Skip to content

Commit

Permalink
Address backend DQ feedback (#12150)
Browse files Browse the repository at this point in the history
* fix: add jp and zh index

* fix: updated testCase tooltips

* fix: changed list testSuite permission to VEW_TEST + set owner of table for executable testSuite
  • Loading branch information
TeddyCr authored and harshach committed Jun 30, 2023
1 parent 2f055d5 commit 5cef4c6
Show file tree
Hide file tree
Showing 10 changed files with 672 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
import org.openmetadata.service.resources.EntityResource;
import org.openmetadata.service.security.Authorizer;
import org.openmetadata.service.security.policyevaluator.OperationContext;
import org.openmetadata.service.security.policyevaluator.ResourceContext;
import org.openmetadata.service.util.EntityUtil;
import org.openmetadata.service.util.FullyQualifiedName;
import org.openmetadata.service.util.RestUtil;
import org.openmetadata.service.util.ResultList;
Expand Down Expand Up @@ -143,7 +145,14 @@ public ResultList<TestSuite> list(
throws IOException {
ListFilter filter = new ListFilter(include);
filter.addQueryParam("testSuiteType", testSuiteType);
return super.listInternal(uriInfo, securityContext, fieldsParam, filter, limitParam, before, after);
EntityUtil.Fields fields = getFields(fieldsParam);

ResourceContext resourceContext;
resourceContext = getResourceContext(entityType, repository).build();
OperationContext operationContext = new OperationContext(Entity.TABLE, MetadataOperation.VIEW_TESTS);

return super.listInternal(
uriInfo, securityContext, fields, filter, limitParam, before, after, operationContext, resourceContext);
}

@GET
Expand Down Expand Up @@ -298,6 +307,7 @@ public Response createExecutable(
Entity.getEntityByName(Entity.TABLE, create.getExecutableEntityReference(), null, null); // check if entity exists
TestSuite testSuite = getTestSuite(create, securityContext.getUserPrincipal().getName());
testSuite.setExecutable(true);
testSuite = setExecutableTestSuiteOwner(testSuite);
testSuite = setExecutableTestSuiteName(testSuite);
return create(uriInfo, securityContext, testSuite);
}
Expand Down Expand Up @@ -550,6 +560,17 @@ private TestSuite setExecutableTestSuiteName(TestSuite testSuite) {
return testSuite.withDisplayName(name).withName(hashedName);
}

private TestSuite setExecutableTestSuiteOwner(TestSuite testSuite) throws IOException {
Table tableEntity =
Entity.getEntity(
testSuite.getExecutableEntityReference().getType(),
testSuite.getExecutableEntityReference().getId(),
"owner",
ALL);
EntityReference ownerReference = tableEntity.getOwner();
return testSuite.withOwner(ownerReference);
}

@Override
public TestSuite getByNameInternal(
UriInfo uriInfo, SecurityContext securityContext, String name, String fieldsParam, Include include)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,325 @@
{
"settings": {
"analysis": {
"normalizer": {
"lowercase_normalizer": {
"type": "custom",
"char_filter": [],
"filter": [
"lowercase"
]
}
},
"analyzer": {
"om_analyzer": {
"tokenizer": "letter",
"filter": [
"lowercase",
"om_stemmer"
]
},
"om_analyzer_jp" : {
"tokenizer" : "kuromoji_tokenizer",
"type" : "custom",
"filter" : [
"kuromoji_baseform",
"kuromoji_part_of_speech",
"kuromoji_number",
"kuromoji_stemmer"
]
},
"om_ngram": {
"tokenizer": "ngram",
"min_gram": 1,
"max_gram": 2,
"filter": [
"lowercase"
]
}
},
"filter": {
"om_stemmer": {
"type": "stemmer",
"name": "english"
}
}
}
},
"mappings": {
"properties": {
"id": {
"type": "text"
},
"name": {
"type": "text",
"analyzer": "om_analyzer_jp",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
},
"ngram": {
"type": "text",
"analyzer": "om_ngram"
}
}
},
"fullyQualifiedName": {
"type": "keyword",
"normalizer": "lowercase_normalizer"
},
"displayName": {
"type": "text",
"analyzer": "om_analyzer_jp",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
},
"ngram": {
"type": "text",
"analyzer": "om_ngram"
}
}
},
"description": {
"type": "text",
"analyzer": "om_analyzer_jp",
"fields": {
"ngram": {
"type": "text",
"analyzer": "om_ngram"
}
}
},
"entityLink": {
"type": "text"
},
"entityFQN": {
"type": "keyword",
"normalizer": "lowercase_normalizer"
},
"parameterValues": {
"properties": {
"name": {
"type": "text",
"analyzer": "om_analyzer_jp",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
},
"ngram": {
"type": "text",
"analyzer": "om_ngram"
}
}
},
"value": {
"type": "text"
}
}
},
"testDefinition": {
"properties": {
"id": {
"type": "text"
},
"name": {
"type": "text",
"analyzer": "om_analyzer_jp",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
},
"ngram": {
"type": "text",
"analyzer": "om_ngram"
}
}
},
"fullyQualifiedName": {
"type": "keyword",
"normalizer": "lowercase_normalizer"
},
"displayName": {
"type": "text",
"analyzer": "om_analyzer_jp",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
},
"ngram": {
"type": "text",
"analyzer": "om_ngram"
}
}
},
"description": {
"type": "text",
"analyzer": "om_analyzer_jp",
"fields": {
"ngram": {
"type": "text",
"analyzer": "om_ngram"
}
}
},
"entityType": {
"type": "keyword"
},
"testPlatforms": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
},
"owner": {
"properties": {
"id": {
"type": "text"
},
"type": {
"type": "keyword"
},
"name": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"displayName": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"fullyQualifiedName": {
"type": "text"
},
"description": {
"type": "text"
},
"deleted": {
"type": "text"
},
"href": {
"type": "text"
}
}
},
"testSuite": {
"properties": {
"id": {
"type": "text"
},
"name": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"displayName": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"fullyQualifiedName": {
"type": "text"
},
"description": {
"type": "text"
},
"deleted": {
"type": "text"
},
"href": {
"type": "text"
},
"executable": {
"type": "text"
}
}
},
"testSuites": {
"properties": {
"id": {
"type": "text"
},
"name": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"displayName": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"fullyQualifiedName": {
"type": "text"
},
"description": {
"type": "text"
},
"deleted": {
"type": "text"
},
"href": {
"type": "text"
},
"executable": {
"type": "text"
}
}
},
"version": {
"type": "float"
},
"updatedAt": {
"type": "date",
"format": "epoch_second"
},
"updatedBy": {
"type": "text"
},
"href": {
"type": "text"
},
"deleted": {
"type": "text"
}
}
}
}
Loading

0 comments on commit 5cef4c6

Please sign in to comment.