mirror of
https://github.com/corda/corda.git
synced 2025-06-17 22:58:19 +00:00
Converted sealed data types to be data classes
This commit is contained in:
@ -513,7 +513,7 @@ sealed class CertificateChainCheckPolicy {
|
||||
}
|
||||
}
|
||||
|
||||
class MustContainOneOf(val trustedAliases: Set<String>) : CertificateChainCheckPolicy() {
|
||||
data class MustContainOneOf(val trustedAliases: Set<String>) : CertificateChainCheckPolicy() {
|
||||
override fun createCheck(keyStore: KeyStore, trustStore: KeyStore): Check {
|
||||
val trustedPublicKeys = trustedAliases.map { trustStore.getCertificate(it).publicKey }.toSet()
|
||||
return object : Check {
|
||||
|
@ -2,7 +2,6 @@ package net.corda.node.services.statemachine
|
||||
|
||||
import net.corda.core.crypto.SecureHash
|
||||
|
||||
// TODO revisit when Kotlin 1.1 is released and data classes can extend other classes
|
||||
interface FlowIORequest {
|
||||
// This is used to identify where we suspended, in case of message mismatch errors and other things where we
|
||||
// don't have the original stack trace because it's in a suspended fiber.
|
||||
|
@ -32,13 +32,11 @@ sealed class FlowSessionState {
|
||||
abstract val sendToParty: Party
|
||||
|
||||
/** [otherParty] may be a specific peer or a service party */
|
||||
class Initiating(val otherParty: Party) : FlowSessionState() {
|
||||
data class Initiating(val otherParty: Party) : FlowSessionState() {
|
||||
override val sendToParty: Party get() = otherParty
|
||||
override fun toString(): String = "${javaClass.simpleName}($otherParty)"
|
||||
}
|
||||
|
||||
class Initiated(val peerParty: Party, val peerSessionId: Long) : FlowSessionState() {
|
||||
data class Initiated(val peerParty: Party, val peerSessionId: Long) : FlowSessionState() {
|
||||
override val sendToParty: Party get() = peerParty
|
||||
override fun toString(): String = "${javaClass.simpleName}($peerParty, $peerSessionId)"
|
||||
}
|
||||
}
|
||||
|
@ -51,15 +51,15 @@ object BFTSMaRt {
|
||||
/** Sent from [Server] to [Client]. */
|
||||
@CordaSerializable
|
||||
sealed class ReplicaResponse {
|
||||
class Error(val error: NotaryError) : ReplicaResponse()
|
||||
class Signature(val txSignature: DigitalSignature) : ReplicaResponse()
|
||||
data class Error(val error: NotaryError) : ReplicaResponse()
|
||||
data class Signature(val txSignature: DigitalSignature) : ReplicaResponse()
|
||||
}
|
||||
|
||||
/** An aggregate response from all replica ([Server]) replies sent from [Client] back to the calling application. */
|
||||
@CordaSerializable
|
||||
sealed class ClusterResponse {
|
||||
class Error(val error: NotaryError) : ClusterResponse()
|
||||
class Signatures(val txSignatures: List<DigitalSignature>) : ClusterResponse()
|
||||
data class Error(val error: NotaryError) : ClusterResponse()
|
||||
data class Signatures(val txSignatures: List<DigitalSignature>) : ClusterResponse()
|
||||
}
|
||||
|
||||
class Client(val id: Int) : SingletonSerializeAsToken() {
|
||||
@ -193,7 +193,7 @@ object BFTSMaRt {
|
||||
|
||||
protected fun validateTimestamp(t: Timestamp?) {
|
||||
if (t != null && !timestampChecker.isValid(t))
|
||||
throw NotaryException(NotaryError.TimestampInvalid())
|
||||
throw NotaryException(NotaryError.TimestampInvalid)
|
||||
}
|
||||
|
||||
protected fun sign(bytes: ByteArray): DigitalSignature.WithKey {
|
||||
|
@ -252,16 +252,11 @@ abstract class AbstractNetworkMapServiceTest<out S : AbstractNetworkMapService>
|
||||
return network.createNode(legalName = legalName, nodeFactory = NoNMSNodeFactory)
|
||||
}
|
||||
|
||||
sealed class Changed(val node: NodeInfo) {
|
||||
override fun equals(other: Any?): Boolean = other?.javaClass == this.javaClass && (other as Changed).node == this.node
|
||||
override fun hashCode(): Int = node.hashCode()
|
||||
override fun toString(): String = "${javaClass.simpleName}($node)"
|
||||
|
||||
class Added(node: NodeInfo) : Changed(node) {
|
||||
sealed class Changed {
|
||||
data class Added(val node: NodeInfo) : Changed() {
|
||||
constructor(node: MockNode) : this(node.info)
|
||||
}
|
||||
|
||||
class Removed(node: NodeInfo) : Changed(node) {
|
||||
data class Removed(val node: NodeInfo) : Changed() {
|
||||
constructor(node: MockNode) : this(node.info)
|
||||
}
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ class RequeryConfigurationTest {
|
||||
commands = emptyList(),
|
||||
notary = DUMMY_NOTARY,
|
||||
signers = emptyList(),
|
||||
type = TransactionType.General(),
|
||||
type = TransactionType.General,
|
||||
timestamp = null
|
||||
)
|
||||
return SignedTransaction(wtx.serialized, listOf(DigitalSignature.WithKey(NullPublicKey, ByteArray(1))))
|
||||
|
@ -153,7 +153,7 @@ class DBTransactionStorageTests {
|
||||
commands = emptyList(),
|
||||
notary = DUMMY_NOTARY,
|
||||
signers = emptyList(),
|
||||
type = TransactionType.General(),
|
||||
type = TransactionType.General,
|
||||
timestamp = null
|
||||
)
|
||||
return SignedTransaction(wtx.serialized, listOf(DigitalSignature.WithKey(NullPublicKey, ByteArray(1))))
|
||||
|
Reference in New Issue
Block a user