Commit 8e626b77 authored by harshit aggarwal's avatar harshit aggarwal
Browse files

PR comments

parent 0b564709
Pipeline #18266 failed with stages
in 35 minutes and 47 seconds
......@@ -59,7 +59,7 @@ STORAGE_API=${storage_service_endpoint}
SEARCH_API=${search_service_endpoint}
#Schema service
SCHEMA_API=${schema_service_endpoint}
osdu.host.schemaServiceUrl=${schema_service_endpoint}
# Partition service
PARTITION_API=${partition_service_endpoint}
......
......@@ -32,12 +32,6 @@ public class Constants {
public static final String COULD_NOT_TRANSFORM = "Could not transform";
public static final String TRANFORMATION_PROCESS_COMPLETED = "Transformation process completed";
public static final String NOT_CREATE_OR_UPDATE_OPERATION = "%d out of %d records do not have create or update operation code";
public static final int AUTHORITY_INDEX = 0;
public static final int SOURCE_INDEX = 1;
public static final int ENTITY_INDEX = 2;
public static final int VERSION_INDEX = 3;
public static final String POST_SCHEMA_ENDPOINT = "/schema";
private Constants() {
}
......
package org.opengroup.osdu.wks.constants;
public class SchemaConstants {
public static final int AUTHORITY_INDEX = 0;
public static final int SOURCE_INDEX = 1;
public static final int ENTITY_INDEX = 2;
public static final int VERSION_INDEX = 3;
public static final String POST_SCHEMA_ENDPOINT = "/schema";
private SchemaConstants() {
}
}
......@@ -8,6 +8,7 @@ import org.opengroup.osdu.core.common.model.tenant.TenantInfo;
import org.opengroup.osdu.core.common.provider.interfaces.ITenantFactory;
import org.opengroup.osdu.wks.config.RequestIdentity;
import org.opengroup.osdu.wks.constants.Constants;
import org.opengroup.osdu.wks.constants.SchemaConstants;
import org.opengroup.osdu.wks.exceptions.ApplicationException;
import org.opengroup.osdu.wks.model.RequestParameters;
import org.opengroup.osdu.wks.model.RestResponse;
......@@ -42,7 +43,7 @@ public class SchemaService implements ISchemaService{
private RequestIdentity requestIdentity;
@Autowired
private ServiceConfiguration serviceConfig;
private ServiceHostConfiguration serviceConfig;
@Autowired
private KindUtil kindUtil;
......@@ -101,7 +102,7 @@ public class SchemaService implements ISchemaService{
try {
String[] kindArr = kind.split(Constants.COLON_SEPARATOR);
String majorVersion = kindUtil.getMajorVersionFromKind(kind).toString();
String schemaUrl = serviceConfig.getSchemaServiceUrl() + Constants.POST_SCHEMA_ENDPOINT;
String schemaUrl = serviceConfig.getSchemaServiceUrl() + SchemaConstants.POST_SCHEMA_ENDPOINT;
URIBuilder uriBuilder = new URIBuilder(schemaUrl);
uriBuilder.addParameter("authority", kindArr[0]);
uriBuilder.addParameter("source", kindArr[1]);
......
package org.opengroup.osdu.wks.service;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Value;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Configuration
@ConfigurationProperties("osdu.host")
@Getter
class ServiceConfiguration {
@Setter
class ServiceHostConfiguration {
@Value("${SCHEMA_API}")
private String searchServiceUrl;
private String storageServiceUrl;
private String schemaServiceUrl;
}
package org.opengroup.osdu.wks.util;
import org.opengroup.osdu.wks.constants.Constants;
import org.opengroup.osdu.wks.constants.SchemaConstants;
import org.springframework.stereotype.Component;
import java.util.stream.Stream;
......@@ -27,22 +28,22 @@ public class KindUtil {
public String retrieveAuthorityName(String kind) {
String[] idArr = kind.split(Constants.COLON_SEPARATOR);
return idArr[Constants.AUTHORITY_INDEX];
return idArr[SchemaConstants.AUTHORITY_INDEX];
}
public String retrieveEntityName(String id) {
String[] idArr = id.split(Constants.COLON_SEPARATOR);
return idArr[Constants.ENTITY_INDEX];
return idArr[SchemaConstants.ENTITY_INDEX];
}
public String retrieveSourceName(String id) {
String[] idArr = id.split(Constants.COLON_SEPARATOR);
return idArr[Constants.SOURCE_INDEX];
return idArr[SchemaConstants.SOURCE_INDEX];
}
public String retrieveMajorVersion(String kind) {
String[] idArr = kind.split(Constants.COLON_SEPARATOR);
String version = idArr[Constants.VERSION_INDEX];
String version = idArr[SchemaConstants.VERSION_INDEX];
return version.split("\\.")[0];
}
}
......@@ -72,7 +72,7 @@ public class SchemaServiceTest {
private RestResponse restResponse;
@Mock
private ServiceConfiguration serviceConfig;
private ServiceHostConfiguration serviceConfig;
@BeforeEach
public void init() throws ApplicationException {
......
Supports Markdown
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