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

updating feature file for PUT tests

parent 6838f2d6
Pipeline #46252 passed with stages
in 24 minutes and 14 seconds
......@@ -55,7 +55,42 @@ public class SchemaServiceStepDef_PUT implements En {
Given("I hit schema service PUT API with {string} only if status is not development",
(String inputPayload) -> {
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 = "SchemaSanityTest:testSource:testEntity:" + nextMajorVersion + "."
+ nextMinorVersion + ".0";
updateVersionInJsonBody(jsonBody, nextMinorVersion, nextMajorVersion, schemaId);
Map<String, String> headers = this.context.getAuthHeaders();
HttpRequest httpRequest = HttpRequest.builder().url(TestConstants.HOST + TestConstants.PUT_ENDPOINT)
HttpResponse response = HttpClientFactory.getInstance().send(httpRequest);
assertEquals("201", String.valueOf(response.getCode()));
Given("I hit schema service PUT API with {string} and mark schema as {string}.",
(String inputPayload, String status) -> {
......@@ -4,7 +4,8 @@ Feature: To verify functionality of PUT schema Service
Background: Common steps for all tests are executed
Given I generate user token and set request headers for "TENANT1"
Given I get latest schema with authority, source, entityType as "SchemaSanityTest", "testSource", "testEntity" respectively
Given I hit schema service POST API with "/input_payloads/postInPrivateScope_positiveScenario.json" and data-partition-id as "TENANT1" only if status is not development
Given I generate user token and set request headers for system partition
Given I hit schema service PUT API with "/input_payloads/postInPrivateScope_positiveScenario.json" only if status is not development
Scenario Outline: Verify that Schema Service's PUT API works correctly without scope field
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