diff --git a/src/main/java/api/test/rest/RestSessionContainer.java b/src/main/java/api/test/rest/RestSessionContainer.java index fb5d5b29636967e266b40b43bcb5952a6c4f6131..2ee38ebe4f7bdc4d68b4e8067d8c70abc50f019e 100644 --- a/src/main/java/api/test/rest/RestSessionContainer.java +++ b/src/main/java/api/test/rest/RestSessionContainer.java @@ -17,251 +17,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. package api.test.rest; -import api.test.rest.pojo.Member; +import api.test.rest.pojo.schema.Schema; public class RestSessionContainer { - private Member member; - private String oauthToken; - private String oauthUUID; - private String personEntityUUID; - private String organizationEntityUUID; - private String assetEntityUUID; - private String passportEntityUUID; - private String documentEntityUUID; - private String conversationEntityUUID; - private String vcardURL; - private String wopiAccessToken; - private String qrCode; - private String actionID; - private String publicKey; - private String carddavUsername; - private String carddavPassword; - private String identificator; - private String newDevicePublicKey; - private String deviceID; - private String phoneNumber; - private String currentCompany; - private String recipientEmail; - private String messegeId; - private String subject; - private String batchKey; - private String batchKey2; - private String batchValue; - public String getIdentificator() { - return identificator; - } - - public void setIdentificator(String identificator) { - this.identificator = identificator; - } - - public Member getCurrentMember() { - return member; - } - - public void setCurrentMember(Member member) { - this.member = member; - } - - public String getOauthToken() { - return oauthToken; - } - - public void setOauthToken(String oauthToken) { - this.oauthToken = oauthToken; - } - - public String getOauthUUID() { - return oauthUUID; - } - - public void setOauthUUID(String oauthUUID) { - this.oauthUUID = oauthUUID; - } - - public String getPersonEntityUUID() { - return personEntityUUID; - } - - public void setPersonEntityUUID(String personEntityUUID) { - this.personEntityUUID = personEntityUUID; - } - - public String getOrganizationEntityUUID() { - return organizationEntityUUID; - } - - public void setOrganizationEntityUUID(String organizationEntityUUID) { - this.organizationEntityUUID = organizationEntityUUID; - } - - public String getAssetEntityUUID() { - return assetEntityUUID; - } - - public void setAssetEntityUUID(String assetEntityUUID) { - this.assetEntityUUID = assetEntityUUID; - } - - public String getPassportEntityUUID() { - return passportEntityUUID; - } - - public void setPassportEntityUUID(String passportEntityUUID) { - this.passportEntityUUID = passportEntityUUID; - } - - public String getDocumentEntityUUID() { - return documentEntityUUID; - } - - public void setDocumentEntityUUID(String documentEntityUUID) { - this.documentEntityUUID = documentEntityUUID; - } - - public String getConversationEntityUUID() { - return conversationEntityUUID; - } - - public void setConversationEntityUUID(String conversationEntityUUID) { - this.conversationEntityUUID = conversationEntityUUID; - } - - public String getVcardURL() { - return vcardURL; - } - - public void setVcardURL(String vcardURL) { - this.vcardURL = vcardURL; - } - - public String getWopiAccessToken() { - return wopiAccessToken; - } - - public void setWopiAccessToken(String wopiAccessToken) { - this.wopiAccessToken = wopiAccessToken; - } - - public String getQrCode() { - return qrCode; - } - - public void setQrCode(String qrCode) { - this.qrCode = qrCode; - } - - public String getActionID() { - return actionID; - } - - public void setActionID(String actionID) { - this.actionID = actionID; - } - - public String getPublicKey() { - return publicKey; - } - - public void setPublicKey(String publicKey) { - this.publicKey = publicKey; - } - - public String getCarddavUsername() { - return carddavUsername; - } - - public void setCarddavUsername(String carddavUsername) { - this.carddavUsername = carddavUsername; - } - - public String getCarddavPassword() { - return carddavPassword; - } - - public void setCarddavPassword(String carddavPassword) { - this.carddavPassword = carddavPassword; - } - - public String getNewDevicePublicKey() { - return newDevicePublicKey; - } - - public void setNewDevicePublicKey(String newDevicePublicKey) { - this.newDevicePublicKey = newDevicePublicKey; - } - - public String getDeviceID() { - return deviceID; - } - - public void setDeviceID(String deviceID) { - this.deviceID = deviceID; - } - - public String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public String getCurrentCompany() { - return currentCompany; - } - - public void setCurrentCompany(String currentCompany) { - this.currentCompany = currentCompany; - } - - public String getRecipientEmail() { - return recipientEmail; - } - - public void setRecipientEmail(String recipientEmail) { - this.recipientEmail = recipientEmail; - } - - public String getMessegeId() { - return messegeId; - } - - public void setMessegeId(String messegeId) { - this.messegeId = messegeId; - } - - public String getSubject() { - return subject; - } - - public void setSubject(String subject) { - this.subject = subject; - } - - public String getBatchKey() { - return batchKey; - } - - public void setBatchKey(String batchKey) { - this.batchKey = batchKey; - } - - public String getBatchValue() { - return batchValue; - } - - public void setBatchValue(String batchValue) { - this.batchValue = batchValue; - } + private Schema currentSchema; - public String getBatchKey2() { - return batchKey2; + public Schema getCurrentSchema() { + return currentSchema; } - public void setBatchKey2(String batchKey2) { - this.batchKey2 = batchKey2; + public void setCurrentSchema(Schema currentSchema) { + this.currentSchema = currentSchema; } } diff --git a/src/main/java/api/test/rest/pojo/schema/Attribute.java b/src/main/java/api/test/rest/pojo/schema/Attribute.java new file mode 100644 index 0000000000000000000000000000000000000000..8ca94b7fccf65042bea4fe01ce605a1d0f5a2393 --- /dev/null +++ b/src/main/java/api/test/rest/pojo/schema/Attribute.java @@ -0,0 +1,19 @@ + +package api.test.rest.pojo.schema; + +import com.google.gson.annotations.Expose; + +public class Attribute { + + @Expose + private String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + +} diff --git a/src/main/java/api/test/rest/pojo/schema/Data.java b/src/main/java/api/test/rest/pojo/schema/Data.java new file mode 100644 index 0000000000000000000000000000000000000000..51873295de518472dfe6f26b992795ebc1e10eca --- /dev/null +++ b/src/main/java/api/test/rest/pojo/schema/Data.java @@ -0,0 +1,90 @@ + +package api.test.rest.pojo.schema; + +import java.util.List; +import com.google.gson.annotations.Expose; + +public class Data { + + @Expose + private List<Attribute> attribute; + @Expose + private String createdBy; + @Expose + private String createdDate; + @Expose + private String id; + @Expose + private String name; + @Expose + private String schemaID; + @Expose + private String updatedBy; + @Expose + private String updatedDate; + + public List<Attribute> getAttribute() { + return attribute; + } + + public void setAttribute(List<Attribute> attribute) { + this.attribute = attribute; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public String getCreatedDate() { + return createdDate; + } + + public void setCreatedDate(String createdDate) { + this.createdDate = createdDate; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSchemaID() { + return schemaID; + } + + public void setSchemaID(String schemaID) { + this.schemaID = schemaID; + } + + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public String getUpdatedDate() { + return updatedDate; + } + + public void setUpdatedDate(String updatedDate) { + this.updatedDate = updatedDate; + } + +} diff --git a/src/main/java/api/test/rest/pojo/schema/Schema.java b/src/main/java/api/test/rest/pojo/schema/Schema.java new file mode 100644 index 0000000000000000000000000000000000000000..56c20ea723e934b41781959bc9fe403d712c2e48 --- /dev/null +++ b/src/main/java/api/test/rest/pojo/schema/Schema.java @@ -0,0 +1,39 @@ + +package api.test.rest.pojo.schema; + +import com.google.gson.annotations.Expose; + +public class Schema { + + @Expose + private Data data; + @Expose + private String message; + @Expose + private Long statusCode; + + public Data getData() { + return data; + } + + public void setData(Data data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public Long getStatusCode() { + return statusCode; + } + + public void setStatusCode(Long statusCode) { + this.statusCode = statusCode; + } + +} diff --git a/src/main/resources/REST/json/AttestationCreateSchemas.json b/src/main/resources/REST/json/AttestationCreateSchemas.json new file mode 100644 index 0000000000000000000000000000000000000000..b0c1807ea586fdc788d83040d80a0286ed924e21 --- /dev/null +++ b/src/main/resources/REST/json/AttestationCreateSchemas.json @@ -0,0 +1,11 @@ +{ + "successful_creation": { + "name": "automation_testing_schema1-01", + "attributes": [ + "fName", + "lName", + "gender" + ], + "createdBy": "2344789247389" + } +} \ No newline at end of file diff --git a/src/main/resources/REST/json/Batch.json b/src/main/resources/REST/json/Batch.json deleted file mode 100644 index d2173e1f579cefff1cb4ad71e1758d7851e10897..0000000000000000000000000000000000000000 --- a/src/main/resources/REST/json/Batch.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "successful_batch": { - "batch": { - "seal_id_1": "gAxtEAEaElNlbmRlclN0YXR1c09iamVjdA==" - } - }, - "multiple_requests": { - "batch": { - "seal_id_1": "gAxtEAEaElNlbmRlclN0YXR1c09iamVjdA==", - "seal_id_2": "gAxtEAEaElNlbmRlclN0YXR1c09iamVjd233==", - "seal_id_3": "gAxtEAEaElNlbmRlclN0YXR1c09iamVjd234==" - } - }, - "missing_batch": { - "seal_id_1": "gAxtEAEaElNlbmRlclN0YXR1c09iamVjdA==" - }, - "not_base64_value": { - "batch": { - "seal_id_1": "dasdadasd" - } - }, - "empty_seal_key": { - "batch": { - "": "gAxtEAEaElNlbmRlclN0YXR1c09iamVjdA==" - } - }, - "empty_seal_value": { - "batch": { - "seal_id_1": "" - } - }, - "missing_seal": { - "batch": { - } - }, - "getStatuses_success": { - "key": "seal_id_1" - }, - "getStatuses_missing_key": { - "": "seal_id_1" - }, - "getStatuses_missing_value": { - "key": "" - }, - "getStatuses_empty": { - } -} \ No newline at end of file diff --git a/src/main/resources/REST/schemas/Attestation_GET_schemas.json b/src/main/resources/REST/schemas/Attestation_GET_schemas.json new file mode 100644 index 0000000000000000000000000000000000000000..869ae15c96a21adb8c964536f91adfa9ab2fe832 --- /dev/null +++ b/src/main/resources/REST/schemas/Attestation_GET_schemas.json @@ -0,0 +1,98 @@ +{ + "title": "Root Schema", + "type": "object", + "required": [ + "statusCode", + "message", + "data" + ], + "properties": { + "statusCode": { + "title": "The statusCode Schema", + "type": "integer" + }, + "message": { + "title": "The message Schema", + "type": "string" + }, + "data": { + "title": "The data Schema", + "type": "object", + "required": [ + "count", + "records" + ], + "properties": { + "count": { + "title": "The count Schema", + "type": "integer" + }, + "records": { + "title": "The records Schema", + "type": "array", + "items": { + "title": "A Schema", + "type": "object", + "required": [ + "id", + "schemaID", + "name", + "createdBy", + "createdDate", + "updatedBy", + "updatedDate", + "attribute" + ], + "properties": { + "id": { + "title": "The id Schema", + "type": "string" + }, + "schemaID": { + "title": "The schemaID Schema", + "type": "string" + }, + "name": { + "title": "The name Schema", + "type": "string" + }, + "createdBy": { + "title": "The createdBy Schema", + "type": "string" + }, + "createdDate": { + "title": "The createdDate Schema", + "type": "string" + }, + "updatedBy": { + "title": "The updatedBy Schema", + "type": "string" + }, + "updatedDate": { + "title": "The updatedDate Schema", + "type": "string" + }, + "attribute": { + "title": "The attribute Schema", + "type": "array", + "items": { + "title": "A Schema", + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "title": "The name Schema", + "type": "string" + } + } + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/REST/schemas/Attestation_POST_schemas.json b/src/main/resources/REST/schemas/Attestation_POST_schemas.json new file mode 100644 index 0000000000000000000000000000000000000000..69591163fd9ac0b0abfcde009f6adf0c12bf0d86 --- /dev/null +++ b/src/main/resources/REST/schemas/Attestation_POST_schemas.json @@ -0,0 +1,80 @@ +{ + "title": "Root Schema", + "type": "object", + "required": [ + "statusCode", + "message", + "data" + ], + "properties": { + "statusCode": { + "title": "The statusCode Schema", + "type": "integer" + }, + "message": { + "title": "The message Schema", + "type": "string" + }, + "data": { + "title": "The data Schema", + "type": "object", + "required": [ + "id", + "schemaID", + "name", + "createdBy", + "createdDate", + "updatedBy", + "updatedDate", + "attribute" + ], + "properties": { + "id": { + "title": "The id Schema", + "type": "string" + }, + "schemaID": { + "title": "The schemaID Schema", + "type": "string" + }, + "name": { + "title": "The name Schema", + "type": "string" + }, + "createdBy": { + "title": "The createdBy Schema", + "type": "string" + }, + "createdDate": { + "title": "The createdDate Schema", + "type": "string" + }, + "updatedBy": { + "title": "The updatedBy Schema", + "type": "string" + }, + "updatedDate": { + "title": "The updatedDate Schema", + "type": "string" + }, + "attribute": { + "title": "The attribute Schema", + "type": "array", + "items": { + "title": "A Schema", + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "title": "The name Schema", + "type": "string" + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/test/java/api/test/core/GeneralStepDefinitions.java b/src/test/java/api/test/core/GeneralStepDefinitions.java index da7fb70f5db1605b38dc2cebf0530f4a34f9307a..106194c50201af020be490f6ebacf7fe5d11caaf 100644 --- a/src/test/java/api/test/core/GeneralStepDefinitions.java +++ b/src/test/java/api/test/core/GeneralStepDefinitions.java @@ -708,6 +708,30 @@ public class GeneralStepDefinitions extends BaseStepDefinitions { logger.debug("Success: the given expected value [{}], matches the actual value [{}] pointed by jsonPath '{}' ", expectedResultAsString, actualResultAsString, jsonPath); } + /** + * Checks if the response contains a value from the request via jsonPaths + * + * @param requestJsonPath the jsonPath to the value of the request + * @param responseJsonPath the jsonPath to the value of the response + * @throws Throwable + * @see <a href="https://github.com/jayway/JsonPath">https://github.com/jayway/JsonPath</a> + */ + @And("^the value \\{(.*?)\\} in the request contains the value \\{(.*?)\\} of the response$") + public void the_value_in_the_request_contains_the_value_of_the_response(String requestJsonPath, String responseJsonPath) throws Throwable { + // set this Option in order to get 'null' returned if node not found in the JSON document instead of exception. + Configuration conf = Configuration.builder().options(Option.SUPPRESS_EXCEPTIONS).build(); + ReadContext requestContext = JsonPath.using(conf).parse(getLastRequest().getBody()); + ReadContext responseContext = JsonPath.using(conf).parse(getLastResponse().getBody()); + + String request = requestContext.read(requestJsonPath); + + Object parsedResult = responseContext.read(responseJsonPath); + String response = String.valueOf(parsedResult); + + assertTrue("the response doesn't contain the request value: ",response.contains(request)); + + } + /** * Compares a single value from a json with the supplied expectedResultAsString diff --git a/src/test/java/api/test/rest/ocm/attestation/AttestationStepDefinitions.java b/src/test/java/api/test/rest/ocm/attestation/AttestationStepDefinitions.java index 16caecd4fa3874c344e3b7739228bba01a96662f..04126af0df41777cfebbdaeea0d2bcaa809cd2e5 100644 --- a/src/test/java/api/test/rest/ocm/attestation/AttestationStepDefinitions.java +++ b/src/test/java/api/test/rest/ocm/attestation/AttestationStepDefinitions.java @@ -19,17 +19,27 @@ package api.test.rest.ocm.attestation; import api.test.core.BaseStepDefinitions; import api.test.rest.RestSessionContainer; +import api.test.rest.pojo.schema.Schema; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import core.DataContainer; -import core.Request; -import core.Response; -import core.RestClient; +import com.jayway.jsonpath.Configuration; +import com.jayway.jsonpath.JsonPath; +import com.jayway.jsonpath.Option; +import com.jayway.jsonpath.ReadContext; +import core.*; import cucumber.api.java.en.Given; +import cucumber.api.java.en.Then; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.HashMap; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + public class AttestationStepDefinitions extends BaseStepDefinitions { private static final Logger logger = LogManager.getLogger(AttestationStepDefinitions.class.getSimpleName()); RestSessionContainer restSessionContainer; @@ -51,4 +61,65 @@ public class AttestationStepDefinitions extends BaseStepDefinitions { addRequest(currentRequest); addResponse(response); } + + @Then("^I create a new schema via Attestation Manager in OCM api") + public void I_create_a_new_schema_via_Attestation_Manager_in_OCM_api() { + currentRequest.setPath("/attestation/v1/schemas"); + + Response response = RestClient.post(currentRequest); + addRequest(currentRequest); + addResponse(response); + + if (getLastResponse() != null && getLastResponse().getStatusCode() == 201) { + restSessionContainer.setCurrentSchema(JsonUtils.getResourceFromResponse(getLastResponse(), Schema.class)); + } + } + + @Then("^I create a new schema with random version via Attestation Manager in OCM api") + public void I_create_a_new_schema_with_random_version_via_Attestation_Manager_in_OCM_api() { + Timestamp timestamp = new Timestamp(System.currentTimeMillis()); + + Gson gson = new Gson(); + JsonElement jsonElement = gson.fromJson(currentRequest.getBody(), JsonElement.class); + // only try to load body as JsonObject if it is not null. + JsonObject jsonObject = new JsonObject(); + if (jsonElement != null) jsonObject = jsonElement.getAsJsonObject();; + jsonObject.addProperty("version", "1.1." + timestamp.getTime()); + currentRequest.setBody(gson.toJson(jsonObject)); + + I_create_a_new_schema_via_Attestation_Manager_in_OCM_api(); + } + + @Then("^I get all the schemas via OCM Api") + public void I_get_all_the_schemas_via_OCM_Api() { + currentRequest.setPath("/attestation/v1/schemas"); + + Response response = RestClient.get(currentRequest); + addRequest(currentRequest); + addResponse(response); + } + + @Given("^I get all the schemas with pageSize \\{(.*?)\\} and page \\{(.*?)\\} via OCM api") + public void I_get_all_the_schemas_with_pageSize_and_page_via_OCM_api(String pageSize,String page) { + HashMap<String, String> queryParams = new HashMap<>(); + queryParams.put("pageSize",pageSize); + queryParams.put("page",page); + currentRequest.setQueryParams(queryParams); + + I_get_all_the_schemas_via_OCM_Api(); + } + + @Given("^I get schema with schemaID \\{(.*?)\\} via OCM Api") + public void I_get_schema_with_schemaID_via_OCM_Api(String schemaID) { + currentRequest.setPath("/attestation/v1/schemas/" + schemaID); + + Response response = RestClient.get(currentRequest); + addRequest(currentRequest); + addResponse(response); + } + + @Given("^I get the current Schema via OCM api") + public void I_get_the_current_Schema_via_OCM_api() { + I_get_schema_with_schemaID_via_OCM_Api(restSessionContainer.getCurrentSchema().getData().getSchemaID()); + } } \ No newline at end of file diff --git a/src/test/resources/features/ocm/attestation/v1/schemas/GET.feature b/src/test/resources/features/ocm/attestation/v1/schemas/GET.feature new file mode 100644 index 0000000000000000000000000000000000000000..79a956222081f68a1e26b18762b733313856f0c6 --- /dev/null +++ b/src/test/resources/features/ocm/attestation/v1/schemas/GET.feature @@ -0,0 +1,51 @@ +#Copyright (c) 2018 Vereign AG [https://www.vereign.com] +# +#This is free software: you can redistribute it and/or modify +#it under the terms of the GNU Affero General Public License as +#published by the Free Software Foundation, either version 3 of the +#License, or (at your option) any later version. +# +#This program is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU Affero General Public License for more details. +# +#You should have received a copy of the GNU Affero General Public License +#along with this program. If not, see <http://www.gnu.org/licenses/>. + +#http://localhost/ocm/attestation/v1/schemas +#Author: Rosen Georgiev rosen.georgiev@vereign.com + +@rest @all @ocm @attestation +Feature: API - OCM - attestation - v1 - schemas GET + This request fetches all the the schemas created by the requesting participant. + + Background: + Given we are testing the OCM Api + + @schemas + Scenario: OCM - Attestation - Getting all schemas - Positive + Given I load the REST request {AttestationCreateSchemas.json} with profile {successful_creation} + Then I create a new schema with random version via Attestation Manager in OCM api + And the status code should be {201} + #GET all the schemas + Given I get all the schemas via OCM Api + Then the field {statusCode} contains the value {200} + And the status code should be {200} + And the response is valid according to the {Attestation_GET_schemas.json} REST schema + And the field {message} contains the value {Schemas fetch successfully} + And the field {$..count} is present and not empty + + @schemas + Scenario: OCM - Attestation - Getting schemas with pagination- Positive + Given I load the REST request {AttestationCreateSchemas.json} with profile {successful_creation} + Then I create a new schema with random version via Attestation Manager in OCM api + And the status code should be {201} + #GET schemas with pagination + Given I get all the schemas with pageSize {1} and page {0} via OCM api + Then the field {statusCode} contains the value {200} + And the status code should be {200} + And the response is valid according to the {Attestation_GET_schemas.json} REST schema + And the field {message} contains the value {Schemas fetch successfully} + And the field {$..count} contains the value {1} + And the field {$.data.records} contains {1} elements \ No newline at end of file diff --git a/src/test/resources/features/ocm/attestation/v1/schemas/POST.feature b/src/test/resources/features/ocm/attestation/v1/schemas/POST.feature new file mode 100644 index 0000000000000000000000000000000000000000..3af3de3af97536925ebe2859bd5ea0a9d5441602 --- /dev/null +++ b/src/test/resources/features/ocm/attestation/v1/schemas/POST.feature @@ -0,0 +1,43 @@ +#Copyright (c) 2018 Vereign AG [https://www.vereign.com] +# +#This is free software: you can redistribute it and/or modify +#it under the terms of the GNU Affero General Public License as +#published by the Free Software Foundation, either version 3 of the +#License, or (at your option) any later version. +# +#This program is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU Affero General Public License for more details. +# +#You should have received a copy of the GNU Affero General Public License +#along with this program. If not, see <http://www.gnu.org/licenses/>. + +#http://localhost/ocm/attestation/v1/schemas +#Author: Rosen Georgiev rosen.georgiev@vereign.com + +@rest @all @ocm @attestation +Feature: API - OCM - attestation - v1 - schemas POST + It is used to create schema. + The schema is a template which defines the schema name, + version and the attributes and is used to define the credential definition. + + + Background: + Given we are testing the OCM Api + + @schemas + Scenario: OCM - Attestation - Creation of a new Schema with attributes - Positive + Given I load the REST request {AttestationCreateSchemas.json} with profile {successful_creation} + Then I create a new schema with random version via Attestation Manager in OCM api + Then the field {statusCode} contains the value {201} + And the status code should be {201} + And the response is valid according to the {Attestation_POST_schemas.json} REST schema + And the field {message} contains the value {Schema created successfully} + And the field {$..name} contains the value {automation_testing_schema1-01} + And the value {$.version} in the request contains the value {$..schemaID} of the response + And the value {$.name} in the request contains the value {$..schemaID} of the response + And the field {$..attribute..name} contains the value {fName} + And the field {$..attribute..name} contains the value {lName} + And the field {$..attribute..name} contains the value {gender} + And the field {$..attribute..name} contains the value {expirationDate} \ No newline at end of file diff --git a/src/test/resources/features/ocm/attestation/v1/schemas/{schemaID}/GET.feature b/src/test/resources/features/ocm/attestation/v1/schemas/{schemaID}/GET.feature new file mode 100644 index 0000000000000000000000000000000000000000..3b227307f4be38b227e48941ad961bef70f6cfd1 --- /dev/null +++ b/src/test/resources/features/ocm/attestation/v1/schemas/{schemaID}/GET.feature @@ -0,0 +1,37 @@ +#Copyright (c) 2018 Vereign AG [https://www.vereign.com] +# +#This is free software: you can redistribute it and/or modify +#it under the terms of the GNU Affero General Public License as +#published by the Free Software Foundation, either version 3 of the +#License, or (at your option) any later version. +# +#This program is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU Affero General Public License for more details. +# +#You should have received a copy of the GNU Affero General Public License +#along with this program. If not, see <http://www.gnu.org/licenses/>. + +#http://localhost/ocm/attestation/v1/schemas/:schemaID +#Author: Rosen Georgiev rosen.georgiev@vereign.com + +@rest @all @ocm @attestation +Feature: API - OCM - attestation - v1 - schemas - :schemaID GET + This request fetches specific schema via SchemaID + + Background: + Given we are testing the OCM Api + + @schemas + Scenario: OCM - Attestation - Getting schema with schemaID - Positive + Given I load the REST request {AttestationCreateSchemas.json} with profile {successful_creation} + Then I create a new schema with random version via Attestation Manager in OCM api + And the status code should be {201} + #Get the current Schema via SchemaID + Given I get the current Schema via OCM api + Then the field {statusCode} contains the value {200} + And the status code should be {200} + And the response is valid according to the {Attestation_GET_schemas.json} REST schema + And the field {message} contains the value {Schema fetch successfully} + And the field {$.data.count} contains the value {1} \ No newline at end of file diff --git a/src/test/resources/features/ocm/connection/v1/connections/GET.feature b/src/test/resources/features/ocm/connection/v1/connections/GET.feature index 23240d9382943c4c6a7404fe19fa40a11bf7c699..3f4fabd4f4a70c2d45be4ce7254eba88ec4b014a 100644 --- a/src/test/resources/features/ocm/connection/v1/connections/GET.feature +++ b/src/test/resources/features/ocm/connection/v1/connections/GET.feature @@ -33,7 +33,7 @@ Feature: API - OCM - connection - v1 - connections GET @connections Scenario: OCM - GET all connections with pagination - Positive - Given an administrator fetches all the connections with pageSize {5} and page {1} via OCM api + Given an administrator fetches all the connections with pageSize {5} and page {0} via OCM api Then the field {statusCode} contains the value {200} And the response is valid according to the {Connection_GetConnections_schema.json} REST schema Then the field {message} contains the value {Connections fetch successfully}