Skip to content

Commit

Permalink
Synapse 0.4.0 Release - API module changes and dependency version inc…
Browse files Browse the repository at this point in the history
…rements (#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 <guttff@gmail.com>
Co-authored-by: johnmartinez <jmartinez5120@gmail.com>
Co-authored-by: Wendy Hu <wendy.hu@alumni.stonybrook.edu>
Co-authored-by: Shahzada Azam Shahani <36014183+shahzadaazam@users.noreply.github.com>
Co-authored-by: Tanvir Islam <t.islam1080@gmail.com>
  • Loading branch information
6 people authored Nov 22, 2024
1 parent f4b5fd2 commit e153639
Show file tree
Hide file tree
Showing 236 changed files with 1,907 additions and 2,460 deletions.
12 changes: 6 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ The following listing shows the pom.xml file that is created when you choose Mav
<parent>
<groupId>com.sample.bookstore</groupId>
<artifactId>service</artifactId>
<version>0.3.32-SNAPSHOT</version>
<version>0.4.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<parent>
<groupId>io.americanexpress.synapse</groupId>
<artifactId>synapse</artifactId>
<version>0.3.32-SNAPSHOT</version>
<version>0.4.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
11 changes: 3 additions & 8 deletions api/synapse-api-rest-imperative/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>io.americanexpress.synapse</groupId>
<artifactId>api</artifactId>
<version>0.3.32-SNAPSHOT</version>
<version>0.4.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand All @@ -36,10 +36,6 @@
<groupId>io.americanexpress.synapse</groupId>
<artifactId>synapse-framework-exception</artifactId>
</dependency>
<dependency>
<groupId>io.americanexpress.synapse</groupId>
<artifactId>synapse-framework-api-docs</artifactId>
</dependency>
<dependency>
<groupId>io.americanexpress.synapse</groupId>
<artifactId>synapse-service-imperative</artifactId>
Expand Down Expand Up @@ -135,9 +131,8 @@
</dependency>

<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.6.6</version>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations-jakarta</artifactId>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -22,7 +20,7 @@
public class BaseCreateImperativeRestController<
I extends BaseServiceRequest,
O extends BaseServiceResponse,
S extends BaseCreateImperativeService<I, O>
S extends BaseService<I, O>
> extends BaseController<S> {

/**
Expand All @@ -34,9 +32,9 @@ public class BaseCreateImperativeRestController<
*/
@PostMapping
@Operation(tags = "Create Operation", summary = "Creates a resource")
public ResponseEntity<O> create(@RequestHeader HttpHeaders headers, @Valid @RequestBody I serviceRequest) {
public ResponseEntity<O> create(@RequestHeader HttpHeaders headers, I serviceRequest) {
logger.entry(serviceRequest);
O serviceResponse = service.create(serviceRequest);
O serviceResponse = service.execute(serviceRequest);
ResponseEntity<O> responseEntity = CreateResponseEntityCreator.create(serviceResponse);
logger.exit();
return responseEntity;
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -22,7 +19,8 @@
*/
public class BaseDeleteImperativeRestController<
I extends BaseServiceRequest,
S extends BaseDeleteImperativeService<I>
O extends BaseServiceResponse,
S extends BaseService<I, O>
> extends BaseController<S> {

/**
Expand All @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 <O> an object extending the {@link BaseServiceResponse}
* @param <S> an object extending the {@link BaseGetMonoImperativeService}
* @param <S> an object extending the {@link BaseService}
* @author Francois Gutt
*/
public class BaseGetMonoImperativeRestController<
I extends BaseServiceRequest,
O extends BaseServiceResponse,
S extends BaseGetMonoImperativeService<O>
S extends BaseService<I, O>
> extends BaseController<S> {

/**
Expand All @@ -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<O> read(@RequestHeader HttpHeaders headers) {
logger.entry(headers);
final O response = service.read(headers);
public ResponseEntity<O> read(@RequestHeader HttpHeaders headers, I serviceRequest) {
logger.entry(serviceRequest);
final O response = service.execute(serviceRequest);
ResponseEntity<O> responseEntity = MonoResponseEntityCreator.create(response);
logger.exit(responseEntity);
return responseEntity;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -21,13 +19,13 @@
*
* @param <I> an object extending the {@link BaseServiceRequest}
* @param <O> an object extending the {@link BaseServiceResponse}
* @param <S> an object extending the {@link BaseReadMonoImperativeService}
* @param <S> an object extending the {@link BaseService}
* @author Gabriel Jimenez
*/
public class BaseReadMonoImperativeRestController<
I extends BaseServiceRequest,
O extends BaseServiceResponse,
S extends BaseReadMonoImperativeService<I, O>
S extends BaseService<I, O>
> extends BaseController<S> {

/**
Expand All @@ -51,10 +49,10 @@ public class BaseReadMonoImperativeRestController<
@ApiResponse(responseCode = "403", description = "Forbidden"),
})
@PostMapping(INQUIRY_RESULTS)
public ResponseEntity<O> read(@RequestHeader HttpHeaders headers, @Valid @RequestBody I serviceRequest) {
public ResponseEntity<O> read(@RequestHeader HttpHeaders headers, I serviceRequest) {
logger.entry(serviceRequest);

final O serviceResponse = service.read(serviceRequest);
final O serviceResponse = service.execute(serviceRequest);
ResponseEntity<O> responseEntity = MonoResponseEntityCreator.create(serviceResponse);

logger.exit(responseEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <I> an object extending {@link BaseServiceRequest}
* @param <O> an object extending {@link BaseServiceResponse}
* @param <S> an object extending {@link BaseReadPolyImperativeService}
* @param <S> an object extending {@link BaseService}
* @author Gabriel Jimenez
*/
public class BaseReadPolyImperativeRestController<I extends BaseServiceRequest, O extends BaseServiceResponse, S extends BaseReadPolyImperativeService<I, O>> extends BaseController<S> {
public class BaseReadPolyImperativeRestController<
I extends BaseServiceRequest,
O extends BaseServiceResponse,
S extends BaseService<I, PageResponse<O>>
> extends BaseController<S> {

/**
* Constant string used for multiple_results.
Expand All @@ -39,7 +39,6 @@ public class BaseReadPolyImperativeRestController<I extends BaseServiceRequest,
*
* @param headers containing the HTTP headers from the consumer
* @param serviceRequest body from the consumer
* @param httpServletResponse HttpServletResponse
* @return a list of resources from the back end service
*/
@Operation(summary = "Read operation based on criteria.", description = "Read a collection of resources based on request criteria.")
Expand All @@ -51,11 +50,11 @@ public class BaseReadPolyImperativeRestController<I extends BaseServiceRequest,
@ApiResponse(responseCode = "403", description = "Forbidden"),
})
@PostMapping(MULTIPLE_RESULTS)
public ResponseEntity<List<O>> read(@RequestHeader HttpHeaders headers, @Valid @RequestBody I serviceRequest, HttpServletResponse httpServletResponse) {
public ResponseEntity<List<O>> read(@RequestHeader HttpHeaders headers, I serviceRequest) {
logger.entry(serviceRequest);

final Page<O> page = service.read(headers, serviceRequest);
final ResponseEntity<List<O>> responseEntity = PolyResponseEntityCreator.create(page, httpServletResponse);
final PageResponse<O> page = service.execute(serviceRequest);
final ResponseEntity<List<O>> responseEntity = PolyResponseEntityCreator.create(page);

logger.exit(responseEntity);
return responseEntity;
Expand Down
Loading

0 comments on commit e153639

Please sign in to comment.