diff --git a/src/test/java/api/test/rest/tsa/policy/PolicyStepDefinitions.java b/src/test/java/api/test/rest/tsa/policy/PolicyStepDefinitions.java index 9886298c38c9c5b14f8f93b29b2b911e0b74497b..fb270b27c51e2d142d9bb1a2afbd010a4df24f21 100644 --- a/src/test/java/api/test/rest/tsa/policy/PolicyStepDefinitions.java +++ b/src/test/java/api/test/rest/tsa/policy/PolicyStepDefinitions.java @@ -41,13 +41,14 @@ import org.bson.Document; import org.bson.conversions.Bson; import org.bson.types.ObjectId; -import static api.test.core.GeneralStepDefinitions.the_field_has_the_value_; import static com.mongodb.client.model.Filters.eq; public class PolicyStepDefinitions extends BaseStepDefinitions { private static final Logger logger = LogManager.getLogger(RestGeneralStepDefinitions.class.getSimpleName()); - public static final String mongoConnection = "mongodb://root:root@localhost:27017"; + + // MONGO_PATH environment variable should be set to point to the MonoDB instance + public static final String mongoConnection = System.getenv("MONGO_PATH"); RestSessionContainer restSessionContainer; Request currentRequest; diff --git a/src/test/resources/features/tsa/v1/task/{taskName}/POST.feature b/src/test/resources/features/tsa/v1/task/{taskName}/POST.feature index b7117ed2cc73cd5b104245d3e1762e1e644d52ae..466118af5246c4f8ccb301ca3da5ef5d492e7f9a 100644 --- a/src/test/resources/features/tsa/v1/task/{taskName}/POST.feature +++ b/src/test/resources/features/tsa/v1/task/{taskName}/POST.feature @@ -34,15 +34,31 @@ Feature: API -TSA - Task - v1/task POST Given I upload a DID resolver policy to repository And I upload a task template {didResolve} to repository Then I load the REST request {Policy.json} with profile {didResolve_evaluate} - And I send the current request as POST to endpoint {task/resolve} + And I send the current request as POST to endpoint {task/didResolve} Then the status code should be {200} And the response is valid according to the {Task_Execute_schema.json} REST schema + # Test the Task Result Then I get the value of {taskID} from the last response and store it in the DataContainer with key {taskID} Then I clear the request body - And I wait for {3000} mseconds + And I wait for {2000} mseconds And I send the current request to endpoint {taskResult} with container value{taskID} Then the status code should be {200} And the response is valid according to the {Task_ExecuteDID_schema.json} REST schema - And the field {result.doc.didDocument.id} has the value {did:indy:idunion:BDrEcHc8Tb4Lb2VyQZWEDE} + And the field {result.data.didDocument.id} has the value {did:indy:idunion:BDrEcHc8Tb4Lb2VyQZWEDE} + # Test the Cache Service + Then I load object with key {taskID} from DataContainer into currentRequest HEADER {x-cache-key} + And I send the current request as GET to endpoint {http://localhost:8083/v1/cache} + And the status code should be {200} + And the response is valid according to the {Task_ExecuteDID_schema.json} REST schema + And the field {result.data.didDocument.id} has the value {did:indy:idunion:BDrEcHc8Tb4Lb2VyQZWEDE} Then delete task {didResolve} from repository And delete policy {resolve} from repository + + @negative + Scenario: TSA - Executing Task with non existing task template - Negative + Given I upload a DID resolver policy to repository + Then I load the REST request {Policy.json} with profile {didResolve_evaluate} + And I send the current request as POST to endpoint {task/resolve} + Then the response is valid according to the {Policy_Evaluate_negative_schema.json} REST schema + And the field {message} has the value {task template not found} + And delete policy {resolve} from repository