From 7e2997b9ef50541ffe8bcdb4483343a1db13f84b Mon Sep 17 00:00:00 2001 From: Volodymyr_Rohach Date: Tue, 14 May 2024 12:48:23 +0300 Subject: [PATCH 1/5] MODINV-1023: Fix mod-inventory OOM issue --- NEWS.md | 1 + .../org/folio/inventory/DataImportConsumerVerticle.java | 3 +-- .../folio/inventory/MarcBibUpdateConsumerVerticle.java | 2 +- .../org/folio/inventory/MarcHridSetConsumerVerticle.java | 2 +- .../inventory/dataimport/cache/MappingMetadataCache.java | 9 ++++++++- .../dataimport/cache/MappingMetadataCacheTest.java | 3 ++- .../dataimport/consumers/DataImportKafkaHandlerTest.java | 3 ++- .../MarcHoldingsRecordHridSetKafkaHandlerTest.java | 2 +- .../actions/CreateAuthorityEventHandlerTest.java | 2 +- .../handlers/actions/CreateInstanceEventHandlerTest.java | 2 +- .../actions/CreateMarcHoldingsEventHandlerTest.java | 2 +- .../actions/ReplaceInstanceEventHandlerTest.java | 2 +- .../actions/UpdateAuthorityEventHandlerTest.java | 2 +- .../actions/UpdateMarcHoldingsEventHandlerTest.java | 2 +- 14 files changed, 23 insertions(+), 14 deletions(-) diff --git a/NEWS.md b/NEWS.md index cedfdce1e..2201e691c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,7 @@ * The result table is not displayed in the file details log [MODINV-1003](https://folio-org.atlassian.net/browse/MODINV-1003) * Invalid values (as it is) created in JSON when value is not matching accepted options provided in Instance field mapping for Nature of Content term [MODINV-1012](https://folio-org.atlassian.net/browse/MODINV-1012) * Remove null values from electronicAccess object before returning item and instance [MODINV-1006](https://folio-org.atlassian.net/browse/MODINV-1006) +* Fix mod-inventory OOM issue [MODINV-1023](https://folio-org.atlassian.net/browse/MODINV-1023) ## 20.2.0 2023-03-20 * Inventory cannot process Holdings with virtual fields ([MODINV-941](https://issues.folio.org/browse/MODINV-941)) diff --git a/src/main/java/org/folio/inventory/DataImportConsumerVerticle.java b/src/main/java/org/folio/inventory/DataImportConsumerVerticle.java index ecb65db09..3883d3147 100644 --- a/src/main/java/org/folio/inventory/DataImportConsumerVerticle.java +++ b/src/main/java/org/folio/inventory/DataImportConsumerVerticle.java @@ -122,9 +122,8 @@ public void start(Promise startPromise) { String mappingMetadataExpirationTime = getCacheEnvVariable(config, "inventory.mapping-metadata-cache.expiration.time.seconds"); ProfileSnapshotCache profileSnapshotCache = new ProfileSnapshotCache(vertx, client, Long.parseLong(profileSnapshotExpirationTime)); - MappingMetadataCache mappingMetadataCache = new MappingMetadataCache(vertx, client, Long.parseLong(mappingMetadataExpirationTime)); ConsortiumDataCache consortiumDataCache = new ConsortiumDataCache(vertx, client); - + MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, client, Long.parseLong(mappingMetadataExpirationTime)); DataImportKafkaHandler dataImportKafkaHandler = new DataImportKafkaHandler( vertx, storage, client, profileSnapshotCache, kafkaConfig, mappingMetadataCache, consortiumDataCache); diff --git a/src/main/java/org/folio/inventory/MarcBibUpdateConsumerVerticle.java b/src/main/java/org/folio/inventory/MarcBibUpdateConsumerVerticle.java index 44aa43ad3..599977000 100644 --- a/src/main/java/org/folio/inventory/MarcBibUpdateConsumerVerticle.java +++ b/src/main/java/org/folio/inventory/MarcBibUpdateConsumerVerticle.java @@ -41,7 +41,7 @@ public void start(Promise startPromise) { InstanceUpdateDelegate instanceUpdateDelegate = new InstanceUpdateDelegate(storage); var mappingMetadataExpirationTime = getCacheEnvVariable(config, METADATA_EXPIRATION_TIME); - MappingMetadataCache mappingMetadataCache = new MappingMetadataCache(vertx, client, Long.parseLong(mappingMetadataExpirationTime)); + MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, client, Long.parseLong(mappingMetadataExpirationTime)); MarcBibUpdateKafkaHandler marcBibUpdateKafkaHandler = new MarcBibUpdateKafkaHandler(vertx, getMaxDistributionNumber(), kafkaConfig, instanceUpdateDelegate, mappingMetadataCache); diff --git a/src/main/java/org/folio/inventory/MarcHridSetConsumerVerticle.java b/src/main/java/org/folio/inventory/MarcHridSetConsumerVerticle.java index 1bbaeea06..c6cb9eb9a 100644 --- a/src/main/java/org/folio/inventory/MarcHridSetConsumerVerticle.java +++ b/src/main/java/org/folio/inventory/MarcHridSetConsumerVerticle.java @@ -64,7 +64,7 @@ public void start(Promise startPromise) { HoldingsUpdateDelegate holdingsRecordUpdateDelegate = new HoldingsUpdateDelegate(storage, holdingsCollectionService); String mappingMetadataExpirationTime = getCacheEnvVariable(config, "inventory.mapping-metadata-cache.expiration.time.seconds"); - MappingMetadataCache mappingMetadataCache = new MappingMetadataCache(vertx, client, Long.parseLong(mappingMetadataExpirationTime)); + MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, client, Long.parseLong(mappingMetadataExpirationTime)); MarcBibInstanceHridSetKafkaHandler marcBibInstanceHridSetKafkaHandler = new MarcBibInstanceHridSetKafkaHandler(instanceUpdateDelegate, mappingMetadataCache); MarcHoldingsRecordHridSetKafkaHandler marcHoldingsRecordHridSetKafkaHandler = new MarcHoldingsRecordHridSetKafkaHandler(holdingsRecordUpdateDelegate, mappingMetadataCache); diff --git a/src/main/java/org/folio/inventory/dataimport/cache/MappingMetadataCache.java b/src/main/java/org/folio/inventory/dataimport/cache/MappingMetadataCache.java index fe910b31e..685097824 100644 --- a/src/main/java/org/folio/inventory/dataimport/cache/MappingMetadataCache.java +++ b/src/main/java/org/folio/inventory/dataimport/cache/MappingMetadataCache.java @@ -29,7 +29,7 @@ public class MappingMetadataCache { private static final Logger LOGGER = LogManager.getLogger(); - + private static MappingMetadataCache instance = null; private final AsyncCache> cache; private final HttpClient httpClient; @@ -107,4 +107,11 @@ private CompletableFuture> loadMappingMetadata(Stri }); } + public static synchronized MappingMetadataCache getInstance(Vertx vertx, HttpClient httpClient, long cacheExpirationTime) { + if (instance == null) { + instance = new MappingMetadataCache(vertx, httpClient, cacheExpirationTime); + } + return instance; + } + } diff --git a/src/test/java/org/folio/inventory/dataimport/cache/MappingMetadataCacheTest.java b/src/test/java/org/folio/inventory/dataimport/cache/MappingMetadataCacheTest.java index 6ca70cd8b..2eab94a1e 100644 --- a/src/test/java/org/folio/inventory/dataimport/cache/MappingMetadataCacheTest.java +++ b/src/test/java/org/folio/inventory/dataimport/cache/MappingMetadataCacheTest.java @@ -35,7 +35,8 @@ public class MappingMetadataCacheTest { private static final String MARC_BIB_RECORD_TYPE = "marc-bib"; private final Vertx vertx = Vertx.vertx(); - private final MappingMetadataCache mappingMetadataCache = new MappingMetadataCache(vertx, + + private final MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, vertx.createHttpClient(), 3600); @Rule 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 f13e116d3..1e37ce9df 100644 --- a/src/test/java/org/folio/inventory/dataimport/consumers/DataImportKafkaHandlerTest.java +++ b/src/test/java/org/folio/inventory/dataimport/consumers/DataImportKafkaHandlerTest.java @@ -153,7 +153,8 @@ public void setUp() { HttpClient client = vertx.createHttpClient(); dataImportKafkaHandler = new DataImportKafkaHandler(vertx, mockedStorage, client, new ProfileSnapshotCache(vertx, client, 3600), - kafkaConfig, new MappingMetadataCache(vertx, client, 3600), + kafkaConfig, + MappingMetadataCache.getInstance(vertx, client, 3600), new ConsortiumDataCache(vertx, client)); EventManager.clearEventHandlers(); diff --git a/src/test/java/org/folio/inventory/dataimport/consumers/MarcHoldingsRecordHridSetKafkaHandlerTest.java b/src/test/java/org/folio/inventory/dataimport/consumers/MarcHoldingsRecordHridSetKafkaHandlerTest.java index 5163b1d27..5e6f42463 100644 --- a/src/test/java/org/folio/inventory/dataimport/consumers/MarcHoldingsRecordHridSetKafkaHandlerTest.java +++ b/src/test/java/org/folio/inventory/dataimport/consumers/MarcHoldingsRecordHridSetKafkaHandlerTest.java @@ -129,7 +129,7 @@ record = Json.decodeValue(TestUtil.readFileFromPath(RECORD_PATH), Record.class); .withMappingParams(Json.encode(mappingParameters)) .withMappingRules(mappingRules.encode()))))); - MappingMetadataCache mappingMetadataCache = new MappingMetadataCache(vertx, vertx.createHttpClient(), 3600); + MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, vertx.createHttpClient(), 3600); marcHoldingsRecordHridSetKafkaHandler = new MarcHoldingsRecordHridSetKafkaHandler(new HoldingsUpdateDelegate(mockedStorage, holdingsCollectionService), mappingMetadataCache); diff --git a/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateAuthorityEventHandlerTest.java b/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateAuthorityEventHandlerTest.java index 2c133487e..e00e050c0 100644 --- a/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateAuthorityEventHandlerTest.java +++ b/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateAuthorityEventHandlerTest.java @@ -144,7 +144,7 @@ public class CreateAuthorityEventHandlerTest { public void setUp() throws IOException { MockitoAnnotations.openMocks(this); MappingManager.clearReaderFactories(); - MappingMetadataCache mappingMetadataCache = new MappingMetadataCache(vertx, vertx.createHttpClient(), 3600); + MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, vertx.createHttpClient(), 3600); createMarcAuthoritiesEventHandler = new CreateAuthorityEventHandler(storage, mappingMetadataCache, authorityIdStorageService); JsonObject mappingRules = new JsonObject(TestUtil.readFileFromPath(MAPPING_RULES_PATH)); 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 d5ed8bc7e..a3c41db16 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 @@ -228,7 +228,7 @@ public void setUp() throws IOException { Vertx vertx = Vertx.vertx(); HttpClient httpClient = vertx.createHttpClient(); createInstanceEventHandler = spy(new CreateInstanceEventHandler(storage, - new PrecedingSucceedingTitlesHelper(context -> mockedClient), new MappingMetadataCache(vertx, + new PrecedingSucceedingTitlesHelper(context -> mockedClient), MappingMetadataCache.getInstance(vertx, httpClient, 3600), instanceIdStorageService, orderHelperService, httpClient)); doReturn(sourceStorageClient).when(createInstanceEventHandler).getSourceStorageRecordsClient(any(), any()); diff --git a/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateMarcHoldingsEventHandlerTest.java b/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateMarcHoldingsEventHandlerTest.java index 4c10769f4..3bac903e9 100644 --- a/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateMarcHoldingsEventHandlerTest.java +++ b/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateMarcHoldingsEventHandlerTest.java @@ -155,7 +155,7 @@ public class CreateMarcHoldingsEventHandlerTest { public void setUp() throws IOException { MockitoAnnotations.openMocks(this); MappingManager.clearReaderFactories(); - MappingMetadataCache mappingMetadataCache = new MappingMetadataCache(vertx, vertx.createHttpClient(), 3600); + MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, vertx.createHttpClient(), 3600); createMarcHoldingsEventHandler = new CreateMarcHoldingsEventHandler(storage, mappingMetadataCache, holdingsIdStorageService, holdingsCollectionService); mappingRules = new JsonObject(TestUtil.readFileFromPath(MAPPING_RULES_PATH)); instanceId = String.valueOf(UUID.randomUUID()); diff --git a/src/test/java/org/folio/inventory/dataimport/handlers/actions/ReplaceInstanceEventHandlerTest.java b/src/test/java/org/folio/inventory/dataimport/handlers/actions/ReplaceInstanceEventHandlerTest.java index d36460f71..17a202422 100644 --- a/src/test/java/org/folio/inventory/dataimport/handlers/actions/ReplaceInstanceEventHandlerTest.java +++ b/src/test/java/org/folio/inventory/dataimport/handlers/actions/ReplaceInstanceEventHandlerTest.java @@ -255,7 +255,7 @@ public void setUp() throws IOException { precedingSucceedingTitlesHelper = spy(new PrecedingSucceedingTitlesHelper(ctxt -> mockedClient)); Vertx vertx = Vertx.vertx(); - replaceInstanceEventHandler = spy(new ReplaceInstanceEventHandler(storage, precedingSucceedingTitlesHelper, new MappingMetadataCache(vertx, + replaceInstanceEventHandler = spy(new ReplaceInstanceEventHandler(storage, precedingSucceedingTitlesHelper, MappingMetadataCache.getInstance(vertx, vertx.createHttpClient(), 3600), vertx.createHttpClient(), consortiumServiceImpl)); var recordUUID = UUID.randomUUID().toString(); diff --git a/src/test/java/org/folio/inventory/dataimport/handlers/actions/UpdateAuthorityEventHandlerTest.java b/src/test/java/org/folio/inventory/dataimport/handlers/actions/UpdateAuthorityEventHandlerTest.java index 8a32d72c2..3b441b589 100644 --- a/src/test/java/org/folio/inventory/dataimport/handlers/actions/UpdateAuthorityEventHandlerTest.java +++ b/src/test/java/org/folio/inventory/dataimport/handlers/actions/UpdateAuthorityEventHandlerTest.java @@ -116,7 +116,7 @@ public class UpdateAuthorityEventHandlerTest { public void setUp() throws IOException { MockitoAnnotations.openMocks(this); MappingManager.clearReaderFactories(); - MappingMetadataCache mappingMetadataCache = new MappingMetadataCache(vertx, vertx.createHttpClient(), 3600); + MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, vertx.createHttpClient(), 3600); eventHandler = new UpdateAuthorityEventHandler(storage, mappingMetadataCache, publisher); JsonObject mappingRules = new JsonObject(TestUtil.readFileFromPath(MAPPING_RULES_PATH)); diff --git a/src/test/java/org/folio/inventory/dataimport/handlers/actions/UpdateMarcHoldingsEventHandlerTest.java b/src/test/java/org/folio/inventory/dataimport/handlers/actions/UpdateMarcHoldingsEventHandlerTest.java index b3f806bec..a1d506523 100644 --- a/src/test/java/org/folio/inventory/dataimport/handlers/actions/UpdateMarcHoldingsEventHandlerTest.java +++ b/src/test/java/org/folio/inventory/dataimport/handlers/actions/UpdateMarcHoldingsEventHandlerTest.java @@ -138,7 +138,7 @@ public class UpdateMarcHoldingsEventHandlerTest { public void setUp() throws IOException { MockitoAnnotations.openMocks(this); MappingManager.clearReaderFactories(); - MappingMetadataCache mappingMetadataCache = new MappingMetadataCache(vertx, vertx.createHttpClient(), 3600); + MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, vertx.createHttpClient(), 3600); eventHandler = new UpdateMarcHoldingsEventHandler(storage, mappingMetadataCache, publisher); mappingRules = new JsonObject(TestUtil.readFileFromPath(MAPPING_RULES_PATH)); From ebacac792f3836436c812ad90e70f8c1b29edc44 Mon Sep 17 00:00:00 2001 From: Volodymyr_Rohach Date: Wed, 22 May 2024 17:04:54 +0300 Subject: [PATCH 2/5] MODINV-1023: Refactoring based on comments. --- .../inventory/DataImportConsumerVerticle.java | 3 +-- .../inventory/MarcBibUpdateConsumerVerticle.java | 11 +---------- .../inventory/MarcHridSetConsumerVerticle.java | 11 +---------- .../dataimport/cache/MappingMetadataCache.java | 15 +++++++++++++-- 4 files changed, 16 insertions(+), 24 deletions(-) diff --git a/src/main/java/org/folio/inventory/DataImportConsumerVerticle.java b/src/main/java/org/folio/inventory/DataImportConsumerVerticle.java index 3883d3147..ee781424e 100644 --- a/src/main/java/org/folio/inventory/DataImportConsumerVerticle.java +++ b/src/main/java/org/folio/inventory/DataImportConsumerVerticle.java @@ -119,11 +119,10 @@ public void start(Promise startPromise) { Storage storage = Storage.basedUpon(config, client); String profileSnapshotExpirationTime = getCacheEnvVariable(config, "inventory.profile-snapshot-cache.expiration.time.seconds"); - String mappingMetadataExpirationTime = getCacheEnvVariable(config, "inventory.mapping-metadata-cache.expiration.time.seconds"); ProfileSnapshotCache profileSnapshotCache = new ProfileSnapshotCache(vertx, client, Long.parseLong(profileSnapshotExpirationTime)); ConsortiumDataCache consortiumDataCache = new ConsortiumDataCache(vertx, client); - MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, client, Long.parseLong(mappingMetadataExpirationTime)); + MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, client, config); DataImportKafkaHandler dataImportKafkaHandler = new DataImportKafkaHandler( vertx, storage, client, profileSnapshotCache, kafkaConfig, mappingMetadataCache, consortiumDataCache); diff --git a/src/main/java/org/folio/inventory/MarcBibUpdateConsumerVerticle.java b/src/main/java/org/folio/inventory/MarcBibUpdateConsumerVerticle.java index 599977000..6737e8500 100644 --- a/src/main/java/org/folio/inventory/MarcBibUpdateConsumerVerticle.java +++ b/src/main/java/org/folio/inventory/MarcBibUpdateConsumerVerticle.java @@ -40,8 +40,7 @@ public void start(Promise startPromise) { Storage storage = Storage.basedUpon(config, client); InstanceUpdateDelegate instanceUpdateDelegate = new InstanceUpdateDelegate(storage); - var mappingMetadataExpirationTime = getCacheEnvVariable(config, METADATA_EXPIRATION_TIME); - MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, client, Long.parseLong(mappingMetadataExpirationTime)); + MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, client, config); MarcBibUpdateKafkaHandler marcBibUpdateKafkaHandler = new MarcBibUpdateKafkaHandler(vertx, getMaxDistributionNumber(), kafkaConfig, instanceUpdateDelegate, mappingMetadataCache); @@ -95,14 +94,6 @@ private KafkaConfig getKafkaConfig(JsonObject config) { return kafkaConfig; } - private String getCacheEnvVariable(JsonObject config, String variableName) { - String cacheExpirationTime = config.getString(variableName); - if (StringUtils.isBlank(cacheExpirationTime)) { - cacheExpirationTime = "3600"; - } - return cacheExpirationTime; - } - public static String formatSubscriptionPattern(String env, String eventType) { return String.join("\\.", env, "\\w{1,}", eventType); } diff --git a/src/main/java/org/folio/inventory/MarcHridSetConsumerVerticle.java b/src/main/java/org/folio/inventory/MarcHridSetConsumerVerticle.java index c6cb9eb9a..dd3242915 100644 --- a/src/main/java/org/folio/inventory/MarcHridSetConsumerVerticle.java +++ b/src/main/java/org/folio/inventory/MarcHridSetConsumerVerticle.java @@ -63,8 +63,7 @@ public void start(Promise startPromise) { InstanceUpdateDelegate instanceUpdateDelegate = new InstanceUpdateDelegate(storage); HoldingsUpdateDelegate holdingsRecordUpdateDelegate = new HoldingsUpdateDelegate(storage, holdingsCollectionService); - String mappingMetadataExpirationTime = getCacheEnvVariable(config, "inventory.mapping-metadata-cache.expiration.time.seconds"); - MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, client, Long.parseLong(mappingMetadataExpirationTime)); + MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, client, config); MarcBibInstanceHridSetKafkaHandler marcBibInstanceHridSetKafkaHandler = new MarcBibInstanceHridSetKafkaHandler(instanceUpdateDelegate, mappingMetadataCache); MarcHoldingsRecordHridSetKafkaHandler marcHoldingsRecordHridSetKafkaHandler = new MarcHoldingsRecordHridSetKafkaHandler(holdingsRecordUpdateDelegate, mappingMetadataCache); @@ -101,12 +100,4 @@ private KafkaConsumerWrapper createConsumerByEvent(KafkaConfig k .subscriptionDefinition(subscriptionDefinition) .build(); } - - private String getCacheEnvVariable(JsonObject config, String variableName) { - String cacheExpirationTime = config.getString(variableName); - if (StringUtils.isBlank(cacheExpirationTime)) { - cacheExpirationTime = "3600"; - } - return cacheExpirationTime; - } } diff --git a/src/main/java/org/folio/inventory/dataimport/cache/MappingMetadataCache.java b/src/main/java/org/folio/inventory/dataimport/cache/MappingMetadataCache.java index 685097824..9c81daa9c 100644 --- a/src/main/java/org/folio/inventory/dataimport/cache/MappingMetadataCache.java +++ b/src/main/java/org/folio/inventory/dataimport/cache/MappingMetadataCache.java @@ -6,8 +6,10 @@ import java.util.concurrent.TimeUnit; import io.vertx.core.json.Json; +import io.vertx.core.json.JsonObject; import io.vertx.ext.web.client.WebClient; import lombok.SneakyThrows; +import org.apache.commons.lang.StringUtils; import org.apache.http.HttpStatus; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -32,6 +34,8 @@ public class MappingMetadataCache { private static MappingMetadataCache instance = null; private final AsyncCache> cache; private final HttpClient httpClient; + private static final String METADATA_EXPIRATION_TIME = "inventory.mapping-metadata-cache.expiration.time.seconds"; + public MappingMetadataCache(Vertx vertx, HttpClient httpClient, long cacheExpirationTime) { this.httpClient = httpClient; @@ -107,11 +111,18 @@ private CompletableFuture> loadMappingMetadata(Stri }); } - public static synchronized MappingMetadataCache getInstance(Vertx vertx, HttpClient httpClient, long cacheExpirationTime) { + public static synchronized MappingMetadataCache getInstance(Vertx vertx, HttpClient httpClient, JsonObject config) { if (instance == null) { - instance = new MappingMetadataCache(vertx, httpClient, cacheExpirationTime); + instance = new MappingMetadataCache(vertx, httpClient, Long.parseLong(getCacheEnvVariable(config, METADATA_EXPIRATION_TIME))); } return instance; } + private static String getCacheEnvVariable(JsonObject config, String variableName) { + String cacheExpirationTime = config.getString(variableName); + if (StringUtils.isBlank(cacheExpirationTime)) { + cacheExpirationTime = "3600"; + } + return cacheExpirationTime; + } } From 805ef4c44fc9982ff44869d2e4da4fc0daad7564 Mon Sep 17 00:00:00 2001 From: Volodymyr_Rohach Date: Wed, 22 May 2024 17:14:41 +0300 Subject: [PATCH 3/5] MODINV-1023: Tests fixing. --- .../inventory/dataimport/cache/MappingMetadataCacheTest.java | 3 ++- .../dataimport/consumers/DataImportKafkaHandlerTest.java | 2 +- .../consumers/MarcHoldingsRecordHridSetKafkaHandlerTest.java | 2 +- .../handlers/actions/CreateInstanceEventHandlerTest.java | 2 +- .../handlers/actions/CreateMarcHoldingsEventHandlerTest.java | 2 +- .../handlers/actions/ReplaceInstanceEventHandlerTest.java | 2 +- .../handlers/actions/UpdateAuthorityEventHandlerTest.java | 2 +- .../handlers/actions/UpdateMarcHoldingsEventHandlerTest.java | 2 +- 8 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/test/java/org/folio/inventory/dataimport/cache/MappingMetadataCacheTest.java b/src/test/java/org/folio/inventory/dataimport/cache/MappingMetadataCacheTest.java index 2eab94a1e..c84634d19 100644 --- a/src/test/java/org/folio/inventory/dataimport/cache/MappingMetadataCacheTest.java +++ b/src/test/java/org/folio/inventory/dataimport/cache/MappingMetadataCacheTest.java @@ -5,6 +5,7 @@ import java.util.Optional; import java.util.UUID; +import io.vertx.core.json.JsonObject; import org.folio.inventory.common.Context; import org.folio.inventory.dataimport.handlers.matching.util.EventHandlingUtil; import org.folio.MappingMetadataDto; @@ -37,7 +38,7 @@ public class MappingMetadataCacheTest { private final Vertx vertx = Vertx.vertx(); private final MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, - vertx.createHttpClient(), 3600); + vertx.createHttpClient(), new JsonObject()); @Rule public WireMockRule mockServer = new WireMockRule( 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 1e37ce9df..1849b11cb 100644 --- a/src/test/java/org/folio/inventory/dataimport/consumers/DataImportKafkaHandlerTest.java +++ b/src/test/java/org/folio/inventory/dataimport/consumers/DataImportKafkaHandlerTest.java @@ -154,7 +154,7 @@ public void setUp() { dataImportKafkaHandler = new DataImportKafkaHandler(vertx, mockedStorage, client, new ProfileSnapshotCache(vertx, client, 3600), kafkaConfig, - MappingMetadataCache.getInstance(vertx, client, 3600), + MappingMetadataCache.getInstance(vertx, client, new JsonObject()), new ConsortiumDataCache(vertx, client)); EventManager.clearEventHandlers(); diff --git a/src/test/java/org/folio/inventory/dataimport/consumers/MarcHoldingsRecordHridSetKafkaHandlerTest.java b/src/test/java/org/folio/inventory/dataimport/consumers/MarcHoldingsRecordHridSetKafkaHandlerTest.java index 5e6f42463..9c266a78e 100644 --- a/src/test/java/org/folio/inventory/dataimport/consumers/MarcHoldingsRecordHridSetKafkaHandlerTest.java +++ b/src/test/java/org/folio/inventory/dataimport/consumers/MarcHoldingsRecordHridSetKafkaHandlerTest.java @@ -129,7 +129,7 @@ record = Json.decodeValue(TestUtil.readFileFromPath(RECORD_PATH), Record.class); .withMappingParams(Json.encode(mappingParameters)) .withMappingRules(mappingRules.encode()))))); - MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, vertx.createHttpClient(), 3600); + MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, vertx.createHttpClient(), new JsonObject()); marcHoldingsRecordHridSetKafkaHandler = new MarcHoldingsRecordHridSetKafkaHandler(new HoldingsUpdateDelegate(mockedStorage, holdingsCollectionService), mappingMetadataCache); 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 a3c41db16..9dde09de7 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 @@ -229,7 +229,7 @@ public void setUp() throws IOException { HttpClient httpClient = vertx.createHttpClient(); createInstanceEventHandler = spy(new CreateInstanceEventHandler(storage, new PrecedingSucceedingTitlesHelper(context -> mockedClient), MappingMetadataCache.getInstance(vertx, - httpClient, 3600), instanceIdStorageService, orderHelperService, httpClient)); + httpClient, new JsonObject()), instanceIdStorageService, orderHelperService, httpClient)); doReturn(sourceStorageClient).when(createInstanceEventHandler).getSourceStorageRecordsClient(any(), any()); doAnswer(invocationOnMock -> { diff --git a/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateMarcHoldingsEventHandlerTest.java b/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateMarcHoldingsEventHandlerTest.java index 3bac903e9..79c9843f6 100644 --- a/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateMarcHoldingsEventHandlerTest.java +++ b/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateMarcHoldingsEventHandlerTest.java @@ -155,7 +155,7 @@ public class CreateMarcHoldingsEventHandlerTest { public void setUp() throws IOException { MockitoAnnotations.openMocks(this); MappingManager.clearReaderFactories(); - MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, vertx.createHttpClient(), 3600); + MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, vertx.createHttpClient(), new JsonObject()); createMarcHoldingsEventHandler = new CreateMarcHoldingsEventHandler(storage, mappingMetadataCache, holdingsIdStorageService, holdingsCollectionService); mappingRules = new JsonObject(TestUtil.readFileFromPath(MAPPING_RULES_PATH)); instanceId = String.valueOf(UUID.randomUUID()); diff --git a/src/test/java/org/folio/inventory/dataimport/handlers/actions/ReplaceInstanceEventHandlerTest.java b/src/test/java/org/folio/inventory/dataimport/handlers/actions/ReplaceInstanceEventHandlerTest.java index 17a202422..2db870c2b 100644 --- a/src/test/java/org/folio/inventory/dataimport/handlers/actions/ReplaceInstanceEventHandlerTest.java +++ b/src/test/java/org/folio/inventory/dataimport/handlers/actions/ReplaceInstanceEventHandlerTest.java @@ -256,7 +256,7 @@ public void setUp() throws IOException { Vertx vertx = Vertx.vertx(); replaceInstanceEventHandler = spy(new ReplaceInstanceEventHandler(storage, precedingSucceedingTitlesHelper, MappingMetadataCache.getInstance(vertx, - vertx.createHttpClient(), 3600), vertx.createHttpClient(), consortiumServiceImpl)); + vertx.createHttpClient(), new JsonObject()), vertx.createHttpClient(), consortiumServiceImpl)); var recordUUID = UUID.randomUUID().toString(); HttpResponse recordHttpResponse = buildHttpResponseWithBuffer(BufferImpl.buffer(String.format(EXISTING_SRS_CONTENT, recordUUID, recordUUID, 0)), HttpStatus.SC_OK); diff --git a/src/test/java/org/folio/inventory/dataimport/handlers/actions/UpdateAuthorityEventHandlerTest.java b/src/test/java/org/folio/inventory/dataimport/handlers/actions/UpdateAuthorityEventHandlerTest.java index 3b441b589..0de481236 100644 --- a/src/test/java/org/folio/inventory/dataimport/handlers/actions/UpdateAuthorityEventHandlerTest.java +++ b/src/test/java/org/folio/inventory/dataimport/handlers/actions/UpdateAuthorityEventHandlerTest.java @@ -116,7 +116,7 @@ public class UpdateAuthorityEventHandlerTest { public void setUp() throws IOException { MockitoAnnotations.openMocks(this); MappingManager.clearReaderFactories(); - MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, vertx.createHttpClient(), 3600); + MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, vertx.createHttpClient(), new JsonObject()); eventHandler = new UpdateAuthorityEventHandler(storage, mappingMetadataCache, publisher); JsonObject mappingRules = new JsonObject(TestUtil.readFileFromPath(MAPPING_RULES_PATH)); diff --git a/src/test/java/org/folio/inventory/dataimport/handlers/actions/UpdateMarcHoldingsEventHandlerTest.java b/src/test/java/org/folio/inventory/dataimport/handlers/actions/UpdateMarcHoldingsEventHandlerTest.java index a1d506523..0f031488e 100644 --- a/src/test/java/org/folio/inventory/dataimport/handlers/actions/UpdateMarcHoldingsEventHandlerTest.java +++ b/src/test/java/org/folio/inventory/dataimport/handlers/actions/UpdateMarcHoldingsEventHandlerTest.java @@ -138,7 +138,7 @@ public class UpdateMarcHoldingsEventHandlerTest { public void setUp() throws IOException { MockitoAnnotations.openMocks(this); MappingManager.clearReaderFactories(); - MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, vertx.createHttpClient(), 3600); + MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, vertx.createHttpClient(), new JsonObject()); eventHandler = new UpdateMarcHoldingsEventHandler(storage, mappingMetadataCache, publisher); mappingRules = new JsonObject(TestUtil.readFileFromPath(MAPPING_RULES_PATH)); From dec6da519703746b4dfcb355a8b0e674338529d8 Mon Sep 17 00:00:00 2001 From: Volodymyr_Rohach Date: Wed, 22 May 2024 17:19:33 +0300 Subject: [PATCH 4/5] MODINV-1023: Tests fixing[2]. --- .../handlers/actions/CreateAuthorityEventHandlerTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateAuthorityEventHandlerTest.java b/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateAuthorityEventHandlerTest.java index e00e050c0..922d65489 100644 --- a/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateAuthorityEventHandlerTest.java +++ b/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateAuthorityEventHandlerTest.java @@ -144,7 +144,7 @@ public class CreateAuthorityEventHandlerTest { public void setUp() throws IOException { MockitoAnnotations.openMocks(this); MappingManager.clearReaderFactories(); - MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, vertx.createHttpClient(), 3600); + MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, vertx.createHttpClient(), new JsonObject()); createMarcAuthoritiesEventHandler = new CreateAuthorityEventHandler(storage, mappingMetadataCache, authorityIdStorageService); JsonObject mappingRules = new JsonObject(TestUtil.readFileFromPath(MAPPING_RULES_PATH)); From 91e8c9dc7fe0edc86f223e20ce1eb8423c30ad09 Mon Sep 17 00:00:00 2001 From: Volodymyr_Rohach Date: Thu, 23 May 2024 16:19:43 +0300 Subject: [PATCH 5/5] MODINV-1023: Useless argument removed. --- .../java/org/folio/inventory/DataImportConsumerVerticle.java | 2 +- .../org/folio/inventory/MarcBibUpdateConsumerVerticle.java | 2 +- .../java/org/folio/inventory/MarcHridSetConsumerVerticle.java | 2 +- .../inventory/dataimport/cache/MappingMetadataCache.java | 4 ++-- .../inventory/dataimport/cache/MappingMetadataCacheTest.java | 2 +- .../dataimport/consumers/DataImportKafkaHandlerTest.java | 2 +- .../consumers/MarcHoldingsRecordHridSetKafkaHandlerTest.java | 2 +- .../handlers/actions/CreateAuthorityEventHandlerTest.java | 2 +- .../handlers/actions/CreateInstanceEventHandlerTest.java | 2 +- .../handlers/actions/CreateMarcHoldingsEventHandlerTest.java | 2 +- .../handlers/actions/ReplaceInstanceEventHandlerTest.java | 2 +- .../handlers/actions/UpdateAuthorityEventHandlerTest.java | 2 +- .../handlers/actions/UpdateMarcHoldingsEventHandlerTest.java | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/java/org/folio/inventory/DataImportConsumerVerticle.java b/src/main/java/org/folio/inventory/DataImportConsumerVerticle.java index ee781424e..f98349069 100644 --- a/src/main/java/org/folio/inventory/DataImportConsumerVerticle.java +++ b/src/main/java/org/folio/inventory/DataImportConsumerVerticle.java @@ -122,7 +122,7 @@ public void start(Promise startPromise) { ProfileSnapshotCache profileSnapshotCache = new ProfileSnapshotCache(vertx, client, Long.parseLong(profileSnapshotExpirationTime)); ConsortiumDataCache consortiumDataCache = new ConsortiumDataCache(vertx, client); - MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, client, config); + MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, client); DataImportKafkaHandler dataImportKafkaHandler = new DataImportKafkaHandler( vertx, storage, client, profileSnapshotCache, kafkaConfig, mappingMetadataCache, consortiumDataCache); diff --git a/src/main/java/org/folio/inventory/MarcBibUpdateConsumerVerticle.java b/src/main/java/org/folio/inventory/MarcBibUpdateConsumerVerticle.java index 6737e8500..7754f1036 100644 --- a/src/main/java/org/folio/inventory/MarcBibUpdateConsumerVerticle.java +++ b/src/main/java/org/folio/inventory/MarcBibUpdateConsumerVerticle.java @@ -40,7 +40,7 @@ public void start(Promise startPromise) { Storage storage = Storage.basedUpon(config, client); InstanceUpdateDelegate instanceUpdateDelegate = new InstanceUpdateDelegate(storage); - MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, client, config); + MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, client); MarcBibUpdateKafkaHandler marcBibUpdateKafkaHandler = new MarcBibUpdateKafkaHandler(vertx, getMaxDistributionNumber(), kafkaConfig, instanceUpdateDelegate, mappingMetadataCache); diff --git a/src/main/java/org/folio/inventory/MarcHridSetConsumerVerticle.java b/src/main/java/org/folio/inventory/MarcHridSetConsumerVerticle.java index dd3242915..12af1cbac 100644 --- a/src/main/java/org/folio/inventory/MarcHridSetConsumerVerticle.java +++ b/src/main/java/org/folio/inventory/MarcHridSetConsumerVerticle.java @@ -63,7 +63,7 @@ public void start(Promise startPromise) { InstanceUpdateDelegate instanceUpdateDelegate = new InstanceUpdateDelegate(storage); HoldingsUpdateDelegate holdingsRecordUpdateDelegate = new HoldingsUpdateDelegate(storage, holdingsCollectionService); - MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, client, config); + MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, client); MarcBibInstanceHridSetKafkaHandler marcBibInstanceHridSetKafkaHandler = new MarcBibInstanceHridSetKafkaHandler(instanceUpdateDelegate, mappingMetadataCache); MarcHoldingsRecordHridSetKafkaHandler marcHoldingsRecordHridSetKafkaHandler = new MarcHoldingsRecordHridSetKafkaHandler(holdingsRecordUpdateDelegate, mappingMetadataCache); diff --git a/src/main/java/org/folio/inventory/dataimport/cache/MappingMetadataCache.java b/src/main/java/org/folio/inventory/dataimport/cache/MappingMetadataCache.java index 9c81daa9c..209386659 100644 --- a/src/main/java/org/folio/inventory/dataimport/cache/MappingMetadataCache.java +++ b/src/main/java/org/folio/inventory/dataimport/cache/MappingMetadataCache.java @@ -111,9 +111,9 @@ private CompletableFuture> loadMappingMetadata(Stri }); } - public static synchronized MappingMetadataCache getInstance(Vertx vertx, HttpClient httpClient, JsonObject config) { + public static synchronized MappingMetadataCache getInstance(Vertx vertx, HttpClient httpClient) { if (instance == null) { - instance = new MappingMetadataCache(vertx, httpClient, Long.parseLong(getCacheEnvVariable(config, METADATA_EXPIRATION_TIME))); + instance = new MappingMetadataCache(vertx, httpClient, Long.parseLong(getCacheEnvVariable(vertx.getOrCreateContext().config(), METADATA_EXPIRATION_TIME))); } return instance; } diff --git a/src/test/java/org/folio/inventory/dataimport/cache/MappingMetadataCacheTest.java b/src/test/java/org/folio/inventory/dataimport/cache/MappingMetadataCacheTest.java index c84634d19..dc7175889 100644 --- a/src/test/java/org/folio/inventory/dataimport/cache/MappingMetadataCacheTest.java +++ b/src/test/java/org/folio/inventory/dataimport/cache/MappingMetadataCacheTest.java @@ -38,7 +38,7 @@ public class MappingMetadataCacheTest { private final Vertx vertx = Vertx.vertx(); private final MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, - vertx.createHttpClient(), new JsonObject()); + vertx.createHttpClient()); @Rule public WireMockRule mockServer = new WireMockRule( 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 1849b11cb..5d76cc0ce 100644 --- a/src/test/java/org/folio/inventory/dataimport/consumers/DataImportKafkaHandlerTest.java +++ b/src/test/java/org/folio/inventory/dataimport/consumers/DataImportKafkaHandlerTest.java @@ -154,7 +154,7 @@ public void setUp() { dataImportKafkaHandler = new DataImportKafkaHandler(vertx, mockedStorage, client, new ProfileSnapshotCache(vertx, client, 3600), kafkaConfig, - MappingMetadataCache.getInstance(vertx, client, new JsonObject()), + MappingMetadataCache.getInstance(vertx, client), new ConsortiumDataCache(vertx, client)); EventManager.clearEventHandlers(); diff --git a/src/test/java/org/folio/inventory/dataimport/consumers/MarcHoldingsRecordHridSetKafkaHandlerTest.java b/src/test/java/org/folio/inventory/dataimport/consumers/MarcHoldingsRecordHridSetKafkaHandlerTest.java index 9c266a78e..ef668148e 100644 --- a/src/test/java/org/folio/inventory/dataimport/consumers/MarcHoldingsRecordHridSetKafkaHandlerTest.java +++ b/src/test/java/org/folio/inventory/dataimport/consumers/MarcHoldingsRecordHridSetKafkaHandlerTest.java @@ -129,7 +129,7 @@ record = Json.decodeValue(TestUtil.readFileFromPath(RECORD_PATH), Record.class); .withMappingParams(Json.encode(mappingParameters)) .withMappingRules(mappingRules.encode()))))); - MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, vertx.createHttpClient(), new JsonObject()); + MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, vertx.createHttpClient()); marcHoldingsRecordHridSetKafkaHandler = new MarcHoldingsRecordHridSetKafkaHandler(new HoldingsUpdateDelegate(mockedStorage, holdingsCollectionService), mappingMetadataCache); diff --git a/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateAuthorityEventHandlerTest.java b/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateAuthorityEventHandlerTest.java index 922d65489..3125f9c66 100644 --- a/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateAuthorityEventHandlerTest.java +++ b/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateAuthorityEventHandlerTest.java @@ -144,7 +144,7 @@ public class CreateAuthorityEventHandlerTest { public void setUp() throws IOException { MockitoAnnotations.openMocks(this); MappingManager.clearReaderFactories(); - MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, vertx.createHttpClient(), new JsonObject()); + MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, vertx.createHttpClient()); createMarcAuthoritiesEventHandler = new CreateAuthorityEventHandler(storage, mappingMetadataCache, authorityIdStorageService); JsonObject mappingRules = new JsonObject(TestUtil.readFileFromPath(MAPPING_RULES_PATH)); 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 9dde09de7..196b9246c 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 @@ -229,7 +229,7 @@ public void setUp() throws IOException { HttpClient httpClient = vertx.createHttpClient(); createInstanceEventHandler = spy(new CreateInstanceEventHandler(storage, new PrecedingSucceedingTitlesHelper(context -> mockedClient), MappingMetadataCache.getInstance(vertx, - httpClient, new JsonObject()), instanceIdStorageService, orderHelperService, httpClient)); + httpClient), instanceIdStorageService, orderHelperService, httpClient)); doReturn(sourceStorageClient).when(createInstanceEventHandler).getSourceStorageRecordsClient(any(), any()); doAnswer(invocationOnMock -> { diff --git a/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateMarcHoldingsEventHandlerTest.java b/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateMarcHoldingsEventHandlerTest.java index 79c9843f6..920836184 100644 --- a/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateMarcHoldingsEventHandlerTest.java +++ b/src/test/java/org/folio/inventory/dataimport/handlers/actions/CreateMarcHoldingsEventHandlerTest.java @@ -155,7 +155,7 @@ public class CreateMarcHoldingsEventHandlerTest { public void setUp() throws IOException { MockitoAnnotations.openMocks(this); MappingManager.clearReaderFactories(); - MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, vertx.createHttpClient(), new JsonObject()); + MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, vertx.createHttpClient()); createMarcHoldingsEventHandler = new CreateMarcHoldingsEventHandler(storage, mappingMetadataCache, holdingsIdStorageService, holdingsCollectionService); mappingRules = new JsonObject(TestUtil.readFileFromPath(MAPPING_RULES_PATH)); instanceId = String.valueOf(UUID.randomUUID()); diff --git a/src/test/java/org/folio/inventory/dataimport/handlers/actions/ReplaceInstanceEventHandlerTest.java b/src/test/java/org/folio/inventory/dataimport/handlers/actions/ReplaceInstanceEventHandlerTest.java index 2db870c2b..f3b55761b 100644 --- a/src/test/java/org/folio/inventory/dataimport/handlers/actions/ReplaceInstanceEventHandlerTest.java +++ b/src/test/java/org/folio/inventory/dataimport/handlers/actions/ReplaceInstanceEventHandlerTest.java @@ -256,7 +256,7 @@ public void setUp() throws IOException { Vertx vertx = Vertx.vertx(); replaceInstanceEventHandler = spy(new ReplaceInstanceEventHandler(storage, precedingSucceedingTitlesHelper, MappingMetadataCache.getInstance(vertx, - vertx.createHttpClient(), new JsonObject()), vertx.createHttpClient(), consortiumServiceImpl)); + vertx.createHttpClient()), vertx.createHttpClient(), consortiumServiceImpl)); var recordUUID = UUID.randomUUID().toString(); HttpResponse recordHttpResponse = buildHttpResponseWithBuffer(BufferImpl.buffer(String.format(EXISTING_SRS_CONTENT, recordUUID, recordUUID, 0)), HttpStatus.SC_OK); diff --git a/src/test/java/org/folio/inventory/dataimport/handlers/actions/UpdateAuthorityEventHandlerTest.java b/src/test/java/org/folio/inventory/dataimport/handlers/actions/UpdateAuthorityEventHandlerTest.java index 0de481236..b26d44cf1 100644 --- a/src/test/java/org/folio/inventory/dataimport/handlers/actions/UpdateAuthorityEventHandlerTest.java +++ b/src/test/java/org/folio/inventory/dataimport/handlers/actions/UpdateAuthorityEventHandlerTest.java @@ -116,7 +116,7 @@ public class UpdateAuthorityEventHandlerTest { public void setUp() throws IOException { MockitoAnnotations.openMocks(this); MappingManager.clearReaderFactories(); - MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, vertx.createHttpClient(), new JsonObject()); + MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, vertx.createHttpClient()); eventHandler = new UpdateAuthorityEventHandler(storage, mappingMetadataCache, publisher); JsonObject mappingRules = new JsonObject(TestUtil.readFileFromPath(MAPPING_RULES_PATH)); diff --git a/src/test/java/org/folio/inventory/dataimport/handlers/actions/UpdateMarcHoldingsEventHandlerTest.java b/src/test/java/org/folio/inventory/dataimport/handlers/actions/UpdateMarcHoldingsEventHandlerTest.java index 0f031488e..72e8e8db5 100644 --- a/src/test/java/org/folio/inventory/dataimport/handlers/actions/UpdateMarcHoldingsEventHandlerTest.java +++ b/src/test/java/org/folio/inventory/dataimport/handlers/actions/UpdateMarcHoldingsEventHandlerTest.java @@ -138,7 +138,7 @@ public class UpdateMarcHoldingsEventHandlerTest { public void setUp() throws IOException { MockitoAnnotations.openMocks(this); MappingManager.clearReaderFactories(); - MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, vertx.createHttpClient(), new JsonObject()); + MappingMetadataCache mappingMetadataCache = MappingMetadataCache.getInstance(vertx, vertx.createHttpClient()); eventHandler = new UpdateMarcHoldingsEventHandler(storage, mappingMetadataCache, publisher); mappingRules = new JsonObject(TestUtil.readFileFromPath(MAPPING_RULES_PATH));