diff --git a/testing/indexer-test-core/src/main/java/org/opengroup/osdu/common/CleanupIndiciesSteps.java b/testing/indexer-test-core/src/main/java/org/opengroup/osdu/common/CleanupIndiciesSteps.java index d15a6668d90540a862167070018333599feb1143..d348fd9d2a48fb4daaad6099f4609fea20882329 100644 --- a/testing/indexer-test-core/src/main/java/org/opengroup/osdu/common/CleanupIndiciesSteps.java +++ b/testing/indexer-test-core/src/main/java/org/opengroup/osdu/common/CleanupIndiciesSteps.java @@ -87,8 +87,8 @@ public class CleanupIndiciesSteps extends TestsBase { records = new Gson().fromJson(fileContent, new TypeToken<List<Map<String, Object>>>() {}.getType()); for (Map<String, Object> testRecord : records) { - testRecord.put("id", generateActualName(testRecord.get("id").toString(), timeStamp)); testRecord.put("kind", actualKind); + testRecord.put("id", generateActualId(testRecord.get("id").toString(), timeStamp, actualKind)); testRecord.put("legal", generateLegalTag()); String[] x_acl = {generateActualName(dataGroup,timeStamp)+"."+getEntitlementsDomain()}; Acl acl = Acl.builder().viewers(x_acl).owners(x_acl).build(); diff --git a/testing/indexer-test-core/src/main/java/org/opengroup/osdu/common/RecordSteps.java b/testing/indexer-test-core/src/main/java/org/opengroup/osdu/common/RecordSteps.java index 3a013e1530b093e9c779890c5a12b230257028b4..948cad79655e474cd4c0639ff4305c3b82d4fd35 100644 --- a/testing/indexer-test-core/src/main/java/org/opengroup/osdu/common/RecordSteps.java +++ b/testing/indexer-test-core/src/main/java/org/opengroup/osdu/common/RecordSteps.java @@ -97,8 +97,8 @@ public class RecordSteps extends TestsBase { records = new Gson().fromJson(fileContent, new TypeToken<List<Map<String, Object>>>() {}.getType()); for (Map<String, Object> testRecord : records) { - testRecord.put("id", generateRecordId(testRecord)); testRecord.put("kind", actualKind); + testRecord.put("id", generateRecordId(testRecord)); testRecord.put("legal", generateLegalTag()); String[] x_acl = {generateActualName(dataGroup,timeStamp)+"."+getEntitlementsDomain()}; Acl acl = Acl.builder().viewers(x_acl).owners(x_acl).build(); @@ -114,7 +114,7 @@ public class RecordSteps extends TestsBase { } protected String generateRecordId(Map<String, Object> testRecord) { - return generateActualName(testRecord.get("id").toString(), timeStamp); + return generateActualId(testRecord.get("id").toString(), timeStamp, testRecord.get("kind").toString()); } public void i_should_get_the_documents_for_the_in_the_Elastic_Search(int expectedCount, String index) throws Throwable { diff --git a/testing/indexer-test-core/src/main/java/org/opengroup/osdu/common/SchemaServiceRecordSteps.java b/testing/indexer-test-core/src/main/java/org/opengroup/osdu/common/SchemaServiceRecordSteps.java index fb7a03e1e3866ae034e6b4cd032d57ba530ac09e..993c26b25b545bcac741b7de314e31b6bd8ed984 100644 --- a/testing/indexer-test-core/src/main/java/org/opengroup/osdu/common/SchemaServiceRecordSteps.java +++ b/testing/indexer-test-core/src/main/java/org/opengroup/osdu/common/SchemaServiceRecordSteps.java @@ -39,7 +39,7 @@ public class SchemaServiceRecordSteps extends RecordSteps { @Override protected String generateRecordId(Map<String, Object> testRecord) { - return generateActualNameWithoutTs(testRecord.get("id").toString()); + return generateActualIdWithoutTs(testRecord.get("id").toString(), testRecord.get("kind").toString()); } @Override diff --git a/testing/indexer-test-core/src/main/java/org/opengroup/osdu/common/TestsBase.java b/testing/indexer-test-core/src/main/java/org/opengroup/osdu/common/TestsBase.java index 53f9e877ae2389457a187d9adc58675dad358d3d..e4d6322f715941c1bc18d5fc82ee9b33ce9e2c97 100644 --- a/testing/indexer-test-core/src/main/java/org/opengroup/osdu/common/TestsBase.java +++ b/testing/indexer-test-core/src/main/java/org/opengroup/osdu/common/TestsBase.java @@ -130,6 +130,17 @@ public abstract class TestsBase { return rawName.replaceAll("<timestamp>", timeStamp); } + protected String generateActualId(String rawName, String timeStamp, String kind) { + + rawName = generateActualName(rawName, timeStamp); + + String kindSubType = kind.split(":")[2]; + + return rawName.replaceAll("<kindSubType>", kindSubType); + + } + + public String generateActualNameWithoutTs(String rawName) { for (Map.Entry<String, String> tenant : tenantMap.entrySet()) { rawName = rawName.replaceAll(tenant.getKey(), tenant.getValue()); @@ -137,6 +148,14 @@ public abstract class TestsBase { return rawName.replaceAll("<timestamp>", ""); } + public String generateActualIdWithoutTs(String rawName, String kind) { + rawName = generateActualNameWithoutTs(rawName); + + String kindSubType = kind.split(":")[2]; + + return rawName.replaceAll("<kindSubType>", kindSubType); + } + protected Legal generateLegalTag() { Legal legal = new Legal(); Set<String> legalTags = new HashSet<>(); diff --git a/testing/indexer-test-core/src/main/resources/features/indexrecord/indexRecord-schema-service.feature b/testing/indexer-test-core/src/main/resources/features/indexrecord/indexRecord-schema-service.feature index 096f997f790e98f69559e074a549a77cb340d488..4152a53252458bd809ae9ffe5da447cf302060d7 100644 --- a/testing/indexer-test-core/src/main/resources/features/indexrecord/indexRecord-schema-service.feature +++ b/testing/indexer-test-core/src/main/resources/features/indexrecord/indexRecord-schema-service.feature @@ -14,9 +14,9 @@ Feature: Indexing of the documents Then I should get the elastic <mapping> for the <type> and <index> in the Elastic Search Examples: - | kind | recordFile | number | index | type | acl | mapping | - | "tenant1:indexer-int-test:sample-schema-1:1.0.4" | "index_records_schema_1" | 5 | "tenant1-indexer-int-test-sample-schema-1-1.0.4" | "sample-schema-1" | "data.default.viewers@tenant1" | "{"mappings":{"well":{"dynamic":"false","properties":{"acl":{"properties":{"owners":{"type":"keyword"},"viewers":{"type":"keyword"}}},"ancestry":{"properties":{"parents":{"type":"keyword"}}},"data":{"properties":{"Basin":{"type":"text"},"Country":{"type":"text"},"County":{"type":"text"},"EmptyAttribute":{"type":"text"},"Established":{"type":"date"},"Field":{"type":"text"},"Location":{"type":"geo_point"},"OriginalOperator":{"type":"text"},"Rank":{"type":"integer"},"Score":{"type":"integer"},"State":{"type":"text"},"WellName":{"type":"text"},"WellStatus":{"type":"text"},"WellType":{"type":"text"},"DblArray":{"type":"double"}}},"id":{"type":"keyword"},"index":{"properties":{"lastUpdateTime":{"type":"date"},"statusCode":{"type":"integer"},"trace":{"type":"text"}}},"kind":{"type":"keyword"},"legal":{"properties":{"legaltags":{"type":"keyword"},"otherRelevantDataCountries":{"type":"keyword"},"status":{"type":"keyword"}}},"namespace":{"type":"keyword"},"type":{"type":"keyword"},"version":{"type":"long"},"x-acl":{"type":"keyword"}}}}}" | - | "tenant1:indexer-int-test:sample-schema-3:1.0.4" | "index_records_schema_1" | 5 | "tenant1-indexer-int-test-sample-schema-3-1.0.4" | "sample-schema-3" | "data.default.viewers@tenant1" | "{"mappings":{"well":{"dynamic":"false","properties":{"acl":{"properties":{"owners":{"type":"keyword"},"viewers":{"type":"keyword"}}},"ancestry":{"properties":{"parents":{"type":"keyword"}}},"data":{"properties":{"Basin":{"type":"text"},"Country":{"type":"text"},"County":{"type":"text"},"EmptyAttribute":{"type":"text"},"Established":{"type":"date"},"Field":{"type":"text"},"Location":{"type":"geo_point"},"OriginalOperator":{"type":"text"},"Rank":{"type":"integer"},"Score":{"type":"integer"},"State":{"type":"text"},"WellName":{"type":"text"},"WellStatus":{"type":"text"},"WellType":{"type":"text"},"DblArray":{"type":"double"}}},"id":{"type":"keyword"},"index":{"properties":{"lastUpdateTime":{"type":"date"},"statusCode":{"type":"integer"},"trace":{"type":"text"}}},"kind":{"type":"keyword"},"legal":{"properties":{"legaltags":{"type":"keyword"},"otherRelevantDataCountries":{"type":"keyword"},"status":{"type":"keyword"}}},"namespace":{"type":"keyword"},"type":{"type":"keyword"},"version":{"type":"long"},"x-acl":{"type":"keyword"}}}}}" | + | kind | recordFile | number | index | type | acl | mapping | + | "tenant1:indexer-int-test:sample-schema-1:1.0.4" | "index_records_1" | 5 | "tenant1-indexer-int-test-sample-schema-1-1.0.4" | "sample-schema-1" | "data.default.viewers@tenant1" | "{"mappings":{"well":{"dynamic":"false","properties":{"acl":{"properties":{"owners":{"type":"keyword"},"viewers":{"type":"keyword"}}},"ancestry":{"properties":{"parents":{"type":"keyword"}}},"data":{"properties":{"Basin":{"type":"text"},"Country":{"type":"text"},"County":{"type":"text"},"EmptyAttribute":{"type":"text"},"Established":{"type":"date"},"Field":{"type":"text"},"Location":{"type":"geo_point"},"OriginalOperator":{"type":"text"},"Rank":{"type":"integer"},"Score":{"type":"integer"},"State":{"type":"text"},"WellName":{"type":"text"},"WellStatus":{"type":"text"},"WellType":{"type":"text"},"DblArray":{"type":"double"}}},"id":{"type":"keyword"},"index":{"properties":{"lastUpdateTime":{"type":"date"},"statusCode":{"type":"integer"},"trace":{"type":"text"}}},"kind":{"type":"keyword"},"legal":{"properties":{"legaltags":{"type":"keyword"},"otherRelevantDataCountries":{"type":"keyword"},"status":{"type":"keyword"}}},"namespace":{"type":"keyword"},"type":{"type":"keyword"},"version":{"type":"long"},"x-acl":{"type":"keyword"}}}}}" | + | "tenant1:indexer-int-test:sample-schema-3:1.0.4" | "index_records_1" | 5 | "tenant1-indexer-int-test-sample-schema-3-1.0.4" | "sample-schema-3" | "data.default.viewers@tenant1" | "{"mappings":{"well":{"dynamic":"false","properties":{"acl":{"properties":{"owners":{"type":"keyword"},"viewers":{"type":"keyword"}}},"ancestry":{"properties":{"parents":{"type":"keyword"}}},"data":{"properties":{"Basin":{"type":"text"},"Country":{"type":"text"},"County":{"type":"text"},"EmptyAttribute":{"type":"text"},"Established":{"type":"date"},"Field":{"type":"text"},"Location":{"type":"geo_point"},"OriginalOperator":{"type":"text"},"Rank":{"type":"integer"},"Score":{"type":"integer"},"State":{"type":"text"},"WellName":{"type":"text"},"WellStatus":{"type":"text"},"WellType":{"type":"text"},"DblArray":{"type":"double"}}},"id":{"type":"keyword"},"index":{"properties":{"lastUpdateTime":{"type":"date"},"statusCode":{"type":"integer"},"trace":{"type":"text"}}},"kind":{"type":"keyword"},"legal":{"properties":{"legaltags":{"type":"keyword"},"otherRelevantDataCountries":{"type":"keyword"},"status":{"type":"keyword"}}},"namespace":{"type":"keyword"},"type":{"type":"keyword"},"version":{"type":"long"},"x-acl":{"type":"keyword"}}}}}" | Scenario Outline: Ingest the record and Index in the Elastic Search with bad attribute When I ingest records with the <recordFile> with <acl> for a given <kind> diff --git a/testing/indexer-test-core/src/main/resources/testData/index_records_1.json b/testing/indexer-test-core/src/main/resources/testData/index_records_1.json index 0d9f3c17ef24167affb538fc7db995317a77c348..81613de69df0524fa6d608ffc8eff55d08cfe1c3 100644 --- a/testing/indexer-test-core/src/main/resources/testData/index_records_1.json +++ b/testing/indexer-test-core/src/main/resources/testData/index_records_1.json @@ -1,6 +1,6 @@ [ { - "id": "tenant1:ihs:testIngest2<timestamp>", + "id": "tenant1:<kindSubType>:testIngest2<timestamp>", "data": { "Field": "OSDU OFFICE - 2", "Location": { @@ -23,7 +23,7 @@ } }, { - "id": "tenant1:ihs:testIngest3<timestamp>", + "id": "tenant1:<kindSubType>:testIngest3<timestamp>", "data": { "Field": "OSDU OFFICE - 2", "Location": { @@ -46,7 +46,7 @@ } }, { - "id": "tenant1:ihs:testIngest4<timestamp>", + "id": "tenant1:<kindSubType>:testIngest4<timestamp>", "data": { "Field": "OSDU OFFICE - 2", "Location": { @@ -68,7 +68,7 @@ } }, { - "id": "tenant1:ihs:testIngest5<timestamp>", + "id": "tenant1:<kindSubType>:testIngest5<timestamp>", "data": { "Field": "OSDU OFFICE - 2", "Location": { @@ -90,7 +90,7 @@ } }, { - "id": "tenant1:ihs:testIngest6<timestamp>", + "id": "tenant1:<kindSubType>:testIngest6<timestamp>", "data": { "Field": "OSDU OFFICE - 2", "Location": { diff --git a/testing/indexer-test-core/src/main/resources/testData/index_records_2.json b/testing/indexer-test-core/src/main/resources/testData/index_records_2.json index 9c35fcd6e58bcd19e01eef2b858ce19b7efcea71..ed11325951b0bc1194eb08ca0a9323358917bee2 100644 --- a/testing/indexer-test-core/src/main/resources/testData/index_records_2.json +++ b/testing/indexer-test-core/src/main/resources/testData/index_records_2.json @@ -1,6 +1,6 @@ [ { - "id": "tenant1:ihs:testIngest7<timestamp>", + "id": "tenant1:<kindSubType>:testIngest7<timestamp>", "data": { "Field": "OSDU OFFICE - 2", "Location": { @@ -22,7 +22,7 @@ } }, { - "id": "tenant1:ihs:testIngest8<timestamp>", + "id": "tenant1:<kindSubType>:testIngest8<timestamp>", "data": { "Field": "OSDU OFFICE - 2", "Location": { @@ -44,7 +44,7 @@ } }, { - "id": "tenant1:ihs:testIngest9<timestamp>", + "id": "tenant1:<kindSubType>:testIngest9<timestamp>", "data": { "Field": "OSDU OFFICE - 2", "Location": { @@ -66,7 +66,7 @@ } }, { - "id": "tenant1:ihs:testIngest10<timestamp>", + "id": "tenant1:<kindSubType>:testIngest10<timestamp>", "data": { "Field": "OSDU OFFICE - 2", "Location": { @@ -88,7 +88,7 @@ } }, { - "id": "tenant1:ihs:testIngest11<timestamp>", + "id": "tenant1:<kindSubType>:testIngest11<timestamp>", "data": { "Field": 1234, "Location": { diff --git a/testing/indexer-test-core/src/main/resources/testData/index_records_3.json b/testing/indexer-test-core/src/main/resources/testData/index_records_3.json index 84c5fcc11fcf96a68dba9c4d90ab06d9efa60c62..983e7bdb99dbe39246cc4ece07a9b3d434bddb5d 100644 --- a/testing/indexer-test-core/src/main/resources/testData/index_records_3.json +++ b/testing/indexer-test-core/src/main/resources/testData/index_records_3.json @@ -1,6 +1,6 @@ [ { - "id": "tenant1:ihs:testIngest51<timestamp>", + "id": "tenant1:<kindSubType>:testIngest51<timestamp>", "data": { "WellName": "Data Platform Services - 51", "GeoShape": { @@ -13,7 +13,7 @@ } }, { - "id": "tenant1:ihs:testIngest52<timestamp>", + "id": "tenant1:<kindSubType>:testIngest52<timestamp>", "data": { "WellName": "Data Platform Services - 52", "GeoShape": { @@ -32,7 +32,7 @@ } }, { - "id": "tenant1:ihs:testIngest53<timestamp>", + "id": "tenant1:<kindSubType>:testIngest53<timestamp>", "data": { "WellName": "Data Platform Services - 53", "GeoShape": { @@ -147,7 +147,7 @@ } }, { - "id": "tenant1:ihs:testIngest54<timestamp>", + "id": "tenant1:<kindSubType>:testIngest54<timestamp>", "data": { "WellName": "Data Platform Services - 54", "GeoShape": { @@ -238,7 +238,7 @@ } }, { - "id": "tenant1:ihs:testIngest55<timestamp>", + "id": "tenant1:<kindSubType>:testIngest55<timestamp>", "data": { "WellName": "Data Platform Services - 55", "GeoShape": { @@ -271,7 +271,7 @@ } }, { - "id": "tenant1:ihs:testIngest56<timestamp>", + "id": "tenant1:<kindSubType>:testIngest56<timestamp>", "data": { "WellName": "Data Platform Services - 56", "GeoShape": { @@ -330,7 +330,7 @@ } }, { - "id": "tenant1:ihs:testIngest57<timestamp>", + "id": "tenant1:<kindSubType>:testIngest57<timestamp>", "data": { "WellName": "Data Platform Services - 57", "GeoShape": { diff --git a/testing/indexer-test-core/src/main/resources/testData/records_1.json b/testing/indexer-test-core/src/main/resources/testData/records_1.json index 14d4b3c84ec863530213737e76cd8494501e825f..33c85b80d024481be7ae416ba9bf6865fef2aa4c 100644 --- a/testing/indexer-test-core/src/main/resources/testData/records_1.json +++ b/testing/indexer-test-core/src/main/resources/testData/records_1.json @@ -1,6 +1,6 @@ [ { - "id": "test:well:1.0.0:1", + "id": "tenant1:well:1.0.0:1", "kind": "<Kind>", "namespace": "tenant1:testdatasource", "type": "well", @@ -38,7 +38,7 @@ } }, { - "id": "test:well:1.0.0:2", + "id": "tenant1:well:1.0.0:2", "kind": "<Kind>", "namespace": "tenant1:testdatasource", "type": "well", @@ -77,7 +77,7 @@ } }, { - "id": "test:well:1.0.0:3", + "id": "tenant1:well:1.0.0:3", "kind": "<Kind>", "namespace": "tenant1:testdatasource", "type": "well", diff --git a/testing/indexer-test-core/src/main/resources/testData/records_2.json b/testing/indexer-test-core/src/main/resources/testData/records_2.json index 12f9ac646e579619b094aa19e571a863b8e23cac..9227d617e772aeb1d1fd0196b3540d04e9ca62ae 100644 --- a/testing/indexer-test-core/src/main/resources/testData/records_2.json +++ b/testing/indexer-test-core/src/main/resources/testData/records_2.json @@ -1,6 +1,6 @@ [ { - "id": "test:well:2.0.0:1", + "id": "tenant1:well:2.0.0:1", "kind": "<kind>", "acl": "{viewers=[<Data-Group>], owners=[<Data-Group>]}", "x-acl": [ @@ -37,7 +37,7 @@ } }, { - "id": "test:well:2.0.0:2", + "id": "tenant1:well:2.0.0:2", "kind": "<kind>", "acl": "{viewers=[<Data-Group>], owners=[<Data-Group>]}", "x-acl": [ @@ -74,7 +74,7 @@ } }, { - "id": "test:well:2.0.0:3", + "id": "tenant1:well:2.0.0:3", "kind": "<kind>", "acl": "{viewers=[<Data-Group>], owners=[<Data-Group>]}", "x-acl": [ diff --git a/testing/indexer-test-core/src/main/resources/testData/records_3.json b/testing/indexer-test-core/src/main/resources/testData/records_3.json index a159d885c7a108d19c6831502192c93667323f2e..697644cc7d20c7a768d3cc55183a9d4a788e99cb 100644 --- a/testing/indexer-test-core/src/main/resources/testData/records_3.json +++ b/testing/indexer-test-core/src/main/resources/testData/records_3.json @@ -1,6 +1,6 @@ [ { - "id": "test:well:1.0.0:1", + "id": "tenant1:well:1.0.0:1", "kind": "<Kind>", "namespace": "tenant1:testdatasource", "type": "well", @@ -39,7 +39,7 @@ } }, { - "id": "test:well:1.0.0:2", + "id": "tenant1:well:1.0.0:2", "kind": "<Kind>", "namespace": "tenant1:testdatasource", "type": "well", @@ -79,7 +79,7 @@ } }, { - "id": "test:well:1.0.0:3", + "id": "tenant1:well:1.0.0:3", "kind": "<Kind>", "namespace": "tenant1:testdatasource", "type": "well",