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

Merge branch 'connectionManager' into 'main'

cleanup

See merge request !20
parents c49c1887 173a9a7b
No related branches found
No related tags found
1 merge request!20cleanup
Pipeline #59468 passed with stage
in 6 minutes and 6 seconds
...@@ -20,10 +20,7 @@ package core; ...@@ -20,10 +20,7 @@ package core;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; 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 { public class DataContainer {
private Map<String, Object> objectMap; private Map<String, Object> objectMap;
......
{ {
"successful_creation": { "successful_creation": {
"schemaName":"", "attributes": [
"attributes":["fName","lName"], {
"schemaId": "7KuDTpQh3GJ7Gp6kErpWvM:2:automation_testing_schema1-01:1.1.1663576062630",
"credentialDefId": "7KuDTpQh3GJ7Gp6kErpWvM:3:CL:493091:Automation_CredDef_001",
"attributeName": "lName",
"value": "",
"condition": ""
}
],
"options": { "options": {
"type":"Aries1.0", "type": "Aries1.0",
"credentialDefinationName":"Test" "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 @@ ...@@ -3,13 +3,13 @@
"comment": "Tested participant", "comment": "Tested participant",
"attributes": [ "attributes": [
{ {
"attribute_name": "fName", "schemaId": "testt",
"value": "1", "credentialDefId": "7KuDTpQh3GJ7Gp6kErpWvM:3:CL:367830:Enrollment_credDef-0107232",
"condition": "true" "attributeName": "lName",
"value": "",
"condition": ""
} }
], ],
"schemaId": "", "connectionId": "31b1c05b-8b0a-41b2-b819-58214d683040"
"credentialDefId": "",
"connectionId": ""
} }
} }
\ No newline at end of file
...@@ -19,13 +19,12 @@ package api.test.rest.ocm.proof; ...@@ -19,13 +19,12 @@ package api.test.rest.ocm.proof;
import api.test.core.BaseStepDefinitions; import api.test.core.BaseStepDefinitions;
import api.test.rest.RestSessionContainer; import api.test.rest.RestSessionContainer;
import api.test.rest.pojo.credentialDef.CredentialDef;
import api.test.rest.pojo.presentationRequest.Presentation; import api.test.rest.pojo.presentationRequest.Presentation;
import com.google.gson.Gson; import com.google.gson.*;
import com.google.gson.JsonElement; import com.jayway.jsonpath.JsonPath;
import com.google.gson.JsonObject;
import core.*; import core.*;
import cucumber.api.java.en.Given; import cucumber.api.java.en.Given;
import net.minidev.json.writer.JsonReader;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
...@@ -69,9 +68,19 @@ public class ProofStepDefinitions extends BaseStepDefinitions { ...@@ -69,9 +68,19 @@ public class ProofStepDefinitions extends BaseStepDefinitions {
// only try to load body as JsonObject if it is not null. // only try to load body as JsonObject if it is not null.
JsonObject jsonObject = new JsonObject(); JsonObject jsonObject = new JsonObject();
if (jsonElement != null) jsonObject = jsonElement.getAsJsonObject();; if (jsonElement != null) jsonObject = jsonElement.getAsJsonObject();;
jsonObject.addProperty("connectionId", restSessionContainer.getCurrentConnection().getData().getConnection().getId()); jsonObject.addProperty("connectionId", restSessionContainer.getCurrentConnection().getData().getConnection().getId());
jsonObject.addProperty("credentialDefId", restSessionContainer.getCurrentCredentialDef().getData().getCredDefId()); JsonObject newAttributes = new JsonObject();
jsonObject.addProperty("schemaId", restSessionContainer.getCurrentSchema().getData().getSchemaID()); 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)); currentRequest.setBody(gson.toJson(jsonObject));
I_send_presentation_request_via_OCM_Api(); I_send_presentation_request_via_OCM_Api();
...@@ -125,16 +134,25 @@ public class ProofStepDefinitions extends BaseStepDefinitions { ...@@ -125,16 +134,25 @@ public class ProofStepDefinitions extends BaseStepDefinitions {
@Given("^I send out of bound presentation request with the current data via OCM Api") @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() { public void I_send_out_of_bound_presentation_request_with_the_current_data_via_OCM_Api() {
// Gson gson = new Gson(); Gson gson = new Gson();
// JsonElement jsonElement = gson.fromJson(currentRequest.getBody(), JsonElement.class); JsonElement jsonElement = gson.fromJson(currentRequest.getBody(), JsonElement.class);
// // only try to load body as JsonObject if it is not null. // only try to load body as JsonObject if it is not null.
// JsonObject jsonObject = new JsonObject(); JsonObject jsonObject = new JsonObject();
// if (jsonElement != null) jsonObject = jsonElement.getAsJsonObject();; if (jsonElement != null) jsonObject = jsonElement.getAsJsonObject();;
// jsonObject.addProperty("connectionId", restSessionContainer.getCurrentConnection().getData().getConnection().getId());
// jsonObject.addProperty("credentialDefId", restSessionContainer.getCurrentCredentialDef().getData().getCredDefId()); jsonObject.addProperty("connectionId", restSessionContainer.getCurrentConnection().getData().getConnection().getId());
// jsonObject.addProperty("schemaId", restSessionContainer.getCurrentSchema().getData().getSchemaID()); JsonObject newAttributes = new JsonObject();
// currentRequest.setBody(gson.toJson(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(); 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 ...@@ -35,24 +35,24 @@ Feature: API - OCM - proof - v1 - find-by-presentation-id GET
And the status code should be {404} And the status code should be {404}
Then the field {message} contains the value {proof with proofRecordId "nonExistentId" not found.} 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 Scenario: OCM - Proof - Get OOB presentation request via presentationId - Positive
# #Create a new member process connection #Create a new member process connection
# Given an administrator generates a QR code by creating a connection with alias {member} via OCM api 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} Then the field {statusCode} contains the value {200}
# And the status code should be {201} And the status code should be {201}
# #Creation of the schema #Creation of the schema
# And I clear the query parameters And I clear the query parameters
# And I clear the request body And I clear the request body
# Given I load the REST request {AttestationCreateSchemas.json} with profile {successful_creation} 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 I create a new schema with random version via Attestation Manager in OCM api
# And the status code should be {201} And the status code should be {201}
# #Creation of the Credential definition #Creation of the Credential definition
# And I clear the request body And I clear the request body
# Given I load the REST request {AttestationCreateCredentialDef.json} with profile {successful_creation} 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 Then I create a new credential definition with the current schemaId via OCM Api
# And the status code should be {201} And the status code should be {201}
# And I clear the request body And I clear the request body
#Send Out of Bound Presentation Request #Send Out of Bound Presentation Request
Given I load the REST request {ProofSendOOBPresentationRequest.json} with profile {successful_creation} 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 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 ...@@ -29,30 +29,47 @@ Feature: API - OCM - proof - v1 - send-out-of-band-presentation-request POST
Background: Background:
Given we are testing the OCM Api 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 Scenario: OCM - Proof - Create out of bounds presentation - Positive
# #Create a new member process connection #Create a new member process connection
# Given an administrator generates a QR code by creating a connection with alias {member} via OCM api 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} Then the field {statusCode} contains the value {200}
# And the status code should be {201} And the status code should be {201}
# #Creation of the schema #Creation of the schema
# And I clear the query parameters And I clear the query parameters
# And I clear the request body And I clear the request body
# Given I load the REST request {AttestationCreateSchemas.json} with profile {successful_creation} 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 I create a new schema with random version via Attestation Manager in OCM api
# And the status code should be {201} And the status code should be {201}
# #Creation of the Credential definition #Creation of the Credential definition
# And I clear the request body And I clear the request body
# Given I load the REST request {AttestationCreateCredentialDef.json} with profile {successful_creation} 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 Then I create a new credential definition with the current schemaId via OCM Api
# And the status code should be {201} And the status code should be {201}
# And I clear the request body And I clear the request body
#Send Out of Bound Presentation Request #Send Out of Bound Presentation Request
Given I load the REST request {ProofSendOOBPresentationRequest.json} with profile {successful_creation} 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 Then I send out of bound presentation request with the current data via OCM Api
And the status code should be {201} And the status code should be {201}
Then the field {statusCode} contains the value {201} Then the field {statusCode} contains the value {201}
Then the field {message} contains the value {Presentation request send successfully} 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} 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 And the response is valid according to the {Proof_POST_OOB_presentation_request.json} REST schema
\ No newline at end of file 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 ...@@ -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 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. 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: Background:
Given we are testing the OCM Api 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 Scenario: OCM - Proof - Try to Create offer of the currently created credential for untrusted connection - Negative
#Create a new member process connection #Create a new member process connection
Given an administrator generates a QR code by creating a connection with alias {member} via OCM api 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 ...@@ -50,5 +50,7 @@ Feature: API - OCM - proof - v1 - send-presentation-request POST
#Send Presentation Request #Send Presentation Request
Given I load the REST request {ProofSendPresentationRequest.json} with profile {successful_creation} Given I load the REST request {ProofSendPresentationRequest.json} with profile {successful_creation}
Then I send presentation request with the current data via OCM Api 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