Commit 1a56229b authored by Sviatoslav Nekhaienko's avatar Sviatoslav Nekhaienko
Browse files

move settings to IndexerConfigurationProperties

parent dc232e1c
Pipeline #19916 failed with stage
in 2 minutes and 3 seconds
......@@ -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;
......
......@@ -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())
......
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment