Commit ac994cd5 authored by Aman Verma's avatar Aman Verma
Browse files

removing redundant methods

parent 8ff30a9e
Pipeline #48498 failed with stages
in 2 minutes and 57 seconds
package org.opengroup.osdu.schema.stepdefs;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.util.ArrayList;
......@@ -70,133 +69,13 @@ public class SchemaServiceStepDef_GET implements En {
.url(TestConstants.HOST + TestConstants.GET_LIST_ENDPOINT).queryParams(queryParams)
.httpMethod(HttpRequest.GET).requestHeaders(this.context.getAuthHeaders()).build();
HttpResponse response = HttpClientFactory.getInstance().send(httpRequest);
// HttpResponse response = HttpResponse.builder()
// .code(200)
// .body("{\"schemaInfos\":[],\"offset\":0,\"count\":0,\"totalCount\":0}")
// .responseHeaders(new HashMap<>())
// .build();
this.context.setHttpResponse(response);
assertEquals("200", String.valueOf(response.getCode()));
LOGGER.log(Level.INFO, "resp - " + response.toString());
verifyGetListResponse(TestConstants.AUTHORITY, authority);
});
Given("I hit schema service GET List API with {string} , {string} , {string}",
(String parameter, String parameterVal, String latestVersion) -> {
Map<String, String> queryParams = new HashMap<String, String>();
queryParams.put(parameter, parameterVal);
queryParams.put("latestVersion", latestVersion);
HttpRequest httpRequest = HttpRequest.builder()
.url(TestConstants.HOST + TestConstants.GET_LIST_ENDPOINT).queryParams(queryParams)
.httpMethod(HttpRequest.GET).requestHeaders(this.context.getAuthHeaders()).build();
HttpResponse response = HttpClientFactory.getInstance().send(httpRequest);
this.context.setHttpResponse(response);
assertEquals("200", String.valueOf(response.getCode()));
LOGGER.log(Level.INFO, "resp - " + response.toString());
verifyGetListResponse(parameter, parameterVal);
});
Given("I hit schema service GET List API with filters of {string}, {string}, {string}, {string} and getLatest flag is {string}",
(String authority, String majorVersion, String minorVersion, String patchVersion,
String latestVersion) -> {
ArrayList<String> allValues = new ArrayList<>();
ArrayList<String> allKeys = new ArrayList<>();
Map<String, String> queryParams = new HashMap<String, String>();
if (majorVersion.equalsIgnoreCase(TestConstants.LATEST_VERSION))
majorVersion = this.context.getSchemaVersionMajor();
if (minorVersion.equalsIgnoreCase(TestConstants.LATEST_VERSION))
minorVersion = this.context.getSchemaVersionMinor();
if (patchVersion.equalsIgnoreCase(TestConstants.LATEST_VERSION))
patchVersion = this.context.getSchemaVersionPatch();
allValues.add(majorVersion);
allValues.add(minorVersion);
allValues.add(patchVersion);
allKeys.add(TestConstants.SCHEMA_MAJOR_VERSION);
allKeys.add(TestConstants.SCHEMA_MINOR_VERSION);
allKeys.add(TestConstants.SCHEMA_PATCH_VERSION);
for (int i = 0; i < allKeys.size(); i++) {
if (!allValues.get(i).equalsIgnoreCase("NA")) {
queryParams.put(allKeys.get(i), allValues.get(i));
}
}
queryParams.put(TestConstants.AUTHORITY, authority);
queryParams.put(TestConstants.LATEST_VERSION, latestVersion);
this.context.setQueryParams(queryParams);
HttpRequest httpRequest = HttpRequest.builder()
.url(TestConstants.HOST + TestConstants.GET_LIST_ENDPOINT).queryParams(queryParams)
.httpMethod(HttpRequest.GET).requestHeaders(this.context.getAuthHeaders()).build();
HttpResponse response = HttpClientFactory.getInstance().send(httpRequest);
this.context.setHttpResponse(response);
});
Then("service should respond back with schemaInfo list from internal as well as shared scope matching {string} and {string}",
(String parameter, String parameterVal) -> {
verifyGetListResponse(parameter, parameterVal);
});
Then("service should respond back with schemaInfo list matching {string} and {string}",
(String parameter, String parameterVal) -> {
parameterVal = selectVersionFromInput(parameterVal);
verifySchemaIdentityElementValues(parameter, parameterVal);
});
Given("I hit schema service GET API with {string}", (String schemaId) -> {
HttpRequest httpRequest = HttpRequest.builder()
.url(TestConstants.HOST + TestConstants.GET_ENDPOINT + schemaId).httpMethod(HttpRequest.GET)
.requestHeaders(this.context.getAuthHeaders()).build();
HttpResponse response = HttpClientFactory.getInstance().send(httpRequest);
this.context.setHttpResponse(response);
});
Then("service should respond back with success {string} and response {string}",
(String ReponseStatusCode, String SchemaToBeVerified) -> {
HttpResponse response = this.context.getHttpResponse();
assertEquals(ReponseStatusCode, String.valueOf(response.getCode()));
String body = this.context.getFileUtils().read(SchemaToBeVerified);
Gson gsn = new Gson();
JsonObject expectedData = gsn.fromJson(body, JsonObject.class);
JsonObject responseMsg = gsn.fromJson(response.getBody().toString(), JsonObject.class);
assertEquals(expectedData.get("schema").toString(), responseMsg.get("schema").toString());
});
Then("I GET updated schema", () -> {
HttpRequest httpRequest = HttpRequest.builder()
.url(TestConstants.HOST + TestConstants.GET_ENDPOINT + this.context.getSchemaIdFromInputPayload())
.httpMethod(HttpRequest.GET).requestHeaders(this.context.getAuthHeaders()).build();
HttpResponse response = HttpClientFactory.getInstance().send(httpRequest);
this.context.setHttpResponse(response);
assertEquals(TestConstants.GET_SUCCESSRESPONSECODE, String.valueOf(response.getCode()));
});
Then("I get response {string} when I try to get schema from {string} other than from where it was ingested",
(String responseCode, String otherTenant) -> {
Map<String, String> authHeaders = this.context.getAuthHeaders();
authHeaders.put(TestConstants.DATA_PARTITION_ID, otherTenant);
HttpRequest httpRequest = HttpRequest.builder()
.url(TestConstants.HOST + TestConstants.GET_ENDPOINT
+ this.context.getSchemaIdFromInputPayload())
.httpMethod(HttpRequest.GET).requestHeaders(authHeaders).build();
HttpResponse response = HttpClientFactory.getInstance().send(httpRequest);
this.context.setHttpResponse(response);
assertEquals(responseCode, String.valueOf(response.getCode()));
verifyGetListResponse(TestConstants.AUTHORITY, authority);
});
Then("I GET udapted Schema with {string}", (String ReponseStatusCode) -> {
HttpRequest httpRequest = HttpRequest.builder()
.url(TestConstants.HOST + TestConstants.GET_ENDPOINT + this.context.getSchemaIdFromInputPayload())
.httpMethod(HttpRequest.GET).requestHeaders(this.context.getAuthHeaders()).build();
HttpResponse response = HttpClientFactory.getInstance().send(httpRequest);
this.context.setHttpResponse(response);
assertEquals(ReponseStatusCode, String.valueOf(response.getCode()));
});
Then("schema service should respond back with {string} and {string}",
(String ReponseStatusCode, String ResponseToBeVerified) -> {
HttpRequest httpRequest = HttpRequest.builder()
......@@ -212,113 +91,6 @@ public class SchemaServiceStepDef_GET implements En {
assertEquals(expectedData.toString(), responseMsg.toString());
});
Given("I hit schema service GET List API with {string} and {string}",
(String parameter, String parameterVal) -> {
parameterVal = selectVersionFromInput(parameterVal);
Map<String, String> queryParams = new HashMap<String, String>();
queryParams.put(parameter, parameterVal);
HttpRequest httpRequest = HttpRequest.builder()
.url(TestConstants.HOST + TestConstants.GET_LIST_ENDPOINT).queryParams(queryParams)
.httpMethod(HttpRequest.GET).requestHeaders(this.context.getAuthHeaders()).build();
HttpResponse response = HttpClientFactory.getInstance().send(httpRequest);
this.context.setHttpResponse(response);
});
Given("I hit schema service GET API with blank {string}", (String header) -> {
Map<String, String> authHeaders = this.context.getAuthHeaders();
if (header.equalsIgnoreCase("authorization")) {
authHeaders.put(TestConstants.AUTHORIZATION, "");
} else {
authHeaders.put(TestConstants.DATA_PARTITION_ID, "");
}
Map<String, String> queryParams = new HashMap<String, String>();
HttpRequest httpRequest = HttpRequest.builder().url(TestConstants.HOST + TestConstants.GET_LIST_ENDPOINT)
.queryParams(queryParams).httpMethod(HttpRequest.GET).requestHeaders(authHeaders).build();
HttpResponse response = HttpClientFactory.getInstance().send(httpRequest);
this.context.setHttpResponse(response);
});
Given("I hit schema service GET List API with query parameters having values {string}, {string}, {string}, {string}, {string}, {string}, {string}, {string}, {string}",
(String authorityVal, String sourceVal, String entityTypeVal, String statusVal, String scopeVal,
String majorVersionVal, String minorVersionVal, String patchVersionVal, String count) -> {
ArrayList<String> allValues = new ArrayList<>();
ArrayList<String> allKeys = new ArrayList<>();
Map<String, String> queryParams = new HashMap<String, String>();
if (majorVersionVal.equalsIgnoreCase(TestConstants.MAJOR_VERSION))
majorVersionVal = this.context.getSchemaVersionMajor();
if (minorVersionVal.equalsIgnoreCase(TestConstants.MINOR_VERSION))
minorVersionVal = this.context.getSchemaVersionMinor();
if (patchVersionVal.equalsIgnoreCase(TestConstants.PATCH_VERSION))
patchVersionVal = this.context.getSchemaVersionPatch();
allValues.add(authorityVal);
allValues.add(sourceVal);
allValues.add(entityTypeVal);
allValues.add(statusVal);
allValues.add(scopeVal);
allValues.add(majorVersionVal);
allValues.add(minorVersionVal);
allValues.add(patchVersionVal);
allKeys.add("authority");
allKeys.add("source");
allKeys.add("entityType");
allKeys.add("status");
allKeys.add("scope");
allKeys.add("schemaVersionMajor");
allKeys.add("schemaVersionMinor");
allKeys.add("schemaVersionPatch");
for (int i = 0; i < allKeys.size(); i++) {
if (!allValues.get(i).equalsIgnoreCase("NA")) {
queryParams.put(allKeys.get(i), allValues.get(i));
}
}
this.context.setQueryParams(queryParams);
HttpRequest httpRequest = HttpRequest.builder()
.url(TestConstants.HOST + TestConstants.GET_LIST_ENDPOINT).queryParams(queryParams)
.httpMethod(HttpRequest.GET).requestHeaders(this.context.getAuthHeaders()).build();
HttpResponse response = HttpClientFactory.getInstance().send(httpRequest);
this.context.setHttpResponse(response);
});
Then("service should respond back with {string} and schemaInfo list values matching to input",
(String responseCode) -> {
verifyGetResponseForMultipleValues(responseCode);
});
Then("service should respond back with {string} and {string} schema with correct major, minor and patch version.",
(String ReponseStatusCode, String ResponseMessage) -> {
String body = this.context.getFileUtils().read(ResponseMessage);
JsonObject jsonBody = new Gson().fromJson(body, JsonObject.class);
HttpResponse response = this.context.getHttpResponse();
if (response != null) {
assertEquals(ReponseStatusCode, String.valueOf(response.getCode()));
verifySchemaIdentityElementValues(TestConstants.SCHEMA_MAJOR_VERSION,
this.context.getSchemaVersionMajor());
verifySchemaIdentityElementValues(TestConstants.SCHEMA_MINOR_VERSION,
this.context.getSchemaVersionMinor());
verifySchemaIdentityElementValues(TestConstants.SCHEMA_PATCH_VERSION,
this.context.getSchemaVersionPatch());
}
});
Then("Then service should respond back with status code {string} or {string}",
(String ResponseStatusCode, String AlternateStatusCode) -> {
HttpResponse response = this.context.getHttpResponse();
if (response != null) {
assertTrue(ResponseStatusCode.equals(String.valueOf(response.getCode()))
|| AlternateStatusCode.equals(String.valueOf(response.getCode())));
}
});
}
private void verifyGetListResponse(String parameter, String parameterVal) throws IOException {
......@@ -326,16 +98,6 @@ public class SchemaServiceStepDef_GET implements En {
verifySchemaInfoResponse(parameter, parameterVal);
}
private String selectVersionFromInput(String parameterVal) {
if (parameterVal.equalsIgnoreCase(TestConstants.MAJOR_VERSION)) {
parameterVal = this.context.getSchemaVersionMajor();
} else if (parameterVal.equalsIgnoreCase(TestConstants.MINOR_VERSION)) {
parameterVal = this.context.getSchemaVersionMinor();
} else if (parameterVal.equalsIgnoreCase(TestConstants.PATCH_VERSION)) {
parameterVal = this.context.getSchemaVersionPatch();
}
return parameterVal;
}
public void prepareSchemaParameterMapList() throws IOException {
String response = this.context.getHttpResponse().getBody();
......@@ -387,46 +149,6 @@ public class SchemaServiceStepDef_GET implements En {
}
}
public void verifySchemaIdentityElementValues(String parameter, String value) throws IOException {
String response = this.context.getHttpResponse().getBody();
Gson gsn = new Gson();
JsonObject schemaInfosList = gsn.fromJson(response, JsonObject.class);
JsonArray root = (JsonArray) schemaInfosList.get("schemaInfos");
verifyResponseJsonElement(parameter, value, root);
}
private void verifyResponseJsonElement(String parameter, String value, JsonArray root) {
for (JsonElement eachSchemaInfo : root) {
if (parameter.equalsIgnoreCase("status") || parameter.equalsIgnoreCase("scope")) {
String ActualVal = eachSchemaInfo.getAsJsonObject().get(parameter).getAsString();
assertEquals(ActualVal, value);
} else {
JsonObject schemaIdentity_ForEachSchemaInfo = (JsonObject) eachSchemaInfo.getAsJsonObject()
.get("schemaIdentity");
String ActualVal = schemaIdentity_ForEachSchemaInfo.get(parameter).getAsString();
assertEquals(ActualVal, value);
}
}
}
public void verifyGetResponseForMultipleValues(String responseCode) throws IOException {
int respCode = this.context.getHttpResponse().getCode();
assertEquals(responseCode, String.valueOf(respCode));
Map<String, String> queryParams = this.context.getQueryParams();
String response = this.context.getHttpResponse().getBody();
Gson gsn = new Gson();
JsonObject schemaInfosList = gsn.fromJson(response, JsonObject.class);
JsonArray root = (JsonArray) schemaInfosList.get("schemaInfos");
queryParams.entrySet().stream().forEach(entry -> {
String key = entry.getKey();
String value = entry.getValue();
verifyResponseJsonElement(key, value, root);
});
}
private String selectTenant(String tenant) {
switch (tenant) {
......
package org.opengroup.osdu.schema.stepdefs;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import org.junit.Assert;
import org.opengroup.osdu.schema.constants.TestConstants;
import org.opengroup.osdu.schema.stepdefs.model.HttpRequest;
import org.opengroup.osdu.schema.stepdefs.model.HttpResponse;
import org.opengroup.osdu.schema.stepdefs.model.SchemaServiceScope;
import org.opengroup.osdu.schema.util.HttpClientFactory;
import org.opengroup.osdu.schema.util.JsonUtils;
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;
public class SchemaServiceStepDef_POST implements En {
@Inject
private SchemaServiceScope context;
static String[] GetListBaseFilterArray;
static String[] GetListVersionFilterArray;
String queryParameter;
private final static Logger LOGGER = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
List<HashMap<String, String>> list_schemaParameterMap = new ArrayList<HashMap<String, String>>();
public SchemaServiceStepDef_POST() {
Given("I hit schema service POST API with {string} and data-partition-id as {string} only if status is not development",
(String inputPayload, String tenant) -> {
tenant = selectTenant(tenant);
String resp = this.context.getHttpResponse().getBody();
Gson gsn = new Gson();
JsonObject schemaInfosList = gsn.fromJson(resp, JsonObject.class);
JsonArray root = (JsonArray) schemaInfosList.get("schemaInfos");
if (!"DEVELOPMENT".equals(context.getStatus()) || (root.size() == 0)) {
String body = this.context.getFileUtils().read(inputPayload);
JsonElement jsonBody = new Gson().fromJson(body, JsonElement.class);
int currentMinorVersion = 0;
int currentMajorVersion = 0;
if (root.size() > 0) {
currentMinorVersion = Integer.parseInt(this.context.getSchemaVersionMinor());
currentMajorVersion = Integer.parseInt(this.context.getSchemaVersionMajor());
}
int nextMinorVersion = currentMinorVersion + 1;
int nextMajorVersion = currentMajorVersion + 1;
String schemaId = "OSDUTest:testSource:testEntity:" + nextMajorVersion + "."
+ nextMinorVersion + ".0";
this.context.setSchemaIdFromInputPayload(schemaId);
updateVersionInJsonBody(jsonBody, nextMinorVersion, nextMajorVersion, schemaId);
HttpResponse response = postRequest(jsonBody, schemaId, tenant);
assertEquals("201", String.valueOf(response.getCode()));
this.context.setHttpResponse(response);
prepareSchemaParameterMapList();
}
});
Given("I hit schema service POST API with {string} and data-partition-id as {string}",
(String inputPayload, String tenant) -> {
tenant = selectTenant(tenant);
String body = this.context.getFileUtils().read(inputPayload);
JsonElement jsonBody = new Gson().fromJson(body, JsonElement.class);
int currentMinorVersion = Integer.parseInt(this.context.getSchemaVersionMinor());
int currentMajorVersion = Integer.parseInt(this.context.getSchemaVersionMajor());
int nextMinorVersion = currentMinorVersion + 1;
int nextMajorVersion = currentMajorVersion + 1;
String schemaId = "OSDUTest:testSource:testEntity:" + nextMajorVersion + "."
+ nextMinorVersion + ".0";
this.context.setSchemaIdFromInputPayload(schemaId);
updateVersionInJsonBody(jsonBody, nextMinorVersion, nextMajorVersion, schemaId);
HttpResponse response = postRequest(jsonBody, schemaId, tenant);
this.context.setHttpResponse(response);
});
Given("I hit schema service POST API with {string} and data-partition-id as {string} with increased minor version only",
(String inputPayload, String tenant) -> {
tenant = selectTenant(tenant);
String body = this.context.getFileUtils().read(inputPayload);
JsonElement jsonBody = new Gson().fromJson(body, JsonElement.class);
int currentMinorVersion = Integer.parseInt(this.context.getSchemaVersionMinor());
int currentMajorVersion = Integer.parseInt(this.context.getSchemaVersionMajor());
int nextMinorVersion = currentMinorVersion + 1;
int nextMajorVersion = currentMajorVersion;
String id = "OSDUTest:testSource:testEntity:" + nextMajorVersion + "." + nextMinorVersion
+ ".0";
updateVersionInJsonBody(jsonBody, nextMinorVersion, nextMajorVersion, id);
body = new Gson().toJson(jsonBody);
this.context.setSchemaIdFromInputPayload(id);
this.context
.setSchemaFromInputPayload(jsonBody.getAsJsonObject().get(TestConstants.SCHEMA).toString());
this.context.setJsonPayloadForPostPUT(jsonBody.toString());
Map<String, String> headers = this.context.getAuthHeaders();
headers.put(TestConstants.DATA_PARTITION_ID, tenant);
this.context.setAuthHeaders(headers);
HttpRequest httpRequest = HttpRequest.builder()
.url(TestConstants.HOST + TestConstants.POST_ENDPOINT).body(jsonBody.toString())
.httpMethod(HttpRequest.POST).requestHeaders(headers).build();
HttpResponse response = HttpClientFactory.getInstance().send(httpRequest);
this.context.setHttpResponse(response);
});
Given("I hit schema service POST API with {string} and data-partition-id as {string} without increasing any version",
(String inputPayload, String tenant) -> {
tenant = selectTenant(tenant);
String body = this.context.getFileUtils().read(inputPayload);
JsonElement jsonBody = new Gson().fromJson(body, JsonElement.class);
int currentMinorVersion = Integer.parseInt(this.context.getSchemaVersionMinor());
int currentMajorVersion = Integer.parseInt(this.context.getSchemaVersionMajor());
int nextMinorVersion = currentMinorVersion;
int nextMajorVersion = currentMajorVersion;
String id = "OSDUTest:testSource:testEntity:" + nextMajorVersion + "." + nextMinorVersion
+ ".0";
updateVersionInJsonBody(jsonBody, nextMinorVersion, nextMajorVersion, id);
body = new Gson().toJson(jsonBody);
this.context.setSchemaIdFromInputPayload(id);
this.context
.setSchemaFromInputPayload(jsonBody.getAsJsonObject().get(TestConstants.SCHEMA).toString());
this.context.setJsonPayloadForPostPUT(jsonBody.toString());
Map<String, String> headers = this.context.getAuthHeaders();
headers.put(TestConstants.DATA_PARTITION_ID, tenant);
this.context.setAuthHeaders(headers);
HttpRequest httpRequest = HttpRequest.builder()
.url(TestConstants.HOST + TestConstants.POST_ENDPOINT).body(jsonBody.toString())
.httpMethod(HttpRequest.POST).requestHeaders(headers).build();
HttpResponse response = HttpClientFactory.getInstance().send(httpRequest);
this.context.setHttpResponse(response);
});
Then("service should respond back with {string} and {string}",
(String ReponseStatusCode, String ResponseMessage) -> {
String body = this.context.getFileUtils().read(ResponseMessage);
JsonObject jsonBody = new Gson().fromJson(body, JsonObject.class);
HttpResponse response = this.context.getHttpResponse();
if (response != null) {
assertEquals(ReponseStatusCode, String.valueOf(response.getCode()));
commonAssertion(response, jsonBody);
Assert.assertNotNull(jsonBody.get(TestConstants.DATE_CREATED));
Assert.assertNotNull(jsonBody.get(TestConstants.CREATED_BY));
}
});
Then("service should respond back with {string} and {string} and scope whould be {string}",
(String ReponseStatusCode, String ResponseMessage, String scope) -> {
String body = this.context.getFileUtils().read(ResponseMessage);
JsonObject jsonBody = new Gson().fromJson(body, JsonObject.class);
HttpResponse response = this.context.getHttpResponse();
if (response != null) {
assertEquals(ReponseStatusCode, String.valueOf(response.getCode()));
commonAssertion(response, jsonBody);
Assert.assertNotNull(jsonBody.get(TestConstants.DATE_CREATED));
Assert.assertNotNull(jsonBody.get(TestConstants.CREATED_BY));
}
});
Then("service should respond back with error {string} and {string}",
(String ReponseStatusCode, String ResponseToBeVerified) -> {
HttpResponse response = this.context.getHttpResponse();
assertEquals(ReponseStatusCode, String.valueOf(response.getCode()));
String body = this.context.getFileUtils().read(ResponseToBeVerified);
Gson gsn = new Gson();
JsonObject expectedData = gsn.fromJson(body, JsonObject.class);
JsonObject responseMsg = gsn.fromJson(response.getBody().toString(), JsonObject.class);
if(!response.getBody().isEmpty())
assertEquals(expectedData.toString(), responseMsg.toString());
});
Given("I hit schema service POST API with {string} and auth token invalid", (String inputPayload) -> {
String body = this.context.getFileUtils().read(inputPayload);
JsonObject jsonBody = new Gson().fromJson(body, JsonObject.class);
Map<String, String> invalidAuthTokenHeaders = this.context.getAuthHeaders();
invalidAuthTokenHeaders.put(TestConstants.AUTHORIZATION, this.context.getToken() + "_invalidHeaders");
HttpRequest httpRequest = HttpRequest.builder().url(TestConstants.HOST + TestConstants.POST_ENDPOINT)
.body(jsonBody.toString()).httpMethod(HttpRequest.POST).requestHeaders(invalidAuthTokenHeaders)
.build();
HttpResponse response = HttpClientFactory.getInstance().send(httpRequest);
this.context.setHttpResponse(response);
});
Given("I hit schema service POST API with {string} for input json validation", (String inputPayload) -> {
String body = this.context.getFileUtils().read(inputPayload);
HttpRequest httpRequest = HttpRequest.builder().url(TestConstants.HOST + TestConstants.POST_ENDPOINT)
.body(body).httpMethod(HttpRequest.POST).requestHeaders(this.context.getAuthHeaders()).build();
HttpResponse response = HttpClientFactory.getInstance().send(httpRequest);
this.context.setHttpResponse(response);
});
Given("I hit schema service POST API with {string}", (String inputPayload) -> {
String body = this.context.getFileUtils().read(inputPayload);
JsonObject jsonBody = new Gson().fromJson(body, JsonObject.class);