diff --git a/.travis.yml b/.travis.yml index 9a64d06f..a072b1b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,9 +13,10 @@ services: before_script: - psql -c 'create database frameworkeventstore;' -U postgres - psql -c 'create database frameworkviewstore;' -U postgres -- psql -c 'create database frameworkfilestore;' -U postgres +- psql -c 'create database fileservice;' -U postgres - psql -c 'create database frameworksystem;' -U postgres - psql -c "CREATE USER framework WITH PASSWORD 'framework';" -U postgres +- psql -c "CREATE USER fileservice WITH PASSWORD 'fileservice';" -U postgres addons: postgresql: '9.5' sonarcloud: diff --git a/CHANGELOG.md b/CHANGELOG.md index bbb045b0..b1de4638 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ on [Keep a CHANGELOG](http://keepachangelog.com/). This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +### Changed +- Provide capability to deploy in local dev environment +- Reorganise modules and move them to root level ## [17.0.1] - 2023-12-13 ### Changed @@ -89,7 +92,7 @@ on [Keep a CHANGELOG](http://keepachangelog.com/). This project adheres to - Update json-schema-catalog to 1.7.4 ### Changed -- Use a single event-source.yaml in example-event-source module +- Use a single event-source.yaml in cakeshop-event-source module ## [2.0.0-M3] - 2019-05-09 @@ -165,6 +168,6 @@ on [Keep a CHANGELOG](http://keepachangelog.com/). This project adheres to ## [1.0.0] - 2018-11-09 ### Added -- Extracted project from example app in Microservices Framework 5.0.0-M1: https://github.com/CJSCommonPlatform/microservice_framework +- Extracted project from cakeshop app in Microservices Framework 5.0.0-M1: https://github.com/CJSCommonPlatform/microservice_framework diff --git a/Licence.md b/Licence.md index 077e626c..0f2cb281 100644 --- a/Licence.md +++ b/Licence.md @@ -13,7 +13,7 @@ This licence does not affect your freedom under fair dealing or fair use or any You are free to: copy, publish, distribute and transmit the Information; adapt the Information; -exploit the Information commercially and non-commercially for example, by combining it with other Information, or by including it in your own product or application. +exploit the Information commercially and non-commercially for cakeshop, by combining it with other Information, or by including it in your own product or application. You must (where you do any of the above): @@ -56,7 +56,7 @@ Definitions In this licence, the terms below have the following meanings: -'Information' means information protected by copyright or by database right (for example, literary and artistic works, content, data and source code) offered for use under the terms of this licence. +'Information' means information protected by copyright or by database right (for cakeshop, literary and artistic works, content, data and source code) offered for use under the terms of this licence. 'Information Provider' means the person or organisation providing the Information under this licence. diff --git a/README.md b/README.md index be8bdd66..62600d15 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,21 @@ # cake-shop + +## How deployment works? +Unlike other contexts, this cakeshop project uses a different approach as this belong to framework (github). Integration tests of this component gets executed in CI pipeline which runs +in travis. So, to get this working in travis pipeline this component gets deployed to embedded wildfly using maven plugin and then ITs are executed against embedded wildfly instance. +All this is setup through integration-test module's pom.xml. Artemis runs as embedded broker in wildfly. Spinning up embedded wildfly uses random ports approach i.e. free ports are selected by maven plugin +and then those ports are used to spin up required services and this is necessary to avoid port clash with local dev environment, so that there is no requirement to shutdown local dev environment +before running build on this component. There is a separate version of standalone.xml file in integration-test module that is used for embedded wildfly instance + +By running `mvn clean install` basically it builds the project and deploys service war file to embedded wildfly instance and then runs all Integration tests. While running + +One issue with above approach is, it's bit hard to debug any integration tests from IDE (it's not impossible but requires little bit of tweaks to setup process). In order to support +debugging ITs this application can also be deployed to local dev environment using this [script](runIntegrationTests.sh). This script builds application without any tests and deploys service war file to +local dev environment. Until other contexts this script is not going to run any integration tests. Once application is deployed any IT can be run from intellij as normal. + +Port selection switching logic is incorporated in on the test helper class, so that when a test is run from IDE it returns local dev environment ports, but when tests are run through mvn command +it returns random ports that are selected by maven plugin for running the application using embedded wildfly. + + diff --git a/example-context/example-service/example-command/example-command-api/pom.xml b/cakeshop-command/cakeshop-command-api/pom.xml similarity index 90% rename from example-context/example-service/example-command/example-command-api/pom.xml rename to cakeshop-command/cakeshop-command-api/pom.xml index 3df0e27a..0ff4eeda 100644 --- a/example-context/example-service/example-command/example-command-api/pom.xml +++ b/cakeshop-command/cakeshop-command-api/pom.xml @@ -3,13 +3,13 @@ xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - example-command - uk.gov.justice.services.example + cakeshop-command + uk.gov.justice.services.cakeshop 17.0.2-SNAPSHOT 4.0.0 - example-command-api + cakeshop-command-api war @@ -114,8 +114,8 @@ - uk.gov.justice.services.example - example-command-handler + uk.gov.justice.services.cakeshop + cakeshop-command-handler ${project.version} raml @@ -124,6 +124,11 @@ messaging-client-generator ${framework.version} + + javax + javaee-api + 8.0.1 + diff --git a/example-context/example-service/example-command/example-command-api/src/main/java/uk/gov/justice/services/example/cakeshop/command/api/MakeCakeCommandApi.java b/cakeshop-command/cakeshop-command-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/command/api/MakeCakeCommandApi.java similarity index 82% rename from example-context/example-service/example-command/example-command-api/src/main/java/uk/gov/justice/services/example/cakeshop/command/api/MakeCakeCommandApi.java rename to cakeshop-command/cakeshop-command-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/command/api/MakeCakeCommandApi.java index c01e0b4c..172a19c4 100644 --- a/example-context/example-service/example-command/example-command-api/src/main/java/uk/gov/justice/services/example/cakeshop/command/api/MakeCakeCommandApi.java +++ b/cakeshop-command/cakeshop-command-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/command/api/MakeCakeCommandApi.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.command.api; +package uk.gov.justice.services.cakeshop.cakeshop.command.api; import static javax.json.Json.createObjectBuilder; import static uk.gov.justice.services.core.annotation.Component.COMMAND_API; @@ -19,17 +19,17 @@ public class MakeCakeCommandApi { @Inject Sender sender; - @Handles("example.make-cake") + @Handles("cakeshop.make-cake") public Envelope handle(final JsonEnvelope envelope) { sender.send(envelop(envelope.payloadAsJsonObject()) - .withName("example.command.make-cake") + .withName("cakeshop.command.make-cake") .withMetadataFrom(envelope)); return envelop( createObjectBuilder() .add("status", "Making Cake") .build()) - .withName("example.command.make-cake-status") + .withName("cakeshop.command.make-cake-status") .withMetadataFrom(envelope); } } diff --git a/example-context/example-service/example-command/example-command-api/src/main/java/uk/gov/justice/services/example/cakeshop/command/api/OrderCakeCommandApi.java b/cakeshop-command/cakeshop-command-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/command/api/OrderCakeCommandApi.java similarity index 81% rename from example-context/example-service/example-command/example-command-api/src/main/java/uk/gov/justice/services/example/cakeshop/command/api/OrderCakeCommandApi.java rename to cakeshop-command/cakeshop-command-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/command/api/OrderCakeCommandApi.java index e08c50fc..0248d356 100644 --- a/example-context/example-service/example-command/example-command-api/src/main/java/uk/gov/justice/services/example/cakeshop/command/api/OrderCakeCommandApi.java +++ b/cakeshop-command/cakeshop-command-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/command/api/OrderCakeCommandApi.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.command.api; +package uk.gov.justice.services.cakeshop.cakeshop.command.api; import static uk.gov.justice.services.core.annotation.Component.COMMAND_API; import static uk.gov.justice.services.core.enveloper.Enveloper.envelop; @@ -16,11 +16,11 @@ public class OrderCakeCommandApi { @Inject Sender sender; - @Handles("example.order-cake") + @Handles("cakeshop.order-cake") public void orderCake(final JsonEnvelope envelope) { sender.send( envelop(envelope.payloadAsJsonObject()) - .withName("example.command.order-cake") + .withName("cakeshop.command.order-cake") .withMetadataFrom(envelope)); } } diff --git a/example-context/example-service/example-command/example-command-api/src/main/java/uk/gov/justice/services/example/cakeshop/command/api/RecipeCommandApi.java b/cakeshop-command/cakeshop-command-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/command/api/RecipeCommandApi.java similarity index 75% rename from example-context/example-service/example-command/example-command-api/src/main/java/uk/gov/justice/services/example/cakeshop/command/api/RecipeCommandApi.java rename to cakeshop-command/cakeshop-command-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/command/api/RecipeCommandApi.java index f003939f..76b7fef5 100644 --- a/example-context/example-service/example-command/example-command-api/src/main/java/uk/gov/justice/services/example/cakeshop/command/api/RecipeCommandApi.java +++ b/cakeshop-command/cakeshop-command-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/command/api/RecipeCommandApi.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.command.api; +package uk.gov.justice.services.cakeshop.cakeshop.command.api; import static uk.gov.justice.services.core.annotation.Component.COMMAND_API; import static uk.gov.justice.services.core.enveloper.Enveloper.envelop; @@ -22,41 +22,41 @@ public class RecipeCommandApi { @Inject Logger logger; - @Handles("example.add-recipe") + @Handles("cakeshop.add-recipe") public void addRecipe(final JsonEnvelope envelope) { sender.send( envelop(envelope.payloadAsJsonObject()) - .withName("example.command.add-recipe") + .withName("cakeshop.command.add-recipe") .withMetadataFrom(envelope)); } - @Handles("example.add-recipe-v2") + @Handles("cakeshop.add-recipe-v2") @FeatureControl("recipes-have-allergens-specified") public void addRecipeWithAllergenSupport(final JsonEnvelope envelope) { logger.warn("Call to in progress method. Feature 'recipes-have-allergens-specified' is enabled"); } - @Handles("example.rename-recipe") + @Handles("cakeshop.rename-recipe") public void renameRecipe(final JsonEnvelope envelope) { sender.send( envelop(envelope.payloadAsJsonObject()) - .withName("example.command.rename-recipe") + .withName("cakeshop.command.rename-recipe") .withMetadataFrom(envelope)); } - @Handles("example.remove-recipe") + @Handles("cakeshop.remove-recipe") public void removeRecipe(final JsonEnvelope envelope) { sender.send( envelop(envelope.payloadAsJsonObject()) - .withName("example.command.remove-recipe") + .withName("cakeshop.command.remove-recipe") .withMetadataFrom(envelope)); } - @Handles("example.upload-photograph") + @Handles("cakeshop.upload-photograph") public void uploadPhotograph(final JsonEnvelope envelope) { sender.send( envelop(envelope.payloadAsJsonObject()) - .withName("example.command.upload-photograph") + .withName("cakeshop.command.upload-photograph") .withMetadataFrom(envelope)); } } diff --git a/example-context/example-service/example-command/example-command-api/src/main/java/uk/gov/justice/services/example/pojo/CakeOrder.java b/cakeshop-command/cakeshop-command-api/src/main/java/uk/gov/justice/services/cakeshop/pojo/CakeOrder.java similarity index 91% rename from example-context/example-service/example-command/example-command-api/src/main/java/uk/gov/justice/services/example/pojo/CakeOrder.java rename to cakeshop-command/cakeshop-command-api/src/main/java/uk/gov/justice/services/cakeshop/pojo/CakeOrder.java index 1e354ee4..d47cfdd3 100644 --- a/example-context/example-service/example-command/example-command-api/src/main/java/uk/gov/justice/services/example/pojo/CakeOrder.java +++ b/cakeshop-command/cakeshop-command-api/src/main/java/uk/gov/justice/services/cakeshop/pojo/CakeOrder.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.pojo; +package uk.gov.justice.services.cakeshop.pojo; public class CakeOrder { diff --git a/example-context/example-service/example-command/example-command-api/src/main/java/uk/gov/justice/services/example/provider/ExampleCommandApiInterceptorChainProvider.java b/cakeshop-command/cakeshop-command-api/src/main/java/uk/gov/justice/services/cakeshop/provider/CakeshopCommandApiInterceptorChainProvider.java similarity index 82% rename from example-context/example-service/example-command/example-command-api/src/main/java/uk/gov/justice/services/example/provider/ExampleCommandApiInterceptorChainProvider.java rename to cakeshop-command/cakeshop-command-api/src/main/java/uk/gov/justice/services/cakeshop/provider/CakeshopCommandApiInterceptorChainProvider.java index 2df62100..c8222dc1 100644 --- a/example-context/example-service/example-command/example-command-api/src/main/java/uk/gov/justice/services/example/provider/ExampleCommandApiInterceptorChainProvider.java +++ b/cakeshop-command/cakeshop-command-api/src/main/java/uk/gov/justice/services/cakeshop/provider/CakeshopCommandApiInterceptorChainProvider.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.provider; +package uk.gov.justice.services.cakeshop.provider; import static uk.gov.justice.services.core.annotation.Component.COMMAND_API; @@ -10,11 +10,11 @@ import java.util.ArrayList; import java.util.List; -public class ExampleCommandApiInterceptorChainProvider implements InterceptorChainEntryProvider { +public class CakeshopCommandApiInterceptorChainProvider implements InterceptorChainEntryProvider { final List interceptorChainEntries = new ArrayList<>(); - public ExampleCommandApiInterceptorChainProvider() { + public CakeshopCommandApiInterceptorChainProvider() { interceptorChainEntries.add(new InterceptorChainEntry(7000, InputStreamFileInterceptor.class)); interceptorChainEntries.add(new InterceptorChainEntry(8000, FeatureControlInterceptor.class)); } diff --git a/example-context/example-service/example-command/example-command-api/src/main/resources/META-INF/beans.xml b/cakeshop-command/cakeshop-command-api/src/main/resources/META-INF/beans.xml similarity index 100% rename from example-context/example-service/example-command/example-command-api/src/main/resources/META-INF/beans.xml rename to cakeshop-command/cakeshop-command-api/src/main/resources/META-INF/beans.xml diff --git a/example-context/example-service/example-command/example-command-api/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/cakeshop-command/cakeshop-command-api/src/main/webapp/WEB-INF/jboss-deployment-structure.xml similarity index 100% rename from example-context/example-service/example-command/example-command-api/src/main/webapp/WEB-INF/jboss-deployment-structure.xml rename to cakeshop-command/cakeshop-command-api/src/main/webapp/WEB-INF/jboss-deployment-structure.xml diff --git a/cakeshop-command/cakeshop-command-api/src/raml/cakeshop-command-api.raml b/cakeshop-command/cakeshop-command-api/src/raml/cakeshop-command-api.raml new file mode 100644 index 00000000..1247d1c0 --- /dev/null +++ b/cakeshop-command/cakeshop-command-api/src/raml/cakeshop-command-api.raml @@ -0,0 +1,107 @@ +#%RAML 0.8 +title: Cakeshop Command API +baseUri: http://localhost:8080/cakeshop-command-api/command/api/rest/cakeshop +version: v0.1 +mediaType: application/json +protocols: [ HTTP, HTTPS ] + +/recipes/{recipeId}: + description: | + Add a new recipe + post: + description: | + ... + (mapping): + requestType: application/vnd.cakeshop.add-recipe+json + name: cakeshop.add-recipe + (mapping): + requestType: application/vnd.cakeshop.add-recipe-v2+json + name: cakeshop.add-recipe-v2 + (mapping): + requestType: application/vnd.cakeshop.remove-recipe+json + name: cakeshop.remove-recipe + ... + + body: + application/vnd.cakeshop.add-recipe+json: + schema: !include json/schema/cakeshop.add-recipe.json + example: !include json/add-recipe.json + + application/vnd.cakeshop.add-recipe-v2+json: + schema: !include json/schema/cakeshop.add-recipe.json + example: !include json/add-recipe.json + + application/vnd.cakeshop.remove-recipe+json: !!null + + put: + description: | + ... + (mapping): + requestType: application/vnd.cakeshop.rename-recipe+json + name: cakeshop.rename-recipe + ... + + body: + application/vnd.cakeshop.rename-recipe+json: + schema: !include json/schema/cakeshop.rename-recipe.json + example: !include json/rename-recipe.json + + +/recipes/{recipeId}/cakes/{cakeId}: + description: | + Make a cake from id in json + post: + description: | + ... + (mapping): + requestType: application/vnd.cakeshop.make-cake+json + name: cakeshop.make-cake + ... + body: + application/vnd.cakeshop.make-cake+json: + schema: !include json/schema/cakeshop.make-cake.json + example: !include json/make-cake.json + responses: + 202: + body: + application/vnd.cakeshop.make-cake-status+json: + schema: !include json/schema/cakeshop.make-cake-status.json + example: !include json/make-cake-status.json + +/orders/{orderId}: + description: | + Order a cake + post: + description: | + ... + (mapping): + requestType: application/vnd.cakeshop.order-cake+json + name: cakeshop.order-cake + ... + body: + application/vnd.cakeshop.order-cake+json: + schema: !include json/schema/cakeshop.order-cake.json + example: !include json/order-cake.json + +/recipes/{recipeId}/photograph: + post: + description: | + Upload recipe photograph + ... + (mapping): + requestType: multipart/form-data + name: cakeshop.upload-photograph + ... + body: + multipart/form-data: + formParameters: + photoId: + description: Photo of recipe + type: file + responses: + 202: + description: Request accepted + 400: + description: Bad Request + 500: + description: Internal Server Error diff --git a/example-context/example-service/example-command/example-command-api/src/raml/json/add-recipe-file.json b/cakeshop-command/cakeshop-command-api/src/raml/json/add-recipe-file.json similarity index 100% rename from example-context/example-service/example-command/example-command-api/src/raml/json/add-recipe-file.json rename to cakeshop-command/cakeshop-command-api/src/raml/json/add-recipe-file.json diff --git a/example-context/example-service/example-command/example-command-api/src/raml/json/add-recipe-v2.json b/cakeshop-command/cakeshop-command-api/src/raml/json/add-recipe-v2.json similarity index 100% rename from example-context/example-service/example-command/example-command-api/src/raml/json/add-recipe-v2.json rename to cakeshop-command/cakeshop-command-api/src/raml/json/add-recipe-v2.json diff --git a/example-context/example-service/example-command/example-command-api/src/raml/json/add-recipe.json b/cakeshop-command/cakeshop-command-api/src/raml/json/add-recipe.json similarity index 100% rename from example-context/example-service/example-command/example-command-api/src/raml/json/add-recipe.json rename to cakeshop-command/cakeshop-command-api/src/raml/json/add-recipe.json diff --git a/example-context/example-service/example-command/example-command-api/src/raml/json/make-cake-status.json b/cakeshop-command/cakeshop-command-api/src/raml/json/make-cake-status.json similarity index 100% rename from example-context/example-service/example-command/example-command-api/src/raml/json/make-cake-status.json rename to cakeshop-command/cakeshop-command-api/src/raml/json/make-cake-status.json diff --git a/example-context/example-service/example-command/example-command-api/src/raml/json/make-cake.json b/cakeshop-command/cakeshop-command-api/src/raml/json/make-cake.json similarity index 100% rename from example-context/example-service/example-command/example-command-api/src/raml/json/make-cake.json rename to cakeshop-command/cakeshop-command-api/src/raml/json/make-cake.json diff --git a/example-context/example-service/example-command/example-command-api/src/raml/json/order-cake.json b/cakeshop-command/cakeshop-command-api/src/raml/json/order-cake.json similarity index 100% rename from example-context/example-service/example-command/example-command-api/src/raml/json/order-cake.json rename to cakeshop-command/cakeshop-command-api/src/raml/json/order-cake.json diff --git a/example-context/example-service/example-command/example-command-api/src/raml/json/remove-recipe.json b/cakeshop-command/cakeshop-command-api/src/raml/json/remove-recipe.json similarity index 100% rename from example-context/example-service/example-command/example-command-api/src/raml/json/remove-recipe.json rename to cakeshop-command/cakeshop-command-api/src/raml/json/remove-recipe.json diff --git a/example-context/example-service/example-command/example-command-api/src/raml/json/rename-recipe.json b/cakeshop-command/cakeshop-command-api/src/raml/json/rename-recipe.json similarity index 100% rename from example-context/example-service/example-command/example-command-api/src/raml/json/rename-recipe.json rename to cakeshop-command/cakeshop-command-api/src/raml/json/rename-recipe.json diff --git a/example-context/example-service/example-command/example-command-api/src/raml/json/schema/example.add-recipe-file.json b/cakeshop-command/cakeshop-command-api/src/raml/json/schema/cakeshop.add-recipe-file.json similarity index 78% rename from example-context/example-service/example-command/example-command-api/src/raml/json/schema/example.add-recipe-file.json rename to cakeshop-command/cakeshop-command-api/src/raml/json/schema/cakeshop.add-recipe-file.json index 55d3bc82..0b27c43a 100644 --- a/example-context/example-service/example-command/example-command-api/src/raml/json/schema/example.add-recipe-file.json +++ b/cakeshop-command/cakeshop-command-api/src/raml/json/schema/cakeshop.add-recipe-file.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/command/api/example.add-recipe-file.json", + "id": "http://justice.gov.uk/cakeshop/command/api/cakeshop.add-recipe-file.json", "type": "object", "properties": { "fileName": { diff --git a/example-context/example-service/example-command/example-command-api/src/raml/json/schema/example.add-recipe-v2.json b/cakeshop-command/cakeshop-command-api/src/raml/json/schema/cakeshop.add-recipe-v2.json similarity index 93% rename from example-context/example-service/example-command/example-command-api/src/raml/json/schema/example.add-recipe-v2.json rename to cakeshop-command/cakeshop-command-api/src/raml/json/schema/cakeshop.add-recipe-v2.json index e40947a8..90f7ea99 100644 --- a/example-context/example-service/example-command/example-command-api/src/raml/json/schema/example.add-recipe-v2.json +++ b/cakeshop-command/cakeshop-command-api/src/raml/json/schema/cakeshop.add-recipe-v2.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/command/api/example.add-recipe-v2.json", + "id": "http://justice.gov.uk/cakeshop/command/api/cakeshop.add-recipe-v2.json", "type": "object", "properties": { "name": { diff --git a/example-context/example-service/example-command/example-command-api/src/raml/json/schema/example.add-recipe.json b/cakeshop-command/cakeshop-command-api/src/raml/json/schema/cakeshop.add-recipe.json similarity index 92% rename from example-context/example-service/example-command/example-command-api/src/raml/json/schema/example.add-recipe.json rename to cakeshop-command/cakeshop-command-api/src/raml/json/schema/cakeshop.add-recipe.json index ba67ba5d..5ccb138a 100644 --- a/example-context/example-service/example-command/example-command-api/src/raml/json/schema/example.add-recipe.json +++ b/cakeshop-command/cakeshop-command-api/src/raml/json/schema/cakeshop.add-recipe.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/command/api/example.add-recipe.json", + "id": "http://justice.gov.uk/cakeshop/command/api/cakeshop.add-recipe.json", "type": "object", "properties": { "name": { diff --git a/example-context/example-service/example-command/example-command-api/src/raml/json/schema/example.make-cake-status.json b/cakeshop-command/cakeshop-command-api/src/raml/json/schema/cakeshop.make-cake-status.json similarity index 70% rename from example-context/example-service/example-command/example-command-api/src/raml/json/schema/example.make-cake-status.json rename to cakeshop-command/cakeshop-command-api/src/raml/json/schema/cakeshop.make-cake-status.json index 259c0736..931ff08f 100644 --- a/example-context/example-service/example-command/example-command-api/src/raml/json/schema/example.make-cake-status.json +++ b/cakeshop-command/cakeshop-command-api/src/raml/json/schema/cakeshop.make-cake-status.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/command/api/example.make-cake-status.json", + "id": "http://justice.gov.uk/cakeshop/command/api/cakeshop.make-cake-status.json", "type": "object", "properties": { "status": { diff --git a/example-context/example-service/example-command/example-command-api/src/raml/json/schema/example.make-cake.json b/cakeshop-command/cakeshop-command-api/src/raml/json/schema/cakeshop.make-cake.json similarity index 56% rename from example-context/example-service/example-command/example-command-api/src/raml/json/schema/example.make-cake.json rename to cakeshop-command/cakeshop-command-api/src/raml/json/schema/cakeshop.make-cake.json index 55a9c75a..3482d6fe 100644 --- a/example-context/example-service/example-command/example-command-api/src/raml/json/schema/example.make-cake.json +++ b/cakeshop-command/cakeshop-command-api/src/raml/json/schema/cakeshop.make-cake.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/command/api/example.make-cake.json", + "id": "http://justice.gov.uk/cakeshop/command/api/cakeshop.make-cake.json", "type": "object", "properties": { } diff --git a/example-context/example-service/example-command/example-command-api/src/raml/json/schema/example.order-cake.json b/cakeshop-command/cakeshop-command-api/src/raml/json/schema/cakeshop.order-cake.json similarity index 76% rename from example-context/example-service/example-command/example-command-api/src/raml/json/schema/example.order-cake.json rename to cakeshop-command/cakeshop-command-api/src/raml/json/schema/cakeshop.order-cake.json index ede0e1fb..073e854c 100644 --- a/example-context/example-service/example-command/example-command-api/src/raml/json/schema/example.order-cake.json +++ b/cakeshop-command/cakeshop-command-api/src/raml/json/schema/cakeshop.order-cake.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/command/api/example.order-cake.json", + "id": "http://justice.gov.uk/cakeshop/command/api/cakeshop.order-cake.json", "type": "object", "properties": { "recipeId": { diff --git a/example-context/example-service/example-command/example-command-api/src/raml/json/schema/example.remove-recipe.json b/cakeshop-command/cakeshop-command-api/src/raml/json/schema/cakeshop.remove-recipe.json similarity index 54% rename from example-context/example-service/example-command/example-command-api/src/raml/json/schema/example.remove-recipe.json rename to cakeshop-command/cakeshop-command-api/src/raml/json/schema/cakeshop.remove-recipe.json index 8e7d3f62..6d0e7eca 100644 --- a/example-context/example-service/example-command/example-command-api/src/raml/json/schema/example.remove-recipe.json +++ b/cakeshop-command/cakeshop-command-api/src/raml/json/schema/cakeshop.remove-recipe.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/command/api/example.remove-recipe.json", + "id": "http://justice.gov.uk/cakeshop/command/api/cakeshop.remove-recipe.json", "type": "object", "properties": {} } diff --git a/example-context/example-service/example-command/example-command-api/src/raml/json/schema/example.rename-recipe.json b/cakeshop-command/cakeshop-command-api/src/raml/json/schema/cakeshop.rename-recipe.json similarity index 80% rename from example-context/example-service/example-command/example-command-api/src/raml/json/schema/example.rename-recipe.json rename to cakeshop-command/cakeshop-command-api/src/raml/json/schema/cakeshop.rename-recipe.json index 5569ce53..a5efea55 100644 --- a/example-context/example-service/example-command/example-command-api/src/raml/json/schema/example.rename-recipe.json +++ b/cakeshop-command/cakeshop-command-api/src/raml/json/schema/cakeshop.rename-recipe.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/command/api/example.rename-recipe.json", + "id": "http://justice.gov.uk/cakeshop/command/api/cakeshop.rename-recipe.json", "type": "object", "properties": { "name": { diff --git a/example-context/example-service/example-command/example-command-api/src/raml/json/schema/example.upload-photograph.json b/cakeshop-command/cakeshop-command-api/src/raml/json/schema/cakeshop.upload-photograph.json similarity index 85% rename from example-context/example-service/example-command/example-command-api/src/raml/json/schema/example.upload-photograph.json rename to cakeshop-command/cakeshop-command-api/src/raml/json/schema/cakeshop.upload-photograph.json index eb903b24..73588edd 100644 --- a/example-context/example-service/example-command/example-command-api/src/raml/json/schema/example.upload-photograph.json +++ b/cakeshop-command/cakeshop-command-api/src/raml/json/schema/cakeshop.upload-photograph.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/command/api/example.upload-photograph.json", + "id": "http://justice.gov.uk/cakeshop/command/api/cakeshop.upload-photograph.json", "type": "object", "properties": { "recipeId": { diff --git a/example-context/example-service/example-command/example-command-api/src/test/java/uk/gov/justice/services/example/cakeshop/command/api/MakeCakeCommandApiTest.java b/cakeshop-command/cakeshop-command-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/command/api/MakeCakeCommandApiTest.java similarity index 90% rename from example-context/example-service/example-command/example-command-api/src/test/java/uk/gov/justice/services/example/cakeshop/command/api/MakeCakeCommandApiTest.java rename to cakeshop-command/cakeshop-command-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/command/api/MakeCakeCommandApiTest.java index 0cd6f908..2e24a69b 100644 --- a/example-context/example-service/example-command/example-command-api/src/test/java/uk/gov/justice/services/example/cakeshop/command/api/MakeCakeCommandApiTest.java +++ b/cakeshop-command/cakeshop-command-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/command/api/MakeCakeCommandApiTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.command.api; +package uk.gov.justice.services.cakeshop.cakeshop.command.api; import static org.hamcrest.CoreMatchers.is; @@ -42,7 +42,7 @@ public class MakeCakeCommandApiTest { public void shouldHandleMakeCakeCommand() throws Exception { assertThat(MakeCakeCommandApi.class, isHandlerClass(COMMAND_API) .with(method("handle") - .thatHandles("example.make-cake"))); + .thatHandles("cakeshop.make-cake"))); } @Test @@ -51,7 +51,7 @@ public void shouldHandleMakeCakeRequest() { commandApi.sender = sender; final JsonEnvelope envelope = envelope() - .with(metadataWithDefaults().withName("example.make-cake")) + .with(metadataWithDefaults().withName("cakeshop.make-cake")) .withPayloadOf("Field", "Value").build(); final Envelope jsonObjectEnvelope = commandApi.handle(envelope); @@ -59,6 +59,6 @@ public void shouldHandleMakeCakeRequest() { assertThat(jsonObjectEnvelope.payload().getString("status"), equalTo("Making Cake")); verify(sender).send(envelopeCaptor.capture()); - assertThat(envelopeCaptor.getValue().metadata().name(), is("example.command.make-cake")); + assertThat(envelopeCaptor.getValue().metadata().name(), is("cakeshop.command.make-cake")); } } diff --git a/example-context/example-service/example-command/example-command-api/src/test/java/uk/gov/justice/services/example/cakeshop/command/api/OrderCakeCommandApiTest.java b/cakeshop-command/cakeshop-command-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/command/api/OrderCakeCommandApiTest.java similarity index 88% rename from example-context/example-service/example-command/example-command-api/src/test/java/uk/gov/justice/services/example/cakeshop/command/api/OrderCakeCommandApiTest.java rename to cakeshop-command/cakeshop-command-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/command/api/OrderCakeCommandApiTest.java index ddb0d8e3..785b5d4b 100644 --- a/example-context/example-service/example-command/example-command-api/src/test/java/uk/gov/justice/services/example/cakeshop/command/api/OrderCakeCommandApiTest.java +++ b/cakeshop-command/cakeshop-command-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/command/api/OrderCakeCommandApiTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.command.api; +package uk.gov.justice.services.cakeshop.cakeshop.command.api; import static org.hamcrest.CoreMatchers.is; @@ -36,7 +36,7 @@ public class OrderCakeCommandApiTest { public void shouldHandleOrderCakeCommand() throws Exception { assertThat(OrderCakeCommandApi.class, isHandlerClass(COMMAND_API) .with(method("orderCake") - .thatHandles("example.order-cake"))); + .thatHandles("cakeshop.order-cake"))); } @Test @@ -45,12 +45,12 @@ public void shouldHandleOrderCakeRequest() { commandApi.sender = sender; final JsonEnvelope envelope = envelope() - .with(metadataWithDefaults().withName("example.order-cake")) + .with(metadataWithDefaults().withName("cakeshop.order-cake")) .withPayloadOf("Field", "Value").build(); commandApi.orderCake(envelope); verify(sender).send(envelopeCaptor.capture()); - assertThat(envelopeCaptor.getValue().metadata().name(), is("example.command.order-cake")); + assertThat(envelopeCaptor.getValue().metadata().name(), is("cakeshop.command.order-cake")); } } diff --git a/example-context/example-service/example-command/example-command-api/src/test/java/uk/gov/justice/services/example/cakeshop/command/api/RecipeCommandApiTest.java b/cakeshop-command/cakeshop-command-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/command/api/RecipeCommandApiTest.java similarity index 82% rename from example-context/example-service/example-command/example-command-api/src/test/java/uk/gov/justice/services/example/cakeshop/command/api/RecipeCommandApiTest.java rename to cakeshop-command/cakeshop-command-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/command/api/RecipeCommandApiTest.java index 74d13ec7..1785f294 100644 --- a/example-context/example-service/example-command/example-command-api/src/test/java/uk/gov/justice/services/example/cakeshop/command/api/RecipeCommandApiTest.java +++ b/cakeshop-command/cakeshop-command-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/command/api/RecipeCommandApiTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.command.api; +package uk.gov.justice.services.cakeshop.cakeshop.command.api; import static org.hamcrest.CoreMatchers.hasItem; @@ -48,46 +48,46 @@ public class RecipeCommandApiTest { public void shouldHandleRecipeCommands() throws Exception { assertThat(RecipeCommandApi.class, isHandlerClass(COMMAND_API) .with(method("addRecipe") - .thatHandles("example.add-recipe")) + .thatHandles("cakeshop.add-recipe")) .with(method("renameRecipe") - .thatHandles("example.rename-recipe")) + .thatHandles("cakeshop.rename-recipe")) .with(method("removeRecipe") - .thatHandles("example.remove-recipe")) + .thatHandles("cakeshop.remove-recipe")) .with(method("uploadPhotograph") - .thatHandles("example.upload-photograph")) + .thatHandles("cakeshop.upload-photograph")) ); } @Test public void shouldHandleAddRecipeRequest() { - commandApi.addRecipe(buildEnvelopeWith("example.add-recipe")); + commandApi.addRecipe(buildEnvelopeWith("cakeshop.add-recipe")); verify(sender).send(envelopeCaptor.capture()); - assertThat(envelopeCaptor.getValue().metadata().name(), is("example.command.add-recipe")); + assertThat(envelopeCaptor.getValue().metadata().name(), is("cakeshop.command.add-recipe")); } @Test public void shouldHandleRenameRecipeRequest() { - commandApi.renameRecipe(buildEnvelopeWith("example.rename-recipe")); + commandApi.renameRecipe(buildEnvelopeWith("cakeshop.rename-recipe")); verify(sender).send(envelopeCaptor.capture()); - assertThat(envelopeCaptor.getValue().metadata().name(), is("example.command.rename-recipe")); + assertThat(envelopeCaptor.getValue().metadata().name(), is("cakeshop.command.rename-recipe")); } @Test public void shouldHandleRemoveRecipeRequest() { - commandApi.removeRecipe(buildEnvelopeWith("example.remove-recipe")); + commandApi.removeRecipe(buildEnvelopeWith("cakeshop.remove-recipe")); verify(sender).send(envelopeCaptor.capture()); - assertThat(envelopeCaptor.getValue().metadata().name(), is("example.command.remove-recipe")); + assertThat(envelopeCaptor.getValue().metadata().name(), is("cakeshop.command.remove-recipe")); } @Test public void shouldHandleUploadPhotographRequest() { - commandApi.uploadPhotograph(buildEnvelopeWith("example.upload-photograpgh")); + commandApi.uploadPhotograph(buildEnvelopeWith("cakeshop.upload-photograpgh")); verify(sender).send(envelopeCaptor.capture()); - assertThat(envelopeCaptor.getValue().metadata().name(), is("example.command.upload-photograph")); + assertThat(envelopeCaptor.getValue().metadata().name(), is("cakeshop.command.upload-photograph")); } @Test diff --git a/example-context/example-service/example-command/example-command-handler/pom.xml b/cakeshop-command/cakeshop-command-handler/pom.xml similarity index 92% rename from example-context/example-service/example-command/example-command-handler/pom.xml rename to cakeshop-command/cakeshop-command-handler/pom.xml index 9648e39f..8f4bab72 100644 --- a/example-context/example-service/example-command/example-command-handler/pom.xml +++ b/cakeshop-command/cakeshop-command-handler/pom.xml @@ -3,13 +3,13 @@ xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - example-command - uk.gov.justice.services.example + cakeshop-command + uk.gov.justice.services.cakeshop 17.0.2-SNAPSHOT 4.0.0 - example-command-handler + cakeshop-command-handler war @@ -43,8 +43,8 @@ command-handler-interceptors - uk.gov.justice.services.example - example-domain + uk.gov.justice.services.cakeshop + cakeshop-domain ${project.version} diff --git a/example-context/example-service/example-command/example-command-handler/src/main/java/uk/gov/justice/services/example/cakeshop/command/handler/EventFactory.java b/cakeshop-command/cakeshop-command-handler/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/command/handler/EventFactory.java similarity index 80% rename from example-context/example-service/example-command/example-command-handler/src/main/java/uk/gov/justice/services/example/cakeshop/command/handler/EventFactory.java rename to cakeshop-command/cakeshop-command-handler/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/command/handler/EventFactory.java index 92a4191d..2e2489ac 100644 --- a/example-context/example-service/example-command/example-command-handler/src/main/java/uk/gov/justice/services/example/cakeshop/command/handler/EventFactory.java +++ b/cakeshop-command/cakeshop-command-handler/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/command/handler/EventFactory.java @@ -1,7 +1,7 @@ -package uk.gov.justice.services.example.cakeshop.command.handler; +package uk.gov.justice.services.cakeshop.cakeshop.command.handler; -import uk.gov.justice.services.example.cakeshop.domain.event.CakeOrdered; +import uk.gov.justice.services.cakeshop.cakeshop.domain.event.CakeOrdered; import uk.gov.justice.services.messaging.JsonEnvelope; import java.io.IOException; diff --git a/example-context/example-service/example-command/example-command-handler/src/main/java/uk/gov/justice/services/example/cakeshop/command/handler/MakeCakeCommandHandler.java b/cakeshop-command/cakeshop-command-handler/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/command/handler/MakeCakeCommandHandler.java similarity index 90% rename from example-context/example-service/example-command/example-command-handler/src/main/java/uk/gov/justice/services/example/cakeshop/command/handler/MakeCakeCommandHandler.java rename to cakeshop-command/cakeshop-command-handler/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/command/handler/MakeCakeCommandHandler.java index bda2cd87..8f682b59 100644 --- a/example-context/example-service/example-command/example-command-handler/src/main/java/uk/gov/justice/services/example/cakeshop/command/handler/MakeCakeCommandHandler.java +++ b/cakeshop-command/cakeshop-command-handler/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/command/handler/MakeCakeCommandHandler.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.command.handler; +package uk.gov.justice.services.cakeshop.cakeshop.command.handler; import static uk.gov.justice.services.core.annotation.Component.COMMAND_HANDLER; import static uk.gov.justice.services.core.enveloper.Enveloper.toEnvelopeWithMetadataFrom; @@ -11,7 +11,7 @@ import uk.gov.justice.services.eventsourcing.source.core.EventStream; import uk.gov.justice.services.eventsourcing.source.core.Tolerance; import uk.gov.justice.services.eventsourcing.source.core.exception.EventStreamException; -import uk.gov.justice.services.example.cakeshop.domain.aggregate.Recipe; +import uk.gov.justice.services.cakeshop.cakeshop.domain.aggregate.Recipe; import uk.gov.justice.services.messaging.JsonEnvelope; import java.util.UUID; @@ -30,7 +30,7 @@ public class MakeCakeCommandHandler { @Inject AggregateService aggregateService; - @Handles("example.command.make-cake") + @Handles("cakeshop.command.make-cake") public void makeCake(final JsonEnvelope command) throws EventStreamException { final UUID recipeId = getUUID(command.payloadAsJsonObject(), FIELD_RECIPE_ID).get(); diff --git a/example-context/example-service/example-command/example-command-handler/src/main/java/uk/gov/justice/services/example/cakeshop/command/handler/OrderCakeCommandHandler.java b/cakeshop-command/cakeshop-command-handler/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/command/handler/OrderCakeCommandHandler.java similarity index 92% rename from example-context/example-service/example-command/example-command-handler/src/main/java/uk/gov/justice/services/example/cakeshop/command/handler/OrderCakeCommandHandler.java rename to cakeshop-command/cakeshop-command-handler/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/command/handler/OrderCakeCommandHandler.java index ce590904..591330a4 100644 --- a/example-context/example-service/example-command/example-command-handler/src/main/java/uk/gov/justice/services/example/cakeshop/command/handler/OrderCakeCommandHandler.java +++ b/cakeshop-command/cakeshop-command-handler/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/command/handler/OrderCakeCommandHandler.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.command.handler; +package uk.gov.justice.services.cakeshop.cakeshop.command.handler; import static uk.gov.justice.services.core.annotation.Component.COMMAND_HANDLER; import static uk.gov.justice.services.core.enveloper.Enveloper.toEnvelopeWithMetadataFrom; @@ -26,7 +26,7 @@ public class OrderCakeCommandHandler { @Inject EventFactory eventFactory; - @Handles("example.command.order-cake") + @Handles("cakeshop.command.order-cake") public void handle(final JsonEnvelope command) throws EventStreamException { final UUID streamId = UUID.fromString(command.payloadAsJsonObject().getString(FIELD_STREAM_ID)); diff --git a/example-context/example-service/example-command/example-command-handler/src/main/java/uk/gov/justice/services/example/cakeshop/command/handler/RecipeCommandHandler.java b/cakeshop-command/cakeshop-command-handler/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/command/handler/RecipeCommandHandler.java similarity index 92% rename from example-context/example-service/example-command/example-command-handler/src/main/java/uk/gov/justice/services/example/cakeshop/command/handler/RecipeCommandHandler.java rename to cakeshop-command/cakeshop-command-handler/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/command/handler/RecipeCommandHandler.java index f17b66d1..ea0b0993 100644 --- a/example-context/example-service/example-command/example-command-handler/src/main/java/uk/gov/justice/services/example/cakeshop/command/handler/RecipeCommandHandler.java +++ b/cakeshop-command/cakeshop-command-handler/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/command/handler/RecipeCommandHandler.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.command.handler; +package uk.gov.justice.services.cakeshop.cakeshop.command.handler; import static org.slf4j.LoggerFactory.getLogger; import static uk.gov.justice.services.core.annotation.Component.COMMAND_HANDLER; @@ -14,8 +14,8 @@ import uk.gov.justice.services.eventsourcing.source.core.EventStream; import uk.gov.justice.services.eventsourcing.source.core.Tolerance; import uk.gov.justice.services.eventsourcing.source.core.exception.EventStreamException; -import uk.gov.justice.services.example.cakeshop.domain.Ingredient; -import uk.gov.justice.services.example.cakeshop.domain.aggregate.Recipe; +import uk.gov.justice.services.cakeshop.cakeshop.domain.Ingredient; +import uk.gov.justice.services.cakeshop.cakeshop.domain.aggregate.Recipe; import uk.gov.justice.services.messaging.Envelope; import uk.gov.justice.services.messaging.JsonEnvelope; @@ -43,7 +43,7 @@ public class RecipeCommandHandler { @Inject AggregateService aggregateService; - @Handles("example.command.add-recipe") + @Handles("cakeshop.command.add-recipe") public void addRecipe(final JsonEnvelope command) throws EventStreamException { LOGGER.trace("=============> Inside add-recipe Command Handler. RecipeId: " + command.payloadAsJsonObject().getString(FIELD_RECIPE_ID)); @@ -60,7 +60,7 @@ public void addRecipe(final JsonEnvelope command) throws EventStreamException { .map(toEnvelopeWithMetadataFrom(command))); } - @Handles("example.command.rename-recipe") + @Handles("cakeshop.command.rename-recipe") public void renameRecipe(final Envelope command) throws EventStreamException { LOGGER.trace("=============> Inside rename-recipe Command Handler"); @@ -78,7 +78,7 @@ public void renameRecipe(final Envelope command) throws EventStrea } - @Handles("example.command.remove-recipe") + @Handles("cakeshop.command.remove-recipe") public void removeRecipe(final JsonEnvelope command) throws EventStreamException { LOGGER.trace("=============> Inside remove-recipe Command Handler. RecipeId: " + command.payloadAsJsonObject().getString(FIELD_RECIPE_ID)); @@ -92,7 +92,7 @@ public void removeRecipe(final JsonEnvelope command) throws EventStreamException .map(toEnvelopeWithMetadataFrom(command))); } - @Handles("example.command.upload-photograph") + @Handles("cakeshop.command.upload-photograph") public void uploadPhotograph(final JsonEnvelope command) throws EventStreamException { LOGGER.trace("=============> Inside upload-photograph Command Handler. RecipeId: " + command.payloadAsJsonObject().getString(FIELD_RECIPE_ID)); diff --git a/example-context/example-service/example-command/example-command-handler/src/main/java/uk/gov/justice/services/example/cakeshop/command/handler/RenameRecipe.java b/cakeshop-command/cakeshop-command-handler/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/command/handler/RenameRecipe.java similarity index 88% rename from example-context/example-service/example-command/example-command-handler/src/main/java/uk/gov/justice/services/example/cakeshop/command/handler/RenameRecipe.java rename to cakeshop-command/cakeshop-command-handler/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/command/handler/RenameRecipe.java index cedb03cf..4e4a4725 100644 --- a/example-context/example-service/example-command/example-command-handler/src/main/java/uk/gov/justice/services/example/cakeshop/command/handler/RenameRecipe.java +++ b/cakeshop-command/cakeshop-command-handler/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/command/handler/RenameRecipe.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.command.handler; +package uk.gov.justice.services.cakeshop.cakeshop.command.handler; public class RenameRecipe { diff --git a/example-context/example-service/example-command/example-command-handler/src/main/java/uk/gov/justice/services/example/provider/ExampleCommandHandlerInterceptorChainProvider.java b/cakeshop-command/cakeshop-command-handler/src/main/java/uk/gov/justice/services/cakeshop/provider/CakeshopCommandHandlerInterceptorChainProvider.java similarity index 79% rename from example-context/example-service/example-command/example-command-handler/src/main/java/uk/gov/justice/services/example/provider/ExampleCommandHandlerInterceptorChainProvider.java rename to cakeshop-command/cakeshop-command-handler/src/main/java/uk/gov/justice/services/cakeshop/provider/CakeshopCommandHandlerInterceptorChainProvider.java index 57155851..6768e8eb 100644 --- a/example-context/example-service/example-command/example-command-handler/src/main/java/uk/gov/justice/services/example/provider/ExampleCommandHandlerInterceptorChainProvider.java +++ b/cakeshop-command/cakeshop-command-handler/src/main/java/uk/gov/justice/services/cakeshop/provider/CakeshopCommandHandlerInterceptorChainProvider.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.provider; +package uk.gov.justice.services.cakeshop.provider; import static java.lang.Integer.MAX_VALUE; import static uk.gov.justice.services.core.annotation.Component.COMMAND_HANDLER; @@ -10,11 +10,11 @@ import java.util.ArrayList; import java.util.List; -public class ExampleCommandHandlerInterceptorChainProvider implements InterceptorChainEntryProvider { +public class CakeshopCommandHandlerInterceptorChainProvider implements InterceptorChainEntryProvider { private final List interceptorChainEntries = new ArrayList<>(); - public ExampleCommandHandlerInterceptorChainProvider() { + public CakeshopCommandHandlerInterceptorChainProvider() { interceptorChainEntries.add(new InterceptorChainEntry(MAX_VALUE, RetryInterceptor.class)); } diff --git a/example-context/example-service/example-command/example-command-handler/src/main/resources/META-INF/beans.xml b/cakeshop-command/cakeshop-command-handler/src/main/resources/META-INF/beans.xml similarity index 100% rename from example-context/example-service/example-command/example-command-handler/src/main/resources/META-INF/beans.xml rename to cakeshop-command/cakeshop-command-handler/src/main/resources/META-INF/beans.xml diff --git a/example-context/example-service/example-command/example-command-handler/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/cakeshop-command/cakeshop-command-handler/src/main/webapp/WEB-INF/jboss-deployment-structure.xml similarity index 100% rename from example-context/example-service/example-command/example-command-handler/src/main/webapp/WEB-INF/jboss-deployment-structure.xml rename to cakeshop-command/cakeshop-command-handler/src/main/webapp/WEB-INF/jboss-deployment-structure.xml diff --git a/cakeshop-command/cakeshop-command-handler/src/raml/cakeshop-command-handler.messaging.raml b/cakeshop-command/cakeshop-command-handler/src/raml/cakeshop-command-handler.messaging.raml new file mode 100644 index 00000000..5d8893c1 --- /dev/null +++ b/cakeshop-command/cakeshop-command-handler/src/raml/cakeshop-command-handler.messaging.raml @@ -0,0 +1,30 @@ +#%RAML 0.8 +title: API Using media type in the URL +baseUri: message://command/handler/message/cakeshop +version: v1 +/cakeshop.handler.command: + post: + body: + application/vnd.cakeshop.command.add-recipe+json: + schema: !include json/schema/cakeshop.command.add-recipe.json + example: !include json/command.add-recipe.json + + application/vnd.cakeshop.command.remove-recipe+json: + schema: !include json/schema/cakeshop.command.remove-recipe.json + example: !include json/command.remove-recipe.json + + application/vnd.cakeshop.command.make-cake+json: + schema: !include json/schema/cakeshop.command.make-cake.json + example: !include json/command.make-cake.json + + application/vnd.cakeshop.command.order-cake+json: + schema: !include json/schema/cakeshop.command.order-cake.json + example: !include json/command.order-cake.json + + application/vnd.cakeshop.command.rename-recipe+json: + schema: !include json/schema/cakeshop.command.rename-recipe.json + example: !include json/command.rename-recipe.json + + application/vnd.cakeshop.command.upload-photograph+json: + schema: !include json/schema/cakeshop.command.upload-photograph.json + example: !include json/command.upload-photograph.json \ No newline at end of file diff --git a/example-context/example-service/example-command/example-command-handler/src/raml/json/command.add-recipe.json b/cakeshop-command/cakeshop-command-handler/src/raml/json/command.add-recipe.json similarity index 100% rename from example-context/example-service/example-command/example-command-handler/src/raml/json/command.add-recipe.json rename to cakeshop-command/cakeshop-command-handler/src/raml/json/command.add-recipe.json diff --git a/example-context/example-service/example-command/example-command-handler/src/raml/json/command.make-cake.json b/cakeshop-command/cakeshop-command-handler/src/raml/json/command.make-cake.json similarity index 100% rename from example-context/example-service/example-command/example-command-handler/src/raml/json/command.make-cake.json rename to cakeshop-command/cakeshop-command-handler/src/raml/json/command.make-cake.json diff --git a/example-context/example-service/example-command/example-command-handler/src/raml/json/command.order-cake.json b/cakeshop-command/cakeshop-command-handler/src/raml/json/command.order-cake.json similarity index 100% rename from example-context/example-service/example-command/example-command-handler/src/raml/json/command.order-cake.json rename to cakeshop-command/cakeshop-command-handler/src/raml/json/command.order-cake.json diff --git a/example-context/example-service/example-command/example-command-handler/src/raml/json/command.remove-recipe.json b/cakeshop-command/cakeshop-command-handler/src/raml/json/command.remove-recipe.json similarity index 100% rename from example-context/example-service/example-command/example-command-handler/src/raml/json/command.remove-recipe.json rename to cakeshop-command/cakeshop-command-handler/src/raml/json/command.remove-recipe.json diff --git a/example-context/example-service/example-command/example-command-handler/src/raml/json/command.rename-recipe.json b/cakeshop-command/cakeshop-command-handler/src/raml/json/command.rename-recipe.json similarity index 100% rename from example-context/example-service/example-command/example-command-handler/src/raml/json/command.rename-recipe.json rename to cakeshop-command/cakeshop-command-handler/src/raml/json/command.rename-recipe.json diff --git a/example-context/example-service/example-command/example-command-handler/src/raml/json/command.upload-photograph.json b/cakeshop-command/cakeshop-command-handler/src/raml/json/command.upload-photograph.json similarity index 100% rename from example-context/example-service/example-command/example-command-handler/src/raml/json/command.upload-photograph.json rename to cakeshop-command/cakeshop-command-handler/src/raml/json/command.upload-photograph.json diff --git a/example-context/example-service/example-command/example-command-handler/src/raml/json/recipe-photograph-added.json b/cakeshop-command/cakeshop-command-handler/src/raml/json/recipe-photograph-added.json similarity index 100% rename from example-context/example-service/example-command/example-command-handler/src/raml/json/recipe-photograph-added.json rename to cakeshop-command/cakeshop-command-handler/src/raml/json/recipe-photograph-added.json diff --git a/example-context/example-service/example-command/example-command-handler/src/raml/json/recipe-removed.json b/cakeshop-command/cakeshop-command-handler/src/raml/json/recipe-removed.json similarity index 100% rename from example-context/example-service/example-command/example-command-handler/src/raml/json/recipe-removed.json rename to cakeshop-command/cakeshop-command-handler/src/raml/json/recipe-removed.json diff --git a/example-context/example-service/example-command/example-command-handler/src/raml/json/recipe-renamed.json b/cakeshop-command/cakeshop-command-handler/src/raml/json/recipe-renamed.json similarity index 100% rename from example-context/example-service/example-command/example-command-handler/src/raml/json/recipe-renamed.json rename to cakeshop-command/cakeshop-command-handler/src/raml/json/recipe-renamed.json diff --git a/example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.events.recipe-added.json b/cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.command.add-recipe.json similarity index 92% rename from example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.events.recipe-added.json rename to cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.command.add-recipe.json index 2e73637d..d4d12f38 100644 --- a/example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.events.recipe-added.json +++ b/cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.command.add-recipe.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/event/example.events.recipe-added.json", + "id": "http://justice.gov.uk/cakeshop/command/handler/cakeshop.add-recipe.json", "type": "object", "properties": { "recipeId": { diff --git a/example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.command.make-cake.json b/cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.command.make-cake.json similarity index 78% rename from example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.command.make-cake.json rename to cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.command.make-cake.json index e592b685..e273be6e 100644 --- a/example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.command.make-cake.json +++ b/cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.command.make-cake.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/command/handler/example.make-cake.json", + "id": "http://justice.gov.uk/cakeshop/command/handler/cakeshop.make-cake.json", "type": "object", "properties": { "recipeId": { diff --git a/example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.command.order-cake.json b/cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.command.order-cake.json similarity index 79% rename from example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.command.order-cake.json rename to cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.command.order-cake.json index de98c93c..875aa8d3 100644 --- a/example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.command.order-cake.json +++ b/cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.command.order-cake.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/command/handler/example.order-cake.json", + "id": "http://justice.gov.uk/cakeshop/command/handler/cakeshop.order-cake.json", "type": "object", "properties": { "orderId": { diff --git a/example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.command.remove-recipe.json b/cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.command.remove-recipe.json similarity index 68% rename from example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.command.remove-recipe.json rename to cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.command.remove-recipe.json index d95436ef..5a294d50 100644 --- a/example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.command.remove-recipe.json +++ b/cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.command.remove-recipe.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/command/handler/example.remove-recipe.json", + "id": "http://justice.gov.uk/cakeshop/command/handler/cakeshop.remove-recipe.json", "type": "object", "properties": { "recipeId": { diff --git a/example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.events.recipe-renamed.json b/cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.command.rename-recipe.json similarity index 85% rename from example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.events.recipe-renamed.json rename to cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.command.rename-recipe.json index 5452febd..4ea0bf82 100644 --- a/example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.events.recipe-renamed.json +++ b/cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.command.rename-recipe.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/event/example.events.recipe-renamed.json", + "id": "http://justice.gov.uk/cakeshop/command/handler/cakeshop.rename-recipe.json", "type": "object", "properties": { "recipeId": { diff --git a/example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.command.upload-photograph.json b/cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.command.upload-photograph.json similarity index 84% rename from example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.command.upload-photograph.json rename to cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.command.upload-photograph.json index a1c3ba9a..98a88f39 100644 --- a/example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.command.upload-photograph.json +++ b/cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.command.upload-photograph.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/command/handler/example.upload-photograph.json", + "id": "http://justice.gov.uk/cakeshop/command/handler/cakeshop.upload-photograph.json", "type": "object", "properties": { "recipeId": { diff --git a/example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.events.cake-made.json b/cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.events.cake-made.json similarity index 78% rename from example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.events.cake-made.json rename to cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.events.cake-made.json index 39b15140..7ad24518 100644 --- a/example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.events.cake-made.json +++ b/cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.events.cake-made.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/event/example.events.cake-made.json", + "id": "http://justice.gov.uk/cakeshop/event/cakeshop.events.cake-made.json", "type": "object", "properties": { "cakeId": { diff --git a/example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.command.add-recipe.json b/cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.events.recipe-added.json similarity index 93% rename from example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.command.add-recipe.json rename to cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.events.recipe-added.json index 48ce27e1..b7dfa339 100644 --- a/example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.command.add-recipe.json +++ b/cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.events.recipe-added.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/command/handler/example.add-recipe.json", + "id": "http://justice.gov.uk/cakeshop/event/cakeshop.events.recipe-added.json", "type": "object", "properties": { "recipeId": { diff --git a/example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.events.recipe-photograph-added.json b/cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.events.recipe-photograph-added.json similarity index 84% rename from example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.events.recipe-photograph-added.json rename to cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.events.recipe-photograph-added.json index a1148d76..ca3da17e 100644 --- a/example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.events.recipe-photograph-added.json +++ b/cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.events.recipe-photograph-added.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/event/example.events.recipe-photograph-added.json", + "id": "http://justice.gov.uk/cakeshop/event/cakeshop.events.recipe-photograph-added.json", "type": "object", "properties": { "recipeId": { diff --git a/example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.events.recipe-removed.json b/cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.events.recipe-removed.json similarity index 68% rename from example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.events.recipe-removed.json rename to cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.events.recipe-removed.json index e2dc2e0d..59db9975 100644 --- a/example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.events.recipe-removed.json +++ b/cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.events.recipe-removed.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/event/example.events.recipe-removed.json", + "id": "http://justice.gov.uk/cakeshop/event/cakeshop.events.recipe-removed.json", "type": "object", "properties": { "recipeId": { diff --git a/example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.command.rename-recipe.json b/cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.events.recipe-renamed.json similarity index 85% rename from example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.command.rename-recipe.json rename to cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.events.recipe-renamed.json index e26d231c..fde6d9f8 100644 --- a/example-context/example-service/example-command/example-command-handler/src/raml/json/schema/example.command.rename-recipe.json +++ b/cakeshop-command/cakeshop-command-handler/src/raml/json/schema/cakeshop.events.recipe-renamed.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/command/handler/example.rename-recipe.json", + "id": "http://justice.gov.uk/cakeshop/event/cakeshop.events.recipe-renamed.json", "type": "object", "properties": { "recipeId": { diff --git a/cakeshop-command/cakeshop-command-handler/src/raml/private-event.messaging.raml b/cakeshop-command/cakeshop-command-handler/src/raml/private-event.messaging.raml new file mode 100644 index 00000000..2b4a2f7c --- /dev/null +++ b/cakeshop-command/cakeshop-command-handler/src/raml/private-event.messaging.raml @@ -0,0 +1,28 @@ +#%RAML 0.8 +title: API Using media type in the URL +baseUri: message://command/handler/message/cakeshop +version: v1 +/cakeshop.event: + post: + body: + application/vnd.cakeshop.events.recipe-added+json: + schema: !include json/schema/cakeshop.events.recipe-added.json + example: !include json/command.add-recipe.json + + application/vnd.cakeshop.events.recipe-removed+json: + schema: !include json/schema/cakeshop.events.recipe-removed.json + example: !include json/recipe-removed.json + + application/vnd.cakeshop.events.cake-made+json: + schema: !include json/schema/cakeshop.events.cake-made.json + example: !include json/command.make-cake.json + + application/vnd.cakeshop.events.cake-ordered+json: + + application/vnd.cakeshop.events.recipe-renamed+json: + schema: !include json/schema/cakeshop.events.recipe-renamed.json + example: !include json/recipe-renamed.json + + application/vnd.cakeshop.events.recipe-photograph-added+json: + schema: !include json/schema/cakeshop.events.recipe-photograph-added.json + example: !include json/recipe-photograph-added.json \ No newline at end of file diff --git a/example-context/example-service/example-command/example-command-handler/src/test/java/uk/gov/justice/services/example/cakeshop/command/handler/EventFactoryTest.java b/cakeshop-command/cakeshop-command-handler/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/command/handler/EventFactoryTest.java similarity index 94% rename from example-context/example-service/example-command/example-command-handler/src/test/java/uk/gov/justice/services/example/cakeshop/command/handler/EventFactoryTest.java rename to cakeshop-command/cakeshop-command-handler/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/command/handler/EventFactoryTest.java index 319dba3a..a890f571 100644 --- a/example-context/example-service/example-command/example-command-handler/src/test/java/uk/gov/justice/services/example/cakeshop/command/handler/EventFactoryTest.java +++ b/cakeshop-command/cakeshop-command-handler/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/command/handler/EventFactoryTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.command.handler; +package uk.gov.justice.services.cakeshop.cakeshop.command.handler; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; @@ -8,7 +8,7 @@ import static uk.gov.justice.services.test.utils.core.messaging.MetadataBuilderFactory.metadataWithDefaults; import uk.gov.justice.services.common.converter.jackson.ObjectMapperProducer; -import uk.gov.justice.services.example.cakeshop.domain.event.CakeOrdered; +import uk.gov.justice.services.cakeshop.cakeshop.domain.event.CakeOrdered; import java.io.IOException; import java.time.ZoneId; diff --git a/example-context/example-service/example-command/example-command-handler/src/test/java/uk/gov/justice/services/example/cakeshop/command/handler/MakeCakeCommandHandlerTest.java b/cakeshop-command/cakeshop-command-handler/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/command/handler/MakeCakeCommandHandlerTest.java similarity index 90% rename from example-context/example-service/example-command/example-command-handler/src/test/java/uk/gov/justice/services/example/cakeshop/command/handler/MakeCakeCommandHandlerTest.java rename to cakeshop-command/cakeshop-command-handler/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/command/handler/MakeCakeCommandHandlerTest.java index 0f3a1d7d..1f952a09 100644 --- a/example-context/example-service/example-command/example-command-handler/src/test/java/uk/gov/justice/services/example/cakeshop/command/handler/MakeCakeCommandHandlerTest.java +++ b/cakeshop-command/cakeshop-command-handler/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/command/handler/MakeCakeCommandHandlerTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.command.handler; +package uk.gov.justice.services.cakeshop.cakeshop.command.handler; import static com.jayway.jsonpath.matchers.JsonPathMatchers.withJsonPath; import static java.util.Collections.EMPTY_LIST; @@ -24,9 +24,9 @@ import uk.gov.justice.services.core.aggregate.AggregateService; import uk.gov.justice.services.eventsourcing.source.core.EventSource; import uk.gov.justice.services.eventsourcing.source.core.EventStream; -import uk.gov.justice.services.example.cakeshop.domain.aggregate.Recipe; -import uk.gov.justice.services.example.cakeshop.domain.event.CakeMade; -import uk.gov.justice.services.example.cakeshop.domain.event.RecipeAdded; +import uk.gov.justice.services.cakeshop.cakeshop.domain.aggregate.Recipe; +import uk.gov.justice.services.cakeshop.cakeshop.domain.event.CakeMade; +import uk.gov.justice.services.cakeshop.cakeshop.domain.event.RecipeAdded; import uk.gov.justice.services.messaging.JsonEnvelope; import java.util.UUID; @@ -41,8 +41,8 @@ @ExtendWith(MockitoExtension.class) public class MakeCakeCommandHandlerTest { - private static final String COMMAND_NAME = "example.command.make-cake"; - private static final String EVENT_NAME = "example.events.cake-made"; + private static final String COMMAND_NAME = "cakeshop.command.make-cake"; + private static final String EVENT_NAME = "cakeshop.events.cake-made"; private static final UUID CAKE_ID = randomUUID(); private static final UUID RECIPE_ID = randomUUID(); diff --git a/example-context/example-service/example-command/example-command-handler/src/test/java/uk/gov/justice/services/example/cakeshop/command/handler/OrderCakeCommandHandlerTest.java b/cakeshop-command/cakeshop-command-handler/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/command/handler/OrderCakeCommandHandlerTest.java similarity index 93% rename from example-context/example-service/example-command/example-command-handler/src/test/java/uk/gov/justice/services/example/cakeshop/command/handler/OrderCakeCommandHandlerTest.java rename to cakeshop-command/cakeshop-command-handler/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/command/handler/OrderCakeCommandHandlerTest.java index 45273b08..06b4d20b 100644 --- a/example-context/example-service/example-command/example-command-handler/src/test/java/uk/gov/justice/services/example/cakeshop/command/handler/OrderCakeCommandHandlerTest.java +++ b/cakeshop-command/cakeshop-command-handler/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/command/handler/OrderCakeCommandHandlerTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.command.handler; +package uk.gov.justice.services.cakeshop.cakeshop.command.handler; import static com.jayway.jsonpath.matchers.JsonPathMatchers.withJsonPath; import static java.util.UUID.randomUUID; @@ -21,7 +21,7 @@ import uk.gov.justice.services.core.aggregate.AggregateService; import uk.gov.justice.services.eventsourcing.source.core.EventSource; import uk.gov.justice.services.eventsourcing.source.core.EventStream; -import uk.gov.justice.services.example.cakeshop.domain.event.CakeOrdered; +import uk.gov.justice.services.cakeshop.cakeshop.domain.event.CakeOrdered; import uk.gov.justice.services.messaging.JsonEnvelope; import java.time.ZonedDateTime; @@ -37,8 +37,8 @@ @ExtendWith(MockitoExtension.class) public class OrderCakeCommandHandlerTest { - private static final String COMMAND_NAME = "example.command.order-cake"; - private static final String EVENT_NAME = "example.events.cake-ordered"; + private static final String COMMAND_NAME = "cakeshop.command.order-cake"; + private static final String EVENT_NAME = "cakeshop.events.cake-ordered"; private static final UUID RECIPE_ID = randomUUID(); private static final UUID ORDER_ID = randomUUID(); diff --git a/example-context/example-service/example-command/example-command-handler/src/test/java/uk/gov/justice/services/example/cakeshop/command/handler/RecipeCommandHandlerTest.java b/cakeshop-command/cakeshop-command-handler/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/command/handler/RecipeCommandHandlerTest.java similarity index 88% rename from example-context/example-service/example-command/example-command-handler/src/test/java/uk/gov/justice/services/example/cakeshop/command/handler/RecipeCommandHandlerTest.java rename to cakeshop-command/cakeshop-command-handler/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/command/handler/RecipeCommandHandlerTest.java index f947285b..51a78485 100644 --- a/example-context/example-service/example-command/example-command-handler/src/test/java/uk/gov/justice/services/example/cakeshop/command/handler/RecipeCommandHandlerTest.java +++ b/cakeshop-command/cakeshop-command-handler/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/command/handler/RecipeCommandHandlerTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.command.handler; +package uk.gov.justice.services.cakeshop.cakeshop.command.handler; import static com.jayway.jsonpath.matchers.JsonPathMatchers.withJsonPath; import static java.util.Collections.emptyList; @@ -31,11 +31,11 @@ import uk.gov.justice.services.eventsourcing.source.core.EventSource; import uk.gov.justice.services.eventsourcing.source.core.EventStream; import uk.gov.justice.services.eventsourcing.source.core.Tolerance; -import uk.gov.justice.services.example.cakeshop.domain.aggregate.Recipe; -import uk.gov.justice.services.example.cakeshop.domain.event.RecipeAdded; -import uk.gov.justice.services.example.cakeshop.domain.event.RecipePhotographAdded; -import uk.gov.justice.services.example.cakeshop.domain.event.RecipeRemoved; -import uk.gov.justice.services.example.cakeshop.domain.event.RecipeRenamed; +import uk.gov.justice.services.cakeshop.cakeshop.domain.aggregate.Recipe; +import uk.gov.justice.services.cakeshop.cakeshop.domain.event.RecipeAdded; +import uk.gov.justice.services.cakeshop.cakeshop.domain.event.RecipePhotographAdded; +import uk.gov.justice.services.cakeshop.cakeshop.domain.event.RecipeRemoved; +import uk.gov.justice.services.cakeshop.cakeshop.domain.event.RecipeRenamed; import uk.gov.justice.services.messaging.Envelope; import uk.gov.justice.services.messaging.JsonEnvelope; @@ -51,13 +51,13 @@ @ExtendWith(MockitoExtension.class) public class RecipeCommandHandlerTest { - private static final String ADD_RECIPE_COMMAND_NAME = "example.command.add-recipe"; - private static final String ADD_RECIPE_EVENT_NAME = "example.events.recipe-added"; - private static final String RENAME_RECIPE_COMMAND_NAME = "example.command.rename-recipe"; - private static final String RENAME_RECIPE_EVENT_NAME = "example.events.recipe-renamed"; - private static final String REMOVE_RECIPE_COMMAND_NAME = "example.command.remove-recipe"; - private static final String REMOVE_RECIPE_EVENT_NAME = "example.events.recipe-removed"; - private static final String RECIPE_PHOTOGRAPH_ADDED_EVENT_NAME = "example.events.recipe-photograph-added"; + private static final String ADD_RECIPE_COMMAND_NAME = "cakeshop.command.add-recipe"; + private static final String ADD_RECIPE_EVENT_NAME = "cakeshop.events.recipe-added"; + private static final String RENAME_RECIPE_COMMAND_NAME = "cakeshop.command.rename-recipe"; + private static final String RENAME_RECIPE_EVENT_NAME = "cakeshop.events.recipe-renamed"; + private static final String REMOVE_RECIPE_COMMAND_NAME = "cakeshop.command.remove-recipe"; + private static final String REMOVE_RECIPE_EVENT_NAME = "cakeshop.events.recipe-removed"; + private static final String RECIPE_PHOTOGRAPH_ADDED_EVENT_NAME = "cakeshop.events.recipe-photograph-added"; private static final UUID RECIPE_ID = randomUUID(); private static final UUID PHOTO_ID = randomUUID(); @@ -84,7 +84,7 @@ public void setup() throws Exception { @Test public void shouldHaveCorrectHandlesAnnotation() throws Exception { assertThat(recipeCommandHandler, isHandler(COMMAND_HANDLER) - .with(method("addRecipe").thatHandles("example.command.add-recipe"))); + .with(method("addRecipe").thatHandles("cakeshop.command.add-recipe"))); } @Test @@ -188,7 +188,7 @@ public void shouldHandleUploadPhotographCommand() throws Exception { final UUID commandId = randomUUID(); final JsonEnvelope command = envelopeFrom( - metadataOf(commandId, "example.upload-photograph"), + metadataOf(commandId, "cakeshop.upload-photograph"), createObjectBuilder() .add("recipeId", RECIPE_ID.toString()) .add("photoId", PHOTO_ID.toString()) diff --git a/example-context/example-service/example-command/example-command-handler/src/test/java/uk/gov/justice/services/example/cakeshop/domain/aggregate/RecipeTest.java b/cakeshop-command/cakeshop-command-handler/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/domain/aggregate/RecipeTest.java similarity index 90% rename from example-context/example-service/example-command/example-command-handler/src/test/java/uk/gov/justice/services/example/cakeshop/domain/aggregate/RecipeTest.java rename to cakeshop-command/cakeshop-command-handler/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/domain/aggregate/RecipeTest.java index d69cd22c..b59fdc66 100644 --- a/example-context/example-service/example-command/example-command-handler/src/test/java/uk/gov/justice/services/example/cakeshop/domain/aggregate/RecipeTest.java +++ b/cakeshop-command/cakeshop-command-handler/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/domain/aggregate/RecipeTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.domain.aggregate; +package uk.gov.justice.services.cakeshop.cakeshop.domain.aggregate; import static java.util.Collections.singletonList; import static java.util.stream.Collectors.toList; @@ -11,11 +11,11 @@ import static org.junit.jupiter.api.Assertions.fail; import static org.mockito.Mockito.mock; -import uk.gov.justice.services.example.cakeshop.domain.Ingredient; -import uk.gov.justice.services.example.cakeshop.domain.event.CakeMade; -import uk.gov.justice.services.example.cakeshop.domain.event.RecipeAdded; -import uk.gov.justice.services.example.cakeshop.domain.event.RecipeRemoved; -import uk.gov.justice.services.example.cakeshop.domain.event.RecipeRenamed; +import uk.gov.justice.services.cakeshop.cakeshop.domain.Ingredient; +import uk.gov.justice.services.cakeshop.cakeshop.domain.event.CakeMade; +import uk.gov.justice.services.cakeshop.cakeshop.domain.event.RecipeAdded; +import uk.gov.justice.services.cakeshop.cakeshop.domain.event.RecipeRemoved; +import uk.gov.justice.services.cakeshop.cakeshop.domain.event.RecipeRenamed; import java.util.List; import java.util.UUID; diff --git a/example-context/example-service/example-command/pom.xml b/cakeshop-command/pom.xml similarity index 63% rename from example-context/example-service/example-command/pom.xml rename to cakeshop-command/pom.xml index faecae1c..16401974 100644 --- a/example-context/example-service/example-command/pom.xml +++ b/cakeshop-command/pom.xml @@ -3,17 +3,17 @@ xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - example-service - uk.gov.justice.services.example + uk.gov.justice.services.cakeshop + cake-shop-parent 17.0.2-SNAPSHOT 4.0.0 - example-command + cakeshop-command pom - example-command-api - example-command-handler + cakeshop-command-api + cakeshop-command-handler diff --git a/example-context/example-service/example-custom/example-custom-api/pom.xml b/cakeshop-custom/cakeshop-custom-api/pom.xml similarity index 94% rename from example-context/example-service/example-custom/example-custom-api/pom.xml rename to cakeshop-custom/cakeshop-custom-api/pom.xml index 06e1e76a..88085a42 100644 --- a/example-context/example-service/example-custom/example-custom-api/pom.xml +++ b/cakeshop-custom/cakeshop-custom-api/pom.xml @@ -3,13 +3,13 @@ xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - example-custom - uk.gov.justice.services.example + cakeshop-custom + uk.gov.justice.services.cakeshop 17.0.2-SNAPSHOT 4.0.0 - example-custom-api + cakeshop-custom-api war diff --git a/example-context/example-service/example-custom/example-custom-api/src/main/java/uk/gov/justice/services/example/cakeshop/custom/api/OvenCustomApi.java b/cakeshop-custom/cakeshop-custom-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/custom/api/OvenCustomApi.java similarity index 71% rename from example-context/example-service/example-custom/example-custom-api/src/main/java/uk/gov/justice/services/example/cakeshop/custom/api/OvenCustomApi.java rename to cakeshop-custom/cakeshop-custom-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/custom/api/OvenCustomApi.java index 29df1b14..bf54c45e 100644 --- a/example-context/example-service/example-custom/example-custom-api/src/main/java/uk/gov/justice/services/example/cakeshop/custom/api/OvenCustomApi.java +++ b/cakeshop-custom/cakeshop-custom-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/custom/api/OvenCustomApi.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.custom.api; +package uk.gov.justice.services.cakeshop.cakeshop.custom.api; import static java.util.Arrays.asList; import static java.util.UUID.randomUUID; @@ -6,15 +6,15 @@ import uk.gov.justice.services.core.annotation.CustomServiceComponent; import uk.gov.justice.services.core.annotation.Handles; -import uk.gov.justice.services.example.cakeshop.custom.api.response.OvenStatus; -import uk.gov.justice.services.example.cakeshop.custom.api.response.OvensStatus; +import uk.gov.justice.services.cakeshop.cakeshop.custom.api.response.OvenStatus; +import uk.gov.justice.services.cakeshop.cakeshop.custom.api.response.OvensStatus; import uk.gov.justice.services.messaging.Envelope; import uk.gov.justice.services.messaging.JsonEnvelope; @CustomServiceComponent("CUSTOM_API") public class OvenCustomApi { - @Handles("example.ovens-status") + @Handles("cakeshop.ovens-status") public Envelope status(final JsonEnvelope query) { final OvensStatus status = new OvensStatus(asList( @@ -22,7 +22,7 @@ public Envelope status(final JsonEnvelope query) { new OvenStatus(randomUUID(), "Large Oven", 0, false))); return envelop(status) - .withName("example.ovens-status") + .withName("cakeshop.ovens-status") .withMetadataFrom(query); } } diff --git a/example-context/example-service/example-custom/example-custom-api/src/main/java/uk/gov/justice/services/example/cakeshop/custom/api/response/OvenStatus.java b/cakeshop-custom/cakeshop-custom-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/custom/api/response/OvenStatus.java similarity index 90% rename from example-context/example-service/example-custom/example-custom-api/src/main/java/uk/gov/justice/services/example/cakeshop/custom/api/response/OvenStatus.java rename to cakeshop-custom/cakeshop-custom-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/custom/api/response/OvenStatus.java index 76b45e05..64ac1d2e 100644 --- a/example-context/example-service/example-custom/example-custom-api/src/main/java/uk/gov/justice/services/example/cakeshop/custom/api/response/OvenStatus.java +++ b/cakeshop-custom/cakeshop-custom-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/custom/api/response/OvenStatus.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.custom.api.response; +package uk.gov.justice.services.cakeshop.cakeshop.custom.api.response; import java.util.UUID; diff --git a/example-context/example-service/example-custom/example-custom-api/src/main/java/uk/gov/justice/services/example/cakeshop/custom/api/response/OvensStatus.java b/cakeshop-custom/cakeshop-custom-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/custom/api/response/OvensStatus.java similarity index 78% rename from example-context/example-service/example-custom/example-custom-api/src/main/java/uk/gov/justice/services/example/cakeshop/custom/api/response/OvensStatus.java rename to cakeshop-custom/cakeshop-custom-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/custom/api/response/OvensStatus.java index f1c8c4ce..1bc4424b 100644 --- a/example-context/example-service/example-custom/example-custom-api/src/main/java/uk/gov/justice/services/example/cakeshop/custom/api/response/OvensStatus.java +++ b/cakeshop-custom/cakeshop-custom-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/custom/api/response/OvensStatus.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.custom.api.response; +package uk.gov.justice.services.cakeshop.cakeshop.custom.api.response; import java.util.List; diff --git a/example-context/example-service/example-custom/example-custom-api/src/main/java/uk/gov/justice/services/example/provider/ExampleCustomApiInterceptorChainProvider.java b/cakeshop-custom/cakeshop-custom-api/src/main/java/uk/gov/justice/services/cakeshop/provider/CakeshopCustomApiInterceptorChainProvider.java similarity index 73% rename from example-context/example-service/example-custom/example-custom-api/src/main/java/uk/gov/justice/services/example/provider/ExampleCustomApiInterceptorChainProvider.java rename to cakeshop-custom/cakeshop-custom-api/src/main/java/uk/gov/justice/services/cakeshop/provider/CakeshopCustomApiInterceptorChainProvider.java index 13021afa..5b9dc758 100644 --- a/example-context/example-service/example-custom/example-custom-api/src/main/java/uk/gov/justice/services/example/provider/ExampleCustomApiInterceptorChainProvider.java +++ b/cakeshop-custom/cakeshop-custom-api/src/main/java/uk/gov/justice/services/cakeshop/provider/CakeshopCustomApiInterceptorChainProvider.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.provider; +package uk.gov.justice.services.cakeshop.provider; import static java.util.Collections.emptyList; @@ -8,7 +8,7 @@ import java.util.List; -public class ExampleCustomApiInterceptorChainProvider implements InterceptorChainEntryProvider { +public class CakeshopCustomApiInterceptorChainProvider implements InterceptorChainEntryProvider { @Override public String component() { diff --git a/example-context/example-service/example-custom/example-custom-api/src/main/resources/META-INF/beans.xml b/cakeshop-custom/cakeshop-custom-api/src/main/resources/META-INF/beans.xml similarity index 100% rename from example-context/example-service/example-custom/example-custom-api/src/main/resources/META-INF/beans.xml rename to cakeshop-custom/cakeshop-custom-api/src/main/resources/META-INF/beans.xml diff --git a/example-context/example-service/example-custom/example-custom-api/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/cakeshop-custom/cakeshop-custom-api/src/main/webapp/WEB-INF/jboss-deployment-structure.xml similarity index 100% rename from example-context/example-service/example-custom/example-custom-api/src/main/webapp/WEB-INF/jboss-deployment-structure.xml rename to cakeshop-custom/cakeshop-custom-api/src/main/webapp/WEB-INF/jboss-deployment-structure.xml diff --git a/example-context/example-service/example-custom/example-custom-api/src/raml/example-custom-api.raml b/cakeshop-custom/cakeshop-custom-api/src/raml/cakeshop-custom-api.raml similarity index 51% rename from example-context/example-service/example-custom/example-custom-api/src/raml/example-custom-api.raml rename to cakeshop-custom/cakeshop-custom-api/src/raml/cakeshop-custom-api.raml index 606b6b2e..5b919d43 100644 --- a/example-context/example-service/example-custom/example-custom-api/src/raml/example-custom-api.raml +++ b/cakeshop-custom/cakeshop-custom-api/src/raml/cakeshop-custom-api.raml @@ -1,6 +1,6 @@ #%RAML 0.8 title: Cakeshop Query -baseUri: http://localhost:8080/example-custom-api/custom/api/rest/cakeshop +baseUri: http://localhost:8080/cakeshop-custom-api/custom/api/rest/cakeshop version: v0.1 mediaType: application/json protocols: [ HTTP, HTTPS ] @@ -11,12 +11,12 @@ protocols: [ HTTP, HTTPS ] description: | ... (mapping): - responseType: application/vnd.example.status+json - name: example.ovens-status + responseType: application/vnd.cakeshop.status+json + name: cakeshop.ovens-status ... responses: 200: body: - application/vnd.example.status+json: - schema: !include json/schema/example.ovens-status.json + application/vnd.cakeshop.status+json: + schema: !include json/schema/cakeshop.ovens-status.json example: !include json/ovens-status.json diff --git a/example-context/example-service/example-custom/example-custom-api/src/raml/json/ovens-status.json b/cakeshop-custom/cakeshop-custom-api/src/raml/json/ovens-status.json similarity index 100% rename from example-context/example-service/example-custom/example-custom-api/src/raml/json/ovens-status.json rename to cakeshop-custom/cakeshop-custom-api/src/raml/json/ovens-status.json diff --git a/example-context/example-service/example-custom/example-custom-api/src/raml/json/schema/example.ovens-status.json b/cakeshop-custom/cakeshop-custom-api/src/raml/json/schema/cakeshop.ovens-status.json similarity index 89% rename from example-context/example-service/example-custom/example-custom-api/src/raml/json/schema/example.ovens-status.json rename to cakeshop-custom/cakeshop-custom-api/src/raml/json/schema/cakeshop.ovens-status.json index 1ff49c4a..e9016723 100644 --- a/example-context/example-service/example-custom/example-custom-api/src/raml/json/schema/example.ovens-status.json +++ b/cakeshop-custom/cakeshop-custom-api/src/raml/json/schema/cakeshop.ovens-status.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/custom/example.ovens-status.json", + "id": "http://justice.gov.uk/cakeshop/custom/cakeshop.ovens-status.json", "object": { "id": "ovens", "type": "array", diff --git a/example-context/example-service/example-custom/example-custom-api/src/test/java/uk/gov/justice/services/example/cakeshop/custom/api/OvenCustomApiTest.java b/cakeshop-custom/cakeshop-custom-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/custom/api/OvenCustomApiTest.java similarity index 84% rename from example-context/example-service/example-custom/example-custom-api/src/test/java/uk/gov/justice/services/example/cakeshop/custom/api/OvenCustomApiTest.java rename to cakeshop-custom/cakeshop-custom-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/custom/api/OvenCustomApiTest.java index 17f9dad6..f145bdd6 100644 --- a/example-context/example-service/example-custom/example-custom-api/src/test/java/uk/gov/justice/services/example/cakeshop/custom/api/OvenCustomApiTest.java +++ b/cakeshop-custom/cakeshop-custom-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/custom/api/OvenCustomApiTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.custom.api; +package uk.gov.justice.services.cakeshop.cakeshop.custom.api; import static java.util.UUID.randomUUID; import static org.hamcrest.CoreMatchers.is; @@ -9,8 +9,8 @@ import static uk.gov.justice.services.test.utils.core.messaging.JsonEnvelopeBuilder.envelope; import static uk.gov.justice.services.test.utils.core.messaging.MetadataBuilderFactory.metadataOf; -import uk.gov.justice.services.example.cakeshop.custom.api.response.OvenStatus; -import uk.gov.justice.services.example.cakeshop.custom.api.response.OvensStatus; +import uk.gov.justice.services.cakeshop.cakeshop.custom.api.response.OvenStatus; +import uk.gov.justice.services.cakeshop.cakeshop.custom.api.response.OvensStatus; import uk.gov.justice.services.messaging.Envelope; import uk.gov.justice.services.messaging.JsonEnvelope; @@ -30,13 +30,13 @@ public class OvenCustomApiTest { @Test public void shouldHandleOvenStatus() throws Exception { assertThat(OvenCustomApi.class, isCustomHandlerClass("CUSTOM_API") - .with(method("status").thatHandles("example.ovens-status"))); + .with(method("status").thatHandles("cakeshop.ovens-status"))); } @Test public void shouldReturnStatusOfAllOvens() throws Exception { final JsonEnvelope query = envelope().with( - metadataOf(randomUUID(), "example.ovens-status")) + metadataOf(randomUUID(), "cakeshop.ovens-status")) .build(); final Envelope status = ovenCustomApi.status(query); diff --git a/example-context/example-service/example-custom/example-custom-api/src/test/java/uk/gov/justice/services/example/cakeshop/custom/api/response/OvenStatusTest.java b/cakeshop-custom/cakeshop-custom-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/custom/api/response/OvenStatusTest.java similarity index 91% rename from example-context/example-service/example-custom/example-custom-api/src/test/java/uk/gov/justice/services/example/cakeshop/custom/api/response/OvenStatusTest.java rename to cakeshop-custom/cakeshop-custom-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/custom/api/response/OvenStatusTest.java index 5ec88373..67bcd967 100644 --- a/example-context/example-service/example-custom/example-custom-api/src/test/java/uk/gov/justice/services/example/cakeshop/custom/api/response/OvenStatusTest.java +++ b/cakeshop-custom/cakeshop-custom-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/custom/api/response/OvenStatusTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.custom.api.response; +package uk.gov.justice.services.cakeshop.cakeshop.custom.api.response; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; diff --git a/example-context/example-service/example-custom/example-custom-api/src/test/java/uk/gov/justice/services/example/cakeshop/custom/api/response/OvensStatusTest.java b/cakeshop-custom/cakeshop-custom-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/custom/api/response/OvensStatusTest.java similarity index 86% rename from example-context/example-service/example-custom/example-custom-api/src/test/java/uk/gov/justice/services/example/cakeshop/custom/api/response/OvensStatusTest.java rename to cakeshop-custom/cakeshop-custom-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/custom/api/response/OvensStatusTest.java index d53be1fe..29c100b2 100644 --- a/example-context/example-service/example-custom/example-custom-api/src/test/java/uk/gov/justice/services/example/cakeshop/custom/api/response/OvensStatusTest.java +++ b/cakeshop-custom/cakeshop-custom-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/custom/api/response/OvensStatusTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.custom.api.response; +package uk.gov.justice.services.cakeshop.cakeshop.custom.api.response; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; diff --git a/example-context/example-service/example-custom/pom.xml b/cakeshop-custom/pom.xml similarity index 68% rename from example-context/example-service/example-custom/pom.xml rename to cakeshop-custom/pom.xml index 1297f111..d95233cd 100644 --- a/example-context/example-service/example-custom/pom.xml +++ b/cakeshop-custom/pom.xml @@ -3,17 +3,17 @@ xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - example-service - uk.gov.justice.services.example + cake-shop-parent + uk.gov.justice.services.cakeshop 17.0.2-SNAPSHOT 4.0.0 - example-custom + cakeshop-custom pom - example-custom-api + cakeshop-custom-api diff --git a/example-context/example-domain/pom.xml b/cakeshop-domain/pom.xml similarity index 82% rename from example-context/example-domain/pom.xml rename to cakeshop-domain/pom.xml index 9a62e7fa..7e69b2d8 100644 --- a/example-context/example-domain/pom.xml +++ b/cakeshop-domain/pom.xml @@ -3,13 +3,13 @@ xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - example-context - uk.gov.justice.services.example + uk.gov.justice.services.cakeshop + cake-shop-parent 17.0.2-SNAPSHOT 4.0.0 - example-domain + cakeshop-domain diff --git a/example-context/example-domain/src/main/java/uk/gov/justice/services/example/cakeshop/domain/Ingredient.java b/cakeshop-domain/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/domain/Ingredient.java similarity index 85% rename from example-context/example-domain/src/main/java/uk/gov/justice/services/example/cakeshop/domain/Ingredient.java rename to cakeshop-domain/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/domain/Ingredient.java index 37ffbd6f..60fe0cb1 100644 --- a/example-context/example-domain/src/main/java/uk/gov/justice/services/example/cakeshop/domain/Ingredient.java +++ b/cakeshop-domain/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/domain/Ingredient.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.domain; +package uk.gov.justice.services.cakeshop.cakeshop.domain; public class Ingredient { diff --git a/example-context/example-domain/src/main/java/uk/gov/justice/services/example/cakeshop/domain/aggregate/Order.java b/cakeshop-domain/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/domain/aggregate/Order.java similarity index 87% rename from example-context/example-domain/src/main/java/uk/gov/justice/services/example/cakeshop/domain/aggregate/Order.java rename to cakeshop-domain/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/domain/aggregate/Order.java index 39393b46..95052e34 100644 --- a/example-context/example-domain/src/main/java/uk/gov/justice/services/example/cakeshop/domain/aggregate/Order.java +++ b/cakeshop-domain/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/domain/aggregate/Order.java @@ -1,11 +1,11 @@ -package uk.gov.justice.services.example.cakeshop.domain.aggregate; +package uk.gov.justice.services.cakeshop.cakeshop.domain.aggregate; import static uk.gov.justice.domain.aggregate.condition.Precondition.assertPrecondition; import static uk.gov.justice.domain.aggregate.matcher.EventSwitcher.match; import static uk.gov.justice.domain.aggregate.matcher.EventSwitcher.when; import uk.gov.justice.domain.aggregate.Aggregate; -import uk.gov.justice.services.example.cakeshop.domain.event.CakeOrdered; +import uk.gov.justice.services.cakeshop.cakeshop.domain.event.CakeOrdered; import java.time.ZonedDateTime; import java.util.UUID; diff --git a/example-context/example-domain/src/main/java/uk/gov/justice/services/example/cakeshop/domain/aggregate/Recipe.java b/cakeshop-domain/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/domain/aggregate/Recipe.java similarity index 82% rename from example-context/example-domain/src/main/java/uk/gov/justice/services/example/cakeshop/domain/aggregate/Recipe.java rename to cakeshop-domain/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/domain/aggregate/Recipe.java index f331da9f..13da8dad 100644 --- a/example-context/example-domain/src/main/java/uk/gov/justice/services/example/cakeshop/domain/aggregate/Recipe.java +++ b/cakeshop-domain/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/domain/aggregate/Recipe.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.domain.aggregate; +package uk.gov.justice.services.cakeshop.cakeshop.domain.aggregate; import static uk.gov.justice.domain.aggregate.condition.Precondition.assertPrecondition; import static uk.gov.justice.domain.aggregate.matcher.EventSwitcher.doNothing; @@ -6,12 +6,12 @@ import static uk.gov.justice.domain.aggregate.matcher.EventSwitcher.when; import uk.gov.justice.domain.aggregate.Aggregate; -import uk.gov.justice.services.example.cakeshop.domain.Ingredient; -import uk.gov.justice.services.example.cakeshop.domain.event.CakeMade; -import uk.gov.justice.services.example.cakeshop.domain.event.RecipeAdded; -import uk.gov.justice.services.example.cakeshop.domain.event.RecipePhotographAdded; -import uk.gov.justice.services.example.cakeshop.domain.event.RecipeRemoved; -import uk.gov.justice.services.example.cakeshop.domain.event.RecipeRenamed; +import uk.gov.justice.services.cakeshop.cakeshop.domain.Ingredient; +import uk.gov.justice.services.cakeshop.cakeshop.domain.event.CakeMade; +import uk.gov.justice.services.cakeshop.cakeshop.domain.event.RecipeAdded; +import uk.gov.justice.services.cakeshop.cakeshop.domain.event.RecipePhotographAdded; +import uk.gov.justice.services.cakeshop.cakeshop.domain.event.RecipeRemoved; +import uk.gov.justice.services.cakeshop.cakeshop.domain.event.RecipeRenamed; import java.util.List; import java.util.UUID; diff --git a/example-context/example-domain/src/main/java/uk/gov/justice/services/example/cakeshop/domain/event/CakeMade.java b/cakeshop-domain/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/domain/event/CakeMade.java similarity index 80% rename from example-context/example-domain/src/main/java/uk/gov/justice/services/example/cakeshop/domain/event/CakeMade.java rename to cakeshop-domain/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/domain/event/CakeMade.java index 51d0c071..7a612e44 100644 --- a/example-context/example-domain/src/main/java/uk/gov/justice/services/example/cakeshop/domain/event/CakeMade.java +++ b/cakeshop-domain/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/domain/event/CakeMade.java @@ -1,10 +1,10 @@ -package uk.gov.justice.services.example.cakeshop.domain.event; +package uk.gov.justice.services.cakeshop.cakeshop.domain.event; import uk.gov.justice.domain.annotation.Event; import java.util.UUID; -@Event("example.events.cake-made") +@Event("cakeshop.events.cake-made") public class CakeMade { private final UUID cakeId; diff --git a/example-context/example-domain/src/main/java/uk/gov/justice/services/example/cakeshop/domain/event/CakeOrdered.java b/cakeshop-domain/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/domain/event/CakeOrdered.java similarity index 86% rename from example-context/example-domain/src/main/java/uk/gov/justice/services/example/cakeshop/domain/event/CakeOrdered.java rename to cakeshop-domain/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/domain/event/CakeOrdered.java index 9ea4cd31..e978fb71 100644 --- a/example-context/example-domain/src/main/java/uk/gov/justice/services/example/cakeshop/domain/event/CakeOrdered.java +++ b/cakeshop-domain/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/domain/event/CakeOrdered.java @@ -1,11 +1,11 @@ -package uk.gov.justice.services.example.cakeshop.domain.event; +package uk.gov.justice.services.cakeshop.cakeshop.domain.event; import uk.gov.justice.domain.annotation.Event; import java.time.ZonedDateTime; import java.util.UUID; -@Event("example.events.cake-ordered") +@Event("cakeshop.events.cake-ordered") public class CakeOrdered { private final UUID orderId; diff --git a/example-context/example-domain/src/main/java/uk/gov/justice/services/example/cakeshop/domain/event/RecipeAdded.java b/cakeshop-domain/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/domain/event/RecipeAdded.java similarity index 82% rename from example-context/example-domain/src/main/java/uk/gov/justice/services/example/cakeshop/domain/event/RecipeAdded.java rename to cakeshop-domain/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/domain/event/RecipeAdded.java index 3949bd7f..e2f6e665 100644 --- a/example-context/example-domain/src/main/java/uk/gov/justice/services/example/cakeshop/domain/event/RecipeAdded.java +++ b/cakeshop-domain/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/domain/event/RecipeAdded.java @@ -1,12 +1,12 @@ -package uk.gov.justice.services.example.cakeshop.domain.event; +package uk.gov.justice.services.cakeshop.cakeshop.domain.event; import uk.gov.justice.domain.annotation.Event; -import uk.gov.justice.services.example.cakeshop.domain.Ingredient; +import uk.gov.justice.services.cakeshop.cakeshop.domain.Ingredient; import java.util.List; import java.util.UUID; -@Event("example.events.recipe-added") +@Event("cakeshop.events.recipe-added") public class RecipeAdded { private final UUID recipeId; diff --git a/example-context/example-domain/src/main/java/uk/gov/justice/services/example/cakeshop/domain/event/RecipePhotographAdded.java b/cakeshop-domain/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/domain/event/RecipePhotographAdded.java similarity index 79% rename from example-context/example-domain/src/main/java/uk/gov/justice/services/example/cakeshop/domain/event/RecipePhotographAdded.java rename to cakeshop-domain/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/domain/event/RecipePhotographAdded.java index 2d08a9ad..5d2deb4c 100644 --- a/example-context/example-domain/src/main/java/uk/gov/justice/services/example/cakeshop/domain/event/RecipePhotographAdded.java +++ b/cakeshop-domain/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/domain/event/RecipePhotographAdded.java @@ -1,10 +1,10 @@ -package uk.gov.justice.services.example.cakeshop.domain.event; +package uk.gov.justice.services.cakeshop.cakeshop.domain.event; import uk.gov.justice.domain.annotation.Event; import java.util.UUID; -@Event("example.events.recipe-photograph-added") +@Event("cakeshop.events.recipe-photograph-added") public class RecipePhotographAdded { private final UUID recipeId; diff --git a/example-context/example-domain/src/main/java/uk/gov/justice/services/example/cakeshop/domain/event/RecipeRemoved.java b/cakeshop-domain/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/domain/event/RecipeRemoved.java similarity index 73% rename from example-context/example-domain/src/main/java/uk/gov/justice/services/example/cakeshop/domain/event/RecipeRemoved.java rename to cakeshop-domain/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/domain/event/RecipeRemoved.java index 72dcb789..55b53180 100644 --- a/example-context/example-domain/src/main/java/uk/gov/justice/services/example/cakeshop/domain/event/RecipeRemoved.java +++ b/cakeshop-domain/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/domain/event/RecipeRemoved.java @@ -1,10 +1,10 @@ -package uk.gov.justice.services.example.cakeshop.domain.event; +package uk.gov.justice.services.cakeshop.cakeshop.domain.event; import uk.gov.justice.domain.annotation.Event; import java.util.UUID; -@Event("example.events.recipe-removed") +@Event("cakeshop.events.recipe-removed") public class RecipeRemoved { private final UUID recipeId; diff --git a/example-context/example-domain/src/main/java/uk/gov/justice/services/example/cakeshop/domain/event/RecipeRenamed.java b/cakeshop-domain/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/domain/event/RecipeRenamed.java similarity index 80% rename from example-context/example-domain/src/main/java/uk/gov/justice/services/example/cakeshop/domain/event/RecipeRenamed.java rename to cakeshop-domain/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/domain/event/RecipeRenamed.java index cd200423..593e04a1 100644 --- a/example-context/example-domain/src/main/java/uk/gov/justice/services/example/cakeshop/domain/event/RecipeRenamed.java +++ b/cakeshop-domain/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/domain/event/RecipeRenamed.java @@ -1,10 +1,10 @@ -package uk.gov.justice.services.example.cakeshop.domain.event; +package uk.gov.justice.services.cakeshop.cakeshop.domain.event; import uk.gov.justice.domain.annotation.Event; import java.util.UUID; -@Event("example.events.recipe-renamed") +@Event("cakeshop.events.recipe-renamed") public class RecipeRenamed { private final UUID recipeId; diff --git a/example-context/example-domain/src/main/resources/META-INF/beans.xml b/cakeshop-domain/src/main/resources/META-INF/beans.xml similarity index 100% rename from example-context/example-domain/src/main/resources/META-INF/beans.xml rename to cakeshop-domain/src/main/resources/META-INF/beans.xml diff --git a/example-context/example-service/example-event-source/pom.xml b/cakeshop-event-source/pom.xml similarity index 93% rename from example-context/example-service/example-event-source/pom.xml rename to cakeshop-event-source/pom.xml index 11aa587a..a7369c4e 100644 --- a/example-context/example-service/example-event-source/pom.xml +++ b/cakeshop-event-source/pom.xml @@ -3,13 +3,13 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - example-service - uk.gov.justice.services.example + cake-shop-parent + uk.gov.justice.services.cakeshop 17.0.2-SNAPSHOT 4.0.0 - example-event-source + cakeshop-event-source diff --git a/cakeshop-event-source/src/yaml/event-sources.yaml b/cakeshop-event-source/src/yaml/event-sources.yaml new file mode 100644 index 00000000..4a4bec84 --- /dev/null +++ b/cakeshop-event-source/src/yaml/event-sources.yaml @@ -0,0 +1,11 @@ +event_sources: + - name: cakeshop + is_default: true + location: + jms_uri: jms:topic:cakeshop.event + rest_uri: http://localhost:8080/cakeshop/event-source-api/rest + data_source: java:/app/cakeshop-service/DS.eventstore + + - name: public.event.source + location: + jms_uri: jms:topic:public.event \ No newline at end of file diff --git a/example-context/example-service/example-event/example-event-indexer/pom.xml b/cakeshop-event/cakeshop-event-indexer/pom.xml similarity index 90% rename from example-context/example-service/example-event/example-event-indexer/pom.xml rename to cakeshop-event/cakeshop-event-indexer/pom.xml index 4b91a6e6..349b4606 100644 --- a/example-context/example-service/example-event/example-event-indexer/pom.xml +++ b/cakeshop-event/cakeshop-event-indexer/pom.xml @@ -3,13 +3,13 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - example-event - uk.gov.justice.services.example + cakeshop-event + uk.gov.justice.services.cakeshop 17.0.2-SNAPSHOT 4.0.0 - example-event-indexer + cakeshop-event-indexer war @@ -76,13 +76,13 @@ provided - uk.gov.justice.services.example - example-persistence + uk.gov.justice.services.cakeshop + cakeshop-viewstore-persistence ${project.version} - uk.gov.justice.services.example - example-domain + uk.gov.justice.services.cakeshop + cakeshop-domain ${project.version} diff --git a/example-context/example-service/example-event/example-event-indexer/src/main/java/uk/gov/justice/services/example/cakeshop/dummy/DummyUnifiedSearchIndexer.java b/cakeshop-event/cakeshop-event-indexer/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/dummy/DummyUnifiedSearchIndexer.java similarity index 81% rename from example-context/example-service/example-event/example-event-indexer/src/main/java/uk/gov/justice/services/example/cakeshop/dummy/DummyUnifiedSearchIndexer.java rename to cakeshop-event/cakeshop-event-indexer/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/dummy/DummyUnifiedSearchIndexer.java index 7ad81099..652c7b8e 100644 --- a/example-context/example-service/example-event/example-event-indexer/src/main/java/uk/gov/justice/services/example/cakeshop/dummy/DummyUnifiedSearchIndexer.java +++ b/cakeshop-event/cakeshop-event-indexer/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/dummy/DummyUnifiedSearchIndexer.java @@ -1,9 +1,9 @@ -package uk.gov.justice.services.example.cakeshop.dummy; +package uk.gov.justice.services.cakeshop.cakeshop.dummy; import static java.util.UUID.fromString; -import uk.gov.justice.services.example.cakeshop.persistence.IndexRepository; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Index; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.IndexRepository; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Index; import uk.gov.justice.services.messaging.Envelope; import uk.gov.justice.services.unifiedsearch.UnifiedSearchIndexer; diff --git a/example-context/example-service/example-event/example-event-indexer/src/main/java/uk/gov/justice/services/example/cakeshop/dummy/DummyUnifiedSearchIndexerProducer.java b/cakeshop-event/cakeshop-event-indexer/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/dummy/DummyUnifiedSearchIndexerProducer.java similarity index 91% rename from example-context/example-service/example-event/example-event-indexer/src/main/java/uk/gov/justice/services/example/cakeshop/dummy/DummyUnifiedSearchIndexerProducer.java rename to cakeshop-event/cakeshop-event-indexer/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/dummy/DummyUnifiedSearchIndexerProducer.java index e83b326c..e3976a9f 100644 --- a/example-context/example-service/example-event/example-event-indexer/src/main/java/uk/gov/justice/services/example/cakeshop/dummy/DummyUnifiedSearchIndexerProducer.java +++ b/cakeshop-event/cakeshop-event-indexer/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/dummy/DummyUnifiedSearchIndexerProducer.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.dummy; +package uk.gov.justice.services.cakeshop.cakeshop.dummy; import uk.gov.justice.services.unifiedsearch.UnifiedSearchIndexer; import uk.gov.justice.services.unifiedsearch.UnifiedSearchName; diff --git a/example-context/example-service/example-event/example-event-indexer/src/main/resources/META-INF/beans.xml b/cakeshop-event/cakeshop-event-indexer/src/main/resources/META-INF/beans.xml similarity index 100% rename from example-context/example-service/example-event/example-event-indexer/src/main/resources/META-INF/beans.xml rename to cakeshop-event/cakeshop-event-indexer/src/main/resources/META-INF/beans.xml diff --git a/example-context/example-service/example-event/example-event-indexer/src/transformer/cake-ordered-spec.json b/cakeshop-event/cakeshop-event-indexer/src/transformer/cake-ordered-spec.json similarity index 100% rename from example-context/example-service/example-event/example-event-indexer/src/transformer/cake-ordered-spec.json rename to cakeshop-event/cakeshop-event-indexer/src/transformer/cake-ordered-spec.json diff --git a/cakeshop-event/cakeshop-event-indexer/src/yaml/subscriptions-descriptor.yaml b/cakeshop-event/cakeshop-event-indexer/src/yaml/subscriptions-descriptor.yaml new file mode 100644 index 00000000..64945b18 --- /dev/null +++ b/cakeshop-event/cakeshop-event-indexer/src/yaml/subscriptions-descriptor.yaml @@ -0,0 +1,12 @@ +subscriptions_descriptor: + spec_version: 1.0.0 + service: cakeshop + service_component: EVENT_INDEXER + subscriptions: + - name: event indexer subscription + events: + - name: cakeshop.events.cake-ordered + schema_uri: http://justice.gov.uk/cakeshop/event/listener/cakeshop.events.cake-ordered.json + event_source_name: cakeshop + + diff --git a/example-context/example-service/example-event/example-event-indexer/src/yaml/unified-search-descriptor.yaml b/cakeshop-event/cakeshop-event-indexer/src/yaml/unified-search-descriptor.yaml similarity index 68% rename from example-context/example-service/example-event/example-event-indexer/src/yaml/unified-search-descriptor.yaml rename to cakeshop-event/cakeshop-event-indexer/src/yaml/unified-search-descriptor.yaml index 9d7139ad..3141feb1 100644 --- a/example-context/example-service/example-event/example-event-indexer/src/yaml/unified-search-descriptor.yaml +++ b/cakeshop-event/cakeshop-event-indexer/src/yaml/unified-search-descriptor.yaml @@ -1,10 +1,10 @@ unified_search_descriptor: - name: example + name: cakeshop spec_version: 1.0.0 - service: examplecontext + service: cakeshopcontext service_component: EVENT_INDEXER events: - - name: example.events.cake-ordered + - name: cakeshop.events.cake-ordered transformer_config: cake-ordered-spec.json index_name: crime_case_index ... \ No newline at end of file diff --git a/example-context/example-service/example-event/example-event-listener/pom.xml b/cakeshop-event/cakeshop-event-listener/pom.xml similarity index 89% rename from example-context/example-service/example-event/example-event-listener/pom.xml rename to cakeshop-event/cakeshop-event-listener/pom.xml index 59c49663..393fcf11 100644 --- a/example-context/example-service/example-event/example-event-listener/pom.xml +++ b/cakeshop-event/cakeshop-event-listener/pom.xml @@ -3,13 +3,13 @@ xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - example-event - uk.gov.justice.services.example + cakeshop-event + uk.gov.justice.services.cakeshop 17.0.2-SNAPSHOT 4.0.0 - example-event-listener + cakeshop-event-listener war @@ -60,13 +60,13 @@ provided - uk.gov.justice.services.example - example-persistence + uk.gov.justice.services.cakeshop + cakeshop-viewstore-persistence ${project.version} - uk.gov.justice.services.example - example-domain + uk.gov.justice.services.cakeshop + cakeshop-domain ${project.version} diff --git a/example-context/example-service/example-event/example-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/CakeMadeEventListener.java b/cakeshop-event/cakeshop-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/CakeMadeEventListener.java similarity index 73% rename from example-context/example-service/example-event/example-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/CakeMadeEventListener.java rename to cakeshop-event/cakeshop-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/CakeMadeEventListener.java index 93f0868f..80cca156 100644 --- a/example-context/example-service/example-event/example-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/CakeMadeEventListener.java +++ b/cakeshop-event/cakeshop-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/CakeMadeEventListener.java @@ -1,10 +1,10 @@ -package uk.gov.justice.services.example.cakeshop.event.listener; +package uk.gov.justice.services.cakeshop.cakeshop.event.listener; import uk.gov.justice.services.core.annotation.Component; import uk.gov.justice.services.core.annotation.Handles; import uk.gov.justice.services.core.annotation.ServiceComponent; -import uk.gov.justice.services.example.cakeshop.persistence.CakeRepository; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Cake; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.CakeRepository; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Cake; import uk.gov.justice.services.messaging.Envelope; import javax.inject.Inject; @@ -15,7 +15,7 @@ public class CakeMadeEventListener { @Inject CakeRepository cakeRepository; - @Handles("example.events.cake-made") + @Handles("cakeshop.events.cake-made") public void handle(final Envelope envelope) { //Best practice is to handle a value object rather than an entity //because the event typically would not cover an entire entity. diff --git a/example-context/example-service/example-event/example-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/CakeOrderedEventListener.java b/cakeshop-event/cakeshop-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/CakeOrderedEventListener.java similarity index 72% rename from example-context/example-service/example-event/example-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/CakeOrderedEventListener.java rename to cakeshop-event/cakeshop-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/CakeOrderedEventListener.java index 39d603b7..947e1ec3 100644 --- a/example-context/example-service/example-event/example-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/CakeOrderedEventListener.java +++ b/cakeshop-event/cakeshop-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/CakeOrderedEventListener.java @@ -1,11 +1,11 @@ -package uk.gov.justice.services.example.cakeshop.event.listener; +package uk.gov.justice.services.cakeshop.cakeshop.event.listener; import static uk.gov.justice.services.core.annotation.Component.EVENT_LISTENER; import uk.gov.justice.services.core.annotation.Handles; import uk.gov.justice.services.core.annotation.ServiceComponent; -import uk.gov.justice.services.example.cakeshop.persistence.CakeOrderRepository; -import uk.gov.justice.services.example.cakeshop.persistence.entity.CakeOrder; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.CakeOrderRepository; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.CakeOrder; import uk.gov.justice.services.messaging.Envelope; import javax.inject.Inject; @@ -16,7 +16,7 @@ public class CakeOrderedEventListener { @Inject CakeOrderRepository repository; - @Handles("example.events.cake-ordered") + @Handles("cakeshop.events.cake-ordered") public void handle(final Envelope envelope) { //Best practice is to handle a value object rather than an entity //because the event typically would not cover an entire entity. diff --git a/example-context/example-service/example-event/example-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/RecipeEventListener.java b/cakeshop-event/cakeshop-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/RecipeEventListener.java similarity index 81% rename from example-context/example-service/example-event/example-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/RecipeEventListener.java rename to cakeshop-event/cakeshop-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/RecipeEventListener.java index 128bfd9b..84288a3f 100644 --- a/example-context/example-service/example-event/example-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/RecipeEventListener.java +++ b/cakeshop-event/cakeshop-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/RecipeEventListener.java @@ -1,17 +1,17 @@ -package uk.gov.justice.services.example.cakeshop.event.listener; +package uk.gov.justice.services.cakeshop.cakeshop.event.listener; import static uk.gov.justice.services.core.annotation.Component.EVENT_LISTENER; import uk.gov.justice.services.common.converter.JsonObjectToObjectConverter; import uk.gov.justice.services.core.annotation.Handles; import uk.gov.justice.services.core.annotation.ServiceComponent; -import uk.gov.justice.services.example.cakeshop.domain.event.RecipeAdded; -import uk.gov.justice.services.example.cakeshop.event.listener.converter.RecipeAddedToIngredientsConverter; -import uk.gov.justice.services.example.cakeshop.event.listener.converter.RecipeAddedToRecipeConverter; -import uk.gov.justice.services.example.cakeshop.persistence.IngredientRepository; -import uk.gov.justice.services.example.cakeshop.persistence.RecipeRepository; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Ingredient; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Recipe; +import uk.gov.justice.services.cakeshop.cakeshop.domain.event.RecipeAdded; +import uk.gov.justice.services.cakeshop.cakeshop.event.listener.converter.RecipeAddedToIngredientsConverter; +import uk.gov.justice.services.cakeshop.cakeshop.event.listener.converter.RecipeAddedToRecipeConverter; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.IngredientRepository; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.RecipeRepository; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Ingredient; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Recipe; import uk.gov.justice.services.messaging.JsonEnvelope; import java.util.UUID; @@ -43,7 +43,7 @@ public class RecipeEventListener { @Inject IngredientRepository ingredientRepository; - @Handles("example.events.recipe-added") + @Handles("cakeshop.events.recipe-added") public void recipeAdded(final JsonEnvelope event) { final String recipeId = event.payloadAsJsonObject().getString(FIELD_RECIPE_ID); @@ -66,7 +66,7 @@ public void recipeAdded(final JsonEnvelope event) { } } - @Handles("example.events.recipe-renamed") + @Handles("cakeshop.events.recipe-renamed") public void recipeRenamed(final JsonEnvelope event) { final String recipeId = event.payloadAsJsonObject().getString(FIELD_RECIPE_ID); @@ -78,7 +78,7 @@ public void recipeRenamed(final JsonEnvelope event) { recipeRepository.save(recipe); } - @Handles("example.events.recipe-removed") + @Handles("cakeshop.events.recipe-removed") public void recipeRemoved(final JsonEnvelope event) { final String recipeId = event.payloadAsJsonObject().getString(FIELD_RECIPE_ID); LOGGER.trace("=============> Inside remove-recipe Event Listener about to find recipeId: " + recipeId); @@ -87,7 +87,7 @@ public void recipeRemoved(final JsonEnvelope event) { recipeRepository.remove(recipeFound); } - @Handles("example.events.recipe-photograph-added") + @Handles("cakeshop.events.recipe-photograph-added") public void recipePhotographAdded(final JsonEnvelope event) { final String recipeId = event.payloadAsJsonObject().getString(FIELD_RECIPE_ID); diff --git a/example-context/example-service/example-event/example-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/converter/RecipeAddedToIngredientsConverter.java b/cakeshop-event/cakeshop-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/converter/RecipeAddedToIngredientsConverter.java similarity index 73% rename from example-context/example-service/example-event/example-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/converter/RecipeAddedToIngredientsConverter.java rename to cakeshop-event/cakeshop-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/converter/RecipeAddedToIngredientsConverter.java index 8684098f..2d055144 100644 --- a/example-context/example-service/example-event/example-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/converter/RecipeAddedToIngredientsConverter.java +++ b/cakeshop-event/cakeshop-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/converter/RecipeAddedToIngredientsConverter.java @@ -1,8 +1,8 @@ -package uk.gov.justice.services.example.cakeshop.event.listener.converter; +package uk.gov.justice.services.cakeshop.cakeshop.event.listener.converter; import uk.gov.justice.services.common.converter.Converter; -import uk.gov.justice.services.example.cakeshop.domain.event.RecipeAdded; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Ingredient; +import uk.gov.justice.services.cakeshop.cakeshop.domain.event.RecipeAdded; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Ingredient; import java.util.ArrayList; import java.util.List; diff --git a/example-context/example-service/example-event/example-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/converter/RecipeAddedToRecipeConverter.java b/cakeshop-event/cakeshop-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/converter/RecipeAddedToRecipeConverter.java similarity index 66% rename from example-context/example-service/example-event/example-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/converter/RecipeAddedToRecipeConverter.java rename to cakeshop-event/cakeshop-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/converter/RecipeAddedToRecipeConverter.java index e232f08a..f6b79df6 100644 --- a/example-context/example-service/example-event/example-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/converter/RecipeAddedToRecipeConverter.java +++ b/cakeshop-event/cakeshop-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/converter/RecipeAddedToRecipeConverter.java @@ -1,8 +1,8 @@ -package uk.gov.justice.services.example.cakeshop.event.listener.converter; +package uk.gov.justice.services.cakeshop.cakeshop.event.listener.converter; import uk.gov.justice.services.common.converter.Converter; -import uk.gov.justice.services.example.cakeshop.domain.event.RecipeAdded; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Recipe; +import uk.gov.justice.services.cakeshop.cakeshop.domain.event.RecipeAdded; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Recipe; /** * Converter to convert the {@link RecipeAdded} 'event' into the relevant view entities (e.g. {@link diff --git a/example-context/example-service/example-event/example-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/interceptor/ExceptionThrowingInterceptor.java b/cakeshop-event/cakeshop-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/interceptor/ExceptionThrowingInterceptor.java similarity index 91% rename from example-context/example-service/example-event/example-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/interceptor/ExceptionThrowingInterceptor.java rename to cakeshop-event/cakeshop-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/interceptor/ExceptionThrowingInterceptor.java index 09956c2b..29916c04 100644 --- a/example-context/example-service/example-event/example-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/interceptor/ExceptionThrowingInterceptor.java +++ b/cakeshop-event/cakeshop-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/interceptor/ExceptionThrowingInterceptor.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.event.listener.interceptor; +package uk.gov.justice.services.cakeshop.cakeshop.event.listener.interceptor; import uk.gov.justice.services.core.interceptor.Interceptor; import uk.gov.justice.services.core.interceptor.InterceptorChain; diff --git a/cakeshop-event/cakeshop-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/interceptor/TestInterceptorException.java b/cakeshop-event/cakeshop-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/interceptor/TestInterceptorException.java new file mode 100644 index 00000000..1767a7f3 --- /dev/null +++ b/cakeshop-event/cakeshop-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/interceptor/TestInterceptorException.java @@ -0,0 +1,5 @@ +package uk.gov.justice.services.cakeshop.cakeshop.event.listener.interceptor; + + +public class TestInterceptorException extends RuntimeException { +} diff --git a/example-context/example-service/example-event/example-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/provider/ExampleEventListenerInterceptorChainProvider.java b/cakeshop-event/cakeshop-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/provider/CakeshopEventListenerInterceptorChainProvider.java similarity index 75% rename from example-context/example-service/example-event/example-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/provider/ExampleEventListenerInterceptorChainProvider.java rename to cakeshop-event/cakeshop-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/provider/CakeshopEventListenerInterceptorChainProvider.java index a2bb7ad2..f8a2bd6d 100644 --- a/example-context/example-service/example-event/example-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/provider/ExampleEventListenerInterceptorChainProvider.java +++ b/cakeshop-event/cakeshop-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/provider/CakeshopEventListenerInterceptorChainProvider.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.event.listener.provider; +package uk.gov.justice.services.cakeshop.cakeshop.event.listener.provider; import uk.gov.justice.services.core.interceptor.InterceptorChainEntry; import uk.gov.justice.services.core.interceptor.InterceptorChainEntryProvider; @@ -7,11 +7,11 @@ import java.util.ArrayList; import java.util.List; -public class ExampleEventListenerInterceptorChainProvider implements InterceptorChainEntryProvider { +public class CakeshopEventListenerInterceptorChainProvider implements InterceptorChainEntryProvider { private final List interceptorChainEntries = new ArrayList(); - public ExampleEventListenerInterceptorChainProvider() { + public CakeshopEventListenerInterceptorChainProvider() { interceptorChainEntries.add(new InterceptorChainEntry(1000, SubscriptionEventInterceptor.class)); } diff --git a/example-context/example-service/example-event/example-event-listener/src/main/resources/META-INF/beans.xml b/cakeshop-event/cakeshop-event-listener/src/main/resources/META-INF/beans.xml similarity index 100% rename from example-context/example-service/example-event/example-event-listener/src/main/resources/META-INF/beans.xml rename to cakeshop-event/cakeshop-event-listener/src/main/resources/META-INF/beans.xml diff --git a/example-context/example-service/example-event/example-event-listener/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/cakeshop-event/cakeshop-event-listener/src/main/webapp/WEB-INF/jboss-deployment-structure.xml similarity index 100% rename from example-context/example-service/example-event/example-event-listener/src/main/webapp/WEB-INF/jboss-deployment-structure.xml rename to cakeshop-event/cakeshop-event-listener/src/main/webapp/WEB-INF/jboss-deployment-structure.xml diff --git a/example-context/example-service/example-event/example-event-listener/src/test/java/uk/gov/justice/services/example/cakeshop/event/listener/CakeMadeEventListenerTest.java b/cakeshop-event/cakeshop-event-listener/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/CakeMadeEventListenerTest.java similarity index 81% rename from example-context/example-service/example-event/example-event-listener/src/test/java/uk/gov/justice/services/example/cakeshop/event/listener/CakeMadeEventListenerTest.java rename to cakeshop-event/cakeshop-event-listener/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/CakeMadeEventListenerTest.java index f78c7c09..59e45703 100644 --- a/example-context/example-service/example-event/example-event-listener/src/test/java/uk/gov/justice/services/example/cakeshop/event/listener/CakeMadeEventListenerTest.java +++ b/cakeshop-event/cakeshop-event-listener/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/CakeMadeEventListenerTest.java @@ -1,11 +1,11 @@ -package uk.gov.justice.services.example.cakeshop.event.listener; +package uk.gov.justice.services.cakeshop.cakeshop.event.listener; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import uk.gov.justice.services.example.cakeshop.persistence.CakeRepository; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Cake; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.CakeRepository; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Cake; import uk.gov.justice.services.messaging.Envelope; import org.junit.jupiter.api.Test; diff --git a/example-context/example-service/example-event/example-event-listener/src/test/java/uk/gov/justice/services/example/cakeshop/event/listener/CakeOrderedEventListenerTest.java b/cakeshop-event/cakeshop-event-listener/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/CakeOrderedEventListenerTest.java similarity index 82% rename from example-context/example-service/example-event/example-event-listener/src/test/java/uk/gov/justice/services/example/cakeshop/event/listener/CakeOrderedEventListenerTest.java rename to cakeshop-event/cakeshop-event-listener/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/CakeOrderedEventListenerTest.java index 6a18cbbe..f3afe955 100644 --- a/example-context/example-service/example-event/example-event-listener/src/test/java/uk/gov/justice/services/example/cakeshop/event/listener/CakeOrderedEventListenerTest.java +++ b/cakeshop-event/cakeshop-event-listener/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/CakeOrderedEventListenerTest.java @@ -1,12 +1,12 @@ -package uk.gov.justice.services.example.cakeshop.event.listener; +package uk.gov.justice.services.cakeshop.cakeshop.event.listener; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import uk.gov.justice.services.example.cakeshop.persistence.CakeOrderRepository; -import uk.gov.justice.services.example.cakeshop.persistence.entity.CakeOrder; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.CakeOrderRepository; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.CakeOrder; import uk.gov.justice.services.messaging.Envelope; import java.time.ZonedDateTime; diff --git a/example-context/example-service/example-event/example-event-listener/src/test/java/uk/gov/justice/services/example/cakeshop/event/listener/RecipeEventListenerTest.java b/cakeshop-event/cakeshop-event-listener/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/RecipeEventListenerTest.java similarity index 87% rename from example-context/example-service/example-event/example-event-listener/src/test/java/uk/gov/justice/services/example/cakeshop/event/listener/RecipeEventListenerTest.java rename to cakeshop-event/cakeshop-event-listener/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/RecipeEventListenerTest.java index f5f4337b..cffdcfe8 100644 --- a/example-context/example-service/example-event/example-event-listener/src/test/java/uk/gov/justice/services/example/cakeshop/event/listener/RecipeEventListenerTest.java +++ b/cakeshop-event/cakeshop-event-listener/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/RecipeEventListenerTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.event.listener; +package uk.gov.justice.services.cakeshop.cakeshop.event.listener; import static java.util.Collections.emptyList; import static java.util.Collections.singletonList; @@ -9,13 +9,13 @@ import static org.mockito.Mockito.when; import uk.gov.justice.services.common.converter.JsonObjectToObjectConverter; -import uk.gov.justice.services.example.cakeshop.domain.event.RecipeAdded; -import uk.gov.justice.services.example.cakeshop.event.listener.converter.RecipeAddedToIngredientsConverter; -import uk.gov.justice.services.example.cakeshop.event.listener.converter.RecipeAddedToRecipeConverter; -import uk.gov.justice.services.example.cakeshop.persistence.IngredientRepository; -import uk.gov.justice.services.example.cakeshop.persistence.RecipeRepository; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Ingredient; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Recipe; +import uk.gov.justice.services.cakeshop.cakeshop.domain.event.RecipeAdded; +import uk.gov.justice.services.cakeshop.cakeshop.event.listener.converter.RecipeAddedToIngredientsConverter; +import uk.gov.justice.services.cakeshop.cakeshop.event.listener.converter.RecipeAddedToRecipeConverter; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.IngredientRepository; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.RecipeRepository; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Ingredient; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Recipe; import uk.gov.justice.services.messaging.JsonEnvelope; import java.util.UUID; diff --git a/example-context/example-service/example-event/example-event-listener/src/test/java/uk/gov/justice/services/example/cakeshop/event/listener/converter/RecipeAddedToIngredientsConverterTest.java b/cakeshop-event/cakeshop-event-listener/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/converter/RecipeAddedToIngredientsConverterTest.java similarity index 77% rename from example-context/example-service/example-event/example-event-listener/src/test/java/uk/gov/justice/services/example/cakeshop/event/listener/converter/RecipeAddedToIngredientsConverterTest.java rename to cakeshop-event/cakeshop-event-listener/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/converter/RecipeAddedToIngredientsConverterTest.java index 14c8eff2..d60c848c 100644 --- a/example-context/example-service/example-event/example-event-listener/src/test/java/uk/gov/justice/services/example/cakeshop/event/listener/converter/RecipeAddedToIngredientsConverterTest.java +++ b/cakeshop-event/cakeshop-event-listener/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/converter/RecipeAddedToIngredientsConverterTest.java @@ -1,11 +1,11 @@ -package uk.gov.justice.services.example.cakeshop.event.listener.converter; +package uk.gov.justice.services.cakeshop.cakeshop.event.listener.converter; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; import static org.mockito.Mockito.when; -import uk.gov.justice.services.example.cakeshop.domain.event.RecipeAdded; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Ingredient; +import uk.gov.justice.services.cakeshop.cakeshop.domain.event.RecipeAdded; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Ingredient; import java.util.Collections; import java.util.List; @@ -28,7 +28,7 @@ public class RecipeAddedToIngredientsConverterTest { @BeforeEach public void setup() { - when(recipeAdded.getIngredients()).thenReturn(Collections.singletonList(new uk.gov.justice.services.example.cakeshop.domain.Ingredient(NAME, 2))); + when(recipeAdded.getIngredients()).thenReturn(Collections.singletonList(new uk.gov.justice.services.cakeshop.cakeshop.domain.Ingredient(NAME, 2))); converter = new RecipeAddedToIngredientsConverter(); } diff --git a/example-context/example-service/example-event/example-event-listener/src/test/java/uk/gov/justice/services/example/cakeshop/event/listener/converter/RecipeAddedToRecipeConverterTest.java b/cakeshop-event/cakeshop-event-listener/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/converter/RecipeAddedToRecipeConverterTest.java similarity index 78% rename from example-context/example-service/example-event/example-event-listener/src/test/java/uk/gov/justice/services/example/cakeshop/event/listener/converter/RecipeAddedToRecipeConverterTest.java rename to cakeshop-event/cakeshop-event-listener/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/converter/RecipeAddedToRecipeConverterTest.java index 0b00ef36..e7d9b588 100644 --- a/example-context/example-service/example-event/example-event-listener/src/test/java/uk/gov/justice/services/example/cakeshop/event/listener/converter/RecipeAddedToRecipeConverterTest.java +++ b/cakeshop-event/cakeshop-event-listener/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/converter/RecipeAddedToRecipeConverterTest.java @@ -1,11 +1,11 @@ -package uk.gov.justice.services.example.cakeshop.event.listener.converter; +package uk.gov.justice.services.cakeshop.cakeshop.event.listener.converter; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; -import uk.gov.justice.services.example.cakeshop.domain.Ingredient; -import uk.gov.justice.services.example.cakeshop.domain.event.RecipeAdded; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Recipe; +import uk.gov.justice.services.cakeshop.cakeshop.domain.Ingredient; +import uk.gov.justice.services.cakeshop.cakeshop.domain.event.RecipeAdded; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Recipe; import java.util.Collections; import java.util.List; diff --git a/example-context/example-service/example-event/example-event-listener/src/test/java/uk/gov/justice/services/example/cakeshop/event/listener/interceptor/ExceptionThrowingInterceptorTest.java b/cakeshop-event/cakeshop-event-listener/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/interceptor/ExceptionThrowingInterceptorTest.java similarity index 95% rename from example-context/example-service/example-event/example-event-listener/src/test/java/uk/gov/justice/services/example/cakeshop/event/listener/interceptor/ExceptionThrowingInterceptorTest.java rename to cakeshop-event/cakeshop-event-listener/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/interceptor/ExceptionThrowingInterceptorTest.java index ea74f639..827c7a17 100644 --- a/example-context/example-service/example-event/example-event-listener/src/test/java/uk/gov/justice/services/example/cakeshop/event/listener/interceptor/ExceptionThrowingInterceptorTest.java +++ b/cakeshop-event/cakeshop-event-listener/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/interceptor/ExceptionThrowingInterceptorTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.event.listener.interceptor; +package uk.gov.justice.services.cakeshop.cakeshop.event.listener.interceptor; import static org.junit.jupiter.api.Assertions.assertThrows; import static uk.gov.justice.services.core.interceptor.InterceptorContext.interceptorContextWithInput; diff --git a/example-context/example-service/example-event/example-event-listener/src/test/java/uk/gov/justice/services/example/cakeshop/event/listener/provider/ExampleEventListenerInterceptorChainProviderTest.java b/cakeshop-event/cakeshop-event-listener/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/provider/CakeshopEventListenerInterceptorChainProviderTest.java similarity index 72% rename from example-context/example-service/example-event/example-event-listener/src/test/java/uk/gov/justice/services/example/cakeshop/event/listener/provider/ExampleEventListenerInterceptorChainProviderTest.java rename to cakeshop-event/cakeshop-event-listener/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/provider/CakeshopEventListenerInterceptorChainProviderTest.java index 42205de6..6df49778 100644 --- a/example-context/example-service/example-event/example-event-listener/src/test/java/uk/gov/justice/services/example/cakeshop/event/listener/provider/ExampleEventListenerInterceptorChainProviderTest.java +++ b/cakeshop-event/cakeshop-event-listener/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/provider/CakeshopEventListenerInterceptorChainProviderTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.event.listener.provider; +package uk.gov.justice.services.cakeshop.cakeshop.event.listener.provider; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; @@ -9,12 +9,12 @@ import org.junit.jupiter.api.Test; -public class ExampleEventListenerInterceptorChainProviderTest { +public class CakeshopEventListenerInterceptorChainProviderTest { @Test public void shouldCreateInterceptorChainEntriesWithSubscriptionEventInterceptor() { - final List interceptorChainEntries = new ExampleEventListenerInterceptorChainProvider().interceptorChainTypes(); + final List interceptorChainEntries = new CakeshopEventListenerInterceptorChainProvider().interceptorChainTypes(); assertThat(interceptorChainEntries.size(), is(1)); @@ -25,6 +25,6 @@ public void shouldCreateInterceptorChainEntriesWithSubscriptionEventInterceptor( @Test public void shouldReturnComponentName() { - assertThat(new ExampleEventListenerInterceptorChainProvider().component(), is("EVENT_LISTENER")); + assertThat(new CakeshopEventListenerInterceptorChainProvider().component(), is("EVENT_LISTENER")); } } \ No newline at end of file diff --git a/example-context/example-service/example-event/example-event-listener/src/yaml/json/add-recipe.json b/cakeshop-event/cakeshop-event-listener/src/yaml/json/add-recipe.json similarity index 100% rename from example-context/example-service/example-event/example-event-listener/src/yaml/json/add-recipe.json rename to cakeshop-event/cakeshop-event-listener/src/yaml/json/add-recipe.json diff --git a/example-context/example-service/example-event/example-event-listener/src/yaml/json/cake-ordered.json b/cakeshop-event/cakeshop-event-listener/src/yaml/json/cake-ordered.json similarity index 100% rename from example-context/example-service/example-event/example-event-listener/src/yaml/json/cake-ordered.json rename to cakeshop-event/cakeshop-event-listener/src/yaml/json/cake-ordered.json diff --git a/example-context/example-service/example-event/example-event-listener/src/yaml/json/make-cake.json b/cakeshop-event/cakeshop-event-listener/src/yaml/json/make-cake.json similarity index 100% rename from example-context/example-service/example-event/example-event-listener/src/yaml/json/make-cake.json rename to cakeshop-event/cakeshop-event-listener/src/yaml/json/make-cake.json diff --git a/example-context/example-service/example-event/example-event-listener/src/yaml/json/recipe-photograph-added.json b/cakeshop-event/cakeshop-event-listener/src/yaml/json/recipe-photograph-added.json similarity index 100% rename from example-context/example-service/example-event/example-event-listener/src/yaml/json/recipe-photograph-added.json rename to cakeshop-event/cakeshop-event-listener/src/yaml/json/recipe-photograph-added.json diff --git a/example-context/example-service/example-event/example-event-listener/src/yaml/json/recipe-removed.json b/cakeshop-event/cakeshop-event-listener/src/yaml/json/recipe-removed.json similarity index 100% rename from example-context/example-service/example-event/example-event-listener/src/yaml/json/recipe-removed.json rename to cakeshop-event/cakeshop-event-listener/src/yaml/json/recipe-removed.json diff --git a/example-context/example-service/example-event/example-event-listener/src/yaml/json/recipe-renamed.json b/cakeshop-event/cakeshop-event-listener/src/yaml/json/recipe-renamed.json similarity index 100% rename from example-context/example-service/example-event/example-event-listener/src/yaml/json/recipe-renamed.json rename to cakeshop-event/cakeshop-event-listener/src/yaml/json/recipe-renamed.json diff --git a/example-context/example-service/example-event/example-event-processor/src/yaml/json/schema/example.cake-made.json b/cakeshop-event/cakeshop-event-listener/src/yaml/json/schema/cakeshop.cake-made.json similarity index 77% rename from example-context/example-service/example-event/example-event-processor/src/yaml/json/schema/example.cake-made.json rename to cakeshop-event/cakeshop-event-listener/src/yaml/json/schema/cakeshop.cake-made.json index bf46a6f4..fafde2ea 100644 --- a/example-context/example-service/example-event/example-event-processor/src/yaml/json/schema/example.cake-made.json +++ b/cakeshop-event/cakeshop-event-listener/src/yaml/json/schema/cakeshop.cake-made.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/event/example.events.cake-made.json", + "id": "http://justice.gov.uk/cakeshop/event/cakeshop.events.cake-made.json", "type": "object", "properties": { "cakeId": { diff --git a/example-context/example-service/example-event/example-event-listener/src/yaml/json/schema/example.cake-ordered.json b/cakeshop-event/cakeshop-event-listener/src/yaml/json/schema/cakeshop.cake-ordered.json similarity index 77% rename from example-context/example-service/example-event/example-event-listener/src/yaml/json/schema/example.cake-ordered.json rename to cakeshop-event/cakeshop-event-listener/src/yaml/json/schema/cakeshop.cake-ordered.json index 836ebfde..055e3387 100644 --- a/example-context/example-service/example-event/example-event-listener/src/yaml/json/schema/example.cake-ordered.json +++ b/cakeshop-event/cakeshop-event-listener/src/yaml/json/schema/cakeshop.cake-ordered.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/event/listener/example.events.cake-ordered.json", + "id": "http://justice.gov.uk/cakeshop/event/listener/cakeshop.events.cake-ordered.json", "type": "object", "properties": { "orderId": { diff --git a/example-context/example-service/example-event/example-event-listener/src/yaml/json/schema/example.recipe-added.json b/cakeshop-event/cakeshop-event-listener/src/yaml/json/schema/cakeshop.recipe-added.json similarity index 93% rename from example-context/example-service/example-event/example-event-listener/src/yaml/json/schema/example.recipe-added.json rename to cakeshop-event/cakeshop-event-listener/src/yaml/json/schema/cakeshop.recipe-added.json index bfcdce48..d2f53d09 100644 --- a/example-context/example-service/example-event/example-event-listener/src/yaml/json/schema/example.recipe-added.json +++ b/cakeshop-event/cakeshop-event-listener/src/yaml/json/schema/cakeshop.recipe-added.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/event/example.events.recipe-added.json", + "id": "http://justice.gov.uk/cakeshop/event/cakeshop.events.recipe-added.json", "type": "object", "properties": { "recipeId": { diff --git a/example-context/example-service/example-event/example-event-listener/src/yaml/json/schema/example.recipe-photograph-added.json b/cakeshop-event/cakeshop-event-listener/src/yaml/json/schema/cakeshop.recipe-photograph-added.json similarity index 84% rename from example-context/example-service/example-event/example-event-listener/src/yaml/json/schema/example.recipe-photograph-added.json rename to cakeshop-event/cakeshop-event-listener/src/yaml/json/schema/cakeshop.recipe-photograph-added.json index 7499a0c5..f83f8021 100644 --- a/example-context/example-service/example-event/example-event-listener/src/yaml/json/schema/example.recipe-photograph-added.json +++ b/cakeshop-event/cakeshop-event-listener/src/yaml/json/schema/cakeshop.recipe-photograph-added.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/event/example.events.recipe-photograph-added.json", + "id": "http://justice.gov.uk/cakeshop/event/cakeshop.events.recipe-photograph-added.json", "type": "object", "properties": { "recipeId": { diff --git a/example-context/example-service/example-event/example-event-listener/src/yaml/json/schema/example.recipe-removed.json b/cakeshop-event/cakeshop-event-listener/src/yaml/json/schema/cakeshop.recipe-removed.json similarity index 68% rename from example-context/example-service/example-event/example-event-listener/src/yaml/json/schema/example.recipe-removed.json rename to cakeshop-event/cakeshop-event-listener/src/yaml/json/schema/cakeshop.recipe-removed.json index 6bdc14ae..8074d78c 100644 --- a/example-context/example-service/example-event/example-event-listener/src/yaml/json/schema/example.recipe-removed.json +++ b/cakeshop-event/cakeshop-event-listener/src/yaml/json/schema/cakeshop.recipe-removed.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/event/example.events.recipe-removed.json", + "id": "http://justice.gov.uk/cakeshop/event/cakeshop.events.recipe-removed.json", "type": "object", "properties": { "recipeId": { diff --git a/example-context/example-service/example-event/example-event-listener/src/yaml/json/schema/example.recipe-renamed.json b/cakeshop-event/cakeshop-event-listener/src/yaml/json/schema/cakeshop.recipe-renamed.json similarity index 85% rename from example-context/example-service/example-event/example-event-listener/src/yaml/json/schema/example.recipe-renamed.json rename to cakeshop-event/cakeshop-event-listener/src/yaml/json/schema/cakeshop.recipe-renamed.json index 9aec3142..59362e1a 100644 --- a/example-context/example-service/example-event/example-event-listener/src/yaml/json/schema/example.recipe-renamed.json +++ b/cakeshop-event/cakeshop-event-listener/src/yaml/json/schema/cakeshop.recipe-renamed.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/event/example.events.recipe-renamed.json", + "id": "http://justice.gov.uk/cakeshop/event/cakeshop.events.recipe-renamed.json", "type": "object", "properties": { "recipeId": { diff --git a/cakeshop-event/cakeshop-event-listener/src/yaml/subscriptions-descriptor.yaml b/cakeshop-event/cakeshop-event-listener/src/yaml/subscriptions-descriptor.yaml new file mode 100644 index 00000000..ae6a01fc --- /dev/null +++ b/cakeshop-event/cakeshop-event-listener/src/yaml/subscriptions-descriptor.yaml @@ -0,0 +1,27 @@ +subscriptions_descriptor: + spec_version: 1.0.0 + service: cakeshop + service_component: EVENT_LISTENER + subscriptions: + - name: event listener subscription + events: + - name: cakeshop.events.recipe-added + schema_uri: http://justice.gov.uk/cakeshop/event/cakeshop.events.recipe-added.json + + - name: cakeshop.events.recipe-removed + schema_uri: http://justice.gov.uk/cakeshop/event/cakeshop.events.recipe-removed.json + + - name: cakeshop.events.cake-made + schema_uri: http://justice.gov.uk/cakeshop/event/cakeshop.events.cake-made.json + + - name: cakeshop.events.cake-ordered + schema_uri: http://justice.gov.uk/cakeshop/event/listener/cakeshop.events.cake-ordered.json + + - name: cakeshop.events.recipe-renamed + schema_uri: http://justice.gov.uk/cakeshop/event/cakeshop.events.recipe-renamed.json + + - name: cakeshop.events.recipe-photograph-added + schema_uri: http://justice.gov.uk/cakeshop/event/cakeshop.events.recipe-photograph-added.json + event_source_name: cakeshop + + diff --git a/example-context/example-service/example-event/example-event-processor/pom.xml b/cakeshop-event/cakeshop-event-processor/pom.xml similarity index 93% rename from example-context/example-service/example-event/example-event-processor/pom.xml rename to cakeshop-event/cakeshop-event-processor/pom.xml index d08c775b..ccb94015 100644 --- a/example-context/example-service/example-event/example-event-processor/pom.xml +++ b/cakeshop-event/cakeshop-event-processor/pom.xml @@ -3,12 +3,12 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - example-event - uk.gov.justice.services.example + cakeshop-event + uk.gov.justice.services.cakeshop 17.0.2-SNAPSHOT 4.0.0 - example-event-processor + cakeshop-event-processor war diff --git a/example-context/example-service/example-event/example-event-processor/src/main/java/uk/gov/justice/services/example/cakeshop/event/processor/CakeMadeEventProcessor.java b/cakeshop-event/cakeshop-event-processor/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/processor/CakeMadeEventProcessor.java similarity index 83% rename from example-context/example-service/example-event/example-event-processor/src/main/java/uk/gov/justice/services/example/cakeshop/event/processor/CakeMadeEventProcessor.java rename to cakeshop-event/cakeshop-event-processor/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/processor/CakeMadeEventProcessor.java index dafd9bcf..f382056a 100644 --- a/example-context/example-service/example-event/example-event-processor/src/main/java/uk/gov/justice/services/example/cakeshop/event/processor/CakeMadeEventProcessor.java +++ b/cakeshop-event/cakeshop-event-processor/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/processor/CakeMadeEventProcessor.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.event.processor; +package uk.gov.justice.services.cakeshop.cakeshop.event.processor; import static uk.gov.justice.services.core.annotation.Component.EVENT_PROCESSOR; @@ -15,7 +15,7 @@ public class CakeMadeEventProcessor { @Inject Sender sender; - @Handles("example.events.cake-made") + @Handles("cakeshop.events.cake-made") public void handle(final JsonEnvelope event) { sender.send(event); } diff --git a/example-context/example-service/example-event/example-event-processor/src/main/java/uk/gov/justice/services/example/cakeshop/event/processor/RecipeAddedEventProcessor.java b/cakeshop-event/cakeshop-event-processor/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/processor/RecipeAddedEventProcessor.java similarity index 82% rename from example-context/example-service/example-event/example-event-processor/src/main/java/uk/gov/justice/services/example/cakeshop/event/processor/RecipeAddedEventProcessor.java rename to cakeshop-event/cakeshop-event-processor/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/processor/RecipeAddedEventProcessor.java index 583694c8..b83dcc09 100644 --- a/example-context/example-service/example-event/example-event-processor/src/main/java/uk/gov/justice/services/example/cakeshop/event/processor/RecipeAddedEventProcessor.java +++ b/cakeshop-event/cakeshop-event-processor/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/processor/RecipeAddedEventProcessor.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.event.processor; +package uk.gov.justice.services.cakeshop.cakeshop.event.processor; import static uk.gov.justice.services.core.annotation.Component.EVENT_PROCESSOR; @@ -15,7 +15,7 @@ public class RecipeAddedEventProcessor { @Inject Sender sender; - @Handles("example.events.recipe-added") + @Handles("cakeshop.events.recipe-added") public void recipeAdded(final JsonEnvelope event) { sender.send(event); } diff --git a/example-context/example-service/example-event/example-event-processor/src/main/java/uk/gov/justice/services/example/provider/ExampleEventProcessorInterceptorChainProvider.java b/cakeshop-event/cakeshop-event-processor/src/main/java/uk/gov/justice/services/cakeshop/provider/CakeshopEventProcessorInterceptorChainProvider.java similarity index 79% rename from example-context/example-service/example-event/example-event-processor/src/main/java/uk/gov/justice/services/example/provider/ExampleEventProcessorInterceptorChainProvider.java rename to cakeshop-event/cakeshop-event-processor/src/main/java/uk/gov/justice/services/cakeshop/provider/CakeshopEventProcessorInterceptorChainProvider.java index f51910cc..08aa2237 100644 --- a/example-context/example-service/example-event/example-event-processor/src/main/java/uk/gov/justice/services/example/provider/ExampleEventProcessorInterceptorChainProvider.java +++ b/cakeshop-event/cakeshop-event-processor/src/main/java/uk/gov/justice/services/cakeshop/provider/CakeshopEventProcessorInterceptorChainProvider.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.provider; +package uk.gov.justice.services.cakeshop.provider; import static uk.gov.justice.services.core.annotation.Component.EVENT_PROCESSOR; @@ -8,7 +8,7 @@ import java.util.ArrayList; import java.util.List; -public class ExampleEventProcessorInterceptorChainProvider implements InterceptorChainEntryProvider { +public class CakeshopEventProcessorInterceptorChainProvider implements InterceptorChainEntryProvider { private final List interceptorChainEntries = new ArrayList<>(); diff --git a/example-context/example-service/example-event/example-event-processor/src/main/resources/META-INF/beans.xml b/cakeshop-event/cakeshop-event-processor/src/main/resources/META-INF/beans.xml similarity index 100% rename from example-context/example-service/example-event/example-event-processor/src/main/resources/META-INF/beans.xml rename to cakeshop-event/cakeshop-event-processor/src/main/resources/META-INF/beans.xml diff --git a/example-context/example-service/example-event/example-event-processor/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/cakeshop-event/cakeshop-event-processor/src/main/webapp/WEB-INF/jboss-deployment-structure.xml similarity index 100% rename from example-context/example-service/example-event/example-event-processor/src/main/webapp/WEB-INF/jboss-deployment-structure.xml rename to cakeshop-event/cakeshop-event-processor/src/main/webapp/WEB-INF/jboss-deployment-structure.xml diff --git a/example-context/example-service/example-event/example-event-processor/src/yaml/json/cake-made.json b/cakeshop-event/cakeshop-event-processor/src/yaml/json/cake-made.json similarity index 100% rename from example-context/example-service/example-event/example-event-processor/src/yaml/json/cake-made.json rename to cakeshop-event/cakeshop-event-processor/src/yaml/json/cake-made.json diff --git a/example-context/example-service/example-event/example-event-processor/src/yaml/json/recipe-added.json b/cakeshop-event/cakeshop-event-processor/src/yaml/json/recipe-added.json similarity index 100% rename from example-context/example-service/example-event/example-event-processor/src/yaml/json/recipe-added.json rename to cakeshop-event/cakeshop-event-processor/src/yaml/json/recipe-added.json diff --git a/example-context/example-service/example-event/example-event-listener/src/yaml/json/schema/example.cake-made.json b/cakeshop-event/cakeshop-event-processor/src/yaml/json/schema/cakeshop.cake-made.json similarity index 77% rename from example-context/example-service/example-event/example-event-listener/src/yaml/json/schema/example.cake-made.json rename to cakeshop-event/cakeshop-event-processor/src/yaml/json/schema/cakeshop.cake-made.json index bf46a6f4..fafde2ea 100644 --- a/example-context/example-service/example-event/example-event-listener/src/yaml/json/schema/example.cake-made.json +++ b/cakeshop-event/cakeshop-event-processor/src/yaml/json/schema/cakeshop.cake-made.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/event/example.events.cake-made.json", + "id": "http://justice.gov.uk/cakeshop/event/cakeshop.events.cake-made.json", "type": "object", "properties": { "cakeId": { diff --git a/example-context/example-service/example-event/example-event-processor/src/yaml/json/schema/example.events.cake-made.json b/cakeshop-event/cakeshop-event-processor/src/yaml/json/schema/cakeshop.events.cake-made.json similarity index 77% rename from example-context/example-service/example-event/example-event-processor/src/yaml/json/schema/example.events.cake-made.json rename to cakeshop-event/cakeshop-event-processor/src/yaml/json/schema/cakeshop.events.cake-made.json index bf46a6f4..fafde2ea 100644 --- a/example-context/example-service/example-event/example-event-processor/src/yaml/json/schema/example.events.cake-made.json +++ b/cakeshop-event/cakeshop-event-processor/src/yaml/json/schema/cakeshop.events.cake-made.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/event/example.events.cake-made.json", + "id": "http://justice.gov.uk/cakeshop/event/cakeshop.events.cake-made.json", "type": "object", "properties": { "cakeId": { diff --git a/example-context/example-service/example-event/example-event-processor/src/yaml/json/schema/example.recipe-added.json b/cakeshop-event/cakeshop-event-processor/src/yaml/json/schema/cakeshop.events.recipe-added.json similarity index 93% rename from example-context/example-service/example-event/example-event-processor/src/yaml/json/schema/example.recipe-added.json rename to cakeshop-event/cakeshop-event-processor/src/yaml/json/schema/cakeshop.events.recipe-added.json index bfcdce48..d2f53d09 100644 --- a/example-context/example-service/example-event/example-event-processor/src/yaml/json/schema/example.recipe-added.json +++ b/cakeshop-event/cakeshop-event-processor/src/yaml/json/schema/cakeshop.events.recipe-added.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/event/example.events.recipe-added.json", + "id": "http://justice.gov.uk/cakeshop/event/cakeshop.events.recipe-added.json", "type": "object", "properties": { "recipeId": { diff --git a/example-context/example-service/example-event/example-event-processor/src/yaml/json/schema/example.events.recipe-added.json b/cakeshop-event/cakeshop-event-processor/src/yaml/json/schema/cakeshop.recipe-added.json similarity index 93% rename from example-context/example-service/example-event/example-event-processor/src/yaml/json/schema/example.events.recipe-added.json rename to cakeshop-event/cakeshop-event-processor/src/yaml/json/schema/cakeshop.recipe-added.json index bfcdce48..d2f53d09 100644 --- a/example-context/example-service/example-event/example-event-processor/src/yaml/json/schema/example.events.recipe-added.json +++ b/cakeshop-event/cakeshop-event-processor/src/yaml/json/schema/cakeshop.recipe-added.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/event/example.events.recipe-added.json", + "id": "http://justice.gov.uk/cakeshop/event/cakeshop.events.recipe-added.json", "type": "object", "properties": { "recipeId": { diff --git a/cakeshop-event/cakeshop-event-processor/src/yaml/public-subscriptions-descriptor.yaml b/cakeshop-event/cakeshop-event-processor/src/yaml/public-subscriptions-descriptor.yaml new file mode 100644 index 00000000..3c2795c6 --- /dev/null +++ b/cakeshop-event/cakeshop-event-processor/src/yaml/public-subscriptions-descriptor.yaml @@ -0,0 +1,14 @@ +subscriptions_descriptor: + spec_version: 1.0.0 + service: cakeshop + service_component: EVENT_PROCESSOR + subscriptions: + - name: public event processor subscription + events: + - name: cakeshop.events.recipe-added + schema_uri: http://justice.gov.uk/cakeshop/event/cakeshop.events.recipe-added.json + + - name: cakeshop.events.cake-made + schema_uri: http://justice.gov.uk/cakeshop/event/cakeshop.events.cake-made.json + + event_source_name: public.event.source \ No newline at end of file diff --git a/cakeshop-event/cakeshop-event-processor/src/yaml/subscriptions-descriptor.yaml b/cakeshop-event/cakeshop-event-processor/src/yaml/subscriptions-descriptor.yaml new file mode 100644 index 00000000..36054feb --- /dev/null +++ b/cakeshop-event/cakeshop-event-processor/src/yaml/subscriptions-descriptor.yaml @@ -0,0 +1,13 @@ +subscriptions_descriptor: + spec_version: 1.0.0 + service: cakeshop + service_component: EVENT_PROCESSOR + subscriptions: + - name: event processor subscription + events: + - name: cakeshop.events.recipe-added + schema_uri: http://justice.gov.uk/cakeshop/event/cakeshop.events.recipe-added.json + + - name: cakeshop.events.cake-made + schema_uri: http://justice.gov.uk/cakeshop/event/cakeshop.events.cake-made.json + event_source_name: cakeshop diff --git a/example-context/example-service/example-event/other-event-listener/pom.xml b/cakeshop-event/other-event-listener/pom.xml similarity index 89% rename from example-context/example-service/example-event/other-event-listener/pom.xml rename to cakeshop-event/other-event-listener/pom.xml index 3d51d50d..2306a0f6 100644 --- a/example-context/example-service/example-event/other-event-listener/pom.xml +++ b/cakeshop-event/other-event-listener/pom.xml @@ -3,8 +3,8 @@ xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - example-event - uk.gov.justice.services.example + cakeshop-event + uk.gov.justice.services.cakeshop 17.0.2-SNAPSHOT 4.0.0 @@ -56,13 +56,13 @@ provided - uk.gov.justice.services.example - example-persistence + uk.gov.justice.services.cakeshop + cakeshop-viewstore-persistence ${project.version} - uk.gov.justice.services.example - example-domain + uk.gov.justice.services.cakeshop + cakeshop-domain ${project.version} diff --git a/example-context/example-service/example-event/other-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/OtherRecipeEventListener.java b/cakeshop-event/other-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/OtherRecipeEventListener.java similarity index 68% rename from example-context/example-service/example-event/other-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/OtherRecipeEventListener.java rename to cakeshop-event/other-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/OtherRecipeEventListener.java index b73fa508..89cb3e66 100644 --- a/example-context/example-service/example-event/other-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/OtherRecipeEventListener.java +++ b/cakeshop-event/other-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/OtherRecipeEventListener.java @@ -1,14 +1,14 @@ -package uk.gov.justice.services.example.cakeshop.event.listener; +package uk.gov.justice.services.cakeshop.cakeshop.event.listener; import uk.gov.justice.services.common.converter.JsonObjectToObjectConverter; import uk.gov.justice.services.core.annotation.Handles; import uk.gov.justice.services.core.annotation.ServiceComponent; -import uk.gov.justice.services.example.cakeshop.domain.event.RecipeAdded; -import uk.gov.justice.services.example.cakeshop.event.listener.converter.OtherRecipeAddedToIngredientsConverter; -import uk.gov.justice.services.example.cakeshop.event.listener.converter.OtherRecipeAddedToRecipeConverter; -import uk.gov.justice.services.example.cakeshop.persistence.IngredientRepository; -import uk.gov.justice.services.example.cakeshop.persistence.RecipeRepository; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Ingredient; +import uk.gov.justice.services.cakeshop.cakeshop.domain.event.RecipeAdded; +import uk.gov.justice.services.cakeshop.cakeshop.event.listener.converter.OtherRecipeAddedToIngredientsConverter; +import uk.gov.justice.services.cakeshop.cakeshop.event.listener.converter.OtherRecipeAddedToRecipeConverter; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.IngredientRepository; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.RecipeRepository; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Ingredient; import uk.gov.justice.services.messaging.JsonEnvelope; import javax.inject.Inject; diff --git a/example-context/example-service/example-event/other-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/converter/OtherRecipeAddedToIngredientsConverter.java b/cakeshop-event/other-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/converter/OtherRecipeAddedToIngredientsConverter.java similarity index 74% rename from example-context/example-service/example-event/other-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/converter/OtherRecipeAddedToIngredientsConverter.java rename to cakeshop-event/other-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/converter/OtherRecipeAddedToIngredientsConverter.java index 9d45939e..e10cb2ae 100644 --- a/example-context/example-service/example-event/other-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/converter/OtherRecipeAddedToIngredientsConverter.java +++ b/cakeshop-event/other-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/converter/OtherRecipeAddedToIngredientsConverter.java @@ -1,8 +1,8 @@ -package uk.gov.justice.services.example.cakeshop.event.listener.converter; +package uk.gov.justice.services.cakeshop.cakeshop.event.listener.converter; import uk.gov.justice.services.common.converter.Converter; -import uk.gov.justice.services.example.cakeshop.domain.event.RecipeAdded; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Ingredient; +import uk.gov.justice.services.cakeshop.cakeshop.domain.event.RecipeAdded; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Ingredient; import java.util.ArrayList; import java.util.List; diff --git a/example-context/example-service/example-event/other-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/converter/OtherRecipeAddedToRecipeConverter.java b/cakeshop-event/other-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/converter/OtherRecipeAddedToRecipeConverter.java similarity index 66% rename from example-context/example-service/example-event/other-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/converter/OtherRecipeAddedToRecipeConverter.java rename to cakeshop-event/other-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/converter/OtherRecipeAddedToRecipeConverter.java index ccbd2848..5ef2a748 100644 --- a/example-context/example-service/example-event/other-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/converter/OtherRecipeAddedToRecipeConverter.java +++ b/cakeshop-event/other-event-listener/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/event/listener/converter/OtherRecipeAddedToRecipeConverter.java @@ -1,8 +1,8 @@ -package uk.gov.justice.services.example.cakeshop.event.listener.converter; +package uk.gov.justice.services.cakeshop.cakeshop.event.listener.converter; import uk.gov.justice.services.common.converter.Converter; -import uk.gov.justice.services.example.cakeshop.domain.event.RecipeAdded; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Recipe; +import uk.gov.justice.services.cakeshop.cakeshop.domain.event.RecipeAdded; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Recipe; /** * Converter to convert the {@link RecipeAdded} 'event' into the relevant view entities (e.g. {@link diff --git a/example-context/example-service/example-event/other-event-listener/src/main/resources/META-INF/beans.xml b/cakeshop-event/other-event-listener/src/main/resources/META-INF/beans.xml similarity index 100% rename from example-context/example-service/example-event/other-event-listener/src/main/resources/META-INF/beans.xml rename to cakeshop-event/other-event-listener/src/main/resources/META-INF/beans.xml diff --git a/example-context/example-service/example-event/other-event-listener/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/cakeshop-event/other-event-listener/src/main/webapp/WEB-INF/jboss-deployment-structure.xml similarity index 100% rename from example-context/example-service/example-event/other-event-listener/src/main/webapp/WEB-INF/jboss-deployment-structure.xml rename to cakeshop-event/other-event-listener/src/main/webapp/WEB-INF/jboss-deployment-structure.xml diff --git a/cakeshop-event/other-event-listener/src/yaml/event-sources.yaml b/cakeshop-event/other-event-listener/src/yaml/event-sources.yaml new file mode 100644 index 00000000..845bd708 --- /dev/null +++ b/cakeshop-event/other-event-listener/src/yaml/event-sources.yaml @@ -0,0 +1,6 @@ +event_sources: +- name: private.event.source + location: + jms_uri: jms:topic:other.event + rest_uri: http://localhost:8080/cakeshop/event-source-api/rest + data_source: java:/app/cakeshop-service/DS.eventstore \ No newline at end of file diff --git a/example-context/example-service/example-event/other-event-listener/src/yaml/json/add-recipe.json b/cakeshop-event/other-event-listener/src/yaml/json/add-recipe.json similarity index 100% rename from example-context/example-service/example-event/other-event-listener/src/yaml/json/add-recipe.json rename to cakeshop-event/other-event-listener/src/yaml/json/add-recipe.json diff --git a/example-context/example-service/example-event/other-event-listener/src/yaml/json/schema/other.recipe-added.json b/cakeshop-event/other-event-listener/src/yaml/json/schema/other.recipe-added.json similarity index 93% rename from example-context/example-service/example-event/other-event-listener/src/yaml/json/schema/other.recipe-added.json rename to cakeshop-event/other-event-listener/src/yaml/json/schema/other.recipe-added.json index 5056444d..d1625561 100644 --- a/example-context/example-service/example-event/other-event-listener/src/yaml/json/schema/other.recipe-added.json +++ b/cakeshop-event/other-event-listener/src/yaml/json/schema/other.recipe-added.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/event/other.recipe-added.json", + "id": "http://justice.gov.uk/cakeshop/event/other.recipe-added.json", "type": "object", "properties": { "recipeId": { diff --git a/example-context/example-service/example-event/other-event-listener/src/yaml/subscriptions-descriptor.yaml b/cakeshop-event/other-event-listener/src/yaml/subscriptions-descriptor.yaml similarity index 70% rename from example-context/example-service/example-event/other-event-listener/src/yaml/subscriptions-descriptor.yaml rename to cakeshop-event/other-event-listener/src/yaml/subscriptions-descriptor.yaml index 6dfa4f93..33b0536a 100644 --- a/example-context/example-service/example-event/other-event-listener/src/yaml/subscriptions-descriptor.yaml +++ b/cakeshop-event/other-event-listener/src/yaml/subscriptions-descriptor.yaml @@ -1,10 +1,10 @@ subscriptions_descriptor: spec_version: 1.0.0 - service: example + service: cakeshop service_component: OTHER_EVENT_LISTENER subscriptions: - name: other event listener subscription events: - name: other.recipe-added - schema_uri: http://justice.gov.uk/example/event/other.recipe-added.json + schema_uri: http://justice.gov.uk/cakeshop/event/other.recipe-added.json event_source_name: private.event.source diff --git a/example-context/example-service/example-event/pom.xml b/cakeshop-event/pom.xml similarity index 97% rename from example-context/example-service/example-event/pom.xml rename to cakeshop-event/pom.xml index 69305710..68b64d60 100644 --- a/example-context/example-service/example-event/pom.xml +++ b/cakeshop-event/pom.xml @@ -3,20 +3,20 @@ xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - uk.gov.justice.services.example - example-service + uk.gov.justice.services.cakeshop + cake-shop-parent 17.0.2-SNAPSHOT 4.0.0 - example-event + cakeshop-event pom - example-event-listener + cakeshop-event-listener other-event-listener - example-event-processor - example-event-indexer + cakeshop-event-processor + cakeshop-event-indexer @@ -233,8 +233,8 @@ ${framework.version} - uk.gov.justice.services.example - example-event-source + uk.gov.justice.services.cakeshop + cakeshop-event-source yaml ${project.version} @@ -282,8 +282,8 @@ ${framework.version} - uk.gov.justice.services.example - example-event-source + uk.gov.justice.services.cakeshop + cakeshop-event-source yaml ${project.version} diff --git a/example-context/example-service/example-feature-control/pom.xml b/cakeshop-feature-control/pom.xml similarity index 89% rename from example-context/example-service/example-feature-control/pom.xml rename to cakeshop-feature-control/pom.xml index 15dd9c06..9f80e1be 100644 --- a/example-context/example-service/example-feature-control/pom.xml +++ b/cakeshop-feature-control/pom.xml @@ -3,13 +3,13 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - example-service - uk.gov.justice.services.example + cake-shop-parent + uk.gov.justice.services.cakeshop 17.0.2-SNAPSHOT 4.0.0 - example-feature-control + cakeshop-feature-control diff --git a/example-context/example-service/example-feature-control/src/main/java/uk/gov/moj/cpp/featurecontrol/example/HardCodedFeatureFetcher.java b/cakeshop-feature-control/src/main/java/uk/gov/moj/cpp/featurecontrol/cakeshop/HardCodedFeatureFetcher.java similarity index 95% rename from example-context/example-service/example-feature-control/src/main/java/uk/gov/moj/cpp/featurecontrol/example/HardCodedFeatureFetcher.java rename to cakeshop-feature-control/src/main/java/uk/gov/moj/cpp/featurecontrol/cakeshop/HardCodedFeatureFetcher.java index c035385a..44516d1c 100644 --- a/example-context/example-service/example-feature-control/src/main/java/uk/gov/moj/cpp/featurecontrol/example/HardCodedFeatureFetcher.java +++ b/cakeshop-feature-control/src/main/java/uk/gov/moj/cpp/featurecontrol/cakeshop/HardCodedFeatureFetcher.java @@ -1,4 +1,4 @@ -package uk.gov.moj.cpp.featurecontrol.example; +package uk.gov.moj.cpp.featurecontrol.cakeshop; import static java.util.Collections.singletonList; import static java.util.stream.Collectors.toList; diff --git a/example-context/example-service/example-feature-control/src/main/resources/META-INF/beans.xml b/cakeshop-feature-control/src/main/resources/META-INF/beans.xml similarity index 100% rename from example-context/example-service/example-feature-control/src/main/resources/META-INF/beans.xml rename to cakeshop-feature-control/src/main/resources/META-INF/beans.xml diff --git a/example-context/example-service/example-healthcheck/pom.xml b/cakeshop-healthcheck/pom.xml similarity index 91% rename from example-context/example-service/example-healthcheck/pom.xml rename to cakeshop-healthcheck/pom.xml index e0af2682..5622dfa0 100644 --- a/example-context/example-service/example-healthcheck/pom.xml +++ b/cakeshop-healthcheck/pom.xml @@ -3,13 +3,13 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - example-service - uk.gov.justice.services.example + cake-shop-parent + uk.gov.justice.services.cakeshop 17.0.2-SNAPSHOT 4.0.0 - example-healthcheck + cakeshop-healthcheck diff --git a/example-context/example-service/example-healthcheck/src/main/java/uk/gov/justice/services/example/cakeshop/healthcheck/CakeShopIgnoredHealthcheckNamesProvider.java b/cakeshop-healthcheck/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/healthcheck/CakeShopIgnoredHealthcheckNamesProvider.java similarity index 90% rename from example-context/example-service/example-healthcheck/src/main/java/uk/gov/justice/services/example/cakeshop/healthcheck/CakeShopIgnoredHealthcheckNamesProvider.java rename to cakeshop-healthcheck/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/healthcheck/CakeShopIgnoredHealthcheckNamesProvider.java index 1533d1bb..393c5fbb 100644 --- a/example-context/example-service/example-healthcheck/src/main/java/uk/gov/justice/services/example/cakeshop/healthcheck/CakeShopIgnoredHealthcheckNamesProvider.java +++ b/cakeshop-healthcheck/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/healthcheck/CakeShopIgnoredHealthcheckNamesProvider.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.healthcheck; +package uk.gov.justice.services.cakeshop.cakeshop.healthcheck; import static java.util.Collections.singletonList; import static uk.gov.justice.services.healthcheck.healthchecks.JobStoreHealthcheck.JOB_STORE_HEALTHCHECK_NAME; diff --git a/example-context/example-service/example-healthcheck/src/main/resources/META-INF/beans.xml b/cakeshop-healthcheck/src/main/resources/META-INF/beans.xml similarity index 100% rename from example-context/example-service/example-healthcheck/src/main/resources/META-INF/beans.xml rename to cakeshop-healthcheck/src/main/resources/META-INF/beans.xml diff --git a/example-context/example-service/example-healthcheck/src/test/java/uk/gov/justice/services/example/cakeshop/healthcheck/CakeShopIgnoredHealthcheckNamesProviderTest.java b/cakeshop-healthcheck/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/healthcheck/CakeShopIgnoredHealthcheckNamesProviderTest.java similarity index 93% rename from example-context/example-service/example-healthcheck/src/test/java/uk/gov/justice/services/example/cakeshop/healthcheck/CakeShopIgnoredHealthcheckNamesProviderTest.java rename to cakeshop-healthcheck/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/healthcheck/CakeShopIgnoredHealthcheckNamesProviderTest.java index d128d528..e67d650d 100644 --- a/example-context/example-service/example-healthcheck/src/test/java/uk/gov/justice/services/example/cakeshop/healthcheck/CakeShopIgnoredHealthcheckNamesProviderTest.java +++ b/cakeshop-healthcheck/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/healthcheck/CakeShopIgnoredHealthcheckNamesProviderTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.healthcheck; +package uk.gov.justice.services.cakeshop.cakeshop.healthcheck; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; diff --git a/example-context/example-service/example-it/pom.xml b/cakeshop-integration-test/pom.xml similarity index 61% rename from example-context/example-service/example-it/pom.xml rename to cakeshop-integration-test/pom.xml index 64624f91..aeb00972 100644 --- a/example-context/example-service/example-it/pom.xml +++ b/cakeshop-integration-test/pom.xml @@ -3,16 +3,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - uk.gov.justice.services.example - example-service + uk.gov.justice.services.cakeshop + cake-shop-parent 17.0.2-SNAPSHOT - example-it + cakeshop-integration-test ${project.build.directory}/wildfly-${wildfly.version} - - - @@ -37,8 +34,8 @@ test - uk.gov.justice.services.example - example-domain + uk.gov.justice.services.cakeshop + cakeshop-domain ${project.version} test @@ -115,8 +112,8 @@ test - uk.gov.justice.services.example - example-persistence + uk.gov.justice.services.cakeshop + cakeshop-viewstore-persistence ${project.version} test @@ -181,7 +178,6 @@ javax.servlet-api provided - @@ -232,7 +228,7 @@ - example-viewstore-liquibase + cakeshop-viewstore-liquibase liquibase/view-store-db-changelog.xml jdbc:postgresql://localhost:5432/frameworkviewstore @@ -273,7 +269,9 @@ liquibase/file-service-liquibase-db-changelog.xml - jdbc:postgresql://localhost:5432/frameworkfilestore + jdbc:postgresql://localhost:5432/fileservice + fileservice + fileservice pre-integration-test @@ -299,8 +297,8 @@ ${event-store.version} - uk.gov.justice.services.example - example-liquibase + uk.gov.justice.services.cakeshop + cakeshop-viewstore-liquibase ${project.version} @@ -325,10 +323,17 @@ - org.apache.maven.plugins maven-dependency-plugin + + + uk.gov.justice.services.cakeshop + cakeshop-service + ${project.version} + war + + unpack-wildfly @@ -350,13 +355,21 @@ - - copy-wars + copy-war-to-wildfly pre-integration-test copy + + + uk.gov.justice.services.cakeshop + cakeshop-service + ${project.version} + war + cakeshop-service.war + + ${jboss.home}/standalone/deployments @@ -385,7 +398,6 @@ - copy-jboss-module pre-integration-test @@ -408,14 +420,13 @@ - org.wildfly.plugins wildfly-maven-plugin 4.0.0.Final ${jboss.home} - ${server.config} + standalone.xml 120 -DDEFAULT_PORT=${random-http-port} @@ -451,206 +462,6 @@ - - - - - - - single-war - - - example.use-multiple-war - !true - - - - standalone.xml - - - - uk.gov.justice.services.example - example-single - ${project.version} - war - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-wars - - - - uk.gov.justice.services.example - example-single - ${project.version} - war - example-single.war - - - - - - - - - - - - - - multi-war - - - example.use-multiple-war - true - - - - - uk.gov.justice.services.example - example-command-api - ${project.version} - war - - - uk.gov.justice.services.example - example-command-handler - ${project.version} - war - - - uk.gov.justice.services.example - example-query-api - ${project.version} - war - - - uk.gov.justice.services.example - example-query-view - ${project.version} - war - - - uk.gov.justice.services.example - example-event-listener - ${project.version} - war - - - uk.gov.justice.services.example - example-event-indexer - ${project.version} - war - - - uk.gov.justice.services.example - other-event-listener - ${project.version} - war - - - uk.gov.justice.services.example - example-event-processor - ${project.version} - war - - - uk.gov.justice.services.example - example-custom-api - ${project.version} - war - - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-wars - - - - uk.gov.justice.services.example - example-command-api - ${project.version} - war - example-command-api.war - - - uk.gov.justice.services.example - example-command-handler - ${project.version} - war - example-command-handler.war - - - uk.gov.justice.services.example - example-event-listener - ${project.version} - war - example-event-listener.war - - - uk.gov.justice.services.example - example-event-indexer - ${project.version} - war - example-event-indexer.war - - - uk.gov.justice.services.example - example-event-listenerb - ${project.version} - war - example-event-listenerb.war - - - uk.gov.justice.services.example - example-event-processor - ${project.version} - war - example-event-processor.war - - - uk.gov.justice.services.example - example-query-api - ${project.version} - war - example-query-api.war - - - uk.gov.justice.services.example - example-query-view - ${project.version} - war - example-query-view.war - - - uk.gov.justice.services.example - example-custom-api - ${project.version} - war - example-custom-api.war - - - - - - - - - - diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CakeShopConcurrencyIT.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CakeShopConcurrencyIT.java similarity index 79% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CakeShopConcurrencyIT.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CakeShopConcurrencyIT.java index 3880c07d..905a8394 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CakeShopConcurrencyIT.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CakeShopConcurrencyIT.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it; +package uk.gov.justice.services.cakeshop.cakeshop.it; import static com.jayway.jsonassert.JsonAssert.with; import static java.util.UUID.randomUUID; @@ -10,18 +10,19 @@ import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsNull.notNullValue; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopMediaTypes.ADD_RECIPE_MEDIA_TYPE; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopMediaTypes.QUERY_RECIPE_MEDIA_TYPE; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopMediaTypes.REMOVE_RECIPE_MEDIA_TYPE; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_QUERY_URI; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_URI; +import static uk.gov.justice.services.cakeshop.cakeshop.it.helpers.TestConstants.DB_CONTEXT_NAME; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopMediaTypes.ADD_RECIPE_MEDIA_TYPE; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopMediaTypes.QUERY_RECIPE_MEDIA_TYPE; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopMediaTypes.REMOVE_RECIPE_MEDIA_TYPE; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_QUERY_URI; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_URI; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.Event; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.EventJdbcRepository; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.EventRepositoryFactory; -import uk.gov.justice.services.example.cakeshop.it.helpers.DatabaseManager; -import uk.gov.justice.services.example.cakeshop.it.helpers.EventFinder; -import uk.gov.justice.services.example.cakeshop.it.helpers.RestEasyClientFactory; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.DatabaseManager; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.EventFinder; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.RestEasyClientFactory; import uk.gov.justice.services.test.utils.core.http.HttpResponsePoller; import uk.gov.justice.services.test.utils.persistence.DatabaseCleaner; @@ -50,10 +51,7 @@ public class CakeShopConcurrencyIT { @BeforeEach public void before() throws Exception { client = new RestEasyClientFactory().createResteasyClient(); - - final String contextName = "framework"; - - databaseCleaner.cleanEventStoreTables(contextName); + databaseCleaner.cleanEventStoreTables(DB_CONTEXT_NAME); cleanViewstoreTables(); } @@ -94,7 +92,7 @@ public void shouldRegisterRecipeRemovedEvent() { await().until(() -> eventFinder.eventsWithPayloadContaining(recipeId).size() == 1); final Event event = eventFinder.eventsWithPayloadContaining(recipeId).get(0); - assertThat(event.getName(), is("example.events.recipe-added")); + assertThat(event.getName(), is("cakeshop.events.recipe-added")); with(event.getMetadata()) .assertEquals("stream.id", recipeId) .assertEquals("stream.version", 1); @@ -124,18 +122,14 @@ public void shouldRegisterRecipeRemovedEvent() { } private void cleanViewstoreTables() { - - final String contextName = "framework"; - - databaseCleaner.cleanViewStoreTables(contextName, + databaseCleaner.cleanViewStoreTables(DB_CONTEXT_NAME, "ingredient", "recipe", "cake", "cake_order", "processed_event" ); - - databaseCleaner.cleanStreamBufferTable(contextName); - databaseCleaner.cleanStreamStatusTable(contextName); + databaseCleaner.cleanStreamBufferTable(DB_CONTEXT_NAME); + databaseCleaner.cleanStreamStatusTable(DB_CONTEXT_NAME); } } diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CakeShopCrossOriginResourceSharingIT.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CakeShopCrossOriginResourceSharingIT.java similarity index 83% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CakeShopCrossOriginResourceSharingIT.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CakeShopCrossOriginResourceSharingIT.java index f38c6b7f..4673b5df 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CakeShopCrossOriginResourceSharingIT.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CakeShopCrossOriginResourceSharingIT.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it; +package uk.gov.justice.services.cakeshop.cakeshop.it; import static java.util.Arrays.asList; import static javax.ws.rs.core.Response.Status.OK; @@ -7,9 +7,9 @@ import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsCollectionContaining.hasItems; import static org.hamcrest.core.IsNull.nullValue; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopUris.ORDERS_RESOURCE_URI; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopUris.ORDERS_RESOURCE_URI; -import uk.gov.justice.services.example.cakeshop.it.helpers.RestEasyClientFactory; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.RestEasyClientFactory; import javax.ws.rs.client.Client; import javax.ws.rs.core.Response; @@ -37,7 +37,7 @@ public void shouldReturnCORSResponse() { final Response corsResponse = client.target(ORDERS_RESOURCE_URI + "123") .request() - .header("Origin", "http://foo.example") + .header("Origin", "http://foo.cakeshop") .header("Access-Control-Request-Headers", "CPPCLIENTCORRELATIONID") .options(); diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CakeShopEventBufferingIT.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CakeShopEventBufferingIT.java similarity index 75% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CakeShopEventBufferingIT.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CakeShopEventBufferingIT.java index db28e2ba..51fe8a09 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CakeShopEventBufferingIT.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CakeShopEventBufferingIT.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it; +package uk.gov.justice.services.cakeshop.cakeshop.it; import static java.util.UUID.fromString; import static java.util.UUID.randomUUID; @@ -6,16 +6,16 @@ import static org.awaitility.Awaitility.await; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopMediaTypes.ADD_RECIPE_MEDIA_TYPE; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopMediaTypes.CONTEXT_NAME; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_URI; +import static uk.gov.justice.services.cakeshop.cakeshop.it.helpers.TestConstants.CONTEXT_NAME; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopMediaTypes.ADD_RECIPE_MEDIA_TYPE; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_URI; import uk.gov.justice.services.event.buffer.core.repository.subscription.StreamStatusJdbcRepository; import uk.gov.justice.services.event.buffer.core.repository.subscription.Subscription; -import uk.gov.justice.services.example.cakeshop.it.helpers.CommandFactory; -import uk.gov.justice.services.example.cakeshop.it.helpers.DatabaseManager; -import uk.gov.justice.services.example.cakeshop.it.helpers.RestEasyClientFactory; -import uk.gov.justice.services.example.cakeshop.it.helpers.StandaloneStreamStatusJdbcRepositoryFactory; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.CommandFactory; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.DatabaseManager; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.RestEasyClientFactory; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.StandaloneStreamStatusJdbcRepositoryFactory; import java.util.Optional; diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CakeShopFailuresIT.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CakeShopFailuresIT.java similarity index 86% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CakeShopFailuresIT.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CakeShopFailuresIT.java index 7a8497a5..e80dab30 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CakeShopFailuresIT.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CakeShopFailuresIT.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it; +package uk.gov.justice.services.cakeshop.cakeshop.it; import static com.jayway.jsonassert.JsonAssert.with; import static java.util.Arrays.asList; @@ -13,17 +13,17 @@ import static org.awaitility.Awaitility.await; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopMediaTypes.ADD_RECIPE_MEDIA_TYPE; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopMediaTypes.QUERY_RECIPES_MEDIA_TYPE; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_QUERY_URI; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_URI; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopMediaTypes.ADD_RECIPE_MEDIA_TYPE; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopMediaTypes.QUERY_RECIPES_MEDIA_TYPE; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_QUERY_URI; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_URI; import static uk.gov.justice.services.test.utils.core.matchers.HttpStatusCodeMatcher.isStatus; -import uk.gov.justice.services.example.cakeshop.it.helpers.ApiResponse; -import uk.gov.justice.services.example.cakeshop.it.helpers.CommandSender; -import uk.gov.justice.services.example.cakeshop.it.helpers.EventFactory; -import uk.gov.justice.services.example.cakeshop.it.helpers.Querier; -import uk.gov.justice.services.example.cakeshop.it.helpers.RestEasyClientFactory; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.ApiResponse; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.CommandSender; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.EventFactory; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.Querier; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.RestEasyClientFactory; import java.util.UUID; diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CakeShopFileServiceIT.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CakeShopFileServiceIT.java similarity index 88% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CakeShopFileServiceIT.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CakeShopFileServiceIT.java index 13bc01f5..707f4b55 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CakeShopFileServiceIT.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CakeShopFileServiceIT.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it; +package uk.gov.justice.services.cakeshop.cakeshop.it; import static com.google.common.io.Resources.getResource; import static com.jayway.jsonassert.JsonAssert.with; @@ -16,19 +16,19 @@ import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsNull.notNullValue; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_QUERY_URI; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_URI; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_QUERY_URI; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_URI; import static uk.gov.justice.services.test.utils.core.matchers.HttpStatusCodeMatcher.isStatus; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.Event; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.EventJdbcRepository; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.EventRepositoryFactory; -import uk.gov.justice.services.example.cakeshop.it.helpers.CommandSender; -import uk.gov.justice.services.example.cakeshop.it.helpers.DatabaseManager; -import uk.gov.justice.services.example.cakeshop.it.helpers.EventFactory; -import uk.gov.justice.services.example.cakeshop.it.helpers.EventFinder; -import uk.gov.justice.services.example.cakeshop.it.helpers.Querier; -import uk.gov.justice.services.example.cakeshop.it.helpers.RestEasyClientFactory; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.CommandSender; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.DatabaseManager; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.EventFactory; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.EventFinder; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.Querier; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.RestEasyClientFactory; import uk.gov.justice.services.test.utils.persistence.DatabaseCleaner; import java.io.File; @@ -99,7 +99,7 @@ public void shouldReturnAcceptedStatusAndCreatEventWhenPostingPhotographToMultip await().until(() -> eventFinder.eventsWithPayloadContaining(recipeId).size() == 2); final Event event = eventFinder.eventsWithPayloadContaining(recipeId).get(1); - assertThat(event.getName(), is("example.events.recipe-photograph-added")); + assertThat(event.getName(), is("cakeshop.events.recipe-photograph-added")); with(event.getMetadata()) .assertEquals("stream.id", recipeId) .assertEquals("stream.version", 2); diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CakeShopFilteringIT.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CakeShopFilteringIT.java similarity index 85% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CakeShopFilteringIT.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CakeShopFilteringIT.java index 5bc83bf4..31e35d54 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CakeShopFilteringIT.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CakeShopFilteringIT.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it; +package uk.gov.justice.services.cakeshop.cakeshop.it; import static com.jayway.jsonassert.JsonAssert.emptyCollection; import static com.jayway.jsonassert.JsonAssert.with; @@ -10,13 +10,13 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsCollectionContaining.hasItem; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_URI; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_URI; -import uk.gov.justice.services.example.cakeshop.it.helpers.ApiResponse; -import uk.gov.justice.services.example.cakeshop.it.helpers.CommandSender; -import uk.gov.justice.services.example.cakeshop.it.helpers.EventFactory; -import uk.gov.justice.services.example.cakeshop.it.helpers.Querier; -import uk.gov.justice.services.example.cakeshop.it.helpers.RestEasyClientFactory; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.ApiResponse; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.CommandSender; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.EventFactory; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.Querier; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.RestEasyClientFactory; import javax.ws.rs.client.Client; diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CakeShopIT.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CakeShopIT.java similarity index 86% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CakeShopIT.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CakeShopIT.java index aef39efd..ffb9fdd2 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CakeShopIT.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CakeShopIT.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it; +package uk.gov.justice.services.cakeshop.cakeshop.it; import static com.jayway.jsonassert.JsonAssert.with; import static java.util.Collections.singletonList; @@ -13,26 +13,26 @@ import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsCollectionContaining.hasItem; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopMediaTypes.ADD_RECIPE_MEDIA_TYPE; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopMediaTypes.POST_RECIPES_QUERY_MEDIA_TYPE; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopMediaTypes.QUERY_RECIPES_MEDIA_TYPE; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopMediaTypes.REMOVE_RECIPE_MEDIA_TYPE; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopUris.OVEN_RESOURCE_CUSTOM_URI; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_QUERY_URI; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_URI; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopMediaTypes.ADD_RECIPE_MEDIA_TYPE; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopMediaTypes.POST_RECIPES_QUERY_MEDIA_TYPE; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopMediaTypes.QUERY_RECIPES_MEDIA_TYPE; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopMediaTypes.REMOVE_RECIPE_MEDIA_TYPE; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopUris.OVEN_RESOURCE_CUSTOM_URI; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_QUERY_URI; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_URI; import static uk.gov.justice.services.test.utils.core.matchers.HttpStatusCodeMatcher.isStatus; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.Event; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.EventJdbcRepository; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.EventRepositoryFactory; -import uk.gov.justice.services.example.cakeshop.it.helpers.ApiResponse; -import uk.gov.justice.services.example.cakeshop.it.helpers.CommandFactory; -import uk.gov.justice.services.example.cakeshop.it.helpers.CommandSender; -import uk.gov.justice.services.example.cakeshop.it.helpers.DatabaseManager; -import uk.gov.justice.services.example.cakeshop.it.helpers.EventFactory; -import uk.gov.justice.services.example.cakeshop.it.helpers.EventFinder; -import uk.gov.justice.services.example.cakeshop.it.helpers.Querier; -import uk.gov.justice.services.example.cakeshop.it.helpers.RestEasyClientFactory; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.ApiResponse; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.CommandFactory; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.CommandSender; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.DatabaseManager; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.EventFactory; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.EventFinder; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.Querier; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.RestEasyClientFactory; import javax.sql.DataSource; import javax.ws.rs.client.Client; @@ -123,7 +123,7 @@ public void shouldProcessRecipeAddedEvent() { await().until(() -> eventFinder.eventsWithPayloadContaining(recipeId).size() == 1); final Event event = eventFinder.eventsWithPayloadContaining(recipeId).get(0); - assertThat(event.getName(), is("example.events.recipe-added")); + assertThat(event.getName(), is("cakeshop.events.recipe-added")); with(event.getMetadata()) .assertEquals("stream.id", recipeId) .assertEquals("stream.version", 1); @@ -248,7 +248,7 @@ public void shouldUpdateRecipeWithNewName() throws Exception { @Test public void shouldQueryForOvenStatus() throws Exception { - final Response response = client.target(OVEN_RESOURCE_CUSTOM_URI).request().accept("application/vnd.example.status+json").get(); + final Response response = client.target(OVEN_RESOURCE_CUSTOM_URI).request().accept("application/vnd.cakeshop.status+json").get(); assertThat(response.getStatus(), isStatus(OK)); final String entity = response.readEntity(String.class); diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CakeShopManyUpdatesIT.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CakeShopManyUpdatesIT.java similarity index 86% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CakeShopManyUpdatesIT.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CakeShopManyUpdatesIT.java index f1911047..c2ffae65 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CakeShopManyUpdatesIT.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CakeShopManyUpdatesIT.java @@ -1,16 +1,16 @@ -package uk.gov.justice.services.example.cakeshop.it; +package uk.gov.justice.services.cakeshop.cakeshop.it; import static java.util.Optional.empty; import static java.util.Optional.of; import static java.util.UUID.randomUUID; import static javax.ws.rs.core.Response.Status.OK; import static org.junit.jupiter.api.Assertions.assertNull; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_URI; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_URI; -import uk.gov.justice.services.example.cakeshop.it.helpers.EventFactory; -import uk.gov.justice.services.example.cakeshop.it.helpers.JmsBootstrapper; -import uk.gov.justice.services.example.cakeshop.it.helpers.Querier; -import uk.gov.justice.services.example.cakeshop.it.helpers.RestEasyClientFactory; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.EventFactory; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.JmsBootstrapper; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.Querier; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.RestEasyClientFactory; import uk.gov.justice.services.test.utils.core.messaging.Poller; import javax.jms.JMSException; @@ -26,7 +26,7 @@ public class CakeShopManyUpdatesIT { - private static final String COMMAND_HANDLER_QUEUE = "example.handler.command"; + private static final String COMMAND_HANDLER_QUEUE = "cakeshop.handler.command"; private static final String DEAD_LETTER_QUEUE = "DLQ"; private final JmsBootstrapper jmsBootstrapper = new JmsBootstrapper(); diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CakeShopTimeStampIT.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CakeShopTimeStampIT.java similarity index 87% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CakeShopTimeStampIT.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CakeShopTimeStampIT.java index 2f8811b8..2b1af989 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CakeShopTimeStampIT.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CakeShopTimeStampIT.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it; +package uk.gov.justice.services.cakeshop.cakeshop.it; import static com.jayway.jsonassert.JsonAssert.with; import static java.util.UUID.randomUUID; @@ -11,18 +11,18 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.core.IsNull.notNullValue; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopMediaTypes.ORDER_CAKE_MEDIA_TYPE; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopUris.ORDERS_RESOURCE_URI; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopMediaTypes.ORDER_CAKE_MEDIA_TYPE; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopUris.ORDERS_RESOURCE_URI; import static uk.gov.justice.services.test.utils.core.matchers.HttpStatusCodeMatcher.isStatus; import uk.gov.justice.services.common.util.UtcClock; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.Event; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.EventJdbcRepository; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.EventRepositoryFactory; -import uk.gov.justice.services.example.cakeshop.it.helpers.ApiResponse; -import uk.gov.justice.services.example.cakeshop.it.helpers.DatabaseManager; -import uk.gov.justice.services.example.cakeshop.it.helpers.Querier; -import uk.gov.justice.services.example.cakeshop.it.helpers.RestEasyClientFactory; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.ApiResponse; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.DatabaseManager; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.Querier; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.RestEasyClientFactory; import java.util.UUID; import java.util.stream.Stream; diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CatchupPerformanceIT.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CatchupPerformanceIT.java similarity index 77% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CatchupPerformanceIT.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CatchupPerformanceIT.java index 08453904..bf752d07 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/CatchupPerformanceIT.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/CatchupPerformanceIT.java @@ -1,57 +1,47 @@ -package uk.gov.justice.services.example.cakeshop.it; - -import static java.lang.Integer.parseInt; -import static java.lang.String.format; -import static java.lang.System.getProperty; -import static java.util.Optional.empty; -import static java.util.Optional.of; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.jupiter.api.Assertions.fail; -import static uk.gov.justice.services.eventstore.management.commands.EventCatchupCommand.CATCHUP; -import static uk.gov.justice.services.jmx.api.mbean.CommandRunMode.GUARDED; -import static uk.gov.justice.services.jmx.system.command.client.connection.JmxParametersBuilder.jmxParameters; -import static uk.gov.justice.services.test.utils.common.host.TestHostProvider.getHost; - -import uk.gov.justice.services.eventsourcing.repository.jdbc.event.Event; -import uk.gov.justice.services.example.cakeshop.it.helpers.BatchEventInserter; -import uk.gov.justice.services.example.cakeshop.it.helpers.CakeshopEventGenerator; -import uk.gov.justice.services.example.cakeshop.it.helpers.DatabaseManager; -import uk.gov.justice.services.example.cakeshop.it.helpers.PositionInStreamIterator; -import uk.gov.justice.services.example.cakeshop.it.helpers.ProcessedEventCounter; -import uk.gov.justice.services.example.cakeshop.it.helpers.RestEasyClientFactory; -import uk.gov.justice.services.jmx.system.command.client.SystemCommanderClient; -import uk.gov.justice.services.jmx.system.command.client.TestSystemCommanderClientFactory; -import uk.gov.justice.services.jmx.system.command.client.connection.JmxParameters; -import uk.gov.justice.services.test.utils.core.messaging.Poller; -import uk.gov.justice.services.test.utils.persistence.DatabaseCleaner; +package uk.gov.justice.services.cakeshop.cakeshop.it; import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.UUID; - import javax.sql.DataSource; import javax.ws.rs.client.Client; - import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import uk.gov.justice.services.eventsourcing.repository.jdbc.event.Event; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.BatchEventInserter; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.CakeshopEventGenerator; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.DatabaseManager; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.PositionInStreamIterator; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.ProcessedEventCounter; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.RestEasyClientFactory; +import uk.gov.justice.services.jmx.system.command.client.SystemCommanderClient; +import uk.gov.justice.services.jmx.system.command.client.TestSystemCommanderClientFactory; +import uk.gov.justice.services.test.utils.core.messaging.Poller; +import uk.gov.justice.services.test.utils.persistence.DatabaseCleaner; + +import static java.lang.String.format; +import static java.util.Optional.empty; +import static java.util.Optional.of; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.fail; +import static uk.gov.justice.services.eventstore.management.commands.EventCatchupCommand.CATCHUP; +import static uk.gov.justice.services.cakeshop.cakeshop.it.helpers.JmxParametersFactory.buildJmxParameters; +import static uk.gov.justice.services.cakeshop.cakeshop.it.helpers.TestConstants.CONTEXT_NAME; +import static uk.gov.justice.services.cakeshop.cakeshop.it.helpers.TestConstants.DB_CONTEXT_NAME; +import static uk.gov.justice.services.jmx.api.mbean.CommandRunMode.GUARDED; public class CatchupPerformanceIT { private static final int BATCH_INSERT_SIZE = 10_000; - private static final String CONTEXT_NAME = "example"; - private final DataSource eventStoreDataSource = new DatabaseManager().initEventStoreDb(); private final DataSource viewStoreDataSource = new DatabaseManager().initViewStoreDb(); private final ProcessedEventCounter processedEventCounter = new ProcessedEventCounter(viewStoreDataSource); - private static final String HOST = getHost(); - private static final int PORT = parseInt(getProperty("random.management.port")); - private final TestSystemCommanderClientFactory systemCommanderClientFactory = new TestSystemCommanderClientFactory(); private final DatabaseCleaner databaseCleaner = new DatabaseCleaner(); @@ -63,12 +53,9 @@ public class CatchupPerformanceIT { @BeforeEach public void before() { client = new RestEasyClientFactory().createResteasyClient(); - - final String contextName = "framework"; - - databaseCleaner.cleanEventStoreTables(contextName); + databaseCleaner.cleanEventStoreTables(DB_CONTEXT_NAME); cleanViewstoreTables(); - databaseCleaner.cleanSystemTables(contextName); + databaseCleaner.cleanSystemTables(DB_CONTEXT_NAME); } @AfterEach @@ -164,30 +151,21 @@ private void addEventsToEventLog(final int numberOfStreams, final int numberOfEv private void runCatchup() throws Exception { - final JmxParameters jmxParameters = jmxParameters() - .withHost(HOST) - .withPort(PORT) - .build(); - - try (final SystemCommanderClient systemCommanderClient = systemCommanderClientFactory.create(jmxParameters)) { + try (final SystemCommanderClient systemCommanderClient = systemCommanderClientFactory.create(buildJmxParameters())) { systemCommanderClient.getRemote(CONTEXT_NAME).call(CATCHUP, GUARDED); } } private void cleanViewstoreTables() { - - final String contextName = "framework"; - - databaseCleaner.cleanViewStoreTables(contextName, + databaseCleaner.cleanViewStoreTables(DB_CONTEXT_NAME, "ingredient", "recipe", "cake", "cake_order", "processed_event" ); - - databaseCleaner.cleanStreamBufferTable(contextName); - databaseCleaner.cleanStreamStatusTable(contextName); + databaseCleaner.cleanStreamBufferTable(DB_CONTEXT_NAME); + databaseCleaner.cleanStreamStatusTable(DB_CONTEXT_NAME); } } diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/EventHealingIT.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/EventHealingIT.java similarity index 73% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/EventHealingIT.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/EventHealingIT.java index 88722467..a1069716 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/EventHealingIT.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/EventHealingIT.java @@ -1,37 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it; - -import static java.lang.Integer.valueOf; -import static java.lang.System.getProperty; -import static java.util.Optional.empty; -import static java.util.Optional.of; -import static java.util.UUID.randomUUID; -import static javax.ws.rs.client.Entity.entity; -import static javax.ws.rs.core.Response.Status.ACCEPTED; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.jupiter.api.Assertions.fail; -import static uk.gov.justice.services.eventstore.management.commands.EventCatchupCommand.CATCHUP; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopMediaTypes.ADD_RECIPE_MEDIA_TYPE; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_URI; -import static uk.gov.justice.services.jmx.api.mbean.CommandRunMode.GUARDED; -import static uk.gov.justice.services.jmx.system.command.client.connection.JmxParametersBuilder.jmxParameters; -import static uk.gov.justice.services.test.utils.common.host.TestHostProvider.getHost; -import static uk.gov.justice.services.test.utils.core.matchers.HttpStatusCodeMatcher.isStatus; - -import uk.gov.justice.services.eventsourcing.repository.jdbc.event.EventJdbcRepository; -import uk.gov.justice.services.eventsourcing.repository.jdbc.event.EventRepositoryFactory; -import uk.gov.justice.services.eventsourcing.repository.jdbc.event.EventStreamJdbsRepositoryFactory; -import uk.gov.justice.services.eventsourcing.repository.jdbc.eventstream.EventStreamJdbcRepository; -import uk.gov.justice.services.example.cakeshop.it.helpers.CommandFactory; -import uk.gov.justice.services.example.cakeshop.it.helpers.DatabaseManager; -import uk.gov.justice.services.example.cakeshop.it.helpers.ProcessedEventCounter; -import uk.gov.justice.services.example.cakeshop.it.helpers.RestEasyClientFactory; -import uk.gov.justice.services.jmx.system.command.client.SystemCommanderClient; -import uk.gov.justice.services.jmx.system.command.client.TestSystemCommanderClientFactory; -import uk.gov.justice.services.jmx.system.command.client.connection.JmxParameters; -import uk.gov.justice.services.test.utils.core.messaging.Poller; -import uk.gov.justice.services.test.utils.persistence.DatabaseCleaner; -import uk.gov.justice.services.test.utils.persistence.SequenceSetter; +package uk.gov.justice.services.cakeshop.cakeshop.it; import java.sql.Connection; import java.sql.PreparedStatement; @@ -41,31 +8,45 @@ import java.util.List; import java.util.Optional; import java.util.UUID; - import javax.sql.DataSource; import javax.ws.rs.client.Client; import javax.ws.rs.core.Response; - import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.CommandFactory; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.DatabaseManager; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.ProcessedEventCounter; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.RestEasyClientFactory; +import uk.gov.justice.services.jmx.system.command.client.SystemCommanderClient; +import uk.gov.justice.services.jmx.system.command.client.TestSystemCommanderClientFactory; +import uk.gov.justice.services.test.utils.core.messaging.Poller; +import uk.gov.justice.services.test.utils.persistence.DatabaseCleaner; +import uk.gov.justice.services.test.utils.persistence.SequenceSetter; -public class EventHealingIT { +import static java.util.Optional.empty; +import static java.util.Optional.of; +import static java.util.UUID.randomUUID; +import static javax.ws.rs.client.Entity.entity; +import static javax.ws.rs.core.Response.Status.ACCEPTED; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.fail; +import static uk.gov.justice.services.eventstore.management.commands.EventCatchupCommand.CATCHUP; +import static uk.gov.justice.services.cakeshop.cakeshop.it.helpers.JmxParametersFactory.buildJmxParameters; +import static uk.gov.justice.services.cakeshop.cakeshop.it.helpers.TestConstants.CONTEXT_NAME; +import static uk.gov.justice.services.cakeshop.cakeshop.it.helpers.TestConstants.DB_CONTEXT_NAME; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopMediaTypes.ADD_RECIPE_MEDIA_TYPE; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_URI; +import static uk.gov.justice.services.jmx.api.mbean.CommandRunMode.GUARDED; +import static uk.gov.justice.services.test.utils.core.matchers.HttpStatusCodeMatcher.isStatus; - private static final String CONTEXT_NAME = "example"; +public class EventHealingIT { private final DataSource eventStoreDataSource = new DatabaseManager().initEventStoreDb(); private final DataSource viewStoreDataSource = new DatabaseManager().initViewStoreDb(); - private final EventJdbcRepository eventJdbcRepository = new EventRepositoryFactory().getEventJdbcRepository(eventStoreDataSource); - - private final EventStreamJdbsRepositoryFactory eventStreamJdbcRepositoryFactory = new EventStreamJdbsRepositoryFactory(); - private final EventStreamJdbcRepository eventStreamJdbcRepository = eventStreamJdbcRepositoryFactory.getEventStreamJdbcRepository(eventStoreDataSource); - private final ProcessedEventCounter processedEventCounter = new ProcessedEventCounter(viewStoreDataSource); - private static final String HOST = getHost(); - private static final int PORT = valueOf(getProperty("random.management.port")); - private final CommandFactory commandFactory = new CommandFactory(); private final TestSystemCommanderClientFactory systemCommanderClientFactory = new TestSystemCommanderClientFactory(); @@ -80,11 +61,9 @@ public class EventHealingIT { public void before() { client = new RestEasyClientFactory().createResteasyClient(); - final String contextName = "framework"; - - databaseCleaner.cleanEventStoreTables(contextName); + databaseCleaner.cleanEventStoreTables(DB_CONTEXT_NAME); cleanViewstoreTables(); - databaseCleaner.cleanSystemTables(contextName); + databaseCleaner.cleanSystemTables(DB_CONTEXT_NAME); sequenceSetter.setSequenceTo(1L, "event_sequence_seq", eventStoreDataSource); } @@ -169,32 +148,22 @@ private void removeRecipesFromViewStore(final int eventNumber, final UUID recipe } private void runCatchup() throws Exception { - - final JmxParameters jmxParameters = jmxParameters() - .withHost(HOST) - .withPort(PORT) - .build(); - - try (final SystemCommanderClient systemCommanderClient = systemCommanderClientFactory.create(jmxParameters)) { + try (final SystemCommanderClient systemCommanderClient = systemCommanderClientFactory.create(buildJmxParameters())) { systemCommanderClient.getRemote(CONTEXT_NAME).call(CATCHUP, GUARDED); } } private void cleanViewstoreTables() { - - final String contextName = "framework"; - - databaseCleaner.cleanViewStoreTables(contextName, + databaseCleaner.cleanViewStoreTables(DB_CONTEXT_NAME, "ingredient", "recipe", "cake", "cake_order", "processed_event" ); - - databaseCleaner.cleanStreamBufferTable(contextName); - databaseCleaner.cleanStreamStatusTable(contextName); + databaseCleaner.cleanStreamBufferTable(DB_CONTEXT_NAME); + databaseCleaner.cleanStreamStatusTable(DB_CONTEXT_NAME); } private UUID findRecipeIdForEventNumber(final int eventNumber) throws Exception { diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/EventValidationIT.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/EventValidationIT.java similarity index 85% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/EventValidationIT.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/EventValidationIT.java index 257b3ebf..6446b7c6 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/EventValidationIT.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/EventValidationIT.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it; +package uk.gov.justice.services.cakeshop.cakeshop.it; import static java.lang.Integer.parseInt; import static java.lang.System.getProperty; @@ -8,19 +8,20 @@ import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.fail; +import static uk.gov.justice.services.cakeshop.cakeshop.it.helpers.JmxParametersFactory.buildJmxParameters; +import static uk.gov.justice.services.cakeshop.cakeshop.it.helpers.TestConstants.CONTEXT_NAME; +import static uk.gov.justice.services.cakeshop.cakeshop.it.helpers.TestConstants.DB_CONTEXT_NAME; import static uk.gov.justice.services.jmx.api.domain.CommandState.COMMAND_COMPLETE; import static uk.gov.justice.services.jmx.api.domain.CommandState.COMMAND_FAILED; import static uk.gov.justice.services.jmx.api.mbean.CommandRunMode.GUARDED; -import static uk.gov.justice.services.jmx.system.command.client.connection.JmxParametersBuilder.jmxParameters; -import static uk.gov.justice.services.test.utils.common.host.TestHostProvider.getHost; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.Event; import uk.gov.justice.services.eventstore.management.commands.ValidatePublishedEventsCommand; -import uk.gov.justice.services.example.cakeshop.it.helpers.BatchEventInserter; -import uk.gov.justice.services.example.cakeshop.it.helpers.CakeshopEventGenerator; -import uk.gov.justice.services.example.cakeshop.it.helpers.DatabaseManager; -import uk.gov.justice.services.example.cakeshop.it.helpers.PositionInStreamIterator; -import uk.gov.justice.services.example.cakeshop.it.helpers.PublishedEventCounter; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.BatchEventInserter; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.CakeshopEventGenerator; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.DatabaseManager; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.PositionInStreamIterator; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.PublishedEventCounter; import uk.gov.justice.services.jmx.api.command.SystemCommand; import uk.gov.justice.services.jmx.api.domain.CommandState; import uk.gov.justice.services.jmx.api.domain.SystemCommandStatus; @@ -48,17 +49,12 @@ public class EventValidationIT { private static final int BATCH_INSERT_SIZE = 10_000; - private static final String CONTEXT_NAME = "example"; - private final DataSource eventStoreDataSource = new DatabaseManager().initEventStoreDb(); @SuppressWarnings("unused") private final DataSource viewStoreDataSource = new DatabaseManager().initViewStoreDb(); private final DatabaseCleaner databaseCleaner = new DatabaseCleaner(); - private static final String HOST = getHost(); - private static final int PORT = parseInt(getProperty("random.management.port")); - private final TestSystemCommanderClientFactory systemCommanderClientFactory = new TestSystemCommanderClientFactory(); private final Poller poller = new Poller(); @@ -66,24 +62,16 @@ public class EventValidationIT { private PublishedEventCounter publishedEventCounter = new PublishedEventCounter(eventStoreDataSource); - private final JmxParameters jmxParameters = jmxParameters() - .withHost(HOST) - .withPort(PORT) - .build(); + private final JmxParameters jmxParameters = buildJmxParameters(); @BeforeEach public void cleanTables() { - - final String databaseContextName = "framework"; - - databaseCleaner.cleanEventStoreTables(databaseContextName); - - databaseCleaner.cleanProcessedEventTable(databaseContextName); - databaseCleaner.cleanStreamStatusTable(databaseContextName); - databaseCleaner.cleanStreamBufferTable(databaseContextName); - databaseCleaner.cleanViewStoreTables(databaseContextName, "recipe"); - - databaseCleaner.cleanSystemTables(databaseContextName); + databaseCleaner.cleanEventStoreTables(DB_CONTEXT_NAME); + databaseCleaner.cleanProcessedEventTable(DB_CONTEXT_NAME); + databaseCleaner.cleanStreamStatusTable(DB_CONTEXT_NAME); + databaseCleaner.cleanStreamBufferTable(DB_CONTEXT_NAME); + databaseCleaner.cleanViewStoreTables(DB_CONTEXT_NAME, "recipe"); + databaseCleaner.cleanSystemTables(DB_CONTEXT_NAME); } @Test diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/FeatureTogglingIT.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/FeatureTogglingIT.java similarity index 87% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/FeatureTogglingIT.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/FeatureTogglingIT.java index 1e966eac..2d432861 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/FeatureTogglingIT.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/FeatureTogglingIT.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it; +package uk.gov.justice.services.cakeshop.cakeshop.it; import static java.util.Collections.singletonList; import static java.util.UUID.randomUUID; @@ -7,15 +7,15 @@ import static javax.ws.rs.core.Response.Status.FORBIDDEN; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopMediaTypes.ADD_RECIPE_VERSION_2_MEDIA_TYPE; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_URI; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopMediaTypes.ADD_RECIPE_VERSION_2_MEDIA_TYPE; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_URI; import static uk.gov.justice.services.test.utils.core.matchers.HttpStatusCodeMatcher.isStatus; import uk.gov.justice.services.core.featurecontrol.domain.Feature; import uk.gov.justice.services.core.featurecontrol.domain.FeatureControl; -import uk.gov.justice.services.example.cakeshop.it.helpers.CommandFactory; -import uk.gov.justice.services.example.cakeshop.it.helpers.RestEasyClientFactory; -import uk.gov.justice.services.example.cakeshop.it.helpers.WildflyFeatureUpdater; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.CommandFactory; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.RestEasyClientFactory; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.WildflyFeatureUpdater; import javax.ws.rs.client.Client; import javax.ws.rs.core.Response; diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/HealthcheckIT.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/HealthcheckIT.java similarity index 85% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/HealthcheckIT.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/HealthcheckIT.java index b522067c..f597ea43 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/HealthcheckIT.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/HealthcheckIT.java @@ -1,12 +1,12 @@ -package uk.gov.justice.services.example.cakeshop.it; +package uk.gov.justice.services.cakeshop.cakeshop.it; import static com.jayway.jsonassert.JsonAssert.with; import static org.hamcrest.CoreMatchers.hasItems; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopUris.HEALTHCHECK_URI; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopUris.HEALTHCHECK_URI; -import uk.gov.justice.services.example.cakeshop.it.helpers.RestEasyClientFactory; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.RestEasyClientFactory; import javax.ws.rs.client.Client; import javax.ws.rs.core.Response; diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/ListSystemCommandsIT.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/ListSystemCommandsIT.java similarity index 81% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/ListSystemCommandsIT.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/ListSystemCommandsIT.java index 561eaec5..7306c558 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/ListSystemCommandsIT.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/ListSystemCommandsIT.java @@ -1,7 +1,12 @@ -package uk.gov.justice.services.example.cakeshop.it; +package uk.gov.justice.services.cakeshop.cakeshop.it; + +import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.Test; +import uk.gov.justice.services.jmx.api.command.SystemCommandDetails; +import uk.gov.justice.services.jmx.system.command.client.SystemCommanderClient; +import uk.gov.justice.services.jmx.system.command.client.TestSystemCommanderClientFactory; -import static java.lang.Integer.parseInt; -import static java.lang.System.getProperty; import static java.util.stream.Collectors.toMap; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; @@ -14,40 +19,20 @@ import static uk.gov.justice.services.eventstore.management.commands.ValidatePublishedEventsCommand.VALIDATE_EVENTS; import static uk.gov.justice.services.eventstore.management.commands.VerifyCatchupCommand.VERIFY_CATCHUP; import static uk.gov.justice.services.eventstore.management.commands.VerifyRebuildCommand.VERIFY_REBUILD; -import static uk.gov.justice.services.jmx.system.command.client.connection.JmxParametersBuilder.jmxParameters; +import static uk.gov.justice.services.cakeshop.cakeshop.it.helpers.JmxParametersFactory.buildJmxParameters; +import static uk.gov.justice.services.cakeshop.cakeshop.it.helpers.TestConstants.CONTEXT_NAME; import static uk.gov.justice.services.management.ping.commands.PingCommand.PING; import static uk.gov.justice.services.management.suspension.commands.RefreshFeatureControlCacheCommand.REFRESH_FEATURE_CACHE; import static uk.gov.justice.services.management.suspension.commands.SuspendCommand.SUSPEND; import static uk.gov.justice.services.management.suspension.commands.UnsuspendCommand.UNSUSPEND; -import static uk.gov.justice.services.test.utils.common.host.TestHostProvider.getHost; - -import uk.gov.justice.services.jmx.api.command.SystemCommandDetails; -import uk.gov.justice.services.jmx.system.command.client.SystemCommanderClient; -import uk.gov.justice.services.jmx.system.command.client.TestSystemCommanderClientFactory; -import uk.gov.justice.services.jmx.system.command.client.connection.JmxParameters; - -import java.util.List; -import java.util.Map; - -import org.junit.jupiter.api.Test; public class ListSystemCommandsIT { - - private static final String HOST = getHost(); - private static final int PORT = parseInt(getProperty("random.management.port")); - private static final String CONTEXT_NAME = "example"; - private final TestSystemCommanderClientFactory testSystemCommanderClientFactory = new TestSystemCommanderClientFactory(); @Test public void shouldListAllSystemCommands() throws Exception { - final JmxParameters jmxParameters = jmxParameters() - .withHost(HOST) - .withPort(PORT) - .build(); - - try (final SystemCommanderClient systemCommanderClient = testSystemCommanderClientFactory.create(jmxParameters)) { + try (final SystemCommanderClient systemCommanderClient = testSystemCommanderClientFactory.create(buildJmxParameters())) { final List systemCommandDetailsList = systemCommanderClient .getRemote(CONTEXT_NAME) diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/MultipleEventListenerCakeShopIT.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/MultipleEventListenerCakeShopIT.java similarity index 87% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/MultipleEventListenerCakeShopIT.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/MultipleEventListenerCakeShopIT.java index 94f9d302..314f1bea 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/MultipleEventListenerCakeShopIT.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/MultipleEventListenerCakeShopIT.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it; +package uk.gov.justice.services.cakeshop.cakeshop.it; import static com.jayway.jsonassert.JsonAssert.with; import static java.util.Collections.singletonList; @@ -10,18 +10,18 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.core.IsCollectionContaining.hasItem; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_URI; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_URI; import static uk.gov.justice.services.messaging.JsonEnvelope.envelopeFrom; import static uk.gov.justice.services.messaging.JsonEnvelope.metadataBuilder; import static uk.gov.justice.services.test.utils.core.matchers.HttpStatusCodeMatcher.isStatus; -import uk.gov.justice.services.example.cakeshop.it.helpers.ApiResponse; -import uk.gov.justice.services.example.cakeshop.it.helpers.CommandSender; -import uk.gov.justice.services.example.cakeshop.it.helpers.EventFactory; -import uk.gov.justice.services.example.cakeshop.it.helpers.EventSender; -import uk.gov.justice.services.example.cakeshop.it.helpers.JmsBootstrapper; -import uk.gov.justice.services.example.cakeshop.it.helpers.Querier; -import uk.gov.justice.services.example.cakeshop.it.helpers.RestEasyClientFactory; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.ApiResponse; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.CommandSender; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.EventFactory; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.EventSender; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.JmsBootstrapper; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.Querier; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.RestEasyClientFactory; import uk.gov.justice.services.messaging.JsonEnvelope; import java.util.UUID; @@ -116,7 +116,7 @@ public void shouldPublishEventToPublicTopic() throws Exception { final TextMessage message = (TextMessage) publicTopicConsumer.receive(); with(message.getText()) - .assertThat("$._metadata.name", equalTo("example.events.recipe-added")) + .assertThat("$._metadata.name", equalTo("cakeshop.events.recipe-added")) .assertThat("$._metadata.stream.id", equalTo(recipeId)) .assertThat("$.recipeId", equalTo(recipeId)) .assertThat("$.name", equalTo("Apple pie")); diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/RebuildIT.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/RebuildIT.java similarity index 83% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/RebuildIT.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/RebuildIT.java index da4c817c..33329fc9 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/RebuildIT.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/RebuildIT.java @@ -1,7 +1,26 @@ -package uk.gov.justice.services.example.cakeshop.it; +package uk.gov.justice.services.cakeshop.cakeshop.it; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.UUID; +import javax.sql.DataSource; +import javax.ws.rs.client.Client; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import uk.gov.justice.services.eventsourcing.repository.jdbc.event.Event; +import uk.gov.justice.services.eventsourcing.repository.jdbc.event.PublishedEvent; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.CommandSender; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.DatabaseManager; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.EventFactory; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.RestEasyClientFactory; +import uk.gov.justice.services.jmx.system.command.client.SystemCommanderClient; +import uk.gov.justice.services.jmx.system.command.client.TestSystemCommanderClientFactory; +import uk.gov.justice.services.test.utils.core.messaging.Poller; +import uk.gov.justice.services.test.utils.events.EventStoreDataAccess; +import uk.gov.justice.services.test.utils.persistence.DatabaseCleaner; +import uk.gov.justice.services.test.utils.persistence.SequenceSetter; -import static java.lang.Integer.valueOf; -import static java.lang.System.getProperty; import static java.util.Optional.empty; import static java.util.Optional.of; import static java.util.UUID.randomUUID; @@ -11,38 +30,11 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.fail; import static uk.gov.justice.services.eventstore.management.commands.RebuildCommand.REBUILD; +import static uk.gov.justice.services.cakeshop.cakeshop.it.helpers.JmxParametersFactory.buildJmxParameters; +import static uk.gov.justice.services.cakeshop.cakeshop.it.helpers.TestConstants.CONTEXT_NAME; import static uk.gov.justice.services.jmx.api.mbean.CommandRunMode.GUARDED; -import static uk.gov.justice.services.jmx.system.command.client.connection.JmxParametersBuilder.jmxParameters; -import static uk.gov.justice.services.test.utils.common.host.TestHostProvider.getHost; - -import uk.gov.justice.services.eventsourcing.repository.jdbc.event.Event; -import uk.gov.justice.services.eventsourcing.repository.jdbc.event.PublishedEvent; -import uk.gov.justice.services.example.cakeshop.it.helpers.CommandSender; -import uk.gov.justice.services.example.cakeshop.it.helpers.DatabaseManager; -import uk.gov.justice.services.example.cakeshop.it.helpers.EventFactory; -import uk.gov.justice.services.example.cakeshop.it.helpers.RestEasyClientFactory; -import uk.gov.justice.services.jmx.system.command.client.SystemCommanderClient; -import uk.gov.justice.services.jmx.system.command.client.TestSystemCommanderClientFactory; -import uk.gov.justice.services.jmx.system.command.client.connection.JmxParameters; -import uk.gov.justice.services.test.utils.core.messaging.Poller; -import uk.gov.justice.services.test.utils.events.EventStoreDataAccess; -import uk.gov.justice.services.test.utils.persistence.DatabaseCleaner; -import uk.gov.justice.services.test.utils.persistence.SequenceSetter; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import java.util.UUID; - -import javax.sql.DataSource; -import javax.ws.rs.client.Client; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; public class RebuildIT { - - private static final String CONTEXT_NAME = "example"; private final DataSource eventStoreDataSource = new DatabaseManager().initEventStoreDb(); private final EventFactory eventFactory = new EventFactory(); private final DatabaseCleaner databaseCleaner = new DatabaseCleaner(); @@ -53,9 +45,6 @@ public class RebuildIT { private final Poller poller = new Poller(); - private static final String HOST = getHost(); - private static final int PORT = valueOf(getProperty("random.management.port")); - private final TestSystemCommanderClientFactory testSystemCommanderClientFactory = new TestSystemCommanderClientFactory(); @BeforeEach @@ -109,12 +98,7 @@ public void shouldRenumberTheEventLogTableAndRebuldPublishedEvents() throws Exce private void invokeRebuild() throws Exception { - final JmxParameters jmxParameters = jmxParameters() - .withHost(HOST) - .withPort(PORT) - .build(); - - try(final SystemCommanderClient systemCommanderClient = testSystemCommanderClientFactory.create(jmxParameters)) { + try(final SystemCommanderClient systemCommanderClient = testSystemCommanderClientFactory.create(buildJmxParameters())) { systemCommanderClient.getRemote(CONTEXT_NAME).call(REBUILD, GUARDED); } } diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/SnapshotCakeShopIT.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/SnapshotCakeShopIT.java similarity index 88% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/SnapshotCakeShopIT.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/SnapshotCakeShopIT.java index 62e97077..3d4d57b2 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/SnapshotCakeShopIT.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/SnapshotCakeShopIT.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it; +package uk.gov.justice.services.cakeshop.cakeshop.it; import static com.jayway.jsonassert.JsonAssert.with; import static java.util.UUID.randomUUID; @@ -11,12 +11,12 @@ import uk.gov.justice.services.core.aggregate.exception.AggregateChangeDetectedException; import uk.gov.justice.services.eventsourcing.jdbc.snapshot.SnapshotJdbcRepository; import uk.gov.justice.services.eventsourcing.jdbc.snapshot.StandaloneSnapshotJdbcRepositoryFactory; -import uk.gov.justice.services.example.cakeshop.domain.aggregate.Recipe; -import uk.gov.justice.services.example.cakeshop.it.helpers.CommandSender; -import uk.gov.justice.services.example.cakeshop.it.helpers.DatabaseManager; -import uk.gov.justice.services.example.cakeshop.it.helpers.EventFactory; -import uk.gov.justice.services.example.cakeshop.it.helpers.Querier; -import uk.gov.justice.services.example.cakeshop.it.helpers.RestEasyClientFactory; +import uk.gov.justice.services.cakeshop.cakeshop.domain.aggregate.Recipe; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.CommandSender; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.DatabaseManager; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.EventFactory; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.Querier; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.RestEasyClientFactory; import java.util.Optional; import java.util.UUID; diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/SuspendIT.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/SuspendIT.java similarity index 84% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/SuspendIT.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/SuspendIT.java index f25c264d..5a205931 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/SuspendIT.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/SuspendIT.java @@ -1,9 +1,27 @@ -package uk.gov.justice.services.example.cakeshop.it; +package uk.gov.justice.services.cakeshop.cakeshop.it; + +import java.util.Optional; +import java.util.UUID; +import javax.ws.rs.client.Client; +import javax.ws.rs.core.Response.Status; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.ApiResponse; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.CommandSender; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.EventFactory; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.Querier; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.RestEasyClientFactory; +import uk.gov.justice.services.jmx.api.domain.SystemCommandStatus; +import uk.gov.justice.services.jmx.api.mbean.SystemCommanderMBean; +import uk.gov.justice.services.jmx.system.command.client.SystemCommanderClient; +import uk.gov.justice.services.jmx.system.command.client.TestSystemCommanderClientFactory; +import uk.gov.justice.services.test.utils.core.messaging.Poller; +import uk.gov.justice.services.test.utils.persistence.DatabaseCleaner; import static com.jayway.jsonassert.JsonAssert.with; -import static java.lang.Integer.parseInt; import static java.lang.String.format; -import static java.lang.System.getProperty; import static java.lang.Thread.sleep; import static java.util.Optional.empty; import static java.util.Optional.of; @@ -15,43 +33,17 @@ import static org.hamcrest.core.IsCollectionContaining.hasItem; import static org.junit.jupiter.api.Assertions.fail; import static org.slf4j.LoggerFactory.getLogger; +import static uk.gov.justice.services.cakeshop.cakeshop.it.helpers.JmxParametersFactory.buildJmxParameters; +import static uk.gov.justice.services.cakeshop.cakeshop.it.helpers.TestConstants.CONTEXT_NAME; import static uk.gov.justice.services.jmx.api.domain.CommandState.COMMAND_COMPLETE; import static uk.gov.justice.services.jmx.api.mbean.CommandRunMode.FORCED; import static uk.gov.justice.services.jmx.api.mbean.CommandRunMode.GUARDED; -import static uk.gov.justice.services.jmx.system.command.client.connection.JmxParametersBuilder.jmxParameters; import static uk.gov.justice.services.management.suspension.commands.SuspendCommand.SUSPEND; import static uk.gov.justice.services.management.suspension.commands.UnsuspendCommand.UNSUSPEND; -import static uk.gov.justice.services.test.utils.common.host.TestHostProvider.getHost; import static uk.gov.justice.services.test.utils.core.matchers.HttpStatusCodeMatcher.isStatus; -import uk.gov.justice.services.example.cakeshop.it.helpers.ApiResponse; -import uk.gov.justice.services.example.cakeshop.it.helpers.CommandSender; -import uk.gov.justice.services.example.cakeshop.it.helpers.EventFactory; -import uk.gov.justice.services.example.cakeshop.it.helpers.Querier; -import uk.gov.justice.services.example.cakeshop.it.helpers.RestEasyClientFactory; -import uk.gov.justice.services.jmx.api.domain.SystemCommandStatus; -import uk.gov.justice.services.jmx.api.mbean.SystemCommanderMBean; -import uk.gov.justice.services.jmx.system.command.client.SystemCommanderClient; -import uk.gov.justice.services.jmx.system.command.client.TestSystemCommanderClientFactory; -import uk.gov.justice.services.jmx.system.command.client.connection.JmxParameters; -import uk.gov.justice.services.test.utils.core.messaging.Poller; -import uk.gov.justice.services.test.utils.persistence.DatabaseCleaner; - -import java.util.Optional; -import java.util.UUID; - -import javax.ws.rs.client.Client; -import javax.ws.rs.core.Response.Status; - -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.slf4j.Logger; - public class SuspendIT { - private static final String CONTEXT_NAME = "example"; - private static final Logger logger = getLogger(SuspendIT.class); private static final String MARBLE_CAKE = "Marble cake"; private static final String CARROT_CAKE = "Carrot cake"; @@ -62,9 +54,6 @@ public class SuspendIT { private Querier querier; private CommandSender commandSender; - private static final String HOST = getHost(); - private static final int PORT = parseInt(getProperty("random.management.port")); - private final TestSystemCommanderClientFactory testSystemCommanderClientFactory = new TestSystemCommanderClientFactory(); private final DatabaseCleaner databaseCleaner = new DatabaseCleaner(); private final Poller poller = new Poller(); @@ -84,12 +73,7 @@ public void cleanup() throws Exception { client.close(); //invoke unsuspending - Always ensure unsuspend is invoked as we cannot guarantee order of execution for other Cakeshop ITs - - final JmxParameters jmxParameters = jmxParameters() - .withHost(HOST) - .withPort(PORT) - .build(); - try (final SystemCommanderClient systemCommanderClient = testSystemCommanderClientFactory.create(jmxParameters)) { + try (final SystemCommanderClient systemCommanderClient = testSystemCommanderClientFactory.create(buildJmxParameters())) { final SystemCommanderMBean systemCommanderMBean = systemCommanderClient.getRemote(CONTEXT_NAME); @@ -114,11 +98,7 @@ public void cleanup() throws Exception { public void shouldNotReturnRecipesAfterSuspending() throws Exception { //invoke suspending - final JmxParameters jmxParameters = jmxParameters() - .withHost(HOST) - .withPort(PORT) - .build(); - try (final SystemCommanderClient systemCommanderClient = testSystemCommanderClientFactory.create(jmxParameters)) { + try (final SystemCommanderClient systemCommanderClient = testSystemCommanderClientFactory.create(buildJmxParameters())) { final SystemCommanderMBean systemCommanderMBean = systemCommanderClient.getRemote(CONTEXT_NAME); final UUID commandId = systemCommanderMBean.call(SUSPEND, FORCED); @@ -149,12 +129,7 @@ public void shouldNotReturnRecipesAfterSuspending() throws Exception { @Test public void shouldQueryForRecipesAfterUnShuttering() throws Exception { - - final JmxParameters jmxParameters = jmxParameters() - .withHost(HOST) - .withPort(PORT) - .build(); - try (final SystemCommanderClient systemCommanderClient = testSystemCommanderClientFactory.create(jmxParameters)) { + try (final SystemCommanderClient systemCommanderClient = testSystemCommanderClientFactory.create(buildJmxParameters())) { final SystemCommanderMBean systemCommanderMBean = systemCommanderClient.getRemote(CONTEXT_NAME); diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/UnifiedSearchIndexerIT.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/UnifiedSearchIndexerIT.java similarity index 75% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/UnifiedSearchIndexerIT.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/UnifiedSearchIndexerIT.java index 2673f2ef..8d8567b7 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/UnifiedSearchIndexerIT.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/UnifiedSearchIndexerIT.java @@ -1,4 +1,15 @@ -package uk.gov.justice.services.example.cakeshop.it; +package uk.gov.justice.services.cakeshop.cakeshop.it; + +import java.util.UUID; +import javax.ws.rs.client.Client; +import javax.ws.rs.core.Response; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.ApiResponse; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.Querier; +import uk.gov.justice.services.cakeshop.cakeshop.it.helpers.RestEasyClientFactory; +import uk.gov.justice.services.test.utils.persistence.DatabaseCleaner; import static com.jayway.jsonassert.JsonAssert.with; import static java.util.UUID.randomUUID; @@ -9,24 +20,11 @@ import static org.awaitility.Awaitility.await; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopMediaTypes.ORDER_CAKE_MEDIA_TYPE; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopUris.ORDERS_RESOURCE_URI; +import static uk.gov.justice.services.cakeshop.cakeshop.it.helpers.TestConstants.DB_CONTEXT_NAME; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopMediaTypes.ORDER_CAKE_MEDIA_TYPE; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopUris.ORDERS_RESOURCE_URI; import static uk.gov.justice.services.test.utils.core.matchers.HttpStatusCodeMatcher.isStatus; -import uk.gov.justice.services.example.cakeshop.it.helpers.ApiResponse; -import uk.gov.justice.services.example.cakeshop.it.helpers.Querier; -import uk.gov.justice.services.example.cakeshop.it.helpers.RestEasyClientFactory; -import uk.gov.justice.services.test.utils.persistence.DatabaseCleaner; - -import java.util.UUID; - -import javax.ws.rs.client.Client; -import javax.ws.rs.core.Response; - -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - public class UnifiedSearchIndexerIT { private final Client client = new RestEasyClientFactory().createResteasyClient(); @@ -36,10 +34,7 @@ public class UnifiedSearchIndexerIT { @BeforeEach public void before() throws Exception { - - final String contextName = "framework"; - - databaseCleaner.cleanEventStoreTables(contextName); + databaseCleaner.cleanEventStoreTables(DB_CONTEXT_NAME); cleanViewstoreTables(); } @@ -74,18 +69,14 @@ public void shouldIndexData() { } private void cleanViewstoreTables() { - - final String contextName = "framework"; - - databaseCleaner.cleanViewStoreTables(contextName, + databaseCleaner.cleanViewStoreTables(DB_CONTEXT_NAME, "ingredient", "recipe", "cake", "cake_order", "processed_event" ); - - databaseCleaner.cleanStreamBufferTable(contextName); - databaseCleaner.cleanStreamStatusTable(contextName); + databaseCleaner.cleanStreamBufferTable(DB_CONTEXT_NAME); + databaseCleaner.cleanStreamStatusTable(DB_CONTEXT_NAME); } } diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/ApiResponse.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/ApiResponse.java similarity index 92% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/ApiResponse.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/ApiResponse.java index 1ec8f10c..32577dff 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/ApiResponse.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/ApiResponse.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it.helpers; +package uk.gov.justice.services.cakeshop.cakeshop.it.helpers; import javax.ws.rs.core.Response; diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/BatchEventInserter.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/BatchEventInserter.java similarity index 98% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/BatchEventInserter.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/BatchEventInserter.java index daccfc7b..267351ed 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/BatchEventInserter.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/BatchEventInserter.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it.helpers; +package uk.gov.justice.services.cakeshop.cakeshop.it.helpers; import static java.lang.String.format; import static uk.gov.justice.services.common.converter.ZonedDateTimes.toSqlTimestamp; diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/CakeshopEventGenerator.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/CakeshopEventGenerator.java similarity index 90% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/CakeshopEventGenerator.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/CakeshopEventGenerator.java index a2d6b0a3..c72744e1 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/CakeshopEventGenerator.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/CakeshopEventGenerator.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it.helpers; +package uk.gov.justice.services.cakeshop.cakeshop.it.helpers; import static java.lang.String.format; import static java.util.UUID.randomUUID; @@ -21,7 +21,7 @@ public class CakeshopEventGenerator { private final Clock clock = new UtcClock(); - private static final String EVENT_SOURCE = "example"; + private static final String EVENT_SOURCE = "cakeshop"; public Event createRecipeAddedEvent(final long seed, final PositionInStreamIterator positionInStreamIterator) { @@ -34,7 +34,7 @@ public Event createRecipeAddedEvent(final long seed, final PositionInStreamItera final Metadata metadata = metadataBuilder() .createdAt(now) .withId(randomUUID()) - .withName("example.events.recipe-added") + .withName("cakeshop.events.recipe-added") .withCausation(randomUUID(), randomUUID()) .withStreamId(recipeId) .withPosition(position) @@ -61,7 +61,7 @@ public Event createRecipeAddedEvent(final long seed, final PositionInStreamItera randomUUID(), recipeId, position, - "example.events.recipe-added", + "cakeshop.events.recipe-added", metadata.asJsonObject().toString(), recipe, now); @@ -75,7 +75,7 @@ public Event createRecipeRenamedEvent(final UUID recipeId, final long seed, fina final Metadata metadata = metadataBuilder() .createdAt(now) .withId(randomUUID()) - .withName("example.events.recipe-renamed") + .withName("cakeshop.events.recipe-renamed") .withCausation(randomUUID(), randomUUID()) .withStreamId(recipeId) .withPosition(position) @@ -92,7 +92,7 @@ public Event createRecipeRenamedEvent(final UUID recipeId, final long seed, fina randomUUID(), recipeId, position, - "example.events.recipe-renamed", + "cakeshop.events.recipe-renamed", metadata.asJsonObject().toString(), recipeRename, now); @@ -110,7 +110,7 @@ public Event createCakeOrderedEvent(final PositionInStreamIterator positionInStr final Metadata metadata = metadataBuilder() .createdAt(now) .withId(randomUUID()) - .withName("example.events.cake-ordered") + .withName("cakeshop.events.cake-ordered") .withCausation(randomUUID(), randomUUID()) .withStreamId(orderId) .withPosition(position) @@ -130,7 +130,7 @@ public Event createCakeOrderedEvent(final PositionInStreamIterator positionInStr randomUUID(), recipeId, position, - "example.events.cake-ordered", + "cakeshop.events.cake-ordered", metadata.asJsonObject().toString(), cakeOrdered, now); diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/CommandFactory.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/CommandFactory.java similarity index 96% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/CommandFactory.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/CommandFactory.java index f9475879..ee6106de 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/CommandFactory.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/CommandFactory.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it.helpers; +package uk.gov.justice.services.cakeshop.cakeshop.it.helpers; import static javax.json.Json.createArrayBuilder; import static javax.json.Json.createObjectBuilder; diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/CommandSender.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/CommandSender.java similarity index 71% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/CommandSender.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/CommandSender.java index fc73b3f4..2b5d9ab4 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/CommandSender.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/CommandSender.java @@ -1,14 +1,14 @@ -package uk.gov.justice.services.example.cakeshop.it.helpers; +package uk.gov.justice.services.cakeshop.cakeshop.it.helpers; import static java.lang.String.format; import static javax.ws.rs.client.Entity.entity; import static javax.ws.rs.core.Response.Status.ACCEPTED; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopMediaTypes.MAKE_CAKE_MEDIA_TYPE; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopMediaTypes.MAKE_CAKE_STATUS_MEDIA_TYPE; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopUris.CAKES_RESOURCE_URI_FORMAT; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_URI; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopMediaTypes.MAKE_CAKE_MEDIA_TYPE; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopMediaTypes.MAKE_CAKE_STATUS_MEDIA_TYPE; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopUris.CAKES_RESOURCE_URI_FORMAT; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_URI; import javax.ws.rs.client.Client; import javax.ws.rs.core.Response; diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/DatabaseManager.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/DatabaseManager.java similarity index 89% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/DatabaseManager.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/DatabaseManager.java index 6c794eca..279324c5 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/DatabaseManager.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/DatabaseManager.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it.helpers; +package uk.gov.justice.services.cakeshop.cakeshop.it.helpers; import javax.sql.DataSource; @@ -15,8 +15,8 @@ public DataSource initEventStoreDb() { } public DataSource initViewStoreDb() { - return initDatabase("db.example.url", "db.example.userName", - "db.example.password"); + return initDatabase("db.cakeshop.url", "db.cakeshop.userName", + "db.cakeshop.password"); } public DataSource initSystemDb() { diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/EventFactory.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/EventFactory.java similarity index 82% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/EventFactory.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/EventFactory.java index 1bcef572..2f4f8d69 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/EventFactory.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/EventFactory.java @@ -1,10 +1,10 @@ -package uk.gov.justice.services.example.cakeshop.it.helpers; +package uk.gov.justice.services.cakeshop.cakeshop.it.helpers; import static javax.json.Json.createArrayBuilder; import static javax.json.Json.createObjectBuilder; import static javax.ws.rs.client.Entity.entity; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopMediaTypes.ADD_RECIPE_MEDIA_TYPE; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopMediaTypes.RENAME_RECIPE_MEDIA_TYPE; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopMediaTypes.ADD_RECIPE_MEDIA_TYPE; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopMediaTypes.RENAME_RECIPE_MEDIA_TYPE; import javax.ws.rs.client.Entity; diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/EventFinder.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/EventFinder.java similarity index 92% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/EventFinder.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/EventFinder.java index 821b3fe9..8f1b06a7 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/EventFinder.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/EventFinder.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it.helpers; +package uk.gov.justice.services.cakeshop.cakeshop.it.helpers; import static java.util.stream.Collectors.toList; diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/EventSender.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/EventSender.java similarity index 94% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/EventSender.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/EventSender.java index fabbc856..4fec7263 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/EventSender.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/EventSender.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it.helpers; +package uk.gov.justice.services.cakeshop.cakeshop.it.helpers; import uk.gov.justice.services.messaging.JsonEnvelope; diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/IndexerTableInspector.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/IndexerTableInspector.java similarity index 93% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/IndexerTableInspector.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/IndexerTableInspector.java index df9a9622..cff7f76c 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/IndexerTableInspector.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/IndexerTableInspector.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it.helpers; +package uk.gov.justice.services.cakeshop.cakeshop.it.helpers; import java.sql.Connection; diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/JmsBootstrapper.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/JmsBootstrapper.java similarity index 76% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/JmsBootstrapper.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/JmsBootstrapper.java index 879dd606..35151456 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/JmsBootstrapper.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/JmsBootstrapper.java @@ -1,6 +1,9 @@ -package uk.gov.justice.services.example.cakeshop.it.helpers; +package uk.gov.justice.services.cakeshop.cakeshop.it.helpers; import static javax.jms.Session.AUTO_ACKNOWLEDGE; +import static uk.gov.justice.services.cakeshop.cakeshop.it.helpers.SystemPropertyFinder.findJmsPort; +import static uk.gov.justice.services.cakeshop.cakeshop.it.helpers.SystemPropertyFinder.findJmsUserName; +import static uk.gov.justice.services.cakeshop.cakeshop.it.helpers.SystemPropertyFinder.findJmsUserPassword; import javax.jms.Connection; import javax.jms.JMSException; @@ -14,11 +17,10 @@ public class JmsBootstrapper { - private static final String JMS_USERNAME = "jmsuser"; - - private static final String JMS_PASSWORD = "jms@user123"; - private static final String RANDOM_JMS_PORT = System.getProperty("random.jms.port"); - private static final String JMS_BROKER_URL = "tcp://localhost:" + RANDOM_JMS_PORT; + private static final String JMS_USERNAME = findJmsUserName(); + private static final String JMS_PASSWORD = findJmsUserPassword(); + private static final String JMS_PORT = findJmsPort(); + private static final String JMS_BROKER_URL = "tcp://localhost:" + JMS_PORT; private final ActiveMQConnectionFactory jmsConnectionFactory = new ActiveMQConnectionFactory(JMS_BROKER_URL); diff --git a/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/JmxParametersFactory.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/JmxParametersFactory.java new file mode 100644 index 00000000..64c4b516 --- /dev/null +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/JmxParametersFactory.java @@ -0,0 +1,37 @@ +package uk.gov.justice.services.cakeshop.cakeshop.it.helpers; + +import uk.gov.justice.services.jmx.system.command.client.connection.JmxParameters; + +import static uk.gov.justice.services.cakeshop.cakeshop.it.helpers.SystemPropertyFinder.findWildflyManagementPort; +import static uk.gov.justice.services.cakeshop.cakeshop.it.helpers.SystemPropertyFinder.hasRandomJmsPortConfigured; +import static uk.gov.justice.services.jmx.system.command.client.connection.JmxParametersBuilder.jmxParameters; +import static uk.gov.justice.services.test.utils.common.host.TestHostProvider.getHost; + +public class JmxParametersFactory { + private static final String HOST = getHost(); + private static final int PORT = findWildflyManagementPort(); + private static final String STANDALONE_WILDFLY_USER = "admin"; + private static final String STANDALONE_WILDFLY_PASSWORD = "admin"; + + public static JmxParameters buildJmxParameters() { + final boolean runningWithEmbeddedWildfly = hasRandomJmsPortConfigured(); + return runningWithEmbeddedWildfly ? buildJmxParametersWithoutAuthForEmbeddedWildfly() + : buildJmxParametersWitAuthForStandaloneWildfly(); + } + + private static JmxParameters buildJmxParametersWithoutAuthForEmbeddedWildfly() { + return jmxParameters() + .withHost(HOST) + .withPort(PORT) + .build(); + } + + private static JmxParameters buildJmxParametersWitAuthForStandaloneWildfly() { + return jmxParameters() + .withHost(HOST) + .withPort(PORT) + .withUsername(STANDALONE_WILDFLY_USER) + .withPassword(STANDALONE_WILDFLY_PASSWORD) + .build(); + } +} diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/PositionInStreamIterator.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/PositionInStreamIterator.java similarity index 73% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/PositionInStreamIterator.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/PositionInStreamIterator.java index 598fe2ea..239e28bc 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/PositionInStreamIterator.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/PositionInStreamIterator.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it.helpers; +package uk.gov.justice.services.cakeshop.cakeshop.it.helpers; public class PositionInStreamIterator { diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/ProcessedEventCounter.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/ProcessedEventCounter.java similarity index 93% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/ProcessedEventCounter.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/ProcessedEventCounter.java index d4c40ec8..c8a34f9c 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/ProcessedEventCounter.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/ProcessedEventCounter.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it.helpers; +package uk.gov.justice.services.cakeshop.cakeshop.it.helpers; import java.sql.Connection; import java.sql.PreparedStatement; diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/PublishedEventCounter.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/PublishedEventCounter.java similarity index 94% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/PublishedEventCounter.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/PublishedEventCounter.java index 7c08b931..c687c181 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/PublishedEventCounter.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/PublishedEventCounter.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it.helpers; +package uk.gov.justice.services.cakeshop.cakeshop.it.helpers; import java.sql.Connection; import java.sql.PreparedStatement; diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/Querier.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/Querier.java similarity index 70% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/Querier.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/Querier.java index bf29e70f..46b2f72e 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/Querier.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/Querier.java @@ -1,19 +1,19 @@ -package uk.gov.justice.services.example.cakeshop.it.helpers; +package uk.gov.justice.services.cakeshop.cakeshop.it.helpers; import static java.util.Collections.singletonList; import static javax.ws.rs.core.Response.Status.OK; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.junit.jupiter.api.Assertions.fail; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopMediaTypes.QUERY_CAKES_MEDIA_TYPE; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopMediaTypes.QUERY_INDEX_MEDIA_TYPE; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopMediaTypes.QUERY_ORDER_MEDIA_TYPE; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopMediaTypes.QUERY_RECIPES_MEDIA_TYPE; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopMediaTypes.QUERY_RECIPE_MEDIA_TYPE; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopUris.CAKES_RESOURCE_QUERY_URI; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopUris.INDEXES_RESOURCE_QUERY_URI; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopUris.ORDERS_RESOURCE_QUERY_URI; -import static uk.gov.justice.services.example.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_QUERY_URI; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopMediaTypes.QUERY_CAKES_MEDIA_TYPE; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopMediaTypes.QUERY_INDEX_MEDIA_TYPE; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopMediaTypes.QUERY_ORDER_MEDIA_TYPE; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopMediaTypes.QUERY_RECIPES_MEDIA_TYPE; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopMediaTypes.QUERY_RECIPE_MEDIA_TYPE; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopUris.CAKES_RESOURCE_QUERY_URI; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopUris.INDEXES_RESOURCE_QUERY_URI; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopUris.ORDERS_RESOURCE_QUERY_URI; +import static uk.gov.justice.services.cakeshop.cakeshop.it.params.CakeShopUris.RECIPES_RESOURCE_QUERY_URI; import java.net.URISyntaxException; import java.util.List; diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/RestEasyClientFactory.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/RestEasyClientFactory.java similarity index 94% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/RestEasyClientFactory.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/RestEasyClientFactory.java index 87aed414..b2ab6736 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/RestEasyClientFactory.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/RestEasyClientFactory.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it.helpers; +package uk.gov.justice.services.cakeshop.cakeshop.it.helpers; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/StandaloneStreamStatusJdbcRepository.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/StandaloneStreamStatusJdbcRepository.java similarity index 88% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/StandaloneStreamStatusJdbcRepository.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/StandaloneStreamStatusJdbcRepository.java index f3adcce7..f9ddd0f6 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/StandaloneStreamStatusJdbcRepository.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/StandaloneStreamStatusJdbcRepository.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it.helpers; +package uk.gov.justice.services.cakeshop.cakeshop.it.helpers; import uk.gov.justice.services.event.buffer.core.repository.subscription.StreamStatusJdbcRepository; diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/StandaloneStreamStatusJdbcRepositoryFactory.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/StandaloneStreamStatusJdbcRepositoryFactory.java similarity index 88% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/StandaloneStreamStatusJdbcRepositoryFactory.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/StandaloneStreamStatusJdbcRepositoryFactory.java index f23f156b..f179c17b 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/StandaloneStreamStatusJdbcRepositoryFactory.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/StandaloneStreamStatusJdbcRepositoryFactory.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it.helpers; +package uk.gov.justice.services.cakeshop.cakeshop.it.helpers; import uk.gov.justice.services.event.buffer.core.repository.subscription.StreamStatusJdbcRepository; import uk.gov.justice.services.jdbc.persistence.PreparedStatementWrapperFactory; diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/StreamGenerator.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/StreamGenerator.java similarity index 90% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/StreamGenerator.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/StreamGenerator.java index c325394c..14004f33 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/StreamGenerator.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/StreamGenerator.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it.helpers; +package uk.gov.justice.services.cakeshop.cakeshop.it.helpers; import static java.util.stream.Collectors.toList; import static java.util.stream.IntStream.range; diff --git a/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/SystemPropertyFinder.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/SystemPropertyFinder.java new file mode 100644 index 00000000..bdc2c10a --- /dev/null +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/SystemPropertyFinder.java @@ -0,0 +1,47 @@ +package uk.gov.justice.services.cakeshop.cakeshop.it.helpers; + +import static org.apache.commons.lang3.StringUtils.isEmpty; + +/* + Random ports are set through pom.xml and this capability is required to run integration tests using embedded wildfly for travis pipeline. + However it's getting hard to debug any ITs with embedded wildfly. + So, to provide better debugging capability application can be deployed to local dev environment and tests can be executed from intellij/IDE which points to local environment. + When test is run through IDE these system properties are not going to be populated, so it will return default values that are related to local dev environment +*/ +public class SystemPropertyFinder { + + public static final String STANDALONE_ARTEMIS_PORT = "61616"; + public static final String STANDALONE_ARTEMIS_USER_NAME = "admin"; + public static final String STANDALONE_ARTEMIS_USER_PASSWORD = "password"; + public static final String STANDALONE_HA_PROXY_HTTP_PORT = "8080"; + public static final String STANDALONE_WILDFLY_MANAGEMENT_PORT = "9990"; + + public static String findJmsPort() { + return findValue("random.jms.port", STANDALONE_ARTEMIS_PORT); + } + + public static String findWildflyHttpPort() { + return findValue("random.http.port", STANDALONE_HA_PROXY_HTTP_PORT); + } + + public static Integer findWildflyManagementPort() { + return Integer.valueOf(findValue("random.management.port", STANDALONE_WILDFLY_MANAGEMENT_PORT)); + } + + public static String findJmsUserName() { + return findValue("jms.user.name", STANDALONE_ARTEMIS_USER_NAME); + } + + public static String findJmsUserPassword() { + return findValue("jms.user.password", STANDALONE_ARTEMIS_USER_PASSWORD); + } + + public static boolean hasRandomJmsPortConfigured() { + return !isEmpty(System.getProperty("random.http.port")); + } + + private static String findValue(final String propertyName, final String defaultValue) { + String value = System.getProperty(propertyName); + return isEmpty(value) ? defaultValue : value; + } +} diff --git a/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/TestConstants.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/TestConstants.java new file mode 100644 index 00000000..b6591eb3 --- /dev/null +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/TestConstants.java @@ -0,0 +1,7 @@ +package uk.gov.justice.services.cakeshop.cakeshop.it.helpers; + +public interface TestConstants { + String CONTEXT_NAME = "cakeshop"; + + String DB_CONTEXT_NAME = "framework"; +} diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/TestProperties.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/TestProperties.java similarity index 94% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/TestProperties.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/TestProperties.java index 28d33376..1e24001b 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/TestProperties.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/TestProperties.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it.helpers; +package uk.gov.justice.services.cakeshop.cakeshop.it.helpers; import static org.junit.jupiter.api.Assertions.fail; diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/WildflyDeploymentDir.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/WildflyDeploymentDir.java similarity index 91% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/WildflyDeploymentDir.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/WildflyDeploymentDir.java index f6389363..0bb7a20e 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/WildflyDeploymentDir.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/WildflyDeploymentDir.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it.helpers; +package uk.gov.justice.services.cakeshop.cakeshop.it.helpers; import static java.nio.file.Paths.get; diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/WildflyFeatureUpdater.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/WildflyFeatureUpdater.java similarity index 96% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/WildflyFeatureUpdater.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/WildflyFeatureUpdater.java index 6cf832a5..ee872e87 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/helpers/WildflyFeatureUpdater.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/helpers/WildflyFeatureUpdater.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.it.helpers; +package uk.gov.justice.services.cakeshop.cakeshop.it.helpers; import static java.util.Optional.empty; import static java.util.Optional.of; diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/params/CakeShopMediaTypes.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/params/CakeShopMediaTypes.java similarity index 89% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/params/CakeShopMediaTypes.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/params/CakeShopMediaTypes.java index 5c37e57c..33ed55fe 100644 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/params/CakeShopMediaTypes.java +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/params/CakeShopMediaTypes.java @@ -1,11 +1,9 @@ -package uk.gov.justice.services.example.cakeshop.it.params; +package uk.gov.justice.services.cakeshop.cakeshop.it.params; import static java.lang.String.format; +import static uk.gov.justice.services.cakeshop.cakeshop.it.helpers.TestConstants.CONTEXT_NAME; public class CakeShopMediaTypes { - - public static final String CONTEXT_NAME = "example"; - private static final String PREFIX = format("application/vnd.%s.", CONTEXT_NAME); public static final String ADD_RECIPE_MEDIA_TYPE = PREFIX + "add-recipe+json"; diff --git a/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/params/CakeShopUris.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/params/CakeShopUris.java new file mode 100644 index 00000000..4e1bf782 --- /dev/null +++ b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/it/params/CakeShopUris.java @@ -0,0 +1,19 @@ +package uk.gov.justice.services.cakeshop.cakeshop.it.params; + +import static uk.gov.justice.services.cakeshop.cakeshop.it.helpers.SystemPropertyFinder.findWildflyHttpPort; + +public class CakeShopUris { + private static final String HOST = "http://localhost:" + findWildflyHttpPort(); + + public static final String RECIPES_RESOURCE_URI = HOST + "/cakeshop-command-api/command/api/rest/cakeshop/recipes/"; + public static final String ORDERS_RESOURCE_URI = HOST + "/cakeshop-command-api/command/api/rest/cakeshop/orders/"; + public static final String RECIPES_RESOURCE_QUERY_URI = HOST + "/cakeshop-query-api/query/api/rest/cakeshop/recipes/"; + public static final String ORDERS_RESOURCE_QUERY_URI = HOST + "/cakeshop-query-api/query/api/rest/cakeshop/orders/"; + public static final String CAKES_RESOURCE_QUERY_URI = HOST + "/cakeshop-query-api/query/api/rest/cakeshop/cakes/"; + public static final String OVEN_RESOURCE_CUSTOM_URI = HOST + "/cakeshop-custom-api/custom/api/rest/cakeshop/ovens/"; + public static final String INDEXES_RESOURCE_QUERY_URI = HOST + "/cakeshop-query-api/query/api/rest/cakeshop/index/"; + public static final String HEALTHCHECK_URI = HOST + "/cakeshop-service/internal/healthchecks/all"; + + + public static final String CAKES_RESOURCE_URI_FORMAT = RECIPES_RESOURCE_URI + "%s/cakes/%s"; +} diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/eventsourcing/jdbc/snapshot/StandaloneSnapshotJdbcRepositoryFactory.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/eventsourcing/jdbc/snapshot/StandaloneSnapshotJdbcRepositoryFactory.java similarity index 100% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/eventsourcing/jdbc/snapshot/StandaloneSnapshotJdbcRepositoryFactory.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/eventsourcing/jdbc/snapshot/StandaloneSnapshotJdbcRepositoryFactory.java diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/eventsourcing/repository/jdbc/event/EventRepositoryFactory.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/eventsourcing/repository/jdbc/event/EventRepositoryFactory.java similarity index 100% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/eventsourcing/repository/jdbc/event/EventRepositoryFactory.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/eventsourcing/repository/jdbc/event/EventRepositoryFactory.java diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/eventsourcing/repository/jdbc/event/EventStreamJdbsRepositoryFactory.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/eventsourcing/repository/jdbc/event/EventStreamJdbsRepositoryFactory.java similarity index 100% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/eventsourcing/repository/jdbc/event/EventStreamJdbsRepositoryFactory.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/eventsourcing/repository/jdbc/event/EventStreamJdbsRepositoryFactory.java diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/eventsourcing/repository/jdbc/event/LinkedEventRepositoryTruncator.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/eventsourcing/repository/jdbc/event/LinkedEventRepositoryTruncator.java similarity index 100% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/eventsourcing/repository/jdbc/event/LinkedEventRepositoryTruncator.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/eventsourcing/repository/jdbc/event/LinkedEventRepositoryTruncator.java diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/eventsourcing/repository/jdbc/event/PublishedEventTableTruncator.java b/cakeshop-integration-test/src/test/java/uk/gov/justice/services/eventsourcing/repository/jdbc/event/PublishedEventTableTruncator.java similarity index 100% rename from example-context/example-service/example-it/src/test/java/uk/gov/justice/services/eventsourcing/repository/jdbc/event/PublishedEventTableTruncator.java rename to cakeshop-integration-test/src/test/java/uk/gov/justice/services/eventsourcing/repository/jdbc/event/PublishedEventTableTruncator.java diff --git a/cakeshop-integration-test/src/test/resources/croydon.jpg b/cakeshop-integration-test/src/test/resources/croydon.jpg new file mode 100644 index 00000000..e69de29b diff --git a/example-context/example-service/example-it/src/test/resources/test.properties b/cakeshop-integration-test/src/test/resources/test.properties similarity index 56% rename from example-context/example-service/example-it/src/test/resources/test.properties rename to cakeshop-integration-test/src/test/resources/test.properties index c7ec9252..692b501a 100644 --- a/example-context/example-service/example-it/src/test/resources/test.properties +++ b/cakeshop-integration-test/src/test/resources/test.properties @@ -4,9 +4,9 @@ db.eventstore.userName=framework db.eventstore.password=framework # viewstore database -db.example.url=jdbc:postgresql://localhost:5432/frameworkviewstore -db.example.userName=framework -db.example.password=framework +db.cakeshop.url=jdbc:postgresql://localhost:5432/frameworkviewstore +db.cakeshop.userName=framework +db.cakeshop.password=framework # system database db.system.url=jdbc:postgresql://localhost:5432/frameworksystem @@ -14,6 +14,6 @@ db.system.userName=framework db.system.password=framework # file store database -db.fileservice.url=jdbc:postgresql://localhost:5432/frameworkfilestore -db.fileservice.userName=framework -db.fileservice.password=framework +db.fileservice.url=jdbc:postgresql://localhost:5432/fileservice +db.fileservice.userName=fileservice +db.fileservice.password=fileservice diff --git a/example-context/example-service/example-it/src/test/resources/wildfly-config/application-roles.properties b/cakeshop-integration-test/src/test/resources/wildfly-config/application-roles.properties similarity index 100% rename from example-context/example-service/example-it/src/test/resources/wildfly-config/application-roles.properties rename to cakeshop-integration-test/src/test/resources/wildfly-config/application-roles.properties diff --git a/example-context/example-service/example-it/src/test/resources/wildfly-config/application-users.properties b/cakeshop-integration-test/src/test/resources/wildfly-config/application-users.properties similarity index 100% rename from example-context/example-service/example-it/src/test/resources/wildfly-config/application-users.properties rename to cakeshop-integration-test/src/test/resources/wildfly-config/application-users.properties diff --git a/cakeshop-integration-test/src/test/resources/wildfly-config/mgmt-users.properties b/cakeshop-integration-test/src/test/resources/wildfly-config/mgmt-users.properties new file mode 100644 index 00000000..e7f0d183 --- /dev/null +++ b/cakeshop-integration-test/src/test/resources/wildfly-config/mgmt-users.properties @@ -0,0 +1,27 @@ +# +# Properties declaration of users for the realm 'ManagementRealm' which is the default realm +# for new installations. Further authentication mechanism can be configured +# as part of the in standalone.xml. +# +# Users can be added to this properties file at any time, updates after the server has started +# will be automatically detected. +# +# By default the properties realm expects the entries to be in the format: - +# username=HEX( MD5( username ':' realm ':' password)) +# +# A utility script is provided which can be executed from the bin folder to add the users: - +# - Linux +# bin/add-user.sh +# +# - Windows +# bin\add-user.bat +# On start-up the server will also automatically add a user $local - this user is specifically +# for local tools running against this AS installation. +# +# The following illustrates how an admin user could be defined, this +# is for illustration only and does not correspond to a usable password. +# +admin=c22052286cd5d72239a90fe193737253 +# +#$REALM_NAME=ManagementRealm$ This line is used by the add-user utility to identify the realm name already used in this file. +# \ No newline at end of file diff --git a/example-context/example-service/example-it/src/test/resources/wildfly-config/standalone.xml b/cakeshop-integration-test/src/test/resources/wildfly-config/standalone.xml similarity index 94% rename from example-context/example-service/example-it/src/test/resources/wildfly-config/standalone.xml rename to cakeshop-integration-test/src/test/resources/wildfly-config/standalone.xml index db0eb6d5..305811d2 100644 --- a/example-context/example-service/example-it/src/test/resources/wildfly-config/standalone.xml +++ b/cakeshop-integration-test/src/test/resources/wildfly-config/standalone.xml @@ -135,7 +135,7 @@ - + jdbc:postgresql://localhost:5432/frameworkeventstore postgres @@ -151,7 +151,7 @@ select 1 - + jdbc:postgresql://localhost:5432/frameworkviewstore postgres @@ -167,7 +167,7 @@ select 1 - + jdbc:postgresql://localhost:5432/frameworksystem postgres @@ -184,7 +184,7 @@ - jdbc:postgresql://localhost:5432/frameworkfilestore + jdbc:postgresql://localhost:5432/fileservice postgres 3 @@ -192,8 +192,8 @@ true - framework - framework + fileservice + fileservice select 1 @@ -234,7 +234,7 @@ - + @@ -525,9 +525,9 @@ - - - + + + @@ -544,8 +544,8 @@ - - + + @@ -583,7 +583,8 @@ - + + @@ -594,8 +595,9 @@ + - + diff --git a/example-context/example-service/example-it/src/test/resources/wildfly-modules/org/postgresql/main/module.xml b/cakeshop-integration-test/src/test/resources/wildfly-modules/org/postgresql/main/module.xml similarity index 100% rename from example-context/example-service/example-it/src/test/resources/wildfly-modules/org/postgresql/main/module.xml rename to cakeshop-integration-test/src/test/resources/wildfly-modules/org/postgresql/main/module.xml diff --git a/example-context/example-service/example-it/start-server-it.bat b/cakeshop-integration-test/start-server-it.bat similarity index 100% rename from example-context/example-service/example-it/start-server-it.bat rename to cakeshop-integration-test/start-server-it.bat diff --git a/example-context/example-service/example-it/start-server-it.sh b/cakeshop-integration-test/start-server-it.sh similarity index 100% rename from example-context/example-service/example-it/start-server-it.sh rename to cakeshop-integration-test/start-server-it.sh diff --git a/example-context/example-service/example-query/example-query-api/pom.xml b/cakeshop-query/cakeshop-query-api/pom.xml similarity index 92% rename from example-context/example-service/example-query/example-query-api/pom.xml rename to cakeshop-query/cakeshop-query-api/pom.xml index fa3471a5..ccbf6934 100644 --- a/example-context/example-service/example-query/example-query-api/pom.xml +++ b/cakeshop-query/cakeshop-query-api/pom.xml @@ -3,13 +3,13 @@ xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - example-query - uk.gov.justice.services.example + cakeshop-query + uk.gov.justice.services.cakeshop 17.0.2-SNAPSHOT 4.0.0 - example-query-api + cakeshop-query-api war @@ -83,8 +83,8 @@ test - uk.gov.justice.services.example - example-persistence + uk.gov.justice.services.cakeshop + cakeshop-viewstore-persistence ${project.version} compile @@ -123,8 +123,8 @@ ${javaee-api.version} - uk.gov.justice.services.example - example-query-view + uk.gov.justice.services.cakeshop + cakeshop-query-view ${project.version} raml diff --git a/example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/CakeOrdersQueryApi.java b/cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/CakeOrdersQueryApi.java similarity index 69% rename from example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/CakeOrdersQueryApi.java rename to cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/CakeOrdersQueryApi.java index c68f537e..c0d0b894 100644 --- a/example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/CakeOrdersQueryApi.java +++ b/cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/CakeOrdersQueryApi.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.api; +package uk.gov.justice.services.cakeshop.cakeshop.query.api; import static uk.gov.justice.services.core.annotation.Component.QUERY_API; @@ -6,8 +6,8 @@ import uk.gov.justice.services.core.annotation.Handles; import uk.gov.justice.services.core.annotation.ServiceComponent; import uk.gov.justice.services.core.requester.Requester; -import uk.gov.justice.services.example.cakeshop.query.api.request.SearchCakeOrder; -import uk.gov.justice.services.example.cakeshop.query.api.response.CakeOrderView; +import uk.gov.justice.services.cakeshop.cakeshop.query.api.request.SearchCakeOrder; +import uk.gov.justice.services.cakeshop.cakeshop.query.api.response.CakeOrderView; import uk.gov.justice.services.messaging.Envelope; import javax.inject.Inject; @@ -18,7 +18,7 @@ public class CakeOrdersQueryApi { @Inject Requester requester; - @Handles("example.get-order") + @Handles("cakeshop.get-order") public Envelope getOrder(final Envelope query) { return requester.request(query, CakeOrderView.class); } diff --git a/example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/CakesQueryApi.java b/cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/CakesQueryApi.java similarity index 69% rename from example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/CakesQueryApi.java rename to cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/CakesQueryApi.java index 50d9559b..609a1fbd 100644 --- a/example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/CakesQueryApi.java +++ b/cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/CakesQueryApi.java @@ -1,12 +1,12 @@ -package uk.gov.justice.services.example.cakeshop.query.api; +package uk.gov.justice.services.cakeshop.cakeshop.query.api; import static uk.gov.justice.services.core.annotation.Component.QUERY_API; import uk.gov.justice.services.core.annotation.Handles; import uk.gov.justice.services.core.annotation.ServiceComponent; import uk.gov.justice.services.core.requester.Requester; -import uk.gov.justice.services.example.cakeshop.query.api.request.SearchCake; -import uk.gov.justice.services.example.cakeshop.query.api.response.CakesView; +import uk.gov.justice.services.cakeshop.cakeshop.query.api.request.SearchCake; +import uk.gov.justice.services.cakeshop.cakeshop.query.api.response.CakesView; import uk.gov.justice.services.messaging.Envelope; import javax.inject.Inject; @@ -17,7 +17,7 @@ public class CakesQueryApi { @Inject Requester requester; - @Handles("example.search-cakes") + @Handles("cakeshop.search-cakes") public Envelope cakes(final Envelope query) { return requester.request(query, CakesView.class); } diff --git a/example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/IndexQueryApi.java b/cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/IndexQueryApi.java similarity index 69% rename from example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/IndexQueryApi.java rename to cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/IndexQueryApi.java index 9bc22239..f8496684 100644 --- a/example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/IndexQueryApi.java +++ b/cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/IndexQueryApi.java @@ -1,12 +1,12 @@ -package uk.gov.justice.services.example.cakeshop.query.api; +package uk.gov.justice.services.cakeshop.cakeshop.query.api; import static uk.gov.justice.services.core.annotation.Component.QUERY_API; import uk.gov.justice.services.core.annotation.Handles; import uk.gov.justice.services.core.annotation.ServiceComponent; import uk.gov.justice.services.core.requester.Requester; -import uk.gov.justice.services.example.cakeshop.query.api.request.SearchIndex; -import uk.gov.justice.services.example.cakeshop.query.api.response.IndexView; +import uk.gov.justice.services.cakeshop.cakeshop.query.api.request.SearchIndex; +import uk.gov.justice.services.cakeshop.cakeshop.query.api.response.IndexView; import uk.gov.justice.services.messaging.Envelope; import javax.inject.Inject; @@ -17,7 +17,7 @@ public class IndexQueryApi { @Inject private Requester requester; - @Handles("example.get-index") + @Handles("cakeshop.get-index") public Envelope getIndex(final Envelope query) { return requester.request(query, IndexView.class); } diff --git a/example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/RecipesQueryApi.java b/cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/RecipesQueryApi.java similarity index 71% rename from example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/RecipesQueryApi.java rename to cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/RecipesQueryApi.java index aa88f6fe..a9bf466d 100644 --- a/example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/RecipesQueryApi.java +++ b/cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/RecipesQueryApi.java @@ -1,12 +1,12 @@ -package uk.gov.justice.services.example.cakeshop.query.api; +package uk.gov.justice.services.cakeshop.cakeshop.query.api; import static uk.gov.justice.services.core.annotation.Component.QUERY_API; import uk.gov.justice.services.core.annotation.Handles; import uk.gov.justice.services.core.annotation.ServiceComponent; import uk.gov.justice.services.core.requester.Requester; -import uk.gov.justice.services.example.cakeshop.query.api.request.SearchRecipes; -import uk.gov.justice.services.example.cakeshop.query.api.response.RecipesView; +import uk.gov.justice.services.cakeshop.cakeshop.query.api.request.SearchRecipes; +import uk.gov.justice.services.cakeshop.cakeshop.query.api.response.RecipesView; import uk.gov.justice.services.messaging.Envelope; import uk.gov.justice.services.messaging.JsonEnvelope; @@ -18,22 +18,22 @@ public class RecipesQueryApi { @Inject Requester requester; - @Handles("example.search-recipes") + @Handles("cakeshop.search-recipes") public JsonEnvelope searchRecipes(final JsonEnvelope query) { return requester.request(query); } - @Handles("example.get-recipe") + @Handles("cakeshop.get-recipe") public JsonEnvelope getRecipe(final JsonEnvelope query) { return requester.request(query); } - @Handles("example.query-recipes") + @Handles("cakeshop.query-recipes") public Envelope queryRecipes(final Envelope query) { return requester.request(query, RecipesView.class); } - @Handles("example.get-recipe-photograph") + @Handles("cakeshop.get-recipe-photograph") public JsonEnvelope getRecipePhotograph(final JsonEnvelope query) { return requester.request(query); } diff --git a/example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/request/SearchCake.java b/cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/request/SearchCake.java similarity index 82% rename from example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/request/SearchCake.java rename to cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/request/SearchCake.java index d0fef004..d222d253 100644 --- a/example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/request/SearchCake.java +++ b/cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/request/SearchCake.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.api.request; +package uk.gov.justice.services.cakeshop.cakeshop.query.api.request; import java.util.UUID; diff --git a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/request/SearchCakeOrder.java b/cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/request/SearchCakeOrder.java similarity index 90% rename from example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/request/SearchCakeOrder.java rename to cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/request/SearchCakeOrder.java index a2dbbef3..63f896ac 100644 --- a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/request/SearchCakeOrder.java +++ b/cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/request/SearchCakeOrder.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.view.request; +package uk.gov.justice.services.cakeshop.cakeshop.query.api.request; import java.time.ZonedDateTime; import java.util.UUID; diff --git a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/request/SearchIndex.java b/cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/request/SearchIndex.java similarity index 87% rename from example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/request/SearchIndex.java rename to cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/request/SearchIndex.java index 54426dc4..c6f2acb5 100644 --- a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/request/SearchIndex.java +++ b/cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/request/SearchIndex.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.view.request; +package uk.gov.justice.services.cakeshop.cakeshop.query.api.request; import java.time.ZonedDateTime; import java.util.UUID; diff --git a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/request/SearchRecipes.java b/cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/request/SearchRecipes.java similarity index 92% rename from example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/request/SearchRecipes.java rename to cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/request/SearchRecipes.java index 197dbf44..d9638aba 100644 --- a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/request/SearchRecipes.java +++ b/cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/request/SearchRecipes.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.view.request; +package uk.gov.justice.services.cakeshop.cakeshop.query.api.request; public class SearchRecipes { diff --git a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/response/CakeOrderView.java b/cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/response/CakeOrderView.java similarity index 90% rename from example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/response/CakeOrderView.java rename to cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/response/CakeOrderView.java index 463b4caa..8fd99508 100644 --- a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/response/CakeOrderView.java +++ b/cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/response/CakeOrderView.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.view.response; +package uk.gov.justice.services.cakeshop.cakeshop.query.api.response; import java.time.ZonedDateTime; import java.util.UUID; diff --git a/example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/response/CakesView.java b/cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/response/CakesView.java similarity index 72% rename from example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/response/CakesView.java rename to cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/response/CakesView.java index 07930326..0ec07037 100644 --- a/example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/response/CakesView.java +++ b/cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/response/CakesView.java @@ -1,6 +1,6 @@ -package uk.gov.justice.services.example.cakeshop.query.api.response; +package uk.gov.justice.services.cakeshop.cakeshop.query.api.response; -import uk.gov.justice.services.example.cakeshop.query.api.request.SearchCake; +import uk.gov.justice.services.cakeshop.cakeshop.query.api.request.SearchCake; import java.util.List; diff --git a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/response/IndexView.java b/cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/response/IndexView.java similarity index 87% rename from example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/response/IndexView.java rename to cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/response/IndexView.java index c1db2c88..a4f6f746 100644 --- a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/response/IndexView.java +++ b/cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/response/IndexView.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.view.response; +package uk.gov.justice.services.cakeshop.cakeshop.query.api.response; import java.time.ZonedDateTime; import java.util.UUID; @@ -13,7 +13,6 @@ public IndexView(final UUID indexId, final ZonedDateTime deliveryDate) { this.deliveryDate = deliveryDate; } - public UUID getIndexId() { return indexId; } diff --git a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/response/RecipeView.java b/cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/response/RecipeView.java similarity index 89% rename from example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/response/RecipeView.java rename to cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/response/RecipeView.java index b296f8b8..107e7013 100644 --- a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/response/RecipeView.java +++ b/cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/response/RecipeView.java @@ -1,6 +1,6 @@ -package uk.gov.justice.services.example.cakeshop.query.view.response; +package uk.gov.justice.services.cakeshop.cakeshop.query.api.response; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Recipe; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Recipe; import java.util.Objects; import java.util.UUID; diff --git a/example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/response/RecipesView.java b/cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/response/RecipesView.java similarity index 85% rename from example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/response/RecipesView.java rename to cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/response/RecipesView.java index 09dc3971..1071117d 100644 --- a/example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/response/RecipesView.java +++ b/cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/response/RecipesView.java @@ -1,6 +1,6 @@ -package uk.gov.justice.services.example.cakeshop.query.api.response; +package uk.gov.justice.services.cakeshop.cakeshop.query.api.response; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Recipe; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Recipe; import java.util.List; import java.util.Objects; diff --git a/example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/provider/ExampleQueryApiInterceptorChainProvider.java b/cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/provider/CakeshopQueryApiInterceptorChainProvider.java similarity index 79% rename from example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/provider/ExampleQueryApiInterceptorChainProvider.java rename to cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/provider/CakeshopQueryApiInterceptorChainProvider.java index a47951d1..842a94d6 100644 --- a/example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/provider/ExampleQueryApiInterceptorChainProvider.java +++ b/cakeshop-query/cakeshop-query-api/src/main/java/uk/gov/justice/services/cakeshop/provider/CakeshopQueryApiInterceptorChainProvider.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.provider; +package uk.gov.justice.services.cakeshop.provider; import static uk.gov.justice.services.core.annotation.Component.QUERY_API; @@ -8,7 +8,7 @@ import java.util.ArrayList; import java.util.List; -public class ExampleQueryApiInterceptorChainProvider implements InterceptorChainEntryProvider { +public class CakeshopQueryApiInterceptorChainProvider implements InterceptorChainEntryProvider { private final List interceptorChainEntries = new ArrayList<>(); diff --git a/example-context/example-service/example-query/example-query-api/src/main/resources/META-INF/beans.xml b/cakeshop-query/cakeshop-query-api/src/main/resources/META-INF/beans.xml similarity index 100% rename from example-context/example-service/example-query/example-query-api/src/main/resources/META-INF/beans.xml rename to cakeshop-query/cakeshop-query-api/src/main/resources/META-INF/beans.xml diff --git a/example-context/example-service/example-query/example-query-api/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/cakeshop-query/cakeshop-query-api/src/main/webapp/WEB-INF/jboss-deployment-structure.xml similarity index 100% rename from example-context/example-service/example-query/example-query-api/src/main/webapp/WEB-INF/jboss-deployment-structure.xml rename to cakeshop-query/cakeshop-query-api/src/main/webapp/WEB-INF/jboss-deployment-structure.xml diff --git a/example-context/example-service/example-query/example-query-api/src/raml/example-query-api.raml b/cakeshop-query/cakeshop-query-api/src/raml/cakeshop-query-api.raml similarity index 56% rename from example-context/example-service/example-query/example-query-api/src/raml/example-query-api.raml rename to cakeshop-query/cakeshop-query-api/src/raml/cakeshop-query-api.raml index 91de8cbf..6bd5bcdc 100644 --- a/example-context/example-service/example-query/example-query-api/src/raml/example-query-api.raml +++ b/cakeshop-query/cakeshop-query-api/src/raml/cakeshop-query-api.raml @@ -1,6 +1,6 @@ #%RAML 0.8 title: Cakeshop Query -baseUri: http://localhost:8080/example-query-api/query/api/rest/cakeshop +baseUri: http://localhost:8080/cakeshop-query-api/query/api/rest/cakeshop version: v0.1 mediaType: application/json protocols: [ HTTP, HTTPS ] @@ -11,8 +11,8 @@ protocols: [ HTTP, HTTPS ] description: | ... (mapping): - responseType: application/vnd.example.recipes+json - name: example.search-recipes + responseType: application/vnd.cakeshop.recipes+json + name: cakeshop.search-recipes ... queryParameters: pagesize: @@ -30,25 +30,25 @@ protocols: [ HTTP, HTTPS ] responses: 200: body: - application/vnd.example.recipes+json: - schema: !include json/schema/example.search-recipes.json + application/vnd.cakeshop.recipes+json: + schema: !include json/schema/cakeshop.search-recipes.json example: !include json/recipes.json post: description: | ... (mapping): - requestType: application/vnd.example.query-recipes+json - name: example.query-recipes + requestType: application/vnd.cakeshop.query-recipes+json + name: cakeshop.query-recipes ... body: - application/vnd.example.query-recipes+json: - schema: !include json/schema/example.query-recipes.json + application/vnd.cakeshop.query-recipes+json: + schema: !include json/schema/cakeshop.query-recipes.json example: !include json/query-recipes.json responses: 200: body: - application/vnd.example.recipes+json: - schema: !include json/schema/example.search-recipes.json + application/vnd.cakeshop.recipes+json: + schema: !include json/schema/cakeshop.search-recipes.json example: !include json/recipes.json /recipes/{recipeId}: @@ -57,14 +57,14 @@ protocols: [ HTTP, HTTPS ] description: | ... (mapping): - responseType: application/vnd.example.recipe+json - name: example.get-recipe + responseType: application/vnd.cakeshop.recipe+json + name: cakeshop.get-recipe ... responses: 200: body: - application/vnd.example.recipe+json: - schema: !include json/schema/example.get-recipe.json + application/vnd.cakeshop.recipe+json: + schema: !include json/schema/cakeshop.get-recipe.json example: !include json/recipe.json /orders/{orderId}: @@ -73,14 +73,14 @@ protocols: [ HTTP, HTTPS ] description: | ... (mapping): - responseType: application/vnd.example.order+json - name: example.get-order + responseType: application/vnd.cakeshop.order+json + name: cakeshop.get-order ... responses: 200: body: - application/vnd.example.order+json: - schema: !include json/schema/example.get-order.json + application/vnd.cakeshop.order+json: + schema: !include json/schema/cakeshop.get-order.json example: !include json/order.json /cakes: description: return cakes @@ -88,14 +88,14 @@ protocols: [ HTTP, HTTPS ] description: | ... (mapping): - responseType: application/vnd.example.cakes+json - name: example.search-cakes + responseType: application/vnd.cakeshop.cakes+json + name: cakeshop.search-cakes ... responses: 200: body: - application/vnd.example.cakes+json: - schema: !include json/schema/example.search-cakes.json + application/vnd.cakeshop.cakes+json: + schema: !include json/schema/cakeshop.search-cakes.json example: !include json/cakes.json /recipes/{recipeId}/photograph: @@ -105,7 +105,7 @@ protocols: [ HTTP, HTTPS ] ... (mapping): responseType: application/octet-stream - name: example.get-recipe-photograph + name: cakeshop.get-recipe-photograph ... responses: 200: @@ -118,12 +118,12 @@ protocols: [ HTTP, HTTPS ] description: | ... (mapping): - responseType: application/vnd.example.index+json - name: example.get-index + responseType: application/vnd.cakeshop.index+json + name: cakeshop.get-index ... responses: 200: body: - application/vnd.example.index+json: - schema: !include json/schema/example.search-index.json + application/vnd.cakeshop.index+json: + schema: !include json/schema/cakeshop.search-index.json example: !include json/index.json \ No newline at end of file diff --git a/example-context/example-service/example-query/example-query-api/src/raml/json/cakes.json b/cakeshop-query/cakeshop-query-api/src/raml/json/cakes.json similarity index 100% rename from example-context/example-service/example-query/example-query-api/src/raml/json/cakes.json rename to cakeshop-query/cakeshop-query-api/src/raml/json/cakes.json diff --git a/example-context/example-service/example-query/example-query-api/src/raml/json/index.json b/cakeshop-query/cakeshop-query-api/src/raml/json/index.json similarity index 100% rename from example-context/example-service/example-query/example-query-api/src/raml/json/index.json rename to cakeshop-query/cakeshop-query-api/src/raml/json/index.json diff --git a/example-context/example-service/example-query/example-query-api/src/raml/json/order.json b/cakeshop-query/cakeshop-query-api/src/raml/json/order.json similarity index 100% rename from example-context/example-service/example-query/example-query-api/src/raml/json/order.json rename to cakeshop-query/cakeshop-query-api/src/raml/json/order.json diff --git a/example-context/example-service/example-query/example-query-api/src/raml/json/query-recipes.json b/cakeshop-query/cakeshop-query-api/src/raml/json/query-recipes.json similarity index 100% rename from example-context/example-service/example-query/example-query-api/src/raml/json/query-recipes.json rename to cakeshop-query/cakeshop-query-api/src/raml/json/query-recipes.json diff --git a/example-context/example-service/example-query/example-query-api/src/raml/json/recipe-photograph.json b/cakeshop-query/cakeshop-query-api/src/raml/json/recipe-photograph.json similarity index 100% rename from example-context/example-service/example-query/example-query-api/src/raml/json/recipe-photograph.json rename to cakeshop-query/cakeshop-query-api/src/raml/json/recipe-photograph.json diff --git a/example-context/example-service/example-query/example-query-api/src/raml/json/recipe.json b/cakeshop-query/cakeshop-query-api/src/raml/json/recipe.json similarity index 100% rename from example-context/example-service/example-query/example-query-api/src/raml/json/recipe.json rename to cakeshop-query/cakeshop-query-api/src/raml/json/recipe.json diff --git a/example-context/example-service/example-query/example-query-api/src/raml/json/recipes.json b/cakeshop-query/cakeshop-query-api/src/raml/json/recipes.json similarity index 100% rename from example-context/example-service/example-query/example-query-api/src/raml/json/recipes.json rename to cakeshop-query/cakeshop-query-api/src/raml/json/recipes.json diff --git a/example-context/example-service/example-query/example-query-view/src/raml/json/schema/example.get-order.json b/cakeshop-query/cakeshop-query-api/src/raml/json/schema/cakeshop.get-order.json similarity index 81% rename from example-context/example-service/example-query/example-query-view/src/raml/json/schema/example.get-order.json rename to cakeshop-query/cakeshop-query-api/src/raml/json/schema/cakeshop.get-order.json index 4eaa8d67..e6adbee3 100644 --- a/example-context/example-service/example-query/example-query-view/src/raml/json/schema/example.get-order.json +++ b/cakeshop-query/cakeshop-query-api/src/raml/json/schema/cakeshop.get-order.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/query/example.get-order.json", + "id": "http://justice.gov.uk/cakeshop/query/cakeshop.get-order.json", "type": "object", "properties": { "orderId": { diff --git a/example-context/example-service/example-query/example-query-api/src/raml/json/schema/example.get-recipe-photograph.json b/cakeshop-query/cakeshop-query-api/src/raml/json/schema/cakeshop.get-recipe-photograph.json similarity index 66% rename from example-context/example-service/example-query/example-query-api/src/raml/json/schema/example.get-recipe-photograph.json rename to cakeshop-query/cakeshop-query-api/src/raml/json/schema/cakeshop.get-recipe-photograph.json index 9f22bde9..284407ee 100644 --- a/example-context/example-service/example-query/example-query-api/src/raml/json/schema/example.get-recipe-photograph.json +++ b/cakeshop-query/cakeshop-query-api/src/raml/json/schema/cakeshop.get-recipe-photograph.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/query/example.get-recipe-photograph.json", + "id": "http://justice.gov.uk/cakeshop/query/cakeshop.get-recipe-photograph.json", "type": "object", "properties": { "name": { diff --git a/example-context/example-service/example-query/example-query-api/src/raml/json/schema/example.get-recipe.json b/cakeshop-query/cakeshop-query-api/src/raml/json/schema/cakeshop.get-recipe.json similarity index 79% rename from example-context/example-service/example-query/example-query-api/src/raml/json/schema/example.get-recipe.json rename to cakeshop-query/cakeshop-query-api/src/raml/json/schema/cakeshop.get-recipe.json index 29c78a42..aa6a98f2 100644 --- a/example-context/example-service/example-query/example-query-api/src/raml/json/schema/example.get-recipe.json +++ b/cakeshop-query/cakeshop-query-api/src/raml/json/schema/cakeshop.get-recipe.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/query/example.get-recipe.json", + "id": "http://justice.gov.uk/cakeshop/query/cakeshop.get-recipe.json", "type": "object", "properties": { "name": { diff --git a/example-context/example-service/example-query/example-query-api/src/raml/json/schema/example.query-recipes.json b/cakeshop-query/cakeshop-query-api/src/raml/json/schema/cakeshop.query-recipes.json similarity index 78% rename from example-context/example-service/example-query/example-query-api/src/raml/json/schema/example.query-recipes.json rename to cakeshop-query/cakeshop-query-api/src/raml/json/schema/cakeshop.query-recipes.json index cc21baa4..e1cbf2cb 100644 --- a/example-context/example-service/example-query/example-query-api/src/raml/json/schema/example.query-recipes.json +++ b/cakeshop-query/cakeshop-query-api/src/raml/json/schema/cakeshop.query-recipes.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/query/example.query-recipes.json", + "id": "http://justice.gov.uk/cakeshop/query/cakeshop.query-recipes.json", "type": "object", "properties": { "pagesize": { diff --git a/example-context/example-service/example-query/example-query-api/src/raml/json/schema/example.search-cakes.json b/cakeshop-query/cakeshop-query-api/src/raml/json/schema/cakeshop.search-cakes.json similarity index 87% rename from example-context/example-service/example-query/example-query-api/src/raml/json/schema/example.search-cakes.json rename to cakeshop-query/cakeshop-query-api/src/raml/json/schema/cakeshop.search-cakes.json index 1d91049d..5e12e8ad 100644 --- a/example-context/example-service/example-query/example-query-api/src/raml/json/schema/example.search-cakes.json +++ b/cakeshop-query/cakeshop-query-api/src/raml/json/schema/cakeshop.search-cakes.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/query/example.search-cakes.json", + "id": "http://justice.gov.uk/cakeshop/query/cakeshop.search-cakes.json", "type": "object", "properties": { "cakes": { diff --git a/example-context/example-service/example-query/example-query-view/src/raml/json/schema/example.search-index.json b/cakeshop-query/cakeshop-query-api/src/raml/json/schema/cakeshop.search-index.json similarity index 77% rename from example-context/example-service/example-query/example-query-view/src/raml/json/schema/example.search-index.json rename to cakeshop-query/cakeshop-query-api/src/raml/json/schema/cakeshop.search-index.json index 6cfd1814..6ddc24d6 100644 --- a/example-context/example-service/example-query/example-query-view/src/raml/json/schema/example.search-index.json +++ b/cakeshop-query/cakeshop-query-api/src/raml/json/schema/cakeshop.search-index.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/query/example.search-index.json", + "id": "http://justice.gov.uk/cakeshop/query/cakeshop.search-index.json", "type": "object", "properties": { "indexId": { diff --git a/example-context/example-service/example-query/example-query-view/src/raml/json/schema/example.search-recipes.json b/cakeshop-query/cakeshop-query-api/src/raml/json/schema/cakeshop.search-recipes.json similarity index 89% rename from example-context/example-service/example-query/example-query-view/src/raml/json/schema/example.search-recipes.json rename to cakeshop-query/cakeshop-query-api/src/raml/json/schema/cakeshop.search-recipes.json index f0926303..a8172827 100644 --- a/example-context/example-service/example-query/example-query-view/src/raml/json/schema/example.search-recipes.json +++ b/cakeshop-query/cakeshop-query-api/src/raml/json/schema/cakeshop.search-recipes.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/query/example.search-recipes.json", + "id": "http://justice.gov.uk/cakeshop/query/cakeshop.search-recipes.json", "type": "object", "properties": { "recipes": { diff --git a/example-context/example-service/example-query/example-query-api/src/test/java/uk/gov/justice/services/example/cakeshop/query/api/CakeOrdersQueryApiTest.java b/cakeshop-query/cakeshop-query-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/CakeOrdersQueryApiTest.java similarity index 84% rename from example-context/example-service/example-query/example-query-api/src/test/java/uk/gov/justice/services/example/cakeshop/query/api/CakeOrdersQueryApiTest.java rename to cakeshop-query/cakeshop-query-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/CakeOrdersQueryApiTest.java index dc9876c2..2d204542 100644 --- a/example-context/example-service/example-query/example-query-api/src/test/java/uk/gov/justice/services/example/cakeshop/query/api/CakeOrdersQueryApiTest.java +++ b/cakeshop-query/cakeshop-query-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/CakeOrdersQueryApiTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.api; +package uk.gov.justice.services.cakeshop.cakeshop.query.api; import static org.hamcrest.MatcherAssert.assertThat; @@ -14,7 +14,7 @@ public class CakeOrdersQueryApiTest { public void shouldHandleCakeOrderQuery() throws Exception { assertThat(CakeOrdersQueryApi.class, isHandlerClass(QUERY_API) .with(method("getOrder") - .thatHandles("example.get-order") + .thatHandles("cakeshop.get-order") .withRequesterPassThrough())); } } diff --git a/example-context/example-service/example-query/example-query-api/src/test/java/uk/gov/justice/services/example/cakeshop/query/api/CakesQueryApiTest.java b/cakeshop-query/cakeshop-query-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/CakesQueryApiTest.java similarity index 84% rename from example-context/example-service/example-query/example-query-api/src/test/java/uk/gov/justice/services/example/cakeshop/query/api/CakesQueryApiTest.java rename to cakeshop-query/cakeshop-query-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/CakesQueryApiTest.java index b79906af..dc3e1b65 100644 --- a/example-context/example-service/example-query/example-query-api/src/test/java/uk/gov/justice/services/example/cakeshop/query/api/CakesQueryApiTest.java +++ b/cakeshop-query/cakeshop-query-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/CakesQueryApiTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.api; +package uk.gov.justice.services.cakeshop.cakeshop.query.api; import static org.hamcrest.MatcherAssert.assertThat; import static uk.gov.justice.services.core.annotation.Component.QUERY_API; @@ -13,7 +13,7 @@ public class CakesQueryApiTest { public void shouldBeQueryApiThatHasRequesterPassThroughMethod() throws Exception { assertThat(CakesQueryApi.class, isHandlerClass(QUERY_API) .with(method("cakes") - .thatHandles("example.search-cakes") + .thatHandles("cakeshop.search-cakes") .withRequesterPassThrough() )); } diff --git a/example-context/example-service/example-query/example-query-api/src/test/java/uk/gov/justice/services/example/cakeshop/query/api/IndexQueryApiTest.java b/cakeshop-query/cakeshop-query-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/IndexQueryApiTest.java similarity index 84% rename from example-context/example-service/example-query/example-query-api/src/test/java/uk/gov/justice/services/example/cakeshop/query/api/IndexQueryApiTest.java rename to cakeshop-query/cakeshop-query-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/IndexQueryApiTest.java index ed02c914..47be21c9 100644 --- a/example-context/example-service/example-query/example-query-api/src/test/java/uk/gov/justice/services/example/cakeshop/query/api/IndexQueryApiTest.java +++ b/cakeshop-query/cakeshop-query-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/IndexQueryApiTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.api; +package uk.gov.justice.services.cakeshop.cakeshop.query.api; import static org.hamcrest.MatcherAssert.assertThat; import static uk.gov.justice.services.core.annotation.Component.QUERY_API; @@ -13,7 +13,7 @@ public class IndexQueryApiTest { public void shouldHandleIndexQuery() throws Exception { assertThat(IndexQueryApi.class, isHandlerClass(QUERY_API) .with(method("getIndex") - .thatHandles("example.get-index") + .thatHandles("cakeshop.get-index") .withRequesterPassThrough())); } diff --git a/example-context/example-service/example-query/example-query-api/src/test/java/uk/gov/justice/services/example/cakeshop/query/api/RecipesQueryApiTest.java b/cakeshop-query/cakeshop-query-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/RecipesQueryApiTest.java similarity index 76% rename from example-context/example-service/example-query/example-query-api/src/test/java/uk/gov/justice/services/example/cakeshop/query/api/RecipesQueryApiTest.java rename to cakeshop-query/cakeshop-query-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/RecipesQueryApiTest.java index 7e7cae15..5811a46a 100644 --- a/example-context/example-service/example-query/example-query-api/src/test/java/uk/gov/justice/services/example/cakeshop/query/api/RecipesQueryApiTest.java +++ b/cakeshop-query/cakeshop-query-api/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/RecipesQueryApiTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.api; +package uk.gov.justice.services.cakeshop.cakeshop.query.api; import static org.hamcrest.CoreMatchers.allOf; @@ -16,16 +16,16 @@ public void shouldBeQueryApiThatHasRequesterPassThroughMethods() throws Exceptio assertThat(RecipesQueryApi.class, isHandlerClass(QUERY_API) .with(allOf( method("searchRecipes") - .thatHandles("example.search-recipes") + .thatHandles("cakeshop.search-recipes") .withRequesterPassThrough(), method("getRecipe") - .thatHandles("example.get-recipe") + .thatHandles("cakeshop.get-recipe") .withRequesterPassThrough(), method("queryRecipes") - .thatHandles("example.query-recipes") + .thatHandles("cakeshop.query-recipes") .withRequesterPassThrough(), method("getRecipePhotograph") - .thatHandles("example.get-recipe-photograph") + .thatHandles("cakeshop.get-recipe-photograph") .withRequesterPassThrough() ))); } diff --git a/example-context/example-service/example-query/example-query-view/pom.xml b/cakeshop-query/cakeshop-query-view/pom.xml similarity index 90% rename from example-context/example-service/example-query/example-query-view/pom.xml rename to cakeshop-query/cakeshop-query-view/pom.xml index 009983c4..c39b84f6 100644 --- a/example-context/example-service/example-query/example-query-view/pom.xml +++ b/cakeshop-query/cakeshop-query-view/pom.xml @@ -3,13 +3,13 @@ xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - example-query - uk.gov.justice.services.example + cakeshop-query + uk.gov.justice.services.cakeshop 17.0.2-SNAPSHOT 4.0.0 - example-query-view + cakeshop-query-view war @@ -39,8 +39,8 @@ rest-adapter-core - uk.gov.justice.services.example - example-persistence + uk.gov.justice.services.cakeshop + cakeshop-viewstore-persistence ${project.version} diff --git a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/CakeOrdersQueryView.java b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/CakeOrdersQueryView.java similarity index 64% rename from example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/CakeOrdersQueryView.java rename to cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/CakeOrdersQueryView.java index 8539b817..6cbefd4f 100644 --- a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/CakeOrdersQueryView.java +++ b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/CakeOrdersQueryView.java @@ -1,13 +1,13 @@ -package uk.gov.justice.services.example.cakeshop.query.view; +package uk.gov.justice.services.cakeshop.cakeshop.query.view; import static uk.gov.justice.services.core.enveloper.Enveloper.envelop; import uk.gov.justice.services.core.annotation.Component; import uk.gov.justice.services.core.annotation.Handles; import uk.gov.justice.services.core.annotation.ServiceComponent; -import uk.gov.justice.services.example.cakeshop.query.view.request.SearchCakeOrder; -import uk.gov.justice.services.example.cakeshop.query.view.response.CakeOrderView; -import uk.gov.justice.services.example.cakeshop.query.view.service.CakeOrderService; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.request.SearchCakeOrder; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.response.CakeOrderView; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.service.CakeOrderService; import uk.gov.justice.services.messaging.Envelope; import javax.inject.Inject; @@ -18,12 +18,12 @@ public class CakeOrdersQueryView { @Inject CakeOrderService service; - @Handles("example.get-order") + @Handles("cakeshop.get-order") public Envelope findOrder(final Envelope query) { final String orderId = query.payload().getOrderId().toString(); return envelop(service.findOrder(orderId)) - .withName("example.get-order") + .withName("cakeshop.get-order") .withMetadataFrom(query); } } diff --git a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/CakesQueryView.java b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/CakesQueryView.java similarity index 67% rename from example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/CakesQueryView.java rename to cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/CakesQueryView.java index 2aa7aca2..410b9f08 100644 --- a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/CakesQueryView.java +++ b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/CakesQueryView.java @@ -1,12 +1,12 @@ -package uk.gov.justice.services.example.cakeshop.query.view; +package uk.gov.justice.services.cakeshop.cakeshop.query.view; import static uk.gov.justice.services.core.annotation.Component.QUERY_VIEW; import static uk.gov.justice.services.core.enveloper.Enveloper.envelop; import uk.gov.justice.services.core.annotation.Handles; import uk.gov.justice.services.core.annotation.ServiceComponent; -import uk.gov.justice.services.example.cakeshop.query.view.response.CakesView; -import uk.gov.justice.services.example.cakeshop.query.view.service.CakeService; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.response.CakesView; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.service.CakeService; import uk.gov.justice.services.messaging.Envelope; import uk.gov.justice.services.messaging.JsonEnvelope; @@ -19,10 +19,10 @@ public class CakesQueryView { @Inject CakeService service; - @Handles("example.search-cakes") + @Handles("cakeshop.search-cakes") public Envelope cakes(final JsonEnvelope query) { return envelop(service.cakes()) - .withName("example.search-cakes") + .withName("cakeshop.search-cakes") .withMetadataFrom(query); } } diff --git a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/IndexQueryView.java b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/IndexQueryView.java similarity index 64% rename from example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/IndexQueryView.java rename to cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/IndexQueryView.java index d85a8225..49c624ff 100644 --- a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/IndexQueryView.java +++ b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/IndexQueryView.java @@ -1,13 +1,13 @@ -package uk.gov.justice.services.example.cakeshop.query.view; +package uk.gov.justice.services.cakeshop.cakeshop.query.view; import static uk.gov.justice.services.core.enveloper.Enveloper.envelop; import uk.gov.justice.services.core.annotation.Component; import uk.gov.justice.services.core.annotation.Handles; import uk.gov.justice.services.core.annotation.ServiceComponent; -import uk.gov.justice.services.example.cakeshop.query.view.request.SearchIndex; -import uk.gov.justice.services.example.cakeshop.query.view.response.IndexView; -import uk.gov.justice.services.example.cakeshop.query.view.service.IndexService; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.request.SearchIndex; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.response.IndexView; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.service.IndexService; import uk.gov.justice.services.messaging.Envelope; import javax.inject.Inject; @@ -18,12 +18,12 @@ public class IndexQueryView { @Inject private IndexService indexService; - @Handles("example.get-index") + @Handles("cakeshop.get-index") public Envelope findIndex(final Envelope query) { final String indexId = query.payload().getIndexId().toString(); return envelop(indexService.findIndexBy(indexId)) - .withName("example.get-index") + .withName("cakeshop.get-index") .withMetadataFrom(query); } } diff --git a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/RecipesQueryView.java b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/RecipesQueryView.java similarity index 75% rename from example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/RecipesQueryView.java rename to cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/RecipesQueryView.java index 7447b71b..c803c23e 100644 --- a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/RecipesQueryView.java +++ b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/RecipesQueryView.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.view; +package uk.gov.justice.services.cakeshop.cakeshop.query.view; import static uk.gov.justice.services.core.enveloper.Enveloper.envelop; import static uk.gov.justice.services.messaging.JsonObjects.getBoolean; @@ -7,11 +7,11 @@ import uk.gov.justice.services.core.annotation.Component; import uk.gov.justice.services.core.annotation.Handles; import uk.gov.justice.services.core.annotation.ServiceComponent; -import uk.gov.justice.services.example.cakeshop.query.view.request.SearchRecipes; -import uk.gov.justice.services.example.cakeshop.query.view.response.PhotoView; -import uk.gov.justice.services.example.cakeshop.query.view.response.RecipeView; -import uk.gov.justice.services.example.cakeshop.query.view.response.RecipesView; -import uk.gov.justice.services.example.cakeshop.query.view.service.RecipeService; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.request.SearchRecipes; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.response.PhotoView; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.response.RecipeView; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.response.RecipesView; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.service.RecipeService; import uk.gov.justice.services.messaging.Envelope; import java.util.Optional; @@ -22,9 +22,9 @@ @ServiceComponent(Component.QUERY_VIEW) public class RecipesQueryView { - static final String NAME_RESPONSE_RECIPE = "example.get-recipe"; - static final String NAME_RESPONSE_RECIPE_PHOTO = "example.get-recipe-photograph"; - static final String NAME_RESPONSE_RECIPE_LIST = "example.search-recipes"; + static final String NAME_RESPONSE_RECIPE = "cakeshop.get-recipe"; + static final String NAME_RESPONSE_RECIPE_PHOTO = "cakeshop.get-recipe-photograph"; + static final String NAME_RESPONSE_RECIPE_LIST = "cakeshop.search-recipes"; private static final String FIELD_RECIPE_ID = "recipeId"; private static final String FIELD_NAME = "name"; private static final String PAGESIZE = "pagesize"; @@ -33,7 +33,7 @@ public class RecipesQueryView { @Inject RecipeService recipeService; - @Handles("example.get-recipe") + @Handles("cakeshop.get-recipe") public Envelope findRecipe(final Envelope query) { final RecipeView recipe = recipeService.findRecipe(query.payload().getString(FIELD_RECIPE_ID)); @@ -42,21 +42,21 @@ public Envelope findRecipe(final Envelope query) { .withMetadataFrom(query); } - @Handles("example.search-recipes") + @Handles("cakeshop.search-recipes") public Envelope listRecipes(final Envelope query) { return envelop(fetchRecipes(query)) .withName(NAME_RESPONSE_RECIPE_LIST) .withMetadataFrom(query); } - @Handles("example.query-recipes") + @Handles("cakeshop.query-recipes") public Envelope queryRecipes(final Envelope query) { return envelop(fetchRecipes(query.payload())) .withName(NAME_RESPONSE_RECIPE_LIST) .withMetadataFrom(query); } - @Handles("example.get-recipe-photograph") + @Handles("cakeshop.get-recipe-photograph") public Envelope findRecipePhoto(final Envelope query) { final PhotoView photo = recipeService.findRecipePhoto(query.payload().getString(FIELD_RECIPE_ID)); return envelop(photo) diff --git a/example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/request/SearchCakeOrder.java b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/request/SearchCakeOrder.java similarity index 89% rename from example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/request/SearchCakeOrder.java rename to cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/request/SearchCakeOrder.java index 54ed5b69..e74a0ffc 100644 --- a/example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/request/SearchCakeOrder.java +++ b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/request/SearchCakeOrder.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.api.request; +package uk.gov.justice.services.cakeshop.cakeshop.query.view.request; import java.time.ZonedDateTime; import java.util.UUID; diff --git a/example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/request/SearchIndex.java b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/request/SearchIndex.java similarity index 86% rename from example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/request/SearchIndex.java rename to cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/request/SearchIndex.java index 9a01a505..e703c1dd 100644 --- a/example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/request/SearchIndex.java +++ b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/request/SearchIndex.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.api.request; +package uk.gov.justice.services.cakeshop.cakeshop.query.view.request; import java.time.ZonedDateTime; import java.util.UUID; diff --git a/example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/request/SearchRecipes.java b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/request/SearchRecipes.java similarity index 91% rename from example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/request/SearchRecipes.java rename to cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/request/SearchRecipes.java index 03f55704..adc4c142 100644 --- a/example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/request/SearchRecipes.java +++ b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/request/SearchRecipes.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.api.request; +package uk.gov.justice.services.cakeshop.cakeshop.query.view.request; public class SearchRecipes { diff --git a/example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/response/CakeOrderView.java b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/response/CakeOrderView.java similarity index 89% rename from example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/response/CakeOrderView.java rename to cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/response/CakeOrderView.java index ab4b21d4..07f33f08 100644 --- a/example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/response/CakeOrderView.java +++ b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/response/CakeOrderView.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.api.response; +package uk.gov.justice.services.cakeshop.cakeshop.query.view.response; import java.time.ZonedDateTime; import java.util.UUID; diff --git a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/response/CakeView.java b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/response/CakeView.java similarity index 82% rename from example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/response/CakeView.java rename to cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/response/CakeView.java index 739bbb41..9220c48b 100644 --- a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/response/CakeView.java +++ b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/response/CakeView.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.view.response; +package uk.gov.justice.services.cakeshop.cakeshop.query.view.response; import java.util.UUID; diff --git a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/response/CakesView.java b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/response/CakesView.java similarity index 84% rename from example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/response/CakesView.java rename to cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/response/CakesView.java index 39170a86..b859b2cc 100644 --- a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/response/CakesView.java +++ b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/response/CakesView.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.view.response; +package uk.gov.justice.services.cakeshop.cakeshop.query.view.response; import java.util.List; diff --git a/example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/response/IndexView.java b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/response/IndexView.java similarity index 86% rename from example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/response/IndexView.java rename to cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/response/IndexView.java index 5a0c5a7b..e6df0141 100644 --- a/example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/response/IndexView.java +++ b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/response/IndexView.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.api.response; +package uk.gov.justice.services.cakeshop.cakeshop.query.view.response; import java.time.ZonedDateTime; import java.util.UUID; @@ -13,6 +13,7 @@ public IndexView(final UUID indexId, final ZonedDateTime deliveryDate) { this.deliveryDate = deliveryDate; } + public UUID getIndexId() { return indexId; } diff --git a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/response/PhotoView.java b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/response/PhotoView.java similarity index 75% rename from example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/response/PhotoView.java rename to cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/response/PhotoView.java index 6694165d..92252de1 100644 --- a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/response/PhotoView.java +++ b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/response/PhotoView.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.view.response; +package uk.gov.justice.services.cakeshop.cakeshop.query.view.response; import java.util.UUID; diff --git a/example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/response/RecipeView.java b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/response/RecipeView.java similarity index 89% rename from example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/response/RecipeView.java rename to cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/response/RecipeView.java index 12ad0418..35b71cef 100644 --- a/example-context/example-service/example-query/example-query-api/src/main/java/uk/gov/justice/services/example/cakeshop/query/api/response/RecipeView.java +++ b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/response/RecipeView.java @@ -1,6 +1,6 @@ -package uk.gov.justice.services.example.cakeshop.query.api.response; +package uk.gov.justice.services.cakeshop.cakeshop.query.view.response; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Recipe; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Recipe; import java.util.Objects; import java.util.UUID; diff --git a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/response/RecipesView.java b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/response/RecipesView.java similarity index 85% rename from example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/response/RecipesView.java rename to cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/response/RecipesView.java index 021616af..26d9c1f6 100644 --- a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/response/RecipesView.java +++ b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/response/RecipesView.java @@ -1,6 +1,6 @@ -package uk.gov.justice.services.example.cakeshop.query.view.response; +package uk.gov.justice.services.cakeshop.cakeshop.query.view.response; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Recipe; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Recipe; import java.util.List; import java.util.Objects; diff --git a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/service/CakeOrderService.java b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/service/CakeOrderService.java similarity index 57% rename from example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/service/CakeOrderService.java rename to cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/service/CakeOrderService.java index 5b3400ce..67d68ede 100644 --- a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/service/CakeOrderService.java +++ b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/service/CakeOrderService.java @@ -1,8 +1,8 @@ -package uk.gov.justice.services.example.cakeshop.query.view.service; +package uk.gov.justice.services.cakeshop.cakeshop.query.view.service; -import uk.gov.justice.services.example.cakeshop.persistence.CakeOrderRepository; -import uk.gov.justice.services.example.cakeshop.persistence.entity.CakeOrder; -import uk.gov.justice.services.example.cakeshop.query.view.response.CakeOrderView; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.CakeOrderRepository; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.CakeOrder; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.response.CakeOrderView; import java.util.UUID; diff --git a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/service/CakeService.java b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/service/CakeService.java similarity index 53% rename from example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/service/CakeService.java rename to cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/service/CakeService.java index 9fb2dfab..f124580e 100644 --- a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/service/CakeService.java +++ b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/service/CakeService.java @@ -1,11 +1,11 @@ -package uk.gov.justice.services.example.cakeshop.query.view.service; +package uk.gov.justice.services.cakeshop.cakeshop.query.view.service; import static java.util.stream.Collectors.toList; -import uk.gov.justice.services.example.cakeshop.persistence.CakeRepository; -import uk.gov.justice.services.example.cakeshop.query.view.response.CakeView; -import uk.gov.justice.services.example.cakeshop.query.view.response.CakesView; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.CakeRepository; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.response.CakeView; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.response.CakesView; import javax.inject.Inject; diff --git a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/service/IndexService.java b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/service/IndexService.java similarity index 55% rename from example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/service/IndexService.java rename to cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/service/IndexService.java index c706cc00..2d76dc28 100644 --- a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/service/IndexService.java +++ b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/service/IndexService.java @@ -1,8 +1,8 @@ -package uk.gov.justice.services.example.cakeshop.query.view.service; +package uk.gov.justice.services.cakeshop.cakeshop.query.view.service; -import uk.gov.justice.services.example.cakeshop.persistence.IndexRepository; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Index; -import uk.gov.justice.services.example.cakeshop.query.view.response.IndexView; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.IndexRepository; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Index; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.response.IndexView; import java.util.UUID; diff --git a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/service/RecipeService.java b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/service/RecipeService.java similarity index 75% rename from example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/service/RecipeService.java rename to cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/service/RecipeService.java index 83668bcc..b02c2538 100644 --- a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/cakeshop/query/view/service/RecipeService.java +++ b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/service/RecipeService.java @@ -1,12 +1,12 @@ -package uk.gov.justice.services.example.cakeshop.query.view.service; +package uk.gov.justice.services.cakeshop.cakeshop.query.view.service; import static java.util.stream.Collectors.toList; -import uk.gov.justice.services.example.cakeshop.persistence.RecipeRepository; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Recipe; -import uk.gov.justice.services.example.cakeshop.query.view.response.PhotoView; -import uk.gov.justice.services.example.cakeshop.query.view.response.RecipeView; -import uk.gov.justice.services.example.cakeshop.query.view.response.RecipesView; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.RecipeRepository; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Recipe; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.response.PhotoView; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.response.RecipeView; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.response.RecipesView; import java.util.Optional; import java.util.UUID; diff --git a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/provider/ExampleQueryViewInterceptorChainProvider.java b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/provider/CakeshopQueryViewInterceptorChainProvider.java similarity index 79% rename from example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/provider/ExampleQueryViewInterceptorChainProvider.java rename to cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/provider/CakeshopQueryViewInterceptorChainProvider.java index 2a7ec586..91f538bd 100644 --- a/example-context/example-service/example-query/example-query-view/src/main/java/uk/gov/justice/services/example/provider/ExampleQueryViewInterceptorChainProvider.java +++ b/cakeshop-query/cakeshop-query-view/src/main/java/uk/gov/justice/services/cakeshop/provider/CakeshopQueryViewInterceptorChainProvider.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.provider; +package uk.gov.justice.services.cakeshop.provider; import static uk.gov.justice.services.core.annotation.Component.QUERY_VIEW; @@ -8,7 +8,7 @@ import java.util.ArrayList; import java.util.List; -public class ExampleQueryViewInterceptorChainProvider implements InterceptorChainEntryProvider { +public class CakeshopQueryViewInterceptorChainProvider implements InterceptorChainEntryProvider { private final List interceptorChainEntries = new ArrayList<>(); diff --git a/example-context/example-service/example-query/example-query-view/src/main/resources/META-INF/beans.xml b/cakeshop-query/cakeshop-query-view/src/main/resources/META-INF/beans.xml similarity index 100% rename from example-context/example-service/example-query/example-query-view/src/main/resources/META-INF/beans.xml rename to cakeshop-query/cakeshop-query-view/src/main/resources/META-INF/beans.xml diff --git a/example-context/example-service/example-query/example-query-view/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/cakeshop-query/cakeshop-query-view/src/main/webapp/WEB-INF/jboss-deployment-structure.xml similarity index 100% rename from example-context/example-service/example-query/example-query-view/src/main/webapp/WEB-INF/jboss-deployment-structure.xml rename to cakeshop-query/cakeshop-query-view/src/main/webapp/WEB-INF/jboss-deployment-structure.xml diff --git a/example-context/example-service/example-query/example-query-view/src/raml/example-query-view.raml b/cakeshop-query/cakeshop-query-view/src/raml/cakeshop-query-view.raml similarity index 52% rename from example-context/example-service/example-query/example-query-view/src/raml/example-query-view.raml rename to cakeshop-query/cakeshop-query-view/src/raml/cakeshop-query-view.raml index 2c71a29e..998e347b 100644 --- a/example-context/example-service/example-query/example-query-view/src/raml/example-query-view.raml +++ b/cakeshop-query/cakeshop-query-view/src/raml/cakeshop-query-view.raml @@ -1,6 +1,6 @@ #%RAML 0.8 title: Cakeshop Data View API -baseUri: http://localhost:8080/example-query-view/query/view/rest/cakeshop +baseUri: http://localhost:8080/cakeshop-query-view/query/view/rest/cakeshop version: v0.1 mediaType: application/json protocols: [ HTTP, HTTPS ] @@ -11,8 +11,8 @@ protocols: [ HTTP, HTTPS ] description: | ... (mapping): - responseType: application/vnd.example.recipes+json - name: example.search-recipes + responseType: application/vnd.cakeshop.recipes+json + name: cakeshop.search-recipes ... queryParameters: pagesize: @@ -30,25 +30,25 @@ protocols: [ HTTP, HTTPS ] responses: 200: body: - application/vnd.example.recipes+json: - schema: !include json/schema/example.search-recipes.json + application/vnd.cakeshop.recipes+json: + schema: !include json/schema/cakeshop.search-recipes.json example: !include json/recipes.json post: description: | ... (mapping): - requestType: application/vnd.example.query-recipes+json - name: example.query-recipes + requestType: application/vnd.cakeshop.query-recipes+json + name: cakeshop.query-recipes ... body: - application/vnd.example.query-recipes+json: - schema: !include json/schema/example.query-recipes.json + application/vnd.cakeshop.query-recipes+json: + schema: !include json/schema/cakeshop.query-recipes.json example: !include json/query-recipes.json responses: 200: body: - application/vnd.example.recipes+json: - schema: !include json/schema/example.search-recipes.json + application/vnd.cakeshop.recipes+json: + schema: !include json/schema/cakeshop.search-recipes.json example: !include json/recipes.json /recipes/{recipeId}: @@ -57,14 +57,14 @@ protocols: [ HTTP, HTTPS ] description: | ... (mapping): - responseType: application/vnd.example.recipe+json - name: example.get-recipe + responseType: application/vnd.cakeshop.recipe+json + name: cakeshop.get-recipe ... responses: 200: body: - application/vnd.example.recipe+json: - schema: !include json/schema/example.get-recipe.json + application/vnd.cakeshop.recipe+json: + schema: !include json/schema/cakeshop.get-recipe.json example: !include json/recipe.json /recipes/{recipeId}/photograph: @@ -73,14 +73,14 @@ protocols: [ HTTP, HTTPS ] description: | ... (mapping): - responseType: application/vnd.example.recipe-photograph+json - name: example.get-recipe-photograph + responseType: application/vnd.cakeshop.recipe-photograph+json + name: cakeshop.get-recipe-photograph ... responses: 200: body: - application/vnd.example.recipe-photograph+json: - schema: !include json/schema/example.get-recipe-photograph.json + application/vnd.cakeshop.recipe-photograph+json: + schema: !include json/schema/cakeshop.get-recipe-photograph.json example: !include json/recipe-photograph.json /orders/{orderId}: @@ -89,14 +89,14 @@ protocols: [ HTTP, HTTPS ] description: | ... (mapping): - responseType: application/vnd.example.order+json - name: example.get-order + responseType: application/vnd.cakeshop.order+json + name: cakeshop.get-order ... responses: 200: body: - application/vnd.example.order+json: - schema: !include json/schema/example.get-order.json + application/vnd.cakeshop.order+json: + schema: !include json/schema/cakeshop.get-order.json example: !include json/order.json /cakes: description: return cakes @@ -104,14 +104,14 @@ protocols: [ HTTP, HTTPS ] description: | ... (mapping): - responseType: application/vnd.example.cakes+json - name: example.search-cakes + responseType: application/vnd.cakeshop.cakes+json + name: cakeshop.search-cakes ... responses: 200: body: - application/vnd.example.cakes+json: - schema: !include json/schema/example.search-cakes.json + application/vnd.cakeshop.cakes+json: + schema: !include json/schema/cakeshop.search-cakes.json example: !include json/cakes.json /index/{indexId}: @@ -120,12 +120,12 @@ protocols: [ HTTP, HTTPS ] description: | ... (mapping): - responseType: application/vnd.example.index+json - name: example.get-index + responseType: application/vnd.cakeshop.index+json + name: cakeshop.get-index ... responses: 200: body: - application/vnd.example.index+json: - schema: !include json/schema/example.search-index.json + application/vnd.cakeshop.index+json: + schema: !include json/schema/cakeshop.search-index.json example: !include json/index.json \ No newline at end of file diff --git a/example-context/example-service/example-query/example-query-view/src/raml/json/cakes.json b/cakeshop-query/cakeshop-query-view/src/raml/json/cakes.json similarity index 100% rename from example-context/example-service/example-query/example-query-view/src/raml/json/cakes.json rename to cakeshop-query/cakeshop-query-view/src/raml/json/cakes.json diff --git a/example-context/example-service/example-query/example-query-view/src/raml/json/index.json b/cakeshop-query/cakeshop-query-view/src/raml/json/index.json similarity index 100% rename from example-context/example-service/example-query/example-query-view/src/raml/json/index.json rename to cakeshop-query/cakeshop-query-view/src/raml/json/index.json diff --git a/example-context/example-service/example-query/example-query-view/src/raml/json/order.json b/cakeshop-query/cakeshop-query-view/src/raml/json/order.json similarity index 100% rename from example-context/example-service/example-query/example-query-view/src/raml/json/order.json rename to cakeshop-query/cakeshop-query-view/src/raml/json/order.json diff --git a/example-context/example-service/example-query/example-query-view/src/raml/json/query-recipes.json b/cakeshop-query/cakeshop-query-view/src/raml/json/query-recipes.json similarity index 100% rename from example-context/example-service/example-query/example-query-view/src/raml/json/query-recipes.json rename to cakeshop-query/cakeshop-query-view/src/raml/json/query-recipes.json diff --git a/example-context/example-service/example-query/example-query-view/src/raml/json/recipe-photograph.json b/cakeshop-query/cakeshop-query-view/src/raml/json/recipe-photograph.json similarity index 100% rename from example-context/example-service/example-query/example-query-view/src/raml/json/recipe-photograph.json rename to cakeshop-query/cakeshop-query-view/src/raml/json/recipe-photograph.json diff --git a/example-context/example-service/example-query/example-query-view/src/raml/json/recipe.json b/cakeshop-query/cakeshop-query-view/src/raml/json/recipe.json similarity index 100% rename from example-context/example-service/example-query/example-query-view/src/raml/json/recipe.json rename to cakeshop-query/cakeshop-query-view/src/raml/json/recipe.json diff --git a/example-context/example-service/example-query/example-query-view/src/raml/json/recipes.json b/cakeshop-query/cakeshop-query-view/src/raml/json/recipes.json similarity index 100% rename from example-context/example-service/example-query/example-query-view/src/raml/json/recipes.json rename to cakeshop-query/cakeshop-query-view/src/raml/json/recipes.json diff --git a/example-context/example-service/example-query/example-query-api/src/raml/json/schema/example.get-order.json b/cakeshop-query/cakeshop-query-view/src/raml/json/schema/cakeshop.get-order.json similarity index 81% rename from example-context/example-service/example-query/example-query-api/src/raml/json/schema/example.get-order.json rename to cakeshop-query/cakeshop-query-view/src/raml/json/schema/cakeshop.get-order.json index 4eaa8d67..e6adbee3 100644 --- a/example-context/example-service/example-query/example-query-api/src/raml/json/schema/example.get-order.json +++ b/cakeshop-query/cakeshop-query-view/src/raml/json/schema/cakeshop.get-order.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/query/example.get-order.json", + "id": "http://justice.gov.uk/cakeshop/query/cakeshop.get-order.json", "type": "object", "properties": { "orderId": { diff --git a/example-context/example-service/example-query/example-query-view/src/raml/json/schema/example.get-recipe-photograph.json b/cakeshop-query/cakeshop-query-view/src/raml/json/schema/cakeshop.get-recipe-photograph.json similarity index 66% rename from example-context/example-service/example-query/example-query-view/src/raml/json/schema/example.get-recipe-photograph.json rename to cakeshop-query/cakeshop-query-view/src/raml/json/schema/cakeshop.get-recipe-photograph.json index 9f22bde9..284407ee 100644 --- a/example-context/example-service/example-query/example-query-view/src/raml/json/schema/example.get-recipe-photograph.json +++ b/cakeshop-query/cakeshop-query-view/src/raml/json/schema/cakeshop.get-recipe-photograph.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/query/example.get-recipe-photograph.json", + "id": "http://justice.gov.uk/cakeshop/query/cakeshop.get-recipe-photograph.json", "type": "object", "properties": { "name": { diff --git a/example-context/example-service/example-query/example-query-view/src/raml/json/schema/example.get-recipe.json b/cakeshop-query/cakeshop-query-view/src/raml/json/schema/cakeshop.get-recipe.json similarity index 79% rename from example-context/example-service/example-query/example-query-view/src/raml/json/schema/example.get-recipe.json rename to cakeshop-query/cakeshop-query-view/src/raml/json/schema/cakeshop.get-recipe.json index 29c78a42..aa6a98f2 100644 --- a/example-context/example-service/example-query/example-query-view/src/raml/json/schema/example.get-recipe.json +++ b/cakeshop-query/cakeshop-query-view/src/raml/json/schema/cakeshop.get-recipe.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/query/example.get-recipe.json", + "id": "http://justice.gov.uk/cakeshop/query/cakeshop.get-recipe.json", "type": "object", "properties": { "name": { diff --git a/example-context/example-service/example-query/example-query-view/src/raml/json/schema/example.query-recipes.json b/cakeshop-query/cakeshop-query-view/src/raml/json/schema/cakeshop.query-recipes.json similarity index 78% rename from example-context/example-service/example-query/example-query-view/src/raml/json/schema/example.query-recipes.json rename to cakeshop-query/cakeshop-query-view/src/raml/json/schema/cakeshop.query-recipes.json index cc21baa4..e1cbf2cb 100644 --- a/example-context/example-service/example-query/example-query-view/src/raml/json/schema/example.query-recipes.json +++ b/cakeshop-query/cakeshop-query-view/src/raml/json/schema/cakeshop.query-recipes.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/query/example.query-recipes.json", + "id": "http://justice.gov.uk/cakeshop/query/cakeshop.query-recipes.json", "type": "object", "properties": { "pagesize": { diff --git a/example-context/example-service/example-query/example-query-view/src/raml/json/schema/example.search-cakes.json b/cakeshop-query/cakeshop-query-view/src/raml/json/schema/cakeshop.search-cakes.json similarity index 87% rename from example-context/example-service/example-query/example-query-view/src/raml/json/schema/example.search-cakes.json rename to cakeshop-query/cakeshop-query-view/src/raml/json/schema/cakeshop.search-cakes.json index 1d91049d..5e12e8ad 100644 --- a/example-context/example-service/example-query/example-query-view/src/raml/json/schema/example.search-cakes.json +++ b/cakeshop-query/cakeshop-query-view/src/raml/json/schema/cakeshop.search-cakes.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/query/example.search-cakes.json", + "id": "http://justice.gov.uk/cakeshop/query/cakeshop.search-cakes.json", "type": "object", "properties": { "cakes": { diff --git a/example-context/example-service/example-query/example-query-api/src/raml/json/schema/example.search-index.json b/cakeshop-query/cakeshop-query-view/src/raml/json/schema/cakeshop.search-index.json similarity index 77% rename from example-context/example-service/example-query/example-query-api/src/raml/json/schema/example.search-index.json rename to cakeshop-query/cakeshop-query-view/src/raml/json/schema/cakeshop.search-index.json index 6cfd1814..6ddc24d6 100644 --- a/example-context/example-service/example-query/example-query-api/src/raml/json/schema/example.search-index.json +++ b/cakeshop-query/cakeshop-query-view/src/raml/json/schema/cakeshop.search-index.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/query/example.search-index.json", + "id": "http://justice.gov.uk/cakeshop/query/cakeshop.search-index.json", "type": "object", "properties": { "indexId": { diff --git a/example-context/example-service/example-query/example-query-api/src/raml/json/schema/example.search-recipes.json b/cakeshop-query/cakeshop-query-view/src/raml/json/schema/cakeshop.search-recipes.json similarity index 89% rename from example-context/example-service/example-query/example-query-api/src/raml/json/schema/example.search-recipes.json rename to cakeshop-query/cakeshop-query-view/src/raml/json/schema/cakeshop.search-recipes.json index f0926303..a8172827 100644 --- a/example-context/example-service/example-query/example-query-api/src/raml/json/schema/example.search-recipes.json +++ b/cakeshop-query/cakeshop-query-view/src/raml/json/schema/cakeshop.search-recipes.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "id": "http://justice.gov.uk/example/query/example.search-recipes.json", + "id": "http://justice.gov.uk/cakeshop/query/cakeshop.search-recipes.json", "type": "object", "properties": { "recipes": { diff --git a/example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/api/request/CakesQueryViewTest.java b/cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/request/CakesQueryViewTest.java similarity index 82% rename from example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/api/request/CakesQueryViewTest.java rename to cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/request/CakesQueryViewTest.java index dcfd15ed..b198f22e 100644 --- a/example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/api/request/CakesQueryViewTest.java +++ b/cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/api/request/CakesQueryViewTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.api.request; +package uk.gov.justice.services.cakeshop.cakeshop.query.api.request; import static java.util.Arrays.asList; import static java.util.UUID.randomUUID; @@ -11,10 +11,10 @@ import static uk.gov.justice.services.test.utils.core.messaging.JsonEnvelopeBuilder.envelope; import static uk.gov.justice.services.test.utils.core.messaging.MetadataBuilderFactory.metadataWithDefaults; -import uk.gov.justice.services.example.cakeshop.query.view.CakesQueryView; -import uk.gov.justice.services.example.cakeshop.query.view.response.CakeView; -import uk.gov.justice.services.example.cakeshop.query.view.response.CakesView; -import uk.gov.justice.services.example.cakeshop.query.view.service.CakeService; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.CakesQueryView; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.response.CakeView; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.response.CakesView; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.service.CakeService; import uk.gov.justice.services.messaging.Envelope; import uk.gov.justice.services.messaging.JsonEnvelope; @@ -39,7 +39,7 @@ public class CakesQueryViewTest { @Test public void shouldHaveCorrectHandlerMethod() throws Exception { assertThat(queryView, isHandler(QUERY_VIEW) - .with(method("cakes").thatHandles("example.search-cakes"))); + .with(method("cakes").thatHandles("cakeshop.search-cakes"))); } @Test diff --git a/example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/view/CakeOrdersQueryViewTest.java b/cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/CakeOrdersQueryViewTest.java similarity index 83% rename from example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/view/CakeOrdersQueryViewTest.java rename to cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/CakeOrdersQueryViewTest.java index a59e7968..474f9506 100644 --- a/example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/view/CakeOrdersQueryViewTest.java +++ b/cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/CakeOrdersQueryViewTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.view; +package uk.gov.justice.services.cakeshop.cakeshop.query.view; import static org.hamcrest.MatcherAssert.assertThat; @@ -10,9 +10,9 @@ import static uk.gov.justice.services.test.utils.core.matchers.HandlerMethodMatcher.method; import static uk.gov.justice.services.test.utils.core.messaging.MetadataBuilderFactory.metadataWithDefaults; -import uk.gov.justice.services.example.cakeshop.query.view.request.SearchCakeOrder; -import uk.gov.justice.services.example.cakeshop.query.view.response.CakeOrderView; -import uk.gov.justice.services.example.cakeshop.query.view.service.CakeOrderService; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.request.SearchCakeOrder; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.response.CakeOrderView; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.service.CakeOrderService; import uk.gov.justice.services.messaging.Envelope; import java.time.ZonedDateTime; @@ -36,7 +36,7 @@ public class CakeOrdersQueryViewTest { @Test public void shouldHaveCorrectHandlerMethod() throws Exception { assertThat(queryView, isHandler(QUERY_VIEW) - .with(method("findOrder").thatHandles("example.get-order"))); + .with(method("findOrder").thatHandles("cakeshop.get-order"))); } @Test diff --git a/example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/view/IndexQueryViewTest.java b/cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/IndexQueryViewTest.java similarity index 83% rename from example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/view/IndexQueryViewTest.java rename to cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/IndexQueryViewTest.java index 550ac1f8..0f168560 100644 --- a/example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/view/IndexQueryViewTest.java +++ b/cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/IndexQueryViewTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.view; +package uk.gov.justice.services.cakeshop.cakeshop.query.view; import static java.util.UUID.randomUUID; import static org.hamcrest.MatcherAssert.assertThat; @@ -10,9 +10,9 @@ import static uk.gov.justice.services.test.utils.core.matchers.HandlerMethodMatcher.method; import static uk.gov.justice.services.test.utils.core.messaging.MetadataBuilderFactory.metadataWithDefaults; -import uk.gov.justice.services.example.cakeshop.query.view.request.SearchIndex; -import uk.gov.justice.services.example.cakeshop.query.view.response.IndexView; -import uk.gov.justice.services.example.cakeshop.query.view.service.IndexService; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.request.SearchIndex; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.response.IndexView; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.service.IndexService; import uk.gov.justice.services.messaging.Envelope; import java.time.ZonedDateTime; @@ -36,7 +36,7 @@ public class IndexQueryViewTest { @Test public void shouldHaveCorrectHandlerMethod() throws Exception { assertThat(indexQueryView, isHandler(QUERY_VIEW) - .with(method("findIndex").thatHandles("example.get-index"))); + .with(method("findIndex").thatHandles("cakeshop.get-index"))); } @Test diff --git a/example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/view/RecipesQueryViewTest.java b/cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/RecipesQueryViewTest.java similarity index 90% rename from example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/view/RecipesQueryViewTest.java rename to cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/RecipesQueryViewTest.java index 9eb8376b..2a238778 100644 --- a/example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/view/RecipesQueryViewTest.java +++ b/cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/RecipesQueryViewTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.view; +package uk.gov.justice.services.cakeshop.cakeshop.query.view; import static java.util.Arrays.asList; @@ -16,11 +16,11 @@ import static uk.gov.justice.services.test.utils.core.matchers.HandlerMethodMatcher.method; import static uk.gov.justice.services.test.utils.core.messaging.MetadataBuilderFactory.metadataWithDefaults; -import uk.gov.justice.services.example.cakeshop.query.view.request.SearchRecipes; -import uk.gov.justice.services.example.cakeshop.query.view.response.PhotoView; -import uk.gov.justice.services.example.cakeshop.query.view.response.RecipeView; -import uk.gov.justice.services.example.cakeshop.query.view.response.RecipesView; -import uk.gov.justice.services.example.cakeshop.query.view.service.RecipeService; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.request.SearchRecipes; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.response.PhotoView; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.response.RecipeView; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.response.RecipesView; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.service.RecipeService; import uk.gov.justice.services.messaging.Envelope; import java.util.Optional; @@ -47,8 +47,8 @@ public class RecipesQueryViewTest { public void shouldHaveCorrectHandlerMethod() throws Exception { assertThat(queryView, isHandler(QUERY_VIEW) .with(allOf( - method("findRecipe").thatHandles("example.get-recipe"), - method("listRecipes").thatHandles("example.search-recipes"))) + method("findRecipe").thatHandles("cakeshop.get-recipe"), + method("listRecipes").thatHandles("cakeshop.search-recipes"))) ); } @@ -187,7 +187,7 @@ public void shouldReturnResponseWithMetadataWhenQueryingForRecipes() { final Envelope response = queryView.listRecipes(envelope); - assertThat(response.metadata().name(), is("example.search-recipes")); + assertThat(response.metadata().name(), is("cakeshop.search-recipes")); } @@ -229,7 +229,7 @@ public void shouldReturnFileId() { final Envelope response = queryView.findRecipePhoto(envelope); - assertThat(response.metadata().name(), is("example.get-recipe-photograph")); + assertThat(response.metadata().name(), is("cakeshop.get-recipe-photograph")); assertThat(response.payload().getFileId(), is(fileId)); } @@ -247,7 +247,7 @@ public void shouldReturnJsonValueNullIfNullPhotoId() { .build()); final Envelope response = queryView.findRecipePhoto(envelope); - assertThat(response.metadata().name(), is("example.get-recipe-photograph")); + assertThat(response.metadata().name(), is("cakeshop.get-recipe-photograph")); assertThat(response.payload(), is(nullValue())); } } diff --git a/example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/view/response/RecipeViewTest.java b/cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/response/RecipeViewTest.java similarity index 92% rename from example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/view/response/RecipeViewTest.java rename to cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/response/RecipeViewTest.java index 634c748c..4adb30b1 100644 --- a/example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/view/response/RecipeViewTest.java +++ b/cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/response/RecipeViewTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.view.response; +package uk.gov.justice.services.cakeshop.cakeshop.query.view.response; import java.util.UUID; diff --git a/example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/view/response/RecipesViewTest.java b/cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/response/RecipesViewTest.java similarity index 93% rename from example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/view/response/RecipesViewTest.java rename to cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/response/RecipesViewTest.java index a94c8419..902f7989 100644 --- a/example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/view/response/RecipesViewTest.java +++ b/cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/response/RecipesViewTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.view.response; +package uk.gov.justice.services.cakeshop.cakeshop.query.view.response; import java.util.Collections; import java.util.List; diff --git a/example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/view/service/CakeOrderServiceTest.java b/cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/service/CakeOrderServiceTest.java similarity index 82% rename from example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/view/service/CakeOrderServiceTest.java rename to cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/service/CakeOrderServiceTest.java index 6f30915f..a364cbcb 100644 --- a/example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/view/service/CakeOrderServiceTest.java +++ b/cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/service/CakeOrderServiceTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.view.service; +package uk.gov.justice.services.cakeshop.cakeshop.query.view.service; import static org.hamcrest.MatcherAssert.assertThat; @@ -7,9 +7,9 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; -import uk.gov.justice.services.example.cakeshop.persistence.CakeOrderRepository; -import uk.gov.justice.services.example.cakeshop.persistence.entity.CakeOrder; -import uk.gov.justice.services.example.cakeshop.query.view.response.CakeOrderView; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.CakeOrderRepository; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.CakeOrder; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.response.CakeOrderView; import java.time.ZonedDateTime; import java.util.UUID; diff --git a/example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/view/service/CakeServiceTest.java b/cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/service/CakeServiceTest.java similarity index 80% rename from example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/view/service/CakeServiceTest.java rename to cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/service/CakeServiceTest.java index a13935f4..8bd3f556 100644 --- a/example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/view/service/CakeServiceTest.java +++ b/cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/service/CakeServiceTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.view.service; +package uk.gov.justice.services.cakeshop.cakeshop.query.view.service; import static java.util.Arrays.asList; import static java.util.UUID.randomUUID; @@ -6,9 +6,9 @@ import static org.hamcrest.Matchers.is; import static org.mockito.Mockito.when; -import uk.gov.justice.services.example.cakeshop.persistence.CakeRepository; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Cake; -import uk.gov.justice.services.example.cakeshop.query.view.response.CakesView; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.CakeRepository; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Cake; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.response.CakesView; import java.util.UUID; diff --git a/example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/view/service/IndexServiceTest.java b/cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/service/IndexServiceTest.java similarity index 82% rename from example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/view/service/IndexServiceTest.java rename to cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/service/IndexServiceTest.java index 29172ba1..80b4b236 100644 --- a/example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/view/service/IndexServiceTest.java +++ b/cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/service/IndexServiceTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.view.service; +package uk.gov.justice.services.cakeshop.cakeshop.query.view.service; import static java.time.ZonedDateTime.now; import static java.util.UUID.randomUUID; @@ -8,9 +8,9 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; -import uk.gov.justice.services.example.cakeshop.persistence.IndexRepository; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Index; -import uk.gov.justice.services.example.cakeshop.query.view.response.IndexView; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.IndexRepository; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Index; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.response.IndexView; import java.time.ZonedDateTime; import java.util.UUID; diff --git a/example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/view/service/RecipeServiceTest.java b/cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/service/RecipeServiceTest.java similarity index 89% rename from example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/view/service/RecipeServiceTest.java rename to cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/service/RecipeServiceTest.java index f22d10bb..60527c22 100644 --- a/example-context/example-service/example-query/example-query-view/src/test/java/uk/gov/justice/services/example/cakeshop/query/view/service/RecipeServiceTest.java +++ b/cakeshop-query/cakeshop-query-view/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/query/view/service/RecipeServiceTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.query.view.service; +package uk.gov.justice.services.cakeshop.cakeshop.query.view.service; import static java.util.Collections.singletonList; import static org.hamcrest.CoreMatchers.equalTo; @@ -8,11 +8,11 @@ import static org.junit.Assert.assertNull; import static org.mockito.BDDMockito.given; -import uk.gov.justice.services.example.cakeshop.persistence.RecipeRepository; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Recipe; -import uk.gov.justice.services.example.cakeshop.query.view.response.PhotoView; -import uk.gov.justice.services.example.cakeshop.query.view.response.RecipeView; -import uk.gov.justice.services.example.cakeshop.query.view.response.RecipesView; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.RecipeRepository; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Recipe; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.response.PhotoView; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.response.RecipeView; +import uk.gov.justice.services.cakeshop.cakeshop.query.view.response.RecipesView; import java.util.List; import java.util.Optional; diff --git a/example-context/example-service/example-query/pom.xml b/cakeshop-query/pom.xml similarity index 64% rename from example-context/example-service/example-query/pom.xml rename to cakeshop-query/pom.xml index f52fbdc5..376e51ba 100644 --- a/example-context/example-service/example-query/pom.xml +++ b/cakeshop-query/pom.xml @@ -3,18 +3,18 @@ xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - example-service - uk.gov.justice.services.example + cake-shop-parent + uk.gov.justice.services.cakeshop 17.0.2-SNAPSHOT 4.0.0 - example-query + cakeshop-query pom - example-query-api - example-query-view + cakeshop-query-api + cakeshop-query-view diff --git a/example-context/example-service/example-single/pom.xml b/cakeshop-service/pom.xml similarity index 82% rename from example-context/example-service/example-single/pom.xml rename to cakeshop-service/pom.xml index c6a2760f..fed4dfd0 100644 --- a/example-context/example-service/example-single/pom.xml +++ b/cakeshop-service/pom.xml @@ -1,61 +1,61 @@ - example-service - uk.gov.justice.services.example + cake-shop-parent + uk.gov.justice.services.cakeshop 17.0.2-SNAPSHOT 4.0.0 - example-single + cakeshop-service war ${project.groupId} - example-command-api + cakeshop-command-api ${project.version} classes ${project.groupId} - example-command-handler + cakeshop-command-handler ${project.version} classes ${project.groupId} - example-event-listener + cakeshop-event-listener ${project.version} classes ${project.groupId} - example-event-indexer + cakeshop-event-indexer ${project.version} classes ${project.groupId} - example-event-processor + cakeshop-event-processor ${project.version} classes ${project.groupId} - example-query-api + cakeshop-query-api ${project.version} classes ${project.groupId} - example-query-view + cakeshop-query-view ${project.version} classes ${project.groupId} - example-custom-api + cakeshop-custom-api ${project.version} classes @@ -68,14 +68,14 @@ framework-management - uk.gov.justice.services.example - example-event-source + uk.gov.justice.services.cakeshop + cakeshop-event-source yaml ${project.version} ${project.groupId} - example-feature-control + cakeshop-feature-control ${project.version} @@ -102,8 +102,8 @@ ${framework.version} - uk.gov.justice.services.example - example-healthcheck + uk.gov.justice.services.cakeshop + cakeshop-healthcheck ${project.version} diff --git a/example-context/example-persistence/src/main/resources/META-INF/beans.xml b/cakeshop-service/src/main/resources/META-INF/beans.xml similarity index 100% rename from example-context/example-persistence/src/main/resources/META-INF/beans.xml rename to cakeshop-service/src/main/resources/META-INF/beans.xml diff --git a/cakeshop-service/src/main/webapp/WEB-INF/ejb-jar.xml b/cakeshop-service/src/main/webapp/WEB-INF/ejb-jar.xml new file mode 100644 index 00000000..f3a00f0d --- /dev/null +++ b/cakeshop-service/src/main/webapp/WEB-INF/ejb-jar.xml @@ -0,0 +1,9 @@ + + + + cakeshop-service + + diff --git a/cakeshop-service/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/cakeshop-service/src/main/webapp/WEB-INF/jboss-deployment-structure.xml new file mode 100644 index 00000000..bdbbd58b --- /dev/null +++ b/cakeshop-service/src/main/webapp/WEB-INF/jboss-deployment-structure.xml @@ -0,0 +1,6 @@ + + + + diff --git a/cakeshop-service/src/main/webapp/WEB-INF/jboss-web.xml b/cakeshop-service/src/main/webapp/WEB-INF/jboss-web.xml new file mode 100644 index 00000000..4c0c3994 --- /dev/null +++ b/cakeshop-service/src/main/webapp/WEB-INF/jboss-web.xml @@ -0,0 +1,7 @@ + + + /cakeshop-service + diff --git a/example-context/example-service/example-single/src/test/java/uk/gov/moj/cpp/example/service/FindSchemaDuplicatesTest.java b/cakeshop-service/src/test/java/uk/gov/moj/cpp/cakeshop/cakeshop/FindSchemaDuplicatesTest.java similarity index 87% rename from example-context/example-service/example-single/src/test/java/uk/gov/moj/cpp/example/service/FindSchemaDuplicatesTest.java rename to cakeshop-service/src/test/java/uk/gov/moj/cpp/cakeshop/cakeshop/FindSchemaDuplicatesTest.java index 251fd830..26d8e3b8 100644 --- a/example-context/example-service/example-single/src/test/java/uk/gov/moj/cpp/example/service/FindSchemaDuplicatesTest.java +++ b/cakeshop-service/src/test/java/uk/gov/moj/cpp/cakeshop/cakeshop/FindSchemaDuplicatesTest.java @@ -1,4 +1,4 @@ -package uk.gov.moj.cpp.example.service; +package uk.gov.moj.cpp.cakeshop.cakeshop; import uk.gov.justice.services.test.utils.core.schema.SchemaDuplicateTestHelper; diff --git a/example-context/example-service/example-liquibase/README.md b/cakeshop-viewstore/cakeshop-viewstore-liquibase/README.md similarity index 100% rename from example-context/example-service/example-liquibase/README.md rename to cakeshop-viewstore/cakeshop-viewstore-liquibase/README.md diff --git a/example-context/example-service/example-liquibase/pom.xml b/cakeshop-viewstore/cakeshop-viewstore-liquibase/pom.xml similarity index 72% rename from example-context/example-service/example-liquibase/pom.xml rename to cakeshop-viewstore/cakeshop-viewstore-liquibase/pom.xml index 695daf0a..e4f86c65 100644 --- a/example-context/example-service/example-liquibase/pom.xml +++ b/cakeshop-viewstore/cakeshop-viewstore-liquibase/pom.xml @@ -3,13 +3,13 @@ xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - uk.gov.justice.services.example - example-service + uk.gov.justice.services.cakeshop + cakeshop-viewstore 17.0.2-SNAPSHOT 4.0.0 - example-liquibase + cakeshop-viewstore-liquibase true diff --git a/example-context/example-service/example-liquibase/src/main/resources/liquibase.properties b/cakeshop-viewstore/cakeshop-viewstore-liquibase/src/main/resources/liquibase.properties similarity index 100% rename from example-context/example-service/example-liquibase/src/main/resources/liquibase.properties rename to cakeshop-viewstore/cakeshop-viewstore-liquibase/src/main/resources/liquibase.properties diff --git a/example-context/example-service/example-liquibase/src/main/resources/liquibase/view-store-db-changelog.xml b/cakeshop-viewstore/cakeshop-viewstore-liquibase/src/main/resources/liquibase/view-store-db-changelog.xml similarity index 100% rename from example-context/example-service/example-liquibase/src/main/resources/liquibase/view-store-db-changelog.xml rename to cakeshop-viewstore/cakeshop-viewstore-liquibase/src/main/resources/liquibase/view-store-db-changelog.xml diff --git a/example-context/example-service/example-liquibase/src/main/resources/liquibase/view-store-db-changesets/001-initial-schema.changelog.xml b/cakeshop-viewstore/cakeshop-viewstore-liquibase/src/main/resources/liquibase/view-store-db-changesets/001-initial-schema.changelog.xml similarity index 100% rename from example-context/example-service/example-liquibase/src/main/resources/liquibase/view-store-db-changesets/001-initial-schema.changelog.xml rename to cakeshop-viewstore/cakeshop-viewstore-liquibase/src/main/resources/liquibase/view-store-db-changesets/001-initial-schema.changelog.xml diff --git a/example-context/example-service/example-liquibase/src/main/resources/liquibase/view-store-db-changesets/002-ingredient-table.changelog.xml b/cakeshop-viewstore/cakeshop-viewstore-liquibase/src/main/resources/liquibase/view-store-db-changesets/002-ingredient-table.changelog.xml similarity index 100% rename from example-context/example-service/example-liquibase/src/main/resources/liquibase/view-store-db-changesets/002-ingredient-table.changelog.xml rename to cakeshop-viewstore/cakeshop-viewstore-liquibase/src/main/resources/liquibase/view-store-db-changesets/002-ingredient-table.changelog.xml diff --git a/example-context/example-service/example-liquibase/src/main/resources/liquibase/view-store-db-changesets/003-order-table.changelog.xml b/cakeshop-viewstore/cakeshop-viewstore-liquibase/src/main/resources/liquibase/view-store-db-changesets/003-order-table.changelog.xml similarity index 100% rename from example-context/example-service/example-liquibase/src/main/resources/liquibase/view-store-db-changesets/003-order-table.changelog.xml rename to cakeshop-viewstore/cakeshop-viewstore-liquibase/src/main/resources/liquibase/view-store-db-changesets/003-order-table.changelog.xml diff --git a/example-context/example-service/example-liquibase/src/main/resources/liquibase/view-store-db-changesets/004-cake-table.changelog.xml b/cakeshop-viewstore/cakeshop-viewstore-liquibase/src/main/resources/liquibase/view-store-db-changesets/004-cake-table.changelog.xml similarity index 100% rename from example-context/example-service/example-liquibase/src/main/resources/liquibase/view-store-db-changesets/004-cake-table.changelog.xml rename to cakeshop-viewstore/cakeshop-viewstore-liquibase/src/main/resources/liquibase/view-store-db-changesets/004-cake-table.changelog.xml diff --git a/example-context/example-service/example-liquibase/src/main/resources/liquibase/view-store-db-changesets/004-rename-recipe-table-column-name.xml b/cakeshop-viewstore/cakeshop-viewstore-liquibase/src/main/resources/liquibase/view-store-db-changesets/004-rename-recipe-table-column-name.xml similarity index 100% rename from example-context/example-service/example-liquibase/src/main/resources/liquibase/view-store-db-changesets/004-rename-recipe-table-column-name.xml rename to cakeshop-viewstore/cakeshop-viewstore-liquibase/src/main/resources/liquibase/view-store-db-changesets/004-rename-recipe-table-column-name.xml diff --git a/example-context/example-service/example-liquibase/src/main/resources/liquibase/view-store-db-changesets/006-add-recipe-photograph-id.xml b/cakeshop-viewstore/cakeshop-viewstore-liquibase/src/main/resources/liquibase/view-store-db-changesets/006-add-recipe-photograph-id.xml similarity index 100% rename from example-context/example-service/example-liquibase/src/main/resources/liquibase/view-store-db-changesets/006-add-recipe-photograph-id.xml rename to cakeshop-viewstore/cakeshop-viewstore-liquibase/src/main/resources/liquibase/view-store-db-changesets/006-add-recipe-photograph-id.xml diff --git a/example-context/example-service/example-liquibase/src/main/resources/liquibase/view-store-db-changesets/007-index-table.changelog.xml b/cakeshop-viewstore/cakeshop-viewstore-liquibase/src/main/resources/liquibase/view-store-db-changesets/007-index-table.changelog.xml similarity index 100% rename from example-context/example-service/example-liquibase/src/main/resources/liquibase/view-store-db-changesets/007-index-table.changelog.xml rename to cakeshop-viewstore/cakeshop-viewstore-liquibase/src/main/resources/liquibase/view-store-db-changesets/007-index-table.changelog.xml diff --git a/example-context/example-persistence/pom.xml b/cakeshop-viewstore/cakeshop-viewstore-persistence/pom.xml similarity index 85% rename from example-context/example-persistence/pom.xml rename to cakeshop-viewstore/cakeshop-viewstore-persistence/pom.xml index 209e2d84..17319862 100644 --- a/example-context/example-persistence/pom.xml +++ b/cakeshop-viewstore/cakeshop-viewstore-persistence/pom.xml @@ -3,13 +3,13 @@ xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - example-context - uk.gov.justice.services.example + cakeshop-viewstore + uk.gov.justice.services.cakeshop 17.0.2-SNAPSHOT 4.0.0 - example-persistence + cakeshop-viewstore-persistence @@ -133,4 +133,24 @@ + + + build + + true + + + + + maven-surefire-plugin + + + **/*IT.java + + + + + + + diff --git a/example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/CakeOrderRepository.java b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/CakeOrderRepository.java similarity index 61% rename from example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/CakeOrderRepository.java rename to cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/CakeOrderRepository.java index f72c702e..e549164f 100644 --- a/example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/CakeOrderRepository.java +++ b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/CakeOrderRepository.java @@ -1,6 +1,6 @@ -package uk.gov.justice.services.example.cakeshop.persistence; +package uk.gov.justice.services.cakeshop.cakeshop.persistence; -import uk.gov.justice.services.example.cakeshop.persistence.entity.CakeOrder; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.CakeOrder; import java.util.UUID; diff --git a/example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/CakeRepository.java b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/CakeRepository.java similarity index 61% rename from example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/CakeRepository.java rename to cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/CakeRepository.java index 4cf39a8e..08bb7f5a 100644 --- a/example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/CakeRepository.java +++ b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/CakeRepository.java @@ -1,7 +1,7 @@ -package uk.gov.justice.services.example.cakeshop.persistence; +package uk.gov.justice.services.cakeshop.cakeshop.persistence; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Cake; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Cake; import java.util.UUID; diff --git a/example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/IndexRepository.java b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/IndexRepository.java similarity index 61% rename from example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/IndexRepository.java rename to cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/IndexRepository.java index 12d31be8..6019a11a 100644 --- a/example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/IndexRepository.java +++ b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/IndexRepository.java @@ -1,6 +1,6 @@ -package uk.gov.justice.services.example.cakeshop.persistence; +package uk.gov.justice.services.cakeshop.cakeshop.persistence; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Index; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Index; import java.util.UUID; diff --git a/example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/IngredientRepository.java b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/IngredientRepository.java similarity index 83% rename from example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/IngredientRepository.java rename to cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/IngredientRepository.java index 6cae5011..f6c88c09 100644 --- a/example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/IngredientRepository.java +++ b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/IngredientRepository.java @@ -1,6 +1,6 @@ -package uk.gov.justice.services.example.cakeshop.persistence; +package uk.gov.justice.services.cakeshop.cakeshop.persistence; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Ingredient; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Ingredient; import java.util.List; import java.util.UUID; diff --git a/example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/RecipeRepository.java b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/RecipeRepository.java similarity index 86% rename from example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/RecipeRepository.java rename to cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/RecipeRepository.java index 8f933095..849a99dd 100644 --- a/example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/RecipeRepository.java +++ b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/RecipeRepository.java @@ -1,9 +1,9 @@ -package uk.gov.justice.services.example.cakeshop.persistence; +package uk.gov.justice.services.cakeshop.cakeshop.persistence; import static java.text.MessageFormat.format; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Recipe; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Recipe_; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Recipe; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Recipe_; import java.util.List; import java.util.Optional; diff --git a/example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/entity/Cake.java b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/entity/Cake.java similarity index 90% rename from example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/entity/Cake.java rename to cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/entity/Cake.java index c44a0d1c..f4b7fb25 100644 --- a/example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/entity/Cake.java +++ b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/entity/Cake.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.persistence.entity; +package uk.gov.justice.services.cakeshop.cakeshop.persistence.entity; import java.io.Serializable; import java.util.UUID; diff --git a/example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/entity/CakeOrder.java b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/entity/CakeOrder.java similarity index 95% rename from example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/entity/CakeOrder.java rename to cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/entity/CakeOrder.java index db84fc3c..c5963c36 100644 --- a/example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/entity/CakeOrder.java +++ b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/entity/CakeOrder.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.persistence.entity; +package uk.gov.justice.services.cakeshop.cakeshop.persistence.entity; import java.io.Serializable; import java.time.ZonedDateTime; diff --git a/example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/entity/Index.java b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/entity/Index.java similarity index 94% rename from example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/entity/Index.java rename to cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/entity/Index.java index 7657edac..294415f7 100644 --- a/example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/entity/Index.java +++ b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/entity/Index.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.persistence.entity; +package uk.gov.justice.services.cakeshop.cakeshop.persistence.entity; import java.io.Serializable; import java.time.ZonedDateTime; diff --git a/example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/entity/Ingredient.java b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/entity/Ingredient.java similarity index 94% rename from example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/entity/Ingredient.java rename to cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/entity/Ingredient.java index 45b56855..8163e1a9 100644 --- a/example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/entity/Ingredient.java +++ b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/entity/Ingredient.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.persistence.entity; +package uk.gov.justice.services.cakeshop.cakeshop.persistence.entity; import java.io.Serializable; import java.util.Objects; diff --git a/example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/entity/Recipe.java b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/entity/Recipe.java similarity index 96% rename from example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/entity/Recipe.java rename to cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/entity/Recipe.java index 4ae6dbdc..485ed2a3 100644 --- a/example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/entity/Recipe.java +++ b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/entity/Recipe.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.persistence.entity; +package uk.gov.justice.services.cakeshop.cakeshop.persistence.entity; import java.io.Serializable; import java.util.Objects; diff --git a/example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/entity/RecipeIngredient.java b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/entity/RecipeIngredient.java similarity index 96% rename from example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/entity/RecipeIngredient.java rename to cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/entity/RecipeIngredient.java index ac51fe22..be3c79fc 100644 --- a/example-context/example-persistence/src/main/java/uk/gov/justice/services/example/cakeshop/persistence/entity/RecipeIngredient.java +++ b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/entity/RecipeIngredient.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.persistence.entity; +package uk.gov.justice.services.cakeshop.cakeshop.persistence.entity; import java.util.UUID; diff --git a/example-context/example-service/example-single/src/main/resources/META-INF/beans.xml b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/resources/META-INF/beans.xml similarity index 100% rename from example-context/example-service/example-single/src/main/resources/META-INF/beans.xml rename to cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/resources/META-INF/beans.xml diff --git a/cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/resources/META-INF/persistence.xml b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/resources/META-INF/persistence.xml new file mode 100644 index 00000000..27ec018d --- /dev/null +++ b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,16 @@ + + + + + org.hibernate.jpa.HibernatePersistenceProvider + java:/DS.cakeshop + uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Recipe + uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.RecipeIngredient + uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.CakeOrder + uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Cake + + + diff --git a/example-context/example-persistence/src/test/java/uk/gov/justice/services/example/cakeshop/persistence/CakeOrderRepositoryIT.java b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/CakeOrderRepositoryIT.java similarity index 91% rename from example-context/example-persistence/src/test/java/uk/gov/justice/services/example/cakeshop/persistence/CakeOrderRepositoryIT.java rename to cakeshop-viewstore/cakeshop-viewstore-persistence/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/CakeOrderRepositoryIT.java index d123ce52..5f4becbd 100644 --- a/example-context/example-persistence/src/test/java/uk/gov/justice/services/example/cakeshop/persistence/CakeOrderRepositoryIT.java +++ b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/CakeOrderRepositoryIT.java @@ -1,11 +1,11 @@ -package uk.gov.justice.services.example.cakeshop.persistence; +package uk.gov.justice.services.cakeshop.cakeshop.persistence; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.MatcherAssert.assertThat; -import uk.gov.justice.services.example.cakeshop.persistence.entity.CakeOrder; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.CakeOrder; import uk.gov.justice.services.test.utils.persistence.BaseTransactionalJunit4Test; import java.time.ZoneId; diff --git a/example-context/example-persistence/src/test/java/uk/gov/justice/services/example/cakeshop/persistence/CakeRepositoryIT.java b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/CakeRepositoryIT.java similarity index 90% rename from example-context/example-persistence/src/test/java/uk/gov/justice/services/example/cakeshop/persistence/CakeRepositoryIT.java rename to cakeshop-viewstore/cakeshop-viewstore-persistence/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/CakeRepositoryIT.java index e8e3d888..cf6c1e4d 100644 --- a/example-context/example-persistence/src/test/java/uk/gov/justice/services/example/cakeshop/persistence/CakeRepositoryIT.java +++ b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/CakeRepositoryIT.java @@ -1,11 +1,11 @@ -package uk.gov.justice.services.example.cakeshop.persistence; +package uk.gov.justice.services.cakeshop.cakeshop.persistence; import static java.util.UUID.randomUUID; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.is; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Cake; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Cake; import uk.gov.justice.services.test.utils.persistence.BaseTransactionalJunit4Test; import java.util.List; diff --git a/example-context/example-persistence/src/test/java/uk/gov/justice/services/example/cakeshop/persistence/IndexRepositoryIT.java b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/IndexRepositoryIT.java similarity index 90% rename from example-context/example-persistence/src/test/java/uk/gov/justice/services/example/cakeshop/persistence/IndexRepositoryIT.java rename to cakeshop-viewstore/cakeshop-viewstore-persistence/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/IndexRepositoryIT.java index 3d95aff0..0ff35734 100644 --- a/example-context/example-persistence/src/test/java/uk/gov/justice/services/example/cakeshop/persistence/IndexRepositoryIT.java +++ b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/IndexRepositoryIT.java @@ -1,11 +1,11 @@ -package uk.gov.justice.services.example.cakeshop.persistence; +package uk.gov.justice.services.cakeshop.cakeshop.persistence; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.MatcherAssert.assertThat; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Index; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Index; import uk.gov.justice.services.test.utils.persistence.BaseTransactionalJunit4Test; import java.time.ZoneId; diff --git a/example-context/example-persistence/src/test/java/uk/gov/justice/services/example/cakeshop/persistence/IngredientRepositoryIT.java b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/IngredientRepositoryIT.java similarity index 96% rename from example-context/example-persistence/src/test/java/uk/gov/justice/services/example/cakeshop/persistence/IngredientRepositoryIT.java rename to cakeshop-viewstore/cakeshop-viewstore-persistence/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/IngredientRepositoryIT.java index 3b12586e..eb279d98 100644 --- a/example-context/example-persistence/src/test/java/uk/gov/justice/services/example/cakeshop/persistence/IngredientRepositoryIT.java +++ b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/IngredientRepositoryIT.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.persistence; +package uk.gov.justice.services.cakeshop.cakeshop.persistence; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; @@ -8,7 +8,7 @@ import static org.hamcrest.collection.IsCollectionWithSize.hasSize; import static org.hamcrest.core.IsCollectionContaining.hasItems; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Ingredient; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Ingredient; import uk.gov.justice.services.test.utils.persistence.BaseTransactionalJunit4Test; import java.util.List; diff --git a/example-context/example-persistence/src/test/java/uk/gov/justice/services/example/cakeshop/persistence/RecipeRepositoryIT.java b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/RecipeRepositoryIT.java similarity index 97% rename from example-context/example-persistence/src/test/java/uk/gov/justice/services/example/cakeshop/persistence/RecipeRepositoryIT.java rename to cakeshop-viewstore/cakeshop-viewstore-persistence/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/RecipeRepositoryIT.java index 2aec2741..7551ab3b 100644 --- a/example-context/example-persistence/src/test/java/uk/gov/justice/services/example/cakeshop/persistence/RecipeRepositoryIT.java +++ b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/RecipeRepositoryIT.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.persistence; +package uk.gov.justice.services.cakeshop.cakeshop.persistence; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; @@ -8,7 +8,7 @@ import static org.hamcrest.collection.IsCollectionWithSize.hasSize; import static org.hamcrest.core.IsCollectionContaining.hasItems; -import uk.gov.justice.services.example.cakeshop.persistence.entity.Recipe; +import uk.gov.justice.services.cakeshop.cakeshop.persistence.entity.Recipe; import uk.gov.justice.services.test.utils.persistence.BaseTransactionalJunit4Test; import java.util.List; diff --git a/example-context/example-persistence/src/test/java/uk/gov/justice/services/example/cakeshop/persistence/entity/IndexTest.java b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/entity/IndexTest.java similarity index 92% rename from example-context/example-persistence/src/test/java/uk/gov/justice/services/example/cakeshop/persistence/entity/IndexTest.java rename to cakeshop-viewstore/cakeshop-viewstore-persistence/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/entity/IndexTest.java index b1393a69..3a1103b7 100644 --- a/example-context/example-persistence/src/test/java/uk/gov/justice/services/example/cakeshop/persistence/entity/IndexTest.java +++ b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/entity/IndexTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.persistence.entity; +package uk.gov.justice.services.cakeshop.cakeshop.persistence.entity; import static java.time.ZonedDateTime.now; import static java.util.UUID.randomUUID; diff --git a/example-context/example-persistence/src/test/java/uk/gov/justice/services/example/cakeshop/persistence/entity/IngredientTest.java b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/entity/IngredientTest.java similarity index 92% rename from example-context/example-persistence/src/test/java/uk/gov/justice/services/example/cakeshop/persistence/entity/IngredientTest.java rename to cakeshop-viewstore/cakeshop-viewstore-persistence/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/entity/IngredientTest.java index 0fa1af61..68ab98a5 100644 --- a/example-context/example-persistence/src/test/java/uk/gov/justice/services/example/cakeshop/persistence/entity/IngredientTest.java +++ b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/entity/IngredientTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.persistence.entity; +package uk.gov.justice.services.cakeshop.cakeshop.persistence.entity; import java.util.UUID; diff --git a/example-context/example-persistence/src/test/java/uk/gov/justice/services/example/cakeshop/persistence/entity/RecipeTest.java b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/entity/RecipeTest.java similarity index 92% rename from example-context/example-persistence/src/test/java/uk/gov/justice/services/example/cakeshop/persistence/entity/RecipeTest.java rename to cakeshop-viewstore/cakeshop-viewstore-persistence/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/entity/RecipeTest.java index e68e6da1..11db12a5 100644 --- a/example-context/example-persistence/src/test/java/uk/gov/justice/services/example/cakeshop/persistence/entity/RecipeTest.java +++ b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/test/java/uk/gov/justice/services/cakeshop/cakeshop/persistence/entity/RecipeTest.java @@ -1,4 +1,4 @@ -package uk.gov.justice.services.example.cakeshop.persistence.entity; +package uk.gov.justice.services.cakeshop.cakeshop.persistence.entity; import java.util.UUID; diff --git a/cakeshop-viewstore/cakeshop-viewstore-persistence/src/test/resources/META-INF/apache-deltaspike_test-container.properties b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/test/resources/META-INF/apache-deltaspike_test-container.properties new file mode 100644 index 00000000..a4c4b346 --- /dev/null +++ b/cakeshop-viewstore/cakeshop-viewstore-persistence/src/test/resources/META-INF/apache-deltaspike_test-container.properties @@ -0,0 +1,10 @@ +DS.cakeshop = new://Resource?type=DataSource +DS.cakeshop.JdbcDriver = org.postgresql.Driver +DS.cakeshop.JdbcUrl = jdbc:postgresql://localhost:5432/frameworkviewstore +DS.cakeshop.JtaManaged = true +DS.cakeshop.UserName = framework +DS.cakeshop.Password = framework +Cakeshop.hibernate.dialect = org.hibernate.dialect.PostgreSQL9Dialect +Cakeshop.hibernate.hbm2ddl.auto = create-drop + +tomee.jpa.factory.lazy = true \ No newline at end of file diff --git a/cakeshop-viewstore/pom.xml b/cakeshop-viewstore/pom.xml new file mode 100644 index 00000000..92283c2b --- /dev/null +++ b/cakeshop-viewstore/pom.xml @@ -0,0 +1,18 @@ + + + + uk.gov.justice.services.cakeshop + cake-shop-parent + 17.0.2-SNAPSHOT + + 4.0.0 + + cakeshop-viewstore + pom + + + cakeshop-viewstore-liquibase + cakeshop-viewstore-persistence + + + diff --git a/example-context/example-persistence/src/main/resources/META-INF/persistence.xml b/example-context/example-persistence/src/main/resources/META-INF/persistence.xml deleted file mode 100644 index 44d6fd8e..00000000 --- a/example-context/example-persistence/src/main/resources/META-INF/persistence.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - org.hibernate.jpa.HibernatePersistenceProvider - java:/DS.example - uk.gov.justice.services.example.cakeshop.persistence.entity.Recipe - uk.gov.justice.services.example.cakeshop.persistence.entity.RecipeIngredient - uk.gov.justice.services.example.cakeshop.persistence.entity.CakeOrder - uk.gov.justice.services.example.cakeshop.persistence.entity.Cake - - - diff --git a/example-context/example-persistence/src/test/resources/META-INF/apache-deltaspike_test-container.properties b/example-context/example-persistence/src/test/resources/META-INF/apache-deltaspike_test-container.properties deleted file mode 100644 index 3ce5342f..00000000 --- a/example-context/example-persistence/src/test/resources/META-INF/apache-deltaspike_test-container.properties +++ /dev/null @@ -1,10 +0,0 @@ -DS.example = new://Resource?type=DataSource -DS.example.JdbcDriver = org.postgresql.Driver -DS.example.JdbcUrl = jdbc:postgresql://localhost:5432/frameworkviewstore -DS.example.JtaManaged = true -DS.example.UserName = framework -DS.example.Password = framework -Example.hibernate.dialect = org.hibernate.dialect.PostgreSQL9Dialect -Example.hibernate.hbm2ddl.auto = create-drop - -tomee.jpa.factory.lazy = true \ No newline at end of file diff --git a/example-context/example-service/example-command/example-command-api/src/raml/cakeshop-command-api.raml b/example-context/example-service/example-command/example-command-api/src/raml/cakeshop-command-api.raml deleted file mode 100644 index df14b4fb..00000000 --- a/example-context/example-service/example-command/example-command-api/src/raml/cakeshop-command-api.raml +++ /dev/null @@ -1,107 +0,0 @@ -#%RAML 0.8 -title: Cakeshop Command API -baseUri: http://localhost:8080/example-command-api/command/api/rest/cakeshop -version: v0.1 -mediaType: application/json -protocols: [ HTTP, HTTPS ] - -/recipes/{recipeId}: - description: | - Add a new recipe - post: - description: | - ... - (mapping): - requestType: application/vnd.example.add-recipe+json - name: example.add-recipe - (mapping): - requestType: application/vnd.example.add-recipe-v2+json - name: example.add-recipe-v2 - (mapping): - requestType: application/vnd.example.remove-recipe+json - name: example.remove-recipe - ... - - body: - application/vnd.example.add-recipe+json: - schema: !include json/schema/example.add-recipe.json - example: !include json/add-recipe.json - - application/vnd.example.add-recipe-v2+json: - schema: !include json/schema/example.add-recipe.json - example: !include json/add-recipe.json - - application/vnd.example.remove-recipe+json: !!null - - put: - description: | - ... - (mapping): - requestType: application/vnd.example.rename-recipe+json - name: example.rename-recipe - ... - - body: - application/vnd.example.rename-recipe+json: - schema: !include json/schema/example.rename-recipe.json - example: !include json/rename-recipe.json - - -/recipes/{recipeId}/cakes/{cakeId}: - description: | - Make a cake from id in json - post: - description: | - ... - (mapping): - requestType: application/vnd.example.make-cake+json - name: example.make-cake - ... - body: - application/vnd.example.make-cake+json: - schema: !include json/schema/example.make-cake.json - example: !include json/make-cake.json - responses: - 202: - body: - application/vnd.example.make-cake-status+json: - schema: !include json/schema/example.make-cake-status.json - example: !include json/make-cake-status.json - -/orders/{orderId}: - description: | - Order a cake - post: - description: | - ... - (mapping): - requestType: application/vnd.example.order-cake+json - name: example.order-cake - ... - body: - application/vnd.example.order-cake+json: - schema: !include json/schema/example.order-cake.json - example: !include json/order-cake.json - -/recipes/{recipeId}/photograph: - post: - description: | - Upload recipe photograph - ... - (mapping): - requestType: multipart/form-data - name: example.upload-photograph - ... - body: - multipart/form-data: - formParameters: - photoId: - description: Photo of recipe - type: file - responses: - 202: - description: Request accepted - 400: - description: Bad Request - 500: - description: Internal Server Error diff --git a/example-context/example-service/example-command/example-command-handler/src/raml/cakeshop-command-handler.messaging.raml b/example-context/example-service/example-command/example-command-handler/src/raml/cakeshop-command-handler.messaging.raml deleted file mode 100644 index 7a3cd60d..00000000 --- a/example-context/example-service/example-command/example-command-handler/src/raml/cakeshop-command-handler.messaging.raml +++ /dev/null @@ -1,30 +0,0 @@ -#%RAML 0.8 -title: API Using media type in the URL -baseUri: message://command/handler/message/cakeshop -version: v1 -/example.handler.command: - post: - body: - application/vnd.example.command.add-recipe+json: - schema: !include json/schema/example.command.add-recipe.json - example: !include json/command.add-recipe.json - - application/vnd.example.command.remove-recipe+json: - schema: !include json/schema/example.command.remove-recipe.json - example: !include json/command.remove-recipe.json - - application/vnd.example.command.make-cake+json: - schema: !include json/schema/example.command.make-cake.json - example: !include json/command.make-cake.json - - application/vnd.example.command.order-cake+json: - schema: !include json/schema/example.command.order-cake.json - example: !include json/command.order-cake.json - - application/vnd.example.command.rename-recipe+json: - schema: !include json/schema/example.command.rename-recipe.json - example: !include json/command.rename-recipe.json - - application/vnd.example.command.upload-photograph+json: - schema: !include json/schema/example.command.upload-photograph.json - example: !include json/command.upload-photograph.json \ No newline at end of file diff --git a/example-context/example-service/example-command/example-command-handler/src/raml/private-event.messaging.raml b/example-context/example-service/example-command/example-command-handler/src/raml/private-event.messaging.raml deleted file mode 100644 index e7366a28..00000000 --- a/example-context/example-service/example-command/example-command-handler/src/raml/private-event.messaging.raml +++ /dev/null @@ -1,28 +0,0 @@ -#%RAML 0.8 -title: API Using media type in the URL -baseUri: message://command/handler/message/cakeshop -version: v1 -/example.event: - post: - body: - application/vnd.example.events.recipe-added+json: - schema: !include json/schema/example.events.recipe-added.json - example: !include json/command.add-recipe.json - - application/vnd.example.events.recipe-removed+json: - schema: !include json/schema/example.events.recipe-removed.json - example: !include json/recipe-removed.json - - application/vnd.example.events.cake-made+json: - schema: !include json/schema/example.events.cake-made.json - example: !include json/command.make-cake.json - - application/vnd.example.events.cake-ordered+json: - - application/vnd.example.events.recipe-renamed+json: - schema: !include json/schema/example.events.recipe-renamed.json - example: !include json/recipe-renamed.json - - application/vnd.example.events.recipe-photograph-added+json: - schema: !include json/schema/example.events.recipe-photograph-added.json - example: !include json/recipe-photograph-added.json \ No newline at end of file diff --git a/example-context/example-service/example-event-source/src/yaml/event-sources.yaml b/example-context/example-service/example-event-source/src/yaml/event-sources.yaml deleted file mode 100644 index 8a666dcc..00000000 --- a/example-context/example-service/example-event-source/src/yaml/event-sources.yaml +++ /dev/null @@ -1,11 +0,0 @@ -event_sources: - - name: example - is_default: true - location: - jms_uri: jms:topic:example.event - rest_uri: http://localhost:8080/example/event-source-api/rest - data_source: java:/app/example-single/DS.eventstore - - - name: public.event.source - location: - jms_uri: jms:topic:public.event \ No newline at end of file diff --git a/example-context/example-service/example-event/example-event-indexer/src/yaml/subscriptions-descriptor.yaml b/example-context/example-service/example-event/example-event-indexer/src/yaml/subscriptions-descriptor.yaml deleted file mode 100644 index 0272b2e0..00000000 --- a/example-context/example-service/example-event/example-event-indexer/src/yaml/subscriptions-descriptor.yaml +++ /dev/null @@ -1,12 +0,0 @@ -subscriptions_descriptor: - spec_version: 1.0.0 - service: example - service_component: EVENT_INDEXER - subscriptions: - - name: event indexer subscription - events: - - name: example.events.cake-ordered - schema_uri: http://justice.gov.uk/example/event/listener/example.events.cake-ordered.json - event_source_name: example - - diff --git a/example-context/example-service/example-event/example-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/interceptor/TestInterceptorException.java b/example-context/example-service/example-event/example-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/interceptor/TestInterceptorException.java deleted file mode 100644 index dda731f5..00000000 --- a/example-context/example-service/example-event/example-event-listener/src/main/java/uk/gov/justice/services/example/cakeshop/event/listener/interceptor/TestInterceptorException.java +++ /dev/null @@ -1,5 +0,0 @@ -package uk.gov.justice.services.example.cakeshop.event.listener.interceptor; - - -public class TestInterceptorException extends RuntimeException { -} diff --git a/example-context/example-service/example-event/example-event-listener/src/yaml/subscriptions-descriptor.yaml b/example-context/example-service/example-event/example-event-listener/src/yaml/subscriptions-descriptor.yaml deleted file mode 100644 index ca430a34..00000000 --- a/example-context/example-service/example-event/example-event-listener/src/yaml/subscriptions-descriptor.yaml +++ /dev/null @@ -1,27 +0,0 @@ -subscriptions_descriptor: - spec_version: 1.0.0 - service: example - service_component: EVENT_LISTENER - subscriptions: - - name: event listener subscription - events: - - name: example.events.recipe-added - schema_uri: http://justice.gov.uk/example/event/example.events.recipe-added.json - - - name: example.events.recipe-removed - schema_uri: http://justice.gov.uk/example/event/example.events.recipe-removed.json - - - name: example.events.cake-made - schema_uri: http://justice.gov.uk/example/event/example.events.cake-made.json - - - name: example.events.cake-ordered - schema_uri: http://justice.gov.uk/example/event/listener/example.events.cake-ordered.json - - - name: example.events.recipe-renamed - schema_uri: http://justice.gov.uk/example/event/example.events.recipe-renamed.json - - - name: example.events.recipe-photograph-added - schema_uri: http://justice.gov.uk/example/event/example.events.recipe-photograph-added.json - event_source_name: example - - diff --git a/example-context/example-service/example-event/example-event-processor/src/yaml/public-subscriptions-descriptor.yaml b/example-context/example-service/example-event/example-event-processor/src/yaml/public-subscriptions-descriptor.yaml deleted file mode 100644 index b6af5c5d..00000000 --- a/example-context/example-service/example-event/example-event-processor/src/yaml/public-subscriptions-descriptor.yaml +++ /dev/null @@ -1,14 +0,0 @@ -subscriptions_descriptor: - spec_version: 1.0.0 - service: example - service_component: EVENT_PROCESSOR - subscriptions: - - name: public event processor subscription - events: - - name: example.events.recipe-added - schema_uri: http://justice.gov.uk/example/event/example.events.recipe-added.json - - - name: example.events.cake-made - schema_uri: http://justice.gov.uk/example/event/example.events.cake-made.json - - event_source_name: public.event.source \ No newline at end of file diff --git a/example-context/example-service/example-event/example-event-processor/src/yaml/subscriptions-descriptor.yaml b/example-context/example-service/example-event/example-event-processor/src/yaml/subscriptions-descriptor.yaml deleted file mode 100644 index 437685f9..00000000 --- a/example-context/example-service/example-event/example-event-processor/src/yaml/subscriptions-descriptor.yaml +++ /dev/null @@ -1,13 +0,0 @@ -subscriptions_descriptor: - spec_version: 1.0.0 - service: example - service_component: EVENT_PROCESSOR - subscriptions: - - name: event processor subscription - events: - - name: example.events.recipe-added - schema_uri: http://justice.gov.uk/example/event/example.events.recipe-added.json - - - name: example.events.cake-made - schema_uri: http://justice.gov.uk/example/event/example.events.cake-made.json - event_source_name: example diff --git a/example-context/example-service/example-event/other-event-listener/src/yaml/event-sources.yaml b/example-context/example-service/example-event/other-event-listener/src/yaml/event-sources.yaml deleted file mode 100644 index 87d3b956..00000000 --- a/example-context/example-service/example-event/other-event-listener/src/yaml/event-sources.yaml +++ /dev/null @@ -1,6 +0,0 @@ -event_sources: -- name: private.event.source - location: - jms_uri: jms:topic:other.event - rest_uri: http://localhost:8080/example/event-source-api/rest - data_source: java:/app/example-single/DS.eventstore \ No newline at end of file diff --git a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/params/CakeShopUris.java b/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/params/CakeShopUris.java deleted file mode 100644 index 89aacca3..00000000 --- a/example-context/example-service/example-it/src/test/java/uk/gov/justice/services/example/cakeshop/it/params/CakeShopUris.java +++ /dev/null @@ -1,20 +0,0 @@ -package uk.gov.justice.services.example.cakeshop.it.params; - -public class CakeShopUris { - - private static final String RANDOM_HTTP_PORT = System.getProperty("random.http.port"); - private static final String HOST = "http://localhost:" + RANDOM_HTTP_PORT ; - - - public static final String RECIPES_RESOURCE_URI = HOST + "/example-command-api/command/api/rest/cakeshop/recipes/"; - public static final String ORDERS_RESOURCE_URI = HOST + "/example-command-api/command/api/rest/cakeshop/orders/"; - public static final String RECIPES_RESOURCE_QUERY_URI = HOST + "/example-query-api/query/api/rest/cakeshop/recipes/"; - public static final String ORDERS_RESOURCE_QUERY_URI = HOST + "/example-query-api/query/api/rest/cakeshop/orders/"; - public static final String CAKES_RESOURCE_QUERY_URI = HOST + "/example-query-api/query/api/rest/cakeshop/cakes/"; - public static final String OVEN_RESOURCE_CUSTOM_URI = HOST + "/example-custom-api/custom/api/rest/cakeshop/ovens/"; - public static final String INDEXES_RESOURCE_QUERY_URI = HOST + "/example-query-api/query/api/rest/cakeshop/index/"; - public static final String HEALTHCHECK_URI = HOST + "/example-single/internal/healthchecks/all"; - - - public static final String CAKES_RESOURCE_URI_FORMAT = RECIPES_RESOURCE_URI + "%s/cakes/%s"; -} diff --git a/example-context/example-service/example-it/src/test/resources/croydon.jpg b/example-context/example-service/example-it/src/test/resources/croydon.jpg deleted file mode 100644 index d9f19fa2..00000000 Binary files a/example-context/example-service/example-it/src/test/resources/croydon.jpg and /dev/null differ diff --git a/example-context/example-service/example-single/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/example-context/example-service/example-single/src/main/webapp/WEB-INF/jboss-deployment-structure.xml deleted file mode 100644 index 0e08f0c4..00000000 --- a/example-context/example-service/example-single/src/main/webapp/WEB-INF/jboss-deployment-structure.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/example-context/example-service/pom.xml b/example-context/example-service/pom.xml deleted file mode 100644 index 4e50afb4..00000000 --- a/example-context/example-service/pom.xml +++ /dev/null @@ -1,514 +0,0 @@ - - - - example-context - uk.gov.justice.services.example - 17.0.2-SNAPSHOT - - 4.0.0 - - example-service - pom - - - UNKNOWN_SERVICE_COMPONENT - true - - - - example-command - example-event - example-query - example-custom - example-it - example-liquibase - example-single - example-event-source - example-feature-control - - - - - - src/main/resources - - - ${project.build.directory}/generated-resources - - - - - src/test/resources - - - ${project.build.directory}/generated-test-resources - - - - - - uk.gov.justice.maven - raml-maven-plugin - ${framework-libraries.version} - - - generate-rest-clients - - generate - - generate-sources - - - uk.gov.justice.services.clients.rest.generator.RestClientGenerator - - ${project.build.directory}/generated-sources - - uk.gov.justice.api - - ${cpp.service-component} - - - **/*.messaging.raml - - - - - generate-classpath-message-clients - - generate - - generate-sources - - - uk.gov.justice.services.clients.messaging.generator.MessagingClientGenerator - - ${project.build.directory}/generated-sources - - uk.gov.justice.api - - ${cpp.service-component} - - - **/*.messaging.raml - - - - - - - uk.gov.justice.framework-generators - rest-client-generator - ${framework.version} - - - uk.gov.justice.framework-generators - messaging-client-generator - ${framework.version} - - - javax - javaee-api - 7.0 - runtime - - - - - - uk.gov.justice.schema - catalog-generation-plugin - ${framework-libraries.version} - - - schema-catalog-generation - - uk.gov.justice.schema.catalog.generation.maven.MavenCatalogGeneratorFactory - uk.gov.justice.schema.catalog.generation.io.parser.ListOfUriParser - src/raml/json/schema - ${project.build.directory}/generated-resources - - **/*.json - - - - - ${project.artifactId} - json/schema/ - - - - generate-schema-catalog - - generate-sources - - - raml-schema-catalog-generation - - uk.gov.justice.schema.catalog.generation.maven.MavenCatalogGeneratorFactory - uk.gov.justice.schema.catalog.generation.io.parser.ListOfUriParser - src/raml/json/schema - ${project.build.directory}/raml-jar - - **/*.json - - - ${project.artifactId} - raml/json/schema/ - - - - generate-schema-catalog - - generate-sources - - - - - uk.gov.justice.schema - catalog-generation - ${framework-libraries.version} - - - uk.gov.justice.maven.generator - parser-common - ${framework-libraries.version} - - - - - - - - maven-war-plugin - - true - true - - - - - - - - - raml-jar - - - src/raml - - - - - - uk.gov.justice.maven - raml-maven-plugin - ${framework-libraries.version} - - - check-raml-syntax - validate - - check-syntax - - - ${basedir}/src/raml - - - **/*.messaging.raml - - - - - raml-lint-check - test - - raml-lint-check - - - ${basedir}/src/raml - - **/*.raml - - - **/*.messaging.raml - - - - - - - - - - uk.gov.justice.framework-generators - lint-check-rules - ${framework.version} - - - javax - javaee-api - 7.0 - runtime - - - - - org.apache.maven.plugins - maven-resources-plugin - - - copy-json-schema-resources - validate - - copy-resources - - - - ${basedir}/target/generated-resources/json/schema - - - - src/raml/json/schema - true - - - - - - activate-json-validation-mockito-extension - process-test-resources - - copy-resources - - - ${skip.mockito.json.validation} - - ${project.build.directory}/generated-test-resources/mockito-extensions - - - - - ${project.build.directory}/shared-archive-resources - - - org.mockito.plugins.MockMaker - - - - - - - - - maven-jar-plugin - - - raml - - jar - - package - - raml - ${project.basedir}/src - - raml/** - - - - - - - - - - - - catalog-generation - - - src/raml - - - - - - uk.gov.justice.schema - catalog-generation-plugin - ${framework-libraries.version} - - uk.gov.justice.maven.generator.io.files.parser.RamlFileParser - - - - - schema-catalog-generation - - generate-schema-catalog - - generate-sources - - - raml-schema-catalog-generation - - generate-schema-catalog - - generate-sources - - - - - uk.gov.justice.schema - catalog-generation - ${framework-libraries.version} - - - uk.gov.justice.maven.generator - generator-raml-parser - ${framework-libraries.version} - - - - - uk.gov.justice.framework-generators - rest-adapter-generator-plugin - ${framework.version} - - - generate-rest-adapters - - generate-rest-adapter - - generate-sources - - - uk.gov.justice.services.adapters.rest.generator.RestAdapterGenerator - - uk.gov.justice.maven.generator.io.files.parser.RamlFileParser - - ${basedir}/src/raml - ${project.build.directory}/generated-sources - - uk.gov.justice.api - - ${cpp.service-component} - - - - **/*.messaging.raml - - - - - - - javax - javaee-api - ${javaee-api.version} - - - uk.gov.justice.framework-generators - rest-adapter-generator - ${framework.version} - - - - - uk.gov.justice.framework-generators - messaging-adapter-generator-plugin - ${framework.version} - - - generate-raml-messaging-adapters - - generate-messaging-adapter - - generate-sources - - - uk.gov.justice.raml.jms.core.JmsEndpointGeneratorFactory - - uk.gov.justice.maven.generator.io.files.parser.RamlFileParser - - ${basedir}/src/raml - ${project.build.directory}/generated-sources - - uk.gov.justice.api - - ${cpp.service-component} - - - **/*public-event.messaging.raml - **/*private-event.messaging.raml - - - **/*.messaging.raml - - - - - - - javax - javaee-api - ${javaee-api.version} - - - uk.gov.justice.framework-generators - messaging-adapter-generator - ${framework.version} - - - - - uk.gov.justice.framework-generators - messaging-client-generator-plugin - ${framework.version} - - - generate-src-raml-message-clients - - generate-messaging-client - - generate-sources - - - uk.gov.justice.services.clients.messaging.generator.MessagingClientGenerator - - uk.gov.justice.maven.generator.io.files.parser.RamlFileParser - - ${basedir}/src/raml - ${project.build.directory}/generated-sources - - uk.gov.justice.api - - ${cpp.service-component} - - - - **/*public-event.messaging.raml - **/*private-event.messaging.raml - - - - - - - javax - javaee-api - ${javaee-api.version} - - - uk.gov.justice.framework-generators - messaging-client-generator - ${framework.version} - - - - - - - - diff --git a/example-context/pom.xml b/example-context/pom.xml deleted file mode 100644 index c3d257cf..00000000 --- a/example-context/pom.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - cake-shop - uk.gov.justice.example - 17.0.2-SNAPSHOT - - 4.0.0 - - example-context - uk.gov.justice.services.example - pom - - - example-domain - example-persistence - example-service - example-service/example-healthcheck - - diff --git a/pom.xml b/pom.xml index 804110d6..49c83d31 100644 --- a/pom.xml +++ b/pom.xml @@ -10,13 +10,13 @@ 17.1.0 - uk.gov.justice.example - cake-shop + uk.gov.justice.services.cakeshop + cake-shop-parent 17.0.2-SNAPSHOT pom Cakeshop Application - Example application for Microservice Framework + Cakeshop application for Microservice Framework ${cpp.scm.connection} @@ -25,7 +25,17 @@ - example-context + cakeshop-domain + cakeshop-command + cakeshop-event + cakeshop-query + cakeshop-viewstore + cakeshop-integration-test + cakeshop-service + cakeshop-event-source + cakeshop-custom + cakeshop-feature-control + cakeshop-healthcheck @@ -69,6 +79,22 @@ + + + src/main/resources + + + ${project.build.directory}/generated-resources + + + + + src/test/resources + + + ${project.build.directory}/generated-test-resources + + @@ -84,6 +110,134 @@ wildfly-maven-plugin ${wildfly.maven.plugin.version} + + uk.gov.justice.maven + raml-maven-plugin + ${framework-libraries.version} + + + generate-rest-clients + + generate + + generate-sources + + + uk.gov.justice.services.clients.rest.generator.RestClientGenerator + + ${project.build.directory}/generated-sources + + uk.gov.justice.api + + ${cpp.service-component} + + + **/*.messaging.raml + + + + + generate-classpath-message-clients + + generate + + generate-sources + + + uk.gov.justice.services.clients.messaging.generator.MessagingClientGenerator + + ${project.build.directory}/generated-sources + + uk.gov.justice.api + + ${cpp.service-component} + + + **/*.messaging.raml + + + + + + + uk.gov.justice.framework-generators + rest-client-generator + ${framework.version} + + + uk.gov.justice.framework-generators + messaging-client-generator + ${framework.version} + + + javax + javaee-api + 7.0 + runtime + + + + + uk.gov.justice.schema + catalog-generation-plugin + ${framework-libraries.version} + + + schema-catalog-generation + + uk.gov.justice.schema.catalog.generation.maven.MavenCatalogGeneratorFactory + uk.gov.justice.schema.catalog.generation.io.parser.ListOfUriParser + src/raml/json/schema + ${project.build.directory}/generated-resources + + **/*.json + + + + + ${project.artifactId} + json/schema/ + + + + generate-schema-catalog + + generate-sources + + + raml-schema-catalog-generation + + uk.gov.justice.schema.catalog.generation.maven.MavenCatalogGeneratorFactory + uk.gov.justice.schema.catalog.generation.io.parser.ListOfUriParser + src/raml/json/schema + ${project.build.directory}/raml-jar + + **/*.json + + + ${project.artifactId} + raml/json/schema/ + + + + generate-schema-catalog + + generate-sources + + + + + uk.gov.justice.schema + catalog-generation + ${framework-libraries.version} + + + uk.gov.justice.maven.generator + parser-common + ${framework-libraries.version} + + + @@ -110,7 +264,7 @@ uk.gov.justice.domain.annotation.Event - example + cakeshop @@ -123,11 +277,337 @@ + + maven-war-plugin + + true + true + + + + raml-jar + + + src/raml + + + + + + uk.gov.justice.maven + raml-maven-plugin + ${framework-libraries.version} + + + check-raml-syntax + validate + + check-syntax + + + ${basedir}/src/raml + + + **/*.messaging.raml + + + + + raml-lint-check + test + + raml-lint-check + + + ${basedir}/src/raml + + **/*.raml + + + **/*.messaging.raml + + + + + + + + + + uk.gov.justice.framework-generators + lint-check-rules + ${framework.version} + + + javax + javaee-api + 7.0 + runtime + + + + + org.apache.maven.plugins + maven-resources-plugin + + + copy-json-schema-resources + validate + + copy-resources + + + + ${basedir}/target/generated-resources/json/schema + + + + src/raml/json/schema + true + + + + + + activate-json-validation-mockito-extension + process-test-resources + + copy-resources + + + ${skip.mockito.json.validation} + + ${project.build.directory}/generated-test-resources/mockito-extensions + + + + + ${project.build.directory}/shared-archive-resources + + + org.mockito.plugins.MockMaker + + + + + + + + + maven-jar-plugin + + + raml + + jar + + package + + raml + ${project.basedir}/src + + raml/** + + + + + + + + + + catalog-generation + + + src/raml + + + + + + uk.gov.justice.schema + catalog-generation-plugin + ${framework-libraries.version} + + uk.gov.justice.maven.generator.io.files.parser.RamlFileParser + + + + + schema-catalog-generation + + generate-schema-catalog + + generate-sources + + + raml-schema-catalog-generation + + generate-schema-catalog + + generate-sources + + + + + uk.gov.justice.schema + catalog-generation + ${framework-libraries.version} + + + uk.gov.justice.maven.generator + generator-raml-parser + ${framework-libraries.version} + + + + + + uk.gov.justice.framework-generators + rest-adapter-generator-plugin + ${framework.version} + + + generate-rest-adapters + + generate-rest-adapter + + generate-sources + + + uk.gov.justice.services.adapters.rest.generator.RestAdapterGenerator + + uk.gov.justice.maven.generator.io.files.parser.RamlFileParser + + ${basedir}/src/raml + ${project.build.directory}/generated-sources + + uk.gov.justice.api + + ${cpp.service-component} + + + + **/*.messaging.raml + + + + + + + javax + javaee-api + ${javaee-api.version} + + + uk.gov.justice.framework-generators + rest-adapter-generator + ${framework.version} + + + + + + uk.gov.justice.framework-generators + messaging-adapter-generator-plugin + ${framework.version} + + + generate-raml-messaging-adapters + + generate-messaging-adapter + + generate-sources + + + uk.gov.justice.raml.jms.core.JmsEndpointGeneratorFactory + + uk.gov.justice.maven.generator.io.files.parser.RamlFileParser + + ${basedir}/src/raml + ${project.build.directory}/generated-sources + + uk.gov.justice.api + + ${cpp.service-component} + + + **/*public-event.messaging.raml + **/*private-event.messaging.raml + + + **/*.messaging.raml + + + + + + + javax + javaee-api + ${javaee-api.version} + + + uk.gov.justice.framework-generators + messaging-adapter-generator + ${framework.version} + + + + + + uk.gov.justice.framework-generators + messaging-client-generator-plugin + ${framework.version} + + + generate-src-raml-message-clients + + generate-messaging-client + + generate-sources + + + uk.gov.justice.services.clients.messaging.generator.MessagingClientGenerator + + uk.gov.justice.maven.generator.io.files.parser.RamlFileParser + + ${basedir}/src/raml + ${project.build.directory}/generated-sources + + uk.gov.justice.api + + ${cpp.service-component} + + + + **/*public-event.messaging.raml + **/*private-event.messaging.raml + + + + + + + javax + javaee-api + ${javaee-api.version} + + + uk.gov.justice.framework-generators + messaging-client-generator + ${framework.version} + + + + + + integration-tests @@ -146,8 +626,10 @@ ${random-jms-port} ${random-http-port} - ${random-management-port} - + ${random-management-port} + + jmsuser + jms@user123 diff --git a/runIntegrationTests.sh b/runIntegrationTests.sh new file mode 100755 index 00000000..7bcd9d64 --- /dev/null +++ b/runIntegrationTests.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +#The prerequisite for this script is that vagrant is running +#Script that runs, liquibase, deploys wars and runs integration tests + +#context name is used to derive database name for running liquibase scripts and cake-shop uses framework database instead of it's own database +CONTEXT_NAME=framework + +FRAMEWORK_LIBRARIES_VERSION=17.3.2 +FRAMEWORK_VERSION=17.4.1 +EVENT_STORE_VERSION=17.4.1 + +DOCKER_CONTAINER_REGISTRY_HOST_NAME=crmdvrepo01 + +LIQUIBASE_COMMAND=update +#LIQUIBASE_COMMAND=dropAll + +#fail script on error +set -e + +[ -z "$CPP_DOCKER_DIR" ] && echo "Please export CPP_DOCKER_DIR environment variable pointing to cpp-developers-docker repo (https://github.com/hmcts/cpp-developers-docker) checked out locally" && exit 1 +WILDFLY_DEPLOYMENT_DIR="$CPP_DOCKER_DIR/containers/wildfly/deployments" + +source $CPP_DOCKER_DIR/docker-utility-functions.sh +source $CPP_DOCKER_DIR/build-scripts/integration-test-scipt-functions.sh + +source ${CPP_DOCKER_DIR}/build-scripts/download-jars-for-liquibase-runner-functions.sh +source ${CPP_DOCKER_DIR}/build-scripts/download-liquibase-jar-functions.sh + +runLiquibase() { + runEventLogLiquibase + runEventLogAggregateSnapshotLiquibase + runEventBufferLiquibase + runViewStoreLiquibaseForCakeShopContext + runSystemLiquibase + runEventTrackingLiquibase + runFileServiceLiquibase + printf "${CYAN}All liquibase $LIQUIBASE_COMMAND scripts run${NO_COLOUR}\n\n" +} + +buildAndDeploy() { + #Unlike other contexts, this script doesn't provide capability to run integration tests, main intention of this script is to just deploy cakeshop to local dev environment so that ITs can be executed froM Intellij/IDE for debugging purpose. + #mvn clean install runs ITs with a different approach by using embedded wildfly (this approach is required for travis pipeline) + loginToDockerContainerRegistry + buildWarsForCakeShopContext #This is not going to run tests, i.e. builds using -DskipTests + undeployWarsFromDocker + buildAndStartContainers + runLiquibase + deployWiremock + deployWarsForCakeShopContext + contextHealthchecksForCakeShop +} + +buildAndDeploy