Commit d99eece5 authored by NSarda's avatar NSarda
Browse files

Changes in stepdef for tags attribute and enables tags IT

parent 7c13b0ab
Pipeline #27746 passed with stages
in 32 minutes and 27 seconds
......@@ -170,14 +170,13 @@ public class IntegrationTestStepDefs implements En {
| responseCode.equals(AutomationConstants.REQUEST_SUCCESS);
assertTrue(recordCreatedOrUpdated);
HttpResponse responseBody = pollStorageForWksOfCustomRecordBodyInContext(AutomationConstants.OS_TARGET_SCHEMA_KIND);
String response = responseBody.getBody();
JsonElement responseGiven = new Gson().fromJson(response, JsonElement.class);
JsonArray tagsResponseArray = responseGiven.getAsJsonObject().getAsJsonArray("tags");
String wksResponseBody = pollStorageForWksOfCustomRecordBodyInContext(AutomationConstants.OS_TARGET_SCHEMA_KIND);
JsonElement responseGiven = new Gson().fromJson(wksResponseBody, JsonElement.class);
JsonObject tagsResponseArray = responseGiven.getAsJsonObject().getAsJsonObject("tags");
String expectedMetaBody = this.context.getFileUtils().read(tagsblock);
JsonElement expectedJsonBody = new Gson().fromJson(expectedMetaBody, JsonElement.class);
JsonArray tagsExpectedArray = expectedJsonBody.getAsJsonObject().getAsJsonArray("tags");
JsonObject tagsExpectedArray = expectedJsonBody.getAsJsonObject().getAsJsonObject("tags");
assertTrue(tagsResponseArray.toString().contentEquals(tagsExpectedArray.toString()));
});
......@@ -606,14 +605,13 @@ public class IntegrationTestStepDefs implements En {
return responseCode;
}
private HttpResponse pollStorageForWksOfCustomRecordBodyInContext(String targetSchemaKind) {
private String pollStorageForWksOfCustomRecordBodyInContext(String targetSchemaKind) {
long initial = System.currentTimeMillis();
HttpResponse responseBody = null;
String wksRecordIdForCustomRawRecord = createWksRecordIdFromCustomRawRecord(this.context.getCustomRecordId(), targetSchemaKind);
this.context.setWksRecordIdForCustomRawRecord(wksRecordIdForCustomRawRecord);
LOGGER.log(Level.INFO, "transformed record id to search - " + wksRecordIdForCustomRawRecord);
while ((System.currentTimeMillis() - initial) < (AutomationConstants.RECORD_SEARCH_MAX_TIMEOUT_SEC) * 1000) {
responseBody = storageGetAndSaveResponseBody(wksRecordIdForCustomRawRecord);
String responseBody = null;
String wksID = this.context.getWksRecordIdForCustomRawRecord();
LOGGER.log(Level.INFO, "transformed record id to search - " + wksID);
while ((System.currentTimeMillis() - initial) < (AutomationConstants.RECORD_SEARCH_MAX_TIMEOUT_SEC) * 100) {
responseBody = storageGetAndSaveResponseBody(wksID).getBody();
}
LOGGER.log(Level.INFO, "Storage Response for searching WKS record: " + this.context.getHttpResponse());
return responseBody;
......
......@@ -43,15 +43,15 @@ 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_WIP
@WksService
Scenario Outline: Wks record to be created with tags attribute on raw record creation.
When I hit Storage service put end point with <payload>
Then Transformed record should be created in storage with <tagsblock>
Examples: # This test case can be enabled after storage service is ready to accept tags attribute at root level
Examples:
| payload | tagsblock |
#| "/input_payloads/payload_withTagsAndMeta_for_create_operation.json" | "/input_payloads/payload_with_tags_In_output.json" |
| "/input_payloads/payload_withTagsAndMeta_for_create_operation.json" | "/input_payloads/payload_with_tags_In_output.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>
......@@ -151,9 +151,6 @@ Feature: Covers all positive and negative test cases around WKS transformation s
Examples:
| relatedEntityPayload | relatedEntityPayload2 | parentPayload | expectedRelationshipBlock |
| "/input_payloads/relationship/raw_having_wks_created_well_entity.json" | "/input_payloads/relationship/recordRelatedToAnotherRawButNotCreatedByWKSService.json" | "/input_payloads/relationship/recordRelatedToEntityHavingWksCreatedWellEntity.json" | "/input_payloads/relationship/expectedRelationship_for_rawHavingWksCreated.json" |
# Below scenarios are not applicable any more but they might be in future
# @RelationshipValidation
# Scenario Outline: WKS record relationships block should show relation to wks record created using mapping definition targeted to schema of same authority and with latest major version
# Given I hit Storage service put end point with <relatedEntityPayload> to persist a record say raw1
......@@ -175,4 +172,4 @@ Feature: Covers all positive and negative test cases around WKS transformation s
#
# Examples:
# | relatedEntityPayload | updatedVersionOfAboveRecord | parentPayload | expectedRelationshipBlock |
# | "/input_payloads/relationship/raw_for_wks_record_version1.json" | "/input_payloads/relationship/raw_for_wks_record_version2.json" | "/input_payloads/relationship/recordRelatedToAnotherRawWithMultipleWksRecordVersions.json" | "/input_payloads/relationship/expectedRelationship_for_multipleWksRecordVersions.json" |
\ No newline at end of file
# | "/input_payloads/relationship/raw_for_wks_record_version1.json" | "/input_payloads/relationship/raw_for_wks_record_version2.json" | "/input_payloads/relationship/recordRelatedToAnotherRawWithMultipleWksRecordVersions.json" | "/input_payloads/relationship/expectedRelationship_for_multipleWksRecordVersions.json" |
[
{
"data": {
"Spud date": "atspud",
"UWI": "<RandomText>"
},
"id": "<CreateUniqueID>",
"version": 1591087431362345,
"kind": "<tenant_name>:at:wellbore:1.0.0",
"tags": {
"name": {
"id": [
{
"kind": "12587932"
}
]
}
},
"acl": {
"viewers": [
"<acl_viewers>@<tenant_name>.<cloud_domain>"
],
"owners": [
"<acl_owners>@<tenant_name>.<cloud_domain>"
]
},
"legal": {
"legaltags": [
"<legal_tags>"
],
"otherRelevantDataCountries": [
"US"
],
"status": "compliant"
},
"createUser": "integrationtester"
}
]
{
"data":{
"Spud date":"atspud",
"UWI":"<RandomText>"
},
"id":"<CreateUniqueID>",
"version":1591087431362345,
"kind":"<tenant_name>:at:wellbore:1.0.0",
"acl":{
"viewers":[
"<acl_viewers>@<tenant_name>.<cloud_domain>"
],
"owners":[
"<acl_owners>@<tenant_name>.<cloud_domain>"
]
},
"legal":{
"legaltags":[
"<legal_tags>"
],
"otherRelevantDataCountries":[
"US"
],
"status":"compliant"
},
"tags":{
"NameOfKey":"123456FirstTry"
},
"createUser":"integrationtester"
}
]
\ No newline at end of file
{
"tags": {
"name": {
"id": [
{
"kind": "12587932"
}
]
}
}
"tags":{
"NameOfKey" : "123456FirstTry"
}
}
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