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

Updating and adding test scenarios

parent 2ea11b6c
Pipeline #17268 failed with stages
in 18 seconds
{
"id": "1a3c1f16-25c7-44cf-9fbd-7d9cbc90805a",
"mappingId": "1a3c1f16-25c7-44cf-9fbd-7d9cbc90805a",
"mappingVersion": "1.0.0",
"mappingAuthority": "osdu",
"mappingKind": "osdu:wks:well:1.0.0",
"mappingSchemaMajorVersion": "1",
"mappingSchemaMinorVersion": "0",
"mappingSchemaPatchVersion": "0",
"sourceSchemaAuthority": "opendes",
"sourceSchemaSource": "oga",
"sourceEntityType": "well",
"sourceSchemaMajorVersion": "1",
"sourceSchemaKind": "opendes:oga:well:1",
"targetSchemaAuthority": "slb",
"targetSchemaSource": "wks",
"targetEntityType": "well",
"targetSchemaMajorVersion": "4",
"createdBy": "testUser",
"fileName": "1a3c1f16-25c7-44cf-9fbd-7d9cbc90805a.json",
"createdOnEpoch": "1606039291",
"mappingScope": "INTERNAL"
}
\ No newline at end of file
{
"id": "4b312ef2-447d-4898-9d54-2a401975bd0b",
"mappingId": "4b312ef2-447d-4898-9d54-2a401975bd0b",
"mappingVersion": "1.0.0",
"mappingAuthority": "osdu",
"mappingSchemaMajorVersion": "1",
"mappingSchemaMinorVersion": "0",
"mappingSchemaPatchVersion": "0",
"mappingKind": "osdu:wks:wellbore:1.0.0",
"sourceSchemaAuthority": "opendes",
"sourceSchemaSource": "ihs",
"sourceEntityType": "log",
"sourceSchemaMajorVersion": "1",
"sourceSchemaKind": "opendes:ihs:log:1",
"targetSchemaAuthority": "slb",
"targetSchemaSource": "wks",
"targetEntityType": "log",
"targetSchemaMajorVersion": "2",
"createdBy": "testUser",
"fileName": "4b312ef2-447d-4898-9d54-2a401975bd0b.json",
"createdOnEpoch": "1606039291",
"mappingScope": "INTERNAL"
}
\ No newline at end of file
{
"id": "aa0ee7f6-2c0b-474a-962c-3e837a3b7de3",
"mappingId": "aa0ee7f6-2c0b-474a-962c-3e837a3b7de3",
"mappingVersion": "1.0.0",
"mappingAuthority": "osdu",
"mappingKind": "osdu:wks:well:1.0.0",
"mappingSchemaMajorVersion": "1",
"mappingSchemaMinorVersion": "0",
"mappingSchemaPatchVersion": "0",
"sourceSchemaAuthority": "opendes",
"sourceSchemaSource": "oga",
"sourceEntityType": "well",
"sourceSchemaMajorVersion": "1",
"sourceSchemaKind": "opendes:oga:well:1",
"targetSchemaAuthority": "abc",
"targetSchemaSource": "wks",
"targetEntityType": "well",
"targetSchemaMajorVersion": "1",
"createdBy": "testUser",
"fileName": "aa0ee7f6-2c0b-474a-962c-3e837a3b7de3.json",
"createdOnEpoch": "1606039291",
"mappingScope": "INTERNAL"
}
\ No newline at end of file
{
"id": "d61a36bc-7b7b-4e7c-8a9c-33e7315bc076",
"mappingId": "d61a36bc-7b7b-4e7c-8a9c-33e7315bc076",
"mappingVersion": "1.0.0",
"mappingAuthority": "osdu",
"mappingSchemaMajorVersion": "1",
"mappingSchemaMinorVersion": "0",
"mappingSchemaPatchVersion": "0",
"mappingKind": "osdu:wks:log:1.0.0",
"sourceSchemaAuthority": "opendes",
"sourceSchemaSource": "ihs",
"sourceEntityType": "log",
"sourceSchemaMajorVersion": "1",
"sourceSchemaKind": "opendes:ihs:log:1",
"targetSchemaAuthority": "abc",
"targetSchemaSource": "wks",
"targetEntityType": "log",
"targetSchemaMajorVersion": "3",
"createdBy": "testUser",
"fileName": "d61a36bc-7b7b-4e7c-8a9c-33e7315bc076.json",
"createdOnEpoch": "1606039291",
"mappingScope": "INTERNAL"
}
\ No newline at end of file
{
"id": "dda587cd-770b-4104-bae3-3f834c3a8aec",
"mappingId": "dda587cd-770b-4104-bae3-3f834c3a8aec",
"mappingVersion": "1.0.0",
"mappingAuthority": "osdu",
"mappingKind": "osdu:wks:well:1.0.0",
"mappingSchemaMajorVersion": "1",
"mappingSchemaMinorVersion": "0",
"mappingSchemaPatchVersion": "0",
"sourceSchemaAuthority": "opendes",
"sourceSchemaSource": "oga",
"sourceEntityType": "well",
"sourceSchemaMajorVersion": "1",
"sourceSchemaKind": "opendes:oga:well:1",
"targetSchemaAuthority": "slb",
"targetSchemaSource": "wks",
"targetEntityType": "well",
"targetSchemaMajorVersion": "5",
"createdBy": "testUser",
"fileName": "dda587cd-770b-4104-bae3-3f834c3a8aec.json",
"createdOnEpoch": "1606039291",
"mappingScope": "INTERNAL"
}
\ No newline at end of file
......@@ -2,8 +2,11 @@
"id": "e2678b5f-5917-4bb1-8b30-2006efcb720d",
"mappingId": "e2678b5f-5917-4bb1-8b30-2006efcb720d",
"mappingVersion": "1.0.0",
"mappingAuthority": "slb",
"mappingKind": "wks",
"mappingAuthority": "osdu",
"mappingSchemaMajorVersion": "1",
"mappingSchemaMinorVersion": "0",
"mappingSchemaPatchVersion": "0",
"mappingKind": "osdu:wks:wellbore:1.0.0",
"sourceSchemaAuthority": "opendes",
"sourceSchemaSource": "at",
"sourceEntityType": "wellbore",
......@@ -13,9 +16,7 @@
"targetSchemaSource": "wks",
"targetEntityType": "wellbore",
"targetSchemaMajorVersion": "1",
"mappingSchemaMajorVersion": "1",
"mappingSchemaMinorVersion": "0",
"mappingSchemaPatchVersion": "0",
"createdBy": "testUser",
"fileName": "e2678b5f-5917-4bb1-8b30-2006efcb720d.json",
"createdOnEpoch": "1606039291",
......
{
"targetSchemaKind": "slb:wks:well:4.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"
}
]
}
{
"targetSchemaKind": "slb:wks:log:2.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"
}
]
}
{
"targetSchemaKind": "abc:wks:well: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"
}
]
}
{
"targetSchemaKind": "abc:wks:log:3.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"
}
]
}
{
"targetSchemaKind": "slb:wks:well:5.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"
}
]
}
{
"targetSchemaKind": "opendes:wks:wellbore:1.0.0",
"mappingId": "",
"targetSchemaKind": "slb:wks:wellbore:1.0.0",
"attributeMappings": [
{
"rawAttributeName": "acl",
......
import json
import os
from os import listdir
from os.path import isfile, join
from azure.cosmos import CosmosClient
......
......@@ -5,6 +5,7 @@ azure_bootstrap:
script:
- pip install -r $AZURE_DEPLOYMENTS_SUBDIR/requirements.txt
- python $AZURE_DEPLOYMENTS_SUBDIR/deploy_mappings.py
- python $AZURE_DEPLOYMENTS_SUBDIR/deploy_mappings_info_records.py
only:
variables:
- $AZURE == 'true'
......
package org.opengroup.osdu.wks.model;
import java.util.Arrays;
import java.util.List;
public class AutomationConstants {
public static final String CONTENT_TYPE = "Content-Type";
public static final String DATA_PARTITION_ID = "data-partition-id";
......@@ -22,16 +25,17 @@ public class AutomationConstants {
public static final String COLON_SEPARATOR = ":";
public static final String DASH = "-";
public static final String POINT = ".";
public static final String OS_WKS_SCHEMA_KIND = System.getProperty("OS_WKS_SCHEMA_KIND",
System.getenv("OS_WKS_SCHEMA_KIND"));
public static final String OS_TARGET_SCHEMA_KIND = System.getProperty("OS_TARGET_SCHEMA_KIND",
System.getenv("OS_TARGET_SCHEMA_KIND"));
public static final String OS_TARGET_SCHEMA_KIND_TENANT = getEnvironmentVariableOrDefaultValue("OS_TARGET_SCHEMA_KIND_TENANT", "opendes:wks:wellbore:1.3.1");
public static final String OS_TARGET_SCHEMA_KIND = getEnvironmentVariableOrDefaultValue("OS_TARGET_SCHEMA_KIND", "slb:wks:wellbore:1.3.1");
public static final List<String> OS_TARGET_SCHEMA_KIND_IHS = Arrays.asList("slb:wks:log:2.3.1", "abc:wks:log:3.2.1");
public static final List<String> OS_TARGET_SCHEMA_KIND_OGA = Arrays.asList("slb:wks:well:4.3.1", "slb:wks:well:5.1.0", "abc:wks:well:1.5.1");
public static final long INDEXING_TIMEOUT = 60;
public static final String TENANT_NAME_PLACEHOLDER = "<tenant_name>";
public static final String ACL_VIEWERS_GROUP = "<acl_viewers>";
public static final String ACL_OWNERS_GROUP = "<acl_owners>";
public static final String CLOUD_DOMAIN = "<cloud_domain>";
public static final String LEGAL_TAGS = "<legal_tags>";
public static final String RECORD_ID = "<record_id.>";
public static final String TENANT_NAME_PLACEHOLDER_VALUE = System.getProperty("TENANT_NAME",
System.getenv("TENANT_NAME"));
public static final String ACL_VIEWERS_GROUP_VALUE = System.getProperty("ACL_VIEWERS",
......@@ -39,4 +43,12 @@ public class AutomationConstants {
public static final String ACL_OWNERS_GROUP_VALUE = System.getProperty("ACL_OWNERS", System.getenv("ACL_OWNERS"));
public static final String CLOUD_DOMAIN_VALUE = System.getProperty("DOMAIN", System.getenv("DOMAIN"));
public static final String LEGAL_TAGS_VALUE = System.getProperty("LEGAL_TAG", System.getenv("LEGAL_TAG"));
private static String getEnvironmentVariableOrDefaultValue(String key, String defaultValue) {
String environmentVariable = System.getProperty(key, System.getenv(key));
if (environmentVariable == null) {
environmentVariable = defaultValue;
}
return environmentVariable;
}
}
package org.opengroup.osdu.wks.model;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -28,6 +29,7 @@ public class WksIntegrationTestScope {
private List<String> bulkRawRecordIdList;
private String vendor;
private String fileVersion;
private List<HttpResponse> httpResponsesList;
public String getFileVersion() {
return fileVersion;
......@@ -124,5 +126,16 @@ public class WksIntegrationTestScope {
public String getVendor() {
return vendor;
}
public void addNewResponse(HttpResponse httpResponse) {
if(this.httpResponsesList == null) {
this.httpResponsesList = new ArrayList<>();
}
this.httpResponsesList.add(httpResponse);
}
public List<HttpResponse> getResponseList() {
return this.httpResponsesList;
}
}
......@@ -6,8 +6,8 @@ Feature: Covers all positive and negative test cases around WKS transformation s
@WksService
Scenario Outline: WKS Transformation should not be attempted if record is already a WKS record
# When I hit Storage service put end point with <payload> which is already a WKS record
# Then No corresponding transformed record should be created for this wks record in storage
When I hit Storage service put end point with <payload> which is already a WKS record
Then No corresponding transformed record should be created for this wks record in storage
Examples:
| payload |
......@@ -15,8 +15,8 @@ Feature: Covers all positive and negative test cases around WKS transformation s
@WksService
Scenario Outline: WKS Transformation should not be attempted if record is a WKE record
# When I hit Storage service put end point with <payload> which is already a WKE record
# Then No corresponding transformed record should be created for this wke record in storage
When I hit Storage service put end point with <payload> which is already a WKE record
Then No corresponding transformed record should be created for this wke record in storage
Examples:
| payload |
......@@ -24,8 +24,8 @@ Feature: Covers all positive and negative test cases around WKS transformation s
@WksService
Scenario Outline: WKS Transformation flow should be skipped if mapping is not present
# When I hit Storage service put end point with <payload> which has invalid source so that mapping service does not return any mapping
# Then No corresponding transformed record should be created for this record in storage
When I hit Storage service put end point with <payload> which has invalid source so that mapping service does not return any mapping
Then No corresponding transformed record should be created for this record in storage
Examples:
| payload |
......@@ -43,6 +43,18 @@ Feature: Covers all positive and negative test cases around WKS transformation s
| payload | updatePayload |
| "/input_payloads/payload_for_create_operation.json" | "/input_payloads/payload_for_update_operation.json" |
@WksService
Scenario Outline: Multiple Wks records should be created on raw record creation. WKS records should be updated on corresponding raw record update.
When I hit Storage service put end point with <payload>
Then Transformed records should be created in storage
And Wks records should be created in the intended kind
When I hit Storage service put end point to update raw record with <updatePayload>
Then Existing WKS records in storage should get updated
Examples:
| payload | updatePayload |
| "/input_payloads/payload_for_create_operation_multiple_wks.json" | "/input_payloads/payload_for_update_operation_multiple_wks.json" |
@WksService
Scenario Outline: Metablock should get updated as per mapping file and ancestry should be correctly updated.
When I hit Storage service put end point with <payload>
......@@ -68,10 +80,10 @@ Feature: Covers all positive and negative test cases around WKS transformation s
@RelationshipValidation
Scenario Outline: WKS record relationships block should show relation to wks record of related entity
# Given I hit Storage service put end point with <relatedEntityPayload> to persist a record say raw1
# And I verify that wks is created for above raw record
# When I hit Storage service put end point with <parentPayload> whose raw record contains relationship to record raw1
# Then Transformed record should contain relationship to wks of raw1 as per <expectedRelationshipBlock>
Given I hit Storage service put end point with <relatedEntityPayload> to persist a record say raw1
And I verify that wks is created for above raw record
When I hit Storage service put end point with <parentPayload> whose raw record contains relationship to record raw1
Then Transformed record should contain relationship to wks of raw1 <relatedEntityPayload> as per <expectedRelationshipBlock>
Examples: