Commit d69a9258 authored by RPrakash3's avatar RPrakash3
Browse files

Changes to make IT cloud agnostic

parent 16656a1f
Pipeline #14920 passed with stages
in 11 minutes and 22 seconds
......@@ -66,11 +66,11 @@ public class IntegrationTestStepDefs implements En {
});
And("Required schema are created", () -> {
String payload = this.context.getFileUtils().read(getFileName(rawSchemaForWhichMappingIsPresent));
String payload = this.context.getFileUtils().read(rawSchemaForWhichMappingIsPresent);
payload = updatePlaceholdersInInputPayload(payload);
postToStorageSchema(payload);
payload = this.context.getFileUtils().read(getFileName(rawSchemaForWhichMappingIsNotPresent));
payload = this.context.getFileUtils().read(rawSchemaForWhichMappingIsNotPresent);
payload = updatePlaceholdersInInputPayload(payload);
postToStorageSchema(payload);
});
......@@ -78,7 +78,7 @@ public class IntegrationTestStepDefs implements En {
Given("I hit Storage service put end point with {string} which is already a WKS record",
(String inputPayload) -> {
String payload = this.context.getFileUtils().read(getFileName(inputPayload));
String payload = this.context.getFileUtils().read(inputPayload);
payload = updatePlaceholdersInInputPayload(payload);
String recordId = generateRawRecordId(AutomationConstants.OS_WKS_SCHEMA_KIND);
this.context.setCustomRecordId(recordId);
......@@ -97,7 +97,7 @@ public class IntegrationTestStepDefs implements En {
Given("I hit Storage service put end point with {string} which is already a WKE record",
(String inputPayload) -> {
String payload = this.context.getFileUtils().read(getFileName(inputPayload));
String payload = this.context.getFileUtils().read(inputPayload);
payload = updatePlaceholdersInInputPayload(payload);
String kindVal = (AutomationConstants.OS_WKS_SCHEMA_KIND).replace("wks:", "wke:");
String recordId = generateRawRecordId(kindVal);
......@@ -119,7 +119,7 @@ public class IntegrationTestStepDefs implements En {
Given("I hit Storage service put end point with {string} which has invalid source so that mapping service does not return any mapping",
(String inputPayload) -> {
String payload = this.context.getFileUtils().read(getFileName(inputPayload));
String payload = this.context.getFileUtils().read(inputPayload);
payload = updatePlaceholdersInInputPayload(payload);
String recordId = generateRandomId(payload);
this.context.setCustomRecordId(recordId);
......@@ -140,7 +140,7 @@ public class IntegrationTestStepDefs implements En {
});
Given("I hit Storage service put end point with {string}", (String inputPayload) -> {
String payload = this.context.getFileUtils().read(getFileName(inputPayload));
String payload = this.context.getFileUtils().read(inputPayload);
payload = updatePlaceholdersInInputPayload(payload);
String recordId = generateRandomId(payload);
this.context.setCustomRecordId(recordId);
......@@ -166,7 +166,7 @@ public class IntegrationTestStepDefs implements En {
});
When("I hit Storage service put end point to update raw record with {string}", (String updatePayload) -> {
String payload = this.context.getFileUtils().read(getFileName(updatePayload));
String payload = this.context.getFileUtils().read(updatePayload);
payload = updatePlaceholdersInInputPayload(payload);
String existingRecordInStorage = this.context.getCustomRecordId();
this.context.setCustomValToVerifyUpdateOperation(RandomStringUtils.randomAlphabetic(10));
......@@ -223,8 +223,8 @@ public class IntegrationTestStepDefs implements En {
(String expectedWksRecord, String mappingFile) -> {
String actualWksDataBlock = new JsonPath(this.context.getHttpResponse().getBody()).get("data")
.toString();
String expectedWksDataBlock = new JsonPath(
this.context.getFileUtils().read(getFileName(expectedWksRecord))).get("data").toString();
String expectedWksDataBlock = new JsonPath(this.context.getFileUtils().read(expectedWksRecord))
.get("data").toString();
assertEquals("Expected: " + expectedWksDataBlock + " , Actual: " + actualWksDataBlock,
expectedWksDataBlock, actualWksDataBlock);
});
......@@ -247,8 +247,8 @@ public class IntegrationTestStepDefs implements En {
(String expectedWksRecord, String mappingFile) -> {
String actualWksMetaBlock = new JsonPath(this.context.getHttpResponse().getBody()).get("meta")
.toString();
String expectedWksMetaBlock = new JsonPath(
this.context.getFileUtils().read(getFileName(expectedWksRecord))).get("meta").toString();
String expectedWksMetaBlock = new JsonPath(this.context.getFileUtils().read(expectedWksRecord))
.get("meta").toString();
assertEquals("Expected: " + expectedWksMetaBlock + " , Actual: " + actualWksMetaBlock,
expectedWksMetaBlock, actualWksMetaBlock);
......@@ -256,7 +256,7 @@ public class IntegrationTestStepDefs implements En {
When("I hit Storage service put end point with {string} having multiple records where few records are already Wks records",
(String bulkRecord) -> {
String payload = this.context.getFileUtils().read(getFileName(bulkRecord));
String payload = this.context.getFileUtils().read(bulkRecord);
payload = updatePlaceholdersInInputPayload(payload);
JsonArray bulkRecords = new Gson().fromJson(payload, JsonArray.class);
List<String> recordList = new ArrayList<String>();
......@@ -428,7 +428,7 @@ public class IntegrationTestStepDefs implements En {
JsonObject respBody = new Gson().fromJson(this.context.getHttpResponse().getBody(), JsonObject.class);
String actualWksRelationshipsBlock = ((JsonObject) ((JsonObject) respBody.get("data")).get("relationships"))
.toString();
String relationshipsString = this.context.getFileUtils().read(getFileName(expectedRelationshipBlock));
String relationshipsString = this.context.getFileUtils().read(expectedRelationshipBlock);
relationshipsString = updatePlaceholdersInInputPayload(relationshipsString);
String expectedWksRelationshipsBlock = new Gson().fromJson(relationshipsString, JsonObject.class).toString();
assertTrue("expected - " + expectedWksRelationshipsBlock + " , actual - " + actualWksRelationshipsBlock,
......@@ -469,7 +469,7 @@ public class IntegrationTestStepDefs implements En {
break;
customStaticWaitForSeconds(10);
}
LOGGER.log(Level.INFO, "Storage Response : " + this.context.getHttpResponse());
LOGGER.log(Level.INFO, "Storage Response for searching WKS record: " + this.context.getHttpResponse());
return responseCode;
}
......@@ -588,28 +588,8 @@ public class IntegrationTestStepDefs implements En {
return responseCode;
}
private String getFileName(String fileName) {
String vendor = this.context.getVendor();
switch (vendor) {
case "gcp":
// Filename generation code for gcp comes here
break;
case "aws":
// Filename generation code for aws comes here
break;
case "azure":
fileName = "/azure_" + fileName.substring(1);
break;
case "ibm":
// Filename generation code for ibm comes here
break;
}
return fileName;
}
private void persistRecordToBeUsedInRelationshipBlock(String inputPayload) throws IOException {
String payload = this.context.getFileUtils().read(getFileName(inputPayload));
String payload = this.context.getFileUtils().read(inputPayload);
payload = updatePlaceholdersInInputPayload(payload);
postToStorage(payload);
LOGGER.log(Level.INFO, "Storage Post Response : " + this.context.getHttpResponse().getBody());
......@@ -637,7 +617,7 @@ public class IntegrationTestStepDefs implements En {
}
private void persistRecordWithRelationshipBlock(String inputPayload) throws IOException {
String payload = this.context.getFileUtils().read(getFileName(inputPayload));
String payload = this.context.getFileUtils().read(inputPayload);
payload = updatePlaceholdersInInputPayload(payload);
String recordId = generateRandomId(payload);
this.context.setCustomRecordId(recordId);
......@@ -675,7 +655,7 @@ public class IntegrationTestStepDefs implements En {
}
private void persistWksRecords(String inputPayload) throws IOException {
String payload = this.context.getFileUtils().read(getFileName(inputPayload));
String payload = this.context.getFileUtils().read(inputPayload);
payload = updatePlaceholdersInInputPayload(payload);
payload = payload.replace("<rawRecordLatestVersion>", this.context.getFileVersion());
postToStorage(payload);
......@@ -683,26 +663,6 @@ public class IntegrationTestStepDefs implements En {
}
private String updatePlaceholdersInInputPayload(String payload) {
String vendor = this.context.getVendor();
switch (vendor) {
case "gcp":
payload = updatePlaceholders_gcp(payload);
break;
case "aws":
// placeholder update logic for aws
break;
case "azure":
// placeholder update logic for azure
break;
case "ibm":
// placeholder update logic for ibm
break;
}
return payload;
}
private String updatePlaceholders_gcp(String payload) {
payload = payload
.replaceAll(AutomationConstants.TENANT_NAME_PLACEHOLDER,
AutomationConstants.TENANT_NAME_PLACEHOLDER_VALUE)
......
{
"data": {
"spudDate": "atspud",
"dlWGS84": {
"latitude": "NaN",
"longitude": "NaN"
}
},
"meta": [
{
"kind": "Unit",
"name": "m",
"persistableReference": "{\"scaleOffset\":{\"scale\":1.0,\"offset\":0.0},\"symbol\":\"m\",\"baseMeasurement\":{\"ancestry\":\"Length\",\"type\":\"UM\"},\"type\":\"USO\"}",
"propertyNames": [
"spudDate"
]
},
{
"kind": "CRS",
"name": "ED50 * EPSG-Nor N62 2001 / UTM zone 31N [23031,1612]",
"persistableReference": "{\"lateBoundCRS\":{\"wkt\":\"PROJCS[\\\"ED_1950_UTM_Zone_31N\\\",GEOGCS[\\\"GCS_European_1950\\\",DATUM[\\\"D_European_1950\\\",SPHEROID[\\\"International_1924\\\",6378388.0,297.0]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433]],PROJECTION[\\\"Transverse_Mercator\\\"],PARAMETER[\\\"False_Easting\\\",500000.0],PARAMETER[\\\"False_Northing\\\",0.0],PARAMETER[\\\"Central_Meridian\\\",3.0],PARAMETER[\\\"Scale_Factor\\\",0.9996],PARAMETER[\\\"Latitude_Of_Origin\\\",0.0],UNIT[\\\"Meter\\\",1.0],AUTHORITY[\\\"EPSG\\\",23031]]\",\"ver\":\"PE_10_3_1\",\"name\":\"ED_1950_UTM_Zone_31N\",\"authCode\":{\"auth\":\"EPSG\",\"code\":\"23031\"},\"type\":\"LBC\"},\"singleCT\":{\"wkt\":\"GEOGTRAN[\\\"ED_1950_To_WGS_1984_23\\\",GEOGCS[\\\"GCS_European_1950\\\",DATUM[\\\"D_European_1950\\\",SPHEROID[\\\"International_1924\\\",6378388.0,297.0]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433]],GEOGCS[\\\"GCS_WGS_1984\\\",DATUM[\\\"D_WGS_1984\\\",SPHEROID[\\\"WGS_1984\\\",6378137.0,298.257223563]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433]],METHOD[\\\"Position_Vector\\\"],PARAMETER[\\\"X_Axis_Translation\\\",-116.641],PARAMETER[\\\"Y_Axis_Translation\\\",-56.931],PARAMETER[\\\"Z_Axis_Translation\\\",-110.559],PARAMETER[\\\"X_Axis_Rotation\\\",0.893],PARAMETER[\\\"Y_Axis_Rotation\\\",0.921],PARAMETER[\\\"Z_Axis_Rotation\\\",-0.917],PARAMETER[\\\"Scale_Difference\\\",-3.52],AUTHORITY[\\\"EPSG\\\",1612]]\",\"ver\":\"PE_10_3_1\",\"name\":\"ED_1950_To_WGS_1984_23\",\"authCode\":{\"auth\":\"EPSG\",\"code\":\"1612\"},\"type\":\"ST\"},\"ver\":\"PE_10_3_1\",\"name\":\"ED50 * EPSG-Nor N62 2001 / UTM zone 31N [23031,1612]\",\"authCode\":{\"auth\":\"\",\"code\":\"23031023\"},\"type\":\"EBC\"}",
"propertyNames": [
"dlWGS84.latitude",
"dlWGS84.longitude"
]
}
],
"id": "<WksRecordId>",
"ancestry": {
"parents": [
"<rawRecordId>:<rawRecordVersion>"
]
},
"kind": "opendes:wks:wellbore:1.0.0",
"acl": {
"viewers": [
"data.test1@opendes.contoso.com"
],
"owners": [
"data.test1@opendes.contoso.com"
]
},
"legal": {
"legaltags": [
"opendes-storage-1594757987127"
],
"otherRelevantDataCountries": [
"BR"
],
"status": "compliant"
}
}
{
"wksSchemaKind": "opendes:wks:wellbore:1.0.0",
"attributeMappings": [
{
"rawAttributeName": "acl",
"wksAttributeName": "acl"
},
{
"rawAttributeName": "ancestry",
"wksAttributeName": "ancestry"
},
{
"rawAttributeName": "id",
"wksAttributeName": "id"
},
{
"rawAttributeName": "kind",
"wksAttributeName": "kind"
},
{
"rawAttributeName": "legal",
"wksAttributeName": "legal"
},
{
"rawAttributeName": "meta",
"wksAttributeName": "meta"
},
{
"rawAttributeName": "version",
"wksAttributeName": "version"
},
{
"rawAttributeName": "data.Spud date",
"wksAttributeName": "data.spudDate"
},
{
"rawAttributeName": "data.UWI",
"wksAttributeName": "data.uwi"
},
{
"rawAttributeName": "data.dlLatLongWGS84.latitude",
"wksAttributeName": "data.dlWGS84.latitude"
},
{
"rawAttributeName": "data.dlLatLongWGS84.longitude",
"wksAttributeName": "data.dlWGS84.longitude"
}
]
}
[
{
"data": {
"Spud date": "atspud",
"UWI": "record1"
},
"id": "<CreateUniqueID1>",
"kind": "opendes:at:wellbore:1.0.0",
"acl": {
"viewers": [
"data.test1@opendes.contoso.com"
],
"owners": [
"data.test1@opendes.contoso.com"
]
},
"legal": {
"legaltags": [
"opendes-storage-1594757987127"
],
"otherRelevantDataCountries": [
"BR"
],
"status": "compliant"
},
"createUser": "integrationtest@opendes.iam.gserviceaccount.com",
"createTime": "2020-06-01T18:32:52.054Z",
"modifyUser": "integrationtest@opendes.iam.gserviceaccount.com",
"modifyTime": "2020-06-02T08:43:51.553Z"
},
{
"data": {
"Spud date": "atspud",
"UWI": "record2"
},
"id": "<CreateUniqueID2>",
"kind": "opendes:wks:wellbore:1.0.0",
"acl": {
"viewers": [
"data.test1@opendes.contoso.com"
],
"owners": [
"data.test1@opendes.contoso.com"
]
},
"legal": {
"legaltags": [
"opendes-storage-1594757987127"
],
"otherRelevantDataCountries": [
"BR"
],
"status": "compliant"
},
"createUser": "integrationtest@opendes.iam.gserviceaccount.com",
"createTime": "2020-06-01T18:32:52.054Z",
"modifyUser": "integrationtest@opendes.iam.gserviceaccount.com",
"modifyTime": "2020-06-02T08:43:51.553Z"
},
{
"data": {
"Spud date": "atspud",
"UWI": "record3"
},
"id": "<CreateUniqueID3>",
"kind": "opendes:at:wellbore:1.0.0",
"acl": {
"viewers": [
"data.test1@opendes.contoso.com"
],
"owners": [
"data.test1@opendes.contoso.com"
]
},
"legal": {
"legaltags": [
"opendes-storage-1594757987127"
],
"otherRelevantDataCountries": [
"BR"
],
"status": "compliant"
},
"createUser": "integrationtest@opendes.iam.gserviceaccount.com",
"createTime": "2020-06-01T18:32:52.054Z",
"modifyUser": "integrationtest@opendes.iam.gserviceaccount.com",
"modifyTime": "2020-06-02T08:43:51.553Z"
}
]
[
{
"data": {
"Spud date": "atspud",
"UWI": "<RandomText>"
},
"id": "<CreateUniqueID>",
"version": 1591087431362345,
"kind": "opendes:at:wellbore:1.0.0",
"acl": {
"viewers": [
"data.test1@opendes.contoso.com"
],
"owners": [
"data.test1@opendes.contoso.com"
]
},
"legal": {
"legaltags": [
"opendes-storage-1594757987127"
],
"otherRelevantDataCountries": [
"BR"
],
"status": "compliant"
},
"createUser": "integrationtest@opendes.iam.gserviceaccount.com",
"createTime": "2020-06-01T18:32:52.054Z",
"modifyUser": "integrationtest@opendes.iam.gserviceaccount.com",
"modifyTime": "2020-06-02T08:43:51.553Z"
}
]
[
{
"data": {
"Spud date": "atspud",
"uwi": "UlHnMzBZgA",
"dlLatLongWGS84": {
"latitude": "NaN",
"longitude": "NaN"
}
},
"meta": [
{
"kind": "Unit",
"name": "m",
"persistableReference": "{\"scaleOffset\":{\"scale\":1.0,\"offset\":0.0},\"symbol\":\"m\",\"baseMeasurement\":{\"ancestry\":\"Length\",\"type\":\"UM\"},\"type\":\"USO\"}",
"propertyNames": [
"Spud date",
"Latitude",
"Well datum name"
]
},
{
"kind": "CRS",
"name": "ED50 * EPSG-Nor N62 2001 / UTM zone 31N [23031,1612]",
"persistableReference": "{\"lateBoundCRS\":{\"wkt\":\"PROJCS[\\\"ED_1950_UTM_Zone_31N\\\",GEOGCS[\\\"GCS_European_1950\\\",DATUM[\\\"D_European_1950\\\",SPHEROID[\\\"International_1924\\\",6378388.0,297.0]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433]],PROJECTION[\\\"Transverse_Mercator\\\"],PARAMETER[\\\"False_Easting\\\",500000.0],PARAMETER[\\\"False_Northing\\\",0.0],PARAMETER[\\\"Central_Meridian\\\",3.0],PARAMETER[\\\"Scale_Factor\\\",0.9996],PARAMETER[\\\"Latitude_Of_Origin\\\",0.0],UNIT[\\\"Meter\\\",1.0],AUTHORITY[\\\"EPSG\\\",23031]]\",\"ver\":\"PE_10_3_1\",\"name\":\"ED_1950_UTM_Zone_31N\",\"authCode\":{\"auth\":\"EPSG\",\"code\":\"23031\"},\"type\":\"LBC\"},\"singleCT\":{\"wkt\":\"GEOGTRAN[\\\"ED_1950_To_WGS_1984_23\\\",GEOGCS[\\\"GCS_European_1950\\\",DATUM[\\\"D_European_1950\\\",SPHEROID[\\\"International_1924\\\",6378388.0,297.0]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433]],GEOGCS[\\\"GCS_WGS_1984\\\",DATUM[\\\"D_WGS_1984\\\",SPHEROID[\\\"WGS_1984\\\",6378137.0,298.257223563]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433]],METHOD[\\\"Position_Vector\\\"],PARAMETER[\\\"X_Axis_Translation\\\",-116.641],PARAMETER[\\\"Y_Axis_Translation\\\",-56.931],PARAMETER[\\\"Z_Axis_Translation\\\",-110.559],PARAMETER[\\\"X_Axis_Rotation\\\",0.893],PARAMETER[\\\"Y_Axis_Rotation\\\",0.921],PARAMETER[\\\"Z_Axis_Rotation\\\",-0.917],PARAMETER[\\\"Scale_Difference\\\",-3.52],AUTHORITY[\\\"EPSG\\\",1612]]\",\"ver\":\"PE_10_3_1\",\"name\":\"ED_1950_To_WGS_1984_23\",\"authCode\":{\"auth\":\"EPSG\",\"code\":\"1612\"},\"type\":\"ST\"},\"ver\":\"PE_10_3_1\",\"name\":\"ED50 * EPSG-Nor N62 2001 / UTM zone 31N [23031,1612]\",\"authCode\":{\"auth\":\"\",\"code\":\"23031023\"},\"type\":\"EBC\"}",
"propertyNames": [
"dlLatLongWGS84.latitude",
"dlLatLongWGS84.longitude"
]
}
],
"id": "<CreateUniqueID>",
"kind": "opendes:at:wellbore:1.0.0",
"acl": {
"viewers": [
"data.test1@opendes.contoso.com"
],
"owners": [
"data.test1@opendes.contoso.com"
]
},
"legal": {
"legaltags": [
"opendes-storage-1594757987127"
],
"otherRelevantDataCountries": [
"BR"
],
"status": "compliant"
},
"createUser": "integrationtest@opendes.iam.gserviceaccount.com",
"createTime": "2020-06-01T18:32:52.054Z",
"modifyUser": "integrationtest@opendes.iam.gserviceaccount.com",
"modifyTime": "2020-06-02T08:43:51.553Z"
}
]
[
{
"data": {
"Operator": "",
"NetGross": "",
"Fluvial facies": "",
"Folder": "'Wells'",
"Cost": "",
"Name": "testWell_csvRelationships1315",
"TD (MD)": 2415.8,
"_dataset_descriptor": "tenant1:petrel:wellbore_default_descriptor",
"Uncertainty standard deviation factor": true,
"Facies": "",
"Max zone from 'Well Tops'": 5,
"Drilling structure": "",
"UWI": "123458103",
"Timestratigraphy": "",
"TD (TVDSS)": 2246.5,
"Ambient temperature [degC]": "",
"Longitude": 100,
"Max inc": 42.7,
"Surface Y": 6782712.41,
"Well datum name": "KB",
"_crc": -309476537,
"Well symbol": "Oil",
"Bottom hole X": 457487.61,
"DEPTH": "",
"Bottom hole Y": 6782625.9
},
"kind": "tenant1:petrel:wellbore:1.0.0",
"namespace": "tenant1:petrel",
"legal": {
"legaltags": [
"tenant1-workflow-tests-1587421127486"
],
"otherRelevantDataCountries": [
"US"
],
"status": "compliant"
},
"id": "non:existant:record:1.0.0",
"acl": {
"viewers": [
"data.default.viewers@tenant1.evd.cloud.slb-ds.com"
],
"owners": [
"data.default.owners@tenant1.evd.cloud.slb-ds.com"
]
},
"type": "wellbore",
"version": 1588571490735210
}
]
[
{
"data": {
"Spud date": "atspud",
"UWI": "<RandomText>"
},
"id": "<CreateUniqueID>",
"version": 1591087431362345,
"kind": "opendes:at:wellbore:1.0.0",
"acl": {
"viewers": [
"data.test1@opendes.contoso.com"
],
"owners": [
"data.test1@opendes.contoso.com"
]
},
"legal": {
"legaltags": [
"opendes-storage-1594757987127"
],
"otherRelevantDataCountries": [
"BR"
],
"status": "compliant"
},
"createUser": "integrationtest@opendes.iam.gserviceaccount.com",
"createTime": "2020-06-01T18:32:52.054Z",