From 91264008c51661b5b986bc8172d1d53cb2b8109d Mon Sep 17 00:00:00 2001 From: yaroslav-epam <138673581+yaroslav-epam@users.noreply.github.com> Date: Tue, 21 Nov 2023 17:59:54 +0200 Subject: [PATCH] MODSOURMAN-1022: migrate from DI_SRS_MARC_BIB_RECORD_CREATED to DI_INCOMING_MARC_BIB_RECORD_PARSED event (#650) --- NEWS.md | 3 ++ .../inventory/DataImportConsumerVerticle.java | 4 +- .../DataImportConsumerVerticleTest.java | 4 +- .../consumers/DataImportKafkaHandlerTest.java | 4 +- .../CreateHoldingEventHandlerTest.java | 4 +- .../CreateInstanceEventHandlerTest.java | 4 +- .../actions/CreateItemEventHandlerTest.java | 46 +++++++++---------- ...odifiedPostProcessingEventHandlerTest.java | 4 +- .../actions/UpdateItemEventHandlerTest.java | 4 +- .../MatchHoldingEventHandlerUnitTest.java | 16 +++---- .../MatchInstanceEventHandlerUnitTest.java | 20 ++++---- .../MatchItemEventHandlerUnitTest.java | 16 +++---- 12 files changed, 66 insertions(+), 63 deletions(-) diff --git a/NEWS.md b/NEWS.md index 60187ab98..0aaceb275 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,6 @@ +## 20.2.0-SNAPSHOT 2023-XX-XX +* [MODSOURMAN-1022](https://issues.folio.org/browse/MODSOURMAN-1022) Remove step of initial saving of incoming records to SRS + ## 20.1.0 2023-10-13 * Update status when user attempts to update shared auth record from member tenant ([MODDATAIMP-926](https://issues.folio.org/browse/MODDATAIMP-926)) * Add cache to get and store consortium data configurations ([MODINV-872](https://issues.folio.org/browse/MODINV-872)) diff --git a/src/main/java/org/folio/inventory/DataImportConsumerVerticle.java b/src/main/java/org/folio/inventory/DataImportConsumerVerticle.java index 9b14db428..271dff4b2 100644 --- a/src/main/java/org/folio/inventory/DataImportConsumerVerticle.java +++ b/src/main/java/org/folio/inventory/DataImportConsumerVerticle.java @@ -19,7 +19,7 @@ import static org.folio.DataImportEventTypes.DI_SRS_MARC_AUTHORITY_RECORD_CREATED; import static org.folio.DataImportEventTypes.DI_SRS_MARC_AUTHORITY_RECORD_MODIFIED_READY_FOR_POST_PROCESSING; import static org.folio.DataImportEventTypes.DI_SRS_MARC_AUTHORITY_RECORD_NOT_MATCHED; -import static org.folio.DataImportEventTypes.DI_SRS_MARC_BIB_RECORD_CREATED; +import static org.folio.DataImportEventTypes.DI_INCOMING_MARC_BIB_RECORD_PARSED; import static org.folio.DataImportEventTypes.DI_SRS_MARC_BIB_RECORD_MATCHED; import static org.folio.DataImportEventTypes.DI_SRS_MARC_BIB_RECORD_MATCHED_READY_FOR_POST_PROCESSING; import static org.folio.DataImportEventTypes.DI_SRS_MARC_BIB_RECORD_MODIFIED; @@ -87,7 +87,7 @@ public class DataImportConsumerVerticle extends AbstractVerticle { DI_SRS_MARC_AUTHORITY_RECORD_DELETED, DI_SRS_MARC_AUTHORITY_RECORD_MODIFIED_READY_FOR_POST_PROCESSING, DI_SRS_MARC_AUTHORITY_RECORD_NOT_MATCHED, - DI_SRS_MARC_BIB_RECORD_CREATED, + DI_INCOMING_MARC_BIB_RECORD_PARSED, DI_SRS_MARC_BIB_RECORD_MATCHED, DI_SRS_MARC_BIB_RECORD_MATCHED_READY_FOR_POST_PROCESSING, DI_SRS_MARC_BIB_RECORD_MODIFIED, diff --git a/src/test/java/org/folio/inventory/dataimport/consumers/DataImportConsumerVerticleTest.java b/src/test/java/org/folio/inventory/dataimport/consumers/DataImportConsumerVerticleTest.java index 9979e9aed..56d987446 100644 --- a/src/test/java/org/folio/inventory/dataimport/consumers/DataImportConsumerVerticleTest.java +++ b/src/test/java/org/folio/inventory/dataimport/consumers/DataImportConsumerVerticleTest.java @@ -51,7 +51,7 @@ import static net.mguenther.kafka.junit.EmbeddedKafkaClusterConfig.defaultClusterConfig; import static org.folio.ActionProfile.Action.CREATE; import static org.folio.DataImportEventTypes.DI_COMPLETED; -import static org.folio.DataImportEventTypes.DI_SRS_MARC_BIB_RECORD_CREATED; +import static org.folio.DataImportEventTypes.DI_INCOMING_MARC_BIB_RECORD_PARSED; import static org.folio.inventory.dataimport.util.KafkaConfigConstants.KAFKA_ENV; import static org.folio.inventory.dataimport.util.KafkaConfigConstants.KAFKA_HOST; import static org.folio.inventory.dataimport.util.KafkaConfigConstants.KAFKA_MAX_REQUEST_SIZE; @@ -169,7 +169,7 @@ public void setUp() { public void shouldSendEventWithProcessedEventPayloadWhenProcessingCoreHandlerSucceeded() throws InterruptedException { // given DataImportEventPayload dataImportEventPayload = new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withTenant(TENANT_ID) .withOkapiUrl(mockServer.baseUrl()) .withToken("test-token") diff --git a/src/test/java/org/folio/inventory/dataimport/consumers/DataImportKafkaHandlerTest.java b/src/test/java/org/folio/inventory/dataimport/consumers/DataImportKafkaHandlerTest.java index 7d59f0534..f13e116d3 100644 --- a/src/test/java/org/folio/inventory/dataimport/consumers/DataImportKafkaHandlerTest.java +++ b/src/test/java/org/folio/inventory/dataimport/consumers/DataImportKafkaHandlerTest.java @@ -50,7 +50,7 @@ import static net.mguenther.kafka.junit.EmbeddedKafkaCluster.provisionWith; import static net.mguenther.kafka.junit.EmbeddedKafkaClusterConfig.defaultClusterConfig; import static org.folio.ActionProfile.Action.CREATE; -import static org.folio.DataImportEventTypes.DI_SRS_MARC_BIB_RECORD_CREATED; +import static org.folio.DataImportEventTypes.DI_INCOMING_MARC_BIB_RECORD_PARSED; import static org.folio.rest.jaxrs.model.EntityType.INSTANCE; import static org.folio.rest.jaxrs.model.EntityType.MARC_BIBLIOGRAPHIC; import static org.folio.rest.jaxrs.model.ProfileSnapshotWrapper.ContentType.ACTION_PROFILE; @@ -198,7 +198,7 @@ public void shouldReturnFailedFutureWhenProcessingCoreHandlerFailed(TestContext // given Async async = context.async(); DataImportEventPayload dataImportEventPayload = new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withTenant("diku") .withOkapiUrl(mockServer.baseUrl()) .withToken("test-token") diff --git a/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateHoldingEventHandlerTest.java b/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateHoldingEventHandlerTest.java index 37193f293..7ab02f86a 100644 --- a/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateHoldingEventHandlerTest.java +++ b/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateHoldingEventHandlerTest.java @@ -67,7 +67,7 @@ import static org.folio.ActionProfile.FolioRecord.HOLDINGS; import static org.folio.ActionProfile.FolioRecord.MARC_BIBLIOGRAPHIC; import static org.folio.DataImportEventTypes.DI_INVENTORY_HOLDING_CREATED; -import static org.folio.DataImportEventTypes.DI_SRS_MARC_BIB_RECORD_CREATED; +import static org.folio.DataImportEventTypes.DI_INCOMING_MARC_BIB_RECORD_PARSED; import static org.folio.inventory.dataimport.handlers.actions.CreateHoldingEventHandler.ACTION_HAS_NO_MAPPING_MSG; import static org.folio.inventory.dataimport.util.DataImportConstants.UNIQUE_ID_ERROR_MESSAGE; import static org.folio.rest.jaxrs.model.ProfileSnapshotWrapper.ContentType.ACTION_PROFILE; @@ -754,7 +754,7 @@ public void shouldNotProcessEventWhenRecordToHoldingsFutureFails() throws Execut payloadContext.put(EntityType.HOLDINGS.value(), holdingAsJson.encode()); DataImportEventPayload dataImportEventPayload = new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withJobExecutionId(UUID.randomUUID().toString()) .withContext(payloadContext) .withCurrentNode(profileSnapshotWrapper.getChildSnapshotWrappers().get(0)); diff --git a/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateInstanceEventHandlerTest.java b/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateInstanceEventHandlerTest.java index 28b86d010..18f255eb3 100644 --- a/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateInstanceEventHandlerTest.java +++ b/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateInstanceEventHandlerTest.java @@ -69,7 +69,7 @@ import static org.folio.ActionProfile.FolioRecord.MARC_BIBLIOGRAPHIC; import static org.folio.DataImportEventTypes.DI_INVENTORY_INSTANCE_CREATED; import static org.folio.DataImportEventTypes.DI_INVENTORY_INSTANCE_CREATED_READY_FOR_POST_PROCESSING; -import static org.folio.DataImportEventTypes.DI_SRS_MARC_BIB_RECORD_CREATED; +import static org.folio.DataImportEventTypes.DI_INCOMING_MARC_BIB_RECORD_PARSED; import static org.folio.inventory.dataimport.util.DataImportConstants.UNIQUE_ID_ERROR_MESSAGE; import static org.folio.rest.jaxrs.model.ProfileSnapshotWrapper.ContentType.ACTION_PROFILE; import static org.folio.rest.jaxrs.model.ProfileSnapshotWrapper.ContentType.JOB_PROFILE; @@ -454,7 +454,7 @@ public void shouldReturnFailedFutureIfCurrentActionProfileHasNoMappingProfile() context.put(MARC_BIBLIOGRAPHIC.value(), Json.encode(new Record().withParsedRecord(new ParsedRecord().withContent(PARSED_CONTENT)))); DataImportEventPayload dataImportEventPayload = new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withContext(context) .withCurrentNode(new ProfileSnapshotWrapper() .withContentType(ACTION_PROFILE) diff --git a/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateItemEventHandlerTest.java b/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateItemEventHandlerTest.java index 669f04c38..363a5e31a 100644 --- a/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateItemEventHandlerTest.java +++ b/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateItemEventHandlerTest.java @@ -63,7 +63,7 @@ import java.util.function.Consumer; import static org.folio.DataImportEventTypes.DI_INVENTORY_ITEM_CREATED; -import static org.folio.DataImportEventTypes.DI_SRS_MARC_BIB_RECORD_CREATED; +import static org.folio.DataImportEventTypes.DI_INCOMING_MARC_BIB_RECORD_PARSED; import static org.folio.inventory.dataimport.handlers.actions.CreateItemEventHandler.ACTION_HAS_NO_MAPPING_MSG; import static org.folio.inventory.dataimport.util.DataImportConstants.UNIQUE_ID_ERROR_MESSAGE; import static org.folio.inventory.domain.items.ItemStatusName.AVAILABLE; @@ -209,7 +209,7 @@ public void shouldCreateItemAndFillInHoldingsRecordIdFromHoldingsEntityAndFillIn payloadContext.put(HOLDINGS_IDENTIFIERS, Json.encode(List.of(PERMANENT_LOCATION_ID))); DataImportEventPayload dataImportEventPayload = new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withJobExecutionId(UUID.randomUUID().toString()) .withContext(payloadContext) .withCurrentNode(profileSnapshotWrapper.getChildSnapshotWrappers().get(0)); @@ -277,7 +277,7 @@ public void shouldCreateMultipleItems() payloadContext.put(HOLDINGS_IDENTIFIERS, Json.encode(List.of(PERMANENT_LOCATION_ID, permanentLocationId2))); DataImportEventPayload dataImportEventPayload = new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withJobExecutionId(UUID.randomUUID().toString()) .withContext(payloadContext) .withCurrentNode(profileSnapshotWrapper.getChildSnapshotWrappers().get(0)); @@ -356,7 +356,7 @@ public void shouldCreateMultipleItemsAndSkipItemsWithInvalidHoldingsIdentifiers( payloadContext.put(HOLDINGS_IDENTIFIERS, Json.encode(Lists.newArrayList(null, PERMANENT_LOCATION_ID, permanentLocationId2, "fake"))); DataImportEventPayload dataImportEventPayload = new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withJobExecutionId(UUID.randomUUID().toString()) .withContext(payloadContext) .withCurrentNode(profileSnapshotWrapper.getChildSnapshotWrappers().get(0)); @@ -435,7 +435,7 @@ public void shouldCreateMultipleItemsAndPopulatePartialErrorsForFailedItems() payloadContext.put(HOLDINGS_IDENTIFIERS, Json.encode(List.of(PERMANENT_LOCATION_ID, permanentLocationId2))); DataImportEventPayload dataImportEventPayload = new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withJobExecutionId(UUID.randomUUID().toString()) .withContext(payloadContext) .withCurrentNode(profileSnapshotWrapper.getChildSnapshotWrappers().get(0)); @@ -504,7 +504,7 @@ public void shouldPopulateSameHoldingsItForAllItemsIfOnlyOneHoldingExist() payloadContext.put(HOLDINGS_IDENTIFIERS, Json.encode(List.of(PERMANENT_LOCATION_ID))); DataImportEventPayload dataImportEventPayload = new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withJobExecutionId(UUID.randomUUID().toString()) .withContext(payloadContext) .withCurrentNode(profileSnapshotWrapper.getChildSnapshotWrappers().get(0)); @@ -554,7 +554,7 @@ public void shouldCreateItemAndFillInHoldingsRecordIdFromParsedRecordContent() payloadContext.put(ERRORS, Json.encode(new PartialError(null, "testError"))); DataImportEventPayload dataImportEventPayload = new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withJobExecutionId(UUID.randomUUID().toString()) .withContext(payloadContext) .withCurrentNode(profileSnapshotWrapper.getChildSnapshotWrappers().get(0)); @@ -601,7 +601,7 @@ public void shouldCreateItemAndFillInHoldingsRecordIdFromMatchedHolding() payloadContext.put(ERRORS, Json.encode(new PartialError(null, "testError"))); DataImportEventPayload dataImportEventPayload = new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withJobExecutionId(UUID.randomUUID().toString()) .withContext(payloadContext) .withCurrentNode(profileSnapshotWrapper.getChildSnapshotWrappers().get(0)); @@ -671,7 +671,7 @@ public void shouldNotReturnFailedFutureIfInventoryStorageErrorExists() payloadContext.put(HOLDINGS_IDENTIFIERS, Json.encode(List.of(PERMANENT_LOCATION_ID, permanentLocationId2))); DataImportEventPayload dataImportEventPayload = new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withJobExecutionId(UUID.randomUUID().toString()) .withContext(payloadContext) .withCurrentNode(profileSnapshotWrapper.getChildSnapshotWrappers().get(0)); @@ -728,7 +728,7 @@ public void shouldCompleteFutureAndReturnErrorsWhenMappedItemWithoutStatus() payloadContext.put(MULTIPLE_HOLDINGS_FIELD, "945"); DataImportEventPayload dataImportEventPayload = new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withJobExecutionId(UUID.randomUUID().toString()) .withContext(payloadContext) .withCurrentNode(profileSnapshotWrapper.getChildSnapshotWrappers().get(0)); @@ -783,7 +783,7 @@ public void shouldCompleteAndReturnErrorWhenMappedItemWithUnrecognizedStatusName payloadContext.put(MULTIPLE_HOLDINGS_FIELD, "945"); DataImportEventPayload dataImportEventPayload = new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withJobExecutionId(UUID.randomUUID().toString()) .withContext(payloadContext) .withCurrentNode(profileSnapshotWrapper.getChildSnapshotWrappers().get(0)); @@ -847,7 +847,7 @@ public void shouldCompleteAndReturnErrorWhenCreatedItemHasExistingBarcode() payloadContext.put(MULTIPLE_HOLDINGS_FIELD, "945"); DataImportEventPayload dataImportEventPayload = new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withJobExecutionId(UUID.randomUUID().toString()) .withContext(payloadContext) .withCurrentNode(profileSnapshotWrapper.getChildSnapshotWrappers().get(0)); @@ -901,7 +901,7 @@ public void shouldCompleteReturnErrorWhenMappedItemWithoutPermanentLoanType() payloadContext.put(MULTIPLE_HOLDINGS_FIELD, "945"); DataImportEventPayload dataImportEventPayload = new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withJobExecutionId(UUID.randomUUID().toString()) .withContext(payloadContext) .withCurrentNode(profileSnapshotWrapper.getChildSnapshotWrappers().get(0)); @@ -964,7 +964,7 @@ public void shouldReturnFailedFutureIfDuplicatedErrorExists() payloadContext.put(MULTIPLE_HOLDINGS_FIELD, "945"); DataImportEventPayload dataImportEventPayload = new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withJobExecutionId(UUID.randomUUID().toString()) .withContext(payloadContext) .withCurrentNode(profileSnapshotWrapper.getChildSnapshotWrappers().get(0)); @@ -1021,7 +1021,7 @@ public void shouldNotRequestWhenCreatedItemHasEmptyBarcode() ))); DataImportEventPayload dataImportEventPayload = new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withJobExecutionId(UUID.randomUUID().toString()) .withContext(payloadContext) .withCurrentNode(new ProfileSnapshotWrapper() @@ -1050,7 +1050,7 @@ public void shouldReturnFailedFutureWhenHasNoMarcRecord() // given DataImportEventPayload dataImportEventPayload = new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withContext(new HashMap<>()) .withCurrentNode(profileSnapshotWrapper.getChildSnapshotWrappers().get(0)); @@ -1073,7 +1073,7 @@ public void shouldReturnFailedFutureWhenCouldNotFindHoldingsRecordIdInEventPaylo payloadContext.put(HOLDINGS_IDENTIFIERS, Json.encode(List.of(PERMANENT_LOCATION_ID))); DataImportEventPayload dataImportEventPayload = new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withJobExecutionId(UUID.randomUUID().toString()) .withContext(payloadContext) .withCurrentNode(profileSnapshotWrapper.getChildSnapshotWrappers().get(0)); @@ -1109,7 +1109,7 @@ public void shouldReturnFailedFutureWhenCouldNotFindPoLineIdInEventPayload() payloadContext.put(EntityType.PO_LINE.value(), new JsonObject().encode()); DataImportEventPayload dataImportEventPayload = new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withJobExecutionId(UUID.randomUUID().toString()) .withContext(payloadContext) .withCurrentNode(profileSnapshotWrapper.getChildSnapshotWrappers().get(0)); @@ -1137,7 +1137,7 @@ public void shouldFailWhenNoItemsCreated() payloadContext.put(HOLDINGS_IDENTIFIERS, Json.encode(List.of(PERMANENT_LOCATION_ID))); DataImportEventPayload dataImportEventPayload = new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withJobExecutionId(UUID.randomUUID().toString()) .withContext(payloadContext) .withCurrentNode(profileSnapshotWrapper.getChildSnapshotWrappers().get(0)); @@ -1161,7 +1161,7 @@ public void shouldReturnFailedFutureWhenCurrentActionProfileHasNoMappingProfile( payloadContext.put(EntityType.MARC_BIBLIOGRAPHIC.value(), Json.encode(record)); DataImportEventPayload dataImportEventPayload = new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withContext(payloadContext) .withCurrentNode(new ProfileSnapshotWrapper() .withContent(JsonObject.mapFrom(actionProfile).getMap()) @@ -1179,7 +1179,7 @@ public void shouldReturnFailedFutureWhenCurrentActionProfileHasNoMappingProfile( public void shouldReturnTrueWhenHandlerIsEligibleForActionProfile() { // given DataImportEventPayload dataImportEventPayload = new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withCurrentNode(profileSnapshotWrapper.getChildSnapshotWrappers().get(0)); // when @@ -1205,7 +1205,7 @@ public void shouldReturnFalseWhenHandlerIsNotEligibleForActionProfile() { .withContent(actionProfile); DataImportEventPayload dataImportEventPayload = new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withCurrentNode(profileSnapshotWrapper); // when @@ -1227,7 +1227,7 @@ public void shouldNotProcessEventWhenRecordToItemFutureFails() throws ExecutionE payloadContext.put(EntityType.HOLDINGS.value(), holdingAsJson.encode()); DataImportEventPayload dataImportEventPayload = new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withJobExecutionId(UUID.randomUUID().toString()) .withContext(payloadContext) .withCurrentNode(profileSnapshotWrapper.getChildSnapshotWrappers().get(0)); diff --git a/src/test/java/org/folio/inventory/dataimport/handlers/actions/MarcBibModifiedPostProcessingEventHandlerTest.java b/src/test/java/org/folio/inventory/dataimport/handlers/actions/MarcBibModifiedPostProcessingEventHandlerTest.java index f4828bf0f..9d9299caf 100644 --- a/src/test/java/org/folio/inventory/dataimport/handlers/actions/MarcBibModifiedPostProcessingEventHandlerTest.java +++ b/src/test/java/org/folio/inventory/dataimport/handlers/actions/MarcBibModifiedPostProcessingEventHandlerTest.java @@ -46,7 +46,7 @@ import java.util.function.Consumer; import static org.folio.ActionProfile.Action.MODIFY; -import static org.folio.DataImportEventTypes.DI_SRS_MARC_BIB_RECORD_CREATED; +import static org.folio.DataImportEventTypes.DI_INCOMING_MARC_BIB_RECORD_PARSED; import static org.folio.DataImportEventTypes.DI_SRS_MARC_BIB_RECORD_MODIFIED_READY_FOR_POST_PROCESSING; import static org.folio.rest.jaxrs.model.EntityType.INSTANCE; import static org.folio.rest.jaxrs.model.EntityType.MARC_BIBLIOGRAPHIC; @@ -343,7 +343,7 @@ public void shouldReturnFalseWhenHandlerIsNotEligibleForProfile() { .withContent(actionProfile); DataImportEventPayload dataImportEventPayload = new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withCurrentNode(profileSnapshotWrapper); // when diff --git a/src/test/java/org/folio/inventory/dataimport/handlers/actions/UpdateItemEventHandlerTest.java b/src/test/java/org/folio/inventory/dataimport/handlers/actions/UpdateItemEventHandlerTest.java index b5aebbcd4..0b6c4b8a9 100644 --- a/src/test/java/org/folio/inventory/dataimport/handlers/actions/UpdateItemEventHandlerTest.java +++ b/src/test/java/org/folio/inventory/dataimport/handlers/actions/UpdateItemEventHandlerTest.java @@ -69,7 +69,7 @@ import static org.folio.ActionProfile.Action.UPDATE; import static org.folio.DataImportEventTypes.DI_INVENTORY_ITEM_MATCHED; import static org.folio.DataImportEventTypes.DI_INVENTORY_ITEM_UPDATED; -import static org.folio.DataImportEventTypes.DI_SRS_MARC_BIB_RECORD_CREATED; +import static org.folio.DataImportEventTypes.DI_INCOMING_MARC_BIB_RECORD_PARSED; import static org.folio.inventory.dataimport.handlers.actions.UpdateItemEventHandler.ACTION_HAS_NO_MAPPING_MSG; import static org.folio.inventory.dataimport.handlers.actions.UpdateItemEventHandler.CURRENT_RETRY_NUMBER; import static org.folio.inventory.domain.items.Item.HRID_KEY; @@ -1162,7 +1162,7 @@ public void shouldNotRequestWhenUpdatedItemHasEmptyBarcode() ))); DataImportEventPayload dataImportEventPayload = new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withJobExecutionId(UUID.randomUUID().toString()) .withContext(payloadContext) .withCurrentNode(new ProfileSnapshotWrapper() diff --git a/src/test/java/org/folio/inventory/eventhandlers/MatchHoldingEventHandlerUnitTest.java b/src/test/java/org/folio/inventory/eventhandlers/MatchHoldingEventHandlerUnitTest.java index a57483194..aa2f8fab3 100644 --- a/src/test/java/org/folio/inventory/eventhandlers/MatchHoldingEventHandlerUnitTest.java +++ b/src/test/java/org/folio/inventory/eventhandlers/MatchHoldingEventHandlerUnitTest.java @@ -16,7 +16,7 @@ import static org.folio.DataImportEventTypes.DI_INVENTORY_HOLDING_MATCHED; import static org.folio.DataImportEventTypes.DI_INVENTORY_HOLDING_NOT_MATCHED; -import static org.folio.DataImportEventTypes.DI_SRS_MARC_BIB_RECORD_CREATED; +import static org.folio.DataImportEventTypes.DI_INCOMING_MARC_BIB_RECORD_PARSED; import static org.folio.MatchDetail.MatchCriterion.EXACTLY_MATCHES; import static org.folio.inventory.dataimport.handlers.matching.loaders.AbstractLoader.MULTI_MATCH_IDS; import static org.folio.rest.jaxrs.model.EntityType.HOLDINGS; @@ -156,7 +156,7 @@ public void shouldMatchOnHandleEventPayload(TestContext testContext) throws Unsu testContext.assertEquals(1, updatedEventPayload.getEventsChain().size()); testContext.assertEquals( updatedEventPayload.getEventsChain(), - singletonList(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + singletonList(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) ); testContext.assertEquals(DI_INVENTORY_HOLDING_MATCHED.value(), updatedEventPayload.getEventType()); async.complete(); @@ -184,7 +184,7 @@ public void shouldNotMatchOnHandleEventPayload(TestContext testContext) throws U testContext.assertEquals(1, updatedEventPayload.getEventsChain().size()); testContext.assertEquals( updatedEventPayload.getEventsChain(), - singletonList(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + singletonList(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) ); testContext.assertEquals(DI_INVENTORY_HOLDING_NOT_MATCHED.value(), updatedEventPayload.getEventType()); async.complete(); @@ -266,7 +266,7 @@ public void shouldNotMatchOnHandleEventPayloadIfValueIsMissing(TestContext testC testContext.assertEquals(1, updatedEventPayload.getEventsChain().size()); testContext.assertEquals( updatedEventPayload.getEventsChain(), - singletonList(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + singletonList(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) ); testContext.assertEquals(DI_INVENTORY_HOLDING_NOT_MATCHED.value(), updatedEventPayload.getEventType()); async.complete(); @@ -336,7 +336,7 @@ public void shouldMatchWithSubMatchByHoldingOnHandleEventPayload(TestContext tes testContext.assertEquals(1, updatedEventPayload.getEventsChain().size()); testContext.assertEquals( updatedEventPayload.getEventsChain(), - singletonList(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + singletonList(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) ); testContext.assertEquals(DI_INVENTORY_HOLDING_MATCHED.value(), updatedEventPayload.getEventType()); async.complete(); @@ -368,7 +368,7 @@ public void shouldMatchWithSubMatchByInstanceOnHandleEventPayload(TestContext te testContext.assertEquals(1, updatedEventPayload.getEventsChain().size()); testContext.assertEquals( updatedEventPayload.getEventsChain(), - singletonList(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + singletonList(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) ); testContext.assertEquals(DI_INVENTORY_HOLDING_MATCHED.value(), updatedEventPayload.getEventType()); async.complete(); @@ -401,7 +401,7 @@ public void shouldMatchWithSubConditionBasedOnMultiMatchResultOnHandleEventPaylo eventHandler.handle(eventPayload).whenComplete((processedPayload, throwable) -> { testContext.assertNull(throwable); testContext.assertEquals(1, processedPayload.getEventsChain().size()); - testContext.assertEquals(processedPayload.getEventsChain(), singletonList(DI_SRS_MARC_BIB_RECORD_CREATED.value())); + testContext.assertEquals(processedPayload.getEventsChain(), singletonList(DI_INCOMING_MARC_BIB_RECORD_PARSED.value())); testContext.assertEquals(DI_INVENTORY_HOLDING_MATCHED.value(), processedPayload.getEventType()); testContext.assertEquals( Json.decodeValue(new JsonArray(processedPayload.getContext().get(HOLDINGS.value())).getJsonObject(0).encode(), HoldingsRecord.class).getId(), @@ -447,7 +447,7 @@ public void shouldPutMultipleMatchResultToPayloadOnHandleEventPayload(TestContex private DataImportEventPayload createEventPayload() { return new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withJobExecutionId(UUID.randomUUID().toString()) .withEventsChain(new ArrayList<>()) .withOkapiUrl("http://localhost:9493") diff --git a/src/test/java/org/folio/inventory/eventhandlers/MatchInstanceEventHandlerUnitTest.java b/src/test/java/org/folio/inventory/eventhandlers/MatchInstanceEventHandlerUnitTest.java index 1369a566a..63c811989 100644 --- a/src/test/java/org/folio/inventory/eventhandlers/MatchInstanceEventHandlerUnitTest.java +++ b/src/test/java/org/folio/inventory/eventhandlers/MatchInstanceEventHandlerUnitTest.java @@ -17,7 +17,7 @@ import static org.folio.DataImportEventTypes.DI_INVENTORY_INSTANCE_MATCHED; import static org.folio.DataImportEventTypes.DI_INVENTORY_INSTANCE_NOT_MATCHED; -import static org.folio.DataImportEventTypes.DI_SRS_MARC_BIB_RECORD_CREATED; +import static org.folio.DataImportEventTypes.DI_INCOMING_MARC_BIB_RECORD_PARSED; import static org.folio.MatchDetail.MatchCriterion.EXACTLY_MATCHES; import static org.folio.inventory.dataimport.handlers.matching.loaders.AbstractLoader.MULTI_MATCH_IDS; import static org.folio.rest.jaxrs.model.EntityType.INSTANCE; @@ -158,7 +158,7 @@ public void shouldMatchOnHandleEventPayload(TestContext testContext) throws Unsu testContext.assertEquals(1, updatedEventPayload.getEventsChain().size()); testContext.assertEquals( updatedEventPayload.getEventsChain(), - singletonList(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + singletonList(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) ); testContext.assertEquals(DI_INVENTORY_INSTANCE_MATCHED.value(), updatedEventPayload.getEventType()); async.complete(); @@ -248,7 +248,7 @@ public void shouldNotThrowMultiMatchExceptionIfMatchedShadowInstanceLocallyAndSh testContext.assertEquals(1, updatedEventPayload.getEventsChain().size()); testContext.assertEquals( updatedEventPayload.getEventsChain(), - singletonList(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + singletonList(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) ); testContext.assertEquals(DI_INVENTORY_INSTANCE_MATCHED.value(), updatedEventPayload.getEventType()); JsonObject matchedInstanceAsJsonObject = new JsonObject(updatedEventPayload.getContext().get(INSTANCE.value())); @@ -296,7 +296,7 @@ public void shouldMatchOnLocalAndNotMatchCentralTenant(TestContext testContext) testContext.assertEquals(1, updatedEventPayload.getEventsChain().size()); testContext.assertEquals( updatedEventPayload.getEventsChain(), - singletonList(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + singletonList(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) ); testContext.assertEquals(DI_INVENTORY_INSTANCE_MATCHED.value(), updatedEventPayload.getEventType()); JsonObject matchedInstanceAsJsonObject = new JsonObject(updatedEventPayload.getContext().get(INSTANCE.value())); @@ -345,7 +345,7 @@ public void shouldNotMatchOnLocalAndMatchOnCentralTenant(TestContext testContext testContext.assertEquals(1, updatedEventPayload.getEventsChain().size()); testContext.assertEquals( updatedEventPayload.getEventsChain(), - singletonList(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + singletonList(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) ); testContext.assertEquals(DI_INVENTORY_INSTANCE_MATCHED.value(), updatedEventPayload.getEventType()); JsonObject matchedInstanceAsJsonObject = new JsonObject(updatedEventPayload.getContext().get(INSTANCE.value())); @@ -375,7 +375,7 @@ public void shouldNotMatchOnHandleEventPayload(TestContext testContext) throws U testContext.assertEquals(1, updatedEventPayload.getEventsChain().size()); testContext.assertEquals( updatedEventPayload.getEventsChain(), - singletonList(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + singletonList(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) ); testContext.assertEquals(DI_INVENTORY_INSTANCE_NOT_MATCHED.value(), updatedEventPayload.getEventType()); async.complete(); @@ -453,7 +453,7 @@ public void shouldNotMatchOnHandleEventPayloadIfValueIsMissing(TestContext testC testContext.assertEquals(1, updatedEventPayload.getEventsChain().size()); testContext.assertEquals( updatedEventPayload.getEventsChain(), - singletonList(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + singletonList(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) ); testContext.assertEquals(DI_INVENTORY_INSTANCE_NOT_MATCHED.value(), updatedEventPayload.getEventType()); async.complete(); @@ -533,7 +533,7 @@ public void shouldMatchWithSubMatchByInstanceOnHandleEventPayload(TestContext te testContext.assertEquals(1, updatedEventPayload.getEventsChain().size()); testContext.assertEquals( updatedEventPayload.getEventsChain(), - singletonList(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + singletonList(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) ); testContext.assertEquals(DI_INVENTORY_INSTANCE_MATCHED.value(), updatedEventPayload.getEventType()); async.complete(); @@ -569,7 +569,7 @@ public void shouldMatchWithSubConditionBasedOnMultiMatchResultOnHandleEventPaylo testContext.assertEquals(1, processedPayload.getEventsChain().size()); testContext.assertEquals( processedPayload.getEventsChain(), - singletonList(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + singletonList(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) ); testContext.assertEquals(DI_INVENTORY_INSTANCE_MATCHED.value(), processedPayload.getEventType()); testContext.assertEquals(new JsonObject(processedPayload.getContext().get(INSTANCE.value())).getString("id"), expectedInstance.getId()); @@ -652,7 +652,7 @@ public void shouldReturnFailedFutureWhenFirstChildProfileIsNotMatchProfileOnHand private DataImportEventPayload createEventPayload() { return new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withJobExecutionId(UUID.randomUUID().toString()) .withEventsChain(new ArrayList<>()) .withOkapiUrl("http://localhost:9493") diff --git a/src/test/java/org/folio/inventory/eventhandlers/MatchItemEventHandlerUnitTest.java b/src/test/java/org/folio/inventory/eventhandlers/MatchItemEventHandlerUnitTest.java index d91b63b85..77e068e37 100644 --- a/src/test/java/org/folio/inventory/eventhandlers/MatchItemEventHandlerUnitTest.java +++ b/src/test/java/org/folio/inventory/eventhandlers/MatchItemEventHandlerUnitTest.java @@ -17,7 +17,7 @@ import static org.folio.DataImportEventTypes.DI_INVENTORY_ITEM_MATCHED; import static org.folio.DataImportEventTypes.DI_INVENTORY_ITEM_NOT_MATCHED; -import static org.folio.DataImportEventTypes.DI_SRS_MARC_BIB_RECORD_CREATED; +import static org.folio.DataImportEventTypes.DI_INCOMING_MARC_BIB_RECORD_PARSED; import static org.folio.MatchDetail.MatchCriterion.EXACTLY_MATCHES; import static org.folio.inventory.dataimport.handlers.matching.loaders.AbstractLoader.MULTI_MATCH_IDS; import static org.folio.rest.jaxrs.model.EntityType.ITEM; @@ -152,7 +152,7 @@ public void shouldMatchOnHandleEventPayload(TestContext testContext) throws Unsu testContext.assertEquals(1, updatedEventPayload.getEventsChain().size()); testContext.assertEquals( updatedEventPayload.getEventsChain(), - singletonList(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + singletonList(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) ); testContext.assertEquals(DI_INVENTORY_ITEM_MATCHED.value(), updatedEventPayload.getEventType()); async.complete(); @@ -180,7 +180,7 @@ public void shouldNotMatchOnHandleEventPayload(TestContext testContext) throws U testContext.assertEquals(1, updatedEventPayload.getEventsChain().size()); testContext.assertEquals( updatedEventPayload.getEventsChain(), - singletonList(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + singletonList(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) ); testContext.assertEquals(DI_INVENTORY_ITEM_NOT_MATCHED.value(), updatedEventPayload.getEventType()); async.complete(); @@ -262,7 +262,7 @@ public void shouldNotMatchOnHandleEventPayloadIfValueIsMissing(TestContext testC testContext.assertEquals(1, updatedEventPayload.getEventsChain().size()); testContext.assertEquals( updatedEventPayload.getEventsChain(), - singletonList(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + singletonList(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) ); testContext.assertEquals(DI_INVENTORY_ITEM_NOT_MATCHED.value(), updatedEventPayload.getEventType()); async.complete(); @@ -333,7 +333,7 @@ public void shouldMatchWithSubMatchByItemOnHandleEventPayload(TestContext testCo testContext.assertEquals(1, updatedEventPayload.getEventsChain().size()); testContext.assertEquals( updatedEventPayload.getEventsChain(), - singletonList(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + singletonList(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) ); testContext.assertEquals(DI_INVENTORY_ITEM_MATCHED.value(), updatedEventPayload.getEventType()); async.complete(); @@ -366,7 +366,7 @@ public void shouldMatchWithSubMatchByHoldingOnHandleEventPayload(TestContext tes testContext.assertEquals(1, updatedEventPayload.getEventsChain().size()); testContext.assertEquals( updatedEventPayload.getEventsChain(), - singletonList(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + singletonList(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) ); testContext.assertEquals(DI_INVENTORY_ITEM_MATCHED.value(), updatedEventPayload.getEventType()); async.complete(); @@ -401,7 +401,7 @@ public void shouldMatchWithSubConditionBasedOnMultiMatchResultOnHandleEventPaylo testContext.assertEquals(1, processedPayload.getEventsChain().size()); testContext.assertEquals( processedPayload.getEventsChain(), - singletonList(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + singletonList(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) ); testContext.assertEquals(DI_INVENTORY_ITEM_MATCHED.value(), processedPayload.getEventType()); testContext.assertEquals( @@ -452,7 +452,7 @@ public void shouldPutMultipleMatchResultToPayloadOnHandleEventPayload(TestContex private DataImportEventPayload createEventPayload() { return new DataImportEventPayload() - .withEventType(DI_SRS_MARC_BIB_RECORD_CREATED.value()) + .withEventType(DI_INCOMING_MARC_BIB_RECORD_PARSED.value()) .withJobExecutionId(UUID.randomUUID().toString()) .withEventsChain(new ArrayList<>()) .withOkapiUrl("http://localhost:9493")