From d774e87eca9d33eae819fca7ce24dd76fec6eeb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mathieu?= Date: Wed, 18 Sep 2019 15:27:04 +0200 Subject: [PATCH 1/9] feat: solution for step 2 --- .../bookmarkit/BookmarkResource.java | 20 ++++++++++++++++++- .../loicmathieu/bookmarkit/MyHealCheck.java | 19 ++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100755 bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/MyHealCheck.java diff --git a/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java b/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java index 15f5efd..d1c74f1 100644 --- a/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java +++ b/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java @@ -1,6 +1,9 @@ package fr.loicmathieu.bookmarkit; -import javax.enterprise.context.ApplicationScoped; +import org.eclipse.microprofile.metrics.annotation.Counted; +import org.eclipse.microprofile.metrics.annotation.Timed; +import org.eclipse.microprofile.openapi.annotations.Operation; + import javax.transaction.Transactional; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -21,18 +24,27 @@ public class BookmarkResource { @GET + @Operation(summary = "List all bookmarks") + @Counted(name = "listAll.count") + @Timed(name="listAll.time") public List listAll(){ return Bookmark.listAll(); } @GET @Path("/{id}") + @Operation(summary = "Get a bookmark") + @Counted(name = "get.count") + @Timed(name="get.time") public Bookmark get(@PathParam("id") Long id) { return Bookmark.findById(id); } @POST @Transactional + @Operation(summary = "Create a bookmark") + @Counted(name = "create.count") + @Timed(name="create.time") public Response create(Bookmark bookmark){ bookmark.persist(); return Response.created(URI.create("/bookmarks/" + bookmark.id)).build(); @@ -41,6 +53,9 @@ public Response create(Bookmark bookmark){ @PUT @Path("/{id}") @Transactional + @Operation(summary = "Update a bookmark") + @Counted(name = "update.count") + @Timed(name="update.time") public void update(Bookmark bookmark){ Bookmark existing = Bookmark.findById(bookmark.id); existing.url = bookmark.url; @@ -51,6 +66,9 @@ public void update(Bookmark bookmark){ @DELETE @Path("/{id}") @Transactional + @Operation(summary = "Delete a bookmark") + @Counted(name = "delete.count") + @Timed(name="delete.time") public void delete(@PathParam("id")Long id){ Bookmark existing = Bookmark.findById(id); existing.delete(); diff --git a/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/MyHealCheck.java b/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/MyHealCheck.java new file mode 100755 index 0000000..6806791 --- /dev/null +++ b/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/MyHealCheck.java @@ -0,0 +1,19 @@ +package fr.loicmathieu.bookmarkit; + +import org.eclipse.microprofile.health.Health; +import org.eclipse.microprofile.health.HealthCheck; +import org.eclipse.microprofile.health.HealthCheckResponse; +import org.eclipse.microprofile.health.HealthCheckResponseBuilder; +import org.eclipse.microprofile.health.Readiness; +import org.jboss.resteasy.annotations.LinkHeaderParam; + +import java.lang.annotation.Annotation; + +@Readiness +public class MyHealCheck implements HealthCheck { + + @Override + public HealthCheckResponse call() { + return HealthCheckResponse.builder().name("custom").withData("key", "value").up().build(); + } +} From e3a4afee260d95876c071d39f3149926350429e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mathieu?= Date: Wed, 18 Sep 2019 15:47:02 +0200 Subject: [PATCH 2/9] feat: solution for step 3 --- .../java/fr/loicmathieu/bookmarkit/BookmarkResource.java | 8 ++++++++ .../src/main/resources/application.properties | 3 +++ 2 files changed, 11 insertions(+) diff --git a/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java b/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java index d1c74f1..9bf632c 100644 --- a/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java +++ b/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java @@ -1,9 +1,11 @@ package fr.loicmathieu.bookmarkit; +import org.eclipse.microprofile.config.inject.ConfigProperty; import org.eclipse.microprofile.metrics.annotation.Counted; import org.eclipse.microprofile.metrics.annotation.Timed; import org.eclipse.microprofile.openapi.annotations.Operation; +import javax.annotation.PostConstruct; import javax.transaction.Transactional; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -22,6 +24,12 @@ @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public class BookmarkResource { + @ConfigProperty(name="greeting") String greeting; + + @PostConstruct + void init(){ + System.out.println("Hello " + greeting); + } @GET @Operation(summary = "List all bookmarks") diff --git a/bookmark-service/src/main/resources/application.properties b/bookmark-service/src/main/resources/application.properties index 4747645..10e1519 100644 --- a/bookmark-service/src/main/resources/application.properties +++ b/bookmark-service/src/main/resources/application.properties @@ -6,3 +6,6 @@ quarkus.datasource.password=quarkus # drop and create the database at startup (use `update` to only update the schema) quarkus.hibernate-orm.database.generation=drop-and-create quarkus.hibernate-orm.sql-load-script=import.sql + +greeting=World +%dev.greeting=Dev \ No newline at end of file From 179d2c1400d2537b9a466f038223dfc8e89c6a02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mathieu?= Date: Wed, 18 Sep 2019 17:15:50 +0200 Subject: [PATCH 3/9] feat: solution for step 5 --- bookmark-service/pom.xml | 8 ++++---- .../fr/loicmathieu/bookmarkit/BookmarkResource.java | 7 +++++++ .../src/main/resources/application.properties | 10 +++++++++- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/bookmark-service/pom.xml b/bookmark-service/pom.xml index eb4fd31..dcc0a8c 100644 --- a/bookmark-service/pom.xml +++ b/bookmark-service/pom.xml @@ -51,10 +51,10 @@ quarkus-smallrye-metrics - - - - + + io.quarkus + quarkus-smallrye-reactive-messaging-amqp + diff --git a/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java b/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java index 9bf632c..7e76acc 100644 --- a/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java +++ b/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java @@ -1,11 +1,15 @@ package fr.loicmathieu.bookmarkit; +import io.smallrye.reactive.messaging.annotations.Emitter; +import io.smallrye.reactive.messaging.annotations.Stream; import org.eclipse.microprofile.config.inject.ConfigProperty; import org.eclipse.microprofile.metrics.annotation.Counted; import org.eclipse.microprofile.metrics.annotation.Timed; import org.eclipse.microprofile.openapi.annotations.Operation; +import org.eclipse.microprofile.reactive.messaging.Outgoing; import javax.annotation.PostConstruct; +import javax.inject.Inject; import javax.transaction.Transactional; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -26,6 +30,8 @@ public class BookmarkResource { @ConfigProperty(name="greeting") String greeting; + @Inject @Stream("bookmarks") Emitter emitter; + @PostConstruct void init(){ System.out.println("Hello " + greeting); @@ -55,6 +61,7 @@ public Bookmark get(@PathParam("id") Long id) { @Timed(name="create.time") public Response create(Bookmark bookmark){ bookmark.persist(); + emitter.send(bookmark); return Response.created(URI.create("/bookmarks/" + bookmark.id)).build(); } diff --git a/bookmark-service/src/main/resources/application.properties b/bookmark-service/src/main/resources/application.properties index 10e1519..1920263 100644 --- a/bookmark-service/src/main/resources/application.properties +++ b/bookmark-service/src/main/resources/application.properties @@ -8,4 +8,12 @@ quarkus.hibernate-orm.database.generation=drop-and-create quarkus.hibernate-orm.sql-load-script=import.sql greeting=World -%dev.greeting=Dev \ No newline at end of file +%dev.greeting=Dev + +# Configures the AMQP broker credentials. +amqp-username=quarkus +amqp-password=quarkus +# Configure the AMQP connector to write to the `bookmark` address +mp.messaging.outgoing.bookmarks.connector=smallrye-amqp +mp.messaging.outgoing.bookmarks.address=bookmarks +mp.messaging.outgoing.bookmarks.durable=true \ No newline at end of file From cae2d7d4ae33bbd762e4ce8f6c8d706098720672 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mathieu?= Date: Wed, 2 Oct 2019 16:33:16 +0200 Subject: [PATCH 4/9] feat: solution for step 6 --- bookmark-service/pom.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bookmark-service/pom.xml b/bookmark-service/pom.xml index dcc0a8c..2040299 100644 --- a/bookmark-service/pom.xml +++ b/bookmark-service/pom.xml @@ -57,14 +57,14 @@ - - - - - - - - + + io.quarkus + quarkus-rest-client + + + io.quarkus + quarkus-smallrye-fault-tolerance + From 8282f144d979463bab1649f829ef630a22c6a780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mathieu?= Date: Tue, 17 Sep 2019 18:06:20 +0200 Subject: [PATCH 5/9] feat: solution for step 1 --- .../bookmarkit/BookmarkResource.java | 34 +------------------ 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java b/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java index 7e76acc..2339255 100644 --- a/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java +++ b/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java @@ -1,15 +1,6 @@ package fr.loicmathieu.bookmarkit; -import io.smallrye.reactive.messaging.annotations.Emitter; -import io.smallrye.reactive.messaging.annotations.Stream; -import org.eclipse.microprofile.config.inject.ConfigProperty; -import org.eclipse.microprofile.metrics.annotation.Counted; -import org.eclipse.microprofile.metrics.annotation.Timed; -import org.eclipse.microprofile.openapi.annotations.Operation; -import org.eclipse.microprofile.reactive.messaging.Outgoing; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; +import javax.enterprise.context.ApplicationScoped; import javax.transaction.Transactional; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -30,47 +21,27 @@ public class BookmarkResource { @ConfigProperty(name="greeting") String greeting; - @Inject @Stream("bookmarks") Emitter emitter; - - @PostConstruct - void init(){ - System.out.println("Hello " + greeting); - } - @GET - @Operation(summary = "List all bookmarks") - @Counted(name = "listAll.count") - @Timed(name="listAll.time") public List listAll(){ return Bookmark.listAll(); } @GET @Path("/{id}") - @Operation(summary = "Get a bookmark") - @Counted(name = "get.count") - @Timed(name="get.time") public Bookmark get(@PathParam("id") Long id) { return Bookmark.findById(id); } @POST @Transactional - @Operation(summary = "Create a bookmark") - @Counted(name = "create.count") - @Timed(name="create.time") public Response create(Bookmark bookmark){ bookmark.persist(); - emitter.send(bookmark); return Response.created(URI.create("/bookmarks/" + bookmark.id)).build(); } @PUT @Path("/{id}") @Transactional - @Operation(summary = "Update a bookmark") - @Counted(name = "update.count") - @Timed(name="update.time") public void update(Bookmark bookmark){ Bookmark existing = Bookmark.findById(bookmark.id); existing.url = bookmark.url; @@ -81,9 +52,6 @@ public void update(Bookmark bookmark){ @DELETE @Path("/{id}") @Transactional - @Operation(summary = "Delete a bookmark") - @Counted(name = "delete.count") - @Timed(name="delete.time") public void delete(@PathParam("id")Long id){ Bookmark existing = Bookmark.findById(id); existing.delete(); From c81fd93efe7bed0fa5e334bc59f28ef85953a1bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mathieu?= Date: Wed, 18 Sep 2019 15:27:04 +0200 Subject: [PATCH 6/9] feat: solution for step 2 --- .../bookmarkit/BookmarkResource.java | 20 +++++++++- .../bookmarkit/BookmarkStep2Test.java | 38 +++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 bookmark-service/src/test/java/fr/loicmathieu/bookmarkit/BookmarkStep2Test.java diff --git a/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java b/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java index 2339255..cf7cd08 100644 --- a/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java +++ b/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java @@ -1,6 +1,9 @@ package fr.loicmathieu.bookmarkit; -import javax.enterprise.context.ApplicationScoped; +import org.eclipse.microprofile.metrics.annotation.Counted; +import org.eclipse.microprofile.metrics.annotation.Timed; +import org.eclipse.microprofile.openapi.annotations.Operation; + import javax.transaction.Transactional; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -22,18 +25,27 @@ public class BookmarkResource { @ConfigProperty(name="greeting") String greeting; @GET + @Operation(summary = "List all bookmarks") + @Counted(name = "listAll.count") + @Timed(name="listAll.time") public List listAll(){ return Bookmark.listAll(); } @GET @Path("/{id}") + @Operation(summary = "Get a bookmark") + @Counted(name = "get.count") + @Timed(name="get.time") public Bookmark get(@PathParam("id") Long id) { return Bookmark.findById(id); } @POST @Transactional + @Operation(summary = "Create a bookmark") + @Counted(name = "create.count") + @Timed(name="create.time") public Response create(Bookmark bookmark){ bookmark.persist(); return Response.created(URI.create("/bookmarks/" + bookmark.id)).build(); @@ -42,6 +54,9 @@ public Response create(Bookmark bookmark){ @PUT @Path("/{id}") @Transactional + @Operation(summary = "Update a bookmark") + @Counted(name = "update.count") + @Timed(name="update.time") public void update(Bookmark bookmark){ Bookmark existing = Bookmark.findById(bookmark.id); existing.url = bookmark.url; @@ -52,6 +67,9 @@ public void update(Bookmark bookmark){ @DELETE @Path("/{id}") @Transactional + @Operation(summary = "Delete a bookmark") + @Counted(name = "delete.count") + @Timed(name="delete.time") public void delete(@PathParam("id")Long id){ Bookmark existing = Bookmark.findById(id); existing.delete(); diff --git a/bookmark-service/src/test/java/fr/loicmathieu/bookmarkit/BookmarkStep2Test.java b/bookmark-service/src/test/java/fr/loicmathieu/bookmarkit/BookmarkStep2Test.java new file mode 100644 index 0000000..33dce76 --- /dev/null +++ b/bookmark-service/src/test/java/fr/loicmathieu/bookmarkit/BookmarkStep2Test.java @@ -0,0 +1,38 @@ +package fr.loicmathieu.bookmarkit; + +import io.quarkus.test.junit.QuarkusTest; +import io.restassured.RestAssured; +import io.restassured.parsing.Parser; +import org.hamcrest.CoreMatchers; +import org.junit.jupiter.api.Test; + +import static io.restassured.RestAssured.given; + +@QuarkusTest +public class BookmarkStep2Test { + @Test + public void step2() { + RestAssured.defaultParser = Parser.JSON; + + //check that a summary has been added to the default OpenAPI + given().accept("application/json") + .when().get("/openapi") + .then() + .statusCode(200) + .body("paths.'/bookmarks'.get.summary", CoreMatchers.is(CoreMatchers.notNullValue())); + + //check that metrics exist for each operations + given().accept("application/json") + .when().get("/metrics/application") + .then() + .statusCode(200) + .body("size()", CoreMatchers.is(10)); + + //check that a custom readiness check has been created + given().accept("application/json") + .when().get("/health/ready") + .then() + .statusCode(200) + .body("checks[0].name", CoreMatchers.is("custom")); + } +} From 9a858b6a2397f8faef7538bf95e2e7ba96ad644c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mathieu?= Date: Wed, 18 Sep 2019 15:47:02 +0200 Subject: [PATCH 7/9] feat: solution for step 3 --- .../fr/loicmathieu/bookmarkit/BookmarkResource.java | 7 +++++++ .../src/main/resources/application.properties | 11 +---------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java b/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java index cf7cd08..9bf632c 100644 --- a/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java +++ b/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java @@ -1,9 +1,11 @@ package fr.loicmathieu.bookmarkit; +import org.eclipse.microprofile.config.inject.ConfigProperty; import org.eclipse.microprofile.metrics.annotation.Counted; import org.eclipse.microprofile.metrics.annotation.Timed; import org.eclipse.microprofile.openapi.annotations.Operation; +import javax.annotation.PostConstruct; import javax.transaction.Transactional; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -24,6 +26,11 @@ public class BookmarkResource { @ConfigProperty(name="greeting") String greeting; + @PostConstruct + void init(){ + System.out.println("Hello " + greeting); + } + @GET @Operation(summary = "List all bookmarks") @Counted(name = "listAll.count") diff --git a/bookmark-service/src/main/resources/application.properties b/bookmark-service/src/main/resources/application.properties index 1920263..c4a5f7f 100644 --- a/bookmark-service/src/main/resources/application.properties +++ b/bookmark-service/src/main/resources/application.properties @@ -5,15 +5,6 @@ quarkus.datasource.username=quarkus quarkus.datasource.password=quarkus # drop and create the database at startup (use `update` to only update the schema) quarkus.hibernate-orm.database.generation=drop-and-create -quarkus.hibernate-orm.sql-load-script=import.sql greeting=World -%dev.greeting=Dev - -# Configures the AMQP broker credentials. -amqp-username=quarkus -amqp-password=quarkus -# Configure the AMQP connector to write to the `bookmark` address -mp.messaging.outgoing.bookmarks.connector=smallrye-amqp -mp.messaging.outgoing.bookmarks.address=bookmarks -mp.messaging.outgoing.bookmarks.durable=true \ No newline at end of file +%dev.greeting=Dev \ No newline at end of file From 3978102a9a35741e7f906ea9aaa042a8c2b791f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mathieu?= Date: Wed, 18 Sep 2019 17:15:50 +0200 Subject: [PATCH 8/9] feat: solution for step 5 --- .../fr/loicmathieu/bookmarkit/BookmarkResource.java | 7 +++++++ .../src/main/resources/application.properties | 10 +++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java b/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java index 9bf632c..7e76acc 100644 --- a/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java +++ b/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java @@ -1,11 +1,15 @@ package fr.loicmathieu.bookmarkit; +import io.smallrye.reactive.messaging.annotations.Emitter; +import io.smallrye.reactive.messaging.annotations.Stream; import org.eclipse.microprofile.config.inject.ConfigProperty; import org.eclipse.microprofile.metrics.annotation.Counted; import org.eclipse.microprofile.metrics.annotation.Timed; import org.eclipse.microprofile.openapi.annotations.Operation; +import org.eclipse.microprofile.reactive.messaging.Outgoing; import javax.annotation.PostConstruct; +import javax.inject.Inject; import javax.transaction.Transactional; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -26,6 +30,8 @@ public class BookmarkResource { @ConfigProperty(name="greeting") String greeting; + @Inject @Stream("bookmarks") Emitter emitter; + @PostConstruct void init(){ System.out.println("Hello " + greeting); @@ -55,6 +61,7 @@ public Bookmark get(@PathParam("id") Long id) { @Timed(name="create.time") public Response create(Bookmark bookmark){ bookmark.persist(); + emitter.send(bookmark); return Response.created(URI.create("/bookmarks/" + bookmark.id)).build(); } diff --git a/bookmark-service/src/main/resources/application.properties b/bookmark-service/src/main/resources/application.properties index c4a5f7f..043cb89 100644 --- a/bookmark-service/src/main/resources/application.properties +++ b/bookmark-service/src/main/resources/application.properties @@ -7,4 +7,12 @@ quarkus.datasource.password=quarkus quarkus.hibernate-orm.database.generation=drop-and-create greeting=World -%dev.greeting=Dev \ No newline at end of file +%dev.greeting=Dev + +# Configures the AMQP broker credentials. +amqp-username=quarkus +amqp-password=quarkus +# Configure the AMQP connector to write to the `bookmark` address +mp.messaging.outgoing.bookmarks.connector=smallrye-amqp +mp.messaging.outgoing.bookmarks.address=bookmarks +mp.messaging.outgoing.bookmarks.durable=true \ No newline at end of file From 8a17a79c48eded05be8a6153f201a3a5b2ca10d4 Mon Sep 17 00:00:00 2001 From: Sparow199 Date: Tue, 3 Dec 2019 00:08:49 +0100 Subject: [PATCH 9/9] feat(*): step 6 --- README.md | 2 +- bookmark-message-consumer/pom.xml | 2 +- .../bookmarkit/BookmarkConsumer.java | 7 +- .../bookmarkit/NativeBookmarkConsumerIT.java | 9 --- .../target/classes/application.properties | 8 -- .../compile/default-compile/createdFiles.lst | 1 - bookmark-service/pom.xml | 6 +- .../bookmarkit/AppHealthCheck.java | 14 ++++ .../bookmarkit/BookmarkResource.java | 79 ++++++++++++------- .../java/fr/loicmathieu/bookmarkit/GeoIp.java | 18 +++++ .../loicmathieu/bookmarkit/GeoIpService.java | 18 +++++ .../loicmathieu/bookmarkit/MyHealCheck.java | 19 ----- .../src/main/resources/application.properties | 22 +++--- .../bookmarkit/BookmarkObservabilityTest.java | 2 +- .../bookmarkit/BookmarkStep2Test.java | 38 --------- .../NativeBookmarkObservabilityIT.java | 9 +++ .../bookmarkit/NativeBookmarkResourceIT.java | 10 +++ docker-compose.yml | 4 +- geoip-service/pom.xml | 2 +- .../java/com/lahzouz/bookmarkit/GeoIp.java | 2 - .../com/lahzouz/bookmarkit/GeoIpResource.java | 4 +- .../src/main/resources/application.properties | 1 - .../bookmarkit/NativeGeoIpResourceIT.java | 4 +- 23 files changed, 148 insertions(+), 133 deletions(-) delete mode 100644 bookmark-message-consumer/src/test/java/fr/loicmathieu/bookmarkit/NativeBookmarkConsumerIT.java delete mode 100644 bookmark-message-consumer/target/classes/application.properties delete mode 100644 bookmark-message-consumer/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst create mode 100644 bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/AppHealthCheck.java create mode 100644 bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/GeoIp.java create mode 100644 bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/GeoIpService.java delete mode 100755 bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/MyHealCheck.java delete mode 100644 bookmark-service/src/test/java/fr/loicmathieu/bookmarkit/BookmarkStep2Test.java create mode 100644 bookmark-service/src/test/java/fr/loicmathieu/bookmarkit/NativeBookmarkObservabilityIT.java create mode 100644 bookmark-service/src/test/java/fr/loicmathieu/bookmarkit/NativeBookmarkResourceIT.java diff --git a/README.md b/README.md index 5276c8a..1780d6f 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ Steps: - Add a configuration property inside you `application.properties` file: `greeting=World` - Modify `BookmarkResource` to read this configuration property and log it at startup: - Use `@ConfigProperty` to inject the property inside a `greeting` variable. - - Create a `@PostConstruct` method that log it via `log.info("Hello {}", greeting)` using [SLFJ](https://www.slf4j.org/). + - Create a `@PostConstruct` method that log it via `LOGGER.infof("Hello %s", greeting)` using [Jboss logging](https://docs.jboss.org/jbosslogging/latest/org/jboss/logging/Logger.html). - Test using `mvn quarkus:dev` you should see `Hello World` in the console. - Add a new line to `application.properties` file: `%dev.greeting=Dev` this is an override of the same property for the dev profile. - Test using `mvn quarkus:dev` you should see `Hello Dev` in the console. diff --git a/bookmark-message-consumer/pom.xml b/bookmark-message-consumer/pom.xml index c51bd3d..d458b00 100644 --- a/bookmark-message-consumer/pom.xml +++ b/bookmark-message-consumer/pom.xml @@ -9,7 +9,7 @@ 2.22.0 1.8 1.8 - 0.22.0 + 1.0.1.Final UTF-8 UTF-8 diff --git a/bookmark-message-consumer/src/main/java/fr/loicmathieu/bookmarkit/BookmarkConsumer.java b/bookmark-message-consumer/src/main/java/fr/loicmathieu/bookmarkit/BookmarkConsumer.java index 9b8b758..d74c03e 100644 --- a/bookmark-message-consumer/src/main/java/fr/loicmathieu/bookmarkit/BookmarkConsumer.java +++ b/bookmark-message-consumer/src/main/java/fr/loicmathieu/bookmarkit/BookmarkConsumer.java @@ -1,18 +1,17 @@ package fr.loicmathieu.bookmarkit; import org.eclipse.microprofile.reactive.messaging.Incoming; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.jboss.logging.Logger; import javax.enterprise.context.ApplicationScoped; @ApplicationScoped public class BookmarkConsumer { - private final Logger log = LoggerFactory.getLogger(BookmarkConsumer.class); + private static final Logger LOG = Logger.getLogger(BookmarkConsumer.class); @Incoming("bookmarks") public void process(String bookmark) { - log.info("Indexing a bookmark: {}", bookmark); + LOG.infof("Indexing a bookmark: %s", bookmark); } } diff --git a/bookmark-message-consumer/src/test/java/fr/loicmathieu/bookmarkit/NativeBookmarkConsumerIT.java b/bookmark-message-consumer/src/test/java/fr/loicmathieu/bookmarkit/NativeBookmarkConsumerIT.java deleted file mode 100644 index c92dec8..0000000 --- a/bookmark-message-consumer/src/test/java/fr/loicmathieu/bookmarkit/NativeBookmarkConsumerIT.java +++ /dev/null @@ -1,9 +0,0 @@ -package fr.loicmathieu.bookmarkit; - -import io.quarkus.test.junit.SubstrateTest; - -@SubstrateTest -public class NativeBookmarkConsumerIT extends BookmarkConsumerTest { - - // Execute the same tests but in native mode. -} diff --git a/bookmark-message-consumer/target/classes/application.properties b/bookmark-message-consumer/target/classes/application.properties deleted file mode 100644 index 9dca708..0000000 --- a/bookmark-message-consumer/target/classes/application.properties +++ /dev/null @@ -1,8 +0,0 @@ -quarkus.http.port=8081 - -# Configures the AMQP broker credentials. -amqp-username=quarkus -amqp-password=quarkus -# Configure the AMQP connector to read from the `prices` queue -mp.messaging.incoming.bookmarks.connector=smallrye-amqp -mp.messaging.incoming.bookmarks.durable=true \ No newline at end of file diff --git a/bookmark-message-consumer/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/bookmark-message-consumer/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst deleted file mode 100644 index 9bfd80e..0000000 --- a/bookmark-message-consumer/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +++ /dev/null @@ -1 +0,0 @@ -fr/loicmathieu/bookmarkit/BookmarkConsumer.class diff --git a/bookmark-service/pom.xml b/bookmark-service/pom.xml index 2040299..5f1bb6a 100644 --- a/bookmark-service/pom.xml +++ b/bookmark-service/pom.xml @@ -9,7 +9,7 @@ 2.22.0 1.8 1.8 - 0.26.1 + 1.0.1.Final UTF-8 UTF-8 @@ -42,10 +42,13 @@ io.quarkus quarkus-smallrye-health + io.quarkus quarkus-jdbc-postgresql + + io.quarkus quarkus-smallrye-metrics @@ -79,6 +82,7 @@ rest-assured test + diff --git a/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/AppHealthCheck.java b/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/AppHealthCheck.java new file mode 100644 index 0000000..11cb5bf --- /dev/null +++ b/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/AppHealthCheck.java @@ -0,0 +1,14 @@ +package fr.loicmathieu.bookmarkit; + +import org.eclipse.microprofile.health.HealthCheck; +import org.eclipse.microprofile.health.HealthCheckResponse; +import org.eclipse.microprofile.health.Readiness; + +@Readiness +public class AppHealthCheck implements HealthCheck { + + @Override + public HealthCheckResponse call() { + return HealthCheckResponse.builder().name("bookmark").withData("is", "always").up().build(); + } +} diff --git a/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java b/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java index 7e76acc..4b4433f 100644 --- a/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java +++ b/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/BookmarkResource.java @@ -1,16 +1,19 @@ package fr.loicmathieu.bookmarkit; +import io.smallrye.reactive.messaging.annotations.Channel; import io.smallrye.reactive.messaging.annotations.Emitter; -import io.smallrye.reactive.messaging.annotations.Stream; import org.eclipse.microprofile.config.inject.ConfigProperty; +import org.eclipse.microprofile.faulttolerance.Retry; import org.eclipse.microprofile.metrics.annotation.Counted; import org.eclipse.microprofile.metrics.annotation.Timed; import org.eclipse.microprofile.openapi.annotations.Operation; -import org.eclipse.microprofile.reactive.messaging.Outgoing; +import org.eclipse.microprofile.rest.client.inject.RestClient; +import org.jboss.logging.Logger; import javax.annotation.PostConstruct; -import javax.inject.Inject; +import javax.annotation.PreDestroy; import javax.transaction.Transactional; +import javax.validation.Valid; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; @@ -19,8 +22,10 @@ import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; import java.net.URI; import java.util.List; @@ -28,28 +33,36 @@ @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public class BookmarkResource { - @ConfigProperty(name="greeting") String greeting; - @Inject @Stream("bookmarks") Emitter emitter; + private static final Logger LOG = Logger.getLogger(BookmarkResource.class); + + @ConfigProperty(name = "greeting") + private String greeting; + + @Channel("bookmarks") + private Emitter emitter; + + @RestClient + GeoIpService geoIpService; @PostConstruct - void init(){ - System.out.println("Hello " + greeting); + void init() { + LOG.infof("Hello %s", greeting); } @GET @Operation(summary = "List all bookmarks") @Counted(name = "listAll.count") - @Timed(name="listAll.time") - public List listAll(){ + @Timed(name = "listAll.time") + public List listAll() { return Bookmark.listAll(); } @GET - @Path("/{id}") + @Path("{id}") @Operation(summary = "Get a bookmark") @Counted(name = "get.count") - @Timed(name="get.time") + @Timed(name = "get.time") public Bookmark get(@PathParam("id") Long id) { return Bookmark.findById(id); } @@ -58,34 +71,44 @@ public Bookmark get(@PathParam("id") Long id) { @Transactional @Operation(summary = "Create a bookmark") @Counted(name = "create.count") - @Timed(name="create.time") - public Response create(Bookmark bookmark){ - bookmark.persist(); - emitter.send(bookmark); - return Response.created(URI.create("/bookmarks/" + bookmark.id)).build(); + @Timed(name = "create.time") + @Retry(maxRetries = 2) + public Response create(@Valid Bookmark bookmark) { + GeoIp geoIp = geoIpService.getIpInfos(); + if (geoIp != null) { + bookmark.location = geoIp.city; + bookmark.persist(); + this.emitter.send(bookmark); + return Response.status(Response.Status.CREATED).entity(bookmark).build(); + } else { + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } } @PUT - @Path("/{id}") + @Path("{id}") @Transactional @Operation(summary = "Update a bookmark") @Counted(name = "update.count") - @Timed(name="update.time") - public void update(Bookmark bookmark){ - Bookmark existing = Bookmark.findById(bookmark.id); - existing.url = bookmark.url; - existing.description = bookmark.description; - existing.title = bookmark.title; + @Timed(name = "update.time") + public Response update(@Valid Bookmark bookmark, @PathParam("id") Long id, @Context UriInfo uriInfo) { + Bookmark entity = Bookmark.findById(id); + entity.description = bookmark.description; + entity.location = bookmark.location; + entity.title = bookmark.title; + entity.url = bookmark.url; + return Response.created(URI.create(uriInfo.getPath())).build(); } @DELETE - @Path("/{id}") + @Path("{id}") @Transactional @Operation(summary = "Delete a bookmark") @Counted(name = "delete.count") - @Timed(name="delete.time") - public void delete(@PathParam("id")Long id){ - Bookmark existing = Bookmark.findById(id); - existing.delete(); + @Timed(name = "delete.time") + public Response delete(@PathParam("id") Long id) { + Bookmark bookmark = Bookmark.findById(id); + bookmark.delete(); + return Response.noContent().build(); } } diff --git a/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/GeoIp.java b/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/GeoIp.java new file mode 100644 index 0000000..8ed2ddc --- /dev/null +++ b/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/GeoIp.java @@ -0,0 +1,18 @@ +package fr.loicmathieu.bookmarkit; + +public class GeoIp { + public String query; + public String status; + public String country; + public String countryCode; + public String region; + public String regionName; + public String city; + public String zip; + public Double lat; + public Double lon; + public String timezone; + public String isp; + public String org; + public String as; +} diff --git a/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/GeoIpService.java b/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/GeoIpService.java new file mode 100644 index 0000000..46f9e47 --- /dev/null +++ b/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/GeoIpService.java @@ -0,0 +1,18 @@ +package fr.loicmathieu.bookmarkit; + +import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +@Path("/geoip") +@RegisterRestClient +public interface GeoIpService { + + @GET + @Produces(MediaType.APPLICATION_JSON) + GeoIp getIpInfos(); + +} diff --git a/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/MyHealCheck.java b/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/MyHealCheck.java deleted file mode 100755 index 6806791..0000000 --- a/bookmark-service/src/main/java/fr/loicmathieu/bookmarkit/MyHealCheck.java +++ /dev/null @@ -1,19 +0,0 @@ -package fr.loicmathieu.bookmarkit; - -import org.eclipse.microprofile.health.Health; -import org.eclipse.microprofile.health.HealthCheck; -import org.eclipse.microprofile.health.HealthCheckResponse; -import org.eclipse.microprofile.health.HealthCheckResponseBuilder; -import org.eclipse.microprofile.health.Readiness; -import org.jboss.resteasy.annotations.LinkHeaderParam; - -import java.lang.annotation.Annotation; - -@Readiness -public class MyHealCheck implements HealthCheck { - - @Override - public HealthCheckResponse call() { - return HealthCheckResponse.builder().name("custom").withData("key", "value").up().build(); - } -} diff --git a/bookmark-service/src/main/resources/application.properties b/bookmark-service/src/main/resources/application.properties index 043cb89..2184240 100644 --- a/bookmark-service/src/main/resources/application.properties +++ b/bookmark-service/src/main/resources/application.properties @@ -1,18 +1,18 @@ -# Datasource configuration -quarkus.datasource.url=jdbc:postgresql://localhost:5432/bookmarkit -quarkus.datasource.driver=org.postgresql.Driver -quarkus.datasource.username=quarkus -quarkus.datasource.password=quarkus -# drop and create the database at startup (use `update` to only update the schema) -quarkus.hibernate-orm.database.generation=drop-and-create - -greeting=World +greeting=world %dev.greeting=Dev - +fr.loicmathieu.bookmarkit.GeoIpService/mp-rest/url=http://localhost:8093 # Configures the AMQP broker credentials. amqp-username=quarkus amqp-password=quarkus # Configure the AMQP connector to write to the `bookmark` address mp.messaging.outgoing.bookmarks.connector=smallrye-amqp mp.messaging.outgoing.bookmarks.address=bookmarks -mp.messaging.outgoing.bookmarks.durable=true \ No newline at end of file +mp.messaging.outgoing.bookmarks.durable=true +# Datasource configuration +quarkus.datasource.url=jdbc:postgresql://localhost:5432/bookmarkit +quarkus.datasource.driver=org.postgresql.Driver +quarkus.datasource.username=sarah +quarkus.datasource.password=connor +# drop and create the database at the startup (use `update` to only update the schema) +quarkus.hibernate-orm.database.generation=drop-and-create +quarkus.hibernate-orm.sql-load-script=import.sql diff --git a/bookmark-service/src/test/java/fr/loicmathieu/bookmarkit/BookmarkObservabilityTest.java b/bookmark-service/src/test/java/fr/loicmathieu/bookmarkit/BookmarkObservabilityTest.java index 06ba45f..b152ae1 100644 --- a/bookmark-service/src/test/java/fr/loicmathieu/bookmarkit/BookmarkObservabilityTest.java +++ b/bookmark-service/src/test/java/fr/loicmathieu/bookmarkit/BookmarkObservabilityTest.java @@ -20,7 +20,7 @@ void metricsTest() { .get("/metrics/application") .then() .statusCode(200) - .body("size()", CoreMatchers.is(10)); + .body("size()", CoreMatchers.is(13)); } @Test diff --git a/bookmark-service/src/test/java/fr/loicmathieu/bookmarkit/BookmarkStep2Test.java b/bookmark-service/src/test/java/fr/loicmathieu/bookmarkit/BookmarkStep2Test.java deleted file mode 100644 index 33dce76..0000000 --- a/bookmark-service/src/test/java/fr/loicmathieu/bookmarkit/BookmarkStep2Test.java +++ /dev/null @@ -1,38 +0,0 @@ -package fr.loicmathieu.bookmarkit; - -import io.quarkus.test.junit.QuarkusTest; -import io.restassured.RestAssured; -import io.restassured.parsing.Parser; -import org.hamcrest.CoreMatchers; -import org.junit.jupiter.api.Test; - -import static io.restassured.RestAssured.given; - -@QuarkusTest -public class BookmarkStep2Test { - @Test - public void step2() { - RestAssured.defaultParser = Parser.JSON; - - //check that a summary has been added to the default OpenAPI - given().accept("application/json") - .when().get("/openapi") - .then() - .statusCode(200) - .body("paths.'/bookmarks'.get.summary", CoreMatchers.is(CoreMatchers.notNullValue())); - - //check that metrics exist for each operations - given().accept("application/json") - .when().get("/metrics/application") - .then() - .statusCode(200) - .body("size()", CoreMatchers.is(10)); - - //check that a custom readiness check has been created - given().accept("application/json") - .when().get("/health/ready") - .then() - .statusCode(200) - .body("checks[0].name", CoreMatchers.is("custom")); - } -} diff --git a/bookmark-service/src/test/java/fr/loicmathieu/bookmarkit/NativeBookmarkObservabilityIT.java b/bookmark-service/src/test/java/fr/loicmathieu/bookmarkit/NativeBookmarkObservabilityIT.java new file mode 100644 index 0000000..ea31999 --- /dev/null +++ b/bookmark-service/src/test/java/fr/loicmathieu/bookmarkit/NativeBookmarkObservabilityIT.java @@ -0,0 +1,9 @@ +package fr.loicmathieu.bookmarkit; + +import io.quarkus.test.junit.NativeImageTest; + +@NativeImageTest +class NativeBookmarkObservabilityIT extends BookmarkObservabilityTest { + + // Execute the same tests but in native mode. +} diff --git a/bookmark-service/src/test/java/fr/loicmathieu/bookmarkit/NativeBookmarkResourceIT.java b/bookmark-service/src/test/java/fr/loicmathieu/bookmarkit/NativeBookmarkResourceIT.java new file mode 100644 index 0000000..24f7ff0 --- /dev/null +++ b/bookmark-service/src/test/java/fr/loicmathieu/bookmarkit/NativeBookmarkResourceIT.java @@ -0,0 +1,10 @@ +package fr.loicmathieu.bookmarkit; + +import io.quarkus.test.junit.NativeImageTest; + +@NativeImageTest +class NativeBookmarkResourceIT extends BookmarkResourceTest { + + // Execute the same tests but in native mode. +} + diff --git a/docker-compose.yml b/docker-compose.yml index b34c368..2d865d7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,8 +12,8 @@ services: ports: - "5432:5432" environment: - - POSTGRES_USER=quarkus - - POSTGRES_PASSWORD=quarkus + - POSTGRES_USER=sarah + - POSTGRES_PASSWORD=connor - POSTGRES_DB=bookmarkit artemis: diff --git a/geoip-service/pom.xml b/geoip-service/pom.xml index eb6f13f..71697fb 100644 --- a/geoip-service/pom.xml +++ b/geoip-service/pom.xml @@ -9,7 +9,7 @@ UTF-8 2.22.0 - 0.26.1 + 1.0.1.Final UTF-8 1.8 1.8 diff --git a/geoip-service/src/main/java/com/lahzouz/bookmarkit/GeoIp.java b/geoip-service/src/main/java/com/lahzouz/bookmarkit/GeoIp.java index 4a27385..712e24d 100644 --- a/geoip-service/src/main/java/com/lahzouz/bookmarkit/GeoIp.java +++ b/geoip-service/src/main/java/com/lahzouz/bookmarkit/GeoIp.java @@ -1,7 +1,6 @@ package com.lahzouz.bookmarkit; public class GeoIp { - public String query; public String status; public String country; @@ -16,5 +15,4 @@ public class GeoIp { public String isp; public String org; public String as; - } diff --git a/geoip-service/src/main/java/com/lahzouz/bookmarkit/GeoIpResource.java b/geoip-service/src/main/java/com/lahzouz/bookmarkit/GeoIpResource.java index 22d1449..7aadd58 100644 --- a/geoip-service/src/main/java/com/lahzouz/bookmarkit/GeoIpResource.java +++ b/geoip-service/src/main/java/com/lahzouz/bookmarkit/GeoIpResource.java @@ -18,14 +18,13 @@ public class GeoIpResource { @RestClient - private GeoIpService geoIpService; + GeoIpService geoIpService; private AtomicBoolean fail = new AtomicBoolean(true); private AtomicBoolean failIp = new AtomicBoolean(true); @GET @Produces(MediaType.APPLICATION_JSON) public Response findGeoIpInfo() { - if (fail.compareAndSet(true, false)) { return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).build(); } else { @@ -38,7 +37,6 @@ public Response findGeoIpInfo() { @Path("/{ip}") @Produces(MediaType.APPLICATION_JSON) public Response findGeoIpInfo(@PathParam("ip") String ip) { - if (failIp.compareAndSet(true, false)) { return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).build(); } else { diff --git a/geoip-service/src/main/resources/application.properties b/geoip-service/src/main/resources/application.properties index 7d3f9eb..9016019 100644 --- a/geoip-service/src/main/resources/application.properties +++ b/geoip-service/src/main/resources/application.properties @@ -2,4 +2,3 @@ quarkus.http.port=8093 quarkus.http.test-port=8091 com.lahzouz.bookmarkit.GeoIpService/mp-rest/url=http://ip-api.com -com.lahzouz.bookmarkit.GeoIpService/mp-rest/scope=javax.inject.Singleton diff --git a/geoip-service/src/test/java/com/lahzouz/bookmarkit/NativeGeoIpResourceIT.java b/geoip-service/src/test/java/com/lahzouz/bookmarkit/NativeGeoIpResourceIT.java index 3844a88..b4ea550 100644 --- a/geoip-service/src/test/java/com/lahzouz/bookmarkit/NativeGeoIpResourceIT.java +++ b/geoip-service/src/test/java/com/lahzouz/bookmarkit/NativeGeoIpResourceIT.java @@ -1,8 +1,8 @@ package com.lahzouz.bookmarkit; -import io.quarkus.test.junit.SubstrateTest; +import io.quarkus.test.junit.NativeImageTest; -@SubstrateTest +@NativeImageTest public class NativeGeoIpResourceIT extends GeoIpResourceTest { // Execute the same tests but in native mode.