Commit 2d601ea1 authored by RPrakash3's avatar RPrakash3
Browse files

Removed unused imports and corrected step defs

parent c430eea6
Pipeline #46641 failed with stages
in 23 minutes and 8 seconds
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;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.google.common.hash.Hashing;
import org.apache.commons.lang3.RandomStringUtils;
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;
import org.opengroup.osdu.de.automation.model.HttpResponse;
import org.opengroup.osdu.de.automation.util.HttpClientFactory;
import org.opengroup.osdu.wks.model.AutomationConstants;
import org.opengroup.osdu.wks.model.WksIntegrationTestScope;
import org.opengroup.osdu.wks.util.AuthUtil;
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 HappyFlowStepDefs implements En {
......@@ -48,16 +33,16 @@ public class HappyFlowStepDefs implements En {
public HappyFlowStepDefs() {
Given("I hit Storage service put end point with {string}", (String inputPayload) -> {
String payload = this.context.getFileUtils().read(inputPayload);
String payload = context.getFileUtils().read(inputPayload);
payload = commonMethods.updatePlaceholdersInInputPayload(payload);
String recordId = commonMethods.generateRandomId(payload);
this.context.setCustomRecordId(recordId);
LOGGER.log(Level.INFO, "Random record ID : " + this.context.getCustomRecordId());
this.context.setCustomValToVerifyUpdateOperation(RandomStringUtils.randomAlphabetic(10));
context.setCustomRecordId(recordId);
LOGGER.log(Level.INFO, "Random record ID : " + context.getCustomRecordId());
context.setCustomValToVerifyUpdateOperation(RandomStringUtils.randomAlphabetic(10));
payload = payload.replace("<CreateUniqueID>", recordId).replace("<RandomText>",
this.context.getCustomValToVerifyUpdateOperation());
context.getCustomValToVerifyUpdateOperation());
commonMethods.postToStorage(payload);
LOGGER.log(Level.INFO, "Storage Post Response : " + this.context.getHttpResponse().getBody());
LOGGER.log(Level.INFO, "Storage Post Response : " + context.getHttpResponse().getBody());
});
Then("Transformed record should be created in storage with {string}", (String tagsblock) -> {
......@@ -72,7 +57,7 @@ public class HappyFlowStepDefs implements En {
JsonElement responseGiven = new Gson().fromJson(wksResponseBody, JsonElement.class);
JsonObject tagsResponseArray = responseGiven.getAsJsonObject().getAsJsonObject("tags");
String expectedMetaBody = this.context.getFileUtils().read(tagsblock);
String expectedMetaBody = context.getFileUtils().read(tagsblock);
JsonElement expectedJsonBody = new Gson().fromJson(expectedMetaBody, JsonElement.class);
JsonObject tagsExpectedArray = expectedJsonBody.getAsJsonObject().getAsJsonObject("tags");
assertTrue(tagsResponseArray.toString().contentEquals(tagsExpectedArray.toString()));
......@@ -96,7 +81,7 @@ public class HappyFlowStepDefs implements En {
});
And("Wks records should be created in the intended kind", () -> {
List<HttpResponse> httpResponseList = this.context.getResponseList();
List<HttpResponse> httpResponseList = 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();
......@@ -105,22 +90,22 @@ public class HappyFlowStepDefs implements En {
});
When("I hit Storage service put end point to update raw record with {string}", (String updatePayload) -> {
String payload = this.context.getFileUtils().read(updatePayload);
String payload = context.getFileUtils().read(updatePayload);
payload = commonMethods.updatePlaceholdersInInputPayload(payload);
String existingRecordInStorage = this.context.getCustomRecordId();
this.context.setCustomValToVerifyUpdateOperation(RandomStringUtils.randomAlphabetic(10));
String existingRecordInStorage = context.getCustomRecordId();
context.setCustomValToVerifyUpdateOperation(RandomStringUtils.randomAlphabetic(10));
payload = payload.replace("<CreateUniqueID>", existingRecordInStorage).replace("<RandomText>",
this.context.getCustomValToVerifyUpdateOperation());
this.context.setInputPayload(payload);
context.getCustomValToVerifyUpdateOperation());
context.setInputPayload(payload);
commonMethods.postToStorage(payload);
LOGGER.log(Level.INFO, "Storage Post Response : " + this.context.getHttpResponse().getBody());
LOGGER.log(Level.INFO, "Storage Post Response : " + context.getHttpResponse().getBody());
});
Then("Existing WKS records in storage should get updated", () -> {
String initialWksRecordData = this.context.getCustomValToVerifyUpdateOperation();
String initialWksRecordData = context.getCustomValToVerifyUpdateOperation();
String postUpdateWksRecordData = null;
List<HttpResponse> httpResponseList = this.context.getResponseList();
List<HttpResponse> httpResponseList = context.getResponseList();
for (int i = 0; i < httpResponseList.size(); i++) {
......@@ -131,13 +116,13 @@ public class HappyFlowStepDefs implements En {
String wksId = new JsonPath(httpResponseList.get(i).getBody()).get("id").toString();
String responseCode = commonMethods.storageGetResponse(wksId);
if (responseCode.equals(AutomationConstants.REQUEST_SUCCESS)) {
postUpdateWksRecordData = new JsonPath(this.context.getHttpResponse().getBody()).get("data.uwi")
postUpdateWksRecordData = new JsonPath(context.getHttpResponse().getBody()).get("data.uwi")
.toString();
if (initialWksRecordData.equalsIgnoreCase(postUpdateWksRecordData))
break;
}
}
LOGGER.log(Level.INFO, "Storage Response : " + this.context.getHttpResponse().getBody());
LOGGER.log(Level.INFO, "Storage Response : " + context.getHttpResponse().getBody());
assertTrue("Expected: " + initialWksRecordData + " , Actual: " + postUpdateWksRecordData,
initialWksRecordData.equalsIgnoreCase(postUpdateWksRecordData));
}
......@@ -149,12 +134,12 @@ public class HappyFlowStepDefs implements En {
long initial = System.currentTimeMillis();
while ((System.currentTimeMillis() - initial) < (AutomationConstants.RECORD_SEARCH_MAX_TIMEOUT_SEC)
* 1000) {
String responseCode = commonMethods.storageGetResponse(this.context.getCustomRecordId());
String responseCode = commonMethods.storageGetResponse(context.getCustomRecordId());
if (responseCode.equals(AutomationConstants.REQUEST_SUCCESS)) {
String version = new JsonPath(this.context.getHttpResponse().getBody()).get("version").toString();
rawRecordWithVersionForAncestry = this.context.getCustomRecordId()
String version = new JsonPath(context.getHttpResponse().getBody()).get("version").toString();
rawRecordWithVersionForAncestry = context.getCustomRecordId()
+ AutomationConstants.COLON_SEPARATOR + version;
this.context.setRawRecordWithVersionForAncestry(rawRecordWithVersionForAncestry);
context.setRawRecordWithVersionForAncestry(rawRecordWithVersionForAncestry);
LOGGER.log(Level.INFO, "ancestry value - " + rawRecordWithVersionForAncestry);
break;
}
......@@ -163,33 +148,33 @@ public class HappyFlowStepDefs implements En {
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")
String actualWksDataBlock = new JsonPath(context.getHttpResponse().getBody()).get("data")
.toString();
String expectedWksDataBlock = new JsonPath(this.context.getFileUtils().read(expectedWksRecord))
String expectedWksDataBlock = new JsonPath(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]")
String actualWksAncestry = new JsonPath(context.getHttpResponse().getBody()).get("ancestry.parents[0]")
.toString();
String expectedWksAncestry = this.context.getRawRecordWithVersionForAncestry();
String expectedWksAncestry = context.getRawRecordWithVersionForAncestry();
assertEquals("Expected: " + expectedWksAncestry + " , Actual: " + actualWksAncestry, expectedWksAncestry,
actualWksAncestry);
commonMethods.deleteFromStorage(this.context.getCustomRecordId());
commonMethods.deleteFromStorage(context.getCustomRecordId());
assertTrue(commonMethods.recordDeleted());
commonMethods.deleteFromStorage(this.context.getWksRecordIdForCustomRawRecord());
commonMethods.deleteFromStorage(context.getWksRecordIdForCustomRawRecord());
assertTrue(commonMethods.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")
String actualWksMetaBlock = new JsonPath(context.getHttpResponse().getBody()).get("meta")
.toString();
String expectedWksMetaBlock = new JsonPath(this.context.getFileUtils().read(expectedWksRecord))
String expectedWksMetaBlock = new JsonPath(context.getFileUtils().read(expectedWksRecord))
.get("meta").toString();
assertEquals("Expected: " + expectedWksMetaBlock + " , Actual: " + actualWksMetaBlock,
expectedWksMetaBlock, actualWksMetaBlock);
......@@ -198,77 +183,77 @@ public class HappyFlowStepDefs implements En {
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();
String actualKind = new JsonPath(context.getHttpResponse().getBody()).get("kind").toString();
assertEquals(expectedKind, actualKind);
});
Then("Existing WKS record in storage should get updated", () -> {
String initialWksRecordData = this.context.getCustomValToVerifyUpdateOperation();
String initialWksRecordData = context.getCustomValToVerifyUpdateOperation();
String postUpdateWksRecordData = null;
long initial = System.currentTimeMillis();
while ((System.currentTimeMillis() - initial) < (AutomationConstants.RECORD_SEARCH_MAX_TIMEOUT_SEC)
* 1000) {
String responseCode = commonMethods.storageGetResponse(this.context.getWksRecordIdForCustomRawRecord());
String responseCode = commonMethods.storageGetResponse(context.getWksRecordIdForCustomRawRecord());
if (responseCode.equals(AutomationConstants.REQUEST_SUCCESS)) {
postUpdateWksRecordData = new JsonPath(this.context.getHttpResponse().getBody()).get("data.uwi")
postUpdateWksRecordData = new JsonPath(context.getHttpResponse().getBody()).get("data.uwi")
.toString();
if (initialWksRecordData.equalsIgnoreCase(postUpdateWksRecordData))
break;
}
}
LOGGER.log(Level.INFO, "Storage Response : " + this.context.getHttpResponse().getBody());
LOGGER.log(Level.INFO, "Storage Response : " + context.getHttpResponse().getBody());
assertTrue("Expected: " + initialWksRecordData + " , Actual: " + postUpdateWksRecordData,
initialWksRecordData.equalsIgnoreCase(postUpdateWksRecordData));
commonMethods.deleteFromStorage(this.context.getCustomRecordId());
commonMethods.deleteFromStorage(context.getCustomRecordId());
assertTrue(commonMethods.recordDeleted());
commonMethods.deleteFromStorage(this.context.getWksRecordIdForCustomRawRecord());
commonMethods.deleteFromStorage(context.getWksRecordIdForCustomRawRecord());
assertTrue(commonMethods.recordDeleted());
});
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);
String payload = context.getFileUtils().read(bulkRecord);
payload = commonMethods.updatePlaceholdersInInputPayload(payload);
JsonArray bulkRecords = new Gson().fromJson(payload, JsonArray.class);
List<String> recordList = new ArrayList<String>();
recordList.add(commonMethods.generateRandomId(bulkRecords.get(0).toString()));
recordList.add(commonMethods.generateRawRecordId(AutomationConstants.OS_TARGET_SCHEMA_KIND_TENANT));
recordList.add(commonMethods.generateRandomId(bulkRecords.get(2).toString()));
this.context.setBulkRawRecordIdList(recordList);
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);
commonMethods.postToStorage(payload);
LOGGER.log(Level.INFO, "Storage Post Response : " + this.context.getHttpResponse().getBody());
LOGGER.log(Level.INFO, "Storage Post Response : " + context.getHttpResponse().getBody());
});
Then("Transformation of Wks records should be skipped", () -> {
String responseCode = commonMethods.fetchRecordFromStorage(commonMethods.createWKSRecordId(
this.context.getBulkRawRecordIdList().get(1), AutomationConstants.OS_TARGET_SCHEMA_KIND));
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 = commonMethods.fetchRecordFromStorage(commonMethods.createWKSRecordId(
this.context.getBulkRawRecordIdList().get(0), AutomationConstants.OS_TARGET_SCHEMA_KIND));
context.getBulkRawRecordIdList().get(0), AutomationConstants.OS_TARGET_SCHEMA_KIND));
assertEquals(AutomationConstants.REQUEST_SUCCESS, responseCode);
responseCode = commonMethods.fetchRecordFromStorage(commonMethods.createWKSRecordId(
this.context.getBulkRawRecordIdList().get(2), AutomationConstants.OS_TARGET_SCHEMA_KIND));
context.getBulkRawRecordIdList().get(2), AutomationConstants.OS_TARGET_SCHEMA_KIND));
assertEquals(AutomationConstants.REQUEST_SUCCESS, responseCode);
this.context.getBulkRawRecordIdList().forEach(recordId -> {
context.getBulkRawRecordIdList().forEach(recordId -> {
commonMethods.deleteFromStorage(recordId);
assertTrue(commonMethods.recordDeleted());
});
commonMethods.deleteFromStorage(commonMethods.createWksRecordIdFromCustomRawRecord(
this.context.getBulkRawRecordIdList().get(0), AutomationConstants.OS_TARGET_SCHEMA_KIND));
context.getBulkRawRecordIdList().get(0), AutomationConstants.OS_TARGET_SCHEMA_KIND));
assertTrue(commonMethods.recordDeleted());
commonMethods.deleteFromStorage(commonMethods.createWksRecordIdFromCustomRawRecord(
this.context.getBulkRawRecordIdList().get(2), AutomationConstants.OS_TARGET_SCHEMA_KIND));
context.getBulkRawRecordIdList().get(2), AutomationConstants.OS_TARGET_SCHEMA_KIND));
assertTrue(commonMethods.recordDeleted());
});
......
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;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.google.common.hash.Hashing;
import org.apache.commons.lang3.RandomStringUtils;
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;
import org.opengroup.osdu.de.automation.model.HttpResponse;
import org.opengroup.osdu.de.automation.util.HttpClientFactory;
import org.opengroup.osdu.wks.model.AutomationConstants;
import org.opengroup.osdu.wks.model.WksIntegrationTestScope;
import org.opengroup.osdu.wks.util.AuthUtil;
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 NegativeTestStepDefs implements En {
......@@ -50,14 +23,14 @@ public class NegativeTestStepDefs 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(inputPayload);
String payload = context.getFileUtils().read(inputPayload);
payload = commonMethods.updatePlaceholdersInInputPayload(payload);
String recordId = commonMethods
.generateRawRecordId(AutomationConstants.OS_TARGET_SCHEMA_KIND_TENANT);
this.context.setCustomRecordId(recordId);
context.setCustomRecordId(recordId);
commonMethods.postToStorage(payload.replace("<CreateUniqueID>", recordId));
LOGGER.log(Level.INFO, "Storage Post Response : " + this.context.getHttpResponse().getBody());
assertEquals(String.valueOf(this.context.getHttpResponse().getCode()),
LOGGER.log(Level.INFO, "Storage Post Response : " + context.getHttpResponse().getBody());
assertEquals(String.valueOf(context.getHttpResponse().getCode()),
AutomationConstants.RECORD_CREATED);
});
......@@ -65,20 +38,20 @@ public class NegativeTestStepDefs implements En {
String responseCode = commonMethods
.pollStorageForAlreadyTransformedRecordType(AutomationConstants.OS_TARGET_SCHEMA_KIND);
assertEquals(AutomationConstants.RECORD_NOT_FOUND, responseCode);
commonMethods.deleteFromStorage(this.context.getCustomRecordId());
commonMethods.deleteFromStorage(context.getCustomRecordId());
assertTrue(commonMethods.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);
String payload = context.getFileUtils().read(inputPayload);
payload = commonMethods.updatePlaceholdersInInputPayload(payload);
String kindVal = (AutomationConstants.OS_TARGET_SCHEMA_KIND_TENANT).replace("wks:", "wke:");
String recordId = commonMethods.generateRawRecordId(kindVal);
this.context.setCustomRecordId(recordId);
context.setCustomRecordId(recordId);
commonMethods.postToStorage(payload.replace("<CreateUniqueID>", recordId));
LOGGER.log(Level.INFO, "Storage Post Response : " + this.context.getHttpResponse().getBody());
assertEquals(String.valueOf(this.context.getHttpResponse().getCode()),
LOGGER.log(Level.INFO, "Storage Post Response : " + context.getHttpResponse().getBody());
assertEquals(String.valueOf(context.getHttpResponse().getCode()),
AutomationConstants.RECORD_CREATED);
});
......@@ -87,21 +60,21 @@ public class NegativeTestStepDefs implements En {
(AutomationConstants.OS_TARGET_SCHEMA_KIND).replace("wks:", "wke:"));
assertEquals(AutomationConstants.RECORD_NOT_FOUND, responseCode);
commonMethods.deleteFromStorage(this.context.getCustomRecordId());
commonMethods.deleteFromStorage(context.getCustomRecordId());
assertTrue(commonMethods.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);
String payload = context.getFileUtils().read(inputPayload);
payload = commonMethods.updatePlaceholdersInInputPayload(payload);
String recordId = commonMethods.generateRandomId(payload);
this.context.setCustomRecordId(recordId);
LOGGER.log(Level.INFO, "Random record ID : " + this.context.getCustomRecordId());
context.setCustomRecordId(recordId);
LOGGER.log(Level.INFO, "Random record ID : " + context.getCustomRecordId());
payload = payload.replace("<CreateUniqueID>", recordId);
commonMethods.postToStorage(payload);
LOGGER.log(Level.INFO, "Storage Post Response : " + this.context.getHttpResponse().getBody());
assertEquals(String.valueOf(this.context.getHttpResponse().getCode()),
LOGGER.log(Level.INFO, "Storage Post Response : " + context.getHttpResponse().getBody());
assertEquals(String.valueOf(context.getHttpResponse().getCode()),
AutomationConstants.RECORD_CREATED);
});
......@@ -109,7 +82,7 @@ public class NegativeTestStepDefs implements En {
String responseCode = commonMethods.pollStorageForCurrentRecordInContext();
assertEquals(AutomationConstants.RECORD_NOT_FOUND, responseCode);
commonMethods.deleteFromStorage(this.context.getCustomRecordId());
commonMethods.deleteFromStorage(context.getCustomRecordId());
assertTrue(commonMethods.recordDeleted());
});
......
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;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.google.common.hash.Hashing;
import org.apache.commons.lang3.RandomStringUtils;
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;
import org.opengroup.osdu.de.automation.model.HttpResponse;
import org.opengroup.osdu.de.automation.util.HttpClientFactory;
import org.opengroup.osdu.wks.model.AutomationConstants;
import org.opengroup.osdu.wks.model.WksIntegrationTestScope;
import org.opengroup.osdu.wks.util.AuthUtil;
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 PreIntegrationStepDefs implements En {
......
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;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.google.common.hash.Hashing;
import org.apache.commons.lang3.RandomStringUtils;
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;
import org.opengroup.osdu.de.automation.model.HttpResponse;
import org.opengroup.osdu.de.automation.util.HttpClientFactory;
import org.opengroup.osdu.wks.model.AutomationConstants;
import org.opengroup.osdu.wks.model.WksIntegrationTestScope;
import org.opengroup.osdu.wks.util.AuthUtil;
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 RelationshipBlockTestStepDefs implements En {
......@@ -196,16 +172,16 @@ public class RelationshipBlockTestStepDefs implements En {
And("I hit Storage service put end point with record raw2 as per {string} having raw1 in its ancestry block",
(String inputPayload) -> {
String payload = this.context.getFileUtils().read(inputPayload);
String payload = context.getFileUtils().read(inputPayload);
payload = commonMethods.updatePlaceholdersInInputPayload(payload);
String recordId = commonMethods.generateRandomId(payload);
this.context.setCustomRecordId(recordId);
LOGGER.log(Level.INFO, "Random record ID : " + this.context.getCustomRecordId());
this.context.setCustomValToVerifyUpdateOperation(RandomStringUtils.randomAlphabetic(10));
context.setCustomRecordId(recordId);
LOGGER.log(Level.INFO, "Random record ID : " + context.getCustomRecordId());
context.setCustomValToVerifyUpdateOperation(RandomStringUtils.randomAlphabetic(10));
payload = payload.replace("<CreateUniqueID>", recordId).replace("<RandomText>",
this.context.getCustomValToVerifyUpdateOperation());
context.getCustomValToVerifyUpdateOperation());
commonMethods.postToStorage(payload);
LOGGER.log(Level.INFO, "Storage Post Response : " + this.context.getHttpResponse().getBody());
LOGGER.log(Level.INFO, "Storage Post Response : " + context.getHttpResponse().getBody());
});
And("I verify that three wks records are created for this raw record raw1 with only one matching entity",
......
Markdown is supported
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