Skip to content

Commit

Permalink
style: apply linters automatic fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Hyperledger Bot <[email protected]>
  • Loading branch information
hyperledger-bot committed Nov 18, 2024
1 parent bae9ccd commit 729a34e
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 46 deletions.
55 changes: 21 additions & 34 deletions tests/integration-tests/src/test/kotlin/abilities/ListenToEvents.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ import java.time.OffsetDateTime
open class ListenToEvents(
private val url: URL,
webhookPort: Int?,
) : Ability, HasTeardown {
) : Ability,
HasTeardown {

private val server: ApplicationEngine
private val gson = GsonBuilder()
Expand Down Expand Up @@ -98,48 +99,36 @@ open class ListenToEvents(
}

companion object {
fun at(url: URL, webhookPort: Int?): ListenToEvents {
return ListenToEvents(url, webhookPort)
}
fun at(url: URL, webhookPort: Int?): ListenToEvents = ListenToEvents(url, webhookPort)

fun with(actor: Actor): ListenToEvents {
return actor.abilityTo(ListenToEvents::class.java)
}
fun with(actor: Actor): ListenToEvents = actor.abilityTo(ListenToEvents::class.java)

fun presentationProofStatus(actor: Actor): Question<PresentationStatusAdapter.Status?> {
return Question.about("presentation status").answeredBy {
val proofEvent = with(actor).presentationEvents.lastOrNull {
it.data.thid == actor.recall<String>("thid")
}
proofEvent?.data?.status
fun presentationProofStatus(actor: Actor): Question<PresentationStatusAdapter.Status?> = Question.about("presentation status").answeredBy {
val proofEvent = with(actor).presentationEvents.lastOrNull {
it.data.thid == actor.recall<String>("thid")
}
proofEvent?.data?.status
}

fun connectionState(actor: Actor): Question<Connection.State?> {
return Question.about("connection state").answeredBy {
val lastEvent = with(actor).connectionEvents.lastOrNull {
it.data.thid == actor.recall<Connection>("connection").thid
}
lastEvent?.data?.state
fun connectionState(actor: Actor): Question<Connection.State?> = Question.about("connection state").answeredBy {
val lastEvent = with(actor).connectionEvents.lastOrNull {
it.data.thid == actor.recall<Connection>("connection").thid
}
lastEvent?.data?.state
}

fun credentialState(actor: Actor): Question<IssueCredentialRecord.ProtocolState?> {
return Question.about("credential state").answeredBy {
val credentialEvent = ListenToEvents.with(actor).credentialEvents.lastOrNull {
it.data.thid == actor.recall<String>("thid")
}
credentialEvent?.data?.protocolState
fun credentialState(actor: Actor): Question<IssueCredentialRecord.ProtocolState?> = Question.about("credential state").answeredBy {
val credentialEvent = ListenToEvents.with(actor).credentialEvents.lastOrNull {
it.data.thid == actor.recall<String>("thid")
}
credentialEvent?.data?.protocolState
}

fun didStatus(actor: Actor): Question<String> {
return Question.about("did status").answeredBy {
val didEvent = ListenToEvents.with(actor).didEvents.lastOrNull {
it.data.did == actor.recall<String>("shortFormDid")
}
didEvent?.data?.status
fun didStatus(actor: Actor): Question<String> = Question.about("did status").answeredBy {
val didEvent = ListenToEvents.with(actor).didEvents.lastOrNull {
it.data.did == actor.recall<String>("shortFormDid")
}
didEvent?.data?.status
}
}

Expand All @@ -153,9 +142,7 @@ open class ListenToEvents(
.start(wait = false)
}

override fun toString(): String {
return "Listen HTTP port at $url"
}
override fun toString(): String = "Listen HTTP port at $url"

override fun tearDown() {
server.stop()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package common
import org.hyperledger.identus.client.models.ManagedDIDKeyTemplate
import org.hyperledger.identus.client.models.Service

data class DidDocumentTemplate (
data class DidDocumentTemplate(
val publicKeys: MutableList<ManagedDIDKeyTemplate>,
val services: MutableList<Service>
val services: MutableList<Service>,
)
12 changes: 6 additions & 6 deletions tests/integration-tests/src/test/kotlin/common/DidType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ enum class DidType {
CUSTOM {
override val documentTemplate get() = DidDocumentTemplate(
publicKeys = mutableListOf(),
services = mutableListOf()
services = mutableListOf(),
)
},
SD_JWT {
override val documentTemplate get() = DidDocumentTemplate(
publicKeys = mutableListOf(
publicKeys = mutableListOf(
ManagedDIDKeyTemplate("auth-1", Purpose.AUTHENTICATION, Curve.ED25519),
ManagedDIDKeyTemplate("assertion-1", Purpose.ASSERTION_METHOD, Curve.ED25519),
),
services = mutableListOf()
services = mutableListOf(),
)
},
JWT {
Expand All @@ -26,7 +26,7 @@ enum class DidType {
ManagedDIDKeyTemplate("assertion-1", Purpose.ASSERTION_METHOD, Curve.SECP256K1),
ManagedDIDKeyTemplate("assertion-2", Purpose.ASSERTION_METHOD, Curve.ED25519),
),
services = mutableListOf()
services = mutableListOf(),
)
},
OIDC_JWT {
Expand All @@ -36,13 +36,13 @@ enum class DidType {
ManagedDIDKeyTemplate("auth-2", Purpose.AUTHENTICATION, Curve.ED25519),
ManagedDIDKeyTemplate("assertion-1", Purpose.ASSERTION_METHOD, Curve.SECP256K1),
),
services = mutableListOf()
services = mutableListOf(),
)
},
ANONCRED {
override val documentTemplate get() = DidDocumentTemplate(
publicKeys = mutableListOf(),
services = mutableListOf()
services = mutableListOf(),
)
}, ;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ import org.assertj.core.api.Assertions.assertThat
import org.hamcrest.CoreMatchers
import org.hyperledger.identus.client.models.AcceptConnectionInvitationRequest
import org.hyperledger.identus.client.models.Connection
import org.hyperledger.identus.client.models.Connection.State.CONNECTION_REQUEST_RECEIVED
import org.hyperledger.identus.client.models.Connection.State.CONNECTION_RESPONSE_RECEIVED
import org.hyperledger.identus.client.models.Connection.State.CONNECTION_RESPONSE_SENT
import org.hyperledger.identus.client.models.Connection.State.INVITATION_GENERATED
import org.hyperledger.identus.client.models.CreateConnectionRequest
import kotlin.time.Duration.Companion.seconds

class ConnectionSteps {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ class CreateDidSteps {
val createDidRequest = CreateManagedDidRequest(
CreateManagedDidRequestDocumentTemplate(
publicKeys = documentTemplate.publicKeys,
services = documentTemplate.services
)
services = documentTemplate.services,
),
)

actor.attemptsTo(
Expand Down

0 comments on commit 729a34e

Please sign in to comment.