Skip to content
Snippets Groups Projects
Commit 173a9a7b authored by Rosen Georgiev's avatar Rosen Georgiev
Browse files

cleanup

parent 3524e416
No related branches found
No related tags found
1 merge request!20cleanup
......@@ -20,10 +20,7 @@ package core;
import java.util.HashMap;
import java.util.Map;
/**
* The purpose of this class is to store data that needs to be passed between scenario steps. For RID is used only for
* scenarios steps that are from different packages.
*/
public class DataContainer {
private Map<String, Object> objectMap;
......
{
"successful_creation": {
"schemaName":"",
"attributes":["fName","lName"],
"attributes": [
{
"schemaId": "7KuDTpQh3GJ7Gp6kErpWvM:2:automation_testing_schema1-01:1.1.1663576062630",
"credentialDefId": "7KuDTpQh3GJ7Gp6kErpWvM:3:CL:493091:Automation_CredDef_001",
"attributeName": "lName",
"value": "",
"condition": ""
}
],
"options": {
"type":"Aries1.0",
"credentialDefinationName":"Test"
}
"type": "Aries1.0",
"credentialDefinationId": "Test"
},
"connectionId": "53f412bc-3897-4990-b6ef-5b2f620db50e"
},
"empty_schemaID": {
"attributes": [
{
"schemaId": "",
"credentialDefId": "7KuDTpQh3GJ7Gp6kErpWvM:3:CL:493069:Automation_CredDef_001",
"attributeName": "lName",
"value": "",
"condition": ""
}
],
"options": {
"type": "Aries1.0",
"credentialDefinationId": "Test"
},
"connectionId": "60812bd1-9f87-4846-8ca7-340186df3d8f"
},
"empty_credentialDefId": {
"attributes": [
{
"schemaId": "7KuDTpQh3GJ7Gp6kErpWvM:2:automation_testing_schema1-01:1.1.1663576062630",
"credentialDefId": "",
"attributeName": "lName",
"value": "",
"condition": ""
}
],
"options": {
"type": "Aries1.0",
"credentialDefinationId": "Test"
},
"connectionId": "60812bd1-9f87-4846-8ca7-340186df3d8f"
},
"empty_connectionId": {
"attributes": [
{
"schemaId": "7KuDTpQh3GJ7Gp6kErpWvM:2:automation_testing_schema1-01:1.1.1663576062630",
"credentialDefId": "7KuDTpQh3GJ7Gp6kErpWvM:3:CL:493091:Automation_CredDef_001",
"attributeName": "lName",
"value": "",
"condition": ""
}
],
"options": {
"type": "Aries1.0",
"credentialDefinationId": "Test"
},
"connectionId": ""
}
}
\ No newline at end of file
}
......@@ -3,13 +3,13 @@
"comment": "Tested participant",
"attributes": [
{
"attribute_name": "fName",
"value": "1",
"condition": "true"
"schemaId": "testt",
"credentialDefId": "7KuDTpQh3GJ7Gp6kErpWvM:3:CL:367830:Enrollment_credDef-0107232",
"attributeName": "lName",
"value": "",
"condition": ""
}
],
"schemaId": "",
"credentialDefId": "",
"connectionId": ""
"connectionId": "31b1c05b-8b0a-41b2-b819-58214d683040"
}
}
\ No newline at end of file
......@@ -19,13 +19,12 @@ package api.test.rest.ocm.proof;
import api.test.core.BaseStepDefinitions;
import api.test.rest.RestSessionContainer;
import api.test.rest.pojo.credentialDef.CredentialDef;
import api.test.rest.pojo.presentationRequest.Presentation;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.*;
import com.jayway.jsonpath.JsonPath;
import core.*;
import cucumber.api.java.en.Given;
import net.minidev.json.writer.JsonReader;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
......@@ -69,9 +68,19 @@ public class ProofStepDefinitions extends BaseStepDefinitions {
// only try to load body as JsonObject if it is not null.
JsonObject jsonObject = new JsonObject();
if (jsonElement != null) jsonObject = jsonElement.getAsJsonObject();;
jsonObject.addProperty("connectionId", restSessionContainer.getCurrentConnection().getData().getConnection().getId());
jsonObject.addProperty("credentialDefId", restSessionContainer.getCurrentCredentialDef().getData().getCredDefId());
jsonObject.addProperty("schemaId", restSessionContainer.getCurrentSchema().getData().getSchemaID());
JsonObject newAttributes = new JsonObject();
newAttributes.addProperty("schemaId",restSessionContainer.getCurrentSchema().getData().getSchemaID());
newAttributes.addProperty("credentialDefId",restSessionContainer.getCurrentCredentialDef().getData().getCredDefId());
newAttributes.addProperty("attributeName","lName");
newAttributes.addProperty("value","");
newAttributes.addProperty("condition","");
JsonArray ja = new JsonArray();
ja.add(newAttributes);
jsonObject.add("attributes",ja);
currentRequest.setBody(gson.toJson(jsonObject));
I_send_presentation_request_via_OCM_Api();
......@@ -125,16 +134,25 @@ public class ProofStepDefinitions extends BaseStepDefinitions {
@Given("^I send out of bound presentation request with the current data via OCM Api")
public void I_send_out_of_bound_presentation_request_with_the_current_data_via_OCM_Api() {
// 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("connectionId", restSessionContainer.getCurrentConnection().getData().getConnection().getId());
// jsonObject.addProperty("credentialDefId", restSessionContainer.getCurrentCredentialDef().getData().getCredDefId());
// jsonObject.addProperty("schemaId", restSessionContainer.getCurrentSchema().getData().getSchemaID());
// currentRequest.setBody(gson.toJson(jsonObject));
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("connectionId", restSessionContainer.getCurrentConnection().getData().getConnection().getId());
JsonObject newAttributes = new JsonObject();
newAttributes.addProperty("schemaId",restSessionContainer.getCurrentSchema().getData().getSchemaID());
newAttributes.addProperty("credentialDefId",restSessionContainer.getCurrentCredentialDef().getData().getCredDefId());
newAttributes.addProperty("attributeName","lName");
newAttributes.addProperty("value","");
newAttributes.addProperty("condition","");
JsonArray ja = new JsonArray();
ja.add(newAttributes);
jsonObject.add("attributes",ja);
currentRequest.setBody(gson.toJson(jsonObject));
I_send_out_of_bound_presentation_request_via_OCM_Api();
}
}
\ No newline at end of file
......@@ -35,24 +35,24 @@ Feature: API - OCM - proof - v1 - find-by-presentation-id GET
And the status code should be {404}
Then the field {message} contains the value {proof with proofRecordId "nonExistentId" not found.}
@proof @bug-proof-25 @bug-proof-24 @bug-proof-23
@proof @bug-proof-25 @bug-proof-24
Scenario: OCM - Proof - Get OOB presentation request via presentationId - Positive
# #Create a new member process connection
# Given an administrator generates a QR code by creating a connection with alias {member} via OCM api
# Then the field {statusCode} contains the value {200}
# And the status code should be {201}
# #Creation of the schema
# And I clear the query parameters
# And I clear the request body
# 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}
# #Creation of the Credential definition
# And I clear the request body
# Given I load the REST request {AttestationCreateCredentialDef.json} with profile {successful_creation}
# Then I create a new credential definition with the current schemaId via OCM Api
# And the status code should be {201}
# And I clear the request body
#Create a new member process connection
Given an administrator generates a QR code by creating a connection with alias {member} via OCM api
Then the field {statusCode} contains the value {200}
And the status code should be {201}
#Creation of the schema
And I clear the query parameters
And I clear the request body
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}
#Creation of the Credential definition
And I clear the request body
Given I load the REST request {AttestationCreateCredentialDef.json} with profile {successful_creation}
Then I create a new credential definition with the current schemaId via OCM Api
And the status code should be {201}
And I clear the request body
#Send Out of Bound Presentation Request
Given I load the REST request {ProofSendOOBPresentationRequest.json} with profile {successful_creation}
Then I send out of bound presentation request with the current data via OCM Api
......
......@@ -29,30 +29,47 @@ Feature: API - OCM - proof - v1 - send-out-of-band-presentation-request POST
Background:
Given we are testing the OCM Api
@proof @bug-proof-25 @bug-proof-24 @bug-proof-23
@proof @bug-proof-25 @bug-proof-24
Scenario: OCM - Proof - Create out of bounds presentation - Positive
# #Create a new member process connection
# Given an administrator generates a QR code by creating a connection with alias {member} via OCM api
# Then the field {statusCode} contains the value {200}
# And the status code should be {201}
# #Creation of the schema
# And I clear the query parameters
# And I clear the request body
# 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}
# #Creation of the Credential definition
# And I clear the request body
# Given I load the REST request {AttestationCreateCredentialDef.json} with profile {successful_creation}
# Then I create a new credential definition with the current schemaId via OCM Api
# And the status code should be {201}
# And I clear the request body
#Create a new member process connection
Given an administrator generates a QR code by creating a connection with alias {member} via OCM api
Then the field {statusCode} contains the value {200}
And the status code should be {201}
#Creation of the schema
And I clear the query parameters
And I clear the request body
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}
#Creation of the Credential definition
And I clear the request body
Given I load the REST request {AttestationCreateCredentialDef.json} with profile {successful_creation}
Then I create a new credential definition with the current schemaId via OCM Api
And the status code should be {201}
And I clear the request body
#Send Out of Bound Presentation Request
Given I load the REST request {ProofSendOOBPresentationRequest.json} with profile {successful_creation}
Then I send out of bound presentation request with the current data via OCM Api
And the status code should be {201}
Then the field {statusCode} contains the value {201}
Then the field {message} contains the value {Presentation request send successfully}
Then the field {$.data.credentialDefId} contains the value {Test}
Then the field {$.data.credentialDefId} contains the value {}
Then the field {$.data.status} contains the value {request-sent}
And the response is valid according to the {Proof_POST_OOB_presentation_request.json} REST schema
@proof @bug-proof-25 @bug-proof-24
Scenario Outline: OCM - Proof - Try to Create out of bounds presentation with <profile> - Negative
#Send Out of Bound Presentation Request
Given I load the REST request {ProofSendOOBPresentationRequest.json} with profile {<profile>}
Then I send out of bound presentation request via OCM Api
And the status code should be {201}
Then the field {statusCode} contains the value {201}
Then the field {message} contains the value {Presentation request send successfully}
Then the field {$.data.credentialDefId} contains the value {}
Then the field {$.data.status} contains the value {request-sent}
And the response is valid according to the {Proof_POST_OOB_presentation_request.json} REST schema
\ No newline at end of file
And the response is valid according to the {Proof_POST_OOB_presentation_request.json} REST schema
Examples:
| profile |
| empty_schemaID |
| empty_credentialDefId |
| empty_connectionId |
\ No newline at end of file
......@@ -24,12 +24,12 @@ Feature: API - OCM - proof - v1 - send-presentation-request POST
In Hyperledger Indy, this message is required, because it forces the Issuer to make a cryptographic commitment
to the set of fields in the final credential and thus prevents Issuers from inserting spurious data.
NOTE: This request needs PCM to be able to be called
NOTE: This request needs PCM to be able to be properly tested
Background:
Given we are testing the OCM Api
@proof @wip
@proof
Scenario: OCM - Proof - Try to Create offer of the currently created credential for untrusted connection - Negative
#Create a new member process connection
Given an administrator generates a QR code by creating a connection with alias {member} via OCM api
......@@ -50,5 +50,7 @@ Feature: API - OCM - proof - v1 - send-presentation-request POST
#Send Presentation Request
Given I load the REST request {ProofSendPresentationRequest.json} with profile {successful_creation}
Then I send presentation request with the current data via OCM Api
And the status code should be {201}
And the status code should be {400}
Then the field {statusCode} contains the value {400}
Then the field {message} contains the value {Could not get schema or connection details. please try again.}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment