diff --git a/src/main/resources/REST/json/AttestationCreateSchemas.json b/src/main/resources/REST/json/AttestationCreateSchemas.json new file mode 100644 index 0000000000000000000000000000000000000000..f03bdf160527fcd400a7d3ea1ef39e52ed1457d4 --- /dev/null +++ b/src/main/resources/REST/json/AttestationCreateSchemas.json @@ -0,0 +1,12 @@ +{ + "successful_creation": { + "name": "pizza_sandwich_290622-01", + "version": "29.06.2201", + "attributes": [ + "fName", + "lName", + "gender" + ], + "createdBy": "acceptsAnyString" + } +} \ 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_POST_schemas.json b/src/main/resources/REST/schemas/Attestation_POST_schemas.json new file mode 100644 index 0000000000000000000000000000000000000000..869ae15c96a21adb8c964536f91adfa9ab2fe832 --- /dev/null +++ b/src/main/resources/REST/schemas/Attestation_POST_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/test/java/api/test/rest/ocm/attestation/AttestationStepDefinitions.java b/src/test/java/api/test/rest/ocm/attestation/AttestationStepDefinitions.java index 16caecd4fa3874c344e3b7739228bba01a96662f..84a96a71bb2ed6a7fbfa438bbb00a08de9095dc9 100644 --- a/src/test/java/api/test/rest/ocm/attestation/AttestationStepDefinitions.java +++ b/src/test/java/api/test/rest/ocm/attestation/AttestationStepDefinitions.java @@ -27,6 +27,7 @@ import core.Request; import core.Response; import core.RestClient; import cucumber.api.java.en.Given; +import cucumber.api.java.en.Then; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -51,4 +52,13 @@ 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.get(currentRequest); + addRequest(currentRequest); + addResponse(response); + } } \ 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..520a7f42784d9595f9328af043d3cd5b412b1274 --- /dev/null +++ b/src/test/resources/features/ocm/attestation/v1/schemas/POST.feature @@ -0,0 +1,41 @@ +#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 via Attestation Manager in 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_POST_schemas.json} REST schema + And the field {message} contains the value {Schemas fetch successfully} + And the field {$..name} contains the value {pizza_sandwich_290622-01} + 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