mirror of
https://github.com/corda/corda.git
synced 2025-06-18 23:28:21 +00:00
Revert Party.Full in preference for a less invasive change
This commit is contained in:
@ -58,22 +58,22 @@ val ORACLE_PUBKEY: CompositeKey get() = ORACLE_KEY.public.composite
|
||||
|
||||
val ALICE_KEY: KeyPair by lazy { generateKeyPair() }
|
||||
val ALICE_PUBKEY: CompositeKey get() = ALICE_KEY.public.composite
|
||||
val ALICE: Party.Full get() = Party.Full("Alice", ALICE_PUBKEY)
|
||||
val ALICE: Party get() = Party("Alice", ALICE_PUBKEY)
|
||||
|
||||
val BOB_KEY: KeyPair by lazy { generateKeyPair() }
|
||||
val BOB_PUBKEY: CompositeKey get() = BOB_KEY.public.composite
|
||||
val BOB: Party.Full get() = Party.Full("Bob", BOB_PUBKEY)
|
||||
val BOB: Party get() = Party("Bob", BOB_PUBKEY)
|
||||
|
||||
val CHARLIE_KEY: KeyPair by lazy { generateKeyPair() }
|
||||
val CHARLIE_PUBKEY: CompositeKey get() = CHARLIE_KEY.public.composite
|
||||
val CHARLIE: Party.Full get() = Party.Full("Charlie", CHARLIE_PUBKEY)
|
||||
val CHARLIE: Party get() = Party("Charlie", CHARLIE_PUBKEY)
|
||||
|
||||
val MEGA_CORP: Party.Full get() = Party.Full("MegaCorp", MEGA_CORP_PUBKEY)
|
||||
val MINI_CORP: Party.Full get() = Party.Full("MiniCorp", MINI_CORP_PUBKEY)
|
||||
val MEGA_CORP: Party get() = Party("MegaCorp", MEGA_CORP_PUBKEY)
|
||||
val MINI_CORP: Party get() = Party("MiniCorp", MINI_CORP_PUBKEY)
|
||||
|
||||
val BOC_KEY: KeyPair by lazy { generateKeyPair() }
|
||||
val BOC_PUBKEY: CompositeKey get() = BOC_KEY.public.composite
|
||||
val BOC: Party.Full get() = Party.Full("BankOfCorda", BOC_PUBKEY)
|
||||
val BOC: Party get() = Party("BankOfCorda", BOC_PUBKEY)
|
||||
val BOC_PARTY_REF = BOC.ref(OpaqueBytes.of(1)).reference
|
||||
|
||||
val ALL_TEST_KEYS: List<KeyPair> get() = listOf(MEGA_CORP_KEY, MINI_CORP_KEY, ALICE_KEY, BOB_KEY, DUMMY_NOTARY_KEY)
|
||||
@ -139,7 +139,7 @@ fun getFreeLocalPorts(hostName: String, numberToAlloc: Int): List<HostAndPort> {
|
||||
*/
|
||||
inline fun <reified P : FlowLogic<*>> AbstractNode.initiateSingleShotFlow(
|
||||
markerClass: KClass<out FlowLogic<*>>,
|
||||
noinline flowFactory: (Party.Full) -> P): ListenableFuture<P> {
|
||||
noinline flowFactory: (Party) -> P): ListenableFuture<P> {
|
||||
val future = smm.changes.filter { it.addOrRemove == ADD && it.logic is P }.map { it.logic as P }.toFuture()
|
||||
services.registerFlowInitiator(markerClass, flowFactory)
|
||||
return future
|
||||
|
@ -115,7 +115,7 @@ data class TestTransactionDSLInterpreter private constructor(
|
||||
transactionBuilder.addInputState(StateAndRef(state, stateRef))
|
||||
}
|
||||
|
||||
override fun _output(label: String?, notary: Party.Full, encumbrance: Int?, contractState: ContractState) {
|
||||
override fun _output(label: String?, notary: Party, encumbrance: Int?, contractState: ContractState) {
|
||||
val outputIndex = transactionBuilder.addOutputState(contractState, notary, encumbrance)
|
||||
if (label != null) {
|
||||
if (label in labelToIndexMap) {
|
||||
|
@ -35,7 +35,7 @@ interface TransactionDSLInterpreter : Verifies, OutputStateLookup {
|
||||
* @param encumbrance The position of the encumbrance state.
|
||||
* @param contractState The state itself.
|
||||
*/
|
||||
fun _output(label: String?, notary: Party.Full, encumbrance: Int?, contractState: ContractState)
|
||||
fun _output(label: String?, notary: Party, encumbrance: Int?, contractState: ContractState)
|
||||
|
||||
/**
|
||||
* Adds an [Attachment] reference to the transaction.
|
||||
@ -90,7 +90,7 @@ class TransactionDSL<out T : TransactionDSLInterpreter>(val interpreter: T) : Tr
|
||||
* @see TransactionDSLInterpreter._output
|
||||
*/
|
||||
@JvmOverloads
|
||||
fun output(label: String? = null, notary: Party.Full = DUMMY_NOTARY, encumbrance: Int? = null, contractStateClosure: () -> ContractState) =
|
||||
fun output(label: String? = null, notary: Party = DUMMY_NOTARY, encumbrance: Int? = null, contractStateClosure: () -> ContractState) =
|
||||
_output(label, notary, encumbrance, contractStateClosure())
|
||||
/**
|
||||
* @see TransactionDSLInterpreter._output
|
||||
|
@ -19,8 +19,8 @@ class MockNetworkMapCache() : InMemoryNetworkMapCache() {
|
||||
data class MockAddress(val id: String): SingleMessageRecipient
|
||||
|
||||
init {
|
||||
val mockNodeA = NodeInfo(MockAddress("bankC:8080"), Party.Full("Bank C", DummyPublicKey("Bank C")))
|
||||
val mockNodeB = NodeInfo(MockAddress("bankD:8080"), Party.Full("Bank D", DummyPublicKey("Bank D")))
|
||||
val mockNodeA = NodeInfo(MockAddress("bankC:8080"), Party("Bank C", DummyPublicKey("Bank C")))
|
||||
val mockNodeB = NodeInfo(MockAddress("bankD:8080"), Party("Bank D", DummyPublicKey("Bank D")))
|
||||
registeredNodes[mockNodeA.legalIdentity] = mockNodeA
|
||||
registeredNodes[mockNodeB.legalIdentity] = mockNodeB
|
||||
runWithoutMapService()
|
||||
@ -40,7 +40,7 @@ class MockNetworkMapCache() : InMemoryNetworkMapCache() {
|
||||
* not a change being received.
|
||||
*/
|
||||
@VisibleForTesting
|
||||
fun deleteRegistration(legalIdentity: Party.Full) : Boolean {
|
||||
fun deleteRegistration(legalIdentity: Party) : Boolean {
|
||||
return registeredNodes.remove(legalIdentity) != null
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ class MockNetwork(private val networkSendManuallyPumped: Boolean = false,
|
||||
// A unique identifier for this network to segregate databases with the same nodeID but different networks.
|
||||
private val networkId = random63BitValue()
|
||||
|
||||
val identities = ArrayList<Party.Full>()
|
||||
val identities = ArrayList<Party>()
|
||||
|
||||
private val _nodes = ArrayList<MockNode>()
|
||||
/** A read only view of the current set of executing nodes. */
|
||||
@ -174,7 +174,7 @@ class MockNetwork(private val networkSendManuallyPumped: Boolean = false,
|
||||
val override = overrideServices[it.info]
|
||||
if (override != null) {
|
||||
// TODO: Store the key
|
||||
ServiceEntry(it.info, Party.Full(it.identity.name, override.public))
|
||||
ServiceEntry(it.info, Party(it.identity.name, override.public))
|
||||
} else {
|
||||
it
|
||||
}
|
||||
|
@ -61,20 +61,20 @@ open class MockServices(val key: KeyPair = generateKeyPair()) : ServiceHub {
|
||||
override val networkMapCache: NetworkMapCache get() = throw UnsupportedOperationException()
|
||||
override val clock: Clock get() = throw UnsupportedOperationException()
|
||||
override val schedulerService: SchedulerService get() = throw UnsupportedOperationException()
|
||||
override val myInfo: NodeInfo get() = NodeInfo(object : SingleMessageRecipient {}, Party.Full("MegaCorp", key.public.composite))
|
||||
override val myInfo: NodeInfo get() = NodeInfo(object : SingleMessageRecipient {}, Party("MegaCorp", key.public.composite))
|
||||
}
|
||||
|
||||
@ThreadSafe
|
||||
class MockIdentityService(val identities: List<Party.Full>) : IdentityService, SingletonSerializeAsToken() {
|
||||
private val keyToParties: Map<CompositeKey, Party.Full>
|
||||
class MockIdentityService(val identities: List<Party>) : IdentityService, SingletonSerializeAsToken() {
|
||||
private val keyToParties: Map<CompositeKey, Party>
|
||||
get() = synchronized(identities) { identities.associateBy { it.owningKey } }
|
||||
private val nameToParties: Map<String, Party.Full>
|
||||
private val nameToParties: Map<String, Party>
|
||||
get() = synchronized(identities) { identities.associateBy { it.name } }
|
||||
|
||||
override fun registerIdentity(party: Party.Full) { throw UnsupportedOperationException() }
|
||||
override fun getAllIdentities(): Iterable<Party.Full> = ArrayList(keyToParties.values)
|
||||
override fun partyFromKey(key: CompositeKey): Party.Full? = keyToParties[key]
|
||||
override fun partyFromName(name: String): Party.Full? = nameToParties[name]
|
||||
override fun registerIdentity(party: Party) { throw UnsupportedOperationException() }
|
||||
override fun getAllIdentities(): Iterable<Party> = ArrayList(keyToParties.values)
|
||||
override fun partyFromKey(key: CompositeKey): Party? = keyToParties[key]
|
||||
override fun partyFromName(name: String): Party? = nameToParties[name]
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user