diff --git a/tests/integration-tests/build.gradle.kts b/tests/integration-tests/build.gradle.kts index db95650174..ea7b9a924f 100644 --- a/tests/integration-tests/build.gradle.kts +++ b/tests/integration-tests/build.gradle.kts @@ -38,7 +38,7 @@ dependencies { implementation("io.ktor:ktor-server-netty:2.3.0") implementation("io.ktor:ktor-client-apache:2.3.0") // RestAPI client - implementation("io.iohk.atala.prism:prism-kotlin-client:1.15.0") + implementation("io.iohk.atala.prism:prism-kotlin-client:1.18.0") // Test helpers library testImplementation("io.iohk.atala:atala-automation:0.3.0") // Hoplite for configuration diff --git a/tests/integration-tests/src/test/kotlin/common/TestConstants.kt b/tests/integration-tests/src/test/kotlin/common/TestConstants.kt index 349f7a69d7..f3b10b8432 100644 --- a/tests/integration-tests/src/test/kotlin/common/TestConstants.kt +++ b/tests/integration-tests/src/test/kotlin/common/TestConstants.kt @@ -58,9 +58,9 @@ object TestConstants { ) val RANDOM_CONSTAND_UUID = UUID.randomUUID().toString() val DID_UPDATE_PUBLISH_MAX_WAIT_5_MIN = Duration.ofSeconds(60L) - val PRISM_DID_AUTH_KEY = ManagedDIDKeyTemplate("auth-1", Purpose.authentication) - val PRISM_DID_ASSERTION_KEY = ManagedDIDKeyTemplate("assertion-1", Purpose.assertionMethod) - val PRISM_DID_UPDATE_NEW_AUTH_KEY = ManagedDIDKeyTemplate("auth-2", Purpose.authentication) + val PRISM_DID_AUTH_KEY = ManagedDIDKeyTemplate("auth-1", Purpose.AUTHENTICATION) + val PRISM_DID_ASSERTION_KEY = ManagedDIDKeyTemplate("assertion-1", Purpose.ASSERTION_METHOD) + val PRISM_DID_UPDATE_NEW_AUTH_KEY = ManagedDIDKeyTemplate("auth-2", Purpose.AUTHENTICATION) val PRISM_DID_SERVICE = Service( "https://foo.bar.com", listOf("LinkedDomains"), diff --git a/tests/integration-tests/src/test/kotlin/config/AgentConf.kt b/tests/integration-tests/src/test/kotlin/config/AgentConf.kt index dacb1b5f33..3918ef0960 100644 --- a/tests/integration-tests/src/test/kotlin/config/AgentConf.kt +++ b/tests/integration-tests/src/test/kotlin/config/AgentConf.kt @@ -6,5 +6,6 @@ import java.net.URL data class AgentConf( val url: URL, @ConfigAlias("webhook_url") val webhookUrl: URL?, - var apikey: String? + var apikey: String?, + @ConfigAlias("multi-tenant") val multiTenant: Boolean?, ) diff --git a/tests/integration-tests/src/test/kotlin/config/GlobalConf.kt b/tests/integration-tests/src/test/kotlin/config/GlobalConf.kt index b0cda15c3b..e3e6d89a34 100644 --- a/tests/integration-tests/src/test/kotlin/config/GlobalConf.kt +++ b/tests/integration-tests/src/test/kotlin/config/GlobalConf.kt @@ -5,5 +5,6 @@ import com.sksamuel.hoplite.ConfigAlias data class GlobalConf( @ConfigAlias("auth_required") val authRequired: Boolean, @ConfigAlias("auth_header") val authHeader: String, - @ConfigAlias("admin_auth_header") val adminAuthHeader: String + @ConfigAlias("admin_auth_header") val adminAuthHeader: String, + @ConfigAlias("admin_apikey") val adminApiKey: String ) diff --git a/tests/integration-tests/src/test/kotlin/features/CommonSteps.kt b/tests/integration-tests/src/test/kotlin/features/CommonSteps.kt index 9fe6a62393..1713f2ad20 100644 --- a/tests/integration-tests/src/test/kotlin/features/CommonSteps.kt +++ b/tests/integration-tests/src/test/kotlin/features/CommonSteps.kt @@ -2,6 +2,7 @@ package features import com.sksamuel.hoplite.ConfigLoader import common.ListenToEvents +import config.AgentConf import config.Config import features.connection.ConnectionSteps import features.credentials.IssueCredentialsSteps @@ -27,112 +28,91 @@ import java.util.* import kotlin.random.Random @OptIn(ExperimentalStdlibApi::class) -@BeforeAll -fun initializeIssuerVerifierMultitenantAgent() { - val eventSteps = EventsSteps() - val cast = Cast() - +fun createWalletAndEntity(agentConf: AgentConf) { val config = ConfigLoader().loadConfigOrThrow("/tests.conf") - - cast.actorNamed("Admin", CallAnApi.at(config.admin.url.toExternalForm())) - cast.actorNamed( - "Acme", - CallAnApi.at(config.issuer.url.toExternalForm()), - ListenToEvents.at(config.issuer.webhookUrl!!) - ) - cast.actorNamed( - "Bob", - CallAnApi.at(config.holder.url.toExternalForm()), - ListenToEvents.at(config.holder.webhookUrl!!) - ) - cast.actorNamed( - "Faber", - CallAnApi.at(config.verifier.url.toExternalForm()), - ListenToEvents.at(config.verifier.webhookUrl!!) - ) - OnStage.setTheStage(cast) - - // Create issuer wallet and tenant - val createIssuerWalletResponse = RestAssured + val createWalletResponse = RestAssured .given().body( CreateWalletRequest( - name = "IssuerWallet", + name = UUID.randomUUID().toString(), seed = Random.nextBytes(64).toHexString(), id = UUID.randomUUID() ) ) - .header(config.global.adminAuthHeader, config.admin.apikey) - .post("${config.issuer.url}/wallets") + .header(config.global.adminAuthHeader, config.global.adminApiKey) + .post("${agentConf.url}/wallets") .thenReturn() - Ensure.that(createIssuerWalletResponse.statusCode).isEqualTo(HttpStatus.SC_CREATED) - val issuerWallet = createIssuerWalletResponse.body.jsonPath().getObject("", WalletDetail::class.java) - - val issuerTenantResponse = RestAssured + Ensure.that(createWalletResponse.statusCode).isEqualTo(HttpStatus.SC_CREATED) + val wallet = createWalletResponse.body.jsonPath().getObject("", WalletDetail::class.java) + val tenantResponse = RestAssured .given().body( CreateEntityRequest( - name = "Issuer", - walletId = issuerWallet.id + name = UUID.randomUUID().toString(), + walletId = wallet.id ) ) - .header(config.global.adminAuthHeader, config.admin.apikey) - .post("${config.issuer.url}/iam/entities") + .header(config.global.adminAuthHeader, config.global.adminApiKey) + .post("${agentConf.url}/iam/entities") .thenReturn() - Ensure.that(issuerTenantResponse.statusCode).isEqualTo(HttpStatus.SC_CREATED) - val issuerEntity = issuerTenantResponse.body.jsonPath().getObject("", EntityResponse::class.java) - - val issuerAddApiKeyResponse = + Ensure.that(tenantResponse.statusCode).isEqualTo(HttpStatus.SC_CREATED) + val entity = tenantResponse.body.jsonPath().getObject("", EntityResponse::class.java) + val addApiKeyResponse = RestAssured .given().body( ApiKeyAuthenticationRequest( - entityId = issuerEntity.id, - apiKey = config.issuer.apikey!! + entityId = entity.id, + apiKey = agentConf.apikey!! ) ) - .header(config.global.adminAuthHeader, config.admin.apikey) - .post("${config.issuer.url}/iam/apikey-authentication") + .header(config.global.adminAuthHeader, config.global.adminApiKey) + .post("${agentConf.url}/iam/apikey-authentication") .thenReturn() - Ensure.that(issuerAddApiKeyResponse.statusCode).isEqualTo(HttpStatus.SC_CREATED) - - // Create verifier wallet - val createVerifierWalletResponse = RestAssured - .given().body( - CreateWalletRequest( - name = "VerifierWallet", - seed = Random.nextBytes(64).toHexString(), - id = UUID.randomUUID() - ) - ) - .header(config.global.adminAuthHeader, config.admin.apikey) - .post("${config.verifier.url}/wallets") - .thenReturn() - Ensure.that(createVerifierWalletResponse.statusCode).isEqualTo(HttpStatus.SC_CREATED) - val verifierWallet = createVerifierWalletResponse.body.jsonPath().getObject("", WalletDetail::class.java) - // Create verifier tenant - val verifierTenantResponse = RestAssured - .given().body( - CreateEntityRequest( - name = "Verifier", - walletId = verifierWallet.id - ) - ) - .header(config.global.adminAuthHeader, config.admin.apikey) - .post("${config.verifier.url}/iam/entities") - .thenReturn() - Ensure.that(verifierTenantResponse.statusCode).isEqualTo(HttpStatus.SC_CREATED) - val verifierEntity = verifierTenantResponse.body.jsonPath().getObject("", EntityResponse::class.java) - // Add verifier api key - val verifierAddApiKeyResponse = + Ensure.that(addApiKeyResponse.statusCode).isEqualTo(HttpStatus.SC_CREATED) + val registerIssuerWebhookResponse = RestAssured .given().body( - ApiKeyAuthenticationRequest( - entityId = verifierEntity.id, - apiKey = config.verifier.apikey!! + CreateWebhookNotification( + url = agentConf.webhookUrl!!.toExternalForm() ) ) - .header(config.global.adminAuthHeader, config.admin.apikey) - .post("${config.verifier.url}/iam/apikey-authentication") + .header(config.global.authHeader, agentConf.apikey) + .post("${agentConf.url}/events/webhooks") .thenReturn() - Ensure.that(verifierAddApiKeyResponse.statusCode).isEqualTo(HttpStatus.SC_CREATED) + Ensure.that(registerIssuerWebhookResponse.statusCode).isEqualTo(HttpStatus.SC_CREATED) +} + +@BeforeAll +fun initAgents() { + val cast = Cast() + val config = ConfigLoader().loadConfigOrThrow("/tests.conf") + cast.actorNamed( + "Admin", + CallAnApi.at(config.admin.url.toExternalForm()) + ) + cast.actorNamed( + "Acme", + CallAnApi.at(config.issuer.url.toExternalForm()), + ListenToEvents.at(config.issuer.webhookUrl!!) + ) + cast.actorNamed( + "Bob", + CallAnApi.at(config.holder.url.toExternalForm()), + ListenToEvents.at(config.holder.webhookUrl!!) + ) + cast.actorNamed( + "Faber", + CallAnApi.at(config.verifier.url.toExternalForm()), + ListenToEvents.at(config.verifier.webhookUrl!!) + ) + OnStage.setTheStage(cast) + + // Create issuer wallet and tenant + if (config.issuer.multiTenant!!) { + createWalletAndEntity(config.issuer) + } + // Create verifier wallet + if (config.verifier.multiTenant!!) { + createWalletAndEntity(config.verifier) + } cast.actors.forEach { actor -> when (actor.name) { @@ -147,30 +127,6 @@ fun initializeIssuerVerifierMultitenantAgent() { } } } - - val registerIssuerWebhookResponse = - RestAssured - .given().body( - CreateWebhookNotification( - url = config.issuer.webhookUrl.toExternalForm() - ) - ) - .header(config.global.authHeader, config.issuer.apikey) - .post("${config.issuer.url}/events/webhooks") - .thenReturn() - Ensure.that(registerIssuerWebhookResponse.statusCode).isEqualTo(HttpStatus.SC_CREATED) - - val registerVerifierWebhookResponse = - RestAssured - .given().body( - CreateWebhookNotification( - url = config.verifier.webhookUrl.toExternalForm() - ) - ) - .header(config.global.authHeader, config.verifier.apikey) - .post("${config.verifier.url}/events/webhooks") - .thenReturn() - Ensure.that(registerVerifierWebhookResponse.statusCode).isEqualTo(HttpStatus.SC_CREATED) } @AfterAll @@ -193,7 +149,7 @@ class CommonSteps { Ensure.thatTheLastResponse().statusCode().isEqualTo(SC_OK) ) val receivedCredential = SerenityRest.lastResponse().get().contents!!.findLast { credential -> - credential.protocolState == IssueCredentialRecord.ProtocolState.credentialReceived + credential.protocolState == IssueCredentialRecord.ProtocolState.CREDENTIAL_RECEIVED } if (receivedCredential != null) { @@ -221,7 +177,7 @@ class CommonSteps { Ensure.thatTheLastResponse().statusCode().isEqualTo(SC_OK) ) val inviterConnection = SerenityRest.lastResponse().get().contents!!.firstOrNull { - it.label == "Connection with ${invitee.name}" && it.state == Connection.State.connectionResponseSent + it.label == "Connection with ${invitee.name}" && it.state == Connection.State.CONNECTION_RESPONSE_SENT } var inviteeConnection: Connection? = null @@ -233,7 +189,7 @@ class CommonSteps { Ensure.thatTheLastResponse().statusCode().isEqualTo(SC_OK) ) inviteeConnection = SerenityRest.lastResponse().get().contents!!.firstOrNull { - it.theirDid == inviterConnection.myDid && it.state == Connection.State.connectionResponseReceived + it.theirDid == inviterConnection.myDid && it.state == Connection.State.CONNECTION_RESPONSE_RECEIVED } } diff --git a/tests/integration-tests/src/test/kotlin/features/connection/ConnectionSteps.kt b/tests/integration-tests/src/test/kotlin/features/connection/ConnectionSteps.kt index 7724e32773..301ff5064e 100644 --- a/tests/integration-tests/src/test/kotlin/features/connection/ConnectionSteps.kt +++ b/tests/integration-tests/src/test/kotlin/features/connection/ConnectionSteps.kt @@ -38,8 +38,8 @@ class ConnectionSteps { inviter.attemptsTo( Ensure.thatTheLastResponse().statusCode().isEqualTo(SC_CREATED), Ensure.that(connection.label!!).isEqualTo(connectionLabel), - Ensure.that(connection.state).isEqualTo(Connection.State.invitationGenerated), - Ensure.that(connection.role).isEqualTo(Connection.Role.inviter) + Ensure.that(connection.state).isEqualTo(Connection.State.INVITATION_GENERATED), + Ensure.that(connection.role).isEqualTo(Connection.Role.INVITER) ) // Acme remembers connection to send it out of band to Bob @@ -68,8 +68,8 @@ class ConnectionSteps { Ensure.that(inviteeConnection.invitation.id).isEqualTo(inviterConnection.invitation.id), Ensure.that(inviteeConnection.invitation.invitationUrl).isEqualTo(inviterConnection.invitation.invitationUrl), Ensure.that(inviteeConnection.invitation.type).isEqualTo(inviterConnection.invitation.type), - Ensure.that(inviteeConnection.state).isEqualTo(Connection.State.connectionRequestPending), - Ensure.that(inviteeConnection.role).isEqualTo(Connection.Role.invitee) + Ensure.that(inviteeConnection.state).isEqualTo(Connection.State.CONNECTION_REQUEST_PENDING), + Ensure.that(inviteeConnection.role).isEqualTo(Connection.Role.INVITEE) ) invitee.remember("connection", inviteeConnection) @@ -83,9 +83,9 @@ class ConnectionSteps { it.data.thid == inviter.recall("connection").thid } lastEvent != null && - lastEvent.data.state == Connection.State.connectionResponseSent + lastEvent.data.state == Connection.State.CONNECTION_RESPONSE_SENT }, - "Inviter connection didn't reach ${Connection.State.connectionResponseSent} state" + "Inviter connection didn't reach ${Connection.State.CONNECTION_RESPONSE_SENT} state" ) } @@ -98,9 +98,9 @@ class ConnectionSteps { it.data.thid == invitee.recall("connection").thid } lastEvent != null && - lastEvent.data.state == Connection.State.connectionResponseReceived + lastEvent.data.state == Connection.State.CONNECTION_RESPONSE_RECEIVED }, - "Invitee connection didn't reach ${Connection.State.connectionResponseReceived} state." + "Invitee connection didn't reach ${Connection.State.CONNECTION_RESPONSE_RECEIVED} state." ) } @@ -128,8 +128,8 @@ class ConnectionSteps { assertThat(inviter.recall("connection-with-${invitee.name}").theirDid) .isEqualTo(invitee.recall("connection-with-${inviter.name}").myDid) assertThat(inviter.recall("connection-with-${invitee.name}").state) - .isEqualTo(Connection.State.connectionResponseSent) + .isEqualTo(Connection.State.CONNECTION_RESPONSE_SENT) assertThat(invitee.recall("connection-with-${inviter.name}").state) - .isEqualTo(Connection.State.connectionResponseReceived) + .isEqualTo(Connection.State.CONNECTION_RESPONSE_RECEIVED) } } diff --git a/tests/integration-tests/src/test/kotlin/features/credentials/IssueCredentialsSteps.kt b/tests/integration-tests/src/test/kotlin/features/credentials/IssueCredentialsSteps.kt index f413cad45c..a187fb0f5a 100644 --- a/tests/integration-tests/src/test/kotlin/features/credentials/IssueCredentialsSteps.kt +++ b/tests/integration-tests/src/test/kotlin/features/credentials/IssueCredentialsSteps.kt @@ -36,7 +36,7 @@ class IssueCredentialsSteps { "lastName" to "LastName" ), issuingDID = did, - connectionId = issuer.recall("connection-with-${holder.name}").connectionId.toString(), + connectionId = issuer.recall("connection-with-${holder.name}").connectionId, validityPeriod = 3600.0, automaticIssuance = false ) @@ -66,9 +66,10 @@ class IssueCredentialsSteps { it.data.thid == holder.recall("thid") } credentialEvent != null && - credentialEvent!!.data.protocolState == IssueCredentialRecord.ProtocolState.offerReceived + credentialEvent!!.data.protocolState == IssueCredentialRecord.ProtocolState.OFFER_RECEIVED }, - "Holder was unable to receive the credential offer from Issuer! Protocol state did not achieve OfferReceived state." + "Holder was unable to receive the credential offer from Issuer! " + + "Protocol state did not achieve ${IssueCredentialRecord.ProtocolState.OFFER_RECEIVED} state." ) val recordId = ListenToEvents.`as`(holder).credentialEvents.last().data.recordId @@ -95,7 +96,7 @@ class IssueCredentialsSteps { it.data.thid == issuer.recall("thid") } credentialEvent != null && - credentialEvent!!.data.protocolState == IssueCredentialRecord.ProtocolState.requestReceived + credentialEvent!!.data.protocolState == IssueCredentialRecord.ProtocolState.REQUEST_RECEIVED }, "Issuer was unable to receive the credential request from Holder! Protocol state did not achieve RequestReceived state." ) @@ -113,10 +114,10 @@ class IssueCredentialsSteps { it.data.thid == issuer.recall("thid") } credentialEvent != null && - credentialEvent!!.data.protocolState == IssueCredentialRecord.ProtocolState.credentialSent + credentialEvent!!.data.protocolState == IssueCredentialRecord.ProtocolState.CREDENTIAL_SENT }, "Issuer was unable to issue the credential! " + - "Protocol state did not achieve ${IssueCredentialRecord.ProtocolState.credentialSent} state." + "Protocol state did not achieve ${IssueCredentialRecord.ProtocolState.CREDENTIAL_SENT} state." ) } @@ -128,10 +129,10 @@ class IssueCredentialsSteps { it.data.thid == holder.recall("thid") } credentialEvent != null && - credentialEvent!!.data.protocolState == IssueCredentialRecord.ProtocolState.credentialReceived + credentialEvent!!.data.protocolState == IssueCredentialRecord.ProtocolState.CREDENTIAL_RECEIVED }, "Holder was unable to receive the credential from Issuer! " + - "Protocol state did not achieve ${IssueCredentialRecord.ProtocolState.credentialReceived} state." + "Protocol state did not achieve ${IssueCredentialRecord.ProtocolState.CREDENTIAL_RECEIVED} state." ) holder.remember("issuedCredential", ListenToEvents.`as`(holder).credentialEvents.last().data) } diff --git a/tests/integration-tests/src/test/kotlin/features/did/ManageDidSteps.kt b/tests/integration-tests/src/test/kotlin/features/did/ManageDidSteps.kt index d3cd209298..d041db6987 100644 --- a/tests/integration-tests/src/test/kotlin/features/did/ManageDidSteps.kt +++ b/tests/integration-tests/src/test/kotlin/features/did/ManageDidSteps.kt @@ -6,7 +6,6 @@ import io.cucumber.java.en.Given import io.cucumber.java.en.Then import io.cucumber.java.en.When import io.iohk.atala.automation.extensions.get -import io.iohk.atala.automation.extensions.toJsonPath import io.iohk.atala.automation.serenity.ensure.Ensure import io.iohk.atala.prism.models.* import net.serenitybdd.rest.SerenityRest @@ -49,30 +48,6 @@ class ManageDidSteps { actor.remember("createdDids", createdDids) } - @When("{actor} tries to create PRISM DID with missing {word}") - fun triesToCreateManagedDidWithMissingField(actor: Actor, missingFieldPath: String) { - val createDidRequest = createPrismDidRequest() - val requestBody = createDidRequest.toJsonPath().delete(missingFieldPath).jsonString() - actor.attemptsTo( - Post.to("/did-registrar/dids") - .with { - it.body(requestBody) - } - ) - } - - @When("{actor} tries to create a managed DID with value {word} in {word}") - fun trisToCreateManagedDidWithValueInField(actor: Actor, value: String, fieldPath: String) { - val createDidRequest = createPrismDidRequest() - val requestBody = createDidRequest.toJsonPath().set(fieldPath, value).jsonString() - actor.attemptsTo( - Post.to("/did-registrar/dids") - .with { - it.body(requestBody) - } - ) - } - @When("{actor} lists all PRISM DIDs") fun iListManagedDids(actor: Actor) { actor.attemptsTo( @@ -89,13 +64,6 @@ class ManageDidSteps { ) } - @Then("{actor} sees the request has failed with error status {int}") - fun seesTheRequestHasFailedWithErrorStatus(actor: Actor, errorStatusCode: Int) { - actor.attemptsTo( - Ensure.thatTheLastResponse().statusCode().isEqualTo(errorStatusCode) - ) - } - @Then("{actor} sees the list contains all created DIDs") fun seeTheListContainsAllCreatedDids(actor: Actor) { val expectedDids = actor.recall>("createdDids") @@ -108,7 +76,7 @@ class ManageDidSteps { private fun createPrismDidRequest(): CreateManagedDidRequest = CreateManagedDidRequest( CreateManagedDidRequestDocumentTemplate( - publicKeys = listOf(ManagedDIDKeyTemplate("auth-1", Purpose.authentication)), + publicKeys = listOf(ManagedDIDKeyTemplate("auth-1", Purpose.AUTHENTICATION)), services = listOf( Service("https://foo.bar.com", listOf("LinkedDomains"), Json("https://foo.bar.com/")) ) diff --git a/tests/integration-tests/src/test/kotlin/features/did/PublishDidSteps.kt b/tests/integration-tests/src/test/kotlin/features/did/PublishDidSteps.kt index 45f1c12217..76167565e3 100644 --- a/tests/integration-tests/src/test/kotlin/features/did/PublishDidSteps.kt +++ b/tests/integration-tests/src/test/kotlin/features/did/PublishDidSteps.kt @@ -50,8 +50,8 @@ class PublishDidSteps { val createDidRequest = CreateManagedDidRequest( CreateManagedDidRequestDocumentTemplate( publicKeys = listOf( - ManagedDIDKeyTemplate("auth-1", Purpose.authentication), - ManagedDIDKeyTemplate("assertion-1", Purpose.assertionMethod) + ManagedDIDKeyTemplate("auth-1", Purpose.AUTHENTICATION), + ManagedDIDKeyTemplate("assertion-1", Purpose.ASSERTION_METHOD) ), services = listOf( Service("https://foo.bar.com", listOf("LinkedDomains"), Json("https://foo.bar.com/")), @@ -119,8 +119,8 @@ class PublishDidSteps { val didDocument = SerenityRest.lastResponse().get().didDocument!! actor.attemptsTo( - Ensure.thatTheLastResponse().statusCode().isEqualTo(HttpStatus.SC_OK), - Ensure.that(didDocument.id).isEqualTo(actor.recall("shortFormDid")) + Ensure.thatTheLastResponse().statusCode().isEqualTo(SC_OK), + Ensure.that(didDocument.id).isEqualTo(actor.recall("shortFormDid")) ) } diff --git a/tests/integration-tests/src/test/kotlin/features/did/UpdateDidSteps.kt b/tests/integration-tests/src/test/kotlin/features/did/UpdateDidSteps.kt index 51044b3b93..dad0341d95 100644 --- a/tests/integration-tests/src/test/kotlin/features/did/UpdateDidSteps.kt +++ b/tests/integration-tests/src/test/kotlin/features/did/UpdateDidSteps.kt @@ -18,8 +18,8 @@ class UpdateDidSteps { @When("{actor} updates PRISM DID by adding new keys") fun actorUpdatesPrismDidByAddingNewKeys(actor: Actor) { val updatePrismDidAction = UpdateManagedDIDRequestAction( - actionType = ActionType.aDDKEY, - ManagedDIDKeyTemplate("auth-2", Purpose.authentication) + actionType = ActionType.ADD_KEY, + ManagedDIDKeyTemplate("auth-2", Purpose.AUTHENTICATION) ) actor.remember("updatePrismDidAction", updatePrismDidAction) } @@ -27,7 +27,7 @@ class UpdateDidSteps { @When("{actor} updates PRISM DID by removing keys") fun actorUpdatesPrismDidByRemovingKeys(actor: Actor) { val updatePrismDidAction = UpdateManagedDIDRequestAction( - actionType = ActionType.rEMOVEKEY, + actionType = ActionType.REMOVE_KEY, removeKey = RemoveEntryById("auth-1") ) actor.remember("updatePrismDidAction", updatePrismDidAction) @@ -36,7 +36,7 @@ class UpdateDidSteps { @When("{actor} updates PRISM DID with new services") fun actorUpdatesPrismDidWithNewServices(actor: Actor) { val updatePrismDidAction = UpdateManagedDIDRequestAction( - actionType = ActionType.aDDSERVICE, + actionType = ActionType.ADD_SERVICE, addService = Service( "https://new.service.com", listOf("LinkedDomains"), @@ -49,7 +49,7 @@ class UpdateDidSteps { @When("{actor} updates PRISM DID by removing services") fun actorUpdatesPrismDidByRemovingServices(actor: Actor) { val updatePrismDidAction = UpdateManagedDIDRequestAction( - actionType = ActionType.rEMOVESERVICE, + actionType = ActionType.REMOVE_SERVICE, removeService = RemoveEntryById("https://new.service.com") ) actor.remember("updatePrismDidAction", updatePrismDidAction) @@ -65,7 +65,7 @@ class UpdateDidSteps { ) ) val updatePrismDidAction = UpdateManagedDIDRequestAction( - actionType = ActionType.uPDATESERVICE, + actionType = ActionType.UPDATE_SERVICE, updateService = newService ) actor.remember("updatePrismDidAction", updatePrismDidAction) diff --git a/tests/integration-tests/src/test/kotlin/features/proofs/PresentProofSteps.kt b/tests/integration-tests/src/test/kotlin/features/proofs/PresentProofSteps.kt index 4793da20ec..c1fa5976e2 100644 --- a/tests/integration-tests/src/test/kotlin/features/proofs/PresentProofSteps.kt +++ b/tests/integration-tests/src/test/kotlin/features/proofs/PresentProofSteps.kt @@ -21,7 +21,7 @@ class PresentProofSteps { @When("{actor} sends a request for proof presentation to {actor}") fun faberSendsARequestForProofPresentationToBob(faber: Actor, bob: Actor) { val presentationRequest = RequestPresentationInput( - connectionId = faber.recall("connection-with-${bob.name}").connectionId.toString(), + connectionId = faber.recall("connection-with-${bob.name}").connectionId, options = Options( challenge = "11c91493-01b3-4c4d-ac36-b336bab5bddf", domain = "https://example-verifier.com" @@ -57,7 +57,7 @@ class PresentProofSteps { it.data.thid == bob.recall("thid") } proofEvent != null && - proofEvent!!.data.status == PresentationStatus.Status.requestReceived + proofEvent!!.data.status == PresentationStatus.Status.REQUEST_RECEIVED }, "ERROR: Bob did not achieve any presentation request!" ) @@ -68,7 +68,7 @@ class PresentProofSteps { fun bobMakesThePresentationOfTheProof(bob: Actor, faber: Actor) { val requestPresentationAction = RequestPresentationAction( proofId = listOf(bob.recall("issuedCredential").recordId), - action = RequestPresentationAction.Action.requestMinusAccept + action = RequestPresentationAction.Action.REQUEST_MINUS_ACCEPT ) bob.attemptsTo( @@ -86,7 +86,7 @@ class PresentProofSteps { Patch.to("/present-proof/presentations/${bob.recall("presentationId")}").with { it.body( RequestPresentationAction( - action = RequestPresentationAction.Action.requestMinusReject + action = RequestPresentationAction.Action.REQUEST_MINUS_REJECT ) ) } @@ -101,7 +101,7 @@ class PresentProofSteps { it.data.thid == bob.recall("thid") } proofEvent != null && - proofEvent!!.data.status == PresentationStatus.Status.requestRejected + proofEvent!!.data.status == PresentationStatus.Status.REQUEST_REJECTED }, "ERROR: Faber did not receive presentation from Bob!" ) @@ -116,7 +116,7 @@ class PresentProofSteps { } proofEvent != null && - proofEvent!!.data.status == PresentationStatus.Status.presentationVerified + proofEvent!!.data.status == PresentationStatus.Status.PRESENTATION_VERIFIED }, "ERROR: presentation did not achieve PresentationVerified state!" ) diff --git a/tests/integration-tests/src/test/kotlin/interactions/AuthRestInteraction.kt b/tests/integration-tests/src/test/kotlin/interactions/AuthRestInteraction.kt index 295fcae850..881c193dae 100644 --- a/tests/integration-tests/src/test/kotlin/interactions/AuthRestInteraction.kt +++ b/tests/integration-tests/src/test/kotlin/interactions/AuthRestInteraction.kt @@ -14,7 +14,7 @@ abstract class AuthRestInteraction : RestInteraction() { fun specWithAuthHeaders(actor: T): RequestSpecification { val spec = rest() if (actor!!.name.toLowerCasePreservingASCIIRules().contains("admin")) { - spec.header(config.global.adminAuthHeader, config.admin.apikey) + spec.header(config.global.adminAuthHeader, config.global.adminApiKey) } else { if (config.global.authRequired) { spec.header(config.global.authHeader, actor.recall("AUTH_KEY")) diff --git a/tests/integration-tests/src/test/resources/features/connection/connection.feature b/tests/integration-tests/src/test/resources/features/connection/connection.feature index 02d1150932..360a135220 100644 --- a/tests/integration-tests/src/test/resources/features/connection/connection.feature +++ b/tests/integration-tests/src/test/resources/features/connection/connection.feature @@ -1,6 +1,5 @@ Feature: Agents connection -@TEST_ATL-3834 Scenario: Establish a connection between two agents When Acme generates a connection invitation to Bob And Bob sends a connection request to Acme diff --git a/tests/integration-tests/src/test/resources/features/credentials/issue_credentials.feature b/tests/integration-tests/src/test/resources/features/credentials/issue_credentials.feature index 527e4fa667..94a1609753 100644 --- a/tests/integration-tests/src/test/resources/features/credentials/issue_credentials.feature +++ b/tests/integration-tests/src/test/resources/features/credentials/issue_credentials.feature @@ -1,7 +1,6 @@ @RFC0453 @AIP20 Feature: Issue Credentials Protocol -@TEST_ATL-3849 Scenario: Issuing credential with published PRISM DID to unpublished PRISM DID Given Acme and Bob have an existing connection When Acme creates unpublished DID @@ -12,7 +11,6 @@ Scenario: Issuing credential with published PRISM DID to unpublished PRISM DID And Acme issues the credential Then Bob receives the issued credential -@TEST_ATL-3894 Scenario: Issuing credential with unpublished PRISM DID to unpublished PRISM DID Given Acme and Bob have an existing connection When Acme creates unpublished DID diff --git a/tests/integration-tests/src/test/resources/features/did/create_did.feature b/tests/integration-tests/src/test/resources/features/did/create_did.feature index 828ea34d47..f987c46390 100644 --- a/tests/integration-tests/src/test/resources/features/did/create_did.feature +++ b/tests/integration-tests/src/test/resources/features/did/create_did.feature @@ -1,37 +1,9 @@ Feature: Create and publish DID -@TEST_ATL-3838 Scenario: Create PRISM DID When Acme creates PRISM DID Then He sees PRISM DID was created successfully -@TEST_ATL-3839 -Scenario Outline: PRISM DID creation fails when required request fields are missing - Given Acme tries to create PRISM DID with missing - Then He sees the request has failed with error status -Examples: - | field | error | - | documentTemplate | 400 | - | documentTemplate.publicKeys | 400 | - | documentTemplate.publicKeys[0].id | 400 | - | documentTemplate.publicKeys[0].purpose | 400 | - | documentTemplate.services | 400 | - | documentTemplate.services[0].id | 400 | - | documentTemplate.services[0].type | 400 | - | documentTemplate.services[0].serviceEndpoint | 400 | - -@TEST_ATL-3840 -Scenario Outline: PRISM DID creation fails with wrong formatted fields - Given Acme tries to create a managed DID with value in - Then He sees the request has failed with error status -Examples: - | field | value | error | - | documentTemplate.publicKeys[0].id | # | 422 | - | documentTemplate.publicKeys[0].purpose | potato | 400 | - | documentTemplate.services[0].id | # | 422 | - | documentTemplate.services[0].type | pot@to | 422 | - -@TEST_ATL-3842 Scenario: Successfully publish DID to ledger When Acme creates unpublished DID And He publishes DID to ledger diff --git a/tests/integration-tests/src/test/resources/features/did/deactivate_did.feature b/tests/integration-tests/src/test/resources/features/did/deactivate_did.feature index 3c80b55c14..9f98dfa7a3 100644 --- a/tests/integration-tests/src/test/resources/features/did/deactivate_did.feature +++ b/tests/integration-tests/src/test/resources/features/did/deactivate_did.feature @@ -1,7 +1,6 @@ @DLT Feature: Deactivate DID -@TEST_ATL-3837 Scenario: Deactivate DID Given Acme have published PRISM DID When Acme deactivates PRISM DID diff --git a/tests/integration-tests/src/test/resources/features/did/listing_did.feature b/tests/integration-tests/src/test/resources/features/did/listing_did.feature index 14bffb3eab..cddac4ecd2 100644 --- a/tests/integration-tests/src/test/resources/features/did/listing_did.feature +++ b/tests/integration-tests/src/test/resources/features/did/listing_did.feature @@ -1,6 +1,5 @@ Feature: DID listing -@TEST_ATL-3841 Scenario: Listing multiple PRISM DIDs Given Acme creates 5 PRISM DIDs When He lists all PRISM DIDs diff --git a/tests/integration-tests/src/test/resources/features/did/update_did.feature b/tests/integration-tests/src/test/resources/features/did/update_did.feature index 906d6b1472..349ae0628a 100644 --- a/tests/integration-tests/src/test/resources/features/did/update_did.feature +++ b/tests/integration-tests/src/test/resources/features/did/update_did.feature @@ -2,34 +2,28 @@ Feature: Update DID Background: Published DID is created - #@PRECOND_ATL-3843 Given Acme have published PRISM DID -@TEST_ATL-3844 Scenario: Update PRISM DID by adding new services When Acme updates PRISM DID with new services And He submits PRISM DID update operation Then He sees PRISM DID was successfully updated with new services -@TEST_ATL-3845 Scenario: Update PRISM DID by removing services When Acme updates PRISM DID by removing services And He submits PRISM DID update operation Then He sees PRISM DID was successfully updated by removing services -@TEST_ATL-3846 Scenario: Update PRISM DID by updating services When Acme updates PRISM DID by updating services And He submits PRISM DID update operation Then He sees PRISM DID was successfully updated by updating services -@TEST_ATL-3847 Scenario: Update PRISM DID by adding new keys When Acme updates PRISM DID by adding new keys And He submits PRISM DID update operation Then He sees PRISM DID was successfully updated with new keys -@TEST_ATL-3848 Scenario: Update PRISM DID by removing keys When Acme updates PRISM DID by removing keys And He submits PRISM DID update operation diff --git a/tests/integration-tests/src/test/resources/features/proofs/present_proof.feature b/tests/integration-tests/src/test/resources/features/proofs/present_proof.feature index dcb0865754..406908d490 100644 --- a/tests/integration-tests/src/test/resources/features/proofs/present_proof.feature +++ b/tests/integration-tests/src/test/resources/features/proofs/present_proof.feature @@ -1,6 +1,5 @@ Feature: Present Proof Protocol -@TEST_ATL-3850 Scenario: Holder presents credential proof to verifier Given Faber and Bob have an existing connection And Bob has an issued credential from Acme @@ -9,7 +8,6 @@ Scenario: Holder presents credential proof to verifier And Bob makes the presentation of the proof to Faber Then Faber has the proof verified -@TEST_ATL-3881 Scenario: Verifier rejects holder proof Given Faber and Bob have an existing connection And Bob has an issued credential from Acme @@ -18,7 +16,6 @@ Scenario: Verifier rejects holder proof And Bob rejects the proof Then Bob sees the proof is rejected -@TEST_ATL-4968 Scenario: Holder presents proof to verifier which is the issuer itself Given Acme and Bob have an existing connection And Bob has an issued credential from Acme diff --git a/tests/integration-tests/src/test/resources/features/schemas/credential_schemas.feature b/tests/integration-tests/src/test/resources/features/schemas/credential_schemas.feature index 11a73b6600..1cd58174fc 100644 --- a/tests/integration-tests/src/test/resources/features/schemas/credential_schemas.feature +++ b/tests/integration-tests/src/test/resources/features/schemas/credential_schemas.feature @@ -1,12 +1,10 @@ Feature: Credential schemas -@TEST_ATL-3835 Scenario: Successful schema creation When Acme creates unpublished DID And Acme creates a new credential schema Then He sees new credential schema is available -@TEST_ATL-3836 Scenario Outline: Multiple schema creation When Acme creates unpublished DID And Acme creates new schemas diff --git a/tests/integration-tests/src/test/resources/features/system/health_endpoint.feature b/tests/integration-tests/src/test/resources/features/system/health_endpoint.feature index ba03a7903c..ea5229aee6 100644 --- a/tests/integration-tests/src/test/resources/features/system/health_endpoint.feature +++ b/tests/integration-tests/src/test/resources/features/system/health_endpoint.feature @@ -1,7 +1,6 @@ @system @smoke Feature: Agent Health Endpoint -@TEST_ATL-3833 Scenario: The runtime version can be retrieved from the Health Endpoint When Acme makes a request to the health endpoint Then Acme knows what version of the service is running diff --git a/tests/integration-tests/src/test/resources/features/verificationpolicies/verification_policies.feature b/tests/integration-tests/src/test/resources/features/verificationpolicies/verification_policies.feature index 766319b2f9..e72204109f 100644 --- a/tests/integration-tests/src/test/resources/features/verificationpolicies/verification_policies.feature +++ b/tests/integration-tests/src/test/resources/features/verificationpolicies/verification_policies.feature @@ -1,4 +1,3 @@ -@TEST_ATL-2487 Feature: Verification Policies Scenario: Successful verification policy creation diff --git a/tests/integration-tests/src/test/resources/tests.conf b/tests/integration-tests/src/test/resources/tests.conf index 5b617bbe89..bd1065b8e6 100644 --- a/tests/integration-tests/src/test/resources/tests.conf +++ b/tests/integration-tests/src/test/resources/tests.conf @@ -1,31 +1,32 @@ global { auth_required = true - auth_header = "apikey" - admin_auth_header = "x-admin-api-key" + auth_header = "${AUTH_HEADER:-apikey}" + admin_auth_header = "${ADMIN_AUTH_HEADER:-x-admin-api-key}" + admin_apikey = "${ADMIN_API_KEY:-admin}" } admin { url = "${ADMIN_AGENT_URL:-http://localhost:8080/prism-agent}" - apikey = "${ADMIN_API_KEY:-admin}" + apikey = "${ISSUER_API_KEY:-${random.string(16)}}" } issuer { url = "${ISSUER_AGENT_URL:-http://localhost:8080/prism-agent}" webhook_url = "${ISSUER_WEBHOOK_URL:-http://host.docker.internal:9955}" apikey = "${ISSUER_API_KEY:-${random.string(16)}}" -} - -holder { - url = "http://localhost:8090/prism-agent" - url = ${?HOLDER_AGENT_URL} - webhook_url = "http://host.docker.internal:9956" - webhook_url = ${?HOLDER_WEBHOOK_URL} - apikey = "default" - apikey = ${?HOLDER_API_KEY} + multi-tenant = true } verifier { url = "${VERIFIER_AGENT_URL:-http://localhost:8080/prism-agent}" webhook_url = "${VERIFIER_WEBHOOK_URL:-http://host.docker.internal:9957}" apikey = "${VERIFIER_API_KEY:-${random.string(16)}}" + multi-tenant = true +} + +holder { + url = "${HOLDER_AGENT_URL:-http://localhost:8090/prism-agent}" + webhook_url = "${HOLDER_WEBHOOK_URL:-http://host.docker.internal:9956}" + apikey = "${HOLDER_API_KEY:-default}" + multi-tenant = false }