Commit a7a8528a authored by RPrakash3's avatar RPrakash3
Browse files

Integration test for relationships block

parent d9bfa1e4
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.opengroup.osdu</groupId>
<artifactId>os-wks</artifactId>
<version>0.0.1</version>
</parent>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.opengroup.osdu</groupId>
<artifactId>os-wks</artifactId>
<version>0.0.1</version>
</parent>
<artifactId>wks-test-core</artifactId>
<artifactId>wks-test-core</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<artifactId>log4j-api</artifactId>
<groupId>org.apache.logging.log4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>asm</artifactId>
<groupId>org.ow2.asm</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId>
</dependency>
<dependency>
<groupId>org.opengroup.osdu</groupId>
<artifactId>os-core-common</artifactId>
<version>0.0.11</version>
</dependency>
<dependency>
<groupId>com.github.berkesa</groupId>
<artifactId>datatree-core</artifactId>
<version>1.0.10</version>
</dependency>
<dependency>
<groupId>com.github.berkesa</groupId>
<artifactId>datatree-adapters</artifactId>
<version>1.0.11</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java8</artifactId>
<version>5.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>5.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-guice</artifactId>
<version>5.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>4.2.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.opengroup.osdu.de</groupId>
<artifactId>os-automation-test-common-lib</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.opengroup.osdu</groupId>
<artifactId>core-lib-azure</artifactId>
<version>0.0.17</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.opengroup.osdu</groupId>
<artifactId>os-wks-core</artifactId>
<version>0.0.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<artifactId>log4j-api</artifactId>
<groupId>org.apache.logging.log4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>asm</artifactId>
<groupId>org.ow2.asm</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId>
</dependency>
<dependency>
<groupId>org.opengroup.osdu</groupId>
<artifactId>os-core-common</artifactId>
<version>0.0.11</version>
</dependency>
<dependency>
<groupId>com.github.berkesa</groupId>
<artifactId>datatree-core</artifactId>
<version>1.0.10</version>
</dependency>
<dependency>
<groupId>com.github.berkesa</groupId>
<artifactId>datatree-adapters</artifactId>
<version>1.0.11</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java8</artifactId>
<version>5.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>5.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-guice</artifactId>
<version>5.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>4.2.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.opengroup.osdu.de</groupId>
<artifactId>os-automation-test-common-lib</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.opengroup.osdu</groupId>
<artifactId>core-lib-azure</artifactId>
<version>0.0.17</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.opengroup.osdu</groupId>
<artifactId>os-wks-core</artifactId>
<version>0.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.opengroup.osdu</groupId>
<artifactId>core-lib-gcp</artifactId>
<version>0.1.17</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>${gitlab-server}</id>
<url>https://community.opengroup.org/api/v4/groups/17/-/packages/maven</url>
</repository>
</repositories>
<repositories>
<repository>
<id>${gitlab-server}</id>
<url>https://community.opengroup.org/api/v4/groups/17/-/packages/maven</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>${gitlab-server}</id>
<url>https://community.opengroup.org/api/v4/projects/191/packages/maven</url>
</repository>
<snapshotRepository>
<id>${gitlab-server}</id>
<url>https://community.opengroup.org/api/v4/projects/191/packages/maven</url>
</snapshotRepository>
</distributionManagement>
<distributionManagement>
<repository>
<id>${gitlab-server}</id>
<url>https://community.opengroup.org/api/v4/projects/191/packages/maven</url>
</repository>
<snapshotRepository>
<id>${gitlab-server}</id>
<url>https://community.opengroup.org/api/v4/projects/191/packages/maven</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M3</version>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<skipTests>${skipItTests}</skipTests>
<includes>
<include>org.opengroup.osdu.wks.runner.IntegrationTestRunner</include>
</includes>
</configuration>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M3</version>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<skipTests>${skipItTests}</skipTests>
<includes>
<include>org.opengroup.osdu.wks.runner.IntegrationTestRunner</include>
</includes>
</configuration>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>Default</id>
<properties>
<skipUnitTests>true</skipUnitTests>
<skipItTests>false</skipItTests>
<preIntegrationPhase>pre-integration-test</preIntegrationPhase>
<postIntegrationPhase>post-integration-test</postIntegrationPhase>
<mainClass>org.opengroup.osdu.wks.WksServiceApplication</mainClass>
</properties>
</profile>
</profiles>
<profiles>
<profile>
<id>Default</id>
<properties>
<skipUnitTests>true</skipUnitTests>
<skipItTests>false</skipItTests>
<preIntegrationPhase>pre-integration-test</preIntegrationPhase>
<postIntegrationPhase>post-integration-test</postIntegrationPhase>
<mainClass>org.opengroup.osdu.wks.WksServiceApplication</mainClass>
</properties>
</profile>
</profiles>
</project>
\ No newline at end of file
......@@ -22,4 +22,19 @@ public class AutomationConstants {
public static final String COLON_SEPARATOR = ":";
public static final String DASH = "-";
public static final String OS_WKS_SCHEMA_KIND = "opendes:wks:wellbore:1.0.0";
public static final String WKS_STATUS_NAMESPACE = "dataecosystem";
public static final long DATASTORE_ENTRY_CREATION_CHECK_MAX_TIMEOUT_SEC = 30;
public static final String STORAGE_SCHEMA_POST_ENDPOINT = "/schemas";
public static final String STORAGE_SCHEMA_GET_ENDPOINT = "/schemas/";
//Datastore attributes
public static final String WKS_KIND = "wksStatus";
public static final String RAW_RECORD_ID = "rawRecordId";
public static final String RAW_RECORD_VERSION = "rawRecordVersion";
public static final String MAPPING_ID = "mappingId";
public static final String WKS_RECORD_ID ="wksRecordId";
public static final String PENDING_ENTITIES ="pendingEntities";
public static final String PENDING_IDS = "pendingIds";
public static final String LAST_MODIFIED_DATE = "updatedDate";
public static final String STATUS = "status";
public static final String WKS_STATUS_KIND = "wksStatus";
}
......@@ -3,6 +3,7 @@ Feature: Covers all positive and negative test cases around WKS transformation s
# Pre-requisite test steps for all scenarios
Background: Generate Access token
Given I generate user token and prepare request header
And Required schema are created
@WksService
Scenario Outline: WKS Transformation should not be attempted if record is already a WKS record
......@@ -50,8 +51,8 @@ Feature: Covers all positive and negative test cases around WKS transformation s
And Transformed record should be created in storage
And Data block in wks should be transformed as defined in <expectedWksRecord> as per <MappingFile>
And Ancestry block should be updated correctly
#And Metablock references in the transformed record should be updated as defined in <expectedWksRecord> as per <MappingFile>
Examples:
| payload | expectedWksRecord | MappingFile |
| "/input_payloads/payload_for_meta_and_ancestry.json" | "/input_payloads/expected_transformed_record_draft.json" | "/input_payloads/mappingFile.json" |
......@@ -65,3 +66,47 @@ Feature: Covers all positive and negative test cases around WKS transformation s
Examples:
| payload |
| "/input_payloads/payload_for_bulk_records.json" |
@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>
Examples:
| relatedEntityPayload | parentPayload | expectedRelationshipBlock |
| "/input_payloads/relationship/raw_having_wks_created.json" | "/input_payloads/relationship/recordRelatedToEntityHavingWksCreated.json" | "/input_payloads/relationship/expectedRelationship_for_rawHavingWksCreated.json" |
@RelationshipValidation
Scenario Outline: WKS record relationships block should show relation to wks records of all related entities
Given I hit Storage service put end point with <relatedEntityPayload> to persist two records say raw1 and raw2
And I verify that wks records are created for above raw records
When I hit wks service with <parentPayload> whose raw record contains relationship to above records
And Transformed record should contain relationship to wks records of raw1 and raw2 as per <expectedRelationshipBlock>
Examples:
| relatedEntityPayload | parentPayload | expectedRelationshipBlock |
| "/input_payloads/relationship/multiple_raw_having_wks_created.json" | "/input_payloads/relationship/recordRelatedToMultipleEntitiesHavingWKSCreated.json" | "/input_payloads/relationship/expectedRelationship_for_multipleRelatedRawWithWksCreated.json" |
@RelationshipValidation
Scenario Outline: WKS record relationships block should show relation to related entity raw record if it's wks record is missing
Given I hit Storage service put end point with <relatedEntityPayload> to persist a record,say raw1, for which there is no wks mapping present
And I verify that wks record does not get created for above raw record
When I hit wks service with <parentPayload> whose raw record contains relationship to record raw1
And Transformed record should contain relationship to raw record raw1 as per <expectedRelationshipBlock>
And pending records should be updated in datastore
Examples:
| relatedEntityPayload | parentPayload | expectedRelationshipBlock |
| "/input_payloads/relationship/raw_having_no_wks_mapping.json" | "/input_payloads/recordRelatedToAnotherRecordWithNoWKS.json" | "/input_payloads/relationship/expectedRelationship_for_rawWithNoWks.json" |
@RelatedRawUnavailable
Scenario Outline: WKS record relationships block should show relation to related entity raw record even if it is not available in system
Given I hit wks service with <parentPayload> whose raw record contains relationship to non-existing record,say raw1
Then Transformed record should contain relationship to record raw1 as per <expectedRelationshipBlock>
And pending records should be updated in datastore
Examples:
| parentPayload | expectedRelationshipBlock |
| "/input_payloads/recordRelatedToAnotherUnavailableRecord.json" | "/input_payloads/relationship/expectedRelationship_for_nonExistentRaw.json" |
{
"wellbores": {
"ids": [
"opendes:wks:wellbore-b3BlbmRlczphdDp3ZWxsYm9yZS1yZWNvcmQxRm9yTXVsdGlwbGVSZWxhdGVkRW50aXR5Q2hlY2s",
"opendes:wks:wellbore-b3BlbmRlczphdDp3ZWxsYm9yZS1yZWNvcmQyRm9yTXVsdGlwbGVSZWxhdGVkRW50aXR5Q2hlY2s"
]
}
}
{
"wellbore": {
"id": "opendes:wks:wellbore-b3BlbmRlczphdDp3ZWxsYm9yZS1yYXdIYXZpbmdXa3NDcmVhdGVk"
}
}
[
{
"data": {
"Spud date": "atspud",
"UWI": "rawHavingWksCreated"
},
"id": "opendes:at:wellbore-record1ForMultipleRelatedEntityCheck",
"kind": "opendes:at:wellbore:1.0.0",
"acl": {
"viewers": [
"data.default.viewers@opendes.p4d.cloud.slb-ds.com"
],
"owners": [
"data.default.owners@opendes.p4d.cloud.slb-ds.com"
]
},
"legal": {
"legaltags": [
"opendes-public-usa-dataset-1"
],
"otherRelevantDataCountries": [
"US"
],
"status": "compliant"
},
"createUser": "integrationtester"
},
{
"data": {
"Spud date": "atspud",
"UWI": "rawHavingWksCreated"
},
"id": "opendes:at:wellbore-record2ForMultipleRelatedEntityCheck",
"kind": "opendes:at:wellbore:1.0.0",
"acl": {
"viewers": [
"data.default.viewers@opendes.p4d.cloud.slb-ds.com"
],
"owners": [
"data.default.owners@opendes.p4d.cloud.slb-ds.com"
]
},
"legal": {
"legaltags": [
"tenant1-1-abc-test"
],
"otherRelevantDataCountries": [
"IN"
],
"status": "compliant"
},
"createUser": "integrationtester"
}
]
{
"recordId": "non:existent:record-recordDoesNotExistInSystem"
}
[
{
"data": {
"Spud date": "atspud",
"UWI": "rawHavingWksCreated"
},
"id": "opendes:at:wellbore-rawHavingNoWksCreated",
"kind": "opendes:at:wellbore:1.0.0",
"acl": {
"viewers": [
"data.default.viewers@opendes.p4d.cloud.slb-ds.com"
],
"owners": [
"data.default.owners@opendes.p4d.cloud.slb-ds.com"
]
},
"legal": {
"legaltags": [
"opendes-public-usa-dataset-1"
],
"otherRelevantDataCountries": [
"US"
],
"status": "compliant"
},
"createUser": "integrationtester"
}
]
[
{
"data": {
"Spud date": "atspud",
"UWI": "rawHavingWksCreated"
},
"id": "opendes:at:wellbore-rawHavingWksCreated",
"kind": "opendes:at:wellbore:1.0.0",
"acl": {
"viewers": [
"data.default.viewers@opendes.p4d.cloud.slb-ds.com"
],
"owners": [
"data.default.owners@opendes.p4d.cloud.slb-ds.com"
]
},
"legal": {
"legaltags": [
"opendes-public-usa-dataset-1"
],
"otherRelevantDataCountries": [
"US"
],
"status": "compliant"
},
"createUser": "integrationtester"
}