Commit d1034e53 authored by Paresh Behede's avatar Paresh Behede
Browse files

Merge branch 'RefactorTestSuite' into 'master'

Test suite refactor

See merge request !76
parents 1316e866 9e1450b6
Pipeline #46839 passed with stages
in 36 minutes and 59 seconds
......@@ -15,8 +15,7 @@ import org.opengroup.osdu.wks.util.AuthUtil;
@ScenarioScoped
public class WksIntegrationTestScope {
@Inject
private FileUtils fileUtils;
private FileUtils fileUtils = new FileUtils();
private String token;
private String inputPayload;
......
......@@ -3,7 +3,6 @@ package org.opengroup.osdu.wks.stepdefs;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -17,7 +16,6 @@ import org.awaitility.Awaitility;
import org.awaitility.Duration;
import static org.awaitility.Awaitility.await;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.opengroup.osdu.de.automation.model.HttpRequest;
......@@ -31,638 +29,51 @@ import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.inject.Inject;
import io.cucumber.java8.En;
import io.restassured.path.json.JsonPath;
import org.opengroup.osdu.wks.util.KindsUtil;
import io.cucumber.datatable.DataTable;
public class IntegrationTestStepDefs implements En {
public class CommonMethods {
private final static Logger LOGGER = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
@Inject
private WksIntegrationTestScope context;
public WksIntegrationTestScope context;
@Inject
public IntegrationTestStepDefs() {
Given("I generate user token and prepare request header", () -> {
if (this.context.getToken() == null) {
String token = new AuthUtil().getToken().replace("Bearer Bearer ", "Bearer ");
this.context.setToken(token);
this.context.setVendor();
}
if (this.context.getAuthHeaders() == null) {
Map<String, String> authHeaders = new HashMap<String, String>();
authHeaders.put(AutomationConstants.AUTHORIZATION, this.context.getToken());
authHeaders.put(AutomationConstants.DATA_PARTITION_ID, AutomationConstants.DATA_PARTITION_ID_VALUE);
authHeaders.put(AutomationConstants.CONTENT_TYPE, AutomationConstants.APPLICATION_JSON);
authHeaders.put(AutomationConstants.ON_BEHALF_OF, "");
authHeaders.put(AutomationConstants.APP_KEY, "");
this.context.setAuthHeaders(authHeaders);
}
});
Given("I create below source schemas used in Mapping files used for IT test", (DataTable sourceSchemaPaths) -> {
List<String> sourceSchemaPathsAsList = sourceSchemaPaths.asList();
for (String sourceSchemaPath : sourceSchemaPathsAsList) {
createSchemas(sourceSchemaPath);
}
});
And("I create below target schemas used in Mapping files used for IT test", (DataTable targetSchemaPaths) -> {
List<String> targetSchemaPathsAsList = targetSchemaPaths.asList();
for (String targetSchemaPath : targetSchemaPathsAsList) {
createSchemas(targetSchemaPath);
}
});
Given("I hit Storage service put end point with {string} which is already a WKS record",
(String inputPayload) -> {
String payload = this.context.getFileUtils().read(inputPayload);
payload = updatePlaceholdersInInputPayload(payload);
String recordId = generateRawRecordId(AutomationConstants.OS_TARGET_SCHEMA_KIND_TENANT);
this.context.setCustomRecordId(recordId);
postToStorage(payload.replace("<CreateUniqueID>", recordId));
LOGGER.log(Level.INFO, "Storage Post Response : " + this.context.getHttpResponse().getBody());
assertEquals(String.valueOf(this.context.getHttpResponse().getCode()),
AutomationConstants.RECORD_CREATED);
});
Then("No corresponding transformed record should be created for this wks record in storage", () -> {
String responseCode = pollStorageForAlreadyTransformedRecordType(AutomationConstants.OS_TARGET_SCHEMA_KIND);
assertEquals(AutomationConstants.RECORD_NOT_FOUND, responseCode);
deleteFromStorage(this.context.getCustomRecordId());
assertTrue(recordDeleted());
});
Given("I hit Storage service put end point with {string} which is already a WKE record",
(String inputPayload) -> {
String payload = this.context.getFileUtils().read(inputPayload);
payload = updatePlaceholdersInInputPayload(payload);
String kindVal = (AutomationConstants.OS_TARGET_SCHEMA_KIND_TENANT).replace("wks:", "wke:");
String recordId = generateRawRecordId(kindVal);
this.context.setCustomRecordId(recordId);
postToStorage(payload.replace("<CreateUniqueID>", recordId));
LOGGER.log(Level.INFO, "Storage Post Response : " + this.context.getHttpResponse().getBody());
assertEquals(String.valueOf(this.context.getHttpResponse().getCode()),
AutomationConstants.RECORD_CREATED);
});
Then("No corresponding transformed record should be created for this wke record in storage", () -> {
String responseCode = pollStorageForAlreadyTransformedRecordType(
(AutomationConstants.OS_TARGET_SCHEMA_KIND).replace("wks:", "wke:"));
assertEquals(AutomationConstants.RECORD_NOT_FOUND, responseCode);
deleteFromStorage(this.context.getCustomRecordId());
assertTrue(recordDeleted());
});
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(inputPayload);
payload = updatePlaceholdersInInputPayload(payload);
String recordId = generateRandomId(payload);
this.context.setCustomRecordId(recordId);
LOGGER.log(Level.INFO, "Random record ID : " + this.context.getCustomRecordId());
payload = payload.replace("<CreateUniqueID>", recordId);
postToStorage(payload);
LOGGER.log(Level.INFO, "Storage Post Response : " + this.context.getHttpResponse().getBody());
assertEquals(String.valueOf(this.context.getHttpResponse().getCode()),
AutomationConstants.RECORD_CREATED);
});
Then("No corresponding transformed record should be created for this record in storage", () -> {
String responseCode = pollStorageForCurrentRecordInContext();
assertEquals(AutomationConstants.RECORD_NOT_FOUND, responseCode);
deleteFromStorage(this.context.getCustomRecordId());
assertTrue(recordDeleted());
});
Given("I hit Storage service put end point with {string}", (String inputPayload) -> {
String payload = this.context.getFileUtils().read(inputPayload);
payload = updatePlaceholdersInInputPayload(payload);
String recordId = generateRandomId(payload);
this.context.setCustomRecordId(recordId);
LOGGER.log(Level.INFO, "Random record ID : " + this.context.getCustomRecordId());
this.context.setCustomValToVerifyUpdateOperation(RandomStringUtils.randomAlphabetic(10));
payload = payload.replace("<CreateUniqueID>", recordId).replace("<RandomText>",
this.context.getCustomValToVerifyUpdateOperation());
postToStorage(payload);
LOGGER.log(Level.INFO, "Storage Post Response : " + this.context.getHttpResponse().getBody());
});
Then("Transformed record should be created in storage", () -> {
String responseCode = pollStorageForWksOfCustomRecordInContext(AutomationConstants.OS_TARGET_SCHEMA_KIND);
boolean recordCreatedOrUpdated = responseCode.equals(AutomationConstants.RECORD_CREATED)
| responseCode.equals(AutomationConstants.REQUEST_SUCCESS);
assertTrue(recordCreatedOrUpdated);
});
Then("Transformed record should be created in storage with {string}", (String tagsblock) -> {
String responseCode = pollStorageForWksOfCustomRecordInContext(AutomationConstants.OS_TARGET_SCHEMA_KIND);
boolean recordCreatedOrUpdated = responseCode.equals(AutomationConstants.RECORD_CREATED)
| responseCode.equals(AutomationConstants.REQUEST_SUCCESS);
assertTrue(recordCreatedOrUpdated);
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);
JsonObject tagsExpectedArray = expectedJsonBody.getAsJsonObject().getAsJsonObject("tags");
assertTrue(tagsResponseArray.toString().contentEquals(tagsExpectedArray.toString()));
});
Then("Transformed records should be created in storage", () -> {
List<String> targetSchemaKinds = Arrays.asList(
AutomationConstants.TARGET_FOR_TESTSOURCE_C_TESTENTITY_C.get(0),
AutomationConstants.TARGET_FOR_TESTSOURCE_C_TESTENTITY_C.get(1));
List<String> responseCodes = pollStorageForMultipleWksOfCustomRecordInContext(targetSchemaKinds);
for (String responseCode : responseCodes) {
boolean recordCreatedOrUpdated = responseCode.equals(AutomationConstants.RECORD_CREATED)
| responseCode.equals(AutomationConstants.REQUEST_SUCCESS);
assertTrue(recordCreatedOrUpdated);
}
});
And("Wks record should be created in the intended kind", () -> {
String expectedKind = AutomationConstants.OS_TARGET_SCHEMA_KIND;
String actualKind = new JsonPath(this.context.getHttpResponse().getBody()).get("kind").toString();
assertEquals(expectedKind, actualKind);
});
public WksIntegrationTestScope getContext() {
return this.context;
}
And("Wks records should be created in the intended kind", () -> {
List<HttpResponse> httpResponseList = this.context.getResponseList();
for (int i = 0; i < httpResponseList.size(); i++) {
String expectedKind = AutomationConstants.TARGET_FOR_TESTSOURCE_C_TESTENTITY_C.get(i);
String actualKind = new JsonPath(httpResponseList.get(i).getBody()).get("kind").toString();
assertEquals(expectedKind, actualKind);
}
});
When("I hit Storage service put end point to update raw record with {string}", (String updatePayload) -> {
String payload = this.context.getFileUtils().read(updatePayload);
payload = updatePlaceholdersInInputPayload(payload);
String existingRecordInStorage = this.context.getCustomRecordId();
this.context.setCustomValToVerifyUpdateOperation(RandomStringUtils.randomAlphabetic(10));
payload = payload.replace("<CreateUniqueID>", existingRecordInStorage).replace("<RandomText>",
this.context.getCustomValToVerifyUpdateOperation());
this.context.setInputPayload(payload);
postToStorage(payload);
LOGGER.log(Level.INFO, "Storage Post Response : " + this.context.getHttpResponse().getBody());
});
Then("Existing WKS record in storage should get updated", () -> {
String initialWksRecordData = this.context.getCustomValToVerifyUpdateOperation();
String postUpdateWksRecordData = null;
long initial = System.currentTimeMillis();
while ((System.currentTimeMillis() - initial) < (AutomationConstants.RECORD_SEARCH_MAX_TIMEOUT_SEC)
* 1000) {
String responseCode = storageGetResponse(this.context.getWksRecordIdForCustomRawRecord());
if (responseCode.equals(AutomationConstants.REQUEST_SUCCESS)) {
postUpdateWksRecordData = new JsonPath(this.context.getHttpResponse().getBody()).get("data.uwi")
.toString();
if (initialWksRecordData.equalsIgnoreCase(postUpdateWksRecordData))
break;
}
}
LOGGER.log(Level.INFO, "Storage Response : " + this.context.getHttpResponse().getBody());
assertTrue("Expected: " + initialWksRecordData + " , Actual: " + postUpdateWksRecordData,
initialWksRecordData.equalsIgnoreCase(postUpdateWksRecordData));
deleteFromStorage(this.context.getCustomRecordId());
assertTrue(recordDeleted());
deleteFromStorage(this.context.getWksRecordIdForCustomRawRecord());
assertTrue(recordDeleted());
});
Then("Existing WKS records in storage should get updated", () -> {
String initialWksRecordData = this.context.getCustomValToVerifyUpdateOperation();
String postUpdateWksRecordData = null;
List<HttpResponse> httpResponseList = this.context.getResponseList();
for (int i = 0; i < httpResponseList.size(); i++) {
long initial = System.currentTimeMillis();
while ((System.currentTimeMillis() - initial) < (AutomationConstants.RECORD_SEARCH_MAX_TIMEOUT_SEC)
* 1000) {
String wksId = new JsonPath(httpResponseList.get(i).getBody()).get("id").toString();
String responseCode = storageGetResponse(wksId);
if (responseCode.equals(AutomationConstants.REQUEST_SUCCESS)) {
postUpdateWksRecordData = new JsonPath(this.context.getHttpResponse().getBody()).get("data.uwi")
.toString();
if (initialWksRecordData.equalsIgnoreCase(postUpdateWksRecordData))
break;
}
}
LOGGER.log(Level.INFO, "Storage Response : " + this.context.getHttpResponse().getBody());
assertTrue("Expected: " + initialWksRecordData + " , Actual: " + postUpdateWksRecordData,
initialWksRecordData.equalsIgnoreCase(postUpdateWksRecordData));
}
public void setContext(WksIntegrationTestScope context) {
this.context = context;
}
});
public CommonMethods() {
setContext(new WksIntegrationTestScope());
setHeaders();
}
Then("Raw Record should be created in Storage", () -> {
String rawRecordWithVersionForAncestry = null;
long initial = System.currentTimeMillis();
while ((System.currentTimeMillis() - initial) < (AutomationConstants.RECORD_SEARCH_MAX_TIMEOUT_SEC)
* 1000) {
String responseCode = storageGetResponse(this.context.getCustomRecordId());
if (responseCode.equals(AutomationConstants.REQUEST_SUCCESS)) {
String version = new JsonPath(this.context.getHttpResponse().getBody()).get("version").toString();
rawRecordWithVersionForAncestry = this.context.getCustomRecordId()
+ AutomationConstants.COLON_SEPARATOR + version;
this.context.setRawRecordWithVersionForAncestry(rawRecordWithVersionForAncestry);
LOGGER.log(Level.INFO, "ancestry value - " + rawRecordWithVersionForAncestry);
break;
}
public void setHeaders() {
if (this.context.getToken() == null) {
String token = "";
try {
token = new AuthUtil().getToken().replace("Bearer Bearer ", "Bearer ");
} catch (Exception e) {
LOGGER.log(Level.INFO, "Error generating access token : " + e.getMessage());
}
});
And("Data block in wks should be transformed as defined in {string} as per {string}",
(String expectedWksRecord, String mappingFile) -> {
String actualWksDataBlock = new JsonPath(this.context.getHttpResponse().getBody()).get("data")
.toString();
String expectedWksDataBlock = new JsonPath(this.context.getFileUtils().read(expectedWksRecord))
.get("data").toString();
assertEquals("Expected: " + expectedWksDataBlock + " , Actual: " + actualWksDataBlock,
expectedWksDataBlock, actualWksDataBlock);
});
And("Ancestry block should be updated correctly", () -> {
String actualWksAncestry = new JsonPath(this.context.getHttpResponse().getBody()).get("ancestry.parents[0]")
.toString();
String expectedWksAncestry = this.context.getRawRecordWithVersionForAncestry();
assertEquals("Expected: " + expectedWksAncestry + " , Actual: " + actualWksAncestry, expectedWksAncestry,
actualWksAncestry);
deleteFromStorage(this.context.getCustomRecordId());
assertTrue(recordDeleted());
deleteFromStorage(this.context.getWksRecordIdForCustomRawRecord());
assertTrue(recordDeleted());
});
And("Metablock references in the transformed record should be updated as defined in {string} as per {string}",
(String expectedWksRecord, String mappingFile) -> {
String actualWksMetaBlock = new JsonPath(this.context.getHttpResponse().getBody()).get("meta")
.toString();
String expectedWksMetaBlock = new JsonPath(this.context.getFileUtils().read(expectedWksRecord))
.get("meta").toString();
assertEquals("Expected: " + expectedWksMetaBlock + " , Actual: " + actualWksMetaBlock,
expectedWksMetaBlock, actualWksMetaBlock);
});
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(bulkRecord);
payload = updatePlaceholdersInInputPayload(payload);
JsonArray bulkRecords = new Gson().fromJson(payload, JsonArray.class);
List<String> recordList = new ArrayList<String>();
recordList.add(generateRandomId(bulkRecords.get(0).toString()));
recordList.add(generateRawRecordId(AutomationConstants.OS_TARGET_SCHEMA_KIND_TENANT));
recordList.add(generateRandomId(bulkRecords.get(2).toString()));
this.context.setBulkRawRecordIdList(recordList);
payload = payload.replace("<CreateUniqueID1>", recordList.get(0))
.replace("<CreateUniqueID2>", recordList.get(1))
.replace("<CreateUniqueID3>", recordList.get(2));
LOGGER.log(Level.INFO, "Payload to Post : " + payload);
postToStorage(payload);
LOGGER.log(Level.INFO, "Storage Post Response : " + this.context.getHttpResponse().getBody());
});
Then("Transformation of Wks records should be skipped", () -> {
String responseCode = fetchRecordFromStorage(createWKSRecordId(this.context.getBulkRawRecordIdList().get(1),
AutomationConstants.OS_TARGET_SCHEMA_KIND));
assertEquals(AutomationConstants.RECORD_NOT_FOUND, responseCode);
});
And("All other valid records should get transformed", () -> {
String responseCode = fetchRecordFromStorage(createWKSRecordId(this.context.getBulkRawRecordIdList().get(0),
AutomationConstants.OS_TARGET_SCHEMA_KIND));
assertEquals(AutomationConstants.REQUEST_SUCCESS, responseCode);
responseCode = fetchRecordFromStorage(createWKSRecordId(this.context.getBulkRawRecordIdList().get(2),
AutomationConstants.OS_TARGET_SCHEMA_KIND));
assertEquals(AutomationConstants.REQUEST_SUCCESS, responseCode);
this.context.getBulkRawRecordIdList().forEach(recordId -> {
deleteFromStorage(recordId);
assertTrue(recordDeleted());
});
deleteFromStorage(createWksRecordIdFromCustomRawRecord(this.context.getBulkRawRecordIdList().get(0),
AutomationConstants.OS_TARGET_SCHEMA_KIND));
assertTrue(recordDeleted());
deleteFromStorage(createWksRecordIdFromCustomRawRecord(this.context.getBulkRawRecordIdList().get(2),
AutomationConstants.OS_TARGET_SCHEMA_KIND));
assertTrue(recordDeleted());
});
Given("I hit Storage service put end point with {string} to persist a record say raw1",
(String inputPayload) -> {
persistRecordToBeUsedInRelationshipBlock(inputPayload);
});
And("I verify that wks is created for above raw record", () -> {
String wksRecordId = getWksIdForRecordFromRequestPayloadArrayAtIndex(0,
AutomationConstants.OS_TARGET_SCHEMA_KIND);
String responseCode = pollStorageForWksOfRawInRelationshipBlock(wksRecordId);
boolean recordCreatedOrUpdated = responseCode.equals(AutomationConstants.RECORD_CREATED)
| responseCode.equals(AutomationConstants.REQUEST_SUCCESS);
assertTrue(recordCreatedOrUpdated);
staticWaitForIndexingToCommence();
});
Given("I hit Storage service put end point with {string} whose raw record contains relationship to record raw1",
(String parentInputPayload) -> {
persistRecordWithRelationshipBlock(parentInputPayload);
});
Then("Transformed record should contain relationship to wks of raw1 {string} as per {string}",
(String inputPayload, String expectedRelationshipBlock) -> {
List<String> ids = extractRecordIdFromPayload(inputPayload);
List<String> wksRecordIdsInRelationshipBlock = new ArrayList<>();
for (String id : ids) {
wksRecordIdsInRelationshipBlock
.add(this.createWKSRecordId(id, AutomationConstants.OS_TARGET_SCHEMA_KIND));
}
verifyRelationshipsBlockOfWksCreated(expectedRelationshipBlock, wksRecordIdsInRelationshipBlock,
AutomationConstants.OS_TARGET_SCHEMA_KIND);
});
Then("Transformed record should contain relationship to wks with same authority of raw1 {string} as per {string}",
(String inputPayload, String expectedRelationshipBlock) -> {
List<String> ids = extractRecordIdFromPayload(inputPayload);
List<String> wksRecordIdsInRelationshipBlock = new ArrayList<>();
// WKS record with slb authority is expected
for (String id : ids) {
wksRecordIdsInRelationshipBlock.add(this.createWKSRecordId(id,
AutomationConstants.TARGET_FOR_TESTSOURCE_C_TESTENTITY_C.get(0)));
}
verifyRelationshipsBlockOfWksCreated(expectedRelationshipBlock, wksRecordIdsInRelationshipBlock,
AutomationConstants.OS_TARGET_SCHEMA_KIND);
});
Given("I hit Storage service put end point with {string} to persist two records say raw1 and raw2",
(String inputPayload) -> {
persistRecordToBeUsedInRelationshipBlock(inputPayload);
});
And("I verify that wks records are created for above raw records", () -> {
String wksRecordId = getWksIdForRecordFromRequestPayloadArrayAtIndex(0,
AutomationConstants.OS_TARGET_SCHEMA_KIND);
String responseCode = pollStorageForWksOfRawInRelationshipBlock(wksRecordId);
boolean recordCreatedOrUpdated = responseCode.equals(AutomationConstants.RECORD_CREATED)
| responseCode.equals(AutomationConstants.REQUEST_SUCCESS);
assertTrue(recordCreatedOrUpdated);
this.context.setToken(token);
this.context.setVendor();
}
wksRecordId = getWksIdForRecordFromRequestPayloadArrayAtIndex(1, AutomationConstants.OS_TARGET_SCHEMA_KIND);
responseCode = pollStorageForWksOfRawInRelationshipBlock(wksRecordId);
recordCreatedOrUpdated = responseCode.equals(AutomationConstants.RECORD_CREATED)
| responseCode.equals(AutomationConstants.REQUEST_SUCCESS);
assertTrue(recordCreatedOrUpdated);
staticWaitForIndexingToCommence();
});
And("I verify that two wks records are created for this raw record raw1", () -> {
checkMultipleWKSRecordsCreatedForEachKind(AutomationConstants.TARGET_FOR_TESTSOURCE_C_TESTENTITY_C);
});
And("I verify that three wks records are created for this raw record raw1", () -> {
checkMultipleWKSRecordsCreatedForEachKind(AutomationConstants.TARGET_FOR_TESTSOURCE_E_TESTENTITY_E);
});
And("I verify that three wks records are created for this raw record raw1 with only one matching entity",
() -> {
checkMultipleWKSRecordsCreatedForEachKind(AutomationConstants.TARGET_FOR_TESTSOURCE_F_TESTENTITY_F);
});
And("I verify that two wks records are created for this raw record raw1 with no matching authority or entity",
() -> {
checkMultipleWKSRecordsCreatedForEachKind(AutomationConstants.TARGET_FOR_TESTSOURCE_D_TESTENTITY_D);
});
And("I verify that multiple wks records are created for each of the above raw records", () -> {
checkMultipleWKSRecordsCreatedForEachKind(AutomationConstants.TARGET_FOR_AT_TESTENTITY_A);
checkMultipleWKSRecordsCreatedForEachKindForSecondRecord(AutomationConstants.TARGET_FOR_AT_LOG);
});
And("I verify that multiple wks records are created for each of the above raw records having same autority and different entities",
() -> {
checkMultipleWKSRecordsCreatedForEachKind(AutomationConstants.TARGET_FOR_TESTSOURCE_G_TESTENTITY_G);
checkMultipleWKSRecordsCreatedForEachKindForSecondRecord(
AutomationConstants.TARGET_FOR_TESTSOURCE_H_TESTENTITY_H);
});
And("I verify that multiple wks records are created for each of the above raw records having same autority",
() -> {
checkMultipleWKSRecordsCreatedForEachKind(AutomationConstants.TARGET_FOR_TESTSOURCE_I_TESTENTITY_I);
checkMultipleWKSRecordsCreatedForEachKindForSecondRecord(AutomationConstants.TARGET_FOR_AT_LOGSET1);
});
Given("I hit wks service with {string} whose raw record contains relationship to above records",
(String inputPayload) -> {
persistRecordWithRelationshipBlock(inputPayload);
staticWaitForIndexingToCommence();
});
Then("Transformed record should contain relationship to wks records of raw1 and raw2 {string} as per {string}",
(String inputPayload, String expectedRelationshipBlock) -> {
List<String> ids = extractRecordIdFromPayload(inputPayload);
List<String> wksRecordIdsInRelationshipBlock = new ArrayList<>();
for (String id : ids) {
wksRecordIdsInRelationshipBlock
.add(this.createWKSRecordId(id, AutomationConstants.OS_TARGET_SCHEMA_KIND));
}
verifyRelationshipsBlockOfWksCreated(expectedRelationshipBlock, wksRecordIdsInRelationshipBlock,
AutomationConstants.OS_TARGET_SCHEMA_KIND);
});
Then("Transformed record should contain relationship to multiple wks records of raw1 and raw2 {string} as per {string}",
(String inputPayload, String expectedRelationshipBlock) -> {
List<String> ids = extractRecordIdFromPayload(inputPayload);
List<String> wksRecordIdsInRelationshipBlock = new ArrayList<>();
for (String id : ids) {
if (id.contains("well"))
wksRecordIdsInRelationshipBlock.add(
this.createWKSRecordId(id, AutomationConstants.TARGET_FOR_AT_TESTENTITY_A.get(3)));
else
wksRecordIdsInRelationshipBlock
.add(this.createWKSRecordId(id, AutomationConstants.TARGET_FOR_AT_LOG.get(3)));
}
verifyRelationshipsBlockOfWksCreated(expectedRelationshipBlock, wksRecordIdsInRelationshipBlock,
AutomationConstants.OS_TARGET_SCHEMA_KIND);
});
Then("Transformed record should contain relationship to multiple wks records with same entity of raw1 and raw2 {string} as per {string}",
(String inputPayload, String expectedRelationshipBlock) -> {
List<String> ids = extractRecordIdFromPayload(inputPayload);
List<String> wksRecordIdsInRelationshipBlock = new ArrayList<>();
for (String id : ids) {
if (id.contains("testEntityG")) {