diff --git a/indexer-core/src/main/java/org/opengroup/osdu/indexer/config/IndexerConfigurationProperties.java b/indexer-core/src/main/java/org/opengroup/osdu/indexer/config/IndexerConfigurationProperties.java index a139637e72da789c60d8f50bb4702098a2e2fa29..13ed75f28a0ba814cd3af9b01e3a166a5b05ae7d 100644 --- a/indexer-core/src/main/java/org/opengroup/osdu/indexer/config/IndexerConfigurationProperties.java +++ b/indexer-core/src/main/java/org/opengroup/osdu/indexer/config/IndexerConfigurationProperties.java @@ -47,6 +47,7 @@ public class IndexerConfigurationProperties { private String storageQueryRecordHost; private Integer storageRecordsBatchSize; private String storageSchemaHost; + private String schemaHost; private String entitlementsHost; private String entitlementTargetAudience; private String indexerQueueHost; diff --git a/indexer-core/src/main/java/org/opengroup/osdu/indexer/service/impl/SchemaServiceImpl.java b/indexer-core/src/main/java/org/opengroup/osdu/indexer/service/impl/SchemaServiceImpl.java index a6d115db841d46cc9d558d49eb695590f4b8f423..c8eb8057ed24198296a5f7021bc77ed93f9e5182 100644 --- a/indexer-core/src/main/java/org/opengroup/osdu/indexer/service/impl/SchemaServiceImpl.java +++ b/indexer-core/src/main/java/org/opengroup/osdu/indexer/service/impl/SchemaServiceImpl.java @@ -22,6 +22,7 @@ import org.opengroup.osdu.core.common.http.IUrlFetchService; import org.opengroup.osdu.core.common.logging.JaxRsDpsLog; import org.opengroup.osdu.core.common.model.http.HttpResponse; import org.opengroup.osdu.core.common.provider.interfaces.IRequestInfo; +import org.opengroup.osdu.indexer.config.IndexerConfigurationProperties; import org.opengroup.osdu.indexer.schema.converter.interfaces.SchemaToStorageFormat; import org.opengroup.osdu.indexer.service.SchemaService; import org.opengroup.osdu.indexer.service.StorageService; @@ -47,8 +48,8 @@ public class SchemaServiceImpl implements SchemaService { @Inject private IUrlFetchService urlFetchService; - @Value("${SCHEMA_HOST}") - private String SCHEMA_HOST; + @Inject + private IndexerConfigurationProperties configurationProperties; @Inject private IRequestInfo requestInfo; @@ -95,7 +96,7 @@ public class SchemaServiceImpl implements SchemaService { } protected HttpResponse getSchemaServiceResponse(String kind) throws UnsupportedEncodingException, URISyntaxException { - String url = String.format("%s/%s", SCHEMA_HOST, URLEncoder.encode(kind, StandardCharsets.UTF_8.toString())); + String url = String.format("%s/%s", configurationProperties.getSchemaHost(), URLEncoder.encode(kind, StandardCharsets.UTF_8.toString())); FetchServiceHttpRequest request = FetchServiceHttpRequest.builder() .httpMethod(HttpMethods.GET) .headers(this.requestInfo.getHeadersMap()) diff --git a/indexer-core/src/test/java/org/opengroup/osdu/indexer/service/impl/SchemaServiceImplTest.java b/indexer-core/src/test/java/org/opengroup/osdu/indexer/service/impl/SchemaServiceImplTest.java index b95b152c5568bad41bc4f41c7fee775d52d30980..69d19a8e140cac2088d4e833b3389e2493957883 100644 --- a/indexer-core/src/test/java/org/opengroup/osdu/indexer/service/impl/SchemaServiceImplTest.java +++ b/indexer-core/src/test/java/org/opengroup/osdu/indexer/service/impl/SchemaServiceImplTest.java @@ -24,6 +24,7 @@ import org.mockito.Spy; import org.opengroup.osdu.core.common.http.IUrlFetchService; import org.opengroup.osdu.core.common.logging.JaxRsDpsLog; import org.opengroup.osdu.core.common.provider.interfaces.IRequestInfo; +import org.opengroup.osdu.indexer.config.IndexerConfigurationProperties; import org.opengroup.osdu.indexer.schema.converter.SchemaToStorageFormatImpl; import org.opengroup.osdu.indexer.service.StorageService; import org.opengroup.osdu.indexer.service.impl.SchemaServiceImpl; @@ -55,6 +56,9 @@ public class SchemaServiceImplTest { @Mock private StorageService storageService; + @Mock + private IndexerConfigurationProperties configurationProperties; + @InjectMocks private SchemaServiceImpl sut; diff --git a/provider/indexer-azure/src/test/java/org/opengroup/osdu/indexer/azure/service/SchemaServiceTest.java b/provider/indexer-azure/src/test/java/org/opengroup/osdu/indexer/azure/service/SchemaServiceTest.java index d683fe78b9311e331e181cc83593fe5571dc1c7f..40dc8d8f923bca3172accdf70b20c5c3326be21b 100644 --- a/provider/indexer-azure/src/test/java/org/opengroup/osdu/indexer/azure/service/SchemaServiceTest.java +++ b/provider/indexer-azure/src/test/java/org/opengroup/osdu/indexer/azure/service/SchemaServiceTest.java @@ -24,6 +24,7 @@ import org.opengroup.osdu.core.common.http.IUrlFetchService; import org.opengroup.osdu.core.common.logging.JaxRsDpsLog; import org.opengroup.osdu.core.common.model.http.HttpResponse; import org.opengroup.osdu.core.common.provider.interfaces.IRequestInfo; +import org.opengroup.osdu.indexer.config.IndexerConfigurationProperties; import org.opengroup.osdu.indexer.schema.converter.SchemaToStorageFormatImpl; import org.opengroup.osdu.indexer.service.StorageService; import org.opengroup.osdu.indexer.service.impl.SchemaServiceImpl; @@ -54,6 +55,8 @@ public class SchemaServiceTest { private IRequestInfo requestInfo; @Mock private StorageService storageService; + @Mock + private IndexerConfigurationProperties configurationProperties; @InjectMocks private SchemaServiceImpl sut;