Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated compositions api naming. #101

Merged
merged 1 commit into from
Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/PullIngestionRequest'
$ref: '#/components/schemas/LegalEntityPullIngestionRequest'
responses:
"201":
description: Legal Entity ingested.
content:
application/json:
schema:
$ref: '#/components/schemas/IngestionResponse'
$ref: '#/components/schemas/LegalEntityIngestionResponse'
"400":
description: BadRequest
content:
Expand All @@ -53,14 +53,14 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/PushIngestionRequest'
$ref: '#/components/schemas/LegalEntityPushIngestionRequest'
responses:
"201":
description: Legal Entity ingested.
content:
application/json:
schema:
$ref: '#/components/schemas/IngestionResponse'
$ref: '#/components/schemas/LegalEntityIngestionResponse'
"400":
description: BadRequest
content:
Expand All @@ -84,7 +84,7 @@ components:
message:
type: string

PullIngestionRequest:
LegalEntityPullIngestionRequest:
type: object
properties:
legalEntityExternalId:
Expand All @@ -94,13 +94,13 @@ components:
additionalProperties:
type: string

PushIngestionRequest:
LegalEntityPushIngestionRequest:
type: object
properties:
legalEntity:
$ref: '../../../../../../../api/stream-legal-entity/openapi.yaml#/components/schemas/LegalEntity'

IngestionResponse:
LegalEntityIngestionResponse:
type: object
properties:
legalEntity:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/PullIngestionRequest'
$ref: '#/components/schemas/ProductCatalogPullIngestionRequest'
responses:
"201":
description: Product group ingested.
content:
application/json:
schema:
$ref: '#/components/schemas/IngestionResponse'
$ref: '#/components/schemas/ProductCatalogIngestionResponse'
"400":
description: BadRequest
content:
Expand All @@ -53,14 +53,14 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/PushIngestionRequest'
$ref: '#/components/schemas/ProductCatalogPushIngestionRequest'
responses:
"201":
description: Product catalog ingested.
content:
application/json:
schema:
$ref: '#/components/schemas/IngestionResponse'
$ref: '#/components/schemas/ProductCatalogIngestionResponse'
"400":
description: BadRequest
content:
Expand All @@ -84,21 +84,21 @@ components:
message:
type: string

PullIngestionRequest:
ProductCatalogPullIngestionRequest:
type: object
properties:
additionalParameters:
type: object
additionalProperties:
type: string

PushIngestionRequest:
ProductCatalogPushIngestionRequest:
type: object
properties:
productCatalog:
$ref: '../../../../../../../api/stream-product-catalog/openapi.yaml#/components/schemas/ProductCatalog'

IngestionResponse:
ProductCatalogIngestionResponse:
type: object
properties:
productCatalog:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/PullIngestionRequest'
$ref: '#/components/schemas/ProductPullIngestionRequest'
responses:
"201":
description: Product group ingested.
content:
application/json:
schema:
$ref: '#/components/schemas/IngestionResponse'
$ref: '#/components/schemas/ProductIngestionResponse'
"400":
description: BadRequest
content:
Expand All @@ -53,14 +53,14 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/PushIngestionRequest'
$ref: '#/components/schemas/ProductPushIngestionRequest'
responses:
"201":
description: Product group ingested.
content:
application/json:
schema:
$ref: '#/components/schemas/IngestionResponse'
$ref: '#/components/schemas/ProductIngestionResponse'
"400":
description: BadRequest
content:
Expand All @@ -84,7 +84,7 @@ components:
message:
type: string

PullIngestionRequest:
ProductPullIngestionRequest:
type: object
required:
- legalEntityExternalId
Expand All @@ -104,13 +104,13 @@ components:
additionalProperties:
type: string

PushIngestionRequest:
ProductPushIngestionRequest:
type: object
properties:
productGgroup:
$ref: '../../../../../../../api/stream-legal-entity/openapi.yaml#/components/schemas/ProductGroup'

IngestionResponse:
ProductIngestionResponse:
type: object
properties:
productGgroup:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import com.backbase.stream.compositions.legalentity.core.model.LegalEntityIngestPushRequest;
import com.backbase.stream.compositions.legalentity.core.model.LegalEntityIngestResponse;
import com.backbase.stream.compositions.legalentity.core.service.LegalEntityIngestionService;
import com.backbase.stream.compositions.legalentity.model.IngestionResponse;
import com.backbase.stream.compositions.legalentity.model.PullIngestionRequest;
import com.backbase.stream.compositions.legalentity.model.PushIngestionRequest;
import com.backbase.stream.compositions.legalentity.model.LegalEntityIngestionResponse;
import com.backbase.stream.compositions.legalentity.model.LegalEntityPullIngestionRequest;
import com.backbase.stream.compositions.legalentity.model.LegalEntityPushIngestionRequest;
import lombok.AllArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand All @@ -28,8 +28,8 @@ public class LegalEntityController implements LegalEntityCompositionApi {
* {@inheritDoc}
*/
@Override
public Mono<ResponseEntity<IngestionResponse>> pullIngestLegalEntity(
@Valid Mono<PullIngestionRequest> pullIngestionRequest, ServerWebExchange exchange) {
public Mono<ResponseEntity<LegalEntityIngestionResponse>> pullIngestLegalEntity(
@Valid Mono<LegalEntityPullIngestionRequest> pullIngestionRequest, ServerWebExchange exchange) {
return legalEntityIngestionService
.ingestPull(pullIngestionRequest.map(this::buildPullRequest))
.map(this::mapIngestionToResponse);
Expand All @@ -39,8 +39,8 @@ public Mono<ResponseEntity<IngestionResponse>> pullIngestLegalEntity(
* {@inheritDoc}
*/
@Override
public Mono<ResponseEntity<IngestionResponse>> pushIngestLegalEntity(
@Valid Mono<PushIngestionRequest> pushIngestionRequest, ServerWebExchange exchange) {
public Mono<ResponseEntity<LegalEntityIngestionResponse>> pushIngestLegalEntity(
@Valid Mono<LegalEntityPushIngestionRequest> pushIngestionRequest, ServerWebExchange exchange) {
return legalEntityIngestionService
.ingestPush(pushIngestionRequest.map(this::buildPushRequest))
.map(this::mapIngestionToResponse);
Expand All @@ -52,7 +52,7 @@ public Mono<ResponseEntity<IngestionResponse>> pushIngestLegalEntity(
* @param request PullIngestionRequest
* @return LegalEntityIngestPullRequest
*/
private LegalEntityIngestPullRequest buildPullRequest(PullIngestionRequest request) {
private LegalEntityIngestPullRequest buildPullRequest(LegalEntityPullIngestionRequest request) {
return LegalEntityIngestPullRequest
.builder()
.legalEntityExternalId(request.getLegalEntityExternalId())
Expand All @@ -66,7 +66,7 @@ private LegalEntityIngestPullRequest buildPullRequest(PullIngestionRequest reque
* @param request PushIngestionRequest
* @return LegalEntityIngestPushRequest
*/
private LegalEntityIngestPushRequest buildPushRequest(PushIngestionRequest request) {
private LegalEntityIngestPushRequest buildPushRequest(LegalEntityPushIngestionRequest request) {
return LegalEntityIngestPushRequest
.builder()
.legalEntity(mapper.mapCompostionToStream(request.getLegalEntity()))
Expand All @@ -79,9 +79,9 @@ private LegalEntityIngestPushRequest buildPushRequest(PushIngestionRequest reque
* @param response LegalEntityIngestResponse
* @return ResponseEntity<IngestionResponse>
*/
private ResponseEntity<IngestionResponse> mapIngestionToResponse(LegalEntityIngestResponse response) {
private ResponseEntity<LegalEntityIngestionResponse> mapIngestionToResponse(LegalEntityIngestResponse response) {
return new ResponseEntity<>(
new IngestionResponse()
new LegalEntityIngestionResponse()
.withLegalEntity(mapper.mapStreamToComposition(response.getLegalEntity())),
HttpStatus.CREATED);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

import com.backbase.stream.LegalEntitySaga;
import com.backbase.stream.LegalEntityTask;
import com.backbase.stream.compositions.legalentity.model.PullIngestionRequest;
import com.backbase.stream.compositions.legalentity.model.PushIngestionRequest;
import com.backbase.stream.compositions.legalentity.model.LegalEntityPullIngestionRequest;
import com.backbase.stream.compositions.legalentity.model.LegalEntityPushIngestionRequest;
import com.backbase.stream.legalentity.model.LegalEntity;
import com.backbase.streams.compositions.test.IntegrationTest;
import com.google.gson.Gson;
import org.apache.activemq.broker.BrokerService;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockserver.client.MockServerClient;
Expand Down Expand Up @@ -110,11 +109,11 @@ void pullIngestLegalEntity_Success() throws Exception {
.thenReturn(Mono.just(new LegalEntityTask(legalEntity)));

URI uri = URI.create("/service-api/v2/pull-ingestion");
PullIngestionRequest pullIngestionRequest =
new PullIngestionRequest().withLegalEntityExternalId("externalId");
LegalEntityPullIngestionRequest pullIngestionRequest =
new LegalEntityPullIngestionRequest().withLegalEntityExternalId("externalId");

WebTestClient webTestClient = WebTestClient.bindToController(legalEntityController).build();
webTestClient.post().uri(uri).body(Mono.just(pullIngestionRequest), PullIngestionRequest.class).exchange()
webTestClient.post().uri(uri).body(Mono.just(pullIngestionRequest), LegalEntityPullIngestionRequest.class).exchange()
.expectStatus().isCreated()
.expectHeader().valueEquals("Content-Type", "application/json")
.expectBody().jsonPath("$.legalEntity.name").isEqualTo("Test Legal Entity");
Expand All @@ -124,11 +123,11 @@ void pullIngestLegalEntity_Success() throws Exception {
void pushIngestLegalEntity_Fail() {
URI uri = URI.create("/service-api/v2/push-ingestion");

PushIngestionRequest pushIngestionRequest = new PushIngestionRequest()
LegalEntityPushIngestionRequest pushIngestionRequest = new LegalEntityPushIngestionRequest()
.withLegalEntity(new com.backbase.stream.compositions.legalentity.model.LegalEntity());

WebTestClient webTestClient = WebTestClient.bindToController(legalEntityController).build();
webTestClient.post().uri(uri).body(Mono.just(pushIngestionRequest), PullIngestionRequest.class).exchange()
webTestClient.post().uri(uri).body(Mono.just(pushIngestionRequest), LegalEntityPullIngestionRequest.class).exchange()
.expectStatus().is5xxServerError();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import com.backbase.stream.compositions.legalentity.core.mapper.LegalEntityMapperImpl;
import com.backbase.stream.compositions.legalentity.core.model.LegalEntityIngestResponse;
import com.backbase.stream.compositions.legalentity.core.service.LegalEntityIngestionService;
import com.backbase.stream.compositions.legalentity.model.PullIngestionRequest;
import com.backbase.stream.compositions.legalentity.model.PushIngestionRequest;
import com.backbase.stream.compositions.legalentity.model.LegalEntityPullIngestionRequest;
import com.backbase.stream.compositions.legalentity.model.LegalEntityPushIngestionRequest;
import com.backbase.stream.legalentity.model.LegalEntity;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -36,8 +36,8 @@ void setUp() {

@Test
void testPullIngestion_Success() {
Mono<PullIngestionRequest> requestMono = Mono.just(
new PullIngestionRequest().withLegalEntityExternalId("externalId"));
Mono<LegalEntityPullIngestionRequest> requestMono = Mono.just(
new LegalEntityPullIngestionRequest().withLegalEntityExternalId("externalId"));

when(legalEntityIngestionService.ingestPull(any())).thenReturn(
Mono.just(LegalEntityIngestResponse.builder()
Expand All @@ -50,8 +50,8 @@ void testPullIngestion_Success() {

@Test
void testPushIngestion_Success() {
Mono<PushIngestionRequest> requestMono = Mono.just(
new PushIngestionRequest().withLegalEntity(new com.backbase.stream.compositions.legalentity.model.LegalEntity()));
Mono<LegalEntityPushIngestionRequest> requestMono = Mono.just(
new LegalEntityPushIngestionRequest().withLegalEntity(new com.backbase.stream.compositions.legalentity.model.LegalEntity()));

when(legalEntityIngestionService.ingestPush(any())).thenReturn(
Mono.just(LegalEntityIngestResponse.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import com.backbase.stream.compositions.productcatalog.core.model.ProductCatalogIngestResponse;
import com.backbase.stream.compositions.productcatalog.core.service.ProductCatalogIngestionService;
import com.backbase.stream.compositions.productcatalog.mapper.ProductCatalogMapper;
import com.backbase.stream.compositions.productcatalog.model.IngestionResponse;
import com.backbase.stream.compositions.productcatalog.model.PullIngestionRequest;
import com.backbase.stream.compositions.productcatalog.model.PushIngestionRequest;
import com.backbase.stream.compositions.productcatalog.model.ProductCatalogIngestionResponse;
import com.backbase.stream.compositions.productcatalog.model.ProductCatalogPullIngestionRequest;
import com.backbase.stream.compositions.productcatalog.model.ProductCatalogPushIngestionRequest;
import lombok.AllArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand All @@ -25,16 +25,16 @@ public class ProductCatalogController implements ProductCatalogCompositionApi {
private final ProductCatalogMapper mapper;

@Override
public Mono<ResponseEntity<IngestionResponse>> pullIngestProductCatalog(
@Valid Mono<PullIngestionRequest> pullIngestionRequest, ServerWebExchange exchange) {
public Mono<ResponseEntity<ProductCatalogIngestionResponse>> pullIngestProductCatalog(
@Valid Mono<ProductCatalogPullIngestionRequest> pullIngestionRequest, ServerWebExchange exchange) {
return productCatalogIngestionService
.ingestPull(pullIngestionRequest.map(this::buildPullRequest))
.map(this::mapIngestionToResponse);
}

@Override
public Mono<ResponseEntity<IngestionResponse>> pushIngestProductCatalog(
@Valid Mono<PushIngestionRequest> pushIngestionRequest, ServerWebExchange exchange) {
public Mono<ResponseEntity<ProductCatalogIngestionResponse>> pushIngestProductCatalog(
@Valid Mono<ProductCatalogPushIngestionRequest> pushIngestionRequest, ServerWebExchange exchange) {
return productCatalogIngestionService
.ingestPush(pushIngestionRequest.map(this::buildPushRequest))
.map(this::mapIngestionToResponse);
Expand All @@ -46,7 +46,7 @@ public Mono<ResponseEntity<IngestionResponse>> pushIngestProductCatalog(
* @param request PullIngestionRequest
* @return ProductIngestPullRequest
*/
private ProductCatalogIngestPullRequest buildPullRequest(PullIngestionRequest request) {
private ProductCatalogIngestPullRequest buildPullRequest(ProductCatalogPullIngestionRequest request) {
return ProductCatalogIngestPullRequest.builder()
.additionalParameters(request.getAdditionalParameters())
.build();
Expand All @@ -58,7 +58,7 @@ private ProductCatalogIngestPullRequest buildPullRequest(PullIngestionRequest re
* @param request PushIngestionRequest
* @return LegalEntityIngestPushRequest
*/
private ProductCatalogIngestPushRequest buildPushRequest(PushIngestionRequest request) {
private ProductCatalogIngestPushRequest buildPushRequest(ProductCatalogPushIngestionRequest request) {
return ProductCatalogIngestPushRequest.builder()
.productCatalog(mapper.mapCompositionToStream(request.getProductCatalog()))
.build();
Expand All @@ -71,9 +71,9 @@ private ProductCatalogIngestPushRequest buildPushRequest(PushIngestionRequest re
* @param response ProductCatalogIngestResponse
* @return IngestionResponse
*/
private ResponseEntity<IngestionResponse> mapIngestionToResponse(ProductCatalogIngestResponse response) {
private ResponseEntity<ProductCatalogIngestionResponse> mapIngestionToResponse(ProductCatalogIngestResponse response) {
return new ResponseEntity<>(
new IngestionResponse()
new ProductCatalogIngestionResponse()
.withProductCatalog(mapper.mapStreamToComposition(response.getProductCatalog())),
HttpStatus.CREATED);
}
Expand Down
Loading