Commit a180ead4 authored by harshit aggarwal's avatar harshit aggarwal
Browse files

Fixing broken ITs

parent 308ff5c7
Pipeline #24615 failed with stages
in 2 minutes and 24 seconds
......@@ -639,7 +639,7 @@ public class IntegrationTestStepDefs implements En {
targetSchemaKindInMapping = targetSchemaKindInMapping.replace(AutomationConstants.COLON_SEPARATOR, AutomationConstants.POINT);
String[] kindStrArr = targetSchemaKind.split(AutomationConstants.COLON_SEPARATOR);
return idStrArr[0] + AutomationConstants.COLON_SEPARATOR + AutomationConstants.WKS_KIND + AutomationConstants.COLON_SEPARATOR + kindStrArr[2]
return idStrArr[0] + AutomationConstants.COLON_SEPARATOR + kindStrArr[2] + AutomationConstants.COLON_SEPARATOR + AutomationConstants.WKS_KIND
+ AutomationConstants.DASH + uniqueId + AutomationConstants.POINT + targetSchemaKindInMapping;
}
......@@ -739,14 +739,20 @@ public class IntegrationTestStepDefs implements En {
private String generateRandomId(String body) {
String rawRecordKind = extractKind(body).replace("[", "").replace("]", "");
String idPrefix = rawRecordKind.substring(0, rawRecordKind.lastIndexOf(":"));
String rawRecordId = idPrefix + "-integrationTestData" + RandomStringUtils.randomAlphabetic(15);
LOGGER.log(Level.INFO, "Current Record : " + rawRecordId);
return rawRecordId;
return generateRawRecordId(rawRecordKind);
}
private String generateRawRecordId(String os_wks_kind) {
String idPrefix = os_wks_kind.substring(0, os_wks_kind.lastIndexOf(":"));
KindsUtil kindsUtil = new KindsUtil();
String authority = kindsUtil.retrieveAuthorityName(os_wks_kind);
String entityType = kindsUtil.retrieveEntityName(os_wks_kind);
String source = kindsUtil.retrieveSourceName(os_wks_kind);
String idPrefix = authority.concat(AutomationConstants.COLON_SEPARATOR)
.concat(entityType)
.concat(AutomationConstants.COLON_SEPARATOR)
.concat(source);
String rawRecordId = idPrefix + "-integrationTestData" + RandomStringUtils.randomAlphabetic(15);
LOGGER.log(Level.INFO, "Current Record : " + rawRecordId);
return rawRecordId;
......
package org.opengroup.osdu.wks.util;
import org.opengroup.osdu.wks.constants.Constants;
import org.opengroup.osdu.wks.constants.SchemaConstants;
import java.util.stream.Stream;
......@@ -21,4 +22,25 @@ public class KindsUtil {
return String.join(Constants.POINT, kindUptoMajorVersion, minorVersion, patchVersion);
}
public String retrieveAuthorityName(String kind) {
String[] idArr = kind.split(Constants.COLON_SEPARATOR);
return idArr[SchemaConstants.AUTHORITY_INDEX];
}
public String retrieveEntityName(String id) {
String[] idArr = id.split(Constants.COLON_SEPARATOR);
return idArr[SchemaConstants.ENTITY_INDEX];
}
public String retrieveSourceName(String id) {
String[] idArr = id.split(Constants.COLON_SEPARATOR);
return idArr[SchemaConstants.SOURCE_INDEX];
}
public String retrieveMajorVersion(String kind) {
String[] idArr = kind.split(Constants.COLON_SEPARATOR);
String version = idArr[SchemaConstants.VERSION_INDEX];
return version.split("\\.")[0];
}
}
{
"wellbore": {
"id": "<tenant_name>:wks:wellbore-b3BlbmRlczphdDp3ZWxsYm9yZS1NdWx0aXBsZVJlY29yZFZlcnNpb24"
"id": "<tenant_name>:wellbore:wks-b3BlbmRlczphdDp3ZWxsYm9yZS1NdWx0aXBsZVJlY29yZFZlcnNpb24"
}
}
......@@ -4,7 +4,7 @@
"Spud date": "atspud",
"UWI": "rawHavingWksCreated"
},
"id": "<tenant_name>:at:wellbore-record1ForMultipleRelatedEntityCheck",
"id": "<tenant_name>:wellbore:at-record1ForMultipleRelatedEntityCheck",
"kind": "<tenant_name>:at:wellbore:1.0.0",
"acl": {
"viewers": [
......@@ -30,7 +30,7 @@
"Spud date": "atspud",
"UWI": "rawHavingWksCreated"
},
"id": "<tenant_name>:at:wellbore-record2ForMultipleRelatedEntityCheck",
"id": "<tenant_name>:wellbore:at-record2ForMultipleRelatedEntityCheck",
"kind": "<tenant_name>:at:wellbore:1.0.0",
"acl": {
"viewers": [
......
......@@ -3,7 +3,7 @@
"data": {
"UWI": "wksWithLowerMajorVersion"
},
"id": "<tenant_name>:wks:wksMapping-lowerMajorVersion",
"id": "<tenant_name>:wksMapping:wks-lowerMajorVersion",
"kind": "<tenant_name>:wks:wksMapping:1.0.0",
"acl": {
"viewers": [
......@@ -24,7 +24,7 @@
},
"ancestry": {
"parents": [
"<tenant_name>:no:wksMapping-rawHavingMultipleWksCreated:<rawRecordLatestVersion>"
"<tenant_name>:wksMapping:no-rawHavingMultipleWksCreated:<rawRecordLatestVersion>"
]
}
},
......@@ -32,7 +32,7 @@
"data": {
"UWI": "wksWithHigherMajorVersion"
},
"id": "<tenant_name>:wks:wksMapping-higherMajorVersion",
"id": "<tenant_name>:wksMapping:wks-higherMajorVersion",
"kind": "<tenant_name>:wks:wksMapping:2.0.0",
"acl": {
"viewers": [
......@@ -53,7 +53,7 @@
},
"ancestry": {
"parents": [
"<tenant_name>:no:wksMapping-rawHavingMultipleWksCreated:<rawRecordLatestVersion>"
"<tenant_name>:wksMapping:no-rawHavingMultipleWksCreated:<rawRecordLatestVersion>"
]
}
}
......
......@@ -4,7 +4,7 @@
"Spud date": "atspud",
"UWI": "version1"
},
"id": "<tenant_name>:at:wellbore-MultipleRecordVersion",
"id": "<tenant_name>:wellbore:at-MultipleRecordVersion",
"kind": "<tenant_name>:at:wellbore:1.0.0",
"acl": {
"viewers": [
......
......@@ -4,7 +4,7 @@
"Spud date": "atspud",
"UWI": "version2"
},
"id": "<tenant_name>:at:wellbore-MultipleRecordVersion",
"id": "<tenant_name>:wellbore:at-MultipleRecordVersion",
"kind": "<tenant_name>:at:wellbore:1.0.0",
"acl": {
"viewers": [
......
......@@ -4,7 +4,7 @@
"Spud date": "atspud",
"UWI": "rawHavingWksCreated"
},
"id": "<tenant_name>:no:wksMapping-rawHavingMultipleWksCreated",
"id": "<tenant_name>:wksMapping:no-rawHavingMultipleWksCreated",
"kind": "<tenant_name>:no:wksMapping:1.0.0",
"acl": {
"viewers": [
......
......@@ -4,7 +4,7 @@
"Spud date": "atspud",
"UWI": "rawHavingWksCreated"
},
"id": "<tenant_name>:no:wksMapping-rawHavingNoWksCreated",
"id": "<tenant_name>:wksMapping:no-rawHavingNoWksCreated",
"kind": "<tenant_name>:no:wksMapping:1.0.0",
"acl": {
"viewers": [
......
......@@ -4,7 +4,7 @@
"Spud date": "atspud",
"UWI": "rawHavingWksCreated"
},
"id": "<tenant_name>:at:wellbore-rawHavingWksCreated",
"id": "<tenant_name>:wellbore:at-rawHavingWksCreated",
"kind": "<tenant_name>:at:wellbore:1.0.0",
"acl": {
"viewers": [
......
......@@ -4,7 +4,7 @@
"Spud date": "atspud",
"UWI": "rawHavingWksCreated"
},
"id": "<tenant_name>:ihs:log-rawHavingWksCreated",
"id": "<tenant_name>:log:ihs-rawHavingWksCreated",
"kind": "<tenant_name>:ihs:log:1.0.0",
"acl": {
"viewers": [
......
......@@ -4,7 +4,7 @@
"Spud date": "atspud",
"UWI": "rawHavingWksCreated"
},
"id": "<tenant_name>:oga:well-rawHavingWksCreated",
"id": "<tenant_name>:well-oga-rawHavingWksCreated",
"kind": "<tenant_name>:oga:well:1.0.0",
"acl": {
"viewers": [
......
......@@ -5,7 +5,7 @@
"id": "<CreateUniqueID>",
"ancestry": {
"parents": [
"<tenant_name>:oga:well-rawHavingWksCreated"
"<tenant_name>:well:oga-rawHavingWksCreated"
]
},
"kind": "<tenant_name>:no:wksMapping:1.0.0",
......
......@@ -3,7 +3,7 @@
"data": {
"relationships": {
"wellbore": {
"id": "<tenant_name>:no:wksMapping-rawHavingMultipleWksCreated"
"id": "<tenant_name>:wksMapping:no-rawHavingMultipleWksCreated"
}
}
},
......
......@@ -3,7 +3,7 @@
"data": {
"relationships": {
"wellbore": {
"id": "<tenant_name>:at:wellbore-MultipleRecordVersion"
"id": "<tenant_name>:wellbore:at-MultipleRecordVersion"
}
}
},
......
......@@ -3,7 +3,7 @@
"data": {
"relationships": {
"wellbore": {
"id": "<tenant_name>:no:wksMapping-rawHavingNoWksCreated"
"id": "<tenant_name>:wksMapping:no-rawHavingNoWksCreated"
}
}
},
......
......@@ -3,7 +3,7 @@
"data": {
"relationships": {
"wellbore": {
"id": "<tenant_name>:at:wellbore-rawHavingWksCreated"
"id": "<tenant_name>:wellbore:at-rawHavingWksCreated"
}
}
},
......
......@@ -3,7 +3,7 @@
"data": {
"relationships": {
"wellbore": {
"id": "<tenant_name>:ihs:log-rawHavingWksCreated"
"id": "<tenant_name>:log:ihs-rawHavingWksCreated"
}
}
},
......
......@@ -3,7 +3,7 @@
"data": {
"relationships": {
"wellbore": {
"id": "<tenant_name>:oga:well-rawHavingWksCreated"
"id": "<tenant_name>:well:oga-rawHavingWksCreated"
}
}
},
......
......@@ -4,8 +4,8 @@
"relationships": {
"wellbores": {
"ids": [
"<tenant_name>:at:wellbore-record1ForMultipleRelatedEntityCheck",
"<tenant_name>:at:wellbore-record2ForMultipleRelatedEntityCheck"
"<tenant_name>:wellbore:at-record1ForMultipleRelatedEntityCheck",
"<tenant_name>:wellbore:at-record2ForMultipleRelatedEntityCheck"
],
"names": [
"record1ForMultipleRelatedEntityCheck",
......
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