diff --git a/client/jackson/src/test/kotlin/net/corda/client/jackson/JacksonSupportTest.kt b/client/jackson/src/test/kotlin/net/corda/client/jackson/JacksonSupportTest.kt index 546d2dc088..d5b311e9f4 100644 --- a/client/jackson/src/test/kotlin/net/corda/client/jackson/JacksonSupportTest.kt +++ b/client/jackson/src/test/kotlin/net/corda/client/jackson/JacksonSupportTest.kt @@ -24,7 +24,7 @@ class JacksonSupportTest { private companion object { val SEED = BigInteger.valueOf(20170922L)!! val mapper = JacksonSupport.createNonRpcMapper() - val ALICE_PUBKEY = TestIdentity(ALICE_NAME, 70).pubkey + val ALICE_PUBKEY = TestIdentity(ALICE_NAME, 70).publicKey val DUMMY_NOTARY = TestIdentity(DUMMY_NOTARY_NAME, 20).party val MINI_CORP = TestIdentity(CordaX500Name("MiniCorp", "London", "GB")).party } diff --git a/core/src/test/kotlin/net/corda/core/crypto/PartialMerkleTreeTest.kt b/core/src/test/kotlin/net/corda/core/crypto/PartialMerkleTreeTest.kt index 3968d8cae3..4449f6a6c3 100644 --- a/core/src/test/kotlin/net/corda/core/crypto/PartialMerkleTreeTest.kt +++ b/core/src/test/kotlin/net/corda/core/crypto/PartialMerkleTreeTest.kt @@ -31,9 +31,9 @@ class PartialMerkleTreeTest { val megaCorp = TestIdentity(CordaX500Name("MegaCorp", "London", "GB")) val miniCorp = TestIdentity(CordaX500Name("MiniCorp", "London", "GB")) val MEGA_CORP get() = megaCorp.party - val MEGA_CORP_PUBKEY get() = megaCorp.pubkey + val MEGA_CORP_PUBKEY get() = megaCorp.publicKey val MINI_CORP get() = miniCorp.party - val MINI_CORP_PUBKEY get() = miniCorp.pubkey + val MINI_CORP_PUBKEY get() = miniCorp.publicKey } @Rule diff --git a/core/src/test/kotlin/net/corda/core/serialization/TransactionSerializationTests.kt b/core/src/test/kotlin/net/corda/core/serialization/TransactionSerializationTests.kt index ca795cf4f0..1fc305f656 100644 --- a/core/src/test/kotlin/net/corda/core/serialization/TransactionSerializationTests.kt +++ b/core/src/test/kotlin/net/corda/core/serialization/TransactionSerializationTests.kt @@ -25,9 +25,9 @@ class TransactionSerializationTests { val megaCorp = TestIdentity(CordaX500Name("MegaCorp", "London", "GB")) val MINI_CORP = TestIdentity(CordaX500Name("MiniCorp", "London", "GB")).party val DUMMY_NOTARY get() = dummyNotary.party - val DUMMY_NOTARY_KEY get() = dummyNotary.key + val DUMMY_NOTARY_KEY get() = dummyNotary.keyPair val MEGA_CORP get() = megaCorp.party - val MEGA_CORP_KEY get() = megaCorp.key + val MEGA_CORP_KEY get() = megaCorp.keyPair } @Rule diff --git a/core/src/test/kotlin/net/corda/core/transactions/TransactionEncumbranceTests.kt b/core/src/test/kotlin/net/corda/core/transactions/TransactionEncumbranceTests.kt index 1f487f6808..37af722e3c 100644 --- a/core/src/test/kotlin/net/corda/core/transactions/TransactionEncumbranceTests.kt +++ b/core/src/test/kotlin/net/corda/core/transactions/TransactionEncumbranceTests.kt @@ -27,7 +27,7 @@ class TransactionEncumbranceTests { val megaCorp = TestIdentity(CordaX500Name("MegaCorp", "London", "GB")) val MINI_CORP = TestIdentity(CordaX500Name("MiniCorp", "London", "GB")).party val MEGA_CORP get() = megaCorp.party - val MEGA_CORP_PUBKEY get() = megaCorp.pubkey + val MEGA_CORP_PUBKEY get() = megaCorp.publicKey } @Rule diff --git a/core/src/test/kotlin/net/corda/core/transactions/TransactionTests.kt b/core/src/test/kotlin/net/corda/core/transactions/TransactionTests.kt index 8280d688e6..9ef046072b 100644 --- a/core/src/test/kotlin/net/corda/core/transactions/TransactionTests.kt +++ b/core/src/test/kotlin/net/corda/core/transactions/TransactionTests.kt @@ -23,7 +23,7 @@ class TransactionTests { val BOB = TestIdentity(BOB_NAME, 80).party val dummyNotary = TestIdentity(DUMMY_NOTARY_NAME, 20) val DUMMY_NOTARY get() = dummyNotary.party - val DUMMY_NOTARY_KEY get() = dummyNotary.key + val DUMMY_NOTARY_KEY get() = dummyNotary.keyPair } @Rule diff --git a/docs/source/example-code/src/main/java/net/corda/docs/java/tutorial/testdsl/CommercialPaperTest.java b/docs/source/example-code/src/main/java/net/corda/docs/java/tutorial/testdsl/CommercialPaperTest.java index 6c83cabfc6..573bef81b3 100644 --- a/docs/source/example-code/src/main/java/net/corda/docs/java/tutorial/testdsl/CommercialPaperTest.java +++ b/docs/source/example-code/src/main/java/net/corda/docs/java/tutorial/testdsl/CommercialPaperTest.java @@ -40,9 +40,9 @@ public class CommercialPaperTest { { IdentityServiceInternal identityService = rigorousMock(IdentityServiceInternal.class); - doReturn(MEGA_CORP.getParty()).when(identityService).partyFromKey(MEGA_CORP.getPubkey()); + doReturn(MEGA_CORP.getParty()).when(identityService).partyFromKey(MEGA_CORP.getPublicKey()); doReturn(null).when(identityService).partyFromKey(BIG_CORP_PUBKEY); - doReturn(null).when(identityService).partyFromKey(ALICE.getPubkey()); + doReturn(null).when(identityService).partyFromKey(ALICE.getPublicKey()); ledgerServices = new MockServices(identityService, MEGA_CORP.getName()); } @@ -79,7 +79,7 @@ public class CommercialPaperTest { ledger(ledgerServices, DUMMY_NOTARY, l -> { l.transaction(tx -> { tx.input(JCP_PROGRAM_ID, inState); - tx.command(MEGA_CORP.getPubkey(), new JavaCommercialPaper.Commands.Move()); + tx.command(MEGA_CORP.getPublicKey(), new JavaCommercialPaper.Commands.Move()); tx.attachments(JCP_PROGRAM_ID); return tx.verifies(); }); @@ -95,7 +95,7 @@ public class CommercialPaperTest { ledger(ledgerServices, DUMMY_NOTARY, l -> { l.transaction(tx -> { tx.input(JCP_PROGRAM_ID, inState); - tx.command(MEGA_CORP.getPubkey(), new JavaCommercialPaper.Commands.Move()); + tx.command(MEGA_CORP.getPublicKey(), new JavaCommercialPaper.Commands.Move()); tx.attachments(JCP_PROGRAM_ID); return tx.failsWith("the state is propagated"); }); @@ -111,7 +111,7 @@ public class CommercialPaperTest { ledger(ledgerServices, DUMMY_NOTARY, l -> { l.transaction(tx -> { tx.input(JCP_PROGRAM_ID, inState); - tx.command(MEGA_CORP.getPubkey(), new JavaCommercialPaper.Commands.Move()); + tx.command(MEGA_CORP.getPublicKey(), new JavaCommercialPaper.Commands.Move()); tx.attachments(JCP_PROGRAM_ID); tx.failsWith("the state is propagated"); tx.output(JCP_PROGRAM_ID, "alice's paper", inState.withOwner(ALICE.getParty())); @@ -134,7 +134,7 @@ public class CommercialPaperTest { tw.timeWindow(getTEST_TX_TIME()); return tw.failsWith("output states are issued by a command signer"); }); - tx.command(MEGA_CORP.getPubkey(), new JavaCommercialPaper.Commands.Issue()); + tx.command(MEGA_CORP.getPublicKey(), new JavaCommercialPaper.Commands.Issue()); tx.timeWindow(getTEST_TX_TIME()); return tx.verifies(); }); @@ -154,7 +154,7 @@ public class CommercialPaperTest { tw.timeWindow(getTEST_TX_TIME()); return tw.failsWith("output states are issued by a command signer"); }); - tx.command(MEGA_CORP.getPubkey(), new JavaCommercialPaper.Commands.Issue()); + tx.command(MEGA_CORP.getPublicKey(), new JavaCommercialPaper.Commands.Issue()); tx.timeWindow(getTEST_TX_TIME()); return tx.verifies(); }); @@ -176,7 +176,7 @@ public class CommercialPaperTest { // Some CP is issued onto the ledger by MegaCorp. l.transaction("Issuance", tx -> { tx.output(JCP_PROGRAM_ID, "paper", getPaper()); - tx.command(MEGA_CORP.getPubkey(), new JavaCommercialPaper.Commands.Issue()); + tx.command(MEGA_CORP.getPublicKey(), new JavaCommercialPaper.Commands.Issue()); tx.attachments(JCP_PROGRAM_ID); tx.timeWindow(getTEST_TX_TIME()); return tx.verifies(); @@ -188,8 +188,8 @@ public class CommercialPaperTest { tx.output(Cash.PROGRAM_ID, "borrowed $900", new Cash.State(issuedBy(DOLLARS(900), issuer), MEGA_CORP.getParty())); JavaCommercialPaper.State inputPaper = l.retrieveOutput(JavaCommercialPaper.State.class, "paper"); tx.output(JCP_PROGRAM_ID, "alice's paper", inputPaper.withOwner(ALICE.getParty())); - tx.command(ALICE.getPubkey(), new Cash.Commands.Move()); - tx.command(MEGA_CORP.getPubkey(), new JavaCommercialPaper.Commands.Move()); + tx.command(ALICE.getPublicKey(), new Cash.Commands.Move()); + tx.command(MEGA_CORP.getPublicKey(), new JavaCommercialPaper.Commands.Move()); return tx.verifies(); }); return Unit.INSTANCE; @@ -212,7 +212,7 @@ public class CommercialPaperTest { // Some CP is issued onto the ledger by MegaCorp. l.transaction("Issuance", tx -> { tx.output(Cash.PROGRAM_ID, "paper", getPaper()); - tx.command(MEGA_CORP.getPubkey(), new JavaCommercialPaper.Commands.Issue()); + tx.command(MEGA_CORP.getPublicKey(), new JavaCommercialPaper.Commands.Issue()); tx.attachments(JCP_PROGRAM_ID); tx.timeWindow(getTEST_TX_TIME()); return tx.verifies(); @@ -224,8 +224,8 @@ public class CommercialPaperTest { tx.output(Cash.PROGRAM_ID, "borrowed $900", new Cash.State(issuedBy(DOLLARS(900), issuer), MEGA_CORP.getParty())); JavaCommercialPaper.State inputPaper = l.retrieveOutput(JavaCommercialPaper.State.class, "paper"); tx.output(JCP_PROGRAM_ID, "alice's paper", inputPaper.withOwner(ALICE.getParty())); - tx.command(ALICE.getPubkey(), new Cash.Commands.Move()); - tx.command(MEGA_CORP.getPubkey(), new JavaCommercialPaper.Commands.Move()); + tx.command(ALICE.getPublicKey(), new Cash.Commands.Move()); + tx.command(MEGA_CORP.getPublicKey(), new JavaCommercialPaper.Commands.Move()); return tx.verifies(); }); @@ -234,7 +234,7 @@ public class CommercialPaperTest { JavaCommercialPaper.State inputPaper = l.retrieveOutput(JavaCommercialPaper.State.class, "paper"); // We moved a paper to other pubkey. tx.output(JCP_PROGRAM_ID, "bob's paper", inputPaper.withOwner(BOB.getParty())); - tx.command(MEGA_CORP.getPubkey(), new JavaCommercialPaper.Commands.Move()); + tx.command(MEGA_CORP.getPublicKey(), new JavaCommercialPaper.Commands.Move()); return tx.verifies(); }); l.fails(); @@ -258,7 +258,7 @@ public class CommercialPaperTest { // Some CP is issued onto the ledger by MegaCorp. l.transaction("Issuance", tx -> { tx.output(Cash.PROGRAM_ID, "paper", getPaper()); - tx.command(MEGA_CORP.getPubkey(), new JavaCommercialPaper.Commands.Issue()); + tx.command(MEGA_CORP.getPublicKey(), new JavaCommercialPaper.Commands.Issue()); tx.attachments(JCP_PROGRAM_ID); tx.timeWindow(getTEST_TX_TIME()); return tx.verifies(); @@ -270,8 +270,8 @@ public class CommercialPaperTest { tx.output(Cash.PROGRAM_ID, "borrowed $900", new Cash.State(issuedBy(DOLLARS(900), issuer), MEGA_CORP.getParty())); JavaCommercialPaper.State inputPaper = l.retrieveOutput(JavaCommercialPaper.State.class, "paper"); tx.output(JCP_PROGRAM_ID, "alice's paper", inputPaper.withOwner(ALICE.getParty())); - tx.command(ALICE.getPubkey(), new Cash.Commands.Move()); - tx.command(MEGA_CORP.getPubkey(), new JavaCommercialPaper.Commands.Move()); + tx.command(ALICE.getPublicKey(), new Cash.Commands.Move()); + tx.command(MEGA_CORP.getPublicKey(), new JavaCommercialPaper.Commands.Move()); return tx.verifies(); }); @@ -281,7 +281,7 @@ public class CommercialPaperTest { JavaCommercialPaper.State inputPaper = l.retrieveOutput(JavaCommercialPaper.State.class, "paper"); // We moved a paper to another pubkey. tx.output(JCP_PROGRAM_ID, "bob's paper", inputPaper.withOwner(BOB.getParty())); - tx.command(MEGA_CORP.getPubkey(), new JavaCommercialPaper.Commands.Move()); + tx.command(MEGA_CORP.getPublicKey(), new JavaCommercialPaper.Commands.Move()); return tx.verifies(); }); lw.fails(); diff --git a/docs/source/example-code/src/main/kotlin/net/corda/docs/tutorial/testdsl/TutorialTestDSL.kt b/docs/source/example-code/src/main/kotlin/net/corda/docs/tutorial/testdsl/TutorialTestDSL.kt index 6754a6082c..45bd12a23f 100644 --- a/docs/source/example-code/src/main/kotlin/net/corda/docs/tutorial/testdsl/TutorialTestDSL.kt +++ b/docs/source/example-code/src/main/kotlin/net/corda/docs/tutorial/testdsl/TutorialTestDSL.kt @@ -28,9 +28,9 @@ class CommercialPaperTest { val DUMMY_NOTARY = TestIdentity(DUMMY_NOTARY_NAME, 20).party val megaCorp = TestIdentity(CordaX500Name("MegaCorp", "London", "GB")) val ALICE get() = alice.party - val ALICE_PUBKEY get() = alice.pubkey + val ALICE_PUBKEY get() = alice.publicKey val MEGA_CORP get() = megaCorp.party - val MEGA_CORP_PUBKEY get() = megaCorp.pubkey + val MEGA_CORP_PUBKEY get() = megaCorp.publicKey } @Rule diff --git a/finance/src/test/java/net/corda/finance/contracts/asset/CashTestsJava.java b/finance/src/test/java/net/corda/finance/contracts/asset/CashTestsJava.java index ce7273f75b..b9daac0541 100644 --- a/finance/src/test/java/net/corda/finance/contracts/asset/CashTestsJava.java +++ b/finance/src/test/java/net/corda/finance/contracts/asset/CashTestsJava.java @@ -27,36 +27,36 @@ public class CashTestsJava { private static final TestIdentity MEGA_CORP = new TestIdentity(new CordaX500Name("MegaCorp", "London", "GB")); private static final TestIdentity MINI_CORP = new TestIdentity(new CordaX500Name("MiniCorp", "London", "GB")); private final PartyAndReference defaultIssuer = MEGA_CORP.ref((byte) 1); - private final Cash.State inState = new Cash.State(issuedBy(DOLLARS(1000), defaultIssuer), new AnonymousParty(MEGA_CORP.getPubkey())); - private final Cash.State outState = new Cash.State(inState.getAmount(), new AnonymousParty(MINI_CORP.getPubkey())); + private final Cash.State inState = new Cash.State(issuedBy(DOLLARS(1000), defaultIssuer), new AnonymousParty(MEGA_CORP.getPublicKey())); + private final Cash.State outState = new Cash.State(inState.getAmount(), new AnonymousParty(MINI_CORP.getPublicKey())); @Rule public final SerializationEnvironmentRule testSerialization = new SerializationEnvironmentRule(); @Test public void trivial() { IdentityServiceInternal identityService = rigorousMock(IdentityServiceInternal.class); - doReturn(MEGA_CORP.getParty()).when(identityService).partyFromKey(MEGA_CORP.getPubkey()); - doReturn(MINI_CORP.getParty()).when(identityService).partyFromKey(MINI_CORP.getPubkey()); + doReturn(MEGA_CORP.getParty()).when(identityService).partyFromKey(MEGA_CORP.getPublicKey()); + doReturn(MINI_CORP.getParty()).when(identityService).partyFromKey(MINI_CORP.getPublicKey()); transaction(new MockServices(identityService, MEGA_CORP.getName()), DUMMY_NOTARY, tx -> { tx.attachment(Cash.PROGRAM_ID); tx.input(Cash.PROGRAM_ID, inState); tx.tweak(tw -> { - tw.output(Cash.PROGRAM_ID, new Cash.State(issuedBy(DOLLARS(2000), defaultIssuer), new AnonymousParty(MINI_CORP.getPubkey()))); - tw.command(MEGA_CORP.getPubkey(), new Cash.Commands.Move()); + tw.output(Cash.PROGRAM_ID, new Cash.State(issuedBy(DOLLARS(2000), defaultIssuer), new AnonymousParty(MINI_CORP.getPublicKey()))); + tw.command(MEGA_CORP.getPublicKey(), new Cash.Commands.Move()); return tw.failsWith("the amounts balance"); }); tx.tweak(tw -> { tw.output(Cash.PROGRAM_ID, outState); - tw.command(MEGA_CORP.getPubkey(), DummyCommandData.INSTANCE); + tw.command(MEGA_CORP.getPublicKey(), DummyCommandData.INSTANCE); // Invalid command return tw.failsWith("required net.corda.finance.contracts.asset.Cash.Commands.Move command"); }); tx.tweak(tw -> { tw.output(Cash.PROGRAM_ID, outState); - tw.command(MINI_CORP.getPubkey(), new Cash.Commands.Move()); + tw.command(MINI_CORP.getPublicKey(), new Cash.Commands.Move()); return tw.failsWith("the owning keys are a subset of the signing keys"); }); tx.tweak(tw -> { @@ -64,14 +64,14 @@ public class CashTestsJava { // issuedBy() can't be directly imported because it conflicts with other identically named functions // with different overloads (for some reason). tw.output(Cash.PROGRAM_ID, outState.issuedBy(MINI_CORP.getParty())); - tw.command(MEGA_CORP.getPubkey(), new Cash.Commands.Move()); + tw.command(MEGA_CORP.getPublicKey(), new Cash.Commands.Move()); return tw.failsWith("at least one cash input"); }); // Simple reallocation works. return tx.tweak(tw -> { tw.output(Cash.PROGRAM_ID, outState); - tw.command(MEGA_CORP.getPubkey(), new Cash.Commands.Move()); + tw.command(MEGA_CORP.getPublicKey(), new Cash.Commands.Move()); return tw.verifies(); }); }); diff --git a/finance/src/test/kotlin/net/corda/finance/contracts/CommercialPaperTests.kt b/finance/src/test/kotlin/net/corda/finance/contracts/CommercialPaperTests.kt index 71ae00d507..dde66f4216 100644 --- a/finance/src/test/kotlin/net/corda/finance/contracts/CommercialPaperTests.kt +++ b/finance/src/test/kotlin/net/corda/finance/contracts/CommercialPaperTests.kt @@ -46,7 +46,7 @@ interface ICommercialPaperTestTemplate { private val megaCorp = TestIdentity(CordaX500Name("MegaCorp", "London", "GB")) private val MEGA_CORP get() = megaCorp.party private val MEGA_CORP_IDENTITY get() = megaCorp.identity -private val MEGA_CORP_PUBKEY get() = megaCorp.pubkey +private val MEGA_CORP_PUBKEY get() = megaCorp.publicKey class JavaCommercialPaperTest : ICommercialPaperTestTemplate { override fun getPaper(): ICommercialPaperState = JavaCommercialPaper.State( @@ -105,13 +105,13 @@ class CommercialPaperTestsGeneric { private val dummyNotary = TestIdentity(DUMMY_NOTARY_NAME, 20) private val miniCorp = TestIdentity(CordaX500Name("MiniCorp", "London", "GB")) private val ALICE get() = alice.party - private val ALICE_KEY get() = alice.key - private val ALICE_PUBKEY get() = alice.pubkey + private val ALICE_KEY get() = alice.keyPair + private val ALICE_PUBKEY get() = alice.publicKey private val DUMMY_NOTARY get() = dummyNotary.party private val DUMMY_NOTARY_IDENTITY get() = dummyNotary.identity private val MINI_CORP get() = miniCorp.party private val MINI_CORP_IDENTITY get() = miniCorp.identity - private val MINI_CORP_PUBKEY get() = miniCorp.pubkey + private val MINI_CORP_PUBKEY get() = miniCorp.publicKey } @Parameterized.Parameter @@ -260,8 +260,8 @@ class CommercialPaperTestsGeneric { private lateinit var aliceServices: MockServices private lateinit var aliceVaultService: VaultService private lateinit var alicesVault: Vault - private val notaryServices = MockServices(rigorousMock(), MEGA_CORP.name, dummyNotary.key) - private val issuerServices = MockServices(listOf("net.corda.finance.contracts"), rigorousMock(), MEGA_CORP.name, dummyCashIssuer.key) + private val notaryServices = MockServices(rigorousMock(), MEGA_CORP.name, dummyNotary.keyPair) + private val issuerServices = MockServices(listOf("net.corda.finance.contracts"), rigorousMock(), MEGA_CORP.name, dummyCashIssuer.keyPair) private lateinit var moveTX: SignedTransaction @Test fun `issue move and then redeem`() { diff --git a/finance/src/test/kotlin/net/corda/finance/contracts/asset/CashTests.kt b/finance/src/test/kotlin/net/corda/finance/contracts/asset/CashTests.kt index 760aab4aea..e085602d45 100644 --- a/finance/src/test/kotlin/net/corda/finance/contracts/asset/CashTests.kt +++ b/finance/src/test/kotlin/net/corda/finance/contracts/asset/CashTests.kt @@ -37,27 +37,27 @@ import kotlin.test.* class CashTests { private companion object { val alice = TestIdentity(ALICE_NAME, 70) - val BOB_PUBKEY = TestIdentity(BOB_NAME, 80).pubkey + val BOB_PUBKEY = TestIdentity(BOB_NAME, 80).publicKey val charlie = TestIdentity(CHARLIE_NAME, 90) val DUMMY_CASH_ISSUER_IDENTITY = TestIdentity(CordaX500Name("Snake Oil Issuer", "London", "GB"), 10).identity val dummyNotary = TestIdentity(DUMMY_NOTARY_NAME, 20) val megaCorp = TestIdentity(CordaX500Name("MegaCorp", "London", "GB")) val miniCorp = TestIdentity(CordaX500Name("MiniCorp", "London", "GB")) val ALICE get() = alice.party - val ALICE_PUBKEY get() = alice.pubkey + val ALICE_PUBKEY get() = alice.publicKey val CHARLIE get() = charlie.party val CHARLIE_IDENTITY get() = charlie.identity val DUMMY_NOTARY get() = dummyNotary.party val DUMMY_NOTARY_IDENTITY get() = dummyNotary.identity - val DUMMY_NOTARY_KEY get() = dummyNotary.key + val DUMMY_NOTARY_KEY get() = dummyNotary.keyPair val MEGA_CORP get() = megaCorp.party val MEGA_CORP_IDENTITY get() = megaCorp.identity - val MEGA_CORP_KEY get() = megaCorp.key - val MEGA_CORP_PUBKEY get() = megaCorp.pubkey + val MEGA_CORP_KEY get() = megaCorp.keyPair + val MEGA_CORP_PUBKEY get() = megaCorp.publicKey val MINI_CORP get() = miniCorp.party val MINI_CORP_IDENTITY get() = miniCorp.identity - val MINI_CORP_KEY get() = miniCorp.key - val MINI_CORP_PUBKEY get() = miniCorp.pubkey + val MINI_CORP_KEY get() = miniCorp.keyPair + val MINI_CORP_PUBKEY get() = miniCorp.publicKey } @Rule diff --git a/finance/src/test/kotlin/net/corda/finance/contracts/asset/ObligationTests.kt b/finance/src/test/kotlin/net/corda/finance/contracts/asset/ObligationTests.kt index 2670b0674f..1677955b79 100644 --- a/finance/src/test/kotlin/net/corda/finance/contracts/asset/ObligationTests.kt +++ b/finance/src/test/kotlin/net/corda/finance/contracts/asset/ObligationTests.kt @@ -45,14 +45,14 @@ class ObligationTests { val megaCorp = TestIdentity(CordaX500Name("MegaCorp", "London", "GB")) val miniCorp = TestIdentity(CordaX500Name("MiniCorp", "London", "GB")) val ALICE get() = alice.party - val ALICE_PUBKEY get() = alice.pubkey + val ALICE_PUBKEY get() = alice.publicKey val BOB get() = bob.party - val BOB_PUBKEY get() = bob.pubkey + val BOB_PUBKEY get() = bob.publicKey val DUMMY_NOTARY get() = dummyNotary.party val MEGA_CORP get() = megaCorp.party - val MEGA_CORP_PUBKEY get() = megaCorp.pubkey + val MEGA_CORP_PUBKEY get() = megaCorp.publicKey val MINI_CORP get() = miniCorp.party - val MINI_CORP_PUBKEY get() = miniCorp.pubkey + val MINI_CORP_PUBKEY get() = miniCorp.publicKey } @Rule @@ -77,7 +77,7 @@ class ObligationTests { ) private val outState = inState.copy(beneficiary = AnonymousParty(BOB_PUBKEY)) private val miniCorpServices = MockServices(listOf("net.corda.finance.contracts.asset"), rigorousMock(), miniCorp) - private val notaryServices = MockServices(rigorousMock(), MEGA_CORP.name, dummyNotary.key) + private val notaryServices = MockServices(rigorousMock(), MEGA_CORP.name, dummyNotary.keyPair) private val identityService = rigorousMock().also { doReturn(null).whenever(it).partyFromKey(ALICE_PUBKEY) doReturn(null).whenever(it).partyFromKey(BOB_PUBKEY) diff --git a/node-api/src/test/kotlin/net/corda/nodeapi/internal/crypto/X509UtilitiesTest.kt b/node-api/src/test/kotlin/net/corda/nodeapi/internal/crypto/X509UtilitiesTest.kt index 30c8004659..8435ff5791 100644 --- a/node-api/src/test/kotlin/net/corda/nodeapi/internal/crypto/X509UtilitiesTest.kt +++ b/node-api/src/test/kotlin/net/corda/nodeapi/internal/crypto/X509UtilitiesTest.kt @@ -51,7 +51,7 @@ class X509UtilitiesTest { val bob = TestIdentity(BOB_NAME, 80) val MEGA_CORP = TestIdentity(CordaX500Name("MegaCorp", "London", "GB")).party val BOB get() = bob.party - val BOB_PUBKEY get() = bob.pubkey + val BOB_PUBKEY get() = bob.publicKey } @Rule diff --git a/node-api/src/test/kotlin/net/corda/nodeapi/internal/serialization/KryoTests.kt b/node-api/src/test/kotlin/net/corda/nodeapi/internal/serialization/KryoTests.kt index 508a40f7c6..d48558a6fe 100644 --- a/node-api/src/test/kotlin/net/corda/nodeapi/internal/serialization/KryoTests.kt +++ b/node-api/src/test/kotlin/net/corda/nodeapi/internal/serialization/KryoTests.kt @@ -33,7 +33,7 @@ import kotlin.test.assertTrue class KryoTests { companion object { - private val ALICE_PUBKEY = TestIdentity(ALICE_NAME, 70).pubkey + private val ALICE_PUBKEY = TestIdentity(ALICE_NAME, 70).publicKey } @Rule diff --git a/node-api/src/test/kotlin/net/corda/nodeapi/internal/serialization/amqp/SerializationOutputTests.kt b/node-api/src/test/kotlin/net/corda/nodeapi/internal/serialization/amqp/SerializationOutputTests.kt index 68bc1a5786..a3af4c26ce 100644 --- a/node-api/src/test/kotlin/net/corda/nodeapi/internal/serialization/amqp/SerializationOutputTests.kt +++ b/node-api/src/test/kotlin/net/corda/nodeapi/internal/serialization/amqp/SerializationOutputTests.kt @@ -49,9 +49,9 @@ class SerializationOutputTests { val megaCorp = TestIdentity(CordaX500Name("MegaCorp", "London", "GB")) val miniCorp = TestIdentity(CordaX500Name("MiniCorp", "London", "GB")) val MEGA_CORP get() = megaCorp.party - val MEGA_CORP_PUBKEY get() = megaCorp.pubkey + val MEGA_CORP_PUBKEY get() = megaCorp.publicKey val MINI_CORP get() = miniCorp.party - val MINI_CORP_PUBKEY get() = miniCorp.pubkey + val MINI_CORP_PUBKEY get() = miniCorp.publicKey } data class Foo(val bar: String, val pub: Int) diff --git a/node/src/integration-test/kotlin/net/corda/node/services/network/NodeInfoWatcherTest.kt b/node/src/integration-test/kotlin/net/corda/node/services/network/NodeInfoWatcherTest.kt index 8977afda78..ba071c1fa1 100644 --- a/node/src/integration-test/kotlin/net/corda/node/services/network/NodeInfoWatcherTest.kt +++ b/node/src/integration-test/kotlin/net/corda/node/services/network/NodeInfoWatcherTest.kt @@ -49,7 +49,7 @@ class NodeInfoWatcherTest { @Before fun start() { val identityService = makeTestIdentityService() - keyManagementService = MockKeyManagementService(identityService, alice.key) + keyManagementService = MockKeyManagementService(identityService, alice.keyPair) nodeInfoWatcher = NodeInfoWatcher(tempFolder.root.toPath(), scheduler) nodeInfoPath = tempFolder.root.toPath() / CordformNode.NODE_INFO_DIRECTORY } diff --git a/node/src/test/java/net/corda/node/services/vault/VaultQueryJavaTests.java b/node/src/test/java/net/corda/node/services/vault/VaultQueryJavaTests.java index b71fc7db16..f6fa7aa18a 100644 --- a/node/src/test/java/net/corda/node/services/vault/VaultQueryJavaTests.java +++ b/node/src/test/java/net/corda/node/services/vault/VaultQueryJavaTests.java @@ -72,11 +72,11 @@ public class VaultQueryJavaTests { List cordappPackages = Arrays.asList("net.corda.testing.contracts", "net.corda.finance.contracts.asset", CashSchemaV1.class.getPackage().getName()); IdentityServiceInternal identitySvc = makeTestIdentityService(Arrays.asList(MEGA_CORP.getIdentity(), DUMMY_CASH_ISSUER_INFO.getIdentity(), DUMMY_NOTARY.getIdentity())); Pair databaseAndServices = makeTestDatabaseAndMockServices( - Arrays.asList(MEGA_CORP.getKey(), DUMMY_NOTARY.getKey()), + Arrays.asList(MEGA_CORP.getKeyPair(), DUMMY_NOTARY.getKeyPair()), identitySvc, cordappPackages, MEGA_CORP.getName()); - issuerServices = new MockServices(cordappPackages, rigorousMock(IdentityServiceInternal.class), DUMMY_CASH_ISSUER_INFO, BOC.getKey()); + issuerServices = new MockServices(cordappPackages, rigorousMock(IdentityServiceInternal.class), DUMMY_CASH_ISSUER_INFO, BOC.getKeyPair()); database = databaseAndServices.getFirst(); MockServices services = databaseAndServices.getSecond(); vaultFiller = new VaultFiller(services, DUMMY_NOTARY); @@ -466,16 +466,16 @@ public class VaultQueryJavaTests { assertThat(results.getOtherResults()).hasSize(12); assertThat(results.getOtherResults().get(0)).isEqualTo(400L); - assertThat(results.getOtherResults().get(1)).isEqualTo(CryptoUtils.toStringShort(BOC.getPubkey())); + assertThat(results.getOtherResults().get(1)).isEqualTo(CryptoUtils.toStringShort(BOC.getPublicKey())); assertThat(results.getOtherResults().get(2)).isEqualTo("GBP"); assertThat(results.getOtherResults().get(3)).isEqualTo(300L); - assertThat(results.getOtherResults().get(4)).isEqualTo(CryptoUtils.toStringShort(DUMMY_CASH_ISSUER_INFO.getPubkey())); + assertThat(results.getOtherResults().get(4)).isEqualTo(CryptoUtils.toStringShort(DUMMY_CASH_ISSUER_INFO.getPublicKey())); assertThat(results.getOtherResults().get(5)).isEqualTo("GBP"); assertThat(results.getOtherResults().get(6)).isEqualTo(200L); - assertThat(results.getOtherResults().get(7)).isEqualTo(CryptoUtils.toStringShort(BOC.getPubkey())); + assertThat(results.getOtherResults().get(7)).isEqualTo(CryptoUtils.toStringShort(BOC.getPublicKey())); assertThat(results.getOtherResults().get(8)).isEqualTo("USD"); assertThat(results.getOtherResults().get(9)).isEqualTo(100L); - assertThat(results.getOtherResults().get(10)).isEqualTo(CryptoUtils.toStringShort(DUMMY_CASH_ISSUER_INFO.getPubkey())); + assertThat(results.getOtherResults().get(10)).isEqualTo(CryptoUtils.toStringShort(DUMMY_CASH_ISSUER_INFO.getPublicKey())); assertThat(results.getOtherResults().get(11)).isEqualTo("USD"); } catch (NoSuchFieldException e) { diff --git a/node/src/test/kotlin/net/corda/node/services/events/NodeSchedulerServiceTest.kt b/node/src/test/kotlin/net/corda/node/services/events/NodeSchedulerServiceTest.kt index 7908665021..4ae3dc09ad 100644 --- a/node/src/test/kotlin/net/corda/node/services/events/NodeSchedulerServiceTest.kt +++ b/node/src/test/kotlin/net/corda/node/services/events/NodeSchedulerServiceTest.kt @@ -52,7 +52,7 @@ import kotlin.test.assertTrue class NodeSchedulerServiceTest : SingletonSerializeAsToken() { private companion object { - val ALICE_KEY = TestIdentity(ALICE_NAME, 70).key + val ALICE_KEY = TestIdentity(ALICE_NAME, 70).keyPair val DUMMY_IDENTITY_1 = getTestPartyAndCertificate(Party(CordaX500Name("Dummy", "Madrid", "ES"), generateKeyPair().public)) val DUMMY_NOTARY = TestIdentity(DUMMY_NOTARY_NAME, 20).party val myInfo = NodeInfo(listOf(NetworkHostAndPort("mockHost", 30000)), listOf(DUMMY_IDENTITY_1), 1, serial = 1L) diff --git a/node/src/test/kotlin/net/corda/node/services/identity/InMemoryIdentityServiceTests.kt b/node/src/test/kotlin/net/corda/node/services/identity/InMemoryIdentityServiceTests.kt index 46a5dc9db0..d7c4fa8bbc 100644 --- a/node/src/test/kotlin/net/corda/node/services/identity/InMemoryIdentityServiceTests.kt +++ b/node/src/test/kotlin/net/corda/node/services/identity/InMemoryIdentityServiceTests.kt @@ -27,10 +27,10 @@ class InMemoryIdentityServiceTests { val bob = TestIdentity(BOB_NAME, 80) val ALICE get() = alice.party val ALICE_IDENTITY get() = alice.identity - val ALICE_PUBKEY get() = alice.pubkey + val ALICE_PUBKEY get() = alice.publicKey val BOB get() = bob.party val BOB_IDENTITY get() = bob.identity - val BOB_PUBKEY get() = bob.pubkey + val BOB_PUBKEY get() = bob.publicKey fun createService(vararg identities: PartyAndCertificate) = InMemoryIdentityService(identities.toSet(), DEV_TRUST_ROOT) } diff --git a/node/src/test/kotlin/net/corda/node/services/identity/PersistentIdentityServiceTests.kt b/node/src/test/kotlin/net/corda/node/services/identity/PersistentIdentityServiceTests.kt index 9b50b7f5b0..46dc9b5f50 100644 --- a/node/src/test/kotlin/net/corda/node/services/identity/PersistentIdentityServiceTests.kt +++ b/node/src/test/kotlin/net/corda/node/services/identity/PersistentIdentityServiceTests.kt @@ -35,10 +35,10 @@ class PersistentIdentityServiceTests { val bob = TestIdentity(BOB_NAME, 80) val ALICE get() = alice.party val ALICE_IDENTITY get() = alice.identity - val ALICE_PUBKEY get() = alice.pubkey + val ALICE_PUBKEY get() = alice.publicKey val BOB get() = bob.party val BOB_IDENTITY get() = bob.identity - val BOB_PUBKEY get() = bob.pubkey + val BOB_PUBKEY get() = bob.publicKey } private lateinit var database: CordaPersistence diff --git a/node/src/test/kotlin/net/corda/node/services/persistence/DBTransactionStorageTests.kt b/node/src/test/kotlin/net/corda/node/services/persistence/DBTransactionStorageTests.kt index e495f12f72..7defd484ab 100644 --- a/node/src/test/kotlin/net/corda/node/services/persistence/DBTransactionStorageTests.kt +++ b/node/src/test/kotlin/net/corda/node/services/persistence/DBTransactionStorageTests.kt @@ -24,7 +24,7 @@ import kotlin.test.assertEquals class DBTransactionStorageTests { private companion object { - val ALICE_PUBKEY = TestIdentity(ALICE_NAME, 70).pubkey + val ALICE_PUBKEY = TestIdentity(ALICE_NAME, 70).publicKey val DUMMY_NOTARY = TestIdentity(DUMMY_NOTARY_NAME, 20).party } diff --git a/node/src/test/kotlin/net/corda/node/services/persistence/HibernateConfigurationTest.kt b/node/src/test/kotlin/net/corda/node/services/persistence/HibernateConfigurationTest.kt index e323c98851..2d144d4520 100644 --- a/node/src/test/kotlin/net/corda/node/services/persistence/HibernateConfigurationTest.kt +++ b/node/src/test/kotlin/net/corda/node/services/persistence/HibernateConfigurationTest.kt @@ -61,7 +61,7 @@ class HibernateConfigurationTest { val dummyCashIssuer = TestIdentity(CordaX500Name("Snake Oil Issuer", "London", "GB"), 10) val dummyNotary = TestIdentity(DUMMY_NOTARY_NAME, 20) val BOC get() = bankOfCorda.party - val BOC_KEY get() = bankOfCorda.key + val BOC_KEY get() = bankOfCorda.keyPair } @Rule @@ -112,7 +112,7 @@ class HibernateConfigurationTest { // `consumeCash` expects we can self-notarise transactions services = object : MockServices(cordappPackages, rigorousMock().also { doNothing().whenever(it).justVerifyAndRegisterIdentity(argThat { name == BOB_NAME }) - }, BOB_NAME, generateKeyPair(), dummyNotary.key) { + }, BOB_NAME, generateKeyPair(), dummyNotary.keyPair) { override val vaultService = makeVaultService(database.hibernateConfig, schemaService) override fun recordTransactions(statesToRecord: StatesToRecord, txs: Iterable) { for (stx in txs) { diff --git a/node/src/test/kotlin/net/corda/node/services/vault/NodeVaultServiceTest.kt b/node/src/test/kotlin/net/corda/node/services/vault/NodeVaultServiceTest.kt index 0a281f0713..a8f24d73cc 100644 --- a/node/src/test/kotlin/net/corda/node/services/vault/NodeVaultServiceTest.kt +++ b/node/src/test/kotlin/net/corda/node/services/vault/NodeVaultServiceTest.kt @@ -64,8 +64,8 @@ class NodeVaultServiceTest { val DUMMY_NOTARY get() = dummyNotary.party val DUMMY_NOTARY_IDENTITY get() = dummyNotary.identity val MEGA_CORP get() = megaCorp.party - val MEGA_CORP_KEY get() = megaCorp.key - val MEGA_CORP_PUBKEY get() = megaCorp.pubkey + val MEGA_CORP_KEY get() = megaCorp.keyPair + val MEGA_CORP_PUBKEY get() = megaCorp.publicKey val MEGA_CORP_IDENTITY get() = megaCorp.identity val MINI_CORP get() = miniCorp.party val MINI_CORP_IDENTITY get() = miniCorp.identity diff --git a/node/src/test/kotlin/net/corda/node/services/vault/VaultQueryTests.kt b/node/src/test/kotlin/net/corda/node/services/vault/VaultQueryTests.kt index c27667d52b..19ccd230bb 100644 --- a/node/src/test/kotlin/net/corda/node/services/vault/VaultQueryTests.kt +++ b/node/src/test/kotlin/net/corda/node/services/vault/VaultQueryTests.kt @@ -64,17 +64,17 @@ class VaultQueryTests { val BOB_IDENTITY get() = bob.identity val BOC get() = bankOfCorda.party val BOC_IDENTITY get() = bankOfCorda.identity - val BOC_KEY get() = bankOfCorda.key - val BOC_PUBKEY get() = bankOfCorda.pubkey + val BOC_KEY get() = bankOfCorda.keyPair + val BOC_PUBKEY get() = bankOfCorda.publicKey val CASH_NOTARY get() = cashNotary.party val CASH_NOTARY_IDENTITY get() = cashNotary.identity val CHARLIE get() = charlie.party val CHARLIE_IDENTITY get() = charlie.identity val DUMMY_NOTARY get() = dummyNotary.party - val DUMMY_NOTARY_KEY get() = dummyNotary.key + val DUMMY_NOTARY_KEY get() = dummyNotary.keyPair val MEGA_CORP_IDENTITY get() = megaCorp.identity - val MEGA_CORP_PUBKEY get() = megaCorp.pubkey - val MEGA_CORP_KEY get() = megaCorp.key + val MEGA_CORP_PUBKEY get() = megaCorp.publicKey + val MEGA_CORP_KEY get() = megaCorp.keyPair val MEGA_CORP get() = megaCorp.party val MINI_CORP_IDENTITY get() = miniCorp.identity val MINI_CORP get() = miniCorp.party @@ -112,7 +112,7 @@ class VaultQueryTests { services = databaseAndServices.second vaultFiller = VaultFiller(services, dummyNotary) vaultFillerCashNotary = VaultFiller(services, dummyNotary, CASH_NOTARY) - notaryServices = MockServices(cordappPackages, rigorousMock(), dummyNotary, dummyCashIssuer.key, BOC_KEY, MEGA_CORP_KEY) + notaryServices = MockServices(cordappPackages, rigorousMock(), dummyNotary, dummyCashIssuer.keyPair, BOC_KEY, MEGA_CORP_KEY) identitySvc = services.identityService // Register all of the identities we're going to use (notaryServices.myInfo.legalIdentitiesAndCerts + BOC_IDENTITY + CASH_NOTARY_IDENTITY + MINI_CORP_IDENTITY + MEGA_CORP_IDENTITY).forEach { identity -> diff --git a/node/src/test/kotlin/net/corda/node/services/vault/VaultWithCashTest.kt b/node/src/test/kotlin/net/corda/node/services/vault/VaultWithCashTest.kt index 34ef9e5203..4e1269fc14 100644 --- a/node/src/test/kotlin/net/corda/node/services/vault/VaultWithCashTest.kt +++ b/node/src/test/kotlin/net/corda/node/services/vault/VaultWithCashTest.kt @@ -49,7 +49,7 @@ class VaultWithCashTest { val DUMMY_NOTARY get() = dummyNotary.party val MEGA_CORP get() = megaCorp.party val MEGA_CORP_IDENTITY get() = megaCorp.identity - val MEGA_CORP_KEY get() = megaCorp.key + val MEGA_CORP_KEY get() = megaCorp.keyPair val MINI_CORP_IDENTITY get() = miniCorp.identity } @@ -68,7 +68,7 @@ class VaultWithCashTest { fun setUp() { LogHelper.setLevel(VaultWithCashTest::class) val databaseAndServices = makeTestDatabaseAndMockServices( - listOf(generateKeyPair(), dummyNotary.key), + listOf(generateKeyPair(), dummyNotary.keyPair), makeTestIdentityService(listOf(MEGA_CORP_IDENTITY, MINI_CORP_IDENTITY, dummyCashIssuer.identity, dummyNotary.identity)), cordappPackages, MEGA_CORP.name) diff --git a/samples/irs-demo/cordapp/src/test/kotlin/net/corda/irs/api/NodeInterestRatesTest.kt b/samples/irs-demo/cordapp/src/test/kotlin/net/corda/irs/api/NodeInterestRatesTest.kt index 11d6e8ac1b..3c8b0192f3 100644 --- a/samples/irs-demo/cordapp/src/test/kotlin/net/corda/irs/api/NodeInterestRatesTest.kt +++ b/samples/irs-demo/cordapp/src/test/kotlin/net/corda/irs/api/NodeInterestRatesTest.kt @@ -38,7 +38,7 @@ class NodeInterestRatesTest { val DUMMY_NOTARY = TestIdentity(DUMMY_NOTARY_NAME, 20).party val MEGA_CORP_KEY = generateKeyPair() val ALICE get() = alice.party - val ALICE_PUBKEY get() = alice.pubkey + val ALICE_PUBKEY get() = alice.publicKey } @Rule diff --git a/samples/irs-demo/cordapp/src/test/kotlin/net/corda/irs/contract/IRSTests.kt b/samples/irs-demo/cordapp/src/test/kotlin/net/corda/irs/contract/IRSTests.kt index 262681c0c6..6615d5f7c0 100644 --- a/samples/irs-demo/cordapp/src/test/kotlin/net/corda/irs/contract/IRSTests.kt +++ b/samples/irs-demo/cordapp/src/test/kotlin/net/corda/irs/contract/IRSTests.kt @@ -39,14 +39,14 @@ private val DUMMY_PARTY = Party(CordaX500Name("Dummy", "Madrid", "ES"), generate private val dummyNotary = TestIdentity(DUMMY_NOTARY_NAME, 20) private val megaCorp = TestIdentity(CordaX500Name("MegaCorp", "London", "GB")) private val miniCorp = TestIdentity(CordaX500Name("MiniCorp", "London", "GB")) -private val ORACLE_PUBKEY = TestIdentity(CordaX500Name("Oracle", "London", "GB")).pubkey +private val ORACLE_PUBKEY = TestIdentity(CordaX500Name("Oracle", "London", "GB")).publicKey private val DUMMY_NOTARY get() = dummyNotary.party -private val DUMMY_NOTARY_KEY get() = dummyNotary.key +private val DUMMY_NOTARY_KEY get() = dummyNotary.keyPair private val MEGA_CORP get() = megaCorp.party -private val MEGA_CORP_KEY get() = megaCorp.key -private val MEGA_CORP_PUBKEY get() = megaCorp.pubkey +private val MEGA_CORP_KEY get() = megaCorp.keyPair +private val MEGA_CORP_PUBKEY get() = megaCorp.publicKey private val MINI_CORP get() = miniCorp.party -private val MINI_CORP_KEY get() = miniCorp.key +private val MINI_CORP_KEY get() = miniCorp.keyPair fun createDummyIRS(irsSelect: Int): InterestRateSwap.State { return when (irsSelect) { 1 -> { diff --git a/samples/trader-demo/src/test/kotlin/net/corda/traderdemo/TransactionGraphSearchTests.kt b/samples/trader-demo/src/test/kotlin/net/corda/traderdemo/TransactionGraphSearchTests.kt index 7f73c6f306..eff4a70136 100644 --- a/samples/trader-demo/src/test/kotlin/net/corda/traderdemo/TransactionGraphSearchTests.kt +++ b/samples/trader-demo/src/test/kotlin/net/corda/traderdemo/TransactionGraphSearchTests.kt @@ -46,13 +46,13 @@ class TransactionGraphSearchTests { val notaryServices = MockServices(listOf("net.corda.testing.contracts"), rigorousMock(), dummyNotary) val originBuilder = TransactionBuilder(dummyNotary.party) .addOutputState(DummyState(random31BitValue()), DummyContract.PROGRAM_ID) - .addCommand(command, megaCorp.pubkey) + .addCommand(command, megaCorp.publicKey) val originPtx = megaCorpServices.signInitialTransaction(originBuilder) val originTx = notaryServices.addSignature(originPtx) val inputBuilder = TransactionBuilder(dummyNotary.party) .addInputState(originTx.tx.outRef(0)) - .addCommand(dummyCommand(megaCorp.pubkey)) + .addCommand(dummyCommand(megaCorp.publicKey)) val inputPtx = megaCorpServices.signInitialTransaction(inputBuilder) val inputTx = megaCorpServices.addSignature(inputPtx) diff --git a/testing/node-driver/src/main/kotlin/net/corda/testing/node/MockServices.kt b/testing/node-driver/src/main/kotlin/net/corda/testing/node/MockServices.kt index f5926637ac..a49b934afd 100644 --- a/testing/node-driver/src/main/kotlin/net/corda/testing/node/MockServices.kt +++ b/testing/node-driver/src/main/kotlin/net/corda/testing/node/MockServices.kt @@ -111,7 +111,7 @@ open class MockServices private constructor( private constructor(cordappLoader: CordappLoader, identityService: IdentityServiceInternal, initialIdentityName: CordaX500Name, keys: Array) : this(cordappLoader, MockTransactionStorage(), identityService, initialIdentityName, keys) constructor(cordappPackages: List, identityService: IdentityServiceInternal, initialIdentityName: CordaX500Name, vararg keys: KeyPair) : this(CordappLoader.createWithTestPackages(cordappPackages), identityService, initialIdentityName, keys) - constructor(cordappPackages: List, identityService: IdentityServiceInternal, initialIdentity: TestIdentity, vararg moreKeys: KeyPair) : this(CordappLoader.createWithTestPackages(cordappPackages), identityService, initialIdentity.name, arrayOf(initialIdentity.key) + moreKeys) + constructor(cordappPackages: List, identityService: IdentityServiceInternal, initialIdentity: TestIdentity, vararg moreKeys: KeyPair) : this(CordappLoader.createWithTestPackages(cordappPackages), identityService, initialIdentity.name, arrayOf(initialIdentity.keyPair) + moreKeys) constructor(identityService: IdentityServiceInternal, initialIdentityName: CordaX500Name, vararg keys: KeyPair) : this(emptyList(), identityService, initialIdentityName, *keys) constructor(identityService: IdentityServiceInternal, initialIdentityName: CordaX500Name) : this(identityService, initialIdentityName, generateKeyPair()) diff --git a/testing/test-utils/src/main/kotlin/net/corda/testing/CoreTestUtils.kt b/testing/test-utils/src/main/kotlin/net/corda/testing/CoreTestUtils.kt index 5b58e65086..e0100da05d 100644 --- a/testing/test-utils/src/main/kotlin/net/corda/testing/CoreTestUtils.kt +++ b/testing/test-utils/src/main/kotlin/net/corda/testing/CoreTestUtils.kt @@ -3,6 +3,7 @@ package net.corda.testing +import net.corda.core.contracts.PartyAndReference import net.corda.core.contracts.StateRef import net.corda.core.crypto.Crypto import net.corda.core.crypto.SecureHash @@ -32,6 +33,7 @@ import org.mockito.internal.stubbing.answers.ThrowsException import java.lang.reflect.Modifier import java.math.BigInteger import java.nio.file.Files +import java.security.KeyPair import java.security.PublicKey import java.util.* import java.util.concurrent.atomic.AtomicInteger @@ -81,7 +83,7 @@ fun freePort(): Int = freePortCounter.getAndAccumulate(0) { prev, _ -> 30000 + ( */ fun getFreeLocalPorts(hostName: String, numberToAlloc: Int): List { val freePort = freePortCounter.getAndAccumulate(0) { prev, _ -> 30000 + (prev - 30000 + numberToAlloc) % 10000 } - return (freePort..freePort + numberToAlloc - 1).map { NetworkHostAndPort(hostName, it) } + return (freePort until freePort + numberToAlloc).map { NetworkHostAndPort(hostName, it) } } fun configureTestSSL(legalName: CordaX500Name): SSLConfiguration = object : SSLConfiguration { @@ -117,11 +119,11 @@ fun getTestPartyAndCertificate(name: CordaX500Name, publicKey: PublicKey): Party } class TestIdentity @JvmOverloads constructor(val name: CordaX500Name, entropy: Long? = null) { - val key = if (entropy != null) entropyToKeyPair(BigInteger.valueOf(entropy)) else generateKeyPair() - val pubkey get() = key.public!! - val party = Party(name, pubkey) - val identity by lazy { getTestPartyAndCertificate(party) } // Often not needed. - fun ref(vararg bytes: Byte) = party.ref(*bytes) + val keyPair: KeyPair = if (entropy != null) entropyToKeyPair(BigInteger.valueOf(entropy)) else generateKeyPair() + val publicKey: PublicKey get() = keyPair.public + val party: Party = Party(name, publicKey) + val identity: PartyAndCertificate by lazy { getTestPartyAndCertificate(party) } // Often not needed. + fun ref(vararg bytes: Byte): PartyAndReference = party.ref(*bytes) } @Suppress("unused") diff --git a/testing/test-utils/src/main/kotlin/net/corda/testing/contracts/VaultFiller.kt b/testing/test-utils/src/main/kotlin/net/corda/testing/contracts/VaultFiller.kt index e303cba51f..06e981c9b1 100644 --- a/testing/test-utils/src/main/kotlin/net/corda/testing/contracts/VaultFiller.kt +++ b/testing/test-utils/src/main/kotlin/net/corda/testing/contracts/VaultFiller.kt @@ -80,7 +80,7 @@ class VaultFiller @JvmOverloads constructor( addCommand(dummyCommand()) } val stx = issuerServices.signInitialTransaction(dummyIssue) - return@map services.addSignature(stx, defaultNotary.pubkey) + return@map services.addSignature(stx, defaultNotary.publicKey) } services.recordTransactions(transactions) // Get all the StateAndRefs of all the generated transactions. @@ -101,7 +101,7 @@ class VaultFiller @JvmOverloads constructor( linearTimestamp: Instant = now()): Vault { val myKey: PublicKey = services.myInfo.chooseIdentity().owningKey val me = AnonymousParty(myKey) - val issuerKey = defaultNotary.key + val issuerKey = defaultNotary.keyPair val signatureMetadata = SignatureMetadata(services.myInfo.platformVersion, Crypto.findSignatureScheme(issuerKey.public).schemeNumberID) val transactions: List = (1..numberToCreate).map { // Issue a Linear state diff --git a/tools/loadtest/src/main/kotlin/net/corda/loadtest/tests/NotaryTest.kt b/tools/loadtest/src/main/kotlin/net/corda/loadtest/tests/NotaryTest.kt index d1d500b7a2..f54970ff69 100644 --- a/tools/loadtest/src/main/kotlin/net/corda/loadtest/tests/NotaryTest.kt +++ b/tools/loadtest/src/main/kotlin/net/corda/loadtest/tests/NotaryTest.kt @@ -27,7 +27,7 @@ data class NotariseCommand(val issueTx: SignedTransaction, val moveTx: SignedTra val dummyNotarisationTest = LoadTest( "Notarising dummy transactions", generate = { _, _ -> - val issuerServices = MockServices(makeTestIdentityService(listOf(megaCorp.identity, miniCorp.identity, dummyCashIssuer.identity, dummyNotary.identity)), megaCorp.name, dummyCashIssuer.key) + val issuerServices = MockServices(makeTestIdentityService(listOf(megaCorp.identity, miniCorp.identity, dummyCashIssuer.identity, dummyNotary.identity)), megaCorp.name, dummyCashIssuer.keyPair) val generateTx = Generator.pickOne(simpleNodes).flatMap { node -> Generator.int().map { val issueBuilder = DummyContract.generateInitial(it, notary.info.legalIdentities[0], DUMMY_CASH_ISSUER) // TODO notary choice