Skip to content

Commit

Permalink
fix migration compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
Aboruhen committed Dec 20, 2023
1 parent 8ac317d commit d7b7c49
Show file tree
Hide file tree
Showing 14 changed files with 103 additions and 100 deletions.
2 changes: 2 additions & 0 deletions stream-compositions/cursors/transaction-cursor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

<properties>
<enforce-banned-dependencies.skip>true</enforce-banned-dependencies.skip>
<archunit.backbase.GeneralCodingRules.skip>true</archunit.backbase.GeneralCodingRules.skip>
<archunit.backbase.RelationalPersistenceRules.skip>true</archunit.backbase.RelationalPersistenceRules.skip>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ void testMapper_Fail() {

private TransactionCursorUpsertRequest getMockModel() {
return new TransactionCursorUpsertRequest()
.withCursor(new TransactionCursor()
.withId("3337f8cc-d66d-41b3-a00e-f71ff15d93cq")
.withArrangementId("4337f8cc-d66d-41b3-a00e-f71ff15d93cq")
.withExtArrangementId("5337f8cc-d66d-41b3-a00e-f71ff15d93cq")
.withLegalEntityId("test-ext-emp")
.withLastTxnDate("2022-05-24 03:18:19")
.withStatus(StatusEnum.IN_PROGRESS)
.withLastTxnIds(List.of("11", "12", "13", "14"))
.withAdditions(Map.of("key1", "val1")));
.cursor(new TransactionCursor()
.id("3337f8cc-d66d-41b3-a00e-f71ff15d93cq")
.arrangementId("4337f8cc-d66d-41b3-a00e-f71ff15d93cq")
.extArrangementId("5337f8cc-d66d-41b3-a00e-f71ff15d93cq")
.legalEntityId("test-ext-emp")
.lastTxnDate("2022-05-24 03:18:19")
.status(StatusEnum.IN_PROGRESS)
.lastTxnIds(List.of("11", "12", "13", "14"))
.additions(Map.of("key1", "val1")));
}

private TransactionCursorEntity getMockDomain() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@
import com.backbase.stream.compositions.transaction.cursor.model.TransactionCursorFilterRequest;
import com.backbase.stream.compositions.transaction.cursor.model.TransactionCursorPatchRequest;

import jakarta.persistence.EntityManager;
import jakarta.persistence.TypedQuery;
import jakarta.persistence.criteria.CriteriaBuilder;
import jakarta.persistence.criteria.CriteriaQuery;
import jakarta.persistence.criteria.CriteriaUpdate;
import jakarta.persistence.criteria.ParameterExpression;
import jakarta.persistence.criteria.Path;
import jakarta.persistence.criteria.Predicate;
import jakarta.persistence.criteria.Root;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.util.Date;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.CriteriaUpdate;
import javax.persistence.criteria.ParameterExpression;
import javax.persistence.criteria.Path;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -94,15 +94,15 @@ void patchByArrangementId_success() {

int result = transactionCursorCustomRepository
.patchByArrangementId("123", new TransactionCursorPatchRequest()
.withStatus(StatusEnum.IN_PROGRESS.getValue()).withLastTxnIds("11,12,13,14")
.withLastTxnDate("2022-06-02 03:18:19"));
.status(StatusEnum.IN_PROGRESS.getValue()).lastTxnIds("11,12,13,14")
.lastTxnDate("2022-06-02 03:18:19"));
assertEquals(1, result);
verify(entityManager, times(1)).getCriteriaBuilder();
verify(criteriaBuilder, times(1)).createCriteriaUpdate(TransactionCursorEntity.class);

int resultWithOutTxnDate = transactionCursorCustomRepository
.patchByArrangementId("123", new TransactionCursorPatchRequest()
.withStatus(StatusEnum.IN_PROGRESS.getValue()).withLastTxnIds("11,12,13,14"));
.status(StatusEnum.IN_PROGRESS.getValue()).lastTxnIds("11,12,13,14"));
assertEquals(1, resultWithOutTxnDate);
}

Expand All @@ -115,8 +115,8 @@ void patchByArrangementId_fail() {
try {
transactionCursorCustomRepository
.patchByArrangementId("123", new TransactionCursorPatchRequest()
.withStatus(StatusEnum.IN_PROGRESS.getValue()).withLastTxnIds("11,12,13,14")
.withLastTxnDate("2022-06 03:18:19"));
.status(StatusEnum.IN_PROGRESS.getValue()).lastTxnIds("11,12,13,14")
.lastTxnDate("2022-06 03:18:19"));
} catch (Exception exception) {
assertThat(exception instanceof ParseException);
}
Expand All @@ -141,8 +141,8 @@ void filterCursor_success() throws ParseException {
.thenReturn(typedQuery);
when(typedQuery.getResultList()).thenReturn(List.of(getMockDomain()));
List<TransactionCursorEntity> transactionCursorEntities = transactionCursorCustomRepository
.filterCursor(new TransactionCursorFilterRequest().withStatus(StatusEnum.SUCCESS
.getValue()).withLastTxnDate("2022-05-24 03:18:59"));
.filterCursor(new TransactionCursorFilterRequest().status(StatusEnum.SUCCESS
.getValue()).lastTxnDate("2022-05-24 03:18:59"));
assertNotNull(transactionCursorEntities);
assertThat(transactionCursorEntities.size()).isEqualTo(1);
assertThat(transactionCursorEntities.get(0).getArrangementId())
Expand All @@ -162,8 +162,8 @@ void filterCursor_fail() {
.thenReturn(predicate);
try {
transactionCursorCustomRepository
.filterCursor(new TransactionCursorFilterRequest().withStatus(StatusEnum.SUCCESS
.getValue()).withLastTxnDate("2022-12 03:18:59"));
.filterCursor(new TransactionCursorFilterRequest().status(StatusEnum.SUCCESS
.getValue()).lastTxnDate("2022-12 03:18:59"));
} catch (Exception exception) {
assertThat(exception instanceof ParseException);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ void upsertCursor_success() {
transactionCursorEntity.setId("1234567890");
when(transactionCursorRepository.save(any())).thenReturn(transactionCursorEntity);
TransactionCursorUpsertRequest transactionCursorUpsertRequest = new TransactionCursorUpsertRequest()
.withCursor(new TransactionCursor().withArrangementId("123"));
.cursor(new TransactionCursor().arrangementId("123"));
TransactionCursorUpsertResponse transactionCursorUpsertResponse = new TransactionCursorUpsertResponse()
.withId("1234567890");
.id("1234567890");
StepVerifier
.create(transactionCursorService.upsertCursor(Mono.just(transactionCursorUpsertRequest)))
.expectNext(new ResponseEntity<>
Expand All @@ -114,8 +114,8 @@ void patchByArrangementId_success() {
@Test
void patchByArrangementId_error() {
StepVerifier.create(transactionCursorService.patchByArrangementId("123",
Mono.just(new TransactionCursorPatchRequest().withLastTxnDate("123-123-123")
.withStatus(StatusEnum.SUCCESS.getValue())))).expectError(ParseException.class);
Mono.just(new TransactionCursorPatchRequest().lastTxnDate("123-123-123")
.status(StatusEnum.SUCCESS.getValue())))).expectError(ParseException.class);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import com.backbase.stream.compositions.transaction.cursor.model.TransactionCursorPatchRequest;
import com.backbase.stream.compositions.transaction.cursor.model.TransactionCursorUpsertRequest;

import jakarta.persistence.EntityManager;
import java.util.Optional;
import javax.persistence.EntityManager;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand Down Expand Up @@ -118,9 +118,9 @@ void patchByArrangementId_Success() {
String arrangementId = "4337f8cc-d66d-41b3-a00e-f71ff15d93cq";

TransactionCursorPatchRequest transactionCursorPatchRequest = new TransactionCursorPatchRequest()
.withLastTxnDate("2022-05-24 03:18:19")
.withStatus(StatusEnum.SUCCESS.getValue())
.withLastTxnIds("11,12,13,14");
.lastTxnDate("2022-05-24 03:18:19")
.status(StatusEnum.SUCCESS.getValue())
.lastTxnIds("11,12,13,14");

webTestClient
.patch().uri("/service-api/v2/cursor/arrangement/{arrangementId}", arrangementId)
Expand All @@ -133,7 +133,7 @@ void patchByArrangementId_Success() {
@Test
void filterCursor_Success() {
TransactionCursorFilterRequest transactionCursorFilterRequest = new TransactionCursorFilterRequest()
.withLastTxnDate("2022-05-24 03:18:59").withStatus(StatusEnum.SUCCESS.getValue());
.lastTxnDate("2022-05-24 03:18:59").status(StatusEnum.SUCCESS.getValue());
webTestClient.post().uri("/service-api/v2/cursor/filter")
.contentType(MediaType.APPLICATION_JSON)
.body(Mono.just(transactionCursorFilterRequest), TransactionCursorFilterRequest.class)
Expand All @@ -143,11 +143,11 @@ void filterCursor_Success() {
// @Test
void upsertCursor_Success() {
TransactionCursorUpsertRequest transactionCursorUpsertRequest =
new TransactionCursorUpsertRequest().withCursor(new TransactionCursor()
.withArrangementId("4337f8cc-d66d-41b3-a00e-f71ff15d93cq")
.withExtArrangementId("5337f8cc-d66d-41b3-a00e-f71ff15d93cq")
.withLegalEntityId("beta-emp-ext")
.withStatus(StatusEnum.IN_PROGRESS));
new TransactionCursorUpsertRequest().cursor(new TransactionCursor()
.arrangementId("4337f8cc-d66d-41b3-a00e-f71ff15d93cq")
.extArrangementId("5337f8cc-d66d-41b3-a00e-f71ff15d93cq")
.legalEntityId("beta-emp-ext")
.status(StatusEnum.IN_PROGRESS));
TransactionCursorEntity transactionCursorEntity = new TransactionCursorEntity();
transactionCursorEntity.setId("3337f8cc-d66d-41b3-a00e-f71ff15d93cq");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void testDeleteCursor_success() {
void testFindByArrangementId_success() {
when(transactionCursorService.findByArrangementId(any()))
.thenReturn(Mono.just(new ResponseEntity<>
(new TransactionCursorResponse().withCursor(new TransactionCursor()), HttpStatus.OK)));
(new TransactionCursorResponse().cursor(new TransactionCursor()), HttpStatus.OK)));
Mono<ResponseEntity<TransactionCursorResponse>> responseEntity = transactionCursorController
.getByArrangementId(anyString(), null);
assertNotNull(responseEntity.block().getBody());
Expand All @@ -55,7 +55,7 @@ void testFindByArrangementId_success() {
void testFindById_success() {
when(transactionCursorService.findById(any()))
.thenReturn(Mono.just(new ResponseEntity<>
(new TransactionCursorResponse().withCursor(new TransactionCursor()), HttpStatus.OK)));
(new TransactionCursorResponse().cursor(new TransactionCursor()), HttpStatus.OK)));
Mono<ResponseEntity<TransactionCursorResponse>> responseEntity = transactionCursorController
.getById(anyString(), null);
assertNotNull(responseEntity.block().getBody());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ void pullIngestPaymentOrder_Success() throws Exception {

PaymentOrderPullIngestionRequest pullIngestionRequest =
new PaymentOrderPullIngestionRequest()
.withInternalUserId("4337f8cc-d66d-41b3-a00e-f71ff15d93cg")
.withMemberNumber("memberId")
.withServiceAgreementInternalId("4337f8cc-d66d-41b3-a00e-f71ff15d93cf")
.withLegalEntityExternalId("leExternalId")
.withLegalEntityInternalId("leInternalId");
.internalUserId("4337f8cc-d66d-41b3-a00e-f71ff15d93cg")
.memberNumber("memberId")
.serviceAgreementInternalId("4337f8cc-d66d-41b3-a00e-f71ff15d93cf")
.legalEntityExternalId("leExternalId")
.legalEntityInternalId("leInternalId");
webTestClient.post().uri(uri)
.contentType(org.springframework.http.MediaType.APPLICATION_JSON)
.body(Mono.just(pullIngestionRequest), PaymentOrderPullIngestionRequest.class).exchange()
Expand Down Expand Up @@ -144,12 +144,12 @@ void pushIngestPaymentOrder_Success() throws Exception {

PaymentOrderPushIngestionRequest pushIngestionRequest =
new PaymentOrderPushIngestionRequest()
.withPaymentOrders(List.of(new PaymentOrderPostRequest()
.withInternalUserId("4337f8cc-d66d-41b3-a00e-f71ff15d93cg")
.withBankReferenceId("bankRefId")
.withServiceAgreementId("4337f8cc-d66d-41b3-a00e-f71ff15d93cf")
.withPaymentSetupId("paymentSetupId")
.withPaymentSubmissionId("paymentSubmissionId")));
.paymentOrders(List.of(new PaymentOrderPostRequest()
.internalUserId("4337f8cc-d66d-41b3-a00e-f71ff15d93cg")
.bankReferenceId("bankRefId")
.serviceAgreementId("4337f8cc-d66d-41b3-a00e-f71ff15d93cf")
.paymentSetupId("paymentSetupId")
.paymentSubmissionId("paymentSubmissionId")));

webTestClient.post().uri(uri)
.contentType(org.springframework.http.MediaType.APPLICATION_JSON)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void setUp() {
void testPullIngestion_Success() {

Mono<PaymentOrderPullIngestionRequest> requestMono = Mono.just(
new PaymentOrderPullIngestionRequest().withInternalUserId("internalUserId"));
new PaymentOrderPullIngestionRequest().internalUserId("internalUserId"));

List<PaymentOrderIngestDbsResponse> paymentOrderIngestDbsResponses = new ArrayList<>();
paymentOrderIngestDbsResponses.add(new NewPaymentOrderIngestDbsResponse(new PaymentOrderPostResponse()));
Expand Down
4 changes: 2 additions & 2 deletions stream-compositions/services/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<artifactId>spring-boot-starter-logging</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
Expand Down
Loading

0 comments on commit d7b7c49

Please sign in to comment.