Skip to content

Commit

Permalink
Update dropwizard and jooq to latest (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
abhrj authored and benjamin-bader committed Aug 16, 2018
1 parent 489a6b5 commit e098c4a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 31 deletions.
24 changes: 4 additions & 20 deletions droptools-example/pom.xml
Expand Up @@ -16,15 +16,15 @@

<properties>
<autovalue.version>1.0-rc1</autovalue.version>
<dropwizard.version>1.0.0</dropwizard.version>
<dropwizard.version>1.3.5</dropwizard.version>
<dropwizard.flyway.version>0.9.2-3</dropwizard.flyway.version>
<dropwizard.jooq.version>${project.parent.version}</dropwizard.jooq.version>
<junit.version>4.12</junit.version>
<mockito.version>1.9.5</mockito.version>
<truth.version>0.23</truth.version>

<flyway.version>4.0.3</flyway.version>
<postgres.jdbc.version>9.3-1101-jdbc41</postgres.jdbc.version>
<postgres.jdbc.version>42.2.4</postgres.jdbc.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -73,7 +73,7 @@
<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>3.4.2</version>
<version>3.11.3</version>

<executions>
<execution>
Expand All @@ -100,29 +100,13 @@
</jdbc>

<generator>
<name>org.jooq.util.DefaultGenerator</name>
<generate>
<deprecated>false</deprecated>
</generate>
<database>
<name>org.jooq.util.postgres.PostgresDatabase</name>
<name>org.jooq.meta.postgres.PostgresDatabase</name>
<includes>.*</includes>
<inputSchema>ex</inputSchema>

<customTypes>
<customType>
<name>DateTime</name>
<type>org.joda.time.DateTime</type>
<converter>com.bendb.dropwizard.jooq.JodaDateTimeConverter</converter>
</customType>
</customTypes>

<forcedTypes>
<forcedType>
<name>DateTime</name>
<types>(?i:timestamp).*</types>
</forcedType>
</forcedTypes>
</database>
<target>
<packageName>com.bendb.example.db</packageName>
Expand Down
Expand Up @@ -4,7 +4,7 @@
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableList;
import io.dropwizard.jackson.JsonSnakeCase;
import org.joda.time.DateTime;
import java.time.OffsetDateTime;

import java.util.List;

Expand All @@ -18,7 +18,7 @@ public abstract class BlogPost {
public abstract String text();

@JsonProperty
public abstract DateTime createdAt();
public abstract OffsetDateTime createdAt();

@JsonProperty
public abstract ImmutableList<String> tags();
Expand All @@ -28,7 +28,7 @@ public abstract class BlogPost {
public static BlogPost create(
int postId,
String text,
DateTime createdAt,
OffsetDateTime createdAt,
List<String> tags) {
return new AutoValue_BlogPost(postId, text, createdAt, immutableCopy(tags));
}
Expand Down
Expand Up @@ -6,7 +6,7 @@
import com.bendb.example.db.tables.records.BlogPostRecord;
import com.bendb.example.db.tables.records.PostTagRecord;
import io.dropwizard.jersey.params.IntParam;
import org.joda.time.DateTime;
import java.time.OffsetDateTime;
import org.jooq.*;
import org.jooq.impl.DSL;
import javax.ws.rs.*;
Expand Down Expand Up @@ -44,12 +44,12 @@ public List<BlogPost> findPostsByTag(@QueryParam("tag") String tag, @JooqInject(
.where(field("id").equal(BLOG_POST.ID)))
.groupBy(BLOG_POST.ID, BLOG_POST.BODY, BLOG_POST.CREATED_AT)
.orderBy(BLOG_POST.CREATED_AT.desc())
.fetch(new RecordMapper<Record4<Integer, String, DateTime, String[]>, BlogPost>() {
.fetch(new RecordMapper<Record4<Integer, String, OffsetDateTime, String[]>, BlogPost>() {
@Override
public BlogPost map(Record4<Integer, String, DateTime, String[]> record) {
public BlogPost map(Record4<Integer, String, OffsetDateTime, String[]> record) {
final Integer postId = record.value1();
final String text = record.value2();
final DateTime createdAt = record.value3();
final OffsetDateTime createdAt = record.value3();
final List<String> tags = Arrays.asList(record.value4());

return BlogPost.create(postId, text, createdAt, tags);
Expand Down Expand Up @@ -96,7 +96,7 @@ public Response run(Configuration configuration) throws Exception {
@GET
@Path("/{id}")
public BlogPost getPost(@PathParam("id") IntParam id, @Context DSLContext create) {
final Record4<Integer, String, DateTime, String[]> record = create
final Record4<Integer, String, OffsetDateTime, String[]> record = create
.select(BLOG_POST.ID, BLOG_POST.BODY, BLOG_POST.CREATED_AT, arrayAgg(POST_TAG.TAG_NAME))
.from(BLOG_POST)
.leftOuterJoin(POST_TAG)
Expand All @@ -111,7 +111,7 @@ public BlogPost getPost(@PathParam("id") IntParam id, @Context DSLContext create

final Integer postId = record.value1();
final String text = record.value2();
final DateTime createdAt = record.value3();
final OffsetDateTime createdAt = record.value3();
final List<String> tags = Arrays.asList(record.value4());

return BlogPost.create(postId, text, createdAt, tags);
Expand Down
2 changes: 1 addition & 1 deletion dropwizard-jooq/pom.xml
Expand Up @@ -19,7 +19,7 @@
<description>Addon bundle for Dropwizard to support jOOQ for database access</description>

<properties>
<jooq.version>3.9.1</jooq.version>
<jooq.version>3.11.3</jooq.version>
</properties>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -55,7 +55,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<dropwizard.version>1.2.0</dropwizard.version>
<dropwizard.version>1.3.5</dropwizard.version>
<coberatura.version>2.7</coberatura.version>

<github.global.server>github</github.global.server>
Expand Down

0 comments on commit e098c4a

Please sign in to comment.