Skip to content
Snippets Groups Projects
Commit f015c7a2 authored by Sviatoslav Nekhaienko's avatar Sviatoslav Nekhaienko
Browse files

remove @Log

parent 2f921e01
No related branches found
No related tags found
1 merge request!60Indexer to read from Schema Service as well as Storage Schema
Pipeline #18345 failed
......@@ -16,6 +16,7 @@ package org.opengroup.osdu.indexer.schema.converter;
import lombok.extern.java.Log;
import org.apache.http.HttpStatus;
import org.opengroup.osdu.core.common.logging.JaxRsDpsLog;
import org.opengroup.osdu.core.common.model.http.AppException;
import org.opengroup.osdu.core.common.search.Preconditions;
import org.opengroup.osdu.indexer.schema.converter.tags.AllOfItem;
......@@ -23,11 +24,15 @@ import org.opengroup.osdu.indexer.schema.converter.tags.Definition;
import org.opengroup.osdu.indexer.schema.converter.tags.Definitions;
import org.opengroup.osdu.indexer.schema.converter.tags.TypeProperty;
import javax.inject.Inject;
import java.util.*;
import java.util.stream.Stream;
@Log
class PropertiesProcessor {
@Inject
private JaxRsDpsLog log;
private static final String DEF_PREFIX = "#/definitions/";
private static final Set<String> SKIP_DEFINITIONS = new HashSet<>(
......@@ -58,11 +63,13 @@ class PropertiesProcessor {
private final String pathPrefix;
private final String pathPrefixWithDot;
public PropertiesProcessor(Definitions definitions) {
this(definitions, null);
public PropertiesProcessor(Definitions definitions, JaxRsDpsLog log) {
this(definitions, null, log);
}
public PropertiesProcessor(Definitions definitions, String pathPrefix) {
public PropertiesProcessor(Definitions definitions, String pathPrefix, JaxRsDpsLog log) {
this.log = log;
this.definitions = definitions;
this.pathPrefix = pathPrefix;
this.pathPrefixWithDot = Objects.isNull(pathPrefix) || pathPrefix.isEmpty() ? "" : pathPrefix + ".";
......@@ -122,12 +129,12 @@ class PropertiesProcessor {
}
if (!Objects.isNull(entry.getValue().getProperties())) {
PropertiesProcessor propertiesProcessor = new PropertiesProcessor(definitions, pathPrefixWithDot + entry.getKey());
PropertiesProcessor propertiesProcessor = new PropertiesProcessor(definitions, pathPrefixWithDot + entry.getKey(), log);
return entry.getValue().getProperties().entrySet().stream().flatMap(propertiesProcessor::processPropertyEntry);
}
if (!Objects.isNull(entry.getValue().getRef())) {
return new PropertiesProcessor(definitions, pathPrefixWithDot + entry.getKey())
return new PropertiesProcessor(definitions, pathPrefixWithDot + entry.getKey(), log)
.processRef(entry.getValue().getRef());
}
......
......@@ -82,7 +82,7 @@ public class SchemaToStorageFormatImpl implements SchemaToStorageFormat {
Preconditions.checkNotNull(objectMapper, "schemaServiceSchema cannot be null");
Preconditions.checkNotNullOrEmpty(kind, "kind cannot be null or empty");
PropertiesProcessor propertiesProcessor = new PropertiesProcessor(schemaServiceSchema.getDefinitions());
PropertiesProcessor propertiesProcessor = new PropertiesProcessor(schemaServiceSchema.getDefinitions(), log);
final List<Map<String, Object>> storageSchemaItems = new ArrayList<>();
if (schemaServiceSchema.getProperties() != null) {
......
......@@ -19,6 +19,7 @@ import lombok.extern.java.Log;
import org.apache.http.HttpStatus;
import org.opengroup.osdu.core.common.http.FetchServiceHttpRequest;
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.schema.converter.interfaces.SchemaToStorageFormat;
......@@ -37,8 +38,10 @@ import java.nio.charset.StandardCharsets;
* Provides implementation of the client service that retrieves schemas from the Schema Service
*/
@Component
@Log
public class SchemaServiceImpl implements SchemaService {
@Inject
private JaxRsDpsLog log;
@Inject
private IUrlFetchService urlFetchService;
......
......@@ -17,6 +17,8 @@ package org.opengroup.osdu.indexer.schema.converter;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.opengroup.osdu.core.common.logging.JaxRsDpsLog;
import org.springframework.boot.test.context.SpringBootTest;
......@@ -40,8 +42,9 @@ import static org.junit.Assert.fail;
public class SchemaToStorageFormatImplTest {
private ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json().build();
private JaxRsDpsLog jaxRsDpsLog = Mockito.mock(JaxRsDpsLog.class);
private JaxRsDpsLog jaxRsDpsLog = Mockito.mock(JaxRsDpsLog.class);
private SchemaToStorageFormatImpl schemaToStorageFormatImpl
= new SchemaToStorageFormatImpl(objectMapper, jaxRsDpsLog);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment