From e09a87db80bd22477b37c09e1289a1f60c1911fe Mon Sep 17 00:00:00 2001 From: Gurleen Kaur Date: Wed, 6 Mar 2024 14:54:13 +0530 Subject: [PATCH 1/7] [MODAUD-183] - Upgrade rmb and vertex version. --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index a4fd0e44..28098366 100644 --- a/pom.xml +++ b/pom.xml @@ -19,8 +19,8 @@ 1.9.19 - 35.0.4 - 4.3.5 + 35.2.0 + 4.5.4 2.25.1 5.6.2 4.3.0 From 32c7906f21152bc0ed55957d3ecc45d208ab523d Mon Sep 17 00:00:00 2001 From: Gurleen Kaur Date: Wed, 6 Mar 2024 15:43:53 +0530 Subject: [PATCH 2/7] [MODAUD-183] - Upgrade rmb and vertex version. --- pom.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 28098366..41cec16f 100644 --- a/pom.xml +++ b/pom.xml @@ -18,12 +18,12 @@ - 1.9.19 + 1.9.21.1 35.2.0 4.5.4 2.25.1 5.6.2 - 4.3.0 + 5.4.0 2.14.1 2.7.0 0.7.3 @@ -65,7 +65,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.12.1 17 UTF-8 @@ -89,7 +89,7 @@ org.apache.maven.plugins maven-resources-plugin - 3.1.0 + 3.3.1 filter-descriptor-inputs @@ -141,7 +141,7 @@ org.apache.maven.plugins maven-release-plugin - 2.5.3 + 3.0.1 clean verify v@{project.version} From 075b88dea389f0f6eefa1df8b75d17e4cfd22780 Mon Sep 17 00:00:00 2001 From: Gurleen Kaur Date: Wed, 6 Mar 2024 15:52:32 +0530 Subject: [PATCH 3/7] [MODAUD-183] - Upgrade rmb and vertex version. --- mod-audit-server/pom.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mod-audit-server/pom.xml b/mod-audit-server/pom.xml index 9e13cbf0..a73fdcb1 100644 --- a/mod-audit-server/pom.xml +++ b/mod-audit-server/pom.xml @@ -46,7 +46,7 @@ org.apache.kafka kafka-clients - 3.1.0 + 3.6.1 io.vertx @@ -55,7 +55,7 @@ net.mguenther.kafka kafka-junit - 3.1.0 + 3.6.0 test @@ -153,7 +153,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.12.1 17 UTF-8 @@ -163,7 +163,7 @@ org.codehaus.mojo build-helper-maven-plugin - 3.2.0 + 3.5.0 add_generated_sources_folder @@ -221,7 +221,7 @@ dev.aspectj aspectj-maven-plugin - 1.13.1 + 1.14 true false @@ -266,7 +266,7 @@ org.apache.maven.plugins maven-resources-plugin - 3.1.0 + 3.3.1 copy-resources @@ -310,7 +310,7 @@ org.apache.maven.plugins maven-antrun-plugin - 3.0.0 + 3.1.0 prepare-package @@ -334,7 +334,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.2.2 + 3.5.2 package @@ -377,7 +377,7 @@ org.apache.maven.plugins maven-release-plugin - 2.5.3 + 3.0.1 clean verify v@{project.version} From 399d19bc575937fb02dc014af84e90227b0a7602 Mon Sep 17 00:00:00 2001 From: Gurleen Kaur Date: Fri, 8 Mar 2024 16:19:34 +0530 Subject: [PATCH 4/7] MODAUD-183 - fixing the failed test cases. --- .../java/org/folio/rest/impl/CirculationLogsImplApiTest.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mod-audit-server/src/test/java/org/folio/rest/impl/CirculationLogsImplApiTest.java b/mod-audit-server/src/test/java/org/folio/rest/impl/CirculationLogsImplApiTest.java index ce39fe8a..8740110f 100644 --- a/mod-audit-server/src/test/java/org/folio/rest/impl/CirculationLogsImplApiTest.java +++ b/mod-audit-server/src/test/java/org/folio/rest/impl/CirculationLogsImplApiTest.java @@ -100,7 +100,6 @@ void anonymizeLoanShouldRemoveUserDataFromRelatedRecords() { given().headers(HEADERS).get(CIRCULATION_LOGS_ENDPOINT + "?query=(items=845687423)") .then().log().all().statusCode(200) .assertThat() - .body("totalRecords", equalTo(6)) .body("logRecords[0].userBarcode", is(NO_BARCODE)) .and().body("logRecords[0].linkToIds.userId", is(emptyOrNullString())) .and().body("logRecords[1].userBarcode", is(NO_BARCODE)) @@ -110,9 +109,7 @@ void anonymizeLoanShouldRemoveUserDataFromRelatedRecords() { .and().body("logRecords[3].userBarcode", is(NO_BARCODE)) .and().body("logRecords[3].linkToIds.userId", is(emptyOrNullString())) .and().body("logRecords[4].userBarcode", is(NO_BARCODE)) - .and().body("logRecords[4].linkToIds.userId", is(emptyOrNullString())) - .and().body("logRecords[5].userBarcode", is(NO_BARCODE)) - .and().body("logRecords[5].linkToIds.userId", is(emptyOrNullString())); + .and().body("logRecords[4].linkToIds.userId", is(emptyOrNullString())); } @Test From b3402b7cccb918105d4d804d66e9bd13b03409c1 Mon Sep 17 00:00:00 2001 From: Gurleen Kaur Date: Fri, 8 Mar 2024 16:40:05 +0530 Subject: [PATCH 5/7] MODAUD-183 - fixing the failed test cases. --- .../folio/rest/impl/AuditHandlersService.java | 16 ++++++++-------- .../rest/impl/CirculationLogsImplApiTest.java | 5 ++++- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/mod-audit-server/src/main/java/org/folio/rest/impl/AuditHandlersService.java b/mod-audit-server/src/main/java/org/folio/rest/impl/AuditHandlersService.java index afd97d7a..0181eb2c 100644 --- a/mod-audit-server/src/main/java/org/folio/rest/impl/AuditHandlersService.java +++ b/mod-audit-server/src/main/java/org/folio/rest/impl/AuditHandlersService.java @@ -32,7 +32,7 @@ public class AuditHandlersService extends BaseService implements AuditHandlers { @Override @Validate public void postAuditHandlersLogRecord(String entity, Map okapiHeaders, - Handler> asyncResultHandler, Context vertxContext) { + Handler> asyncResultHandler, Context vertxContext) { LOGGER.debug("postAuditHandlersLogRecord:: Trying to Save AuditHandlersLogRecord request with entity: {}", entity); try { LOGGER.info("postAuditHandlersLogRecord:: Saving AuditHandlersLogRecord request with entity: {}", entity); @@ -44,14 +44,14 @@ public void postAuditHandlersLogRecord(String entity, Map okapiH .exceptionally(throwable -> { LOGGER.warn("Error saving log event : {} due to : {}", entity, throwable.getLocalizedMessage()); return null; - }); + }).thenAccept(v -> + asyncResultHandler.handle(succeededFuture(PostAuditHandlersLogRecordResponse.respond204())) + ); } catch (Exception e) { LOGGER.warn("Error saving log event for entity {} due to {} ", entity, e.getMessage()); - } finally { asyncResultHandler.handle(succeededFuture(PostAuditHandlersLogRecordResponse.respond204())); } } - private CompletableFuture> processAnonymize(List records, Map okapiHeaders, Context vertxContext) { LOGGER.debug("processAnonymize:: Processing anonymize for records"); @@ -78,10 +78,10 @@ private CompletableFuture> anonymizeLoanRelatedRecords(List { if (reply.succeeded()) { LOGGER.info("anonymizeLoanRelatedRecords:: Anonymize loan-related records for log records Successfully"); - reply.result().getResults().forEach(record -> { - record.setUserBarcode(null); - record.setLinkToIds(record.getLinkToIds().withUserId(null)); - result.add(record); + reply.result().getResults().forEach(logRecord -> { + logRecord.setUserBarcode(null); + logRecord.setLinkToIds(logRecord.getLinkToIds().withUserId(null)); + result.add(logRecord); }); future.complete(result); } else { diff --git a/mod-audit-server/src/test/java/org/folio/rest/impl/CirculationLogsImplApiTest.java b/mod-audit-server/src/test/java/org/folio/rest/impl/CirculationLogsImplApiTest.java index 8740110f..ce39fe8a 100644 --- a/mod-audit-server/src/test/java/org/folio/rest/impl/CirculationLogsImplApiTest.java +++ b/mod-audit-server/src/test/java/org/folio/rest/impl/CirculationLogsImplApiTest.java @@ -100,6 +100,7 @@ void anonymizeLoanShouldRemoveUserDataFromRelatedRecords() { given().headers(HEADERS).get(CIRCULATION_LOGS_ENDPOINT + "?query=(items=845687423)") .then().log().all().statusCode(200) .assertThat() + .body("totalRecords", equalTo(6)) .body("logRecords[0].userBarcode", is(NO_BARCODE)) .and().body("logRecords[0].linkToIds.userId", is(emptyOrNullString())) .and().body("logRecords[1].userBarcode", is(NO_BARCODE)) @@ -109,7 +110,9 @@ void anonymizeLoanShouldRemoveUserDataFromRelatedRecords() { .and().body("logRecords[3].userBarcode", is(NO_BARCODE)) .and().body("logRecords[3].linkToIds.userId", is(emptyOrNullString())) .and().body("logRecords[4].userBarcode", is(NO_BARCODE)) - .and().body("logRecords[4].linkToIds.userId", is(emptyOrNullString())); + .and().body("logRecords[4].linkToIds.userId", is(emptyOrNullString())) + .and().body("logRecords[5].userBarcode", is(NO_BARCODE)) + .and().body("logRecords[5].linkToIds.userId", is(emptyOrNullString())); } @Test From d74a1465bb00ed8148ca6cdc56e2525cecaa8780 Mon Sep 17 00:00:00 2001 From: Gurleen Kaur Date: Fri, 8 Mar 2024 17:59:40 +0530 Subject: [PATCH 6/7] MODAUD-183 - fixing the failed test cases. --- .../impl/AuditDataAcquisitionAPITest.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/mod-audit-server/src/test/java/org/folio/rest/impl/AuditDataAcquisitionAPITest.java b/mod-audit-server/src/test/java/org/folio/rest/impl/AuditDataAcquisitionAPITest.java index 4234c741..08788e50 100644 --- a/mod-audit-server/src/test/java/org/folio/rest/impl/AuditDataAcquisitionAPITest.java +++ b/mod-audit-server/src/test/java/org/folio/rest/impl/AuditDataAcquisitionAPITest.java @@ -101,24 +101,24 @@ void shouldReturnOrderLineEventsOnGetByOrderLineId() { .withActionDate(new Date()) .withOrderLineSnapshot(jsonObject); - orderLineEventDao.save(orderLineAuditEvent, TENANT_ID); + orderLineEventDao.save(orderLineAuditEvent, TENANT_ID).onComplete(v -> { + given().header(CONTENT_TYPE).header(TENANT).header(PERMS).get(ACQ_AUDIT_ORDER_LINE_PATH + INVALID_ID) + .then().log().all().statusCode(200) + .body(containsString("orderLineAuditEvents")).body(containsString("totalItems")); - given().header(CONTENT_TYPE).header(TENANT).header(PERMS).get(ACQ_AUDIT_ORDER_LINE_PATH + INVALID_ID) - .then().log().all().statusCode(200) - .body(containsString("orderLineAuditEvents")).body(containsString("totalItems")); - - given().header(CONTENT_TYPE).header(TENANT).header(PERMS).get(ACQ_AUDIT_ORDER_LINE_PATH + ORDER_LINE_ID) - .then().log().all().statusCode(200) - .body(containsString(ORDER_LINE_ID)); + given().header(CONTENT_TYPE).header(TENANT).header(PERMS).get(ACQ_AUDIT_ORDER_LINE_PATH + ORDER_LINE_ID) + .then().log().all().statusCode(200) + .body(containsString(ORDER_LINE_ID)); - given().header(CONTENT_TYPE).header(TENANT).header(PERMS).get(ACQ_AUDIT_ORDER_LINE_PATH + ORDER_LINE_ID + "?limit=1").then().log().all().statusCode(200) - .body(containsString(ORDER_LINE_ID)); + given().header(CONTENT_TYPE).header(TENANT).header(PERMS).get(ACQ_AUDIT_ORDER_LINE_PATH + ORDER_LINE_ID + "?limit=1").then().log().all().statusCode(200) + .body(containsString(ORDER_LINE_ID)); - given().header(CONTENT_TYPE).header(TENANT).header(PERMS).get(ACQ_AUDIT_ORDER_LINE_PATH + ORDER_LINE_ID + "?sortBy=action_date").then().log().all().statusCode(200) - .body(containsString(ORDER_LINE_ID)); + given().header(CONTENT_TYPE).header(TENANT).header(PERMS).get(ACQ_AUDIT_ORDER_LINE_PATH + ORDER_LINE_ID + "?sortBy=action_date").then().log().all().statusCode(200) + .body(containsString(ORDER_LINE_ID)); - given().header(CONTENT_TYPE).header(TENANT).header(PERMS).get(ACQ_AUDIT_ORDER_PATH + ORDER_LINE_ID + 123).then().log().all().statusCode(500) - .body(containsString("UUID string too large")); + given().header(CONTENT_TYPE).header(TENANT).header(PERMS).get(ACQ_AUDIT_ORDER_PATH + ORDER_LINE_ID + 123).then().log().all().statusCode(500) + .body(containsString("UUID string too large")); + }); } @Test From f2a304108a7a494f70b462de174a6a2dee6dde06 Mon Sep 17 00:00:00 2001 From: Gurleen Kaur Date: Sat, 9 Mar 2024 09:51:52 +0530 Subject: [PATCH 7/7] MODAUD-183 - fixing the failed test cases. --- .../java/org/folio/rest/impl/AuditHandlersService.java | 7 ++++--- .../org/folio/rest/impl/CirculationLogsImplApiTest.java | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/mod-audit-server/src/main/java/org/folio/rest/impl/AuditHandlersService.java b/mod-audit-server/src/main/java/org/folio/rest/impl/AuditHandlersService.java index 0181eb2c..87d66e7b 100644 --- a/mod-audit-server/src/main/java/org/folio/rest/impl/AuditHandlersService.java +++ b/mod-audit-server/src/main/java/org/folio/rest/impl/AuditHandlersService.java @@ -44,14 +44,15 @@ public void postAuditHandlersLogRecord(String entity, Map okapiH .exceptionally(throwable -> { LOGGER.warn("Error saving log event : {} due to : {}", entity, throwable.getLocalizedMessage()); return null; - }).thenAccept(v -> - asyncResultHandler.handle(succeededFuture(PostAuditHandlersLogRecordResponse.respond204())) - ); + }); } catch (Exception e) { LOGGER.warn("Error saving log event for entity {} due to {} ", entity, e.getMessage()); + } finally { asyncResultHandler.handle(succeededFuture(PostAuditHandlersLogRecordResponse.respond204())); } } + + private CompletableFuture> processAnonymize(List records, Map okapiHeaders, Context vertxContext) { LOGGER.debug("processAnonymize:: Processing anonymize for records"); diff --git a/mod-audit-server/src/test/java/org/folio/rest/impl/CirculationLogsImplApiTest.java b/mod-audit-server/src/test/java/org/folio/rest/impl/CirculationLogsImplApiTest.java index ce39fe8a..70bc15d7 100644 --- a/mod-audit-server/src/test/java/org/folio/rest/impl/CirculationLogsImplApiTest.java +++ b/mod-audit-server/src/test/java/org/folio/rest/impl/CirculationLogsImplApiTest.java @@ -95,7 +95,7 @@ void anonymizeLoanShouldRemoveUserDataFromRelatedRecords() { .log().all() .statusCode(204); - await().atLeast(1, TimeUnit.SECONDS); + await().pollDelay(1, TimeUnit.SECONDS).until(() -> true); given().headers(HEADERS).get(CIRCULATION_LOGS_ENDPOINT + "?query=(items=845687423)") .then().log().all().statusCode(200)