Skip to content
Snippets Groups Projects
Commit ad3b003f authored by Hema Vishnu Pola [Microsoft]'s avatar Hema Vishnu Pola [Microsoft]
Browse files

Merge branch 'master' into integration_test_fix

parents 56e462b7 feb78aa0
No related branches found
No related tags found
1 merge request!118Defensive update to resolve tagging Integration tests issue
Pipeline #32297 failed
Showing
with 126 additions and 9 deletions
......@@ -24,7 +24,7 @@ public class SchemaConverterPropertiesConfig implements SchemaConverterConfig {
}
private Set<String> getDefaultSupportedArrayTypes() {
return new HashSet<>(Arrays.asList("boolean", "integer", "number", "string"));
return new HashSet<>(Arrays.asList("boolean", "integer", "number", "string", "object"));
}
private Map<String, String> getDefaultSpecialDefinitionsMap() {
......
......@@ -43,7 +43,7 @@ public class TypeMapper {
metaAttributeIndexerType.put(RecordMetaAttribute.VERSION.getValue(), ElasticType.LONG.getValue());
metaAttributeIndexerType.put(RecordMetaAttribute.X_ACL.getValue(), ElasticType.KEYWORD.getValue());
metaAttributeIndexerType.put(RecordMetaAttribute.ACL.getValue(), getAclIndexerMapping());
metaAttributeIndexerType.put(RecordMetaAttribute.TAGS.getValue(), ElasticType.FLATTENED.getValue());
metaAttributeIndexerType.put(RecordMetaAttribute.TAGS.getValue(), ElasticType.OBJECT.getValue());
metaAttributeIndexerType.put(RecordMetaAttribute.LEGAL.getValue(), getLegalIndexerMapping());
metaAttributeIndexerType.put(RecordMetaAttribute.ANCESTRY.getValue(), getAncestryIndexerMapping());
metaAttributeIndexerType.put(RecordMetaAttribute.INDEX_STATUS.getValue(), getIndexStatusMapping());
......
......@@ -40,6 +40,10 @@
{
"kind": "string",
"path": "Checksum"
},
{
"kind": "[]object",
"path": "VectorHeaderMapping"
}
]
}
\ No newline at end of file
......@@ -32,6 +32,14 @@
{
"kind": "[]link",
"path": "Counterparties"
},
{
"kind": "[]object",
"path": "Terms"
},
{
"kind": "[]object",
"path": "RestrictedResources"
}
]
}
\ No newline at end of file
......@@ -76,6 +76,10 @@
{
"kind": "string",
"path": "VerticalMeasurementID"
},
{
"kind": "[]object",
"path": "Curves"
}
]
}
\ No newline at end of file
......@@ -44,6 +44,10 @@
{
"kind": "[]string",
"path": "Annotations"
},
{
"kind": "[]object",
"path": "LineageAssertions"
}
]
}
\ No newline at end of file
......@@ -79,15 +79,38 @@ public class IndexerQueueTaskBuilderAws extends IndexerQueueTaskBuilder {
}
@Override
public void createReIndexTask(String payload,DpsHeaders headers) {
this.createTask(payload, headers);
Map<String, MessageAttributeValue> messageAttributes = new HashMap<>();
messageAttributes.put(DpsHeaders.ACCOUNT_ID, new MessageAttributeValue()
.withDataType("String")
.withStringValue(headers.getPartitionIdWithFallbackToAccountId()));
messageAttributes.put(DpsHeaders.DATA_PARTITION_ID, new MessageAttributeValue()
.withDataType("String")
.withStringValue(headers.getPartitionIdWithFallbackToAccountId()));
headers.addCorrelationIdIfMissing();
messageAttributes.put(DpsHeaders.CORRELATION_ID, new MessageAttributeValue()
.withDataType("String")
.withStringValue(headers.getCorrelationId()));
messageAttributes.put(DpsHeaders.USER_EMAIL, new MessageAttributeValue()
.withDataType("String")
.withStringValue(headers.getUserEmail()));
messageAttributes.put(DpsHeaders.AUTHORIZATION, new MessageAttributeValue()
.withDataType("String")
.withStringValue(headers.getAuthorization()));
messageAttributes.put("ReIndexCursor", new MessageAttributeValue()
.withDataType("String")
.withStringValue("True"));
SendMessageRequest sendMessageRequest = new SendMessageRequest()
.withQueueUrl(storageQueue)
.withMessageBody(payload)
.withMessageAttributes(messageAttributes);
sqsClient.sendMessage(sendMessageRequest);
}
@Override
public void createReIndexTask(String payload, Long countDownMillis, DpsHeaders headers){
this.createTask(payload, headers);
this.createReIndexTask(payload, headers);
}
private void createTask(String payload, DpsHeaders headers) {
Map<String, MessageAttributeValue> messageAttributes = new HashMap<>();
messageAttributes.put(DpsHeaders.ACCOUNT_ID, new MessageAttributeValue()
.withDataType("String")
......
......@@ -23,12 +23,36 @@ public class AppExceptionHandler {
? e.getOriginalException().getMessage()
: e.getError().getMessage();
if (e.getError().getCode() > 499) {
Integer errorCode = e.getError().getCode();
if (errorCode > 499) {
log.error(exceptionMsg, e.getOriginalException());
} else {
log.warn(exceptionMsg, e.getOriginalException());
}
return new ResponseEntity<>(e.getError(), HttpStatus.resolve(e.getError().getCode()));
HttpStatus status = Objects.nonNull(HttpStatus.resolve(errorCode))
? HttpStatus.resolve(errorCode)
: resolveNotSupportedStatus(errorCode);
return new ResponseEntity<>(e.getError(), status);
}
//Currently not all codes provided from core can be resolved by HttpStatus
//example org.opengroup.osdu.core.common.model.http.RequestStatus have not supported by HttpStatus codes
private HttpStatus resolveNotSupportedStatus(int statusCode) {
if (statusCode > 99 && statusCode < 200) {
return HttpStatus.CONTINUE;
}
if (statusCode > 199 && statusCode < 300) {
return HttpStatus.NO_CONTENT;
}
if (statusCode > 299 && statusCode < 400) {
return HttpStatus.MULTIPLE_CHOICES;
}
if (statusCode > 399 && statusCode < 500) {
return HttpStatus.BAD_REQUEST;
}
return HttpStatus.INTERNAL_SERVER_ERROR;
}
}
......@@ -42,5 +42,3 @@ security.https.certificate.trust=false
indexer.que.service.mail=default@iam.gserviceaccount.com
SCHEMA_HOST=${HOST}/api/schema-service/v1/schema
storage-query-kinds-host=https://${STORAGE_HOSTNAME}/api/storage/v2/query/kinds
schema.converter.supported-array-types=boolean,integer,number,string,object
package org.opengroup.osdu.indexer.ibm.di;
import org.opengroup.osdu.core.common.entitlements.EntitlementsAPIConfig;
import org.opengroup.osdu.core.common.entitlements.EntitlementsFactory;
import org.opengroup.osdu.core.common.entitlements.IEntitlementsFactory;
import org.opengroup.osdu.core.common.http.json.HttpResponseBodyMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.config.AbstractFactoryBean;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import org.springframework.web.context.annotation.RequestScope;
@Component
@RequestScope
@Lazy
public class EntitlementsClientFactory extends AbstractFactoryBean<IEntitlementsFactory> {
@Value("${AUTHORIZE_API}")
private String AUTHORIZE_API;
@Value("${AUTHORIZE_API_KEY:}")
private String AUTHORIZE_API_KEY;
@Autowired
private HttpResponseBodyMapper mapper;
@Override
protected IEntitlementsFactory createInstance() throws Exception {
return new EntitlementsFactory(EntitlementsAPIConfig
.builder()
.rootUrl(AUTHORIZE_API)
.apiKey(AUTHORIZE_API_KEY)
.build(),
mapper);
}
@Override
public Class<?> getObjectType() {
return IEntitlementsFactory.class;
}
}
\ No newline at end of file
......@@ -3,6 +3,8 @@
package org.opengroup.osdu.indexer.ibm.util;
import static org.opengroup.osdu.core.common.Constants.WORKER_RELATIVE_URL;
import java.util.Map;
import javax.inject.Inject;
......@@ -46,6 +48,12 @@ public class IndexerQueueTaskBuilderIbm extends IndexerQueueTaskBuilder {
public void createReIndexTask(String payload, DpsHeaders headers) {
createTask(payload, headers);
}
//used by reindexer api
@Override
public void createWorkerTask(String payload, Long countdownMillis, DpsHeaders headers) {
createTask(payload, headers);
}
private void createTask(String payload, DpsHeaders headers) {
......
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