From e1536391e2d90116f31f3ee548207b35d6f09492 Mon Sep 17 00:00:00 2001 From: Anthony Gonzalez Date: Fri, 22 Nov 2024 11:43:40 -0800 Subject: [PATCH] Synapse 0.4.0 Release - API module changes and dependency version increments (#315) * Dependency version updates and cleanup Major version bump to Java 21, Spring 6, Spring Boot 3. Added Spring BOMs to control dependency versions. Initial cleanup of individual POMs to correct and minimize dependencies. * Bump CircleCI Image to OpenJDK 21 * unit test fixes * minor fixes and unit test fixes * fix(): fix query param on java 3.2.x * pom fixes * pom fixes * exclude service/service-samples/sample-service-rest-native-book * Fixes on POM dependencies. * Fixes on POM dependencies. * Removing the service native sample book module. * Removing the service native sample book module. * feat(test): adding junit * add missing plugins to pluginManagement comment out use of api-docs * fix(): adding jakarta websocket dep to service-graphql * add missing version * feat(base): adding the update controller * feat(base):updating the controller with the entitycreator * Added HTTP 409 CONFLICT to ErrorCode (#314) * feat(copyright): adding copyright and removing api * feat(api): adding update controller * feat: add spring-aspects to dependency to enable spring-retry (#310) * Remove binding annotations from base controllers * Deprecate old service w/ controller modules * Addressed PR comments. * Addressed PR comments. --------- Co-authored-by: guttff Co-authored-by: johnmartinez Co-authored-by: Wendy Hu Co-authored-by: Shahzada Azam Shahani <36014183+shahzadaazam@users.noreply.github.com> Co-authored-by: Tanvir Islam --- .circleci/config.yml | 12 +- README.md | 2 +- api/pom.xml | 2 +- api/synapse-api-rest-imperative/pom.xml | 11 +- .../config/BaseApiImperativeRestConfig.java | 3 +- .../BaseCreateImperativeRestController.java | 10 +- .../BaseDeleteImperativeRestController.java | 14 +- .../BaseGetMonoImperativeRestController.java | 16 +- .../BaseReadImperativeRestController.java | 15 - .../BaseReadMonoImperativeRestController.java | 12 +- .../BaseReadPolyImperativeRestController.java | 25 +- .../BaseUpdateImperativeRestController.java | 40 + .../ControllerExceptionHandler.java | 26 +- .../helpers/PolyResponseEntityCreator.java | 31 +- .../helpers}/ServiceHeadersFactory.java | 6 +- .../rest/imperative}/model/ErrorResponse.java | 5 +- api/synapse-api-rest-reactive/pom.xml | 20 +- .../config/BaseApiReactiveRestConfig.java | 3 +- .../reactive/controller/BaseController.java | 31 +- .../BaseCreateReactiveRestController.java | 38 +- .../BaseDeleteReactiveRestController.java | 30 +- .../BaseGetFluxReactiveRestController.java | 46 +- .../BaseGetMonoReactiveRestController.java | 56 +- .../BaseReadFluxReactiveRestController.java | 46 +- .../BaseReadMonoReactiveRestController.java | 46 +- .../ControllerExceptionHandler.java | 9 +- .../InputValidationErrorHandler.java | 4 +- .../rest/reactive/model/ErrorResponse.java | 103 +++ archetype/pom.xml | 2 +- .../synapse-archetype-client-graphql/pom.xml | 2 +- .../pom.xml | 2 +- .../synapse-archetype-client-rest-get/pom.xml | 2 +- .../pom.xml | 2 +- .../synapse-archetype-client-rest-put/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../synapse-archetype-client-rest/pom.xml | 2 +- .../synapse-archetype-data-postgres/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- client/client-samples/pom.xml | 2 +- .../sample-client-graphql-book/pom.xml | 2 +- .../sample-client-reactive-football/pom.xml | 2 +- .../sample-client-reactive-weather/pom.xml | 2 +- .../sample-client-weather/pom.xml | 2 +- .../client/weather/client/WeatherClient.java | 5 +- .../weather/client/WeatherClientIT.java | 14 +- client/pom.xml | 2 +- client/synapse-client-graphql/pom.xml | 2 +- client/synapse-client-rest/pom.xml | 2 +- .../synapse/client/rest/UnitTestSuite.java | 5 +- client/synapse-client-soap/pom.xml | 2 +- client/synapse-client-test/pom.xml | 23 +- .../test/client/BaseRestClientUnitTest.java | 2 +- data/data-samples/pom.xml | 2 +- .../sample-data-cassandra-book/pom.xml | 2 +- .../sample-data-cassandra-reactive/pom.xml | 2 +- .../data-samples/sample-data-db2-book/pom.xml | 2 +- .../sample-data-mongodb-book/pom.xml | 10 +- .../sample-data-mongodb-reactive/pom.xml | 10 +- .../sample-data-mssql-reactive-book/pom.xml | 2 +- .../sample-data-mysql-book/pom.xml | 2 +- .../book/config/MySqlDataConfigTest.java | 3 +- .../sample-data-mysql-reactive-book/pom.xml | 2 +- .../sample-data-oracle-book/pom.xml | 2 +- .../book/config/OracleDataConfigTest.java | 2 +- .../sample-data-oracle-reactive-book/pom.xml | 2 +- .../pom.xml | 2 +- .../sample-data-postgres-book/pom.xml | 3 +- .../sample-data-redis-book/pom.xml | 2 +- data/pom.xml | 2 +- data/synapse-data-cassandra/pom.xml | 2 +- data/synapse-data-couchbase/pom.xml | 9 +- data/synapse-data-db2/pom.xml | 4 +- data/synapse-data-mongodb/pom.xml | 2 +- data/synapse-data-mssql/pom.xml | 2 +- data/synapse-data-mysql/pom.xml | 6 +- data/synapse-data-oracle/pom.xml | 2 +- data/synapse-data-postgres/pom.xml | 4 +- .../config/BasePostgresDataConfig.java | 2 +- data/synapse-data-redis/pom.xml | 2 +- docs/docs/real_docs/synapse.md | 2 +- framework/pom.xml | 2 +- framework/synapse-framework-api-docs/pom.xml | 26 +- .../framework/api/docs/ApiDocsConfig.java | 3 +- framework/synapse-framework-exception/pom.xml | 34 +- .../framework/exception/model/ErrorCode.java | 9 +- .../framework/exception/model/HttpStatus.java | 234 +++++ .../main/resources/error-messages.properties | 1 + .../FrameworkExceptionUnitTestSuite.java | 5 +- framework/synapse-framework-logging/pom.xml | 57 +- .../src/main/resources/log4j2-test.xml | 15 +- .../src/main/resources/log4j2.xml | 15 +- framework/synapse-framework-test/pom.xml | 31 +- function/function-samples/pom.xml | 2 +- .../sample-function-book-aws/pom.xml | 2 +- .../sample-function-greeter-aws/pom.xml | 2 +- .../sample-function-greeter-gcp/pom.xml | 5 +- .../sample-function-greeting/pom.xml | 2 +- .../handler/GetMonoGreetingHandler.java | 2 +- .../router/CreateMonoGreetingRouter.java | 29 +- .../router/DeleteMonoGreetingRouter.java | 4 +- .../router/GetMonoGreetingRouter.java | 4 +- .../router/ReadMonoGreetingRouter.java | 4 +- .../router/UpdateMonoGreetingRouter.java | 4 +- .../greeting/rest/GreetingRouterTest.java | 7 +- .../sample-function-rest-book/pom.xml | 8 +- .../book/rest/router/BookCrudMonoRouter.java | 10 +- function/pom.xml | 2 +- function/synapse-function/pom.xml | 77 +- .../reactive/config/FunctionConfig.java | 3 +- .../reactive/model/ServiceRouting.java | 5 +- .../function/reactive/model/ServiceTrace.java | 5 +- .../reactive/router/BaseCreateMonoRouter.java | 25 +- .../reactive/router/BaseCrudMonoRouter.java | 28 +- .../reactive/router/BaseDeleteMonoRouter.java | 29 +- .../reactive/router/BaseGetMonoRouter.java | 27 +- .../reactive/router/BaseReadMonoRouter.java | 28 +- .../reactive/router/BaseReadPolyRouter.java | 30 +- .../function/reactive/router/BaseRouter.java | 5 +- .../reactive/router/BaseUpdateMonoRouter.java | 26 +- .../rest/ServiceRestUnitTestSuite.java | 23 - .../interceptor/BaseHttpInterceptorTest.java | 61 -- pom.xml | 865 ++++++++---------- publisher/pom.xml | 2 +- publisher/synapse-publisher-kafka/pom.xml | 2 +- .../kafka/config/BaseKafkaProperties.java | 3 +- service/pom.xml | 2 +- service/service-samples/pom.xml | 3 +- .../sample-service-db2-book/pom.xml | 2 +- .../sample-service-graphql-book/pom.xml | 2 +- .../sample-service-imperative-book/pom.xml | 2 +- .../config/BookServiceConfig.java | 9 - .../model/CreateBookServiceRequest.java | 2 +- .../model/CreateBookServiceResponse.java | 2 +- .../model/DeleteBookServiceRequest.java | 2 +- .../model/DeleteBookServiceResponse.java | 16 +- .../model/ReadBookServiceRequest.java | 2 +- .../model/ReadBookServiceResponse.java | 2 +- .../model/UpdateBookServiceRequest.java | 5 + .../model/UpdateBookServiceResponse.java | 2 +- .../service/CreateBookService.java | 6 +- .../service/DeleteBookService.java | 12 +- .../service/ReadBookService.java | 6 +- .../service/UpdateBookService.java | 6 +- .../pom.xml | 6 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../sample-service-reactive-rest-book/pom.xml | 2 +- .../pom.xml | 4 +- .../pom.xml | 2 +- .../book/rest/config/BookTestConfig.java | 59 +- .../controller/CreateBookControllerTest.java | 119 ++- .../controller/ReadMonoControllerTest.java | 128 +-- .../controller/UpdateBookControllerTest.java | 112 +-- .../sample-service-rest-mysql-book/pom.xml | 6 +- .../sample-service-rest-native-book/pom.xml | 25 +- .../sample-service-rest-oracle-book/pom.xml | 2 +- .../sample-service-rest-postgres-book/pom.xml | 2 +- service/synapse-service-graphql/pom.xml | 13 +- .../synapse/service/graphql/package-info.java | 5 + service/synapse-service-imperative/pom.xml | 77 +- .../config/BaseImperativeServiceConfig.java | 59 +- .../imperative/model/PageResponse.java | 2 +- .../imperative/model/ServiceRouting.java | 5 +- .../imperative/model/ServiceTrace.java | 5 +- .../service/BaseCreateImperativeService.java | 51 -- .../service/BaseDeleteImperativeService.java | 38 - .../service/BaseGetMonoImperativeService.java | 46 - .../service/BaseGetPolyImperativeService.java | 18 - .../BaseReadMonoImperativeService.java | 52 -- .../BaseReadPolyImperativeService.java | 49 - .../imperative/service/BaseService.java | 27 +- .../service/BaseUpdateImperativeService.java | 51 -- service/synapse-service-reactive-rest/pom.xml | 6 +- .../BaseCreateReactiveController.java | 12 +- .../BaseGetFluxReactiveController.java | 18 +- .../BaseGetMonoReactiveController.java | 18 +- .../BaseReadFluxReactiveController.java | 18 +- .../BaseReadMonoReactiveController.java | 18 +- .../ControllerExceptionHandler.java | 4 +- .../service/reactive/rest/package-info.java | 5 + service/synapse-service-reactive/pom.xml | 36 +- .../config/BaseReactiveServiceRestConfig.java | 51 +- .../service/BaseCreateReactiveService.java | 52 -- .../service/BaseDeleteReactiveService.java | 45 - .../service/BaseGetFluxReactiveService.java | 49 - .../service/BaseGetMonoReactiveService.java | 52 -- .../service/BaseReadFluxReactiveService.java | 52 -- .../service/BaseReadMonoReactiveService.java | 52 -- .../service/reactive/service/BaseService.java | 21 +- .../service/BaseUpdateReactiveService.java | 52 -- service/synapse-service-rest/pom.xml | 15 +- .../rest/config/ServiceRestConfig.java | 5 +- .../ControllerExceptionHandler.java | 6 +- .../service/rest/model/ServiceRouting.java | 4 +- .../service/rest/model/ServiceTrace.java | 4 +- .../synapse/service/rest/package-info.java | 5 + .../rest/ServiceRestUnitTestSuite.java | 5 +- .../MonoResponseEntityCreatorTest.java | 2 +- service/synapse-service-test/pom.xml | 14 +- .../test/controller/BaseControllerIT.java | 1 + .../test/controller/BaseControllerTest.java | 8 +- .../controller/BaseControllerUnitTest.java | 1 + .../BaseCreateMonoControllerUnitTest.java | 1 + .../BaseDeleteControllerUnitTest.java | 7 +- .../BaseGetMonoControllerUnitTest.java | 1 + .../BaseReadMonoControllerUnitTest.java | 1 + .../BaseReadPolyControllerUnitTest.java | 6 +- .../BaseUpdateControllerUnitTest.java | 1 + .../service/test/controller/package-info.java | 5 + subscriber/pom.xml | 2 +- subscriber/synapse-subscriber-kafka/pom.xml | 2 +- .../BaseKafkaPropertiesConfiguration.java | 3 +- utility/pom.xml | 2 +- utility/synapse-utilities-common/pom.xml | 2 +- .../utilities/common/UnitTestSuite.java | 5 +- .../common/encoding/CryptoUtilTest.java | 2 +- .../common/io/ClasspathObjectFactoryTest.java | 5 +- .../TitleCaseStringSerializerTest.java | 2 +- utility/synapse-utility-cryptography/pom.xml | 2 +- .../utility/cryptography/CryptoUtilTest.java | 2 +- utility/synapse-utility-date/pom.xml | 2 +- utility/synapse-utility-number/pom.xml | 2 +- utility/synapse-utility-telephone/pom.xml | 2 +- 236 files changed, 1907 insertions(+), 2460 deletions(-) delete mode 100644 api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/BaseReadImperativeRestController.java create mode 100644 api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/BaseUpdateImperativeRestController.java rename {service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/model => api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/helpers}/ServiceHeadersFactory.java (80%) rename {service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive => api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative}/model/ErrorResponse.java (94%) create mode 100644 api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/model/ErrorResponse.java create mode 100644 framework/synapse-framework-exception/src/main/java/io/americanexpress/synapse/framework/exception/model/HttpStatus.java delete mode 100644 function/synapse-function/src/test/java/io/americanexpress/synapse/service/rest/ServiceRestUnitTestSuite.java delete mode 100644 function/synapse-function/src/test/java/io/americanexpress/synapse/service/rest/interceptor/BaseHttpInterceptorTest.java rename function/synapse-function/src/test/java/io/americanexpress/synapse/function/rest/SynapseSampleApplication.java => service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/DeleteBookServiceResponse.java (61%) create mode 100644 service/synapse-service-graphql/src/main/java/io/americanexpress/synapse/service/graphql/package-info.java delete mode 100644 service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseCreateImperativeService.java delete mode 100644 service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseDeleteImperativeService.java delete mode 100644 service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseGetMonoImperativeService.java delete mode 100644 service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseGetPolyImperativeService.java delete mode 100644 service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseReadMonoImperativeService.java delete mode 100644 service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseReadPolyImperativeService.java delete mode 100644 service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseUpdateImperativeService.java create mode 100644 service/synapse-service-reactive-rest/src/main/java/io/americanexpress/synapse/service/reactive/rest/package-info.java delete mode 100644 service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseCreateReactiveService.java delete mode 100644 service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseDeleteReactiveService.java delete mode 100644 service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseGetFluxReactiveService.java delete mode 100644 service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseGetMonoReactiveService.java delete mode 100644 service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseReadFluxReactiveService.java delete mode 100644 service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseReadMonoReactiveService.java delete mode 100644 service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseUpdateReactiveService.java create mode 100644 service/synapse-service-rest/src/main/java/io/americanexpress/synapse/service/rest/package-info.java create mode 100644 service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/package-info.java diff --git a/.circleci/config.yml b/.circleci/config.yml index d2654a29f..de5d0666e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -8,7 +8,7 @@ jobs: # Build and Test build-test-job: docker: - - image: circleci/openjdk:17-jdk-buster + - image: cimg/openjdk:21.0 steps: - checkout - restore_cache: @@ -26,7 +26,7 @@ jobs: # Test test-job: docker: - - image: circleci/openjdk:17-jdk-buster + - image: cimg/openjdk:21.0 steps: - checkout - run: mvn test @@ -37,7 +37,7 @@ jobs: # SNAPSHOT Deploy to Maven Central snapshot-maven-central-deploy-job: docker: - - image: circleci/openjdk:17-jdk-buster + - image: cimg/openjdk:21.0 steps: - checkout - run: mvn --settings ".circleci/settings.xml" -DskipTests clean deploy @@ -46,7 +46,7 @@ jobs: # SNAPSHOT to RELEASE Deploy to Maven Central snapshot-release-maven-central-deploy-job: docker: - - image: circleci/openjdk:17-jdk-buster + - image: cimg/openjdk:21.0 steps: - checkout - run: @@ -57,12 +57,12 @@ jobs: - add_ssh_keys: fingerprints: - "0a:8a:6d:3a:22:28:74:a8:9e:a6:72:5d:bc:2b:aa:fe" - - run: mvn --settings ".circleci/settings.xml" -B release:clean release:prepare release:perform -P release -DscmCommentPrefix="[skip,ci]" # uses maven-release-plugin and nexus-staging-maven-plugin + - run: mvn --settings ".circleci/settings.xml" -B release:clean release:prepare release:perform -P release -DscmCommentPrefix="[skip,ci]" # uses maven-release-plugin and nexus-staging-maven-plugin # RELEASE Deploy to Maven Central release-maven-central-deploy-job: docker: - - image: circleci/openjdk:17-jdk-buster + - image: cimg/openjdk:21.0 steps: - checkout - run: mvn --settings ".circleci/settings.xml" -DskipTests clean deploy -P release -e -X # uses maven-deploy-plugin diff --git a/README.md b/README.md index 9b0c8906e..8b1c70b4f 100644 --- a/README.md +++ b/README.md @@ -318,7 +318,7 @@ The following listing shows the pom.xml file that is created when you choose Mav com.sample.bookstore service - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/api/pom.xml b/api/pom.xml index 1dcc41e01..2cfff006f 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/api/synapse-api-rest-imperative/pom.xml b/api/synapse-api-rest-imperative/pom.xml index e82bb8e5f..6e07605b8 100644 --- a/api/synapse-api-rest-imperative/pom.xml +++ b/api/synapse-api-rest-imperative/pom.xml @@ -19,7 +19,7 @@ io.americanexpress.synapse api - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 @@ -36,10 +36,6 @@ io.americanexpress.synapse synapse-framework-exception - - io.americanexpress.synapse - synapse-framework-api-docs - io.americanexpress.synapse synapse-service-imperative @@ -135,9 +131,8 @@ - io.swagger - swagger-annotations - 1.6.6 + io.swagger.core.v3 + swagger-annotations-jakarta diff --git a/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/config/BaseApiImperativeRestConfig.java b/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/config/BaseApiImperativeRestConfig.java index 185e2c2d8..9b0b9b76e 100644 --- a/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/config/BaseApiImperativeRestConfig.java +++ b/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/config/BaseApiImperativeRestConfig.java @@ -15,7 +15,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import io.americanexpress.synapse.api.rest.imperative.interceptor.MetricInterceptor; -import io.americanexpress.synapse.framework.api.docs.ApiDocsConfig; import io.americanexpress.synapse.framework.exception.config.ExceptionConfig; import io.americanexpress.synapse.utilities.common.config.UtilitiesCommonConfig; import org.springframework.context.annotation.ComponentScan; @@ -31,7 +30,7 @@ */ @ComponentScan(basePackages = "io.americanexpress.synapse.api.rest.imperative") @Configuration -@Import({ApiDocsConfig.class, ExceptionConfig.class, UtilitiesCommonConfig.class}) +@Import({ExceptionConfig.class, UtilitiesCommonConfig.class}) public class BaseApiImperativeRestConfig implements WebMvcConfigurer { /** diff --git a/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/BaseCreateImperativeRestController.java b/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/BaseCreateImperativeRestController.java index b966c29bf..01147693f 100644 --- a/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/BaseCreateImperativeRestController.java +++ b/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/BaseCreateImperativeRestController.java @@ -3,14 +3,12 @@ import io.americanexpress.synapse.api.rest.imperative.controller.helpers.CreateResponseEntityCreator; import io.americanexpress.synapse.service.imperative.model.BaseServiceRequest; import io.americanexpress.synapse.service.imperative.model.BaseServiceResponse; -import io.americanexpress.synapse.service.imperative.service.BaseCreateImperativeService; +import io.americanexpress.synapse.service.imperative.service.BaseService; import io.swagger.v3.oas.annotations.Operation; import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; -import jakarta.validation.Valid; /** * {@code BaseCreateService} class specifies the prototypes for performing business logic. @@ -22,7 +20,7 @@ public class BaseCreateImperativeRestController< I extends BaseServiceRequest, O extends BaseServiceResponse, - S extends BaseCreateImperativeService + S extends BaseService > extends BaseController { /** @@ -34,9 +32,9 @@ public class BaseCreateImperativeRestController< */ @PostMapping @Operation(tags = "Create Operation", summary = "Creates a resource") - public ResponseEntity create(@RequestHeader HttpHeaders headers, @Valid @RequestBody I serviceRequest) { + public ResponseEntity create(@RequestHeader HttpHeaders headers, I serviceRequest) { logger.entry(serviceRequest); - O serviceResponse = service.create(serviceRequest); + O serviceResponse = service.execute(serviceRequest); ResponseEntity responseEntity = CreateResponseEntityCreator.create(serviceResponse); logger.exit(); return responseEntity; diff --git a/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/BaseDeleteImperativeRestController.java b/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/BaseDeleteImperativeRestController.java index 2d5ab2329..36dfc5617 100644 --- a/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/BaseDeleteImperativeRestController.java +++ b/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/BaseDeleteImperativeRestController.java @@ -1,18 +1,15 @@ package io.americanexpress.synapse.api.rest.imperative.controller; import io.americanexpress.synapse.service.imperative.model.BaseServiceRequest; -import io.americanexpress.synapse.service.imperative.service.BaseDeleteImperativeService; +import io.americanexpress.synapse.service.imperative.model.BaseServiceResponse; +import io.americanexpress.synapse.service.imperative.service.BaseService; import io.swagger.v3.oas.annotations.Operation; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.ResponseStatus; -import jakarta.validation.Valid; - /** * {@code BaseDeleteController} class specifies the prototypes for listening for requests from the consumer * to Delete (DELETE) a resource. This controller expects only one entry per request. @@ -22,7 +19,8 @@ */ public class BaseDeleteImperativeRestController< I extends BaseServiceRequest, - S extends BaseDeleteImperativeService + O extends BaseServiceResponse, + S extends BaseService > extends BaseController { /** @@ -33,9 +31,9 @@ public class BaseDeleteImperativeRestController< @DeleteMapping @ResponseStatus(HttpStatus.NO_CONTENT) @Operation(tags = "Delete Operation", summary = "Deletes a resource") - public void delete(@RequestHeader HttpHeaders headers, @Valid @RequestBody I serviceRequest) { + public void delete(@RequestHeader HttpHeaders headers, I serviceRequest) { logger.entry(serviceRequest); - service.delete(serviceRequest); + service.execute(serviceRequest); logger.exit(); } } diff --git a/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/BaseGetMonoImperativeRestController.java b/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/BaseGetMonoImperativeRestController.java index 1247fce20..f49848748 100644 --- a/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/BaseGetMonoImperativeRestController.java +++ b/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/BaseGetMonoImperativeRestController.java @@ -3,28 +3,26 @@ import io.americanexpress.synapse.api.rest.imperative.controller.helpers.MonoResponseEntityCreator; import io.americanexpress.synapse.service.imperative.model.BaseServiceRequest; import io.americanexpress.synapse.service.imperative.model.BaseServiceResponse; -import io.americanexpress.synapse.service.imperative.service.BaseGetMonoImperativeService; +import io.americanexpress.synapse.service.imperative.service.BaseService; import io.swagger.v3.oas.annotations.Operation; import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestHeader; -import jakarta.validation.Valid; - /** * {@code BaseGetMonoImperativeRestController} is base class for read mono controller. This controller handles POST method requests, * but specifically for read purposes. * This controller returns a single object. * * @param an object extending the {@link BaseServiceResponse} - * @param an object extending the {@link BaseGetMonoImperativeService} + * @param an object extending the {@link BaseService} * @author Francois Gutt */ public class BaseGetMonoImperativeRestController< + I extends BaseServiceRequest, O extends BaseServiceResponse, - S extends BaseGetMonoImperativeService + S extends BaseService > extends BaseController { /** @@ -34,9 +32,9 @@ public class BaseGetMonoImperativeRestController< */ @Operation(summary = "Read operation based on path.", description = "Read one resource based on a path variable.") @GetMapping - public ResponseEntity read(@RequestHeader HttpHeaders headers) { - logger.entry(headers); - final O response = service.read(headers); + public ResponseEntity read(@RequestHeader HttpHeaders headers, I serviceRequest) { + logger.entry(serviceRequest); + final O response = service.execute(serviceRequest); ResponseEntity responseEntity = MonoResponseEntityCreator.create(response); logger.exit(responseEntity); return responseEntity; diff --git a/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/BaseReadImperativeRestController.java b/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/BaseReadImperativeRestController.java deleted file mode 100644 index 34efb9f17..000000000 --- a/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/BaseReadImperativeRestController.java +++ /dev/null @@ -1,15 +0,0 @@ -package io.americanexpress.synapse.api.rest.imperative.controller; - -import io.americanexpress.synapse.service.imperative.model.BaseServiceRequest; -import io.americanexpress.synapse.service.imperative.model.BaseServiceResponse; -import io.americanexpress.synapse.service.imperative.service.BaseCreateImperativeService; - -public class BaseReadImperativeRestController< - I extends BaseServiceRequest, - O extends BaseServiceResponse, - S extends BaseCreateImperativeService - > extends BaseController { - - - -} diff --git a/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/BaseReadMonoImperativeRestController.java b/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/BaseReadMonoImperativeRestController.java index 1d2db4cd0..9957a9167 100644 --- a/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/BaseReadMonoImperativeRestController.java +++ b/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/BaseReadMonoImperativeRestController.java @@ -3,16 +3,14 @@ import io.americanexpress.synapse.api.rest.imperative.controller.helpers.MonoResponseEntityCreator; import io.americanexpress.synapse.service.imperative.model.BaseServiceRequest; import io.americanexpress.synapse.service.imperative.model.BaseServiceResponse; -import io.americanexpress.synapse.service.imperative.service.BaseReadMonoImperativeService; +import io.americanexpress.synapse.service.imperative.service.BaseService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; -import jakarta.validation.Valid; /** * {@code BaseReadMonoController} class specifies the prototypes for listening for requests from the consumer @@ -21,13 +19,13 @@ * * @param an object extending the {@link BaseServiceRequest} * @param an object extending the {@link BaseServiceResponse} - * @param an object extending the {@link BaseReadMonoImperativeService} + * @param an object extending the {@link BaseService} * @author Gabriel Jimenez */ public class BaseReadMonoImperativeRestController< I extends BaseServiceRequest, O extends BaseServiceResponse, - S extends BaseReadMonoImperativeService + S extends BaseService > extends BaseController { /** @@ -51,10 +49,10 @@ public class BaseReadMonoImperativeRestController< @ApiResponse(responseCode = "403", description = "Forbidden"), }) @PostMapping(INQUIRY_RESULTS) - public ResponseEntity read(@RequestHeader HttpHeaders headers, @Valid @RequestBody I serviceRequest) { + public ResponseEntity read(@RequestHeader HttpHeaders headers, I serviceRequest) { logger.entry(serviceRequest); - final O serviceResponse = service.read(serviceRequest); + final O serviceResponse = service.execute(serviceRequest); ResponseEntity responseEntity = MonoResponseEntityCreator.create(serviceResponse); logger.exit(responseEntity); diff --git a/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/BaseReadPolyImperativeRestController.java b/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/BaseReadPolyImperativeRestController.java index 39628dd96..3199ec328 100644 --- a/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/BaseReadPolyImperativeRestController.java +++ b/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/BaseReadPolyImperativeRestController.java @@ -3,31 +3,31 @@ import io.americanexpress.synapse.api.rest.imperative.controller.helpers.PolyResponseEntityCreator; import io.americanexpress.synapse.service.imperative.model.BaseServiceRequest; import io.americanexpress.synapse.service.imperative.model.BaseServiceResponse; -import io.americanexpress.synapse.service.imperative.service.BaseReadPolyImperativeService; +import io.americanexpress.synapse.service.imperative.model.PageResponse; +import io.americanexpress.synapse.service.imperative.service.BaseService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; -import org.springframework.data.domain.Page; +import java.util.List; import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; -import jakarta.servlet.http.HttpServletResponse; -import jakarta.validation.Valid; -import java.util.List; - /** * {@code BaseReadPolyController} class specifies the prototypes for listening for requests from the consumer * to Read (POST) a resource. This Controller expects only one object in request and a list of objects as response, hence, "Poly" in the name. * * @param an object extending {@link BaseServiceRequest} * @param an object extending {@link BaseServiceResponse} - * @param an object extending {@link BaseReadPolyImperativeService} + * @param an object extending {@link BaseService} * @author Gabriel Jimenez */ -public class BaseReadPolyImperativeRestController> extends BaseController { +public class BaseReadPolyImperativeRestController< + I extends BaseServiceRequest, + O extends BaseServiceResponse, + S extends BaseService> + > extends BaseController { /** * Constant string used for multiple_results. @@ -39,7 +39,6 @@ public class BaseReadPolyImperativeRestController> read(@RequestHeader HttpHeaders headers, @Valid @RequestBody I serviceRequest, HttpServletResponse httpServletResponse) { + public ResponseEntity> read(@RequestHeader HttpHeaders headers, I serviceRequest) { logger.entry(serviceRequest); - final Page page = service.read(headers, serviceRequest); - final ResponseEntity> responseEntity = PolyResponseEntityCreator.create(page, httpServletResponse); + final PageResponse page = service.execute(serviceRequest); + final ResponseEntity> responseEntity = PolyResponseEntityCreator.create(page); logger.exit(responseEntity); return responseEntity; diff --git a/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/BaseUpdateImperativeRestController.java b/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/BaseUpdateImperativeRestController.java new file mode 100644 index 000000000..eac8372cc --- /dev/null +++ b/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/BaseUpdateImperativeRestController.java @@ -0,0 +1,40 @@ +package io.americanexpress.synapse.api.rest.imperative.controller; + +import io.americanexpress.synapse.api.rest.imperative.controller.helpers.CreateResponseEntityCreator; +import io.americanexpress.synapse.service.imperative.model.BaseServiceRequest; +import io.americanexpress.synapse.service.imperative.model.BaseServiceResponse; +import io.americanexpress.synapse.service.imperative.service.BaseService; +import org.springframework.http.HttpHeaders; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestHeader; + +/** + * {@code BaseUpdateImperativeRestController} class specifies the prototypes for performing business logic. + * + * @param input request type + * @param output response type + * @author Francois Gutt + */ +public class BaseUpdateImperativeRestController< + I extends BaseServiceRequest, + O extends BaseServiceResponse, + S extends BaseService + > extends BaseController { + + /** + * Update a single resource. + * + * @param headers containing the HTTP headers from the consumer + * @param serviceRequest body from the consumer + * @return response to the consumer + */ + @PutMapping + public ResponseEntity update(@RequestHeader HttpHeaders headers, I serviceRequest) { + logger.entry(serviceRequest); + O serviceResponse = service.execute(serviceRequest); + ResponseEntity responseEntity = CreateResponseEntityCreator.create(serviceResponse); + logger.exit(); + return responseEntity; + } +} diff --git a/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/exceptionhandler/ControllerExceptionHandler.java b/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/exceptionhandler/ControllerExceptionHandler.java index 09e744c36..0c2b9164c 100644 --- a/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/exceptionhandler/ControllerExceptionHandler.java +++ b/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/exceptionhandler/ControllerExceptionHandler.java @@ -23,6 +23,7 @@ import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.OptimisticLockingFailureException; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.http.converter.HttpMessageNotReadableException; @@ -91,14 +92,14 @@ public ResponseEntity handleApplicationClientException(final Appl ResponseEntity errorResponseEntity; if (applicationClientException.getCause() == null) { - ErrorCode errorCode = applicationClientException.getErrorCode(); + ErrorCode errorCode = applicationClientException.getErrorCode(); String message = errorMessagePropertyReader.getErrorMessage(errorCode, applicationClientException.getMessageArguments() != null ? applicationClientException.getMessageArguments() : new String[]{StringUtils.EMPTY}); String developerMessage = StringUtils.isNotBlank(applicationClientException.getDeveloperMessage()) ? applicationClientException.getDeveloperMessage() : StringUtils.EMPTY; ErrorResponse errorResponse = new ErrorResponse(errorCode, errorCode.getMessage(), message, developerMessage); - errorResponseEntity = ResponseEntity.status(errorCode.getHttpStatus()).body(errorResponse); + errorResponseEntity = ResponseEntity.status(errorCode.getHttpStatus().value()).body(errorResponse); } else { - errorResponseEntity = handleInternalServerError(applicationClientException); + errorResponseEntity = handleInternalServerError(applicationClientException); } logger.exit(errorResponseEntity); @@ -145,7 +146,7 @@ public ResponseEntity handleHttpMessageNotReadableException(HttpM String userMessage = httpMessageNotReadableException.getMessage(); ErrorCode errorCode = ErrorCode.GENERIC_4XX_ERROR; final ErrorResponse errorResponse = new ErrorResponse(errorCode, errorCode.getMessage(), userMessage, "Input validation"); - final ResponseEntity errorResponseEntity = ResponseEntity.status(errorCode.getHttpStatus()).body(errorResponse); + final ResponseEntity errorResponseEntity = ResponseEntity.status(errorCode.getHttpStatus().value()).body(errorResponse); logger.exit(errorResponseEntity); return errorResponseEntity; } @@ -173,7 +174,7 @@ private ResponseEntity handleInternalServerError(Throwable throwa String fullStackTrace = ApplicationServerException.getStackTrace(throwable, System.lineSeparator()); ErrorCode errorCode = ErrorCode.GENERIC_5XX_ERROR; ErrorResponse errorResponse = new ErrorResponse(errorCode, errorCode.getMessage(), message, CryptoUtil.encrypt(fullStackTrace)); - return ResponseEntity.status(errorCode.getHttpStatus()).body(errorResponse); + return ResponseEntity.status(errorCode.getHttpStatus().value()).body(errorResponse); } /** @@ -193,4 +194,19 @@ private ResponseEntity handleInternalServerError(final Throwable return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(errorResponse); } + + @ExceptionHandler(OptimisticLockingFailureException.class) + public ResponseEntity handleOptimisticLockingFailure(OptimisticLockingFailureException optimisticLockingFailureException) { + logger.warn("Client issued a request which resulted in a conflict.", optimisticLockingFailureException); + ResponseEntity errorResponseEntity; + ErrorCode errorConflictCode = ErrorCode.RESOURCE_OUT_OF_SYNC; + String fullStackTrace = ApplicationServerException.getStackTrace(optimisticLockingFailureException, System.lineSeparator()); + String message = errorMessagePropertyReader.getErrorMessage(errorConflictCode); + ErrorResponse errorResponse = new ErrorResponse(errorConflictCode, errorConflictCode.getMessage(), message, + CryptoUtil.encrypt(fullStackTrace)); + errorResponseEntity = ResponseEntity.status(errorConflictCode.getHttpStatus().value()).body(errorResponse); + + logger.exit(errorResponseEntity); + return errorResponseEntity; + } } diff --git a/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/helpers/PolyResponseEntityCreator.java b/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/helpers/PolyResponseEntityCreator.java index c5d200e50..ae201c852 100644 --- a/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/helpers/PolyResponseEntityCreator.java +++ b/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/helpers/PolyResponseEntityCreator.java @@ -14,12 +14,13 @@ package io.americanexpress.synapse.api.rest.imperative.controller.helpers; import io.americanexpress.synapse.service.imperative.model.BaseServiceResponse; -import org.springframework.data.domain.Page; +import io.americanexpress.synapse.service.imperative.model.PageResponse; +import java.util.List; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; +import org.springframework.http.ResponseEntity.BodyBuilder; +import org.springframework.http.ResponseEntity.HeadersBuilder; import org.springframework.util.CollectionUtils; -import jakarta.servlet.http.HttpServletResponse; -import java.util.List; /** * {@code PolyResponseEntityCreator} creates ResponseEntity for poly responses. @@ -27,25 +28,25 @@ * * @author Francois Gutt */ -public class PolyResponseEntityCreator { +public class PolyResponseEntityCreator { /** * Creates a Poly ResponseEntity with pagination. * @param page will be used for pagination. - * @param httpServletResponse response from the service. * @return ResponseEntity that will have {@link BaseServiceResponse} */ - public static ResponseEntity> create(Page page, HttpServletResponse httpServletResponse) { + public static ResponseEntity> create(PageResponse page) { final ResponseEntity> responseEntity; List pageContent = null; if (page != null) { - pageContent = page.getContent(); + pageContent = page.getResponsesForPage(); } if (page == null || CollectionUtils.isEmpty(pageContent)) { responseEntity = new ResponseEntity<>(HttpStatus.NO_CONTENT); } else { - setHeadersInResponse(page, httpServletResponse); - responseEntity = new ResponseEntity<>(pageContent, HttpStatus.OK); + BodyBuilder bodyBuilder = ResponseEntity.ok(); + setHeadersInResponse(page, bodyBuilder); + responseEntity = bodyBuilder.body(pageContent); } return responseEntity; } @@ -53,13 +54,11 @@ public static ResponseEntity> create(Pag /** * Creates pagination header * @param page pagination - * @param httpServletResponse response + * @param headersBuilder response headers */ - private static void setHeadersInResponse(final Page page, final HttpServletResponse httpServletResponse) { - if (page != null && !CollectionUtils.isEmpty(page.getContent())) { - httpServletResponse.setHeader("size", String.valueOf(page.getSize())); - httpServletResponse.setHeader("page", String.valueOf(page.getNumber())); - httpServletResponse.setHeader("total_results_count", String.valueOf(page.getNumberOfElements())); - } + private static void setHeadersInResponse(final PageResponse page, final HeadersBuilder headersBuilder) { + headersBuilder.header("size", String.valueOf(page.getPageSize())); + headersBuilder.header("page", String.valueOf(page.getPage())); + headersBuilder.header("total_results_count", String.valueOf(page.getTotalResultsCount())); } } diff --git a/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/model/ServiceHeadersFactory.java b/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/helpers/ServiceHeadersFactory.java similarity index 80% rename from service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/model/ServiceHeadersFactory.java rename to api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/helpers/ServiceHeadersFactory.java index 076812166..17a884cfd 100644 --- a/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/model/ServiceHeadersFactory.java +++ b/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/controller/helpers/ServiceHeadersFactory.java @@ -11,8 +11,12 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -package io.americanexpress.synapse.service.imperative.model; +package io.americanexpress.synapse.api.rest.imperative.controller.helpers; +import io.americanexpress.synapse.service.imperative.model.ServiceHeaderKey; +import io.americanexpress.synapse.service.imperative.model.ServiceHeaders; +import io.americanexpress.synapse.service.imperative.model.ServiceRouting; +import io.americanexpress.synapse.service.imperative.model.ServiceTrace; import org.springframework.http.HttpHeaders; /** diff --git a/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/model/ErrorResponse.java b/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/model/ErrorResponse.java similarity index 94% rename from service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/model/ErrorResponse.java rename to api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/model/ErrorResponse.java index 5a360f97e..bac4e05f9 100644 --- a/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/model/ErrorResponse.java +++ b/api/synapse-api-rest-imperative/src/main/java/io/americanexpress/synapse/api/rest/imperative/model/ErrorResponse.java @@ -11,14 +11,13 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -package io.americanexpress.synapse.service.reactive.model; +package io.americanexpress.synapse.api.rest.imperative.model; import io.americanexpress.synapse.framework.exception.model.ErrorCode; /** * {@code ErrorResponse} class is the response model for 4XX and 5XX series errors. * - * @author Francois Gutt */ public class ErrorResponse { @@ -43,7 +42,7 @@ public class ErrorResponse { private String developerMessage; /** - * Creates a new instance of ErrorResponse with given values. + * Argument constructor creates a new instance of ErrorResponse with given values. * * @param code error code * @param message friendly header message that gives a brief overview of the error diff --git a/api/synapse-api-rest-reactive/pom.xml b/api/synapse-api-rest-reactive/pom.xml index 36dd408d2..2f8f3c245 100644 --- a/api/synapse-api-rest-reactive/pom.xml +++ b/api/synapse-api-rest-reactive/pom.xml @@ -19,7 +19,7 @@ io.americanexpress.synapse api - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 @@ -36,32 +36,32 @@ io.americanexpress.synapse synapse-service-reactive + + + + io.americanexpress.synapse - synapse-framework-api-docs + synapse-framework-logging io.americanexpress.synapse - synapse-framework-logging + synapse-utilities-common io.americanexpress.synapse - synapse-utilities-common + synapse-framework-exception - - org.springframework.boot - spring-boot-starter-validation - org.springframework.boot spring-boot-starter-webflux - io.swagger - swagger-annotations + io.swagger.core.v3 + swagger-annotations-jakarta diff --git a/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/config/BaseApiReactiveRestConfig.java b/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/config/BaseApiReactiveRestConfig.java index 4b1af1815..f28e2877e 100644 --- a/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/config/BaseApiReactiveRestConfig.java +++ b/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/config/BaseApiReactiveRestConfig.java @@ -14,7 +14,6 @@ package io.americanexpress.synapse.api.rest.reactive.config; import com.fasterxml.jackson.databind.ObjectMapper; -import io.americanexpress.synapse.framework.api.docs.ApiDocsConfig; import io.americanexpress.synapse.framework.exception.config.ExceptionConfig; import io.americanexpress.synapse.service.reactive.config.BaseReactiveServiceRestConfig; import io.americanexpress.synapse.utilities.common.config.UtilitiesCommonConfig; @@ -33,7 +32,7 @@ @ComponentScan(basePackages = "io.americanexpress.synapse.api.rest.reactive") @Configuration @EnableWebFlux -@Import({BaseReactiveServiceRestConfig.class, ExceptionConfig.class, ApiDocsConfig.class, UtilitiesCommonConfig.class}) +@Import({BaseReactiveServiceRestConfig.class, ExceptionConfig.class, UtilitiesCommonConfig.class}) public class BaseApiReactiveRestConfig implements WebFluxConfigurer { /** diff --git a/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/BaseController.java b/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/BaseController.java index efdbe26e8..dca608b5b 100644 --- a/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/BaseController.java +++ b/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/BaseController.java @@ -13,10 +13,18 @@ */ package io.americanexpress.synapse.api.rest.reactive.controller; +import io.americanexpress.synapse.service.reactive.model.BaseServiceRequest; +import io.americanexpress.synapse.service.reactive.model.BaseServiceResponse; import io.americanexpress.synapse.service.reactive.service.BaseService; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpHeaders; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.reactivestreams.Publisher; +import reactor.core.publisher.Mono; /** * {@code BaseController} The base controller every child controller should extend this parent controller @@ -24,7 +32,10 @@ * * @author Francois gutt */ -public class BaseController { +public abstract class BaseController< + I extends BaseServiceRequest, + O extends Publisher, + S extends BaseService> { /** * Service that will be called to get a single resource or multiple resources. @@ -37,4 +48,22 @@ public class BaseController { */ protected final XLogger logger = XLoggerFactory.getXLogger(this.getClass()); + protected Mono> execute(@RequestHeader HttpHeaders headers, @RequestBody I serviceRequest) { + logger.entry(serviceRequest); + try { + return Mono.just(ResponseEntity.ok(service.execute(serviceRequest))); + } + catch (Throwable throwable) { + return handleThrowable(throwable); + } + finally { + logger.exit(); + } + } + + protected Mono> handleThrowable(Throwable throwable) { + logger.catching(throwable); + + return Mono.just(ResponseEntity.internalServerError().build()); + } } diff --git a/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/BaseCreateReactiveRestController.java b/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/BaseCreateReactiveRestController.java index 0eec39982..d745fd8ca 100644 --- a/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/BaseCreateReactiveRestController.java +++ b/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/BaseCreateReactiveRestController.java @@ -13,21 +13,19 @@ */ package io.americanexpress.synapse.api.rest.reactive.controller; -import io.americanexpress.synapse.api.rest.reactive.controller.helper.MonoResponseEntityCreator; import io.americanexpress.synapse.service.reactive.model.BaseServiceRequest; import io.americanexpress.synapse.service.reactive.model.BaseServiceResponse; -import io.americanexpress.synapse.service.reactive.service.BaseCreateReactiveService; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import io.americanexpress.synapse.service.reactive.service.BaseService; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import org.reactivestreams.Publisher; import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RestController; import reactor.core.publisher.Mono; -import jakarta.validation.Valid; /** * {@code BaseCreateReactiveRestController} class specifies the prototypes for listening for requests from the consumer @@ -35,15 +33,15 @@ * * @param an object extending the {@link BaseServiceRequest} * @param an object extending the {@link BaseServiceResponse} - * @param an object extending the {@link BaseCreateReactiveService} + * @param an object extending the {@link BaseService} * @author Gabriel Jimenez */ @RestController public class BaseCreateReactiveRestController< I extends BaseServiceRequest, - O extends BaseServiceResponse, - S extends BaseCreateReactiveService - > extends BaseController { + O extends Publisher, + S extends BaseService + > extends BaseController { /** * Create a single resource. @@ -52,19 +50,15 @@ public class BaseCreateReactiveRestController< * @param serviceRequest body from the consumer * @return response to the consumer */ - @PostMapping - @Operation(tags = "Reactive Create Operation", summary = "Creates a reactive resource") + @Operation(description = "Reactive Create Operation", summary = "Creates a resource reactively") @ApiResponses(value = { - @ApiResponse(code = 201, message = "Created"), - @ApiResponse(code = 400, message = "Bad Request"), - @ApiResponse(code = 401, message = "Unauthorized"), - @ApiResponse(code = 403, message = "Forbidden"), + @ApiResponse(responseCode = "201", description = "Created"), + @ApiResponse(responseCode = "400", description = "Bad Request"), + @ApiResponse(responseCode = "401", description = "Unauthorized"), + @ApiResponse(responseCode = "403", description = "Forbidden"), }) - public ResponseEntity> create(@RequestHeader HttpHeaders headers, @Valid @RequestBody I serviceRequest) { - logger.entry(serviceRequest); - final var serviceResponse = service.create(serviceRequest); - ResponseEntity> responseEntity = MonoResponseEntityCreator.create(serviceResponse); - logger.exit(); - return responseEntity; + @PostMapping + public Mono> create(@RequestHeader HttpHeaders headers, I serviceRequest) { + return execute(headers, serviceRequest); } } diff --git a/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/BaseDeleteReactiveRestController.java b/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/BaseDeleteReactiveRestController.java index a5db56ac9..91b65c31a 100644 --- a/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/BaseDeleteReactiveRestController.java +++ b/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/BaseDeleteReactiveRestController.java @@ -14,13 +14,15 @@ package io.americanexpress.synapse.api.rest.reactive.controller; import io.americanexpress.synapse.service.reactive.model.BaseServiceRequest; -import io.americanexpress.synapse.service.reactive.service.BaseDeleteReactiveService; +import io.americanexpress.synapse.service.reactive.model.BaseServiceResponse; +import io.americanexpress.synapse.service.reactive.service.BaseService; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import org.reactivestreams.Publisher; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.ResponseStatus; import reactor.core.publisher.Mono; @@ -29,13 +31,14 @@ * {@code BaseDeleteReactiveRestController} is base class for delete mono controller. This controller handles DELETE * method requests, but specifically for delete purposes. * This controller returns a single object. - * @param an object extending the {@link BaseDeleteReactiveService} + * @param an object extending the {@link BaseService} * @author Francois Gutt */ public class BaseDeleteReactiveRestController< I extends BaseServiceRequest, - S extends BaseDeleteReactiveService - > extends BaseController { + O extends Publisher, + S extends BaseService + > extends BaseController { /** * Delete a single resource. @@ -43,14 +46,15 @@ public class BaseDeleteReactiveRestController< * @param serviceRequest of the resource to be deleted */ @DeleteMapping + @Operation(description = "Delete Operation", summary = "Deletes a resource reactively", + responses = { + @ApiResponse(responseCode = "204", description = "No Content"), + @ApiResponse(responseCode = "400", description = "Bad Request"), + @ApiResponse(responseCode = "401", description = "Unauthorized"), + @ApiResponse(responseCode = "403", description = "Forbidden"), + }) @ResponseStatus(HttpStatus.NO_CONTENT) - @Operation(tags = "Delete Operation", summary = "Deletes a resource reactively") - public Mono> delete(@RequestHeader HttpHeaders headers, @PathVariable I serviceRequest) { - logger.entry(serviceRequest); - var serviceResults = service.delete(serviceRequest); - var responseEntity = serviceResults - .map(res -> new ResponseEntity(HttpStatus.NO_CONTENT)); - logger.exit(responseEntity); - return responseEntity; + public Mono> delete(@RequestHeader HttpHeaders headers, I serviceRequest) { + return execute(headers, serviceRequest); } } diff --git a/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/BaseGetFluxReactiveRestController.java b/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/BaseGetFluxReactiveRestController.java index c457c9140..c6851e1e3 100644 --- a/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/BaseGetFluxReactiveRestController.java +++ b/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/BaseGetFluxReactiveRestController.java @@ -15,50 +15,46 @@ import io.americanexpress.synapse.service.reactive.model.BaseServiceRequest; import io.americanexpress.synapse.service.reactive.model.BaseServiceResponse; -import io.americanexpress.synapse.service.reactive.service.BaseGetFluxReactiveService; -import io.americanexpress.synapse.service.reactive.service.BaseGetMonoReactiveService; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import io.americanexpress.synapse.service.reactive.service.BaseService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import org.reactivestreams.Publisher; import org.springframework.http.HttpHeaders; +import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestHeader; -import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; /** * {@code BaseGetFluxReactiveRestController} is base class for read mono controller. * This controller handles GET method requests, but specifically for read purposes. * This controller returns a single object. * @param an object extending the {@link BaseServiceResponse} - * @param an object extending the {@link BaseGetMonoReactiveService} + * @param an object extending the {@link BaseService} * @author Francois Gutt */ public class BaseGetFluxReactiveRestController< I extends BaseServiceRequest, - O extends BaseServiceResponse, - S extends BaseGetFluxReactiveService - > - extends BaseController { + O extends Publisher, + S extends BaseService + > extends BaseController { /** * Get a list of multiple resources from the back end service. * @param headers the headers * @return response */ - @ApiOperation(value = "Reactive get flux", notes = "Gets all resources reactively") - @ApiResponses(value = { - @ApiResponse(code = 200, message = "Ok"), - @ApiResponse(code = 204, message = "No Content"), - @ApiResponse(code = 206, message = "Partial Content"), - @ApiResponse(code = 400, message = "Bad Request"), - @ApiResponse(code = 401, message = "Unauthorized"), - @ApiResponse(code = 403, message = "Forbidden"), - }) + @Operation(description = "Reactive get flux", summary = "Gets all resources reactively", + responses = { + @ApiResponse(responseCode = "200", description = "Ok"), + @ApiResponse(responseCode = "204", description = "No Content"), + @ApiResponse(responseCode = "206", description = "Partial Content"), + @ApiResponse(responseCode = "400", description = "Bad Request"), + @ApiResponse(responseCode = "401", description = "Unauthorized"), + @ApiResponse(responseCode = "403", description = "Forbidden"), + }) @GetMapping() - public Flux read(@RequestHeader HttpHeaders headers, I serviceRequest) { - logger.entry(); - final var serviceResponse = service.read(serviceRequest); - logger.exit(); - return serviceResponse; + public Mono> read(@RequestHeader HttpHeaders headers, I serviceRequest) { + return execute(headers, serviceRequest); } } diff --git a/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/BaseGetMonoReactiveRestController.java b/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/BaseGetMonoReactiveRestController.java index c142fec97..f077a49c6 100644 --- a/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/BaseGetMonoReactiveRestController.java +++ b/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/BaseGetMonoReactiveRestController.java @@ -13,20 +13,17 @@ */ package io.americanexpress.synapse.api.rest.reactive.controller; -import io.americanexpress.synapse.api.rest.reactive.controller.helper.MonoResponseEntityCreator; import io.americanexpress.synapse.service.reactive.model.BaseServiceRequest; import io.americanexpress.synapse.service.reactive.model.BaseServiceResponse; -import io.americanexpress.synapse.service.reactive.service.BaseGetMonoReactiveService; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import io.americanexpress.synapse.service.reactive.service.BaseService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import org.reactivestreams.Publisher; import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import reactor.core.publisher.Mono; -import jakarta.validation.Valid; /** * {@code BaseGetMonoReactiveRestController} is base class for read mono controller. @@ -35,14 +32,14 @@ * * @param an object extending the {@link BaseServiceRequest} * @param an object extending the {@link BaseServiceResponse} - * @param an object extending the {@link BaseGetMonoReactiveService} + * @param an object extending the {@link BaseService} * @author Francois Gutt */ public class BaseGetMonoReactiveRestController< I extends BaseServiceRequest, - O extends BaseServiceResponse, - S extends BaseGetMonoReactiveService - > extends BaseController { + O extends Publisher, + S extends BaseService + > extends BaseController { /** * Get a single resource from the back end service. @@ -51,32 +48,17 @@ public class BaseGetMonoReactiveRestController< * @param serviceRequest the service request * @return response */ - @ApiOperation(value = "Reactive get mono", notes = "Gets one resource reactively") - @ApiResponses(value = { - @ApiResponse(code = 200, message = "Ok"), - @ApiResponse(code = 204, message = "No Content"), - @ApiResponse(code = 206, message = "Partial Content"), - @ApiResponse(code = 400, message = "Bad Request"), - @ApiResponse(code = 401, message = "Unauthorized"), - @ApiResponse(code = 403, message = "Forbidden"), - }) @GetMapping - public ResponseEntity> read(@RequestHeader HttpHeaders headers, @Valid @RequestBody I serviceRequest) { - logger.entry(serviceRequest); - final var serviceResponse = service.read(serviceRequest); - ResponseEntity> responseEntity = MonoResponseEntityCreator.create(serviceResponse); - logger.exit(); - return responseEntity; + @Operation(description = "Reactive get mono", summary = "Gets one resource reactively", + responses = { + @ApiResponse(responseCode = "200", description = "Ok"), + @ApiResponse(responseCode = "204", description = "No Content"), + @ApiResponse(responseCode = "206", description = "Partial Content"), + @ApiResponse(responseCode = "400", description = "Bad Request"), + @ApiResponse(responseCode = "401", description = "Unauthorized"), + @ApiResponse(responseCode = "403", description = "Forbidden"), + }) + public Mono> read(@RequestHeader HttpHeaders headers, I serviceRequest) { + return execute(headers, serviceRequest); } - -// @GetMapping -// public Mono> read(@RequestHeader HttpHeaders headers, @Valid @RequestBody I serviceRequest) { -// logger.entry(serviceRequest); -// var serviceResponse = service.read(serviceRequest); -// var responseEntity = serviceResponse -// .map(ResponseEntity::ok) -// .defaultIfEmpty(ResponseEntity.noContent().build()); -// logger.exit(responseEntity); -// return responseEntity; -// } } diff --git a/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/BaseReadFluxReactiveRestController.java b/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/BaseReadFluxReactiveRestController.java index e064d5f95..f5778b9fe 100644 --- a/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/BaseReadFluxReactiveRestController.java +++ b/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/BaseReadFluxReactiveRestController.java @@ -15,31 +15,29 @@ import io.americanexpress.synapse.service.reactive.model.BaseServiceRequest; import io.americanexpress.synapse.service.reactive.model.BaseServiceResponse; -import io.americanexpress.synapse.service.reactive.service.BaseReadFluxReactiveService; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import io.americanexpress.synapse.service.reactive.service.BaseService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import org.reactivestreams.Publisher; import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; -import reactor.core.publisher.Flux; -import jakarta.validation.Valid; +import reactor.core.publisher.Mono; /** * {@code BaseReadFluxReactiveRestController} class specifies the prototypes for listening for requests from the consumer * to Read (POST) a resource. * @param an object extending the {@link BaseServiceRequest} * @param an object extending the {@link BaseServiceResponse} - * @param an object extending the {@link BaseReadFluxReactiveService} + * @param an object extending the {@link BaseService} * @author Gabriel Jimenez */ public class BaseReadFluxReactiveRestController< I extends BaseServiceRequest, - O extends BaseServiceResponse, - S extends BaseReadFluxReactiveService - > extends BaseController { + O extends Publisher, + S extends BaseService + > extends BaseController { /** * The constant MULTIPLE_RESULTS. @@ -52,22 +50,16 @@ public class BaseReadFluxReactiveRestController< * @param serviceRequest body from the consumer * @return a list of resources from the back end service */ - @ApiOperation(value = "Reactive Read Poly", notes = "Gets a collection of resources", response = ResponseEntity.class) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "Ok"), - @ApiResponse(code = 204, message = "No Content"), - @ApiResponse(code = 400, message = "Bad Request"), - @ApiResponse(code = 401, message = "Unauthorized"), - @ApiResponse(code = 403, message = "Forbidden"), - }) + @Operation(description = "Reactive Read Poly", summary = "Gets a collection of resources", + responses = { + @ApiResponse(responseCode = "200", description = "Ok"), + @ApiResponse(responseCode = "204", description = "No Content"), + @ApiResponse(responseCode = "400", description = "Bad Request"), + @ApiResponse(responseCode = "401", description = "Unauthorized"), + @ApiResponse(responseCode = "403", description = "Forbidden"), + }) @PostMapping(MULTIPLE_RESULTS) - public Flux> read(@RequestHeader HttpHeaders headers, @Valid @RequestBody I serviceRequest) { - logger.entry(serviceRequest); - final var serviceResult = service.read(serviceRequest); - final var responseEntity = serviceResult - .map(ResponseEntity::ok) - .defaultIfEmpty(ResponseEntity.noContent().build()); - logger.exit(responseEntity); - return responseEntity; + public Mono> read(@RequestHeader HttpHeaders headers, I serviceRequest) { + return execute(headers, serviceRequest); } } diff --git a/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/BaseReadMonoReactiveRestController.java b/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/BaseReadMonoReactiveRestController.java index 3af08a4d4..b2d200c1d 100644 --- a/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/BaseReadMonoReactiveRestController.java +++ b/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/BaseReadMonoReactiveRestController.java @@ -15,17 +15,15 @@ import io.americanexpress.synapse.service.reactive.model.BaseServiceRequest; import io.americanexpress.synapse.service.reactive.model.BaseServiceResponse; -import io.americanexpress.synapse.service.reactive.service.BaseReadMonoReactiveService; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import io.americanexpress.synapse.service.reactive.service.BaseService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import org.reactivestreams.Publisher; import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import reactor.core.publisher.Mono; -import jakarta.validation.Valid; /** * {@code BaseReadMonoReactiveRestController} class specifies the prototypes for listening for requests from the consumer @@ -34,14 +32,14 @@ * * @param an object extending the {@link BaseServiceRequest} * @param an object extending the {@link BaseServiceResponse} - * @param an object extending the {@link BaseReadMonoReactiveService} + * @param an object extending the {@link BaseService} * @author Gabriel Jimenez */ public class BaseReadMonoReactiveRestController< I extends BaseServiceRequest, - O extends BaseServiceResponse, - S extends BaseReadMonoReactiveService - > extends BaseController { + O extends Publisher, + S extends BaseService + > extends BaseController { /** * The constant INQUIRY_RESULTS. @@ -54,23 +52,17 @@ public class BaseReadMonoReactiveRestController< * @param serviceRequest body from the consumer * @return a single resource from the back end service */ - @ApiOperation(value = "Reactive Read Mono", notes = "Gets one resource") - @ApiResponses(value = { - @ApiResponse(code = 200, message = "Ok"), - @ApiResponse(code = 204, message = "No Content"), - @ApiResponse(code = 206, message = "Partial Content"), - @ApiResponse(code = 400, message = "Bad Request"), - @ApiResponse(code = 401, message = "Unauthorized"), - @ApiResponse(code = 403, message = "Forbidden"), - }) + @Operation(description = "Reactive Read Mono", summary = "Gets one resources", + responses = { + @ApiResponse(responseCode = "200", description = "Ok"), + @ApiResponse(responseCode = "204", description = "No Content"), + @ApiResponse(responseCode = "206", description = "Partial Content"), + @ApiResponse(responseCode = "400", description = "Bad Request"), + @ApiResponse(responseCode = "401", description = "Unauthorized"), + @ApiResponse(responseCode = "403", description = "Forbidden"), + }) @PostMapping(INQUIRY_RESULTS) - public Mono> read(@RequestHeader HttpHeaders headers, @Valid @RequestBody I serviceRequest) { - logger.entry(serviceRequest); - var serviceResponse = service.read(serviceRequest); - var responseEntity = serviceResponse - .map(ResponseEntity::ok) - .defaultIfEmpty(ResponseEntity.noContent().build()); - logger.exit(responseEntity); - return responseEntity; + public Mono> read(@RequestHeader HttpHeaders headers, I serviceRequest) { + return execute(headers, serviceRequest); } } diff --git a/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/exceptionhandler/ControllerExceptionHandler.java b/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/exceptionhandler/ControllerExceptionHandler.java index 948428985..632e6f44a 100644 --- a/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/exceptionhandler/ControllerExceptionHandler.java +++ b/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/exceptionhandler/ControllerExceptionHandler.java @@ -15,10 +15,10 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; +import io.americanexpress.synapse.api.rest.reactive.model.ErrorResponse; import io.americanexpress.synapse.framework.exception.ApplicationClientException; import io.americanexpress.synapse.framework.exception.ApplicationServerException; import io.americanexpress.synapse.framework.exception.model.ErrorCode; -import io.americanexpress.synapse.service.reactive.model.ErrorResponse; import lombok.RequiredArgsConstructor; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; @@ -30,7 +30,6 @@ import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.ServerWebInputException; import org.springframework.web.server.WebExceptionHandler; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; /** @@ -70,7 +69,7 @@ public Mono handle(ServerWebExchange exchange, Throwable throwable) { exchange.getResponse().setStatusCode(HttpStatus.BAD_REQUEST); errorResponse = new ErrorResponse(ErrorCode.GENERIC_4XX_ERROR, serverWebInputException.getMessage(), throwable.getMessage(), serverWebInputException.getLocalizedMessage()); } else if (throwable instanceof ApplicationClientException applicationClientException) { - exchange.getResponse().setStatusCode(applicationClientException.getErrorCode().getHttpStatus()); + exchange.getResponse().setRawStatusCode(applicationClientException.getErrorCode().getHttpStatus().value()); errorResponse = new ErrorResponse(applicationClientException.getErrorCode(), applicationClientException.getErrorCode().getMessage(), throwable.getMessage(), applicationClientException.getDeveloperMessage()); } else if (throwable instanceof ApplicationServerException) { @@ -96,9 +95,9 @@ public Mono createResponseBody(ServerWebExchange exchange, ErrorResponse e throw new ApplicationServerException(exception); } - exchange.getResponse().setStatusCode(errorResponse.getCode().getHttpStatus()); + exchange.getResponse().setRawStatusCode(errorResponse.getCode().getHttpStatus().value()); exchange.getResponse().getHeaders().add("Content-Type", "application/json"); - return exchange.getResponse().writeWith(Flux.just(buffer)); + return exchange.getResponse().writeWith(Mono.just(buffer)); } /** diff --git a/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/exceptionhandler/InputValidationErrorHandler.java b/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/exceptionhandler/InputValidationErrorHandler.java index 5ed5faaca..44444db77 100644 --- a/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/exceptionhandler/InputValidationErrorHandler.java +++ b/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/controller/exceptionhandler/InputValidationErrorHandler.java @@ -13,14 +13,14 @@ */ package io.americanexpress.synapse.api.rest.reactive.controller.exceptionhandler; +import io.americanexpress.synapse.api.rest.reactive.model.ErrorResponse; import io.americanexpress.synapse.framework.exception.model.ErrorCode; -import io.americanexpress.synapse.service.reactive.model.ErrorResponse; +import java.util.StringJoiner; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; import org.springframework.stereotype.Component; import org.springframework.validation.FieldError; import org.springframework.web.bind.support.WebExchangeBindException; -import java.util.StringJoiner; /** * {@code InputValidationErrorHandler} creates the error response containing the input validation errors. diff --git a/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/model/ErrorResponse.java b/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/model/ErrorResponse.java new file mode 100644 index 000000000..4c20e64e6 --- /dev/null +++ b/api/synapse-api-rest-reactive/src/main/java/io/americanexpress/synapse/api/rest/reactive/model/ErrorResponse.java @@ -0,0 +1,103 @@ +/* + * Copyright 2020 American Express Travel Related Services Company, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package io.americanexpress.synapse.api.rest.reactive.model; + +import io.americanexpress.synapse.framework.exception.model.ErrorCode; + +/** + * {@code ErrorResponse} class is the response model for 4XX and 5XX series errors. + * + */ +public class ErrorResponse { + + /** + * Error code. + */ + private ErrorCode code; + + /** + * Friendly header message that gives a brief overview of the error. + */ + private String message; + + /** + * Friendly user message to the consumer of the error. + */ + private String moreInfo; + + /** + * Message for the developer of the error and possibly a solution to fix the error. + */ + private String developerMessage; + + /** + * Argument constructor creates a new instance of ErrorResponse with given values. + * + * @param code error code + * @param message friendly header message that gives a brief overview of the error + * @param moreInfo friendly user message to the consumer of the error + * @param developerMessage message for the developer of the error and possibly a solution to fix the error + */ + public ErrorResponse(ErrorCode code, String message, String moreInfo, String developerMessage) { + this.code = code; + this.message = message; + this.moreInfo = moreInfo; + this.developerMessage = developerMessage; + } + + /** + * Get the errorCode. + * + * @return the errorCode + */ + public ErrorCode getCode() { + return code; + } + + /** + * Get the userMessage. + * + * @return the userMessage + */ + public String getMoreInfo() { + return moreInfo; + } + + /** + * Get the headerMessage. + * + * @return the headerMessage + */ + public String getMessage() { + return message; + } + + /** + * Get the developerMessage. + * + * @return the developerMessage + */ + public String getDeveloperMessage() { + return developerMessage; + } + + /** + * Set the developerMessage. + * + * @param developerMessage the developerMessage + */ + public void setDeveloperMessage(String developerMessage) { + this.developerMessage = developerMessage; + } +} diff --git a/archetype/pom.xml b/archetype/pom.xml index 87b566916..3b8818190 100644 --- a/archetype/pom.xml +++ b/archetype/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/archetype/synapse-archetype-client-graphql/pom.xml b/archetype/synapse-archetype-client-graphql/pom.xml index 9a0fffcb1..781209bad 100644 --- a/archetype/synapse-archetype-client-graphql/pom.xml +++ b/archetype/synapse-archetype-client-graphql/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse archetype - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT synapse-archetype-client-graphql diff --git a/archetype/synapse-archetype-client-rest-delete/pom.xml b/archetype/synapse-archetype-client-rest-delete/pom.xml index 87de9e2f1..67fa50a10 100644 --- a/archetype/synapse-archetype-client-rest-delete/pom.xml +++ b/archetype/synapse-archetype-client-rest-delete/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse archetype - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT synapse-archetype-client-rest-delete diff --git a/archetype/synapse-archetype-client-rest-get/pom.xml b/archetype/synapse-archetype-client-rest-get/pom.xml index 0d898bf7a..9f6de6f6f 100644 --- a/archetype/synapse-archetype-client-rest-get/pom.xml +++ b/archetype/synapse-archetype-client-rest-get/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse archetype - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT synapse-archetype-client-rest-get diff --git a/archetype/synapse-archetype-client-rest-post/pom.xml b/archetype/synapse-archetype-client-rest-post/pom.xml index c32e80aad..9aca8cf7b 100644 --- a/archetype/synapse-archetype-client-rest-post/pom.xml +++ b/archetype/synapse-archetype-client-rest-post/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse archetype - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT synapse-archetype-client-rest-post diff --git a/archetype/synapse-archetype-client-rest-put/pom.xml b/archetype/synapse-archetype-client-rest-put/pom.xml index c86505c90..fca171f62 100644 --- a/archetype/synapse-archetype-client-rest-put/pom.xml +++ b/archetype/synapse-archetype-client-rest-put/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse archetype - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT synapse-archetype-client-rest-put diff --git a/archetype/synapse-archetype-client-rest-reactive-delete/pom.xml b/archetype/synapse-archetype-client-rest-reactive-delete/pom.xml index e2abd83ce..2dbbd502f 100644 --- a/archetype/synapse-archetype-client-rest-reactive-delete/pom.xml +++ b/archetype/synapse-archetype-client-rest-reactive-delete/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse archetype - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT synapse-archetype-client-rest-reactive-delete diff --git a/archetype/synapse-archetype-client-rest-reactive-get/pom.xml b/archetype/synapse-archetype-client-rest-reactive-get/pom.xml index 2b522a639..391123202 100644 --- a/archetype/synapse-archetype-client-rest-reactive-get/pom.xml +++ b/archetype/synapse-archetype-client-rest-reactive-get/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse archetype - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT synapse-archetype-client-rest-reactive-get diff --git a/archetype/synapse-archetype-client-rest-reactive-post/pom.xml b/archetype/synapse-archetype-client-rest-reactive-post/pom.xml index 8c04709f8..204006cfb 100644 --- a/archetype/synapse-archetype-client-rest-reactive-post/pom.xml +++ b/archetype/synapse-archetype-client-rest-reactive-post/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse archetype - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT synapse-archetype-client-rest-reactive-post diff --git a/archetype/synapse-archetype-client-rest-reactive-put/pom.xml b/archetype/synapse-archetype-client-rest-reactive-put/pom.xml index 396153dc6..9a976e320 100644 --- a/archetype/synapse-archetype-client-rest-reactive-put/pom.xml +++ b/archetype/synapse-archetype-client-rest-reactive-put/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse archetype - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT synapse-archetype-client-rest-reactive-put diff --git a/archetype/synapse-archetype-client-rest-reactive/pom.xml b/archetype/synapse-archetype-client-rest-reactive/pom.xml index 57bd8c1ef..703f2f8de 100644 --- a/archetype/synapse-archetype-client-rest-reactive/pom.xml +++ b/archetype/synapse-archetype-client-rest-reactive/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse archetype - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT synapse-archetype-client-rest-reactive diff --git a/archetype/synapse-archetype-client-rest/pom.xml b/archetype/synapse-archetype-client-rest/pom.xml index 18355fdbf..b9f6164ab 100644 --- a/archetype/synapse-archetype-client-rest/pom.xml +++ b/archetype/synapse-archetype-client-rest/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse archetype - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT synapse-archetype-client-rest diff --git a/archetype/synapse-archetype-data-postgres/pom.xml b/archetype/synapse-archetype-data-postgres/pom.xml index 6637cf59c..5ca1ccef5 100644 --- a/archetype/synapse-archetype-data-postgres/pom.xml +++ b/archetype/synapse-archetype-data-postgres/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse archetype - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT synapse-archetype-data-postgres diff --git a/archetype/synapse-archetype-service-rest-delete/pom.xml b/archetype/synapse-archetype-service-rest-delete/pom.xml index 4074f18ee..46908e9e8 100644 --- a/archetype/synapse-archetype-service-rest-delete/pom.xml +++ b/archetype/synapse-archetype-service-rest-delete/pom.xml @@ -18,7 +18,7 @@ io.americanexpress.synapse archetype - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT synapse-archetype-service-rest-delete diff --git a/archetype/synapse-archetype-service-rest-get/pom.xml b/archetype/synapse-archetype-service-rest-get/pom.xml index f78249e40..0740a75f7 100644 --- a/archetype/synapse-archetype-service-rest-get/pom.xml +++ b/archetype/synapse-archetype-service-rest-get/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse archetype - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT synapse-archetype-service-rest-get diff --git a/archetype/synapse-archetype-service-rest-post/pom.xml b/archetype/synapse-archetype-service-rest-post/pom.xml index 17d4e5b3b..da7ce9343 100644 --- a/archetype/synapse-archetype-service-rest-post/pom.xml +++ b/archetype/synapse-archetype-service-rest-post/pom.xml @@ -18,7 +18,7 @@ io.americanexpress.synapse archetype - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT synapse-archetype-service-rest-post diff --git a/archetype/synapse-archetype-service-rest-put/pom.xml b/archetype/synapse-archetype-service-rest-put/pom.xml index 827ce7039..6f3bedad7 100644 --- a/archetype/synapse-archetype-service-rest-put/pom.xml +++ b/archetype/synapse-archetype-service-rest-put/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse archetype - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT synapse-archetype-service-rest-put diff --git a/archetype/synapse-archetype-service-rest-reactive-get/pom.xml b/archetype/synapse-archetype-service-rest-reactive-get/pom.xml index fe3185b64..19194b391 100644 --- a/archetype/synapse-archetype-service-rest-reactive-get/pom.xml +++ b/archetype/synapse-archetype-service-rest-reactive-get/pom.xml @@ -18,7 +18,7 @@ io.americanexpress.synapse archetype - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT synapse-archetype-service-rest-reactive-get diff --git a/archetype/synapse-archetype-service-rest-reactive-post/pom.xml b/archetype/synapse-archetype-service-rest-reactive-post/pom.xml index c246c6183..04ab625d2 100644 --- a/archetype/synapse-archetype-service-rest-reactive-post/pom.xml +++ b/archetype/synapse-archetype-service-rest-reactive-post/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse archetype - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT synapse-archetype-service-rest-reactive-post diff --git a/archetype/synapse-archetype-service-rest-reactive-put/pom.xml b/archetype/synapse-archetype-service-rest-reactive-put/pom.xml index 2b3fc6021..ae003c9b8 100644 --- a/archetype/synapse-archetype-service-rest-reactive-put/pom.xml +++ b/archetype/synapse-archetype-service-rest-reactive-put/pom.xml @@ -18,7 +18,7 @@ io.americanexpress.synapse archetype - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT synapse-archetype-service-rest-reactive-put diff --git a/client/client-samples/pom.xml b/client/client-samples/pom.xml index 0d9612da2..f0dda631a 100644 --- a/client/client-samples/pom.xml +++ b/client/client-samples/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse client - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/client/client-samples/sample-client-graphql-book/pom.xml b/client/client-samples/sample-client-graphql-book/pom.xml index 2638e8ef8..ea233cfd2 100644 --- a/client/client-samples/sample-client-graphql-book/pom.xml +++ b/client/client-samples/sample-client-graphql-book/pom.xml @@ -6,7 +6,7 @@ io.americanexpress.synapse client-samples - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT sample-client-graphql-book diff --git a/client/client-samples/sample-client-reactive-football/pom.xml b/client/client-samples/sample-client-reactive-football/pom.xml index 9d03c0732..3283a2d2f 100644 --- a/client/client-samples/sample-client-reactive-football/pom.xml +++ b/client/client-samples/sample-client-reactive-football/pom.xml @@ -18,7 +18,7 @@ client-samples io.americanexpress.synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/client/client-samples/sample-client-reactive-weather/pom.xml b/client/client-samples/sample-client-reactive-weather/pom.xml index eee0540bb..a8fb69ea1 100644 --- a/client/client-samples/sample-client-reactive-weather/pom.xml +++ b/client/client-samples/sample-client-reactive-weather/pom.xml @@ -18,7 +18,7 @@ client-samples io.americanexpress.synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/client/client-samples/sample-client-weather/pom.xml b/client/client-samples/sample-client-weather/pom.xml index 1283390da..ca4ddf51b 100644 --- a/client/client-samples/sample-client-weather/pom.xml +++ b/client/client-samples/sample-client-weather/pom.xml @@ -18,7 +18,7 @@ client-samples io.americanexpress.synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/client/client-samples/sample-client-weather/src/main/java/io/americanexpress/sample/client/weather/client/WeatherClient.java b/client/client-samples/sample-client-weather/src/main/java/io/americanexpress/sample/client/weather/client/WeatherClient.java index aaee67d42..7cabbfad1 100644 --- a/client/client-samples/sample-client-weather/src/main/java/io/americanexpress/sample/client/weather/client/WeatherClient.java +++ b/client/client-samples/sample-client-weather/src/main/java/io/americanexpress/sample/client/weather/client/WeatherClient.java @@ -29,10 +29,9 @@ public class WeatherClient extends BaseRestClient io.americanexpress.synapse synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/client/synapse-client-graphql/pom.xml b/client/synapse-client-graphql/pom.xml index 1fec2e9de..4dc1620e4 100644 --- a/client/synapse-client-graphql/pom.xml +++ b/client/synapse-client-graphql/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse client - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/client/synapse-client-rest/pom.xml b/client/synapse-client-rest/pom.xml index a1ef01779..493aaecae 100644 --- a/client/synapse-client-rest/pom.xml +++ b/client/synapse-client-rest/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse client - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/client/synapse-client-rest/src/test/java/io/americanexpress/synapse/client/rest/UnitTestSuite.java b/client/synapse-client-rest/src/test/java/io/americanexpress/synapse/client/rest/UnitTestSuite.java index f1b66dfb7..f3178cc77 100644 --- a/client/synapse-client-rest/src/test/java/io/americanexpress/synapse/client/rest/UnitTestSuite.java +++ b/client/synapse-client-rest/src/test/java/io/americanexpress/synapse/client/rest/UnitTestSuite.java @@ -13,11 +13,10 @@ */ package io.americanexpress.synapse.client.rest; -import org.junit.platform.runner.JUnitPlatform; import org.junit.platform.suite.api.SelectPackages; -import org.junit.runner.RunWith; +import org.junit.platform.suite.api.Suite; -@RunWith(JUnitPlatform.class) +@Suite @SelectPackages("com.americanexpress.synapse.client.rest") public class UnitTestSuite { diff --git a/client/synapse-client-soap/pom.xml b/client/synapse-client-soap/pom.xml index c8b478c87..87b61e316 100644 --- a/client/synapse-client-soap/pom.xml +++ b/client/synapse-client-soap/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse client - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/client/synapse-client-test/pom.xml b/client/synapse-client-test/pom.xml index bc2b521d0..cb72c5039 100644 --- a/client/synapse-client-test/pom.xml +++ b/client/synapse-client-test/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse client - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 @@ -30,11 +30,32 @@ io.americanexpress.synapse synapse-client-rest + + io.americanexpress.synapse + synapse-framework-test + compile + + io.projectreactor reactor-test + + org.junit.jupiter + junit-jupiter + compile + + + org.junit.jupiter + junit-jupiter-api + compile + + + org.springframework.boot + spring-boot-starter-test + compile + diff --git a/client/synapse-client-test/src/main/java/io/americanexpress/synapse/client/test/client/BaseRestClientUnitTest.java b/client/synapse-client-test/src/main/java/io/americanexpress/synapse/client/test/client/BaseRestClientUnitTest.java index eab910c2c..d5040508d 100644 --- a/client/synapse-client-test/src/main/java/io/americanexpress/synapse/client/test/client/BaseRestClientUnitTest.java +++ b/client/synapse-client-test/src/main/java/io/americanexpress/synapse/client/test/client/BaseRestClientUnitTest.java @@ -38,7 +38,7 @@ import java.util.ArrayList; import java.util.List; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.springframework.test.web.client.match.MockRestRequestMatchers.method; import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo; diff --git a/data/data-samples/pom.xml b/data/data-samples/pom.xml index a61258857..6052f744b 100644 --- a/data/data-samples/pom.xml +++ b/data/data-samples/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse data - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/data/data-samples/sample-data-cassandra-book/pom.xml b/data/data-samples/sample-data-cassandra-book/pom.xml index 267b345c4..67f375917 100644 --- a/data/data-samples/sample-data-cassandra-book/pom.xml +++ b/data/data-samples/sample-data-cassandra-book/pom.xml @@ -17,7 +17,7 @@ data-samples io.americanexpress.synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/data/data-samples/sample-data-cassandra-reactive/pom.xml b/data/data-samples/sample-data-cassandra-reactive/pom.xml index 0027cc865..135a7339a 100644 --- a/data/data-samples/sample-data-cassandra-reactive/pom.xml +++ b/data/data-samples/sample-data-cassandra-reactive/pom.xml @@ -17,7 +17,7 @@ data-samples io.americanexpress.synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/data/data-samples/sample-data-db2-book/pom.xml b/data/data-samples/sample-data-db2-book/pom.xml index a84742094..20d3fff98 100644 --- a/data/data-samples/sample-data-db2-book/pom.xml +++ b/data/data-samples/sample-data-db2-book/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse data-samples - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/data/data-samples/sample-data-mongodb-book/pom.xml b/data/data-samples/sample-data-mongodb-book/pom.xml index 0309a2738..ae2509106 100644 --- a/data/data-samples/sample-data-mongodb-book/pom.xml +++ b/data/data-samples/sample-data-mongodb-book/pom.xml @@ -17,7 +17,7 @@ data-samples io.americanexpress.synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 @@ -28,6 +28,14 @@ io.americanexpress.synapse synapse-data-mongodb + + org.springframework + spring-test + + + org.junit.jupiter + junit-jupiter + diff --git a/data/data-samples/sample-data-mongodb-reactive/pom.xml b/data/data-samples/sample-data-mongodb-reactive/pom.xml index 04403bcf6..1de22f729 100644 --- a/data/data-samples/sample-data-mongodb-reactive/pom.xml +++ b/data/data-samples/sample-data-mongodb-reactive/pom.xml @@ -17,7 +17,7 @@ data-samples io.americanexpress.synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 @@ -34,6 +34,14 @@ reactor-test test + + org.springframework + spring-test + + + org.junit.jupiter + junit-jupiter + diff --git a/data/data-samples/sample-data-mssql-reactive-book/pom.xml b/data/data-samples/sample-data-mssql-reactive-book/pom.xml index cd1f22d2f..0e00ab970 100644 --- a/data/data-samples/sample-data-mssql-reactive-book/pom.xml +++ b/data/data-samples/sample-data-mssql-reactive-book/pom.xml @@ -19,7 +19,7 @@ io.americanexpress.synapse data-samples - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT sample-data-mssql-reactive-book diff --git a/data/data-samples/sample-data-mysql-book/pom.xml b/data/data-samples/sample-data-mysql-book/pom.xml index d01a56c04..a856b7942 100644 --- a/data/data-samples/sample-data-mysql-book/pom.xml +++ b/data/data-samples/sample-data-mysql-book/pom.xml @@ -18,7 +18,7 @@ data-samples io.americanexpress.synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/data/data-samples/sample-data-mysql-book/src/test/java/io/americanexpress/data/mysql/book/config/MySqlDataConfigTest.java b/data/data-samples/sample-data-mysql-book/src/test/java/io/americanexpress/data/mysql/book/config/MySqlDataConfigTest.java index 65094759a..c7281a7e5 100644 --- a/data/data-samples/sample-data-mysql-book/src/test/java/io/americanexpress/data/mysql/book/config/MySqlDataConfigTest.java +++ b/data/data-samples/sample-data-mysql-book/src/test/java/io/americanexpress/data/mysql/book/config/MySqlDataConfigTest.java @@ -24,7 +24,6 @@ import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.TestPropertySource; - import javax.sql.DataSource; import java.util.Properties; @@ -73,7 +72,7 @@ private Properties additionalHibernateSpringProperties() { properties.setProperty("hibernate.format_sql", "true"); properties.setProperty("spring.datasource.h2.initialization-mode", "always"); properties.setProperty("hibernate.cache.use_query_cache", "true"); - properties.setProperty("hibernate.cache.provider_class", "net.sf.ehcache.hibernate.EhCacheProvider"); + properties.setProperty("hibernate.cache.provider_class", "org.ehcache.hibernate.EhCacheProvider"); return properties; } diff --git a/data/data-samples/sample-data-mysql-reactive-book/pom.xml b/data/data-samples/sample-data-mysql-reactive-book/pom.xml index eb21b6707..16e1360e9 100644 --- a/data/data-samples/sample-data-mysql-reactive-book/pom.xml +++ b/data/data-samples/sample-data-mysql-reactive-book/pom.xml @@ -18,7 +18,7 @@ data-samples io.americanexpress.synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/data/data-samples/sample-data-oracle-book/pom.xml b/data/data-samples/sample-data-oracle-book/pom.xml index eb9452b4f..09992c67e 100644 --- a/data/data-samples/sample-data-oracle-book/pom.xml +++ b/data/data-samples/sample-data-oracle-book/pom.xml @@ -18,7 +18,7 @@ data-samples io.americanexpress.synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/data/data-samples/sample-data-oracle-book/src/test/java/io/americanexpress/data/oracle/book/config/OracleDataConfigTest.java b/data/data-samples/sample-data-oracle-book/src/test/java/io/americanexpress/data/oracle/book/config/OracleDataConfigTest.java index ada9e6350..8b7bff713 100644 --- a/data/data-samples/sample-data-oracle-book/src/test/java/io/americanexpress/data/oracle/book/config/OracleDataConfigTest.java +++ b/data/data-samples/sample-data-oracle-book/src/test/java/io/americanexpress/data/oracle/book/config/OracleDataConfigTest.java @@ -73,7 +73,7 @@ private Properties additionalHibernateSpringProperties() { properties.setProperty("hibernate.format_sql", "true"); properties.setProperty("spring.datasource.h2.initialization-mode", "always"); properties.setProperty("hibernate.cache.use_query_cache", "true"); - properties.setProperty("hibernate.cache.provider_class", "net.sf.ehcache.hibernate.EhCacheProvider"); + properties.setProperty("hibernate.cache.provider_class", "org.ehcache.hibernate.EhCacheProvider"); return properties; } diff --git a/data/data-samples/sample-data-oracle-reactive-book/pom.xml b/data/data-samples/sample-data-oracle-reactive-book/pom.xml index b2b938fea..a22bae0f8 100644 --- a/data/data-samples/sample-data-oracle-reactive-book/pom.xml +++ b/data/data-samples/sample-data-oracle-reactive-book/pom.xml @@ -18,7 +18,7 @@ data-samples io.americanexpress.synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/data/data-samples/sample-data-oracle-reactive-cp-book/pom.xml b/data/data-samples/sample-data-oracle-reactive-cp-book/pom.xml index a4c8336d6..1b01854f0 100644 --- a/data/data-samples/sample-data-oracle-reactive-cp-book/pom.xml +++ b/data/data-samples/sample-data-oracle-reactive-cp-book/pom.xml @@ -18,7 +18,7 @@ data-samples io.americanexpress.synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/data/data-samples/sample-data-postgres-book/pom.xml b/data/data-samples/sample-data-postgres-book/pom.xml index 340bf14be..a7da04844 100644 --- a/data/data-samples/sample-data-postgres-book/pom.xml +++ b/data/data-samples/sample-data-postgres-book/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse data-samples - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 @@ -31,6 +31,7 @@ io.americanexpress.synapse synapse-framework-test + compile org.mockito diff --git a/data/data-samples/sample-data-redis-book/pom.xml b/data/data-samples/sample-data-redis-book/pom.xml index 73c26fe29..dad576a0e 100644 --- a/data/data-samples/sample-data-redis-book/pom.xml +++ b/data/data-samples/sample-data-redis-book/pom.xml @@ -17,7 +17,7 @@ data-samples io.americanexpress.synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/data/pom.xml b/data/pom.xml index d7a38ae28..6fd7fb13d 100644 --- a/data/pom.xml +++ b/data/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/data/synapse-data-cassandra/pom.xml b/data/synapse-data-cassandra/pom.xml index fe1e7a989..479542473 100644 --- a/data/synapse-data-cassandra/pom.xml +++ b/data/synapse-data-cassandra/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse data - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/data/synapse-data-couchbase/pom.xml b/data/synapse-data-couchbase/pom.xml index 99dd952b3..2779413bd 100644 --- a/data/synapse-data-couchbase/pom.xml +++ b/data/synapse-data-couchbase/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse data - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 @@ -64,6 +64,13 @@ jakarta.persistence jakarta.persistence-api + + + com.querydsl + querydsl-apt + 5.0.0 + jakarta + diff --git a/data/synapse-data-db2/pom.xml b/data/synapse-data-db2/pom.xml index 02770a01e..4bac5b7c5 100644 --- a/data/synapse-data-db2/pom.xml +++ b/data/synapse-data-db2/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse data - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 @@ -43,7 +43,7 @@ jcc - org.hibernate + org.hibernate.orm hibernate-core diff --git a/data/synapse-data-mongodb/pom.xml b/data/synapse-data-mongodb/pom.xml index 1ffbb1afa..3eba54c19 100644 --- a/data/synapse-data-mongodb/pom.xml +++ b/data/synapse-data-mongodb/pom.xml @@ -17,7 +17,7 @@ data io.americanexpress.synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/data/synapse-data-mssql/pom.xml b/data/synapse-data-mssql/pom.xml index b02dd7032..cd7ce1e57 100644 --- a/data/synapse-data-mssql/pom.xml +++ b/data/synapse-data-mssql/pom.xml @@ -19,7 +19,7 @@ io.americanexpress.synapse data - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT synapse-data-mssql diff --git a/data/synapse-data-mysql/pom.xml b/data/synapse-data-mysql/pom.xml index 083309b2b..c045c7456 100644 --- a/data/synapse-data-mysql/pom.xml +++ b/data/synapse-data-mysql/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse data - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 @@ -27,8 +27,8 @@ - mysql - mysql-connector-java + com.mysql + mysql-connector-j diff --git a/data/synapse-data-oracle/pom.xml b/data/synapse-data-oracle/pom.xml index 71ddf0fc0..ac746794e 100644 --- a/data/synapse-data-oracle/pom.xml +++ b/data/synapse-data-oracle/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse data - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/data/synapse-data-postgres/pom.xml b/data/synapse-data-postgres/pom.xml index 56b354fbe..931689703 100644 --- a/data/synapse-data-postgres/pom.xml +++ b/data/synapse-data-postgres/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse data - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 @@ -55,7 +55,7 @@ - net.sf.ehcache + org.ehcache ehcache diff --git a/data/synapse-data-postgres/src/main/java/io/americanexpress/synapse/data/postgres/config/BasePostgresDataConfig.java b/data/synapse-data-postgres/src/main/java/io/americanexpress/synapse/data/postgres/config/BasePostgresDataConfig.java index e985dc84b..0dfaedb16 100644 --- a/data/synapse-data-postgres/src/main/java/io/americanexpress/synapse/data/postgres/config/BasePostgresDataConfig.java +++ b/data/synapse-data-postgres/src/main/java/io/americanexpress/synapse/data/postgres/config/BasePostgresDataConfig.java @@ -80,7 +80,7 @@ private Properties additionalHibernateSpringProperties() { properties.setProperty("hibernate.format_sql", environment.getRequiredProperty("hibernate.format_sql")); properties.setProperty("spring.datasource.initialization-mode", environment.getRequiredProperty("spring.datasource.initialization-mode")); properties.setProperty("hibernate.cache.use_query_cache", "true"); - properties.setProperty("hibernate.cache.provider_class", "net.sf.ehcache.hibernate.EhCacheProvider"); + properties.setProperty("hibernate.cache.provider_class", "org.ehcache.hibernate.EhCacheProvider"); return properties; } diff --git a/data/synapse-data-redis/pom.xml b/data/synapse-data-redis/pom.xml index 0fda642d1..eef6e592c 100644 --- a/data/synapse-data-redis/pom.xml +++ b/data/synapse-data-redis/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse data - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/docs/docs/real_docs/synapse.md b/docs/docs/real_docs/synapse.md index 90ec1b58d..c7449087a 100644 --- a/docs/docs/real_docs/synapse.md +++ b/docs/docs/real_docs/synapse.md @@ -123,7 +123,7 @@ The following listing shows the pom.xml file that is created when you choose Mav com.example service - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/framework/pom.xml b/framework/pom.xml index 9b8772048..9395d0738 100644 --- a/framework/pom.xml +++ b/framework/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/framework/synapse-framework-api-docs/pom.xml b/framework/synapse-framework-api-docs/pom.xml index bfe619e34..2471d284a 100644 --- a/framework/synapse-framework-api-docs/pom.xml +++ b/framework/synapse-framework-api-docs/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse framework - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 @@ -28,28 +28,42 @@ org.springdoc - springdoc-openapi-ui + springdoc-openapi-starter-common org.springdoc - springdoc-openapi-webmvc-core + springdoc-openapi-starter-webmvc-api + runtime true org.springdoc - springdoc-openapi-webflux-ui + springdoc-openapi-starter-webmvc-ui + runtime true org.springdoc - springdoc-openapi-data-rest + springdoc-openapi-starter-webflux-api + runtime true org.springdoc - springdoc-openapi-native + springdoc-openapi-starter-webflux-ui + runtime true + + + org.springframework + spring-context + + + + io.swagger.core.v3 + swagger-models-jakarta + diff --git a/framework/synapse-framework-api-docs/src/main/java/io/americanexpress/synapse/framework/api/docs/ApiDocsConfig.java b/framework/synapse-framework-api-docs/src/main/java/io/americanexpress/synapse/framework/api/docs/ApiDocsConfig.java index 280657429..4ff68f514 100644 --- a/framework/synapse-framework-api-docs/src/main/java/io/americanexpress/synapse/framework/api/docs/ApiDocsConfig.java +++ b/framework/synapse-framework-api-docs/src/main/java/io/americanexpress/synapse/framework/api/docs/ApiDocsConfig.java @@ -14,12 +14,11 @@ package io.americanexpress.synapse.framework.api.docs; import io.swagger.v3.oas.models.Components; -import io.swagger.v3.oas.models.ExternalDocumentation; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.info.Contact; import io.swagger.v3.oas.models.info.Info; import io.swagger.v3.oas.models.info.License; -import org.springdoc.core.GroupedOpenApi; +import org.springdoc.core.models.GroupedOpenApi; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/framework/synapse-framework-exception/pom.xml b/framework/synapse-framework-exception/pom.xml index c8dd1aadf..2dd0b784f 100644 --- a/framework/synapse-framework-exception/pom.xml +++ b/framework/synapse-framework-exception/pom.xml @@ -18,7 +18,7 @@ io.americanexpress.synapse framework - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 @@ -32,39 +32,25 @@ spring-beans - org.junit.platform - junit-platform-suite-api + org.springframework + spring-context - junit - junit + org.springframework + spring-core + org.junit.jupiter junit-jupiter-api - - - org.junit.jupiter - junit-jupiter-engine + test org.junit.platform - junit-platform-runner - - - org.springframework.boot - spring-boot-starter - - - org.springframework.boot - spring-boot-starter-logging - - - - - org.springframework - spring-web + junit-platform-suite-api + test + diff --git a/framework/synapse-framework-exception/src/main/java/io/americanexpress/synapse/framework/exception/model/ErrorCode.java b/framework/synapse-framework-exception/src/main/java/io/americanexpress/synapse/framework/exception/model/ErrorCode.java index 339398bfd..ebda11b21 100644 --- a/framework/synapse-framework-exception/src/main/java/io/americanexpress/synapse/framework/exception/model/ErrorCode.java +++ b/framework/synapse-framework-exception/src/main/java/io/americanexpress/synapse/framework/exception/model/ErrorCode.java @@ -13,8 +13,6 @@ */ package io.americanexpress.synapse.framework.exception.model; -import org.springframework.http.HttpStatus; - /** * {@code ErrorCode} enum is used to return to the consumer a specific error message. *

@@ -68,7 +66,12 @@ public enum ErrorCode { /** * Used for when the consumer makes a request to a locked resource. */ - LOCKED(HttpStatus.LOCKED, "Locked."); + LOCKED(HttpStatus.LOCKED, "Locked."), + + /** + * Used for when the consumer makes a request with change in the Entity State. + */ + RESOURCE_OUT_OF_SYNC(HttpStatus.CONFLICT, "Resource out of sync."); /** * Gets the HttpStatus of the ErrorCode. diff --git a/framework/synapse-framework-exception/src/main/java/io/americanexpress/synapse/framework/exception/model/HttpStatus.java b/framework/synapse-framework-exception/src/main/java/io/americanexpress/synapse/framework/exception/model/HttpStatus.java new file mode 100644 index 000000000..71ae78e08 --- /dev/null +++ b/framework/synapse-framework-exception/src/main/java/io/americanexpress/synapse/framework/exception/model/HttpStatus.java @@ -0,0 +1,234 @@ +/* + * Copyright 2020 American Express Travel Related Services Company, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.americanexpress.synapse.framework.exception.model; + +import org.springframework.lang.Nullable; + +/** + * This class was added to avoid a dependency on spring-web and will be removed with the redesign of the exception handling. + */ +@Deprecated(since = "0.4.0", forRemoval = true) +public enum HttpStatus { + CONTINUE(100, HttpStatus.Series.INFORMATIONAL, "Continue"), + SWITCHING_PROTOCOLS(101, HttpStatus.Series.INFORMATIONAL, "Switching Protocols"), + PROCESSING(102, HttpStatus.Series.INFORMATIONAL, "Processing"), + EARLY_HINTS(103, HttpStatus.Series.INFORMATIONAL, "Early Hints"), + /** @deprecated */ + @Deprecated + CHECKPOINT(103, HttpStatus.Series.INFORMATIONAL, "Checkpoint"), + OK(200, HttpStatus.Series.SUCCESSFUL, "OK"), + CREATED(201, HttpStatus.Series.SUCCESSFUL, "Created"), + ACCEPTED(202, HttpStatus.Series.SUCCESSFUL, "Accepted"), + NON_AUTHORITATIVE_INFORMATION(203, HttpStatus.Series.SUCCESSFUL, "Non-Authoritative Information"), + NO_CONTENT(204, HttpStatus.Series.SUCCESSFUL, "No Content"), + RESET_CONTENT(205, HttpStatus.Series.SUCCESSFUL, "Reset Content"), + PARTIAL_CONTENT(206, HttpStatus.Series.SUCCESSFUL, "Partial Content"), + MULTI_STATUS(207, HttpStatus.Series.SUCCESSFUL, "Multi-Status"), + ALREADY_REPORTED(208, HttpStatus.Series.SUCCESSFUL, "Already Reported"), + IM_USED(226, HttpStatus.Series.SUCCESSFUL, "IM Used"), + MULTIPLE_CHOICES(300, HttpStatus.Series.REDIRECTION, "Multiple Choices"), + MOVED_PERMANENTLY(301, HttpStatus.Series.REDIRECTION, "Moved Permanently"), + FOUND(302, HttpStatus.Series.REDIRECTION, "Found"), + /** @deprecated */ + @Deprecated + MOVED_TEMPORARILY(302, HttpStatus.Series.REDIRECTION, "Moved Temporarily"), + SEE_OTHER(303, HttpStatus.Series.REDIRECTION, "See Other"), + NOT_MODIFIED(304, HttpStatus.Series.REDIRECTION, "Not Modified"), + /** @deprecated */ + @Deprecated + USE_PROXY(305, HttpStatus.Series.REDIRECTION, "Use Proxy"), + TEMPORARY_REDIRECT(307, HttpStatus.Series.REDIRECTION, "Temporary Redirect"), + PERMANENT_REDIRECT(308, HttpStatus.Series.REDIRECTION, "Permanent Redirect"), + BAD_REQUEST(400, HttpStatus.Series.CLIENT_ERROR, "Bad Request"), + UNAUTHORIZED(401, HttpStatus.Series.CLIENT_ERROR, "Unauthorized"), + PAYMENT_REQUIRED(402, HttpStatus.Series.CLIENT_ERROR, "Payment Required"), + FORBIDDEN(403, HttpStatus.Series.CLIENT_ERROR, "Forbidden"), + NOT_FOUND(404, HttpStatus.Series.CLIENT_ERROR, "Not Found"), + METHOD_NOT_ALLOWED(405, HttpStatus.Series.CLIENT_ERROR, "Method Not Allowed"), + NOT_ACCEPTABLE(406, HttpStatus.Series.CLIENT_ERROR, "Not Acceptable"), + PROXY_AUTHENTICATION_REQUIRED(407, HttpStatus.Series.CLIENT_ERROR, "Proxy Authentication Required"), + REQUEST_TIMEOUT(408, HttpStatus.Series.CLIENT_ERROR, "Request Timeout"), + CONFLICT(409, HttpStatus.Series.CLIENT_ERROR, "Conflict"), + GONE(410, HttpStatus.Series.CLIENT_ERROR, "Gone"), + LENGTH_REQUIRED(411, HttpStatus.Series.CLIENT_ERROR, "Length Required"), + PRECONDITION_FAILED(412, HttpStatus.Series.CLIENT_ERROR, "Precondition Failed"), + PAYLOAD_TOO_LARGE(413, HttpStatus.Series.CLIENT_ERROR, "Payload Too Large"), + /** @deprecated */ + @Deprecated + REQUEST_ENTITY_TOO_LARGE(413, HttpStatus.Series.CLIENT_ERROR, "Request Entity Too Large"), + URI_TOO_LONG(414, HttpStatus.Series.CLIENT_ERROR, "URI Too Long"), + /** @deprecated */ + @Deprecated + REQUEST_URI_TOO_LONG(414, HttpStatus.Series.CLIENT_ERROR, "Request-URI Too Long"), + UNSUPPORTED_MEDIA_TYPE(415, HttpStatus.Series.CLIENT_ERROR, "Unsupported Media Type"), + REQUESTED_RANGE_NOT_SATISFIABLE(416, HttpStatus.Series.CLIENT_ERROR, "Requested range not satisfiable"), + EXPECTATION_FAILED(417, HttpStatus.Series.CLIENT_ERROR, "Expectation Failed"), + I_AM_A_TEAPOT(418, HttpStatus.Series.CLIENT_ERROR, "I'm a teapot"), + /** @deprecated */ + @Deprecated + INSUFFICIENT_SPACE_ON_RESOURCE(419, HttpStatus.Series.CLIENT_ERROR, "Insufficient Space On Resource"), + /** @deprecated */ + @Deprecated + METHOD_FAILURE(420, HttpStatus.Series.CLIENT_ERROR, "Method Failure"), + /** @deprecated */ + @Deprecated + DESTINATION_LOCKED(421, HttpStatus.Series.CLIENT_ERROR, "Destination Locked"), + UNPROCESSABLE_ENTITY(422, HttpStatus.Series.CLIENT_ERROR, "Unprocessable Entity"), + LOCKED(423, HttpStatus.Series.CLIENT_ERROR, "Locked"), + FAILED_DEPENDENCY(424, HttpStatus.Series.CLIENT_ERROR, "Failed Dependency"), + TOO_EARLY(425, HttpStatus.Series.CLIENT_ERROR, "Too Early"), + UPGRADE_REQUIRED(426, HttpStatus.Series.CLIENT_ERROR, "Upgrade Required"), + PRECONDITION_REQUIRED(428, HttpStatus.Series.CLIENT_ERROR, "Precondition Required"), + TOO_MANY_REQUESTS(429, HttpStatus.Series.CLIENT_ERROR, "Too Many Requests"), + REQUEST_HEADER_FIELDS_TOO_LARGE(431, HttpStatus.Series.CLIENT_ERROR, "Request Header Fields Too Large"), + UNAVAILABLE_FOR_LEGAL_REASONS(451, HttpStatus.Series.CLIENT_ERROR, "Unavailable For Legal Reasons"), + INTERNAL_SERVER_ERROR(500, HttpStatus.Series.SERVER_ERROR, "Internal Server Error"), + NOT_IMPLEMENTED(501, HttpStatus.Series.SERVER_ERROR, "Not Implemented"), + BAD_GATEWAY(502, HttpStatus.Series.SERVER_ERROR, "Bad Gateway"), + SERVICE_UNAVAILABLE(503, HttpStatus.Series.SERVER_ERROR, "Service Unavailable"), + GATEWAY_TIMEOUT(504, HttpStatus.Series.SERVER_ERROR, "Gateway Timeout"), + HTTP_VERSION_NOT_SUPPORTED(505, HttpStatus.Series.SERVER_ERROR, "HTTP Version not supported"), + VARIANT_ALSO_NEGOTIATES(506, HttpStatus.Series.SERVER_ERROR, "Variant Also Negotiates"), + INSUFFICIENT_STORAGE(507, HttpStatus.Series.SERVER_ERROR, "Insufficient Storage"), + LOOP_DETECTED(508, HttpStatus.Series.SERVER_ERROR, "Loop Detected"), + BANDWIDTH_LIMIT_EXCEEDED(509, HttpStatus.Series.SERVER_ERROR, "Bandwidth Limit Exceeded"), + NOT_EXTENDED(510, HttpStatus.Series.SERVER_ERROR, "Not Extended"), + NETWORK_AUTHENTICATION_REQUIRED(511, HttpStatus.Series.SERVER_ERROR, "Network Authentication Required"); + + private static final HttpStatus[] VALUES = values(); + private final int value; + private final Series series; + private final String reasonPhrase; + + private HttpStatus(int value, Series series, String reasonPhrase) { + this.value = value; + this.series = series; + this.reasonPhrase = reasonPhrase; + } + + public int value() { + return this.value; + } + + public Series series() { + return this.series; + } + + public String getReasonPhrase() { + return this.reasonPhrase; + } + + public boolean is1xxInformational() { + return this.series() == HttpStatus.Series.INFORMATIONAL; + } + + public boolean is2xxSuccessful() { + return this.series() == HttpStatus.Series.SUCCESSFUL; + } + + public boolean is3xxRedirection() { + return this.series() == HttpStatus.Series.REDIRECTION; + } + + public boolean is4xxClientError() { + return this.series() == HttpStatus.Series.CLIENT_ERROR; + } + + public boolean is5xxServerError() { + return this.series() == HttpStatus.Series.SERVER_ERROR; + } + + public boolean isError() { + return this.is4xxClientError() || this.is5xxServerError(); + } + + public String toString() { + int var10000 = this.value; + return "" + var10000 + " " + this.name(); + } + + public static HttpStatus valueOf(int statusCode) { + HttpStatus status = resolve(statusCode); + if (status == null) { + throw new IllegalArgumentException("No matching constant for [" + statusCode + "]"); + } else { + return status; + } + } + + @Nullable + public static HttpStatus resolve(int statusCode) { + HttpStatus[] var1 = VALUES; + int var2 = var1.length; + + for(int var3 = 0; var3 < var2; ++var3) { + HttpStatus status = var1[var3]; + if (status.value == statusCode) { + return status; + } + } + + return null; + } + + public static enum Series { + INFORMATIONAL(1), + SUCCESSFUL(2), + REDIRECTION(3), + CLIENT_ERROR(4), + SERVER_ERROR(5); + + private final int value; + + private Series(int value) { + this.value = value; + } + + public int value() { + return this.value; + } + + /** @deprecated */ + @Deprecated + public static Series valueOf(HttpStatus status) { + return status.series; + } + + public static Series valueOf(int statusCode) { + Series series = resolve(statusCode); + if (series == null) { + throw new IllegalArgumentException("No matching constant for [" + statusCode + "]"); + } else { + return series; + } + } + + @Nullable + public static Series resolve(int statusCode) { + int seriesCode = statusCode / 100; + Series[] var2 = values(); + int var3 = var2.length; + + for(int var4 = 0; var4 < var3; ++var4) { + Series series = var2[var4]; + if (series.value == seriesCode) { + return series; + } + } + + return null; + } + } +} diff --git a/framework/synapse-framework-exception/src/main/resources/error-messages.properties b/framework/synapse-framework-exception/src/main/resources/error-messages.properties index d8550d879..c950d5657 100644 --- a/framework/synapse-framework-exception/src/main/resources/error-messages.properties +++ b/framework/synapse-framework-exception/src/main/resources/error-messages.properties @@ -19,3 +19,4 @@ MISSING_HTTP_HEADER_ERROR=Missing required HTTP header: {0}. AUTHENTICATION_ERROR=Your client does not have permission to get this URL from this server. TOO_MANY_REQUESTS=Your client has issued too many requests. LOCKED=Your client has issued a request to a locked resource. +RESOURCE_OUT_OF_SYNC=The resource you are trying to update is outdated. Please try again. diff --git a/framework/synapse-framework-exception/src/test/java/io/americanexpress/synapse/framework/exception/FrameworkExceptionUnitTestSuite.java b/framework/synapse-framework-exception/src/test/java/io/americanexpress/synapse/framework/exception/FrameworkExceptionUnitTestSuite.java index 8f3205f1a..05931d601 100644 --- a/framework/synapse-framework-exception/src/test/java/io/americanexpress/synapse/framework/exception/FrameworkExceptionUnitTestSuite.java +++ b/framework/synapse-framework-exception/src/test/java/io/americanexpress/synapse/framework/exception/FrameworkExceptionUnitTestSuite.java @@ -13,11 +13,10 @@ */ package io.americanexpress.synapse.framework.exception; -import org.junit.platform.runner.JUnitPlatform; import org.junit.platform.suite.api.SelectPackages; -import org.junit.runner.RunWith; +import org.junit.platform.suite.api.Suite; -@RunWith(JUnitPlatform.class) +@Suite @SelectPackages("com.americanexpress.synapse.framework.exception") class FrameworkExceptionUnitTestSuite { diff --git a/framework/synapse-framework-logging/pom.xml b/framework/synapse-framework-logging/pom.xml index 49b05cbd4..3a89a938a 100644 --- a/framework/synapse-framework-logging/pom.xml +++ b/framework/synapse-framework-logging/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse framework - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 @@ -25,42 +25,53 @@ - + - org.junit.jupiter - junit-jupiter-api + org.apache.logging.log4j + log4j-api + runtime - org.junit.jupiter - junit-jupiter-engine + org.apache.logging.log4j + log4j-core + runtime - org.junit.vintage - junit-vintage-engine + org.apache.logging.log4j + log4j-slf4j2-impl + runtime - org.junit.platform - junit-platform-launcher + org.apache.logging.log4j + log4j-1.2-api + runtime + + - org.junit.platform - junit-platform-runner + org.slf4j + slf4j-api - org.springframework.boot - spring-boot-starter-log4j2 + org.slf4j + slf4j-ext org.slf4j - slf4j-ext + jcl-over-slf4j + runtime - org.apache.logging.log4j - log4j-core + org.slf4j + jul-to-slf4j + runtime + + - org.apache.logging.log4j - log4j-api + org.junit.jupiter + junit-jupiter-api + test @@ -74,6 +85,14 @@ maven-dependency-plugin + + + org.slf4j:slf4j-api:jar + + + org.slf4j:slf4j-ext:jar + + maven-jar-plugin diff --git a/framework/synapse-framework-logging/src/main/resources/log4j2-test.xml b/framework/synapse-framework-logging/src/main/resources/log4j2-test.xml index 706b1ec55..a886c335d 100644 --- a/framework/synapse-framework-logging/src/main/resources/log4j2-test.xml +++ b/framework/synapse-framework-logging/src/main/resources/log4j2-test.xml @@ -1,4 +1,17 @@ + @@ -12,7 +25,7 @@ - + diff --git a/framework/synapse-framework-logging/src/main/resources/log4j2.xml b/framework/synapse-framework-logging/src/main/resources/log4j2.xml index 47f3652f3..9a71aa2cd 100644 --- a/framework/synapse-framework-logging/src/main/resources/log4j2.xml +++ b/framework/synapse-framework-logging/src/main/resources/log4j2.xml @@ -1,4 +1,17 @@ + @@ -33,7 +46,7 @@ - + diff --git a/framework/synapse-framework-test/pom.xml b/framework/synapse-framework-test/pom.xml index 04cf2c164..f7f6bb1e4 100644 --- a/framework/synapse-framework-test/pom.xml +++ b/framework/synapse-framework-test/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse framework - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 @@ -26,10 +26,6 @@ - - io.americanexpress.synapse - synapse-framework-logging - io.americanexpress.synapse synapse-framework-exception @@ -38,34 +34,17 @@ org.junit.jupiter junit-jupiter-api - - - org.junit.jupiter - junit-jupiter-engine + compile org.junit.platform - junit-platform-launcher - - - org.junit.vintage - junit-vintage-engine - - - org.junit.platform - junit-platform-runner - - - org.mockito - mockito-junit-jupiter + junit-platform-suite-api + compile org.springframework.boot spring-boot-starter-test - - - org.slf4j - slf4j-ext + compile com.openpojo diff --git a/function/function-samples/pom.xml b/function/function-samples/pom.xml index 28dcc688f..5c15b7433 100644 --- a/function/function-samples/pom.xml +++ b/function/function-samples/pom.xml @@ -4,7 +4,7 @@ io.americanexpress.synapse function - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/function/function-samples/sample-function-book-aws/pom.xml b/function/function-samples/sample-function-book-aws/pom.xml index d1533e642..1143d5873 100644 --- a/function/function-samples/sample-function-book-aws/pom.xml +++ b/function/function-samples/sample-function-book-aws/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse function-samples - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/function/function-samples/sample-function-greeter-aws/pom.xml b/function/function-samples/sample-function-greeter-aws/pom.xml index 99fe25b7d..9c0ba3948 100644 --- a/function/function-samples/sample-function-greeter-aws/pom.xml +++ b/function/function-samples/sample-function-greeter-aws/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse function-samples - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/function/function-samples/sample-function-greeter-gcp/pom.xml b/function/function-samples/sample-function-greeter-gcp/pom.xml index fb94e3c12..0f04662a5 100644 --- a/function/function-samples/sample-function-greeter-gcp/pom.xml +++ b/function/function-samples/sample-function-greeter-gcp/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse function-samples - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 @@ -40,6 +40,7 @@ org.springframework.cloud spring-cloud-function-adapter-gcp + 4.1.1 @@ -57,7 +58,7 @@ com.google.cloud.functions function-maven-plugin - 0.9.1 + 0.11.0 org.springframework.cloud.function.adapter.gcp.GcfJarLauncher 8080 diff --git a/function/function-samples/sample-function-greeting/pom.xml b/function/function-samples/sample-function-greeting/pom.xml index 27dbfe1f8..da9ed9c85 100644 --- a/function/function-samples/sample-function-greeting/pom.xml +++ b/function/function-samples/sample-function-greeting/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse function-samples - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/function/function-samples/sample-function-greeting/src/main/java/io/americanexpress/function/greeting/reactive/handler/GetMonoGreetingHandler.java b/function/function-samples/sample-function-greeting/src/main/java/io/americanexpress/function/greeting/reactive/handler/GetMonoGreetingHandler.java index 79814ca9d..f1781c38f 100644 --- a/function/function-samples/sample-function-greeting/src/main/java/io/americanexpress/function/greeting/reactive/handler/GetMonoGreetingHandler.java +++ b/function/function-samples/sample-function-greeting/src/main/java/io/americanexpress/function/greeting/reactive/handler/GetMonoGreetingHandler.java @@ -16,6 +16,6 @@ public class GetMonoGreetingHandler extends BaseGetMonoHandler { @Override protected Mono executeGet(ServerRequest request) { return ServerResponse.ok().contentType(MediaType.APPLICATION_JSON) - .body(BodyInserters.fromValue(new Greeting("Hello, Spring!!"))); + .body(BodyInserters.fromValue(new Greeting("Hello, Spring!"))); } } diff --git a/function/function-samples/sample-function-greeting/src/main/java/io/americanexpress/function/greeting/reactive/router/CreateMonoGreetingRouter.java b/function/function-samples/sample-function-greeting/src/main/java/io/americanexpress/function/greeting/reactive/router/CreateMonoGreetingRouter.java index 478b865f4..8d051cabe 100644 --- a/function/function-samples/sample-function-greeting/src/main/java/io/americanexpress/function/greeting/reactive/router/CreateMonoGreetingRouter.java +++ b/function/function-samples/sample-function-greeting/src/main/java/io/americanexpress/function/greeting/reactive/router/CreateMonoGreetingRouter.java @@ -1,15 +1,14 @@ -//package io.americanexpress.function.greeting.reactive.router; -// -//import io.americanexpress.function.greeting.reactive.handler.CreateMonoGreetingHandler; -//import io.americanexpress.synapse.function.reactive.router.BaseCreateMonoRouter; -//import io.americanexpress.synapse.function.reactive.router.BaseReadMonoRouter; -//import org.springframework.context.annotation.Configuration; -// -//@Configuration -//public class CreateMonoGreetingRouter extends BaseCreateMonoRouter { -// -// @Override -// protected void setEndpoint(String endpoint) { -// BaseCreateMonoRouter.endpoint = "/hello"; -// } -//} +package io.americanexpress.function.greeting.reactive.router; + +import io.americanexpress.function.greeting.reactive.handler.CreateMonoGreetingHandler; +import io.americanexpress.synapse.function.reactive.router.BaseCreateMonoRouter; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class CreateMonoGreetingRouter extends BaseCreateMonoRouter { + + @Override + public String getEndpoint() { + return "/hello"; + } +} diff --git a/function/function-samples/sample-function-greeting/src/main/java/io/americanexpress/function/greeting/reactive/router/DeleteMonoGreetingRouter.java b/function/function-samples/sample-function-greeting/src/main/java/io/americanexpress/function/greeting/reactive/router/DeleteMonoGreetingRouter.java index 509a4a1db..872d14e2c 100644 --- a/function/function-samples/sample-function-greeting/src/main/java/io/americanexpress/function/greeting/reactive/router/DeleteMonoGreetingRouter.java +++ b/function/function-samples/sample-function-greeting/src/main/java/io/americanexpress/function/greeting/reactive/router/DeleteMonoGreetingRouter.java @@ -9,7 +9,7 @@ public class DeleteMonoGreetingRouter extends BaseDeleteMonoRouter { @Override - protected void setEndpoint(String endpoint) { - BaseDeleteMonoRouter.endpoint = "/hello"; + public String getEndpoint() { + return "/hello"; } } diff --git a/function/function-samples/sample-function-greeting/src/main/java/io/americanexpress/function/greeting/reactive/router/GetMonoGreetingRouter.java b/function/function-samples/sample-function-greeting/src/main/java/io/americanexpress/function/greeting/reactive/router/GetMonoGreetingRouter.java index 4cfe63659..75add64ee 100644 --- a/function/function-samples/sample-function-greeting/src/main/java/io/americanexpress/function/greeting/reactive/router/GetMonoGreetingRouter.java +++ b/function/function-samples/sample-function-greeting/src/main/java/io/americanexpress/function/greeting/reactive/router/GetMonoGreetingRouter.java @@ -8,7 +8,7 @@ public class GetMonoGreetingRouter extends BaseGetMonoRouter { @Override - protected void setEndpoint(String endpoint) { - BaseGetMonoRouter.endpoint = "hello"; + public String getEndpoint() { + return "/hello"; } } diff --git a/function/function-samples/sample-function-greeting/src/main/java/io/americanexpress/function/greeting/reactive/router/ReadMonoGreetingRouter.java b/function/function-samples/sample-function-greeting/src/main/java/io/americanexpress/function/greeting/reactive/router/ReadMonoGreetingRouter.java index c82cde026..1b6b258a4 100644 --- a/function/function-samples/sample-function-greeting/src/main/java/io/americanexpress/function/greeting/reactive/router/ReadMonoGreetingRouter.java +++ b/function/function-samples/sample-function-greeting/src/main/java/io/americanexpress/function/greeting/reactive/router/ReadMonoGreetingRouter.java @@ -8,7 +8,7 @@ public class ReadMonoGreetingRouter extends BaseReadMonoRouter { @Override - protected void setEndpoint(String endpoint) { - BaseReadMonoRouter.endpoint = "/hello"; + public String getEndpoint() { + return "/hello"; } } diff --git a/function/function-samples/sample-function-greeting/src/main/java/io/americanexpress/function/greeting/reactive/router/UpdateMonoGreetingRouter.java b/function/function-samples/sample-function-greeting/src/main/java/io/americanexpress/function/greeting/reactive/router/UpdateMonoGreetingRouter.java index 0bdfe1e6c..ca3dbece9 100644 --- a/function/function-samples/sample-function-greeting/src/main/java/io/americanexpress/function/greeting/reactive/router/UpdateMonoGreetingRouter.java +++ b/function/function-samples/sample-function-greeting/src/main/java/io/americanexpress/function/greeting/reactive/router/UpdateMonoGreetingRouter.java @@ -8,7 +8,7 @@ public class UpdateMonoGreetingRouter extends BaseUpdateMonoRouter { @Override - protected void setEndpoint(String endpoint) { - BaseUpdateMonoRouter.endpoint = "/hello"; + public String getEndpoint() { + return "/hello"; } } diff --git a/function/function-samples/sample-function-greeting/src/test/java/io/americanexpress/function/greeting/rest/GreetingRouterTest.java b/function/function-samples/sample-function-greeting/src/test/java/io/americanexpress/function/greeting/rest/GreetingRouterTest.java index 5cfc89875..f3d880c4a 100644 --- a/function/function-samples/sample-function-greeting/src/test/java/io/americanexpress/function/greeting/rest/GreetingRouterTest.java +++ b/function/function-samples/sample-function-greeting/src/test/java/io/americanexpress/function/greeting/rest/GreetingRouterTest.java @@ -1,9 +1,13 @@ package io.americanexpress.function.greeting.rest; +import io.americanexpress.function.greeting.reactive.Application; +import io.americanexpress.function.greeting.reactive.handler.GetMonoGreetingHandler; import io.americanexpress.function.greeting.reactive.model.Greeting; +import io.americanexpress.function.greeting.reactive.router.GetMonoGreetingRouter; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; import org.springframework.test.context.junit.jupiter.SpringExtension; @@ -11,9 +15,10 @@ import static org.assertj.core.api.Assertions.assertThat; +@EnableAutoConfiguration @ExtendWith(SpringExtension.class) // We create a `@SpringBootTest`, starting an actual server on a `RANDOM_PORT` -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@SpringBootTest(classes = { Application.class }, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class GreetingRouterTest { // Spring Boot will create a `WebTestClient` for you, diff --git a/function/function-samples/sample-function-rest-book/pom.xml b/function/function-samples/sample-function-rest-book/pom.xml index 45b2b00e3..d16a9b91b 100644 --- a/function/function-samples/sample-function-rest-book/pom.xml +++ b/function/function-samples/sample-function-rest-book/pom.xml @@ -17,11 +17,11 @@ io.americanexpress.synapse function-samples - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 - sample-function-book + sample-function-rest-book @@ -60,14 +60,14 @@ org.springframework.cloud spring-cloud-function-adapter-gcp - 3.2.8 + 4.1.1 com.google.cloud.functions function-maven-plugin - 0.9.1 + 0.11.0 org.springframework.cloud.function.adapter.gcp.GcfJarLauncher 8080 diff --git a/function/function-samples/sample-function-rest-book/src/main/java/io/americanexpress/function/book/rest/router/BookCrudMonoRouter.java b/function/function-samples/sample-function-rest-book/src/main/java/io/americanexpress/function/book/rest/router/BookCrudMonoRouter.java index 405b5af08..362b56ce7 100644 --- a/function/function-samples/sample-function-rest-book/src/main/java/io/americanexpress/function/book/rest/router/BookCrudMonoRouter.java +++ b/function/function-samples/sample-function-rest-book/src/main/java/io/americanexpress/function/book/rest/router/BookCrudMonoRouter.java @@ -7,10 +7,8 @@ @Configuration public class BookCrudMonoRouter extends BaseCrudMonoRouter { - private String endpoint = "books"; - - @Override - protected void setEndpoint(String endpoint) { - this.setEndpoint(endpoint); - } + @Override + public String getEndpoint() { + return "/books"; + } } diff --git a/function/pom.xml b/function/pom.xml index 04d3ad2fa..030c772be 100644 --- a/function/pom.xml +++ b/function/pom.xml @@ -4,7 +4,7 @@ io.americanexpress.synapse synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/function/synapse-function/pom.xml b/function/synapse-function/pom.xml index 510b4558d..bc63355fa 100644 --- a/function/synapse-function/pom.xml +++ b/function/synapse-function/pom.xml @@ -18,7 +18,7 @@ io.americanexpress.synapse function - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 @@ -30,85 +30,74 @@ io.americanexpress.synapse synapse-framework-logging + runtime io.americanexpress.synapse synapse-framework-exception - - io.americanexpress.synapse - synapse-framework-api-docs - io.americanexpress.synapse synapse-framework-test + org.junit.jupiter junit-jupiter-api - org.junit.jupiter - junit-jupiter-engine + org.junit.platform + junit-platform-suite-api + + - io.swagger - swagger-annotations + org.springframework + spring-beans - - - - - - - - - - - - - - org.springframework.boot - spring-boot-starter-webflux + spring-boot - org.springframework.security - spring-security-test + org.springframework.boot + spring-boot-autoconfigure - org.springframework.boot - spring-boot-starter + org.springframework + spring-core - org.springframework.boot - spring-boot-starter-data-rest + org.springframework + spring-context - org.springframework.boot - spring-boot-starter-web + org.springframework + spring-web - org.springframework.boot - spring-boot-starter-aop + org.springframework + spring-webflux + + + + + + org.slf4j + slf4j-ext + - org.springframework.boot - spring-boot-starter-test - - - junit - junit - - + io.projectreactor + reactor-core + - org.springframework.boot - spring-boot-starter-actuator + io.swagger.core.v3 + swagger-annotations-jakarta diff --git a/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/config/FunctionConfig.java b/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/config/FunctionConfig.java index 36cd85fe6..a383a19e0 100644 --- a/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/config/FunctionConfig.java +++ b/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/config/FunctionConfig.java @@ -13,7 +13,6 @@ */ package io.americanexpress.synapse.function.reactive.config; -import io.americanexpress.synapse.framework.api.docs.ApiDocsConfig; import io.americanexpress.synapse.framework.exception.config.ExceptionConfig; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -26,7 +25,7 @@ */ @Configuration @ComponentScan(basePackages = "io.americanexpress.synapse.function.reactive") -@Import({ExceptionConfig.class, ApiDocsConfig.class}) +@Import(ExceptionConfig.class) public class FunctionConfig { } diff --git a/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/model/ServiceRouting.java b/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/model/ServiceRouting.java index 949680d05..f56eb5806 100644 --- a/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/model/ServiceRouting.java +++ b/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/model/ServiceRouting.java @@ -13,8 +13,7 @@ */ package io.americanexpress.synapse.function.reactive.model; -import io.swagger.annotations.ApiModelProperty; - +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Objects; /** @@ -43,7 +42,7 @@ public ServiceRouting() { * * @return the client identifier. */ - @ApiModelProperty(value = "Unique client id assigned to the consumer") + @Schema(description = "Unique client id assigned to the consumer") public String getClientId() { return clientId; } diff --git a/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/model/ServiceTrace.java b/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/model/ServiceTrace.java index 7e936c4b6..316a9a1d3 100644 --- a/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/model/ServiceTrace.java +++ b/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/model/ServiceTrace.java @@ -13,8 +13,7 @@ */ package io.americanexpress.synapse.function.reactive.model; -import io.swagger.annotations.ApiModelProperty; - +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Objects; /** @@ -42,7 +41,7 @@ public ServiceTrace() { * * @return the correlationId */ - @ApiModelProperty(value = "This is a unique identifier used for operational logging purposes") + @Schema(description = "This is a unique identifier used for operational logging purposes") public String getCorrelationId() { return correlationId; } diff --git a/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseCreateMonoRouter.java b/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseCreateMonoRouter.java index 39d3dd2a7..23c7a20c0 100644 --- a/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseCreateMonoRouter.java +++ b/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseCreateMonoRouter.java @@ -14,9 +14,9 @@ package io.americanexpress.synapse.function.reactive.router; import io.americanexpress.synapse.function.reactive.handler.BaseCreateMonoHandler; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import org.springframework.context.annotation.Bean; import org.springframework.http.MediaType; import org.springframework.web.reactive.function.server.RouterFunction; @@ -35,21 +35,18 @@ */ public abstract class BaseCreateMonoRouter extends BaseRouter { - public static String endpoint = "not_a_valid_endpoint"; - /** * Get a single resource from the back end service. * * @param handler body from the consumer * @return a single resource from the back end service */ - @ApiOperation(value = "Reactive Create Mono", notes = "Create one resource") + @Operation(description = "Reactive Create Mono", summary = "Create one resource") @ApiResponses(value = { - @ApiResponse(code = 200, message = "Ok"), - @ApiResponse(code = 204, message = "No Content"), - @ApiResponse(code = 400, message = "Bad Request"), - @ApiResponse(code = 401, message = "Unauthorized"), - @ApiResponse(code = 403, message = "Forbidden"), + @ApiResponse(responseCode = "201", description = "Created"), + @ApiResponse(responseCode = "400", description = "Bad Request"), + @ApiResponse(responseCode = "401", description = "Unauthorized"), + @ApiResponse(responseCode = "403", description = "Forbidden"), }) @Bean public RouterFunction createRoute(S handler) { @@ -62,9 +59,5 @@ public RouterFunction createRoute(S handler) { return routerResponse; } - private String getEndpoint() { - return endpoint; - } - - protected abstract void setEndpoint(String endpoint); + public abstract String getEndpoint(); } diff --git a/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseCrudMonoRouter.java b/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseCrudMonoRouter.java index 6053157e5..35f8e1564 100644 --- a/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseCrudMonoRouter.java +++ b/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseCrudMonoRouter.java @@ -14,9 +14,9 @@ package io.americanexpress.synapse.function.reactive.router; import io.americanexpress.synapse.function.reactive.handler.BaseCrudMonoHandler; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.MediaType; @@ -37,24 +37,20 @@ @Configuration public abstract class BaseCrudMonoRouter extends BaseRouter { - private String endpoint = "books"; - - /** * Get a single resource from the back end service. * * @param handler body from the consumer * @return a single resource from the back end service */ - @ApiOperation(value = "Reactive Create Mono", notes = "Create one resource") + @Operation(description = "Reactive Create Mono", summary = "Create one resource") @ApiResponses(value = { - @ApiResponse(code = 200, message = "Ok"), - @ApiResponse(code = 204, message = "No Content"), - @ApiResponse(code = 400, message = "Bad Request"), - @ApiResponse(code = 401, message = "Unauthorized"), - @ApiResponse(code = 403, message = "Forbidden"), + @ApiResponse(responseCode = "200", description = "Ok"), + @ApiResponse(responseCode = "204", description = "No Content"), + @ApiResponse(responseCode = "400", description = "Bad Request"), + @ApiResponse(responseCode = "401", description = "Unauthorized"), + @ApiResponse(responseCode = "403", description = "Forbidden"), }) - @Bean public RouterFunction crudRoute(S handler) { logger.entry(handler); @@ -72,9 +68,5 @@ public RouterFunction crudRoute(S handler) { return routerResponse; } - private String getEndpoint() { - return endpoint; - } - - protected abstract void setEndpoint(String endpoint); + public abstract String getEndpoint(); } diff --git a/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseDeleteMonoRouter.java b/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseDeleteMonoRouter.java index 22392f2e0..c42462286 100644 --- a/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseDeleteMonoRouter.java +++ b/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseDeleteMonoRouter.java @@ -14,15 +14,16 @@ package io.americanexpress.synapse.function.reactive.router; import io.americanexpress.synapse.function.reactive.handler.BaseDeleteMonoHandler; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import org.springframework.context.annotation.Bean; import org.springframework.http.MediaType; import org.springframework.web.reactive.function.server.RouterFunction; import org.springframework.web.reactive.function.server.RouterFunctions; import org.springframework.web.reactive.function.server.ServerResponse; +import static org.springframework.web.reactive.function.server.RequestPredicates.DELETE; import static org.springframework.web.reactive.function.server.RequestPredicates.POST; import static org.springframework.web.reactive.function.server.RequestPredicates.accept; @@ -35,36 +36,30 @@ */ public abstract class BaseDeleteMonoRouter extends BaseRouter { - public static String endpoint = "not_a_valid_endpoint"; - /** * Get a single resource from the back end service. * * @param handler body from the consumer * @return a single resource from the back end service */ - @ApiOperation(value = "Reactive Delete Mono", notes = "Delete one resource") + @Operation(description = "Reactive Delete Mono", summary = "Delete one resource") @ApiResponses(value = { - @ApiResponse(code = 200, message = "Ok"), - @ApiResponse(code = 204, message = "No Content"), - @ApiResponse(code = 400, message = "Bad Request"), - @ApiResponse(code = 401, message = "Unauthorized"), - @ApiResponse(code = 403, message = "Forbidden"), + @ApiResponse(responseCode = "200", description = "Ok"), + @ApiResponse(responseCode = "204", description = "No Content"), + @ApiResponse(responseCode = "400", description = "Bad Request"), + @ApiResponse(responseCode = "401", description = "Unauthorized"), + @ApiResponse(responseCode = "403", description = "Forbidden"), }) @Bean public RouterFunction deleteRoute(S handler) { logger.entry(handler); RouterFunction routerResponse = RouterFunctions - .route(POST(getEndpoint()).and(accept(MediaType.APPLICATION_JSON)), handler::delete); + .route(DELETE(getEndpoint()).and(accept(MediaType.APPLICATION_JSON)), handler::delete); logger.exit(); return routerResponse; } - private String getEndpoint() { - return endpoint; - } - - protected abstract void setEndpoint(String endpoint); + public abstract String getEndpoint(); } diff --git a/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseGetMonoRouter.java b/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseGetMonoRouter.java index f893d8d89..a7339eb5f 100644 --- a/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseGetMonoRouter.java +++ b/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseGetMonoRouter.java @@ -14,9 +14,9 @@ package io.americanexpress.synapse.function.reactive.router; import io.americanexpress.synapse.function.reactive.handler.BaseGetMonoHandler; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import org.springframework.context.annotation.Bean; import org.springframework.http.MediaType; import org.springframework.web.reactive.function.server.RouterFunction; @@ -35,32 +35,25 @@ */ public abstract class BaseGetMonoRouter extends BaseRouter { - public static String endpoint = "not_a_valid_endpoint"; - /** * Get a single resource from the back end service. * * @param handler body from the consumer * @return a single resource from the back end service */ - @ApiOperation(value = "Reactive Get Mono", notes = "Get one resource") + @Operation(description = "Reactive Get Mono", summary = "Get one resource") @ApiResponses(value = { - @ApiResponse(code = 200, message = "Ok"), - @ApiResponse(code = 204, message = "No Content"), - @ApiResponse(code = 400, message = "Bad Request"), - @ApiResponse(code = 401, message = "Unauthorized"), - @ApiResponse(code = 403, message = "Forbidden"), + @ApiResponse(responseCode = "200", description = "Ok"), + @ApiResponse(responseCode = "204", description = "No Content"), + @ApiResponse(responseCode = "400", description = "Bad Request"), + @ApiResponse(responseCode = "401", description = "Unauthorized"), + @ApiResponse(responseCode = "403", description = "Forbidden"), }) - @Bean public RouterFunction route(S handler) { return RouterFunctions .route(GET(getEndpoint()).and(accept(MediaType.APPLICATION_JSON)), handler::get); } - private String getEndpoint() { - return endpoint; - } - - protected abstract void setEndpoint(String endpoint); + public abstract String getEndpoint(); } diff --git a/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseReadMonoRouter.java b/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseReadMonoRouter.java index 5a4eaeb45..666fc8a76 100644 --- a/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseReadMonoRouter.java +++ b/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseReadMonoRouter.java @@ -14,9 +14,9 @@ package io.americanexpress.synapse.function.reactive.router; import io.americanexpress.synapse.function.reactive.handler.BaseReadMonoHandler; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import org.springframework.context.annotation.Bean; import org.springframework.http.MediaType; import org.springframework.web.reactive.function.server.RouterFunction; @@ -37,21 +37,19 @@ public abstract class BaseReadMonoRouter extends public static final String INQUIRY_RESULTS = "/inquiry_results"; - public static String endpoint = "not_a_valid_endpoint"; - /** * Get a single resource from the back end service. * * @param handler body from the consumer * @return a single resource from the back end service */ - @ApiOperation(value = "Reactive Read Mono", notes = "Gets one resource") + @Operation(description = "Reactive Read Mono", summary = "Gets one resource") @ApiResponses(value = { - @ApiResponse(code = 200, message = "Ok"), - @ApiResponse(code = 204, message = "No Content"), - @ApiResponse(code = 400, message = "Bad Request"), - @ApiResponse(code = 401, message = "Unauthorized"), - @ApiResponse(code = 403, message = "Forbidden"), + @ApiResponse(responseCode = "200", description = "Ok"), + @ApiResponse(responseCode = "204", description = "No Content"), + @ApiResponse(responseCode = "400", description = "Bad Request"), + @ApiResponse(responseCode = "401", description = "Unauthorized"), + @ApiResponse(responseCode = "403", description = "Forbidden"), }) @Bean @@ -59,12 +57,8 @@ public RouterFunction readRoute(S handler) { logger.entry(handler); return RouterFunctions - .route(POST(getEndpoint()).and(accept(MediaType.APPLICATION_JSON)), handler::read); - } - - private String getEndpoint() { - return endpoint + INQUIRY_RESULTS; + .route(POST(getEndpoint() + INQUIRY_RESULTS).and(accept(MediaType.APPLICATION_JSON)), handler::read); } - protected abstract void setEndpoint(String endpoint); + public abstract String getEndpoint(); } diff --git a/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseReadPolyRouter.java b/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseReadPolyRouter.java index d6bd33fca..b388c9776 100644 --- a/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseReadPolyRouter.java +++ b/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseReadPolyRouter.java @@ -14,9 +14,9 @@ package io.americanexpress.synapse.function.reactive.router; import io.americanexpress.synapse.function.reactive.handler.BaseReadPolyHandler; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import org.springframework.context.annotation.Bean; import org.springframework.http.MediaType; import org.springframework.web.reactive.function.server.RouterFunction; @@ -35,9 +35,7 @@ */ public abstract class BaseReadPolyRouter extends BaseRouter { - public static final String INQUIRY_RESULTS = "/multiple_results"; - - public static String endpoint = "not_a_valid_endpoint"; + public static final String MULTIPLE_RESULTS = "/multiple_results"; /** * Get a single resource from the back end service. @@ -45,24 +43,20 @@ public abstract class BaseReadPolyRouter extends * @param handler body from the consumer * @return a single resource from the back end service */ - @ApiOperation(value = "Reactive Read Mono", notes = "Gets one resource") + @Operation(description = "Reactive Read Mono", summary = "Gets one resource") @ApiResponses(value = { - @ApiResponse(code = 200, message = "Ok"), - @ApiResponse(code = 204, message = "No Content"), - @ApiResponse(code = 400, message = "Bad Request"), - @ApiResponse(code = 401, message = "Unauthorized"), - @ApiResponse(code = 403, message = "Forbidden"), + @ApiResponse(responseCode = "200", description = "Ok"), + @ApiResponse(responseCode = "204", description = "No Content"), + @ApiResponse(responseCode = "400", description = "Bad Request"), + @ApiResponse(responseCode = "401", description = "Unauthorized"), + @ApiResponse(responseCode = "403", description = "Forbidden"), }) @Bean public RouterFunction routePoly(S handler) { return RouterFunctions - .route(GET(getEndpoint()).and(accept(MediaType.APPLICATION_JSON)), handler::read); - } - - private String getEndpoint() { - return endpoint; + .route(GET(getEndpoint() + MULTIPLE_RESULTS).and(accept(MediaType.APPLICATION_JSON)), handler::read); } - protected abstract void setEndpoint(String endpoint); + public abstract String getEndpoint(); } diff --git a/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseRouter.java b/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseRouter.java index f61845d8b..c08c8f0d0 100644 --- a/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseRouter.java +++ b/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseRouter.java @@ -20,12 +20,11 @@ public abstract class BaseRouter { + protected final XLogger logger = XLoggerFactory.getXLogger(this.getClass()); + /** * Service that will be called to get a single resource or multiple resources. */ @Autowired protected S service; - - protected final XLogger logger = XLoggerFactory.getXLogger(this.getClass()); - } diff --git a/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseUpdateMonoRouter.java b/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseUpdateMonoRouter.java index 91981d3fb..f867f1087 100644 --- a/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseUpdateMonoRouter.java +++ b/function/synapse-function/src/main/java/io/americanexpress/synapse/function/reactive/router/BaseUpdateMonoRouter.java @@ -14,9 +14,9 @@ package io.americanexpress.synapse.function.reactive.router; import io.americanexpress.synapse.function.reactive.handler.BaseUpdateMonoHandler; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import org.springframework.context.annotation.Bean; import org.springframework.http.MediaType; import org.springframework.web.reactive.function.server.RouterFunction; @@ -35,21 +35,19 @@ */ public abstract class BaseUpdateMonoRouter extends BaseRouter { - public static String endpoint = "not_a_valid_endpoint"; - /** * Update a single resource from the back end service. * * @param handler body from the consumer * @return a single resource from the back end service */ - @ApiOperation(value = "Reactive Update Mono", notes = "Updates one resource") + @Operation(description = "Reactive Update Mono", summary = "Updates one resource") @ApiResponses(value = { - @ApiResponse(code = 200, message = "Ok"), - @ApiResponse(code = 204, message = "No Content"), - @ApiResponse(code = 400, message = "Bad Request"), - @ApiResponse(code = 401, message = "Unauthorized"), - @ApiResponse(code = 403, message = "Forbidden"), + @ApiResponse(responseCode = "200", description = "Ok"), + @ApiResponse(responseCode = "204", description = "No Content"), + @ApiResponse(responseCode = "400", description = "Bad Request"), + @ApiResponse(responseCode = "401", description = "Unauthorized"), + @ApiResponse(responseCode = "403", description = "Forbidden"), }) @Bean public RouterFunction updateRoute(S handler) { @@ -62,9 +60,5 @@ public RouterFunction updateRoute(S handler) { return routerResponse; } - private String getEndpoint() { - return endpoint; - } - - protected abstract void setEndpoint(String endpoint); + public abstract String getEndpoint(); } diff --git a/function/synapse-function/src/test/java/io/americanexpress/synapse/service/rest/ServiceRestUnitTestSuite.java b/function/synapse-function/src/test/java/io/americanexpress/synapse/service/rest/ServiceRestUnitTestSuite.java deleted file mode 100644 index d236ebb46..000000000 --- a/function/synapse-function/src/test/java/io/americanexpress/synapse/service/rest/ServiceRestUnitTestSuite.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2020 American Express Travel Related Services Company, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package io.americanexpress.synapse.function.rest; - -import org.junit.platform.runner.JUnitPlatform; -import org.junit.platform.suite.api.SelectPackages; -import org.junit.runner.RunWith; - -@RunWith(JUnitPlatform.class) -@SelectPackages("io.americanexpress.synapse.function.rest") -public class ServiceRestUnitTestSuite { -} diff --git a/function/synapse-function/src/test/java/io/americanexpress/synapse/service/rest/interceptor/BaseHttpInterceptorTest.java b/function/synapse-function/src/test/java/io/americanexpress/synapse/service/rest/interceptor/BaseHttpInterceptorTest.java deleted file mode 100644 index c357e7682..000000000 --- a/function/synapse-function/src/test/java/io/americanexpress/synapse/service/rest/interceptor/BaseHttpInterceptorTest.java +++ /dev/null @@ -1,61 +0,0 @@ -///* -// * Copyright 2020 American Express Travel Related Services Company, Inc. -// * -// * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except -// * in compliance with the License. You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software distributed under the License -// * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express -// * or implied. See the License for the specific language governing permissions and limitations under -// * the License. -// */ -//package io.americanexpress.synapse.service.rest.interceptor; -// -//import io.americanexpress.synapse.framework.exception.ApplicationClientException; -//import org.junit.jupiter.api.BeforeEach; -//import org.junit.jupiter.api.Test; -// -//import jakarta.servlet.http.HttpServletRequest; -//import java.util.Arrays; -// -//import static org.junit.jupiter.api.Assertions.assertThrows; -//import static org.junit.jupiter.api.Assertions.assertTrue; -//import static org.mockito.Mockito.CALLS_REAL_METHODS; -//import static org.mockito.Mockito.mock; -//import static org.mockito.Mockito.when; -//import static org.mockito.Mockito.withSettings; -// -//class BaseHttpInterceptorTest extends BaseHttpInterceptor { -// -// private static final String SAMPLE_HTTP_HEADER = "Correlation-ID"; -// -// private BaseHttpInterceptor baseHttpInterceptor; -// -// @BeforeEach -// private void initialize() { -// baseHttpInterceptor = mock(BaseHttpInterceptor.class, withSettings().useConstructor().defaultAnswer(CALLS_REAL_METHODS)); -// } -// -// @Test -// void preHandle_givenEmptyRequiredHttpHeaderNames_expectedValidHttpHeaders() throws Exception { -// assertTrue(baseHttpInterceptor.preHandle(null, null, null)); -// } -// -// @Test -// void preHandle_givenMissingHttpHeader_expectedApplicationException() { -// when(baseHttpInterceptor.getRequiredHttpHeaderNames()).thenReturn(Arrays.asList(SAMPLE_HTTP_HEADER)); -// HttpServletRequest httpServletRequest = mock(HttpServletRequest.class); -// when(httpServletRequest.getHeader(SAMPLE_HTTP_HEADER)).thenReturn(null); -// assertThrows(ApplicationClientException.class, () -> baseHttpInterceptor.preHandle(httpServletRequest, null, null)); -// } -// -// @Test -// void preHandle_givenHttpHeader_expectedValidHttpHeaders() throws Exception { -// when(baseHttpInterceptor.getRequiredHttpHeaderNames()).thenReturn(Arrays.asList(SAMPLE_HTTP_HEADER)); -// HttpServletRequest httpServletRequest = mock(HttpServletRequest.class); -// when(httpServletRequest.getHeader(SAMPLE_HTTP_HEADER)).thenReturn("Sample Value"); -// assertTrue(baseHttpInterceptor.preHandle(httpServletRequest, null, null)); -// } -//} diff --git a/pom.xml b/pom.xml index 40a403d5c..52fa23238 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ io.americanexpress.synapse synapse pom - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT Synapse is a set of lightweight foundational framework modules for rapid development built-in with enterprise @@ -36,51 +36,53 @@ - 17 - 17 - 17 + 21 + ${java.version} + ${java.version} + + UTF-8 + UTF-8 - 1.7.20 + 1.9.22 - 6.0.11 - 6.0.0 - 3.1.3 - 1.4.7.RELEASE - 3.2.7 - 0.12.2 + 3.2.4 + 2023.0.0 - 1.6.12 + 2.3.0 + + + 2.2.20 - 11.1.0 + 15.1.0 + 11.1.0 - 4.8.1 + 5.10.0 - 1.9.1 - 5.9.1 + 1.10.2 + 5.10.2 - 2.14.0 + 2.16.1 - 2.19.0 - 2.0.4 + 2.23.0 + 2.0.12 - 0.9.16 - 2.5 + 0.10.1 11.5 11.5.0.0 - 1.17.5 + 1.19.6 @@ -191,6 +193,7 @@ synapse-archetype-service-rest-reactive-post ${project.version} + io.americanexpress.synapse @@ -206,6 +209,7 @@ io.americanexpress.synapse synapse-framework-test ${project.version} + test io.americanexpress.synapse @@ -257,12 +261,14 @@ synapse-service-test ${project.version} + io.americanexpress.synapse synapse-function ${project.version} + io.americanexpress.synapse @@ -284,6 +290,7 @@ synapse-client-soap ${project.version} + io.americanexpress.synapse @@ -330,6 +337,7 @@ synapse-data-redis ${project.version} + io.americanexpress.synapse @@ -351,6 +359,7 @@ synapse-utility-number ${project.version} + io.americanexpress.synapse @@ -409,11 +418,11 @@ sample-service-rest-book ${project.version} - + io.americanexpress.synapse sample-service-rest-cassandra-book @@ -489,184 +498,82 @@ com.github.stefanbirkner system-rules - compile + 1.19.0 - - - - org.springframework.cloud - spring-cloud-function-adapter-aws - ${spring-cloud.version} - - org.springframework.cloud - spring-cloud-function-adapter-gcp - ${spring-cloud.version} + org.projectlombok + lombok + 1.18.30 + provided - org.springframework.data - spring-data-r2dbc - 3.2.2 - - - org.springframework.plugin - spring-plugin-core - 2.0.0.RELEASE - - - org.springframework - spring-framework-bom - ${spring-framework.version} + org.springframework.boot + spring-boot-dependencies + ${spring-boot-framework.version} pom import - org.springframework - spring-web - ${spring-framework.version} - - - - org.springframework - spring-webmvc - ${spring-framework.version} - - - - - org.springframework.security - spring-security-core - ${spring-security.version} - - - org.springframework.security - spring-security-config - ${spring-security.version} - - - org.springframework.security - spring-security-web - ${spring-security.version} - - - org.springframework.security - spring-security-test - ${spring-security.version} - - - - org.springframework.boot - spring-boot-dependencies - ${spring-boot-framework.version} + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud-framework.version} pom import - org.springframework.boot - spring-boot-starter-ws - ${spring-boot-ws-framework.version} + org.springframework.plugin + spring-plugin-core + 2.0.0.RELEASE org.springframework.boot - spring-boot-starter - ${spring-boot-framework.version} - - - org.springframework.boot - spring-boot-starter-logging - - + spring-boot-starter-ws + 1.4.7.RELEASE org.springframework.boot - spring-boot-starter-web + spring-boot-starter-test ${spring-boot-framework.version} - - - org.springframework.boot - spring-boot-starter-logging - - + test org.springframework.boot - spring-boot-starter-webflux + spring-boot-starter ${spring-boot-framework.version} - org.springframework.boot spring-boot-starter-logging + org.springframework.boot org.springframework.boot - spring-boot-starter-log4j2 + spring-boot-starter-logging ${spring-boot-framework.version} - - - org.springframework.boot - spring-boot-starter-validation - ${spring-boot-framework.version} - - - org.springframework.boot - spring-boot-starter-logging - - + provided org.apache.logging.log4j - log4j-core - ${log4j.version} - - - org.apache.logging.log4j - log4j-slf4j-impl - ${log4j.version} - - - org.apache.logging.log4j - log4j-api + log4j-bom ${log4j.version} + pom + import com.google.guava guava - 31.1-jre - - - - com.wavefront - wavefront-spring-boot-starter - 2.2.2 - - - - - org.springframework.cloud - spring-cloud-starter-function-web - ${spring-cloud.version} - - - org.springframework.cloud - spring-cloud-starter-sleuth - 3.1.5 + 33.0.0-jre - - org.webjars.npm - graphql-ws - 5.5.5 - com.graphql-java graphql-java-tools @@ -686,24 +593,21 @@ + com.graphql-java-kickstart graphql-spring-boot-starter - 15.0.0 + ${spring-boot-graphql.version} - - - org.apache.tomcat.embed - tomcat-embed-core - 10.1.1 + com.graphql-java-kickstart + graphiql-spring-boot-starter + ${spring-boot-graphiql.version} - - - io.netty - netty-codec-http - 4.1.59.Final + com.graphql-java-kickstart + voyager-spring-boot-starter + ${spring-boot-graphiql.version} @@ -715,46 +619,41 @@ commons-io commons-io - 2.11.0 - - - org.apache.commons - commons-collections4 - 4.4 - - - org.apache.commons - commons-lang3 - 3.12.0 - + 2.15.1 + + + + + + + + + + + org.apache.commons commons-text - 1.10.0 - - - org.apache.santuario - xmlsec - 3.0.1 + 1.11.0 + + + + + - - net.sf.ehcache - ehcache - 2.10.9.2 - org.ehcache ehcache - 3.10.3 + 3.10.8 org.hibernate hibernate-ehcache - 5.6.12.Final + 5.6.15.Final org.hibernate @@ -762,9 +661,9 @@ 3.5.6-Final - org.hibernate + org.hibernate.orm hibernate-core - 5.6.15.Final + 6.4.4.Final org.hibernate @@ -780,44 +679,44 @@ - - org.postgresql - postgresql - 42.5.0 - + + + + + - - com.h2database - h2 - 2.1.214 - - - io.r2dbc - r2dbc-h2 - 1.0.0.RC1 - + + + + + + + + + + - - io.r2dbc - r2dbc-pool - 1.0.0.RELEASE - + + + + + - - io.r2dbc - r2dbc-mssql - 1.0.2.RELEASE - + + + + + - - jakarta.persistence - jakarta.persistence-api - 3.1.0 - + + + + + com.openpojo openpojo @@ -833,269 +732,256 @@ equalsverifier 3.15.8 - - commons-codec - commons-codec - 1.15 - + + + + + com.google.http-client google-http-client - 1.42.2 + 1.44.1 - - com.fasterxml.jackson.core - jackson-core - ${jackson.version} - - - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - ${jackson.version} - + + + + + + + + + + + + + + + - - jakarta.validation - jakarta.validation-api - 3.0.2 - - - jakarta.servlet - jakarta.servlet-api - 6.0.0 - - - jakarta.xml.bind - jakarta.xml.bind-api - 4.0.0 - + + + + + + + + + + + + + + + - - org.mockito - mockito-junit-jupiter - ${mockito.version} - - - org.hamcrest - hamcrest - 2.2 - - - org.mockito - mockito-core - ${mockito.version} - + + + + + + + + + + + + + + + - - org.graalvm.buildtools - junit-platform-native - 0.9.14 - test - - - org.junit.jupiter - junit-jupiter - ${junit.jupiter.version} - - - org.junit.jupiter - junit-jupiter-api - ${junit.jupiter.version} - - - org.junit.jupiter - junit-jupiter-engine - ${junit.jupiter.version} - - - org.junit.jupiter - junit-jupiter-params - ${junit.jupiter.version} - - - org.junit.vintage - junit-vintage-engine - ${junit.jupiter.version} - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.junit junit-bom - ${junit.jupiter.version} + ${junit-jupiter.version} pom + import - org.junit.platform - junit-platform-launcher - ${junit.version} + org.junit.jupiter + junit-jupiter-api + ${junit-jupiter.version} test - - org.junit.platform - junit-platform-runner - ${junit.version} - + + + + + + + + + + + org.junit.platform junit-platform-suite-api - ${junit.version} - - - org.junit.platform - junit-platform-engine - ${junit.version} - - - org.junit.platform - junit-platform-commons - ${junit.version} + ${junit-platform.version} + test + + + + + + + + + + - - org.slf4j - slf4j-ext - ${slf4j.version} - - - org.slf4j - slf4j-api - ${slf4j.version} - + + + + + + + + + + - - com.couchbase.client - java-client - 3.3.4 - + + + + + - - org.springframework.experimental - spring-native - ${spring-native.version} - - - org.springframework.experimental - spring-aot - ${spring-native.version} - provided - + + + + + + + + + + + org.springdoc - springdoc-openapi-webflux-ui - ${springdoc.version} - - - org.springdoc - springdoc-openapi-data-rest - ${springdoc.version} - - - org.springdoc - springdoc-openapi-ui - ${springdoc.version} - - - org.springdoc - springdoc-openapi-webmvc-core - ${springdoc.version} - - - org.springdoc - springdoc-openapi-native + springdoc-openapi ${springdoc.version} + pom + import - io.swagger - swagger-annotations - 1.6.6 + io.swagger.core.v3 + swagger-annotations-jakarta + ${swagger.version} - - - com.ibm.db2.jcc - db2jcc4 - ${db2-db2jcc4.version} - - - org.springframework.boot - spring-boot-starter-data-jpa - ${spring-boot-framework.version} - - com.ibm.db2 - jcc - ${db2-jcc.version} + io.swagger.core.v3 + swagger-models-jakarta + ${swagger.version} - - - org.mongodb - mongodb-driver-sync - 4.9.1 - - - org.springframework.boot - spring-boot-starter-data-mongodb-reactive - ${spring-boot-framework.version} - - - org.springframework.data - spring-data-mongodb - 4.0.0 - + + + + + + + + + + + org.jetbrains.kotlin - kotlin-stdlib-jdk8 + kotlin-bom ${kotlin.version} + pom + import - - org.jetbrains.kotlin - kotlin-test - ${kotlin.version} - test - + + + + + + + + + + + + + + + + + - - org.springframework.data - spring-data-cassandra - 4.0.0 - - - org.springframework - spring-tx - 5.3.23 - - - io.projectreactor - reactor-core - 3.4.24 - + + + + + + + + + + + + + + + - - mysql - mysql-connector-java - 8.0.31 - + + + + + dev.miku r2dbc-mysql @@ -1103,59 +989,59 @@ - - com.oracle.database.jdbc - ojdbc11 - 21.7.0.0 - - - com.oracle.database.r2dbc - oracle-r2dbc - 1.0.0 - + + + + + + + + + + - - org.springframework.boot - spring-boot-starter-data-redis - ${spring-boot-framework.version} - - - org.springframework.data - spring-data-redis - ${spring-boot-framework.version} - + + + + + + + + + + com.amazonaws aws-lambda-java-events - 2.0.2 + 3.11.4 provided com.amazonaws aws-lambda-java-core - 1.1.0 + 1.2.3 provided - - org.testcontainers - cassandra - ${testcontainers.version} - - - org.testcontainers - junit-jupiter - ${testcontainers.version} - - - org.testcontainers - testcontainers - ${testcontainers.version} - + + + + + + + + + + + + + + + @@ -1194,6 +1080,7 @@ ${java.version} ${java.version} + true @@ -1224,7 +1111,7 @@ org.apache.maven.plugins maven-dependency-plugin - 3.3.0 + 3.6.1 analyze @@ -1242,6 +1129,7 @@ org.apache.maven.plugins maven-failsafe-plugin + 3.2.5 @@ -1257,7 +1145,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M7 + 3.2.5 com.google.code.findbugs @@ -1269,7 +1157,7 @@ org.apache.maven.plugins maven-pmd-plugin - 3.14.0 + 3.21.2 cobertura-maven-plugin @@ -1307,7 +1195,7 @@ org.jacoco jacoco-maven-plugin - 0.8.8 + 0.8.11 pre-unit-test @@ -1358,23 +1246,33 @@ maven-clean-plugin - 3.2.0 + 3.3.2 maven-install-plugin - 3.0.1 + 3.1.1 maven-deploy-plugin - 3.0.0 + 3.1.1 maven-site-plugin 3.12.1 + + org.apache.maven.plugins + maven-shade-plugin + 3.5.3 + maven-project-info-reports-plugin - 3.0.0 + 3.5.0 + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot-framework.version} @@ -1426,6 +1324,12 @@ compile + + + ${project.basedir}/src/main/kotlin + ${project.basedir}/src/main/java + + test-compile @@ -1433,10 +1337,16 @@ test-compile + + + ${project.basedir}/src/test/kotlin + ${project.basedir}/src/test/java + + - 1.8 + ${java.version} @@ -1528,11 +1438,6 @@ - - org.springframework.boot - spring-boot-maven-plugin - ${spring-boot-framework.version} - diff --git a/publisher/pom.xml b/publisher/pom.xml index a0120678d..9ab44afef 100644 --- a/publisher/pom.xml +++ b/publisher/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/publisher/synapse-publisher-kafka/pom.xml b/publisher/synapse-publisher-kafka/pom.xml index 334dcb467..e55b22155 100644 --- a/publisher/synapse-publisher-kafka/pom.xml +++ b/publisher/synapse-publisher-kafka/pom.xml @@ -4,7 +4,7 @@ io.americanexpress.synapse publisher - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/publisher/synapse-publisher-kafka/src/main/java/io/americanexpress/synapse/publisher/kafka/config/BaseKafkaProperties.java b/publisher/synapse-publisher-kafka/src/main/java/io/americanexpress/synapse/publisher/kafka/config/BaseKafkaProperties.java index 2fb88c807..d083f083d 100644 --- a/publisher/synapse-publisher-kafka/src/main/java/io/americanexpress/synapse/publisher/kafka/config/BaseKafkaProperties.java +++ b/publisher/synapse-publisher-kafka/src/main/java/io/americanexpress/synapse/publisher/kafka/config/BaseKafkaProperties.java @@ -105,8 +105,9 @@ public List getBootstrapServers() { public Map buildProducerProperties() { Map properties = new HashMap<>(); properties.put("security.protocol", SecurityProtocol.SSL.name); + //TODO: look into two lines below. properties.putAll(this.getSsl().buildProperties()); - properties.putAll(this.getProducer().buildProperties()); + properties.putAll(this.getProducer().buildProperties(null)); return properties; } diff --git a/service/pom.xml b/service/pom.xml index 2d9b3ff11..2b29a2f96 100644 --- a/service/pom.xml +++ b/service/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/service/service-samples/pom.xml b/service/service-samples/pom.xml index 76a68d99e..36d382902 100644 --- a/service/service-samples/pom.xml +++ b/service/service-samples/pom.xml @@ -18,7 +18,7 @@ io.americanexpress.synapse service - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 @@ -41,6 +41,7 @@ sample-service-rest-cassandra-book sample-service-rest-mysql-book sample-service-rest-oracle-book + sample-service-rest-postgres-book diff --git a/service/service-samples/sample-service-db2-book/pom.xml b/service/service-samples/sample-service-db2-book/pom.xml index 402e552a5..3edce83ac 100644 --- a/service/service-samples/sample-service-db2-book/pom.xml +++ b/service/service-samples/sample-service-db2-book/pom.xml @@ -18,7 +18,7 @@ io.americanexpress.synapse service-samples - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/service/service-samples/sample-service-graphql-book/pom.xml b/service/service-samples/sample-service-graphql-book/pom.xml index f9e54e534..3b76c1ce3 100644 --- a/service/service-samples/sample-service-graphql-book/pom.xml +++ b/service/service-samples/sample-service-graphql-book/pom.xml @@ -18,7 +18,7 @@ io.americanexpress.synapse service-samples - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/service/service-samples/sample-service-imperative-book/pom.xml b/service/service-samples/sample-service-imperative-book/pom.xml index e2136012b..421122e84 100644 --- a/service/service-samples/sample-service-imperative-book/pom.xml +++ b/service/service-samples/sample-service-imperative-book/pom.xml @@ -19,7 +19,7 @@ service-samples io.americanexpress.synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/config/BookServiceConfig.java b/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/config/BookServiceConfig.java index 85f0aa22e..8c5d2017d 100644 --- a/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/config/BookServiceConfig.java +++ b/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/config/BookServiceConfig.java @@ -13,7 +13,6 @@ */ package io.americanexpress.service.sample.imperativebook.config; -import com.fasterxml.jackson.databind.ObjectMapper; import io.americanexpress.synapse.service.imperative.config.BaseImperativeServiceConfig; /** @@ -23,12 +22,4 @@ */ public class BookServiceConfig extends BaseImperativeServiceConfig { - /** - * Constructor taking in objectMapper & metricInterceptor. - * - * @param defaultObjectMapper the default object mapper - */ - public BookServiceConfig(ObjectMapper defaultObjectMapper) { - super(defaultObjectMapper); - } } diff --git a/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/CreateBookServiceRequest.java b/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/CreateBookServiceRequest.java index 11de00fea..347d230bd 100644 --- a/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/CreateBookServiceRequest.java +++ b/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/CreateBookServiceRequest.java @@ -17,7 +17,7 @@ import org.springframework.stereotype.Component; /** - * {@code CreateBookServiceRequest} class is responsible for creating the book service request. + * {@code CreateBookServiceRequest} class is the request model for {@link io.americanexpress.service.sample.imperativebook.service.CreateBookService} * * @author Francois Gutt */ diff --git a/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/CreateBookServiceResponse.java b/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/CreateBookServiceResponse.java index 5fa083439..b42991b30 100644 --- a/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/CreateBookServiceResponse.java +++ b/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/CreateBookServiceResponse.java @@ -17,7 +17,7 @@ import org.springframework.stereotype.Component; /** - * CreateBookServiceResponse class is responsible for creating the book service response. + * {@code CreateBookServiceRequest} class is the response model for {@link io.americanexpress.service.sample.imperativebook.service.CreateBookService} * * @author Francois Gutt */ diff --git a/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/DeleteBookServiceRequest.java b/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/DeleteBookServiceRequest.java index 57c71d69b..011d7282b 100644 --- a/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/DeleteBookServiceRequest.java +++ b/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/DeleteBookServiceRequest.java @@ -16,7 +16,7 @@ import io.americanexpress.synapse.service.imperative.model.BaseServiceRequest; /** - * {@code DeleteBookServiceRequest} class is responsible for deleting the book service request. + * {@code DeleteBookServiceRequest} class is the request model for {@link io.americanexpress.service.sample.imperativebook.service.DeleteBookService} * * @author Francois Gutt */ diff --git a/function/synapse-function/src/test/java/io/americanexpress/synapse/function/rest/SynapseSampleApplication.java b/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/DeleteBookServiceResponse.java similarity index 61% rename from function/synapse-function/src/test/java/io/americanexpress/synapse/function/rest/SynapseSampleApplication.java rename to service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/DeleteBookServiceResponse.java index efcf38be9..ead6de3e3 100644 --- a/function/synapse-function/src/test/java/io/americanexpress/synapse/function/rest/SynapseSampleApplication.java +++ b/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/DeleteBookServiceResponse.java @@ -11,15 +11,15 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -package io.americanexpress.synapse.function.rest; +package io.americanexpress.service.sample.imperativebook.model; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; +import io.americanexpress.synapse.service.imperative.model.BaseServiceResponse; -@SpringBootApplication -public class SynapseSampleApplication { +/** + * {@code DeleteBookServiceResponse} class is the response model for {@link io.americanexpress.service.sample.imperativebook.service.DeleteBookService} + * + * @author Francois Gutt + */ +public class DeleteBookServiceResponse implements BaseServiceResponse { - public static void main(String[] args) { - SpringApplication.run(SynapseSampleApplication.class, args); - } } diff --git a/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/ReadBookServiceRequest.java b/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/ReadBookServiceRequest.java index 69e34a524..fd397f106 100644 --- a/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/ReadBookServiceRequest.java +++ b/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/ReadBookServiceRequest.java @@ -17,7 +17,7 @@ import org.springframework.stereotype.Component; /** - * {@code ReadBookServiceRequest} class is responsible for reading the book service request. + * {@code ReadBookServiceRequest} class is the request model for {@link io.americanexpress.service.sample.imperativebook.service.ReadBookService} * * @author Francois Gutt */ diff --git a/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/ReadBookServiceResponse.java b/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/ReadBookServiceResponse.java index de0de355f..a6fcc0279 100644 --- a/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/ReadBookServiceResponse.java +++ b/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/ReadBookServiceResponse.java @@ -17,7 +17,7 @@ import org.springframework.stereotype.Component; /** - * ReadBookServiceResponse class is responsible for reading the book service response. + * {@code ReadBookServiceResponse} class is the response model for {@link io.americanexpress.service.sample.imperativebook.service.ReadBookService} * * @author Francois Gutt */ diff --git a/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/UpdateBookServiceRequest.java b/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/UpdateBookServiceRequest.java index 6a6005725..84a729599 100644 --- a/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/UpdateBookServiceRequest.java +++ b/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/UpdateBookServiceRequest.java @@ -16,6 +16,11 @@ import io.americanexpress.synapse.service.imperative.model.BaseServiceRequest; import org.springframework.stereotype.Component; +/** + * {@code UpdateBookServiceRequest} class is the request model for {@link io.americanexpress.service.sample.imperativebook.service.UpdateBookService} + * + * @author Francois Gutt + */ @Component public class UpdateBookServiceRequest extends BaseBook implements BaseServiceRequest { diff --git a/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/UpdateBookServiceResponse.java b/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/UpdateBookServiceResponse.java index 1004bb3f3..cbd793b10 100644 --- a/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/UpdateBookServiceResponse.java +++ b/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/model/UpdateBookServiceResponse.java @@ -17,7 +17,7 @@ import org.springframework.stereotype.Component; /** - * UpdateBookServiceResponse class is responsible for updating the book service response. + * {@code UpdateBookServiceResponse} class is the response model for {@link io.americanexpress.service.sample.imperativebook.service.UpdateBookService} * * @author Francois Gutt */ diff --git a/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/service/CreateBookService.java b/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/service/CreateBookService.java index 4aaadf794..1a0b4baa7 100644 --- a/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/service/CreateBookService.java +++ b/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/service/CreateBookService.java @@ -16,7 +16,7 @@ import io.americanexpress.service.sample.imperativebook.model.CreateBookServiceRequest; import io.americanexpress.service.sample.imperativebook.model.CreateBookServiceResponse; import io.americanexpress.service.sample.imperativebook.service.helper.CreateBookServiceResponseCreator; -import io.americanexpress.synapse.service.imperative.service.BaseCreateImperativeService; +import io.americanexpress.synapse.service.imperative.service.BaseService; import org.springframework.stereotype.Component; /** @@ -25,7 +25,7 @@ * @author Francois Gutt */ @Component -public class CreateBookService extends BaseCreateImperativeService< +public class CreateBookService extends BaseService< CreateBookServiceRequest, CreateBookServiceResponse > { @@ -51,7 +51,7 @@ public CreateBookService(CreateBookServiceResponseCreator createBookServiceRespo * @return response body to the controller */ @Override - protected CreateBookServiceResponse executeCreate(CreateBookServiceRequest request) { + protected CreateBookServiceResponse doExecute(CreateBookServiceRequest request) { return createBookServiceResponseCreator.create(request); } } diff --git a/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/service/DeleteBookService.java b/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/service/DeleteBookService.java index 35b20ff7b..12cb93bd8 100644 --- a/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/service/DeleteBookService.java +++ b/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/service/DeleteBookService.java @@ -14,7 +14,8 @@ package io.americanexpress.service.sample.imperativebook.service; import io.americanexpress.service.sample.imperativebook.model.DeleteBookServiceRequest; -import io.americanexpress.synapse.service.imperative.service.BaseDeleteImperativeService; +import io.americanexpress.service.sample.imperativebook.model.DeleteBookServiceResponse; +import io.americanexpress.synapse.service.imperative.service.BaseService; import org.springframework.stereotype.Component; /** @@ -23,8 +24,9 @@ * @author Francois Gutt */ @Component -public class DeleteBookService extends BaseDeleteImperativeService< - DeleteBookServiceRequest +public class DeleteBookService extends BaseService< + DeleteBookServiceRequest, + DeleteBookServiceResponse > { /** @@ -33,7 +35,7 @@ public class DeleteBookService extends BaseDeleteImperativeService< * @param serviceRequest the service request */ @Override - protected void executeDelete(DeleteBookServiceRequest serviceRequest) { - + protected DeleteBookServiceResponse doExecute(DeleteBookServiceRequest serviceRequest) { + return new DeleteBookServiceResponse(); } } diff --git a/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/service/ReadBookService.java b/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/service/ReadBookService.java index c608afdb1..974e0d7c1 100644 --- a/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/service/ReadBookService.java +++ b/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/service/ReadBookService.java @@ -16,7 +16,7 @@ import io.americanexpress.service.sample.imperativebook.model.ReadBookServiceRequest; import io.americanexpress.service.sample.imperativebook.model.ReadBookServiceResponse; import io.americanexpress.service.sample.imperativebook.service.helper.ReadBookServiceResponseCreator; -import io.americanexpress.synapse.service.imperative.service.BaseReadMonoImperativeService; +import io.americanexpress.synapse.service.imperative.service.BaseService; import org.springframework.stereotype.Component; /** @@ -25,7 +25,7 @@ * @author Francois Gutt */ @Component -public class ReadBookService extends BaseReadMonoImperativeService< +public class ReadBookService extends BaseService< ReadBookServiceRequest, ReadBookServiceResponse > { @@ -51,7 +51,7 @@ public ReadBookService(ReadBookServiceResponseCreator readBookServiceResponseCre * @return a read mono response */ @Override - protected ReadBookServiceResponse executeRead(ReadBookServiceRequest request) { + protected ReadBookServiceResponse doExecute(ReadBookServiceRequest request) { return readBookServiceResponseCreator.create(request); } } diff --git a/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/service/UpdateBookService.java b/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/service/UpdateBookService.java index 445feb246..33ea6044e 100644 --- a/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/service/UpdateBookService.java +++ b/service/service-samples/sample-service-imperative-book/src/main/java/io/americanexpress/service/sample/imperativebook/service/UpdateBookService.java @@ -16,7 +16,7 @@ import io.americanexpress.service.sample.imperativebook.model.UpdateBookServiceRequest; import io.americanexpress.service.sample.imperativebook.model.UpdateBookServiceResponse; import io.americanexpress.service.sample.imperativebook.service.helper.UpdateBookServiceResponseCreator; -import io.americanexpress.synapse.service.imperative.service.BaseUpdateImperativeService; +import io.americanexpress.synapse.service.imperative.service.BaseService; import org.springframework.stereotype.Component; /** @@ -25,7 +25,7 @@ * @author Francois Gutt */ @Component -public class UpdateBookService extends BaseUpdateImperativeService< +public class UpdateBookService extends BaseService< UpdateBookServiceRequest, UpdateBookServiceResponse > { @@ -50,7 +50,7 @@ public UpdateBookService(UpdateBookServiceResponseCreator updateBookServiceRespo * @param request body received from the controller */ @Override - protected UpdateBookServiceResponse executeUpdate(UpdateBookServiceRequest request) { + protected UpdateBookServiceResponse doExecute(UpdateBookServiceRequest request) { var response = updateBookServiceResponseCreator.create(request); return response; } diff --git a/service/service-samples/sample-service-reactive-cassandra-book/pom.xml b/service/service-samples/sample-service-reactive-cassandra-book/pom.xml index 4572e2cf7..826dee170 100644 --- a/service/service-samples/sample-service-reactive-cassandra-book/pom.xml +++ b/service/service-samples/sample-service-reactive-cassandra-book/pom.xml @@ -17,7 +17,7 @@ service-samples io.americanexpress.synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 @@ -33,6 +33,10 @@ io.americanexpress.synapse sample-data-cassandra-reactive + + org.junit.jupiter + junit-jupiter + diff --git a/service/service-samples/sample-service-reactive-mongodb-book/pom.xml b/service/service-samples/sample-service-reactive-mongodb-book/pom.xml index acf04eca8..191aa2477 100644 --- a/service/service-samples/sample-service-reactive-mongodb-book/pom.xml +++ b/service/service-samples/sample-service-reactive-mongodb-book/pom.xml @@ -18,7 +18,7 @@ service-samples io.americanexpress.synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/service/service-samples/sample-service-reactive-mssql-book/pom.xml b/service/service-samples/sample-service-reactive-mssql-book/pom.xml index 1f3249f4c..36d8eee01 100644 --- a/service/service-samples/sample-service-reactive-mssql-book/pom.xml +++ b/service/service-samples/sample-service-reactive-mssql-book/pom.xml @@ -19,7 +19,7 @@ io.americanexpress.synapse service-samples - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT sample-service-reactive-mssql-book diff --git a/service/service-samples/sample-service-reactive-mysql-book/pom.xml b/service/service-samples/sample-service-reactive-mysql-book/pom.xml index f463b77e3..617688ee1 100644 --- a/service/service-samples/sample-service-reactive-mysql-book/pom.xml +++ b/service/service-samples/sample-service-reactive-mysql-book/pom.xml @@ -18,7 +18,7 @@ io.americanexpress.synapse service-samples - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/service/service-samples/sample-service-reactive-oracle-book/pom.xml b/service/service-samples/sample-service-reactive-oracle-book/pom.xml index 5349fa8ed..0e2b317e6 100644 --- a/service/service-samples/sample-service-reactive-oracle-book/pom.xml +++ b/service/service-samples/sample-service-reactive-oracle-book/pom.xml @@ -18,7 +18,7 @@ io.americanexpress.synapse service-samples - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/service/service-samples/sample-service-reactive-oracle-cp-book/pom.xml b/service/service-samples/sample-service-reactive-oracle-cp-book/pom.xml index ae4b00fca..0a96497ae 100644 --- a/service/service-samples/sample-service-reactive-oracle-cp-book/pom.xml +++ b/service/service-samples/sample-service-reactive-oracle-cp-book/pom.xml @@ -18,7 +18,7 @@ io.americanexpress.synapse service-samples - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/service/service-samples/sample-service-reactive-rest-book/pom.xml b/service/service-samples/sample-service-reactive-rest-book/pom.xml index d284ffc36..03969a7c1 100644 --- a/service/service-samples/sample-service-reactive-rest-book/pom.xml +++ b/service/service-samples/sample-service-reactive-rest-book/pom.xml @@ -18,7 +18,7 @@ io.americanexpress.synapse service-samples - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/service/service-samples/sample-service-reactive-weather-client/pom.xml b/service/service-samples/sample-service-reactive-weather-client/pom.xml index ae506a9fe..a57e185a2 100644 --- a/service/service-samples/sample-service-reactive-weather-client/pom.xml +++ b/service/service-samples/sample-service-reactive-weather-client/pom.xml @@ -19,7 +19,7 @@ io.americanexpress.synapse service-samples - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT sample-service-reactive-weather-client @@ -33,7 +33,7 @@ io.americanexpress.synapse sample-client-reactive-weather - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT diff --git a/service/service-samples/sample-service-rest-cassandra-book/pom.xml b/service/service-samples/sample-service-rest-cassandra-book/pom.xml index b88d53ea8..32e250dc9 100644 --- a/service/service-samples/sample-service-rest-cassandra-book/pom.xml +++ b/service/service-samples/sample-service-rest-cassandra-book/pom.xml @@ -17,7 +17,7 @@ service-samples io.americanexpress.synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/service/service-samples/sample-service-rest-cassandra-book/src/test/java/io/americanexpress/service/book/rest/config/BookTestConfig.java b/service/service-samples/sample-service-rest-cassandra-book/src/test/java/io/americanexpress/service/book/rest/config/BookTestConfig.java index 917a41ecf..32dc17094 100644 --- a/service/service-samples/sample-service-rest-cassandra-book/src/test/java/io/americanexpress/service/book/rest/config/BookTestConfig.java +++ b/service/service-samples/sample-service-rest-cassandra-book/src/test/java/io/americanexpress/service/book/rest/config/BookTestConfig.java @@ -1,25 +1,34 @@ -/* - * Copyright 2020 American Express Travel Related Services Company, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package io.americanexpress.service.book.rest.config; - -import org.springframework.boot.test.context.TestConfiguration; -import org.springframework.context.annotation.Import; - -/** - * {@code BookTestConfig} contains the configurations for tests. - */ -@TestConfiguration -@Import(BookConfig.class) -public class BookTestConfig { -} +///* +// * Copyright 2020 American Express Travel Related Services Company, Inc. +// * +// * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except +// * in compliance with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, software distributed under the License +// * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +// * or implied. See the License for the specific language governing permissions and limitations under +// * the License. +// */ +//package io.americanexpress.service.book.rest.config; +// +//import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; +//import org.springframework.boot.test.context.TestConfiguration; +//import org.springframework.boot.test.mock.mockito.MockBean; +//import org.springframework.context.annotation.Import; +//import io.americanexpress.data.book.repository.BookRepository; +//import org.springframework.context.annotation.Primary; +// +///** +// * {@code BookTestConfig} contains the configurations for tests. +// */ +//@TestConfiguration +//@Import(BookConfig.class) +//@AutoConfigureTestDatabase(replace=AutoConfigureTestDatabase.Replace.ANY) +//public class BookTestConfig { +// +// @MockBean +// BookRepository bookRepository; +// +//} diff --git a/service/service-samples/sample-service-rest-cassandra-book/src/test/java/io/americanexpress/service/book/rest/controller/CreateBookControllerTest.java b/service/service-samples/sample-service-rest-cassandra-book/src/test/java/io/americanexpress/service/book/rest/controller/CreateBookControllerTest.java index 06f4b8913..a4b9fa7f0 100644 --- a/service/service-samples/sample-service-rest-cassandra-book/src/test/java/io/americanexpress/service/book/rest/controller/CreateBookControllerTest.java +++ b/service/service-samples/sample-service-rest-cassandra-book/src/test/java/io/americanexpress/service/book/rest/controller/CreateBookControllerTest.java @@ -1,60 +1,59 @@ -/* - * Copyright 2020 American Express Travel Related Services Company, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package io.americanexpress.service.book.rest.controller; - -import io.americanexpress.service.book.rest.config.BookEndpoints; -import io.americanexpress.service.book.rest.config.BookTestConfig; -import io.americanexpress.service.book.rest.model.CreateBookRequest; -import io.americanexpress.service.book.rest.model.CreateBookResponse; -import io.americanexpress.service.book.rest.service.CreateBookService; -import io.americanexpress.synapse.service.test.controller.BaseCreateMonoControllerUnitTest; -import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.web.WebAppConfiguration; - -/** - * {@code CreateBookControllerTest} tests the {@link CreateBookController} - */ -@WebAppConfiguration -@ContextConfiguration(classes = BookTestConfig.class) -public class CreateBookControllerTest extends BaseCreateMonoControllerUnitTest { - - /** - * Provide the endpoint for the api. - */ - @Override - protected String getEndpoint() { - return BookEndpoints.BOOK_ENDPOINT; - } - - /** - * Provide the location of the sample request json file. - */ - @Override - protected String getSampleJsonRequestFileName() { - return "sample-request.json"; - } - - /** - * Provide the http headers needed. - */ - @Override - protected HttpHeaders getSampleHttpHeaders() { - HttpHeaders headers = new HttpHeaders(); - headers.set("Correlation-ID", "ghaof"); - headers.setContentType(MediaType.APPLICATION_JSON); - return headers; - } -} +///* +// * Copyright 2020 American Express Travel Related Services Company, Inc. +// * +// * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except +// * in compliance with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, software distributed under the License +// * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +// * or implied. See the License for the specific language governing permissions and limitations under +// * the License. +// */ +//package io.americanexpress.service.book.rest.controller; +// +//import io.americanexpress.service.book.rest.config.BookEndpoints; +//import io.americanexpress.service.book.rest.config.BookTestConfig; +//import io.americanexpress.service.book.rest.model.CreateBookRequest; +//import io.americanexpress.service.book.rest.model.CreateBookResponse; +//import io.americanexpress.service.book.rest.service.CreateBookService; +//import io.americanexpress.synapse.service.test.controller.BaseCreateMonoControllerUnitTest; +//import org.springframework.boot.test.context.SpringBootTest; +//import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +//import org.springframework.http.HttpHeaders; +//import org.springframework.http.MediaType; +// +///** +// * {@code CreateBookControllerTest} tests the {@link CreateBookController} +// */ +//@SpringBootTest(classes = BookTestConfig.class, webEnvironment = WebEnvironment.MOCK) +//public class CreateBookControllerTest extends BaseCreateMonoControllerUnitTest { +// +// /** +// * Provide the endpoint for the api. +// */ +// @Override +// protected String getEndpoint() { +// return BookEndpoints.BOOK_ENDPOINT; +// } +// +// /** +// * Provide the location of the sample request json file. +// */ +// @Override +// protected String getSampleJsonRequestFileName() { +// return "sample-request.json"; +// } +// +// /** +// * Provide the http headers needed. +// */ +// @Override +// protected HttpHeaders getSampleHttpHeaders() { +// HttpHeaders headers = new HttpHeaders(); +// headers.set("Correlation-ID", "ghaof"); +// headers.setContentType(MediaType.APPLICATION_JSON); +// return headers; +// } +//} diff --git a/service/service-samples/sample-service-rest-cassandra-book/src/test/java/io/americanexpress/service/book/rest/controller/ReadMonoControllerTest.java b/service/service-samples/sample-service-rest-cassandra-book/src/test/java/io/americanexpress/service/book/rest/controller/ReadMonoControllerTest.java index 43ebd78ff..2f027671c 100644 --- a/service/service-samples/sample-service-rest-cassandra-book/src/test/java/io/americanexpress/service/book/rest/controller/ReadMonoControllerTest.java +++ b/service/service-samples/sample-service-rest-cassandra-book/src/test/java/io/americanexpress/service/book/rest/controller/ReadMonoControllerTest.java @@ -1,64 +1,64 @@ -/* - * Copyright 2020 American Express Travel Related Services Company, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package io.americanexpress.service.book.rest.controller; - -import io.americanexpress.service.book.rest.config.BookEndpoints; -import io.americanexpress.service.book.rest.config.BookTestConfig; -import io.americanexpress.service.book.rest.model.ReadBookRequest; -import io.americanexpress.service.book.rest.model.ReadBookResponse; -import io.americanexpress.service.book.rest.service.ReadBookService; -import io.americanexpress.synapse.service.test.controller.BaseReadMonoControllerUnitTest; -import org.springframework.http.HttpHeaders; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.web.WebAppConfiguration; - -/** - * {@code ReadMonoControllerTest} tests the {@link ReadMonoControllerTest} - */ -@WebAppConfiguration -@ContextConfiguration(classes = BookTestConfig.class) -public class ReadMonoControllerTest extends BaseReadMonoControllerUnitTest { - - /** - * Provide the endpoint for the api. - */ - @Override - protected String getEndpoint() { - return BookEndpoints.BOOK_ENDPOINT + "/inquiry_results"; - } - - /** - * Provide the location of the sample response json file. - */ - @Override - protected String getSampleJsonResponseFileName() { - return "sample-response.json"; - } - - /** - * Provide the location of the sample request json file. - */ - @Override - protected String getSampleJsonRequestFileName() { - return "sample-request.json"; - } - - /** - * Provide any headers needed. - */ - @Override - protected HttpHeaders getSampleHttpHeaders() { - return null; - } -} +///* +// * Copyright 2020 American Express Travel Related Services Company, Inc. +// * +// * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except +// * in compliance with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, software distributed under the License +// * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +// * or implied. See the License for the specific language governing permissions and limitations under +// * the License. +// */ +//package io.americanexpress.service.book.rest.controller; +// +//import io.americanexpress.service.book.rest.config.BookEndpoints; +//import io.americanexpress.service.book.rest.config.BookTestConfig; +//import io.americanexpress.service.book.rest.model.ReadBookRequest; +//import io.americanexpress.service.book.rest.model.ReadBookResponse; +//import io.americanexpress.service.book.rest.service.ReadBookService; +//import io.americanexpress.synapse.service.test.controller.BaseReadMonoControllerUnitTest; +//import org.springframework.http.HttpHeaders; +//import org.springframework.test.context.ContextConfiguration; +//import org.springframework.test.context.web.WebAppConfiguration; +// +///** +// * {@code ReadMonoControllerTest} tests the {@link ReadMonoControllerTest} +// */ +//@WebAppConfiguration +//@ContextConfiguration(classes = BookTestConfig.class) +//public class ReadMonoControllerTest extends BaseReadMonoControllerUnitTest { +// +// /** +// * Provide the endpoint for the api. +// */ +// @Override +// protected String getEndpoint() { +// return BookEndpoints.BOOK_ENDPOINT + "/inquiry_results"; +// } +// +// /** +// * Provide the location of the sample response json file. +// */ +// @Override +// protected String getSampleJsonResponseFileName() { +// return "sample-response.json"; +// } +// +// /** +// * Provide the location of the sample request json file. +// */ +// @Override +// protected String getSampleJsonRequestFileName() { +// return "sample-request.json"; +// } +// +// /** +// * Provide any headers needed. +// */ +// @Override +// protected HttpHeaders getSampleHttpHeaders() { +// return null; +// } +//} diff --git a/service/service-samples/sample-service-rest-cassandra-book/src/test/java/io/americanexpress/service/book/rest/controller/UpdateBookControllerTest.java b/service/service-samples/sample-service-rest-cassandra-book/src/test/java/io/americanexpress/service/book/rest/controller/UpdateBookControllerTest.java index f91d1f9b7..90a98b91e 100644 --- a/service/service-samples/sample-service-rest-cassandra-book/src/test/java/io/americanexpress/service/book/rest/controller/UpdateBookControllerTest.java +++ b/service/service-samples/sample-service-rest-cassandra-book/src/test/java/io/americanexpress/service/book/rest/controller/UpdateBookControllerTest.java @@ -1,56 +1,56 @@ -/* - * Copyright 2020 American Express Travel Related Services Company, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package io.americanexpress.service.book.rest.controller; - -import io.americanexpress.service.book.rest.config.BookEndpoints; -import io.americanexpress.service.book.rest.config.BookTestConfig; -import io.americanexpress.service.book.rest.model.CreateBookResponse; -import io.americanexpress.service.book.rest.model.UpdateBookRequest; -import io.americanexpress.service.book.rest.service.UpdateBookService; -import io.americanexpress.synapse.service.test.controller.BaseUpdateControllerUnitTest; -import org.springframework.http.HttpHeaders; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.web.WebAppConfiguration; - -/** - * {@code UpdateBookControllerTest} tests the {@link UpdateBookControllerTest} - */ -@WebAppConfiguration -@ContextConfiguration(classes = BookTestConfig.class) -public class UpdateBookControllerTest extends BaseUpdateControllerUnitTest{ - - /** - * Provide the endpoint for the api. - */ - @Override - protected String getEndpoint() { - return BookEndpoints.BOOK_ENDPOINT; - } - - /** - * Provide the location of the sample request json file. - */ - @Override - protected String getSampleJsonRequestFileName() { - return "sample-request.json"; - } - - /** - * Provide the http headers. - */ - @Override - protected HttpHeaders getSampleHttpHeaders() { - return null; - } -} +///* +// * Copyright 2020 American Express Travel Related Services Company, Inc. +// * +// * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except +// * in compliance with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, software distributed under the License +// * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +// * or implied. See the License for the specific language governing permissions and limitations under +// * the License. +// */ +//package io.americanexpress.service.book.rest.controller; +// +//import io.americanexpress.service.book.rest.config.BookEndpoints; +//import io.americanexpress.service.book.rest.config.BookTestConfig; +//import io.americanexpress.service.book.rest.model.CreateBookResponse; +//import io.americanexpress.service.book.rest.model.UpdateBookRequest; +//import io.americanexpress.service.book.rest.service.UpdateBookService; +//import io.americanexpress.synapse.service.test.controller.BaseUpdateControllerUnitTest; +//import org.springframework.http.HttpHeaders; +//import org.springframework.test.context.ContextConfiguration; +//import org.springframework.test.context.web.WebAppConfiguration; +// +///** +// * {@code UpdateBookControllerTest} tests the {@link UpdateBookControllerTest} +// */ +//@WebAppConfiguration +//@ContextConfiguration(classes = BookTestConfig.class) +//public class UpdateBookControllerTest extends BaseUpdateControllerUnitTest{ +// +// /** +// * Provide the endpoint for the api. +// */ +// @Override +// protected String getEndpoint() { +// return BookEndpoints.BOOK_ENDPOINT; +// } +// +// /** +// * Provide the location of the sample request json file. +// */ +// @Override +// protected String getSampleJsonRequestFileName() { +// return "sample-request.json"; +// } +// +// /** +// * Provide the http headers. +// */ +// @Override +// protected HttpHeaders getSampleHttpHeaders() { +// return null; +// } +//} diff --git a/service/service-samples/sample-service-rest-mysql-book/pom.xml b/service/service-samples/sample-service-rest-mysql-book/pom.xml index 61e76e778..c4f915411 100644 --- a/service/service-samples/sample-service-rest-mysql-book/pom.xml +++ b/service/service-samples/sample-service-rest-mysql-book/pom.xml @@ -18,7 +18,7 @@ io.americanexpress.synapse service-samples - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 @@ -38,6 +38,10 @@ io.americanexpress.synapse synapse-framework-exception + + io.americanexpress.synapse + synapse-framework-test + diff --git a/service/service-samples/sample-service-rest-native-book/pom.xml b/service/service-samples/sample-service-rest-native-book/pom.xml index bdd1f0a36..3fea4da45 100644 --- a/service/service-samples/sample-service-rest-native-book/pom.xml +++ b/service/service-samples/sample-service-rest-native-book/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse service-samples - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 @@ -44,11 +44,6 @@ - - org.springframework.experimental - spring-aot - provided - org.springframework.cloud spring-cloud-function-web @@ -84,25 +79,11 @@ - - - org.springframework.experimental - spring-aot-maven-plugin - - true - true - - test-generate - - test-generate - - - - generate + process-aot - generate + process-aot diff --git a/service/service-samples/sample-service-rest-oracle-book/pom.xml b/service/service-samples/sample-service-rest-oracle-book/pom.xml index f4c755cf8..acbb1a177 100644 --- a/service/service-samples/sample-service-rest-oracle-book/pom.xml +++ b/service/service-samples/sample-service-rest-oracle-book/pom.xml @@ -18,7 +18,7 @@ io.americanexpress.synapse service-samples - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/service/service-samples/sample-service-rest-postgres-book/pom.xml b/service/service-samples/sample-service-rest-postgres-book/pom.xml index 49285953c..befdb29fa 100644 --- a/service/service-samples/sample-service-rest-postgres-book/pom.xml +++ b/service/service-samples/sample-service-rest-postgres-book/pom.xml @@ -19,7 +19,7 @@ io.americanexpress.synapse service-samples - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT sample-service-rest-postgres-book diff --git a/service/synapse-service-graphql/pom.xml b/service/synapse-service-graphql/pom.xml index 413171331..e1ccf20c9 100644 --- a/service/synapse-service-graphql/pom.xml +++ b/service/synapse-service-graphql/pom.xml @@ -15,7 +15,7 @@ io.americanexpress.synapse service - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 @@ -51,6 +51,17 @@ org.springframework.security spring-security-web + + + jakarta.websocket + jakarta.websocket-api + + + + jakarta.websocket + jakarta.websocket-client-api + + diff --git a/service/synapse-service-graphql/src/main/java/io/americanexpress/synapse/service/graphql/package-info.java b/service/synapse-service-graphql/src/main/java/io/americanexpress/synapse/service/graphql/package-info.java new file mode 100644 index 000000000..145724f90 --- /dev/null +++ b/service/synapse-service-graphql/src/main/java/io/americanexpress/synapse/service/graphql/package-info.java @@ -0,0 +1,5 @@ +/** + * @deprecated As of release 0.4.0, to be replaced by new API module. + */ +@Deprecated(since = "0.4.0", forRemoval = true) +package io.americanexpress.synapse.service.graphql; \ No newline at end of file diff --git a/service/synapse-service-imperative/pom.xml b/service/synapse-service-imperative/pom.xml index 44283e71e..f723ce9a4 100644 --- a/service/synapse-service-imperative/pom.xml +++ b/service/synapse-service-imperative/pom.xml @@ -19,7 +19,7 @@ io.americanexpress.synapse service - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 @@ -27,28 +27,10 @@ - - - io.americanexpress.synapse - synapse-framework-logging - io.americanexpress.synapse synapse-framework-exception - - io.americanexpress.synapse - synapse-framework-api-docs - - - io.americanexpress.synapse - synapse-utilities-common - - - io.americanexpress.synapse - synapse-framework-test - - @@ -67,63 +49,26 @@ mockito-junit-jupiter - - - - org.springframework.plugin - spring-plugin-core - - - org.springframework.boot - spring-boot-starter - - - org.springframework.boot - spring-boot-starter-data-rest - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-aop - - - org.springframework.boot - spring-boot-starter-test - - - junit - junit - - - - - org.springframework.boot - spring-boot-starter-actuator - + - org.springframework.boot - spring-boot-starter-validation + org.springframework + spring-context - + - org.apache.tomcat.embed - tomcat-embed-core + org.slf4j + slf4j-ext - - org.apache.commons - commons-lang3 + jakarta.validation + jakarta.validation-api - io.swagger - swagger-annotations - 1.6.6 + io.swagger.core.v3 + swagger-annotations-jakarta diff --git a/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/config/BaseImperativeServiceConfig.java b/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/config/BaseImperativeServiceConfig.java index 8b9009fcf..600d4dafe 100644 --- a/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/config/BaseImperativeServiceConfig.java +++ b/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/config/BaseImperativeServiceConfig.java @@ -13,20 +13,10 @@ */ package io.americanexpress.synapse.service.imperative.config; -import com.fasterxml.jackson.databind.ObjectMapper; import io.americanexpress.synapse.framework.exception.config.ExceptionConfig; -import io.americanexpress.synapse.utilities.common.config.UtilitiesCommonConfig; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; -import org.springframework.http.MediaType; -import org.springframework.http.converter.HttpMessageConverter; -import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import java.util.Collections; -import java.util.List; /** * {@code ServiceRestConfig} class sets common configurations for the service layer. @@ -35,52 +25,7 @@ */ @ComponentScan(basePackages = "io.americanexpress.synapse.service.imperative") @Configuration -@Import({ExceptionConfig.class, UtilitiesCommonConfig.class}) -public class BaseImperativeServiceConfig implements WebMvcConfigurer { +@Import({ExceptionConfig.class}) +public class BaseImperativeServiceConfig { - /** - * Default object mapper. - */ - private final ObjectMapper defaultObjectMapper; - - /** - * Constructor taking in objectMapper & metricInterceptor. - * - * @param defaultObjectMapper the default object mapper - */ - @Autowired - public BaseImperativeServiceConfig(ObjectMapper defaultObjectMapper) { - this.defaultObjectMapper = defaultObjectMapper; - } - - /** - * Get the JSON message converter. - * - * @return the JSON message converter - */ - @Bean - public MappingJackson2HttpMessageConverter jsonMessageConverter() { - final MappingJackson2HttpMessageConverter messageConverter = new MappingJackson2HttpMessageConverter(getObjectMapper()); - messageConverter.setSupportedMediaTypes(Collections.singletonList(MediaType.APPLICATION_JSON)); - return messageConverter; - } - - /** - * Configure the message converters. - * - * @param converters message converters of the application. - */ - @Override - public void configureMessageConverters(final List> converters) { - converters.add(jsonMessageConverter()); - } - - /** - * Returns default objectMapper. - * - * @return an object mapper - */ - protected ObjectMapper getObjectMapper() { - return defaultObjectMapper; - } } diff --git a/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/model/PageResponse.java b/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/model/PageResponse.java index be150a509..839c6bd11 100644 --- a/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/model/PageResponse.java +++ b/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/model/PageResponse.java @@ -22,7 +22,7 @@ * * @param output type (response type) */ -public class PageResponse { +public class PageResponse implements BaseServiceResponse { /** * The default number of results to display per page if none was provided. diff --git a/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/model/ServiceRouting.java b/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/model/ServiceRouting.java index a223a57da..f45c258a4 100644 --- a/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/model/ServiceRouting.java +++ b/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/model/ServiceRouting.java @@ -13,8 +13,7 @@ */ package io.americanexpress.synapse.service.imperative.model; -import io.swagger.annotations.ApiModelProperty; - +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Objects; /** @@ -43,7 +42,7 @@ public ServiceRouting() { * * @return the client identifier. */ - @ApiModelProperty(value = "Unique client id assigned to the consumer") + @Schema(description = "Unique client id assigned to the consumer") public String getClientId() { return clientId; } diff --git a/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/model/ServiceTrace.java b/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/model/ServiceTrace.java index 9ac7bb69c..c205245cd 100644 --- a/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/model/ServiceTrace.java +++ b/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/model/ServiceTrace.java @@ -13,8 +13,7 @@ */ package io.americanexpress.synapse.service.imperative.model; -import io.swagger.annotations.ApiModelProperty; - +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Objects; /** @@ -42,7 +41,7 @@ public ServiceTrace() { * * @return the correlationId */ - @ApiModelProperty(value = "This is a unique identifier used for operational logging purposes") + @Schema(description = "This is a unique identifier used for operational logging purposes") public String getCorrelationId() { return correlationId; } diff --git a/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseCreateImperativeService.java b/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseCreateImperativeService.java deleted file mode 100644 index 79ae93ad8..000000000 --- a/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseCreateImperativeService.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2020 American Express Travel Related Services Company, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package io.americanexpress.synapse.service.imperative.service; - -import io.americanexpress.synapse.service.imperative.model.BaseServiceRequest; -import io.americanexpress.synapse.service.imperative.model.BaseServiceResponse; -import org.springframework.http.HttpHeaders; - -/** - * {@code BaseCreateService} class specifies the prototypes for performing business logic. - * @param input request type - * @param output response type - * @author Francois Gutt - */ -public abstract non-sealed class BaseCreateImperativeService< - I extends BaseServiceRequest, - O extends BaseServiceResponse - > extends BaseService { - - /** - * Add a single resource. - * - * @param request body received from the controller - * @return response body to the controller - */ - public O create(I request) { - logger.entry(request); - final O response = executeCreate(request); - logger.exit(response); - return response; - } - - /** - * Prototype for adding a resource. - - * @param request body received from the controller - * @return response body to the controller - */ - protected abstract O executeCreate(I request); -} diff --git a/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseDeleteImperativeService.java b/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseDeleteImperativeService.java deleted file mode 100644 index 502bbbe75..000000000 --- a/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseDeleteImperativeService.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2020 American Express Travel Related Services Company, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package io.americanexpress.synapse.service.imperative.service; - -import io.americanexpress.synapse.service.imperative.model.BaseServiceRequest; - -/** - * {@code BaseDeleteService} class specifies the prototypes for performing business logic. - * - * @author Francois Gutt - */ -public abstract non-sealed class BaseDeleteImperativeService< - I extends BaseServiceRequest - > extends BaseService { - - /** - * - * @param serviceRequest - */ - public void delete(I serviceRequest) { - logger.entry(serviceRequest); - executeDelete(serviceRequest); - logger.exit(); - } - - protected abstract void executeDelete(I serviceRequest); -} diff --git a/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseGetMonoImperativeService.java b/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseGetMonoImperativeService.java deleted file mode 100644 index aec634bf7..000000000 --- a/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseGetMonoImperativeService.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2020 American Express Travel Related Services Company, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package io.americanexpress.synapse.service.imperative.service; - -import io.americanexpress.synapse.service.imperative.model.BaseServiceResponse; -import org.springframework.http.HttpHeaders; - -/** - * {@code BaseGetMonoService} class specifies the prototypes for performing business logic. - * @param BaseServiceResponse - * @author Francois Gutt - */ -public abstract non-sealed class BaseGetMonoImperativeService extends BaseService { - - /** - * Unique identifier for the resource. - * - * @param headers the http headers - * @return a service response - */ - public O read(HttpHeaders headers) { - logger.entry(headers); - O response = executeRead(headers); - logger.exit(response); - return response; - } - - /** - * Prototype for reading a resource. - * - * @param headers the http headers - * @return a service response - */ - protected abstract O executeRead(HttpHeaders headers); -} diff --git a/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseGetPolyImperativeService.java b/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseGetPolyImperativeService.java deleted file mode 100644 index ed545d6c4..000000000 --- a/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseGetPolyImperativeService.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright 2020 American Express Travel Related Services Company, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package io.americanexpress.synapse.service.imperative.service; - -public class BaseGetPolyImperativeService { - -} diff --git a/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseReadMonoImperativeService.java b/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseReadMonoImperativeService.java deleted file mode 100644 index a370c9317..000000000 --- a/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseReadMonoImperativeService.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2020 American Express Travel Related Services Company, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package io.americanexpress.synapse.service.imperative.service; - -import io.americanexpress.synapse.service.imperative.model.BaseServiceRequest; -import io.americanexpress.synapse.service.imperative.model.BaseServiceResponse; -import org.springframework.http.HttpHeaders; - -/** - * {@code BaseReadMonoService} class specifies the prototypes for performing business logic. - * @param class extending the {@link BaseServiceRequest} - * @param class extending the {@link BaseServiceResponse} - * - * @author Francois Gutt - */ -public abstract non-sealed class BaseReadMonoImperativeService< - I extends BaseServiceRequest, - O extends BaseServiceResponse - > extends BaseService { - - /** - * Get a single resource from the back end service. - * - * @param request body received from the controller - * @return a single resource from the back end service. - */ - public O read(I request) { - logger.entry(request); - final O response = executeRead(request); - logger.exit(response); - return response; - } - - /** - * Prototype for reading a resource. - * @param headers the http header map - * @param request the request - * @return a read mono response - */ - protected abstract O executeRead(I request); -} diff --git a/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseReadPolyImperativeService.java b/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseReadPolyImperativeService.java deleted file mode 100644 index 87934d367..000000000 --- a/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseReadPolyImperativeService.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2020 American Express Travel Related Services Company, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package io.americanexpress.synapse.service.imperative.service; - -import io.americanexpress.synapse.service.imperative.model.BaseServiceRequest; -import io.americanexpress.synapse.service.imperative.model.BaseServiceResponse; -import org.springframework.data.domain.Page; -import org.springframework.http.HttpHeaders; - -/** - * {@code BaseReadPolyService} class specifies the prototypes for performing business logic. - * @param class extending the {@link BaseServiceRequest} - * @param class extending the {@link BaseServiceResponse} - * @author Francois Gutt - */ -public abstract non-sealed class BaseReadPolyImperativeService extends BaseService { - - /** - * Get multiple resources from the back end service. - * @param headers received from the controller - * @param request body received from the controller - * @return a single resource from the back end service. - */ - public Page read(HttpHeaders headers, final I request) { - logger.entry(request); - final Page responses = executeRead(headers, request); - logger.exit(responses); - return responses; - } - - /** - * Prototype for reading multiple resources. - * @param headers the Http header map - * @param request a read poly request - * @return a page of responses - */ - protected abstract Page executeRead(HttpHeaders headers,I request); -} diff --git a/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseService.java b/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseService.java index aa5ca21b0..031354c2c 100644 --- a/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseService.java +++ b/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseService.java @@ -14,23 +14,36 @@ package io.americanexpress.synapse.service.imperative.service; import io.americanexpress.synapse.service.imperative.model.BaseServiceRequest; +import io.americanexpress.synapse.service.imperative.model.BaseServiceResponse; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; +import jakarta.validation.Valid; /** * {@code BaseService} The base service every child controller should extend this parent service. * @author Francois Gutt */ -public sealed abstract class BaseService - permits BaseCreateImperativeService, - BaseDeleteImperativeService, - BaseGetMonoImperativeService, - BaseReadMonoImperativeService, - BaseReadPolyImperativeService, - BaseUpdateImperativeService { +public abstract class BaseService< + I extends BaseServiceRequest, + O extends BaseServiceResponse> { /** * Logger for the base service. */ protected final XLogger logger = XLoggerFactory.getXLogger(getClass()); + + /** + * Execute service logic + * + * @param request received from the controller + * @return response to the controller + */ + public O execute(@Valid I request) { + logger.entry(request); + final var response = doExecute(request); + logger.exit(); + return response; + } + + protected abstract O doExecute(I request); } diff --git a/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseUpdateImperativeService.java b/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseUpdateImperativeService.java deleted file mode 100644 index e145b38df..000000000 --- a/service/synapse-service-imperative/src/main/java/io/americanexpress/synapse/service/imperative/service/BaseUpdateImperativeService.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2020 American Express Travel Related Services Company, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package io.americanexpress.synapse.service.imperative.service; - -import io.americanexpress.synapse.service.imperative.model.BaseServiceRequest; -import io.americanexpress.synapse.service.imperative.model.BaseServiceResponse; - -/** - * {@code BaseUpdateService} class specifies the prototypes for performing business logic. - * - * @param class extending the {@link BaseServiceRequest} - * @param class extending the {@link BaseServiceResponse} - * @author Francois Gutt - */ -public abstract non-sealed class BaseUpdateImperativeService< - I extends BaseServiceRequest, - O extends BaseServiceResponse - > extends BaseService { - - /** - * Update a single resource. - * - * @param request body received from the controller - */ - public O update(I request) { - logger.entry(request); - executeUpdate(request); - logger.exit(); - - return null; - } - - /** - * Prototype for updating a resource. - * - * @param request body received from the controller - * @return a single resource from the back end service. - */ - protected abstract O executeUpdate(I request); -} diff --git a/service/synapse-service-reactive-rest/pom.xml b/service/synapse-service-reactive-rest/pom.xml index 934749b7a..737aaa9e0 100644 --- a/service/synapse-service-reactive-rest/pom.xml +++ b/service/synapse-service-reactive-rest/pom.xml @@ -19,7 +19,7 @@ io.americanexpress.synapse service - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 @@ -52,8 +52,8 @@ - io.swagger - swagger-annotations + io.swagger.core.v3 + swagger-annotations-jakarta diff --git a/service/synapse-service-reactive-rest/src/main/java/io/americanexpress/synapse/service/reactive/rest/controller/BaseCreateReactiveController.java b/service/synapse-service-reactive-rest/src/main/java/io/americanexpress/synapse/service/reactive/rest/controller/BaseCreateReactiveController.java index b801724fb..6c983558d 100644 --- a/service/synapse-service-reactive-rest/src/main/java/io/americanexpress/synapse/service/reactive/rest/controller/BaseCreateReactiveController.java +++ b/service/synapse-service-reactive-rest/src/main/java/io/americanexpress/synapse/service/reactive/rest/controller/BaseCreateReactiveController.java @@ -16,8 +16,8 @@ import io.americanexpress.synapse.service.reactive.rest.model.BaseServiceRequest; import io.americanexpress.synapse.service.reactive.rest.model.BaseServiceResponse; import io.americanexpress.synapse.service.reactive.rest.service.BaseCreateReactiveService; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import jakarta.validation.Valid; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; @@ -47,10 +47,10 @@ public abstract class BaseCreateReactiveController> create(@RequestHeader HttpHeaders headers, @Valid @RequestBody I serviceRequest) { logger.entry(serviceRequest); diff --git a/service/synapse-service-reactive-rest/src/main/java/io/americanexpress/synapse/service/reactive/rest/controller/BaseGetFluxReactiveController.java b/service/synapse-service-reactive-rest/src/main/java/io/americanexpress/synapse/service/reactive/rest/controller/BaseGetFluxReactiveController.java index c2be06172..3c1a2ba1f 100644 --- a/service/synapse-service-reactive-rest/src/main/java/io/americanexpress/synapse/service/reactive/rest/controller/BaseGetFluxReactiveController.java +++ b/service/synapse-service-reactive-rest/src/main/java/io/americanexpress/synapse/service/reactive/rest/controller/BaseGetFluxReactiveController.java @@ -15,9 +15,9 @@ import io.americanexpress.synapse.service.reactive.rest.model.BaseServiceResponse; import io.americanexpress.synapse.service.reactive.rest.service.BaseGetFluxReactiveService; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import org.springframework.http.HttpHeaders; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestHeader; @@ -38,13 +38,13 @@ public abstract class BaseGetFluxReactiveController read(@RequestHeader HttpHeaders headers) { diff --git a/service/synapse-service-reactive-rest/src/main/java/io/americanexpress/synapse/service/reactive/rest/controller/BaseGetMonoReactiveController.java b/service/synapse-service-reactive-rest/src/main/java/io/americanexpress/synapse/service/reactive/rest/controller/BaseGetMonoReactiveController.java index 1a00b1fb5..8a443a2f3 100644 --- a/service/synapse-service-reactive-rest/src/main/java/io/americanexpress/synapse/service/reactive/rest/controller/BaseGetMonoReactiveController.java +++ b/service/synapse-service-reactive-rest/src/main/java/io/americanexpress/synapse/service/reactive/rest/controller/BaseGetMonoReactiveController.java @@ -15,9 +15,9 @@ import io.americanexpress.synapse.service.reactive.rest.model.BaseServiceResponse; import io.americanexpress.synapse.service.reactive.rest.service.BaseGetMonoReactiveService; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; @@ -41,13 +41,13 @@ public abstract class BaseGetMonoReactiveController> read(@RequestHeader HttpHeaders headers, @PathVariable String id) { diff --git a/service/synapse-service-reactive-rest/src/main/java/io/americanexpress/synapse/service/reactive/rest/controller/BaseReadFluxReactiveController.java b/service/synapse-service-reactive-rest/src/main/java/io/americanexpress/synapse/service/reactive/rest/controller/BaseReadFluxReactiveController.java index 6b568a841..7cd29e99e 100644 --- a/service/synapse-service-reactive-rest/src/main/java/io/americanexpress/synapse/service/reactive/rest/controller/BaseReadFluxReactiveController.java +++ b/service/synapse-service-reactive-rest/src/main/java/io/americanexpress/synapse/service/reactive/rest/controller/BaseReadFluxReactiveController.java @@ -16,9 +16,9 @@ import io.americanexpress.synapse.service.reactive.rest.model.BaseServiceRequest; import io.americanexpress.synapse.service.reactive.rest.model.BaseServiceResponse; import io.americanexpress.synapse.service.reactive.rest.service.BaseReadFluxReactiveService; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import jakarta.validation.Valid; import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseEntity; @@ -50,13 +50,13 @@ public abstract class BaseReadFluxReactiveController> read(@RequestHeader HttpHeaders headers, @Valid @RequestBody I serviceRequest) { diff --git a/service/synapse-service-reactive-rest/src/main/java/io/americanexpress/synapse/service/reactive/rest/controller/BaseReadMonoReactiveController.java b/service/synapse-service-reactive-rest/src/main/java/io/americanexpress/synapse/service/reactive/rest/controller/BaseReadMonoReactiveController.java index 3aa313fd1..c1c477702 100644 --- a/service/synapse-service-reactive-rest/src/main/java/io/americanexpress/synapse/service/reactive/rest/controller/BaseReadMonoReactiveController.java +++ b/service/synapse-service-reactive-rest/src/main/java/io/americanexpress/synapse/service/reactive/rest/controller/BaseReadMonoReactiveController.java @@ -16,9 +16,9 @@ import io.americanexpress.synapse.service.reactive.rest.model.BaseServiceRequest; import io.americanexpress.synapse.service.reactive.rest.model.BaseServiceResponse; import io.americanexpress.synapse.service.reactive.rest.service.BaseReadMonoReactiveService; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import jakarta.validation.Valid; import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseEntity; @@ -51,13 +51,13 @@ public abstract class BaseReadMonoReactiveController> read(@RequestHeader HttpHeaders headers, @Valid @RequestBody I serviceRequest) { diff --git a/service/synapse-service-reactive-rest/src/main/java/io/americanexpress/synapse/service/reactive/rest/controller/exceptionhandler/ControllerExceptionHandler.java b/service/synapse-service-reactive-rest/src/main/java/io/americanexpress/synapse/service/reactive/rest/controller/exceptionhandler/ControllerExceptionHandler.java index af72ed9e4..617b5cbad 100644 --- a/service/synapse-service-reactive-rest/src/main/java/io/americanexpress/synapse/service/reactive/rest/controller/exceptionhandler/ControllerExceptionHandler.java +++ b/service/synapse-service-reactive-rest/src/main/java/io/americanexpress/synapse/service/reactive/rest/controller/exceptionhandler/ControllerExceptionHandler.java @@ -68,7 +68,7 @@ public Mono handle(ServerWebExchange exchange, Throwable throwable) { exchange.getResponse().setStatusCode(HttpStatus.BAD_REQUEST); errorResponse = new ErrorResponse(ErrorCode.GENERIC_4XX_ERROR, serverWebInputException.getMessage(), throwable.getMessage(), serverWebInputException.getLocalizedMessage()); } else if (throwable instanceof ApplicationClientException applicationClientException) { - exchange.getResponse().setStatusCode(applicationClientException.getErrorCode().getHttpStatus()); + exchange.getResponse().setRawStatusCode(applicationClientException.getErrorCode().getHttpStatus().value()); errorResponse = new ErrorResponse(applicationClientException.getErrorCode(), applicationClientException.getErrorCode().getMessage(), throwable.getMessage(), applicationClientException.getDeveloperMessage()); } else if (throwable instanceof ApplicationServerException) { @@ -94,7 +94,7 @@ public Mono createResponseBody(ServerWebExchange exchange, ErrorResponse e throw new ApplicationServerException(exception); } - exchange.getResponse().setStatusCode(errorResponse.getCode().getHttpStatus()); + exchange.getResponse().setRawStatusCode(errorResponse.getCode().getHttpStatus().value()); exchange.getResponse().getHeaders().add("Content-Type", "application/json"); return exchange.getResponse().writeWith(Flux.just(buffer)); } diff --git a/service/synapse-service-reactive-rest/src/main/java/io/americanexpress/synapse/service/reactive/rest/package-info.java b/service/synapse-service-reactive-rest/src/main/java/io/americanexpress/synapse/service/reactive/rest/package-info.java new file mode 100644 index 000000000..710db15d6 --- /dev/null +++ b/service/synapse-service-reactive-rest/src/main/java/io/americanexpress/synapse/service/reactive/rest/package-info.java @@ -0,0 +1,5 @@ +/** + * @deprecated As of release 0.4.0, replaced by new API module synapse-api-rest-reactive. + */ +@Deprecated(since = "0.4.0", forRemoval = true) +package io.americanexpress.synapse.service.reactive.rest; \ No newline at end of file diff --git a/service/synapse-service-reactive/pom.xml b/service/synapse-service-reactive/pom.xml index 1de50e144..482dd786a 100644 --- a/service/synapse-service-reactive/pom.xml +++ b/service/synapse-service-reactive/pom.xml @@ -19,7 +19,7 @@ io.americanexpress.synapse service - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 @@ -27,37 +27,29 @@ - - org.projectlombok - lombok - - - - io.americanexpress.synapse - synapse-framework-api-docs - io.americanexpress.synapse - synapse-framework-logging - - - io.americanexpress.synapse - synapse-utilities-common + synapse-framework-exception - + + + - org.springframework.boot - spring-boot-starter-validation + org.springframework + spring-context + + - org.springframework.boot - spring-boot-starter-webflux + io.projectreactor + reactor-core + - io.swagger - swagger-annotations + org.slf4j + slf4j-ext diff --git a/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/config/BaseReactiveServiceRestConfig.java b/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/config/BaseReactiveServiceRestConfig.java index 73982e010..a2932467f 100644 --- a/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/config/BaseReactiveServiceRestConfig.java +++ b/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/config/BaseReactiveServiceRestConfig.java @@ -13,64 +13,19 @@ */ package io.americanexpress.synapse.service.reactive.config; -import com.fasterxml.jackson.databind.ObjectMapper; -import io.americanexpress.synapse.framework.api.docs.ApiDocsConfig; import io.americanexpress.synapse.framework.exception.config.ExceptionConfig; -import io.americanexpress.synapse.utilities.common.config.UtilitiesCommonConfig; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; -import org.springframework.http.codec.ServerCodecConfigurer; -import org.springframework.http.codec.json.Jackson2JsonDecoder; -import org.springframework.http.codec.json.Jackson2JsonEncoder; -import org.springframework.web.reactive.config.EnableWebFlux; -import org.springframework.web.reactive.config.WebFluxConfigurer; /** * {@code BaseServiceReactiveRestConfig} sets common configurations for the service layer. * * @author Francois Gutt */ -@Configuration -@EnableWebFlux @ComponentScan(basePackages = "io.americanexpress.synapse.service.reactive") -@Import({ExceptionConfig.class, ApiDocsConfig.class, UtilitiesCommonConfig.class}) -public class BaseReactiveServiceRestConfig implements WebFluxConfigurer { - - /** - * Default object mapper. - */ - private final ObjectMapper defaultObjectMapper; - - /** - * Constructor taking in objectMapper. - * - * @param defaultObjectMapper the default object mapper. - */ - @Autowired - public BaseReactiveServiceRestConfig(ObjectMapper defaultObjectMapper) { - this.defaultObjectMapper = defaultObjectMapper; - } - - /** - * Configures the HTTP message readers and writers for reading from the request body and - * for writing to the response body in annotated controllers and functional endpoints. - * - * @param configurer the service codec configurer - */ - @Override - public void configureHttpMessageCodecs(ServerCodecConfigurer configurer) { - configurer.defaultCodecs().jackson2JsonEncoder(new Jackson2JsonEncoder(getObjectMapper())); - configurer.defaultCodecs().jackson2JsonDecoder(new Jackson2JsonDecoder(getObjectMapper())); - } +@Configuration +@Import({ExceptionConfig.class}) +public class BaseReactiveServiceRestConfig { - /** - * Returns default objectMapper. - * - * @return an object mapper - */ - protected ObjectMapper getObjectMapper() { - return defaultObjectMapper; - } } diff --git a/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseCreateReactiveService.java b/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseCreateReactiveService.java deleted file mode 100644 index 563c8db06..000000000 --- a/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseCreateReactiveService.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2020 American Express Travel Related Services Company, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package io.americanexpress.synapse.service.reactive.service; - -import io.americanexpress.synapse.service.reactive.model.BaseServiceRequest; -import io.americanexpress.synapse.service.reactive.model.BaseServiceResponse; -import reactor.core.publisher.Mono; - -/** - * {@code BaseCreateReactiveService} specifies the prototypes for performing business logic. - * - * @param an object extending the {@link BaseServiceRequest} - * @param an object extending the {@link BaseServiceResponse} - * @author Francois Gutt - */ -public abstract class BaseCreateReactiveService< - I extends BaseServiceRequest, - O extends BaseServiceResponse - > extends BaseService { - - /** - * Add a single resource. - * - * @param request body received from the controller - * @return response body to the controller - */ - public Mono create(I request) { - logger.entry(request); - final var response = executeCreate(request); - logger.exit(); - return response; - } - - /** - * Prototype for adding a resource. - * - * @param request body received from the controller - * @return response body to the controller - */ - protected abstract Mono executeCreate(I request); -} diff --git a/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseDeleteReactiveService.java b/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseDeleteReactiveService.java deleted file mode 100644 index 1a095650e..000000000 --- a/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseDeleteReactiveService.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2020 American Express Travel Related Services Company, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package io.americanexpress.synapse.service.reactive.service; - -import io.americanexpress.synapse.service.reactive.model.BaseServiceRequest; -import reactor.core.publisher.Mono; - -/** - * {@code BaseDeleteReactiveService} class specifies the prototypes for performing business logic. - * - * @author Francois Gutt - */ -public abstract class BaseDeleteReactiveService< - I extends BaseServiceRequest - > extends BaseService { - /** - * Deletes a resource by id. - * - * @return a mono void - */ - public Mono delete(I serviceRequest) { - logger.entry(); - var results = executeDelete(serviceRequest); - logger.exit(); - return results; - } - - /** - * Prototype for deleting a resource. - * - * @return a mono void - */ - protected abstract Mono executeDelete(I serviceRequest); -} diff --git a/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseGetFluxReactiveService.java b/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseGetFluxReactiveService.java deleted file mode 100644 index ebe57d1a2..000000000 --- a/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseGetFluxReactiveService.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2020 American Express Travel Related Services Company, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package io.americanexpress.synapse.service.reactive.service; - -import io.americanexpress.synapse.service.reactive.model.BaseServiceRequest; -import io.americanexpress.synapse.service.reactive.model.BaseServiceResponse; -import reactor.core.publisher.Flux; - -/** - * {@code BaseGetFluxReactiveService} class specifies the prototypes for performing business logic. - * - * @param an object extending the {@link BaseServiceResponse} - * @author Francois Gutt - */ -public abstract class BaseGetFluxReactiveService< - I extends BaseServiceRequest, - O extends BaseServiceResponse - > extends BaseService { - - /** - * Retrieves multiple resource. - * - * @return a flux read response - */ - public Flux read(I serviceRequest) { - logger.entry(); - var response = executeRead(serviceRequest); - logger.exit(); - return response; - } - - /** - * Prototype for reading multiple resources. - * - * @return a flux read response - */ - protected abstract Flux executeRead(I serviceRequest); -} diff --git a/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseGetMonoReactiveService.java b/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseGetMonoReactiveService.java deleted file mode 100644 index 6c71810d2..000000000 --- a/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseGetMonoReactiveService.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2020 American Express Travel Related Services Company, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package io.americanexpress.synapse.service.reactive.service; - -import io.americanexpress.synapse.service.reactive.model.BaseServiceRequest; -import io.americanexpress.synapse.service.reactive.model.BaseServiceResponse; -import org.springframework.http.HttpHeaders; -import reactor.core.publisher.Mono; - -/** - * {@code BaseGetMonoReactiveService} class specifies the prototypes for performing business logic. - * - * @param an object extending the {@link BaseServiceResponse} - * @author Francois Gutt - */ -public abstract class BaseGetMonoReactiveService< - I extends BaseServiceRequest, - O extends BaseServiceResponse - > extends BaseService { - - /** - * Retrieves one resource. - * - * @param serviceRequest the service request - * @return a mono read response - */ - public Mono read(I serviceRequest) { - logger.entry(serviceRequest); - final var response = executeRead(serviceRequest); - logger.exit(); - return response; - } - - /** - * Prototype for reading a resource. - * - * @param serviceRequest the service request - * @return a mono read response - */ - protected abstract Mono executeRead(I serviceRequest); -} diff --git a/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseReadFluxReactiveService.java b/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseReadFluxReactiveService.java deleted file mode 100644 index 491579863..000000000 --- a/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseReadFluxReactiveService.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2020 American Express Travel Related Services Company, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package io.americanexpress.synapse.service.reactive.service; - -import io.americanexpress.synapse.service.reactive.model.BaseServiceRequest; -import io.americanexpress.synapse.service.reactive.model.BaseServiceResponse; -import org.springframework.http.HttpHeaders; -import reactor.core.publisher.Flux; - -/** - * {@code BaseReadFluxReactiveService} class specifies the prototypes for performing business logic. - * @param an object extending the {@link BaseServiceRequest} - * @param an object extending the {@link BaseServiceResponse} - * @author Francois Gutt - */ -public abstract class BaseReadFluxReactiveService< - I extends BaseServiceRequest, - O extends BaseServiceResponse - > extends BaseService { - - /** - * Retrieves multiple resources with a request body. - * - * @param request a base service request - * @return a flux read response - */ - public Flux read(final I request) { - logger.entry(request); - final var response = executeRead(request); - logger.exit(response); - return response; - } - - /** - * Prototype for reading multiple resources. - * - * @param request a base service request - * @return a flux read response - */ - protected abstract Flux executeRead(I request); -} diff --git a/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseReadMonoReactiveService.java b/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseReadMonoReactiveService.java deleted file mode 100644 index d6f333474..000000000 --- a/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseReadMonoReactiveService.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2020 American Express Travel Related Services Company, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package io.americanexpress.synapse.service.reactive.service; - -import io.americanexpress.synapse.service.reactive.model.BaseServiceRequest; -import io.americanexpress.synapse.service.reactive.model.BaseServiceResponse; -import reactor.core.publisher.Mono; - -/** - * {@code BaseReadMonoReactiveService} class specifies the prototypes for performing business logic. - * - * @param an object extending the {@link BaseServiceRequest} - * @param an object extending the {@link BaseServiceResponse} - * @author Francois Gutt - */ -public abstract class BaseReadMonoReactiveService< - I extends BaseServiceRequest, - O extends BaseServiceResponse - > extends BaseService { - - /** - * Retrieves one resource with a request body. - * - * @param request a service request - * @return a mono service response - */ - public Mono read(I request) { - logger.entry(request); - final var response = executeRead(request); - logger.exit(); - return response; - } - - /** - * Prototype for reading a resource. - * - * @param request a service request - * @return a mono service response - */ - protected abstract Mono executeRead(I request); -} diff --git a/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseService.java b/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseService.java index 4362e3c91..7ba04f011 100644 --- a/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseService.java +++ b/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseService.java @@ -13,6 +13,9 @@ */ package io.americanexpress.synapse.service.reactive.service; +import io.americanexpress.synapse.service.reactive.model.BaseServiceRequest; +import io.americanexpress.synapse.service.reactive.model.BaseServiceResponse; +import org.reactivestreams.Publisher; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; @@ -21,11 +24,27 @@ * * @author Francois Gutt */ -public abstract class BaseService { +public abstract class BaseService< + I extends BaseServiceRequest, + O extends Publisher> { /** * Logger for the base service. */ protected final XLogger logger = XLoggerFactory.getXLogger(getClass()); + /** + * Execute service logic + * + * @param request received from the controller + * @return response to the controller + */ + public O execute(I request) { + logger.entry(request); + final var response = doExecute(request); + logger.exit(); + return response; + } + + protected abstract O doExecute(I request); } diff --git a/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseUpdateReactiveService.java b/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseUpdateReactiveService.java deleted file mode 100644 index dbb5935f7..000000000 --- a/service/synapse-service-reactive/src/main/java/io/americanexpress/synapse/service/reactive/service/BaseUpdateReactiveService.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2020 American Express Travel Related Services Company, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package io.americanexpress.synapse.service.reactive.service; - -import io.americanexpress.synapse.service.reactive.model.BaseServiceRequest; -import io.americanexpress.synapse.service.reactive.model.BaseServiceResponse; -import reactor.core.publisher.Mono; - -/** - * {@code BaseUpdateReactiveService} class specifies the prototypes for performing business logic. - * - * @param an object extending the {@link BaseServiceRequest} - * @param an object extending the {@link BaseServiceResponse} - * @author Francois Gutt - */ -public abstract class BaseUpdateReactiveService< - I extends BaseServiceRequest, - O extends BaseServiceResponse - > extends BaseService { - - /** - * Update a single resource reactively. - * - * @param request body received from the controller - * @return a mono void - */ - public Mono update(I request) { - logger.entry(request); - var results = executeUpdate(request); - logger.exit(); - return results; - } - - /** - * Prototype for updating a resource. - * - * @param request body received from the controller - * @return a mono void - */ - protected abstract Mono executeUpdate(I request); -} diff --git a/service/synapse-service-rest/pom.xml b/service/synapse-service-rest/pom.xml index b9ed57f3d..0ebfa8453 100644 --- a/service/synapse-service-rest/pom.xml +++ b/service/synapse-service-rest/pom.xml @@ -18,7 +18,7 @@ io.americanexpress.synapse service - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 @@ -35,10 +35,10 @@ io.americanexpress.synapse synapse-framework-exception - - io.americanexpress.synapse - synapse-framework-api-docs - + + + + io.americanexpress.synapse synapse-utilities-common @@ -134,9 +134,8 @@ - io.swagger - swagger-annotations - 1.6.6 + io.swagger.core.v3 + swagger-annotations-jakarta diff --git a/service/synapse-service-rest/src/main/java/io/americanexpress/synapse/service/rest/config/ServiceRestConfig.java b/service/synapse-service-rest/src/main/java/io/americanexpress/synapse/service/rest/config/ServiceRestConfig.java index e74db9ba6..e907921e1 100644 --- a/service/synapse-service-rest/src/main/java/io/americanexpress/synapse/service/rest/config/ServiceRestConfig.java +++ b/service/synapse-service-rest/src/main/java/io/americanexpress/synapse/service/rest/config/ServiceRestConfig.java @@ -14,7 +14,7 @@ package io.americanexpress.synapse.service.rest.config; import com.fasterxml.jackson.databind.ObjectMapper; -import io.americanexpress.synapse.framework.api.docs.ApiDocsConfig; +//import io.americanexpress.synapse.framework.api.docs.ApiDocsConfig; import io.americanexpress.synapse.framework.exception.config.ExceptionConfig; import io.americanexpress.synapse.service.rest.interceptor.MetricInterceptor; import io.americanexpress.synapse.utilities.common.config.UtilitiesCommonConfig; @@ -39,7 +39,8 @@ */ @Configuration @ComponentScan(basePackages = "io.americanexpress.synapse.service.rest") -@Import({ExceptionConfig.class, ApiDocsConfig.class, UtilitiesCommonConfig.class}) +//@Import({ExceptionConfig.class, ApiDocsConfig.class, UtilitiesCommonConfig.class}) +@Import({ExceptionConfig.class, UtilitiesCommonConfig.class}) public class ServiceRestConfig implements WebMvcConfigurer { /** diff --git a/service/synapse-service-rest/src/main/java/io/americanexpress/synapse/service/rest/controller/exceptionhandler/ControllerExceptionHandler.java b/service/synapse-service-rest/src/main/java/io/americanexpress/synapse/service/rest/controller/exceptionhandler/ControllerExceptionHandler.java index 9ae0e98b6..0b8e083a4 100644 --- a/service/synapse-service-rest/src/main/java/io/americanexpress/synapse/service/rest/controller/exceptionhandler/ControllerExceptionHandler.java +++ b/service/synapse-service-rest/src/main/java/io/americanexpress/synapse/service/rest/controller/exceptionhandler/ControllerExceptionHandler.java @@ -99,7 +99,7 @@ public ResponseEntity handleApplicationClientException(final Appl ? applicationClientException.getMessageArguments() : new String[]{StringUtils.EMPTY}); String developerMessage = StringUtils.isNotBlank(applicationClientException.getDeveloperMessage()) ? applicationClientException.getDeveloperMessage() : StringUtils.EMPTY; ErrorResponse errorResponse = new ErrorResponse(errorCode, errorCode.getMessage(), message, developerMessage); - errorResponseEntity = ResponseEntity.status(errorCode.getHttpStatus()).body(errorResponse); + errorResponseEntity = ResponseEntity.status(errorCode.getHttpStatus().value()).body(errorResponse); } else { errorResponseEntity = handleInternalServerError(applicationClientException); } @@ -150,7 +150,7 @@ public ResponseEntity handleHttpMessageNotReadableException(HttpM String userMessage = httpMessageNotReadableException.getMessage(); ErrorCode errorCode = ErrorCode.GENERIC_4XX_ERROR; final ErrorResponse errorResponse = new ErrorResponse(errorCode, errorCode.getMessage(), userMessage, "Input validation"); - final ResponseEntity errorResponseEntity = ResponseEntity.status(errorCode.getHttpStatus()).body(errorResponse); + final ResponseEntity errorResponseEntity = ResponseEntity.status(errorCode.getHttpStatus().value()).body(errorResponse); logger.exit(errorResponseEntity); return errorResponseEntity; } @@ -180,7 +180,7 @@ private ResponseEntity handleInternalServerError(Throwable throwa String fullStackTrace = ApplicationServerException.getStackTrace(throwable, System.lineSeparator()); ErrorCode errorCode = ErrorCode.GENERIC_5XX_ERROR; ErrorResponse errorResponse = new ErrorResponse(errorCode, errorCode.getMessage(), message, CryptoUtil.encrypt(fullStackTrace)); - return ResponseEntity.status(errorCode.getHttpStatus()).body(errorResponse); + return ResponseEntity.status(errorCode.getHttpStatus().value()).body(errorResponse); } /** diff --git a/service/synapse-service-rest/src/main/java/io/americanexpress/synapse/service/rest/model/ServiceRouting.java b/service/synapse-service-rest/src/main/java/io/americanexpress/synapse/service/rest/model/ServiceRouting.java index ba46fa790..dbe4e3825 100644 --- a/service/synapse-service-rest/src/main/java/io/americanexpress/synapse/service/rest/model/ServiceRouting.java +++ b/service/synapse-service-rest/src/main/java/io/americanexpress/synapse/service/rest/model/ServiceRouting.java @@ -13,7 +13,7 @@ */ package io.americanexpress.synapse.service.rest.model; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Objects; @@ -43,7 +43,7 @@ public ServiceRouting() { * * @return the client identifier. */ - @ApiModelProperty(value = "Unique client id assigned to the consumer") + @Schema(description = "Unique client id assigned to the consumer") public String getClientId() { return clientId; } diff --git a/service/synapse-service-rest/src/main/java/io/americanexpress/synapse/service/rest/model/ServiceTrace.java b/service/synapse-service-rest/src/main/java/io/americanexpress/synapse/service/rest/model/ServiceTrace.java index b03cdae47..895043ff9 100644 --- a/service/synapse-service-rest/src/main/java/io/americanexpress/synapse/service/rest/model/ServiceTrace.java +++ b/service/synapse-service-rest/src/main/java/io/americanexpress/synapse/service/rest/model/ServiceTrace.java @@ -13,7 +13,7 @@ */ package io.americanexpress.synapse.service.rest.model; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Objects; @@ -42,7 +42,7 @@ public ServiceTrace() { * * @return the correlationId */ - @ApiModelProperty(value = "This is a unique identifier used for operational logging purposes") + @Schema(description = "This is a unique identifier used for operational logging purposes") public String getCorrelationId() { return correlationId; } diff --git a/service/synapse-service-rest/src/main/java/io/americanexpress/synapse/service/rest/package-info.java b/service/synapse-service-rest/src/main/java/io/americanexpress/synapse/service/rest/package-info.java new file mode 100644 index 000000000..199955691 --- /dev/null +++ b/service/synapse-service-rest/src/main/java/io/americanexpress/synapse/service/rest/package-info.java @@ -0,0 +1,5 @@ +/** + * @deprecated As of release 0.4.0, replaced by new API module synapse-api-rest-imperative. + */ +@Deprecated(since = "0.4.0", forRemoval = true) +package io.americanexpress.synapse.service.rest; \ No newline at end of file diff --git a/service/synapse-service-rest/src/test/java/io/americanexpress/synapse/service/rest/ServiceRestUnitTestSuite.java b/service/synapse-service-rest/src/test/java/io/americanexpress/synapse/service/rest/ServiceRestUnitTestSuite.java index 3941b7b7b..aafd3fa00 100644 --- a/service/synapse-service-rest/src/test/java/io/americanexpress/synapse/service/rest/ServiceRestUnitTestSuite.java +++ b/service/synapse-service-rest/src/test/java/io/americanexpress/synapse/service/rest/ServiceRestUnitTestSuite.java @@ -13,11 +13,10 @@ */ package io.americanexpress.synapse.service.rest; -import org.junit.platform.runner.JUnitPlatform; import org.junit.platform.suite.api.SelectPackages; -import org.junit.runner.RunWith; +import org.junit.platform.suite.api.Suite; -@RunWith(JUnitPlatform.class) +@Suite @SelectPackages("io.americanexpress.synapse.service.rest") public class ServiceRestUnitTestSuite { } diff --git a/service/synapse-service-rest/src/test/java/io/americanexpress/synapse/service/rest/controller/helpers/MonoResponseEntityCreatorTest.java b/service/synapse-service-rest/src/test/java/io/americanexpress/synapse/service/rest/controller/helpers/MonoResponseEntityCreatorTest.java index eb7e19685..f087e669a 100644 --- a/service/synapse-service-rest/src/test/java/io/americanexpress/synapse/service/rest/controller/helpers/MonoResponseEntityCreatorTest.java +++ b/service/synapse-service-rest/src/test/java/io/americanexpress/synapse/service/rest/controller/helpers/MonoResponseEntityCreatorTest.java @@ -15,10 +15,10 @@ import io.americanexpress.synapse.service.rest.controller.helpers.model.BaseServiceResponseTest; -import org.junit.Test; import java.util.Objects; import java.util.UUID; +import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; diff --git a/service/synapse-service-test/pom.xml b/service/synapse-service-test/pom.xml index 76911929c..6b20d834a 100644 --- a/service/synapse-service-test/pom.xml +++ b/service/synapse-service-test/pom.xml @@ -18,7 +18,7 @@ io.americanexpress.synapse service - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 @@ -34,12 +34,14 @@ io.americanexpress.synapse synapse-framework-test + compile org.springframework.boot spring-boot-starter-test + compile org.springframework.boot @@ -62,6 +64,16 @@ org.mockito mockito-core + + org.junit.jupiter + junit-jupiter + compile + + + org.junit.jupiter + junit-jupiter-api + compile + diff --git a/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseControllerIT.java b/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseControllerIT.java index e487d4d2e..25326e395 100644 --- a/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseControllerIT.java +++ b/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseControllerIT.java @@ -7,5 +7,6 @@ * * @param the type parameter */ +@Deprecated public abstract class BaseControllerIT extends BaseControllerTest { } diff --git a/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseControllerTest.java b/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseControllerTest.java index 86d077891..8faf3f3c1 100644 --- a/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseControllerTest.java +++ b/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseControllerTest.java @@ -1,8 +1,10 @@ package io.americanexpress.synapse.service.test.controller; +import com.fasterxml.jackson.databind.ObjectMapper; import io.americanexpress.synapse.service.rest.model.BaseServiceResponse; import io.americanexpress.synapse.utilities.common.io.IOUtils; -import com.fasterxml.jackson.databind.ObjectMapper; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; import org.apache.commons.lang3.StringUtils; import org.hamcrest.Matchers; import org.junit.jupiter.api.Assertions; @@ -23,9 +25,6 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; - /** * The type Base controller test. * This class is not meant to be extended directly. @@ -33,6 +32,7 @@ * @param the type parameter */ @ExtendWith(SpringExtension.class) +@Deprecated public abstract class BaseControllerTest { /** diff --git a/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseControllerUnitTest.java b/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseControllerUnitTest.java index 752a2bb4b..aee0377da 100644 --- a/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseControllerUnitTest.java +++ b/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseControllerUnitTest.java @@ -14,6 +14,7 @@ * @param the type parameter */ @Profile(ProfileConstants.TEST) +@Deprecated public abstract class BaseControllerUnitTest extends BaseControllerTest { /** diff --git a/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseCreateMonoControllerUnitTest.java b/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseCreateMonoControllerUnitTest.java index 39d0926ea..236840947 100644 --- a/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseCreateMonoControllerUnitTest.java +++ b/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseCreateMonoControllerUnitTest.java @@ -21,6 +21,7 @@ * @param the type parameter * @param the type parameter */ +@Deprecated public abstract class BaseCreateMonoControllerUnitTest> extends BaseControllerUnitTest{ /** diff --git a/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseDeleteControllerUnitTest.java b/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseDeleteControllerUnitTest.java index 1ef2d1a5a..81502fb54 100644 --- a/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseDeleteControllerUnitTest.java +++ b/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseDeleteControllerUnitTest.java @@ -1,9 +1,10 @@ package io.americanexpress.synapse.service.test.controller; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doThrow; import io.americanexpress.synapse.framework.exception.ApplicationClientException; import io.americanexpress.synapse.framework.exception.model.ErrorCode; import io.americanexpress.synapse.service.rest.model.BaseServiceResponse; -import io.americanexpress.synapse.service.rest.model.ServiceHeaders; import io.americanexpress.synapse.service.rest.service.BaseDeleteService; import org.apache.commons.lang3.StringUtils; import org.junit.jupiter.api.Test; @@ -13,15 +14,13 @@ import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.doThrow; - /** * The type Base delete controller test. * * @param the type parameter * @param the type parameter */ +@Deprecated public abstract class BaseDeleteControllerUnitTest extends BaseControllerUnitTest { /** diff --git a/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseGetMonoControllerUnitTest.java b/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseGetMonoControllerUnitTest.java index 10dce63bc..fa7970e77 100644 --- a/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseGetMonoControllerUnitTest.java +++ b/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseGetMonoControllerUnitTest.java @@ -19,6 +19,7 @@ * @param the type parameter * @param the type parameter */ +@Deprecated public abstract class BaseGetMonoControllerUnitTest> extends BaseControllerUnitTest { /** diff --git a/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseReadMonoControllerUnitTest.java b/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseReadMonoControllerUnitTest.java index fd2b49b62..77118e561 100644 --- a/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseReadMonoControllerUnitTest.java +++ b/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseReadMonoControllerUnitTest.java @@ -21,6 +21,7 @@ * @param the type parameter * @param the type parameter */ +@Deprecated public abstract class BaseReadMonoControllerUnitTest> extends BaseControllerUnitTest { /** diff --git a/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseReadPolyControllerUnitTest.java b/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseReadPolyControllerUnitTest.java index 5dcd84331..0ffc0e972 100644 --- a/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseReadPolyControllerUnitTest.java +++ b/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseReadPolyControllerUnitTest.java @@ -6,6 +6,8 @@ import io.americanexpress.synapse.service.rest.model.BaseServiceRequest; import io.americanexpress.synapse.service.rest.model.BaseServiceResponse; import io.americanexpress.synapse.service.rest.service.BaseReadPolyService; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang3.StringUtils; import org.junit.jupiter.api.Test; import org.mockito.ArgumentMatchers; @@ -16,9 +18,6 @@ import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; -import java.util.ArrayList; -import java.util.List; - /** * The type Base read poly controller test. * @@ -26,6 +25,7 @@ * @param the type parameter * @param the type parameter */ +@Deprecated public abstract class BaseReadPolyControllerUnitTest> extends BaseControllerUnitTest { /** diff --git a/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseUpdateControllerUnitTest.java b/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseUpdateControllerUnitTest.java index 0b9270340..e29430803 100644 --- a/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseUpdateControllerUnitTest.java +++ b/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/BaseUpdateControllerUnitTest.java @@ -21,6 +21,7 @@ * @param the type parameter * @param the type parameter */ +@Deprecated public abstract class BaseUpdateControllerUnitTest> extends BaseControllerUnitTest { /** diff --git a/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/package-info.java b/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/package-info.java new file mode 100644 index 000000000..a4abb3eba --- /dev/null +++ b/service/synapse-service-test/src/main/java/io/americanexpress/synapse/service/test/controller/package-info.java @@ -0,0 +1,5 @@ +/** + * @deprecated As of release 0.4.0, to be replaced by new API module. + */ +@Deprecated(since = "0.4.0", forRemoval = true) +package io.americanexpress.synapse.service.test.controller; \ No newline at end of file diff --git a/subscriber/pom.xml b/subscriber/pom.xml index 3bea4612e..f9ad4e5ea 100644 --- a/subscriber/pom.xml +++ b/subscriber/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/subscriber/synapse-subscriber-kafka/pom.xml b/subscriber/synapse-subscriber-kafka/pom.xml index a115dbcb2..d734750dd 100644 --- a/subscriber/synapse-subscriber-kafka/pom.xml +++ b/subscriber/synapse-subscriber-kafka/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse subscriber - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/subscriber/synapse-subscriber-kafka/src/main/java/io/americanexpress/synapse/subscriber/kafka/config/BaseKafkaPropertiesConfiguration.java b/subscriber/synapse-subscriber-kafka/src/main/java/io/americanexpress/synapse/subscriber/kafka/config/BaseKafkaPropertiesConfiguration.java index 560bc1e4e..78ec2a9a9 100644 --- a/subscriber/synapse-subscriber-kafka/src/main/java/io/americanexpress/synapse/subscriber/kafka/config/BaseKafkaPropertiesConfiguration.java +++ b/subscriber/synapse-subscriber-kafka/src/main/java/io/americanexpress/synapse/subscriber/kafka/config/BaseKafkaPropertiesConfiguration.java @@ -95,7 +95,8 @@ public Consumer getConsumer() { */ @Override public Map buildConsumerProperties() { - return this.getConsumer().buildProperties(); + //TODO: look into line below. + return this.getConsumer().buildProperties(null); } diff --git a/utility/pom.xml b/utility/pom.xml index 1afccbabf..a6d0201fa 100644 --- a/utility/pom.xml +++ b/utility/pom.xml @@ -17,7 +17,7 @@ io.americanexpress.synapse synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/utility/synapse-utilities-common/pom.xml b/utility/synapse-utilities-common/pom.xml index 6f56f1613..2f2a40ee6 100644 --- a/utility/synapse-utilities-common/pom.xml +++ b/utility/synapse-utilities-common/pom.xml @@ -18,7 +18,7 @@ io.americanexpress.synapse utility - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/utility/synapse-utilities-common/src/test/java/io/americanexpress/synapse/utilities/common/UnitTestSuite.java b/utility/synapse-utilities-common/src/test/java/io/americanexpress/synapse/utilities/common/UnitTestSuite.java index 009788962..6db1b5a72 100644 --- a/utility/synapse-utilities-common/src/test/java/io/americanexpress/synapse/utilities/common/UnitTestSuite.java +++ b/utility/synapse-utilities-common/src/test/java/io/americanexpress/synapse/utilities/common/UnitTestSuite.java @@ -13,11 +13,10 @@ */ package io.americanexpress.synapse.utilities.common; -import org.junit.platform.runner.JUnitPlatform; import org.junit.platform.suite.api.SelectPackages; -import org.junit.runner.RunWith; +import org.junit.platform.suite.api.Suite; -@RunWith(JUnitPlatform.class) +@Suite @SelectPackages({"com.americanexpress.synapse.utilities.common"}) public class UnitTestSuite { diff --git a/utility/synapse-utilities-common/src/test/java/io/americanexpress/synapse/utilities/common/encoding/CryptoUtilTest.java b/utility/synapse-utilities-common/src/test/java/io/americanexpress/synapse/utilities/common/encoding/CryptoUtilTest.java index 71d4c5b53..b8f1b3784 100644 --- a/utility/synapse-utilities-common/src/test/java/io/americanexpress/synapse/utilities/common/encoding/CryptoUtilTest.java +++ b/utility/synapse-utilities-common/src/test/java/io/americanexpress/synapse/utilities/common/encoding/CryptoUtilTest.java @@ -23,7 +23,7 @@ */ class CryptoUtilTest { - private static final String ENCRYPTED_VALUE = "0fvMPUD069EJ7pJ4rmkdMtqc+83aES_jmGYKX57jL4e2XXeX4DBmA68qypDCzL08WMunmo0JzR6ey+RIRyaAUDH5YgjisXexxnDW0nMDb48fwi0+b69YvrF+ZIkDLrQYorlUefGxIOR01mtmTiKfQEdaaJ4w4CtVtKdAsd9QAC7_zWlAtQ_Ubsz++12PS8iDGlyK35T54j8nCHwcwZQd8tq9uvV8nocVUQBxgRVp5keJGA5e5Ujcb830l9NdEC2QanoVAde+PVgZMMpQcbJMgbwn139qfRN5+YDKNlsBONaejXOVfpMU18Ztr16+HZ4Jd5bTSk4UrZtRSAv8CZ9eBGBg6VURi3513YgFoVtIjuQVz4X7waIfBlwvjg_hmmWwQbQXidCQPQyre8mvTlt5iXcm7e0ZxxMvsXYYSkUSFe00BzV4fmHsmK9TwCOEjAgsO11KVnjnynyQCh551qskDZFfIO47o5n1gfLW3uPmUwnGiqMkUtr9WSBdVZ_dSmzs90+cLY7zahgOF9At0z6t4QwIFvPOmc39gkwOU+mStg66wwPnK0psSU79rNGTtxHWqYAG3jBoTUJLnCXbUM+bYrmPr0wECBV3yiAVHJnMrCOoSF1rIIlt5tEC3uL3eA+XXxRtz8Ia9JvTGlcOXZQWkdEC+HR+IG2HaR4nxpFu2tWmm5oa4lEMivoz5FE0aKfge9fvN9D7p1hENhDKcBwu8ByBgLvIAH7ZOeOQuJD+aujAiABoE3KAHob0UQ3Q5RgtDe7HvXn5WqDCLz6fupddiuNW10zA9E3jmOmjVdTdHwk5lDMXWlC79hTgHpk50vp2laa+pQCtADclS7W8shnKpEO4KE0egq1FxxbEMvGDpB2IsTlGtzTmELuI6cc6STOHM6BL0uMkmUJGJwK8AAsxPKVrZfKZqGh9i6cLRGEQks2iG_TFjexz6D5wdkKyaF6kIbkn5qRLViZaX1bZooFM6PA_t407XuLVGMFPfK3LecIL9gV9Sw9cyH9oCJ77OD2HSjSLYBhJTVKrt2ikdu63F6Se+nJ+Xi2dAKTtOR478xAiVwvnzIxbNJYWggJMGD21ryt5b1_o7UBNoqT0+0048zsTzPEBHslJbcaOY97C97PUgVyWo_F1sztqkpEuv6KXPptwWxc819L6pmbqyL0qXMhyMuBPJRdqUlCloVzDq_x+szi7gRrbLKBCHT5hy9qKKYNJXa0syShV6LVUNGx04B4L_TzKUDehJ7pMHRkYiLCzBlOJWBsu7J63MGWNzZlKhmXRXYqD_X8sD3rqCtdKM6xfmpr3HkMS8C9kNMTfo_Po8wEQOTNI780B4bcvE3qheslUfG0bbBiZmUpvImodYa8DgcCgYzKjKGVScRDj0pcEDDa5ol1nc3zPdQMNdCMchAdUfWQdTaEJmKXtC1XSjPhyvyboW1em_6qM4KN_kK+EycOmRjQTf9NGF5FqGp619Q7rhcWBB+Jwz8yYQa1MpRTLe74S_n67tneSzP27JL94HWQ2IBn_VAypW_dJpSVW5kzNA7LMNi4P3iTl4txzEBWVK37CNnafc3Dh7S+FrmmFDyRrg2qrKkQU7uPk7CUI81fjZksQyp4dx1QDZd15QvfNdRUq_yEYGEbKoiNCryRq_uSBkk1KoROqC1IJ_rB42SQaAjz2reNDvUNyRnZaa5NyZbUT3YH93qyJQycF6tWZZU5RI3MbTM4VBBU45RXGuET+nvfIdKk0cJT1oKLfjGZ9NFB2M+QuH8ZWLdm0LVdd7+0SiIk+qpTfGTpmTyVuwM75Tuibm2uvW9a51JVewHtmxP1eyuzOle3AlvOrXKC+txxUoHlbZi+wzaanvr0ahgXJP+UVonhNx7uH_fkT+mhX8rSVs0gs2cltFeThIQgnhXohOWs89UYzJER9iYU5DeLa3DuEY59ufp887ZxOGyZ_D2XAgycS7quEVxh9kLvYcxck5h0t1Y9_f1kzpyxNQTLH9mvtPR8U5_vB5fKpALBTVwgWaDhaTpGx8zajOSnn3ekBI590VgegS0tDkGcAkAvFLqEgPcgdNLHbu1w+Cc+9n7EN8+FyXIuc+vdrZ17cclgYsMw1Aer_PIciaIKNVV1wSDKBTrI5dL1N308s25K6FNemnCUJeGp3JtDWZkPFsk3+GdTwUIKxmRS4GrpeysJYORyN+2n6F55VKHphOiSXkpxbG7L6FlS5cwlviz4_4gl5KCD5J_yGfOVu6+oRiQoCHuM6qjmYHqiDNJqfI6jH0fPnqTOI5+vRXPUg3rVLaESXaXRBnNluNHRG7S0cMHqB5EUUib+M5Z28QgDHZBezC5qkjYgkNnpkl6JNCA6nLUONHsH+bPb+kJ+gnFEXF1mhH+Eja8n72kL6pB0LQnw7sTWabB9jqHk2rM22w1GAU_uoi7ukG24H26kWbMDIXJqCCHIn5huXxfTrkVK7uysMjXTgwHFNhhB85o6NgobQLm3lCeM68FR9dBIF70YPp9reY4Zak1F3tG4dk+cK+TdUSdVV_4m+mYimscHgWbzeJA3ZIQyP8_ps4ik8Og2ND7yK41WHUwuwFEay6f5w19z2j7ANckQm_Es_tZ7Wn0fZLmw_CtVDQm5DzFghqMApH4KvuoyKpJkAzjNA8bJaSSaEY_Xl+ntjVCXUU2zQbAQngzSoX+lETH_ZpSCm2zZluprFhQKTA0lzf+kYg_N+AlVNpJCElMNgj4rX4sMRzrieC8NUqHng2xqW5qS2_QhY31L7HJebVGVAt7uiRi+161BZ+HBvYn2coBVEbkz32mcyRWtASbf79OhfPDz3jlSb6QWPb9zfcoutIeYlrrfdyTOK8Qk27_byOtut1CGDGgYCqoNIkTkALS2gZdeLgj8cTjjRC9PDJuHHOb78O3pyT71ir8W5MyfY_Ne+ZiEIxYDYLcwPKRVkA1xfTC26wmeLA7ofb33hMF5LJIPpkJOqE99DpMpGJOvuhw7m9UfM+dRd5xWNUfXgr5yCsKS3512DkxZPpVGgL94j6yyVybbY2N04vIzGaODu7TqF0ciVjIKt_XstrwlKNG7ImDAhLA8YRwADbEwKRW1gMkkjss5Q1l6m9jUrOekVut+fHDWvEXx5vRwdziYZZS48YmyTq9+LYnITF9LDS_XxUgwpbKu6Zrnn7TqnsBZVEIoBRFOYCoodP9dE+m+UWbqNm8dh76bqWHUA3+mfgwnetcgrWrLoLyOziMFBSRVyaAroHaO87CwupCRAgKG0IlQbdc33nTjQqm52ZO80pq4KRE5FXJ3ID5GflPtRHolEXVvFJs1K_I2c0SrWlUVcaD0E1xG8bHIbK+0pjbpo1bcP8hCQq2IlfeKBPrl8JvzthLHnijiBZvzRno9nne3GSqYubzF0c8k0MOw+R9U1iMVBwXAP3a4EDS4MIRmlQ609_coo7ZXn9tTraVijl4Ge+Nf93dE6caxGYq7lFMqrWpSLV8LBNOtBHPbvjgKyQuyDZ8KtwLm4+TxXQZF2orUlPMvpM3FgSCpR88eaKEm74Z3EOx5Q4f8G_OM_w0x+VDcR9e33Yqgh3z46Od3ImvELILSNrHMnHRxPjk3DocR9qStTSevXO0rXDsQPB0wqlDcasOT8rSZqeOULflAjQl6eoGE5x2wvP27xEtSopsOY4RezmYtO+titfy2kZQi4tPcRIELR0kwdT6QLuqQcXetaPu07Jsgnh4b3ruxUHeuHOlEKLPuxbkfxCPi5AQzfMUFevTLYNi8hVPgGTUuNNic09f4iJrEQRVmHAFWVfgzNxXhod+iyUz+yi6Xoo+hK9E6GD5N1Ayayt+bdkJ5eLWRvWVjUjMQdPhZo8Ch2_AATOzXq3uwmtskmeVou+NbJpUOwjG_zakwc_7jxB4ckquqPprNjUcsowr2vFH9BAeYrDMarIPAxgUIs5GDZs+JqaYmennRur+n_G8DSF3LN+ftVk+W2m1PLthqQAXsBBX0iKBQYfV4mB+djeFkWdyAZ_GXyXg_r+fekbfiBOqBoRsoUFtbI+jEN58A66hnaTjmg8RH3ivNF3AvGtD7798YmzQZyenONEDaioede0qSF2kdxmSboFksI6DXFGsyxarfZ6a_EDvwUREWtbLQW66Fsb4cNJCrkyYRL6rqHax2hPTi_P31YEq9EORwhM69Thn_RIo+12WBLlwPXBiIbWmQe2VgDYQLEQqACGneu3o10QZs6e_A_sM4vk+sz0b+8ET8Gv9m1qgGI6s7n2RkUJV83WKvT1mZEdyc7mpOhkT7kqy3vNwZQQTCAxSa+NLnX9hk7JMcPvA_LkyTLi0ESgic1x_iX_n5nqPC_2In2kdBt5RlfOzo0v_rI3jKSxhU_ZNcygUZZvjXM9sV_cinHrkmUHa43T06LwR7lQrtrcALkS3qFEXsjUsMAX3lkRvmGlGCIRAmsuepH8EIATt9tBvKnDh_twDmmXWsk_JMSLCOV0HpsZ3fQLWGpXOPCg6j_YRJ+ANtNbC+EJT55bnXXoyViT6X50fi8E9Esg4+0E+UVRQUfuCdo3b0GTRk_vS5StXEoZAyfhbsNNaOkyTcDpwGbn3pYWEn_NFodSM1TOOJfpvskcZo96kQlMlTBayiHPm+zEL61dbOoTvmGKYRcnZm1HJ6Elqz2NjMw0tXn5L7XAvFa9Vrbnm04HCTfX92mZgZbHYcoqvqO8VrW0dDmtgfFrKpVGc0O_Ybx2sq_gXh+Vzq2JFevg2hRkKh_oaM0145Z49TQURStDPDEQZgS9G+TBeROw0rmvjvGukqrou8oAHOFCHO9adxDon8JEQuPkCTSl0M8qGSlZP9YCBkqHtv8Dlf0y3kh8XSBy97nmDGboF4mPA1lGxm8i+N17I2uk0j0Hu3QzZB0CX_3qmLh9jK6ujv96a123xK3Vhm9HeviLrENv8kCPGyy4vPCZWFysJM1FR3IIX0lcHSqZzj9m9+CYkucdfyHGzduPgBZLO++EU80_oYiByAGeF3XrjTvBUmD63j91fYgkRQ9P8bYm93ihUsyI_qd_cKROCsFoz7bOCMvVnzp8vIzHmF2T1nZvBGQQCZ0E5xlRNEsNEc4Vy9F3frBFRKweI4SX61g1lasqwfTmuope4tF_awO09vkPmec7qWs5jwz_RNITkesFO4LJepqIWkwl_rsYbMwqoaTnCgNdKRcT_YhTB5Vc2BRB6F8+c_MmeuGhxJLhExM9Zj_YYh3TeQ1r5lH8wFxZf2wuKHlzBpVj5D8q_4o4ke36vh2OfyfvUIR_Eyzjjf4M3p3kZnieqrXQFdsqM6G0tF5p1GQuEOVh1wlaTekiFlvvoiJhMJobcPOjvjeBGjh+5B7ndht3d8AI7D6ENR01S3zRMc+NSXLTIafYHagY4kacvkcJHNcGwEySNS+he3tz4gGXXjQoDHDsscW8V6b95+s3uYHGb6qTtK6Ug4kvS68Ijeu+IcP3e4muNRxEISjGlRajto7Cfd1fksCEM0D_IyL4WBw3KQbLYFg8hSxF_uDFjm7K6PRWdvYRCgAaaldWk0RP3NQlgq+5piKtPW97yS6VMcY37JPGGvO5O9gb5FatXYBK5hs3SKDF_uwaq4oXmlIDxd2DIi7alV4g7aW2hsY5d2SXc6kU7JgyLFkbt3JcUvn0JVF4_Wras1pRgxmOZ8bQOwCPCRlNA5LfutXe7goUzyerZRXy7HDdVG9uqV9cRNQf_uH7hiKAORkeWXtm4jRFkR4IiatVBCWX9HcZIAnVcmpxJs23RtdoywOZsz4dNSBUYm7w3Yvb48gPRt0q_U2TA95KbTc1BgNExHuEYAly_oE+n61AngvWX_pY2OTG6bxX+NwD66tfghctwH6_nsQfsE_hlQHmpxixqbMJyYn_RXjlpxGSzKtndZUzVx4c8h5rbKcpHFeyuavNY9z_dswcoj+3xfCYba_h6ZAWB4AcmTt9rY6zpWSnOBDHjN95P2sY0nfKyA19BtPGjbWHwDZ5H0Q+1xcfLUkk4icosphQCHfh7f4Sm3qC1IyUjbOkyfNqy6ZwatcX9yOPWPUuOjchGzUvw2JTjuxAyi2StOKwdEXgAwDFvD8jLly_nCVLE9KvpfdzrGMrBUq8MZLC98gABugQ+TIOu8nb6LJCBgViZBU35hZbwtLpg+lqJcNq3rrXHOhmwbPmQE4aY_EDhJHrFvlDclqkI1Sudo7ky7IoBD5aiDVccbeprL436R__BC0F6pFkHZGknQoNXPmm3zttapgJ9Ec1ha9GGtvgyjyCIRGcZnBo6Way6GCvBotcHeXW4hCLg9StHxspmAgkVVH5mWlyo9bxfokdAa+_f3gMWSYwG3mcC4Cagul+liyZq25P_dxUmYhBku6iAxaBWfGrVdulIWH+A2SRlVujuG3i9yWQCz1AAOOdhEta6lFQk5x6jcKsnA8WE66GaQiB8C6vCxAqjtlGoQQpKdqRDBDhoM5HRV3SuCgTdjChWANGUaIwxXx_zuGIRsuVLFBI4Z4YwoOC+tDhVQieCZ+FjqVD2GRIpavKPxOG6OuzLzeTu0gRCGzESRF4BjqjB2NPdXLfWjQT0KMK+n5gL73_nrK85PjKXceN6rUqfDn8NgFn_cLlDomy5SEzPnFvNqBBDJOAf_UGwPsjf1x+D+IrjJ0ND1AxGyZjC9uIXaWfTzV+MblRK3hW1vPmNxjw6UIodACF0zHS1JSCkdaLYwgHPRjt__jHS9bSEIH55fGkh6EEw1MnwKILadOonnWDhfIyahj8S0mSKr8zUJv8WM="; + private static final String ENCRYPTED_VALUE = "feR+vAk+Ysys9pOeEWupVQ=="; private static final String DECRYPTED_VALUE = "184981684091"; diff --git a/utility/synapse-utilities-common/src/test/java/io/americanexpress/synapse/utilities/common/io/ClasspathObjectFactoryTest.java b/utility/synapse-utilities-common/src/test/java/io/americanexpress/synapse/utilities/common/io/ClasspathObjectFactoryTest.java index 9c59910d9..d1c146c3e 100644 --- a/utility/synapse-utilities-common/src/test/java/io/americanexpress/synapse/utilities/common/io/ClasspathObjectFactoryTest.java +++ b/utility/synapse-utilities-common/src/test/java/io/americanexpress/synapse/utilities/common/io/ClasspathObjectFactoryTest.java @@ -13,6 +13,7 @@ */ package io.americanexpress.synapse.utilities.common.io; +import com.fasterxml.jackson.databind.ObjectMapper; import io.americanexpress.synapse.utilities.common.config.UtilitiesCommonConfig; import io.americanexpress.synapse.utilities.common.serialization.model.Phone; import com.fasterxml.jackson.core.JsonParseException; @@ -42,9 +43,9 @@ class ClasspathObjectFactoryTest { @Test void classpathObjectFactory_constructor() throws Exception { - Constructor constructor = ClasspathObjectFactory.class.getDeclaredConstructor(); + Constructor constructor = ClasspathObjectFactory.class.getDeclaredConstructor(ObjectMapper.class); constructor.setAccessible(true); - constructor.newInstance(); + constructor.newInstance(new UtilitiesCommonConfig().camelCaseObjectMapper()); constructor.setAccessible(false); } diff --git a/utility/synapse-utilities-common/src/test/java/io/americanexpress/synapse/utilities/common/serialization/TitleCaseStringSerializerTest.java b/utility/synapse-utilities-common/src/test/java/io/americanexpress/synapse/utilities/common/serialization/TitleCaseStringSerializerTest.java index 3f66db0a0..10f30f950 100644 --- a/utility/synapse-utilities-common/src/test/java/io/americanexpress/synapse/utilities/common/serialization/TitleCaseStringSerializerTest.java +++ b/utility/synapse-utilities-common/src/test/java/io/americanexpress/synapse/utilities/common/serialization/TitleCaseStringSerializerTest.java @@ -16,7 +16,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertEquals; /** diff --git a/utility/synapse-utility-cryptography/pom.xml b/utility/synapse-utility-cryptography/pom.xml index 5ee7d5087..eb5194a55 100644 --- a/utility/synapse-utility-cryptography/pom.xml +++ b/utility/synapse-utility-cryptography/pom.xml @@ -5,7 +5,7 @@ utility io.americanexpress.synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/utility/synapse-utility-cryptography/src/test/java/io/americanexpress/synapse/utility/cryptography/CryptoUtilTest.java b/utility/synapse-utility-cryptography/src/test/java/io/americanexpress/synapse/utility/cryptography/CryptoUtilTest.java index 0568c1995..94ea8fb78 100644 --- a/utility/synapse-utility-cryptography/src/test/java/io/americanexpress/synapse/utility/cryptography/CryptoUtilTest.java +++ b/utility/synapse-utility-cryptography/src/test/java/io/americanexpress/synapse/utility/cryptography/CryptoUtilTest.java @@ -22,7 +22,7 @@ */ class CryptoUtilTest { - private static final String ENCRYPTED_VALUE = "0fvMPUD069EJ7pJ4rmkdMtqc+83aES_jmGYKX57jL4e2XXeX4DBmA68qypDCzL08WMunmo0JzR6ey+RIRyaAUDH5YgjisXexxnDW0nMDb48fwi0+b69YvrF+ZIkDLrQYorlUefGxIOR01mtmTiKfQEdaaJ4w4CtVtKdAsd9QAC7_zWlAtQ_Ubsz++12PS8iDGlyK35T54j8nCHwcwZQd8tq9uvV8nocVUQBxgRVp5keJGA5e5Ujcb830l9NdEC2QanoVAde+PVgZMMpQcbJMgbwn139qfRN5+YDKNlsBONaejXOVfpMU18Ztr16+HZ4Jd5bTSk4UrZtRSAv8CZ9eBGBg6VURi3513YgFoVtIjuQVz4X7waIfBlwvjg_hmmWwQbQXidCQPQyre8mvTlt5iXcm7e0ZxxMvsXYYSkUSFe00BzV4fmHsmK9TwCOEjAgsO11KVnjnynyQCh551qskDZFfIO47o5n1gfLW3uPmUwnGiqMkUtr9WSBdVZ_dSmzs90+cLY7zahgOF9At0z6t4QwIFvPOmc39gkwOU+mStg66wwPnK0psSU79rNGTtxHWqYAG3jBoTUJLnCXbUM+bYrmPr0wECBV3yiAVHJnMrCOoSF1rIIlt5tEC3uL3eA+XXxRtz8Ia9JvTGlcOXZQWkdEC+HR+IG2HaR4nxpFu2tWmm5oa4lEMivoz5FE0aKfge9fvN9D7p1hENhDKcBwu8ByBgLvIAH7ZOeOQuJD+aujAiABoE3KAHob0UQ3Q5RgtDe7HvXn5WqDCLz6fupddiuNW10zA9E3jmOmjVdTdHwk5lDMXWlC79hTgHpk50vp2laa+pQCtADclS7W8shnKpEO4KE0egq1FxxbEMvGDpB2IsTlGtzTmELuI6cc6STOHM6BL0uMkmUJGJwK8AAsxPKVrZfKZqGh9i6cLRGEQks2iG_TFjexz6D5wdkKyaF6kIbkn5qRLViZaX1bZooFM6PA_t407XuLVGMFPfK3LecIL9gV9Sw9cyH9oCJ77OD2HSjSLYBhJTVKrt2ikdu63F6Se+nJ+Xi2dAKTtOR478xAiVwvnzIxbNJYWggJMGD21ryt5b1_o7UBNoqT0+0048zsTzPEBHslJbcaOY97C97PUgVyWo_F1sztqkpEuv6KXPptwWxc819L6pmbqyL0qXMhyMuBPJRdqUlCloVzDq_x+szi7gRrbLKBCHT5hy9qKKYNJXa0syShV6LVUNGx04B4L_TzKUDehJ7pMHRkYiLCzBlOJWBsu7J63MGWNzZlKhmXRXYqD_X8sD3rqCtdKM6xfmpr3HkMS8C9kNMTfo_Po8wEQOTNI780B4bcvE3qheslUfG0bbBiZmUpvImodYa8DgcCgYzKjKGVScRDj0pcEDDa5ol1nc3zPdQMNdCMchAdUfWQdTaEJmKXtC1XSjPhyvyboW1em_6qM4KN_kK+EycOmRjQTf9NGF5FqGp619Q7rhcWBB+Jwz8yYQa1MpRTLe74S_n67tneSzP27JL94HWQ2IBn_VAypW_dJpSVW5kzNA7LMNi4P3iTl4txzEBWVK37CNnafc3Dh7S+FrmmFDyRrg2qrKkQU7uPk7CUI81fjZksQyp4dx1QDZd15QvfNdRUq_yEYGEbKoiNCryRq_uSBkk1KoROqC1IJ_rB42SQaAjz2reNDvUNyRnZaa5NyZbUT3YH93qyJQycF6tWZZU5RI3MbTM4VBBU45RXGuET+nvfIdKk0cJT1oKLfjGZ9NFB2M+QuH8ZWLdm0LVdd7+0SiIk+qpTfGTpmTyVuwM75Tuibm2uvW9a51JVewHtmxP1eyuzOle3AlvOrXKC+txxUoHlbZi+wzaanvr0ahgXJP+UVonhNx7uH_fkT+mhX8rSVs0gs2cltFeThIQgnhXohOWs89UYzJER9iYU5DeLa3DuEY59ufp887ZxOGyZ_D2XAgycS7quEVxh9kLvYcxck5h0t1Y9_f1kzpyxNQTLH9mvtPR8U5_vB5fKpALBTVwgWaDhaTpGx8zajOSnn3ekBI590VgegS0tDkGcAkAvFLqEgPcgdNLHbu1w+Cc+9n7EN8+FyXIuc+vdrZ17cclgYsMw1Aer_PIciaIKNVV1wSDKBTrI5dL1N308s25K6FNemnCUJeGp3JtDWZkPFsk3+GdTwUIKxmRS4GrpeysJYORyN+2n6F55VKHphOiSXkpxbG7L6FlS5cwlviz4_4gl5KCD5J_yGfOVu6+oRiQoCHuM6qjmYHqiDNJqfI6jH0fPnqTOI5+vRXPUg3rVLaESXaXRBnNluNHRG7S0cMHqB5EUUib+M5Z28QgDHZBezC5qkjYgkNnpkl6JNCA6nLUONHsH+bPb+kJ+gnFEXF1mhH+Eja8n72kL6pB0LQnw7sTWabB9jqHk2rM22w1GAU_uoi7ukG24H26kWbMDIXJqCCHIn5huXxfTrkVK7uysMjXTgwHFNhhB85o6NgobQLm3lCeM68FR9dBIF70YPp9reY4Zak1F3tG4dk+cK+TdUSdVV_4m+mYimscHgWbzeJA3ZIQyP8_ps4ik8Og2ND7yK41WHUwuwFEay6f5w19z2j7ANckQm_Es_tZ7Wn0fZLmw_CtVDQm5DzFghqMApH4KvuoyKpJkAzjNA8bJaSSaEY_Xl+ntjVCXUU2zQbAQngzSoX+lETH_ZpSCm2zZluprFhQKTA0lzf+kYg_N+AlVNpJCElMNgj4rX4sMRzrieC8NUqHng2xqW5qS2_QhY31L7HJebVGVAt7uiRi+161BZ+HBvYn2coBVEbkz32mcyRWtASbf79OhfPDz3jlSb6QWPb9zfcoutIeYlrrfdyTOK8Qk27_byOtut1CGDGgYCqoNIkTkALS2gZdeLgj8cTjjRC9PDJuHHOb78O3pyT71ir8W5MyfY_Ne+ZiEIxYDYLcwPKRVkA1xfTC26wmeLA7ofb33hMF5LJIPpkJOqE99DpMpGJOvuhw7m9UfM+dRd5xWNUfXgr5yCsKS3512DkxZPpVGgL94j6yyVybbY2N04vIzGaODu7TqF0ciVjIKt_XstrwlKNG7ImDAhLA8YRwADbEwKRW1gMkkjss5Q1l6m9jUrOekVut+fHDWvEXx5vRwdziYZZS48YmyTq9+LYnITF9LDS_XxUgwpbKu6Zrnn7TqnsBZVEIoBRFOYCoodP9dE+m+UWbqNm8dh76bqWHUA3+mfgwnetcgrWrLoLyOziMFBSRVyaAroHaO87CwupCRAgKG0IlQbdc33nTjQqm52ZO80pq4KRE5FXJ3ID5GflPtRHolEXVvFJs1K_I2c0SrWlUVcaD0E1xG8bHIbK+0pjbpo1bcP8hCQq2IlfeKBPrl8JvzthLHnijiBZvzRno9nne3GSqYubzF0c8k0MOw+R9U1iMVBwXAP3a4EDS4MIRmlQ609_coo7ZXn9tTraVijl4Ge+Nf93dE6caxGYq7lFMqrWpSLV8LBNOtBHPbvjgKyQuyDZ8KtwLm4+TxXQZF2orUlPMvpM3FgSCpR88eaKEm74Z3EOx5Q4f8G_OM_w0x+VDcR9e33Yqgh3z46Od3ImvELILSNrHMnHRxPjk3DocR9qStTSevXO0rXDsQPB0wqlDcasOT8rSZqeOULflAjQl6eoGE5x2wvP27xEtSopsOY4RezmYtO+titfy2kZQi4tPcRIELR0kwdT6QLuqQcXetaPu07Jsgnh4b3ruxUHeuHOlEKLPuxbkfxCPi5AQzfMUFevTLYNi8hVPgGTUuNNic09f4iJrEQRVmHAFWVfgzNxXhod+iyUz+yi6Xoo+hK9E6GD5N1Ayayt+bdkJ5eLWRvWVjUjMQdPhZo8Ch2_AATOzXq3uwmtskmeVou+NbJpUOwjG_zakwc_7jxB4ckquqPprNjUcsowr2vFH9BAeYrDMarIPAxgUIs5GDZs+JqaYmennRur+n_G8DSF3LN+ftVk+W2m1PLthqQAXsBBX0iKBQYfV4mB+djeFkWdyAZ_GXyXg_r+fekbfiBOqBoRsoUFtbI+jEN58A66hnaTjmg8RH3ivNF3AvGtD7798YmzQZyenONEDaioede0qSF2kdxmSboFksI6DXFGsyxarfZ6a_EDvwUREWtbLQW66Fsb4cNJCrkyYRL6rqHax2hPTi_P31YEq9EORwhM69Thn_RIo+12WBLlwPXBiIbWmQe2VgDYQLEQqACGneu3o10QZs6e_A_sM4vk+sz0b+8ET8Gv9m1qgGI6s7n2RkUJV83WKvT1mZEdyc7mpOhkT7kqy3vNwZQQTCAxSa+NLnX9hk7JMcPvA_LkyTLi0ESgic1x_iX_n5nqPC_2In2kdBt5RlfOzo0v_rI3jKSxhU_ZNcygUZZvjXM9sV_cinHrkmUHa43T06LwR7lQrtrcALkS3qFEXsjUsMAX3lkRvmGlGCIRAmsuepH8EIATt9tBvKnDh_twDmmXWsk_JMSLCOV0HpsZ3fQLWGpXOPCg6j_YRJ+ANtNbC+EJT55bnXXoyViT6X50fi8E9Esg4+0E+UVRQUfuCdo3b0GTRk_vS5StXEoZAyfhbsNNaOkyTcDpwGbn3pYWEn_NFodSM1TOOJfpvskcZo96kQlMlTBayiHPm+zEL61dbOoTvmGKYRcnZm1HJ6Elqz2NjMw0tXn5L7XAvFa9Vrbnm04HCTfX92mZgZbHYcoqvqO8VrW0dDmtgfFrKpVGc0O_Ybx2sq_gXh+Vzq2JFevg2hRkKh_oaM0145Z49TQURStDPDEQZgS9G+TBeROw0rmvjvGukqrou8oAHOFCHO9adxDon8JEQuPkCTSl0M8qGSlZP9YCBkqHtv8Dlf0y3kh8XSBy97nmDGboF4mPA1lGxm8i+N17I2uk0j0Hu3QzZB0CX_3qmLh9jK6ujv96a123xK3Vhm9HeviLrENv8kCPGyy4vPCZWFysJM1FR3IIX0lcHSqZzj9m9+CYkucdfyHGzduPgBZLO++EU80_oYiByAGeF3XrjTvBUmD63j91fYgkRQ9P8bYm93ihUsyI_qd_cKROCsFoz7bOCMvVnzp8vIzHmF2T1nZvBGQQCZ0E5xlRNEsNEc4Vy9F3frBFRKweI4SX61g1lasqwfTmuope4tF_awO09vkPmec7qWs5jwz_RNITkesFO4LJepqIWkwl_rsYbMwqoaTnCgNdKRcT_YhTB5Vc2BRB6F8+c_MmeuGhxJLhExM9Zj_YYh3TeQ1r5lH8wFxZf2wuKHlzBpVj5D8q_4o4ke36vh2OfyfvUIR_Eyzjjf4M3p3kZnieqrXQFdsqM6G0tF5p1GQuEOVh1wlaTekiFlvvoiJhMJobcPOjvjeBGjh+5B7ndht3d8AI7D6ENR01S3zRMc+NSXLTIafYHagY4kacvkcJHNcGwEySNS+he3tz4gGXXjQoDHDsscW8V6b95+s3uYHGb6qTtK6Ug4kvS68Ijeu+IcP3e4muNRxEISjGlRajto7Cfd1fksCEM0D_IyL4WBw3KQbLYFg8hSxF_uDFjm7K6PRWdvYRCgAaaldWk0RP3NQlgq+5piKtPW97yS6VMcY37JPGGvO5O9gb5FatXYBK5hs3SKDF_uwaq4oXmlIDxd2DIi7alV4g7aW2hsY5d2SXc6kU7JgyLFkbt3JcUvn0JVF4_Wras1pRgxmOZ8bQOwCPCRlNA5LfutXe7goUzyerZRXy7HDdVG9uqV9cRNQf_uH7hiKAORkeWXtm4jRFkR4IiatVBCWX9HcZIAnVcmpxJs23RtdoywOZsz4dNSBUYm7w3Yvb48gPRt0q_U2TA95KbTc1BgNExHuEYAly_oE+n61AngvWX_pY2OTG6bxX+NwD66tfghctwH6_nsQfsE_hlQHmpxixqbMJyYn_RXjlpxGSzKtndZUzVx4c8h5rbKcpHFeyuavNY9z_dswcoj+3xfCYba_h6ZAWB4AcmTt9rY6zpWSnOBDHjN95P2sY0nfKyA19BtPGjbWHwDZ5H0Q+1xcfLUkk4icosphQCHfh7f4Sm3qC1IyUjbOkyfNqy6ZwatcX9yOPWPUuOjchGzUvw2JTjuxAyi2StOKwdEXgAwDFvD8jLly_nCVLE9KvpfdzrGMrBUq8MZLC98gABugQ+TIOu8nb6LJCBgViZBU35hZbwtLpg+lqJcNq3rrXHOhmwbPmQE4aY_EDhJHrFvlDclqkI1Sudo7ky7IoBD5aiDVccbeprL436R__BC0F6pFkHZGknQoNXPmm3zttapgJ9Ec1ha9GGtvgyjyCIRGcZnBo6Way6GCvBotcHeXW4hCLg9StHxspmAgkVVH5mWlyo9bxfokdAa+_f3gMWSYwG3mcC4Cagul+liyZq25P_dxUmYhBku6iAxaBWfGrVdulIWH+A2SRlVujuG3i9yWQCz1AAOOdhEta6lFQk5x6jcKsnA8WE66GaQiB8C6vCxAqjtlGoQQpKdqRDBDhoM5HRV3SuCgTdjChWANGUaIwxXx_zuGIRsuVLFBI4Z4YwoOC+tDhVQieCZ+FjqVD2GRIpavKPxOG6OuzLzeTu0gRCGzESRF4BjqjB2NPdXLfWjQT0KMK+n5gL73_nrK85PjKXceN6rUqfDn8NgFn_cLlDomy5SEzPnFvNqBBDJOAf_UGwPsjf1x+D+IrjJ0ND1AxGyZjC9uIXaWfTzV+MblRK3hW1vPmNxjw6UIodACF0zHS1JSCkdaLYwgHPRjt__jHS9bSEIH55fGkh6EEw1MnwKILadOonnWDhfIyahj8S0mSKr8zUJv8WM="; + private static final String ENCRYPTED_VALUE = "feR+vAk+Ysys9pOeEWupVQ=="; private static final String DECRYPTED_VALUE = "184981684091"; diff --git a/utility/synapse-utility-date/pom.xml b/utility/synapse-utility-date/pom.xml index 536c872e8..27946b1cb 100644 --- a/utility/synapse-utility-date/pom.xml +++ b/utility/synapse-utility-date/pom.xml @@ -5,7 +5,7 @@ utility io.americanexpress.synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/utility/synapse-utility-number/pom.xml b/utility/synapse-utility-number/pom.xml index 8c1c3f083..33c69d46f 100644 --- a/utility/synapse-utility-number/pom.xml +++ b/utility/synapse-utility-number/pom.xml @@ -5,7 +5,7 @@ utility io.americanexpress.synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0 diff --git a/utility/synapse-utility-telephone/pom.xml b/utility/synapse-utility-telephone/pom.xml index 03e4c13b6..260e1f26c 100644 --- a/utility/synapse-utility-telephone/pom.xml +++ b/utility/synapse-utility-telephone/pom.xml @@ -5,7 +5,7 @@ utility io.americanexpress.synapse - 0.3.32-SNAPSHOT + 0.4.0-SNAPSHOT 4.0.0