From 79f288dcf6a008e0119c5cb02818a8ec46bb7643 Mon Sep 17 00:00:00 2001 From: josecoll Date: Mon, 18 Dec 2017 14:30:46 +0000 Subject: [PATCH] Fix compilation errors on Tests following rebase from OS. --- .../client/rpc/CordaRPCJavaClientTest.java | 2 +- .../node/services/BFTNotaryServiceTests.kt | 1 + .../services/messaging/P2PMessagingTest.kt | 5 +- .../services/vault/VaultQueryJavaTests.java | 1 + .../persistence/HibernateConfigurationTest.kt | 1 + .../persistence/RunOnceServiceTest.kt | 2 +- .../node/services/vault/VaultQueryTests.kt | 8 +--- .../contracts/CommercialPaperTests.kt | 42 +++++++++-------- .../contracts/asset/CashTests.kt | 47 +++++++++---------- .../flows/TwoPartyTradeFlowTest.kt | 9 +++- .../r3/enclaves/verify/NativeSgxApiTest.kt | 13 ++--- .../r3/enclaves/txverify/EnclaveletTest.kt | 10 ++-- 12 files changed, 75 insertions(+), 66 deletions(-) diff --git a/client/rpc/src/integration-test/java/net/corda/client/rpc/CordaRPCJavaClientTest.java b/client/rpc/src/integration-test/java/net/corda/client/rpc/CordaRPCJavaClientTest.java index 7bfc292895..c10e439c0f 100644 --- a/client/rpc/src/integration-test/java/net/corda/client/rpc/CordaRPCJavaClientTest.java +++ b/client/rpc/src/integration-test/java/net/corda/client/rpc/CordaRPCJavaClientTest.java @@ -40,7 +40,7 @@ public class CordaRPCJavaClientTest extends NodeBasedTest { } @ClassRule - public static IntegrationTestSchemas databaseSchemas = new IntegrationTestSchemas(IntegrationTestKt.toDatabaseSchemaName(getALICE_NAME()), + public static IntegrationTestSchemas databaseSchemas = new IntegrationTestSchemas(IntegrationTestKt.toDatabaseSchemaName(ALICE_NAME), IntegrationTestKt.toDatabaseSchemaName(DUMMY_NOTARY_NAME)); private List perms = Arrays.asList( diff --git a/node/src/integration-test/kotlin/net/corda/node/services/BFTNotaryServiceTests.kt b/node/src/integration-test/kotlin/net/corda/node/services/BFTNotaryServiceTests.kt index 4e6ba5d42f..e84f277e1a 100644 --- a/node/src/integration-test/kotlin/net/corda/node/services/BFTNotaryServiceTests.kt +++ b/node/src/integration-test/kotlin/net/corda/node/services/BFTNotaryServiceTests.kt @@ -32,6 +32,7 @@ import net.corda.testing.IntegrationTest import net.corda.testing.IntegrationTestSchemas import net.corda.testing.common.internal.testNetworkParameters import net.corda.testing.contracts.DummyContract +import net.corda.testing.dummyCommand import net.corda.testing.node.MockNetwork import net.corda.testing.node.MockNetwork.MockNode import net.corda.testing.node.MockNodeParameters diff --git a/node/src/integration-test/kotlin/net/corda/services/messaging/P2PMessagingTest.kt b/node/src/integration-test/kotlin/net/corda/services/messaging/P2PMessagingTest.kt index 4841d20750..5dfa2963b1 100644 --- a/node/src/integration-test/kotlin/net/corda/services/messaging/P2PMessagingTest.kt +++ b/node/src/integration-test/kotlin/net/corda/services/messaging/P2PMessagingTest.kt @@ -101,10 +101,13 @@ class P2PMessagingTest : IntegrationTest() { // Restart the node and expect a response val aliceRestarted = startAlice() - val responseFuture = openFuture() aliceRestarted.network.runOnNextMessage("test.response") { + + val responseFuture = openFuture() + aliceRestarted.network.runOnNextMessage("test.response") { responseFuture.set(it.data.deserialize()) } val response = responseFuture.getOrThrow() + assertThat(crashingNodes.requestsReceived.get()).isGreaterThan(numberOfRequestsReceived) assertThat(response).isEqualTo(responseMessage) } 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 7a5b41fcc1..5150d0883b 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 @@ -25,6 +25,7 @@ import net.corda.nodeapi.internal.persistence.DatabaseTransaction; import net.corda.testing.SerializationEnvironmentRule; import net.corda.testing.TestIdentity; import net.corda.testing.internal.vault.DummyLinearContract; +import net.corda.testing.internal.vault.DummyLinearStateSchemaV1; import net.corda.testing.internal.vault.VaultFiller; import net.corda.testing.node.MockServices; import org.junit.After; 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 7844d0e52d..dc412846a6 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 @@ -38,6 +38,7 @@ import net.corda.nodeapi.internal.persistence.DatabaseConfig import net.corda.nodeapi.internal.persistence.HibernateConfiguration import net.corda.testing.* import net.corda.testing.internal.rigorousMock +import net.corda.testing.internal.vault.DummyDealStateSchemaV1 import net.corda.testing.internal.vault.VaultFiller import net.corda.testing.node.MockServices import net.corda.testing.node.MockServices.Companion.makeTestDataSourceProperties diff --git a/node/src/test/kotlin/net/corda/node/services/persistence/RunOnceServiceTest.kt b/node/src/test/kotlin/net/corda/node/services/persistence/RunOnceServiceTest.kt index d853b9608e..05568dc4dd 100644 --- a/node/src/test/kotlin/net/corda/node/services/persistence/RunOnceServiceTest.kt +++ b/node/src/test/kotlin/net/corda/node/services/persistence/RunOnceServiceTest.kt @@ -6,9 +6,9 @@ import com.nhaarman.mockito_kotlin.verify import com.nhaarman.mockito_kotlin.whenever import net.corda.node.internal.configureDatabase import net.corda.nodeapi.internal.persistence.CordaPersistence +import net.corda.testing.internal.rigorousMock import net.corda.testing.node.MockServices.Companion.makeTestDataSourceProperties import net.corda.testing.node.MockServices.Companion.makeTestDatabaseProperties -import net.corda.testing.rigorousMock import org.junit.After import org.junit.Before import org.junit.Rule 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 1a977695eb..c5976b4bc7 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 @@ -18,23 +18,19 @@ import net.corda.finance.contracts.CommercialPaper import net.corda.finance.contracts.Commodity import net.corda.finance.contracts.DealState import net.corda.finance.contracts.asset.Cash +import net.corda.finance.sampleschemas.SampleCashSchemaV3 import net.corda.finance.schemas.CashSchemaV1 import net.corda.finance.schemas.CashSchemaV1.PersistentCashState import net.corda.finance.schemas.CommercialPaperSchemaV1 -import net.corda.finance.sampleschemas.SampleCashSchemaV3 import net.corda.node.internal.configureDatabase import net.corda.nodeapi.internal.persistence.CordaPersistence import net.corda.nodeapi.internal.persistence.DatabaseConfig import net.corda.testing.* import net.corda.testing.internal.rigorousMock -import net.corda.testing.internal.vault.DUMMY_LINEAR_CONTRACT_PROGRAM_ID -import net.corda.testing.internal.vault.DummyLinearContract -import net.corda.testing.internal.vault.VaultFiller +import net.corda.testing.internal.vault.* import net.corda.testing.node.MockServices import net.corda.testing.node.MockServices.Companion.makeTestDatabaseAndMockServices import net.corda.testing.node.makeTestIdentityService -import net.corda.testing.schemas.DummyDealStateSchemaV1 -import net.corda.testing.internal.vault.DummyLinearStateSchemaV1 import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThatThrownBy import org.junit.* diff --git a/perftestcordapp/src/test/kotlin/com/r3/corda/enterprise/perftestcordapp/contracts/CommercialPaperTests.kt b/perftestcordapp/src/test/kotlin/com/r3/corda/enterprise/perftestcordapp/contracts/CommercialPaperTests.kt index 76e81fc64b..b9f9d19a20 100644 --- a/perftestcordapp/src/test/kotlin/com/r3/corda/enterprise/perftestcordapp/contracts/CommercialPaperTests.kt +++ b/perftestcordapp/src/test/kotlin/com/r3/corda/enterprise/perftestcordapp/contracts/CommercialPaperTests.kt @@ -18,6 +18,10 @@ import net.corda.core.utilities.days import net.corda.core.utilities.seconds import net.corda.node.services.api.IdentityServiceInternal import net.corda.testing.* +import net.corda.testing.dsl.EnforceVerifyOrFail +import net.corda.testing.dsl.TransactionDSL +import net.corda.testing.dsl.TransactionDSLInterpreter +import net.corda.testing.internal.rigorousMock import net.corda.testing.node.MockServices import net.corda.testing.node.ledger import net.corda.testing.node.makeTestIdentityService @@ -44,7 +48,7 @@ interface CommercialPaperTestTemplate { 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 KotlinCommercialPaperTest : CommercialPaperTestTemplate { @@ -89,13 +93,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 } @@ -105,7 +109,7 @@ class CommercialPaperTestsGeneric { @JvmField val testSerialization = SerializationEnvironmentRule() val issuer = MEGA_CORP.ref(123) - private val ledgerServices = MockServices(rigorousMock().also { + private val ledgerServices = MockServices(emptyList(), rigorousMock().also { doReturn(MEGA_CORP).whenever(it).partyFromKey(MEGA_CORP_PUBKEY) doReturn(MINI_CORP).whenever(it).partyFromKey(MINI_CORP_PUBKEY) doReturn(null).whenever(it).partyFromKey(ALICE_PUBKEY) @@ -155,10 +159,8 @@ class CommercialPaperTestsGeneric { output(Cash.PROGRAM_ID, "Alice's profit", aliceGetsBack.STATE ownedBy ALICE) output(Cash.PROGRAM_ID, "Change", (someProfits - aliceGetsBack).STATE ownedBy MEGA_CORP) } - command(MEGA_CORP_PUBKEY, Cash.Commands.Move()) command(ALICE_PUBKEY, thisTest.getRedeemCommand(DUMMY_NOTARY)) - tweak { outputs(700.DOLLARS `issued by` issuer) timeWindow(TEST_TX_TIME + 8.days) @@ -249,17 +251,17 @@ class CommercialPaperTestsGeneric { private lateinit var aliceVaultService: VaultService private lateinit var alicesVault: Vault - private val notaryServices = MockServices(rigorousMock(), MEGA_CORP.name, dummyNotary.key) - private val issuerServices = MockServices(rigorousMock(), MEGA_CORP.name, DUMMY_CASH_ISSUER_KEY) + private val notaryServices = MockServices(emptyList(), rigorousMock(), MEGA_CORP.name, dummyNotary.keyPair) + private val issuerServices = MockServices(listOf("net.corda.finance.contracts", "net.corda.finance.schemas"), rigorousMock(), MEGA_CORP.name, dummyCashIssuer.keyPair) private lateinit var moveTX: SignedTransaction - // @Test - fun `issue move and then redeem`() = withTestSerialization{ - val aliceDatabaseAndServices = MockServices.makeTestDatabaseAndMockServices( - listOf(ALICE_KEY), - makeTestIdentityService(listOf(MEGA_CORP_IDENTITY, MINI_CORP_IDENTITY, DUMMY_CASH_ISSUER_IDENTITY, DUMMY_NOTARY_IDENTITY)), - initialIdentityName = MEGA_CORP.name) + @Test + fun `issue move and then redeem`() = { + val aliceDatabaseAndServices = MockServices.makeTestDatabaseAndMockServices( + listOf("net.corda.finance.contracts"), + makeTestIdentityService(MEGA_CORP_IDENTITY, MINI_CORP_IDENTITY, DUMMY_CASH_ISSUER_IDENTITY, DUMMY_NOTARY_IDENTITY), + TestIdentity(MEGA_CORP.name, ALICE_KEY)) val databaseAlice = aliceDatabaseAndServices.first aliceServices = aliceDatabaseAndServices.second aliceVaultService = aliceServices.vaultService @@ -270,9 +272,9 @@ class CommercialPaperTestsGeneric { } val bigCorpDatabaseAndServices = MockServices.makeTestDatabaseAndMockServices( - listOf(BIG_CORP_KEY), - makeTestIdentityService(listOf(MEGA_CORP_IDENTITY, MINI_CORP_IDENTITY, DUMMY_CASH_ISSUER_IDENTITY, DUMMY_NOTARY_IDENTITY)), - initialIdentityName = MEGA_CORP.name) + listOf("net.corda.finance.contracts"), + makeTestIdentityService(MEGA_CORP_IDENTITY, MINI_CORP_IDENTITY, DUMMY_CASH_ISSUER_IDENTITY, DUMMY_NOTARY_IDENTITY), + TestIdentity(MEGA_CORP.name, BIG_CORP_KEY)) val databaseBigCorp = bigCorpDatabaseAndServices.first bigCorpServices = bigCorpDatabaseAndServices.second bigCorpVaultService = bigCorpServices.vaultService @@ -298,8 +300,8 @@ class CommercialPaperTestsGeneric { // Alice pays $9000 to BigCorp to own some of their debt. moveTX = run { val builder = TransactionBuilder(DUMMY_NOTARY) - Cash.generateSpend(aliceServices, builder, 9000.DOLLARS, AnonymousParty(bigCorpServices.key.public)) - CommercialPaper().generateMove(builder, issueTx.tx.outRef(0), AnonymousParty(aliceServices.key.public)) + Cash.generateSpend(aliceServices, builder, 9000.DOLLARS, AnonymousParty(BIG_CORP_KEY.public)) + CommercialPaper().generateMove(builder, issueTx.tx.outRef(0), AnonymousParty(ALICE_PUBKEY)) val ptx = aliceServices.signInitialTransaction(builder) val ptx2 = bigCorpServices.addSignature(ptx) val stx = notaryServices.addSignature(ptx2) diff --git a/perftestcordapp/src/test/kotlin/com/r3/corda/enterprise/perftestcordapp/contracts/asset/CashTests.kt b/perftestcordapp/src/test/kotlin/com/r3/corda/enterprise/perftestcordapp/contracts/asset/CashTests.kt index acf6b068ce..b475c98c77 100644 --- a/perftestcordapp/src/test/kotlin/com/r3/corda/enterprise/perftestcordapp/contracts/asset/CashTests.kt +++ b/perftestcordapp/src/test/kotlin/com/r3/corda/enterprise/perftestcordapp/contracts/asset/CashTests.kt @@ -11,7 +11,6 @@ import com.r3.corda.enterprise.perftestcordapp.utils.sumCashOrNull import com.r3.corda.enterprise.perftestcordapp.utils.sumCashOrZero import net.corda.core.contracts.* import net.corda.core.crypto.SecureHash -import net.corda.core.crypto.generateKeyPair import net.corda.core.identity.AbstractParty import net.corda.core.identity.AnonymousParty import net.corda.core.identity.CordaX500Name @@ -28,6 +27,11 @@ import net.corda.node.services.vault.NodeVaultService import net.corda.nodeapi.internal.persistence.CordaPersistence import net.corda.testing.* import net.corda.testing.contracts.DummyState +import net.corda.testing.dsl.EnforceVerifyOrFail +import net.corda.testing.dsl.TransactionDSL +import net.corda.testing.dsl.TransactionDSLInterpreter +import net.corda.testing.internal.LogHelper +import net.corda.testing.internal.rigorousMock import net.corda.testing.node.MockServices import net.corda.testing.node.MockServices.Companion.makeTestDatabaseAndMockServices import net.corda.testing.node.ledger @@ -77,27 +81,27 @@ fun ServiceHub.fillWithSomeTestCash(howMuch: Amount, 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 @@ -133,22 +137,15 @@ class CashTests { @Before fun setUp() { LogHelper.setLevel(NodeVaultService::class) - megaCorpServices = MockServices( - listOf("com.r3.corda.enterprise.perftestcordapp.contracts.asset", "com.r3.corda.enterprise.perftestcordapp.schemas"), - rigorousMock(), MEGA_CORP.name, MEGA_CORP_KEY) - miniCorpServices = MockServices( - listOf("com.r3.corda.enterprise.perftestcordapp.contracts.asset", "com.r3.corda.enterprise.perftestcordapp.schemas"), - rigorousMock().also { - doNothing().whenever(it).justVerifyAndRegisterIdentity(argThat { name == MINI_CORP.name }) - }, MINI_CORP.name, MINI_CORP_KEY) - val notaryServices = MockServices( - listOf("com.r3.corda.enterprise.perftestcordapp.contracts.asset", "com.r3.corda.enterprise.perftestcordapp.schemas"), - rigorousMock(), DUMMY_NOTARY.name, DUMMY_NOTARY_KEY) + megaCorpServices = MockServices(listOf("net.corda.finance.contracts.asset", "net.corda.finance.schemas"), rigorousMock(), MEGA_CORP.name, MEGA_CORP_KEY) + miniCorpServices = MockServices(listOf("net.corda.finance.contracts.asset", "net.corda.finance.schemas"), rigorousMock().also { + doNothing().whenever(it).justVerifyAndRegisterIdentity(argThat { name == MINI_CORP.name }) + }, MINI_CORP.name, MINI_CORP_KEY) + val notaryServices = MockServices(listOf("net.corda.finance.contracts.asset"), rigorousMock(), DUMMY_NOTARY.name, DUMMY_NOTARY_KEY) val databaseAndServices = makeTestDatabaseAndMockServices( - cordappPackages = listOf("com.r3.corda.enterprise.perftestcordapp.contracts.asset", "com.r3.corda.enterprise.perftestcordapp.schemas"), - initialIdentityName = CordaX500Name(organisation = "Me", locality = "London", country = "GB"), - keys = listOf(generateKeyPair()), - identityService = makeTestIdentityService(listOf(MEGA_CORP_IDENTITY, MINI_CORP_IDENTITY, DUMMY_CASH_ISSUER_IDENTITY, DUMMY_NOTARY_IDENTITY))) + listOf("net.corda.finance.contracts.asset"), + makeTestIdentityService(MEGA_CORP_IDENTITY, MINI_CORP_IDENTITY, DUMMY_CASH_ISSUER_IDENTITY, DUMMY_NOTARY_IDENTITY), + TestIdentity(CordaX500Name("Me", "London", "GB"))) database = databaseAndServices.first ourServices = databaseAndServices.second @@ -184,7 +181,7 @@ class CashTests { } private fun transaction(script: TransactionDSL.() -> EnforceVerifyOrFail) = run { - MockServices(rigorousMock().also { + MockServices(emptyList(), rigorousMock().also { doReturn(MEGA_CORP).whenever(it).partyFromKey(MEGA_CORP_PUBKEY) doReturn(MINI_CORP).whenever(it).partyFromKey(MINI_CORP_PUBKEY) doReturn(null).whenever(it).partyFromKey(ALICE_PUBKEY) @@ -882,7 +879,7 @@ class CashTests { transaction { attachment(Cash.PROGRAM_ID) input("MEGA_CORP cash") - // We send it to another pubkey so that the transaction is not identical to the previous one + // We send it to another publicKey so that the transaction is not identical to the previous one output(Cash.PROGRAM_ID, "MEGA_CORP cash 3", "MEGA_CORP cash".output().copy(owner = ALICE)) command(MEGA_CORP_PUBKEY, Cash.Commands.Move()) this.verifies() diff --git a/perftestcordapp/src/test/kotlin/com/r3/corda/enterprise/perftestcordapp/flows/TwoPartyTradeFlowTest.kt b/perftestcordapp/src/test/kotlin/com/r3/corda/enterprise/perftestcordapp/flows/TwoPartyTradeFlowTest.kt index 1ddfe67308..dbaaaab191 100644 --- a/perftestcordapp/src/test/kotlin/com/r3/corda/enterprise/perftestcordapp/flows/TwoPartyTradeFlowTest.kt +++ b/perftestcordapp/src/test/kotlin/com/r3/corda/enterprise/perftestcordapp/flows/TwoPartyTradeFlowTest.kt @@ -47,6 +47,12 @@ import net.corda.node.services.persistence.DBTransactionStorage import net.corda.node.services.statemachine.Checkpoint import net.corda.nodeapi.internal.persistence.CordaPersistence import net.corda.testing.* +import net.corda.testing.dsl.LedgerDSL +import net.corda.testing.dsl.TestLedgerDSLInterpreter +import net.corda.testing.dsl.TestTransactionDSLInterpreter +import net.corda.testing.internal.LogHelper +import net.corda.testing.internal.rigorousMock +import net.corda.testing.internal.vault.VaultFiller import net.corda.testing.node.* import org.assertj.core.api.Assertions.assertThat import org.junit.After @@ -127,8 +133,7 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) { bobNode.internals.disableDBCloseOnStop() bobNode.database.transaction { - bobNode.services.fillWithSomeTestCash(2000.DOLLARS, bankNode.services, outputNotary = notary, - issuedBy = cashIssuer) + VaultFiller(bobNode.services, dummyNotary, notary, ::Random).fillWithSomeTestCash(2000.DOLLARS, bankNode.services, 3, 10, cashIssuer) } val alicesFakePaper = aliceNode.database.transaction { diff --git a/verify-enclave/src/integration-test/kotlin/com/r3/enclaves/verify/NativeSgxApiTest.kt b/verify-enclave/src/integration-test/kotlin/com/r3/enclaves/verify/NativeSgxApiTest.kt index 198fe59fbe..81699c31a9 100644 --- a/verify-enclave/src/integration-test/kotlin/com/r3/enclaves/verify/NativeSgxApiTest.kt +++ b/verify-enclave/src/integration-test/kotlin/com/r3/enclaves/verify/NativeSgxApiTest.kt @@ -17,9 +17,9 @@ import net.corda.node.services.api.IdentityServiceInternal import net.corda.testing.DUMMY_NOTARY_NAME import net.corda.testing.TestIdentity import net.corda.testing.getTestPartyAndCertificate +import net.corda.testing.internal.rigorousMock import net.corda.testing.node.MockServices import net.corda.testing.node.ledger -import net.corda.testing.rigorousMock import org.junit.Ignore import org.junit.Test import java.math.BigInteger @@ -34,13 +34,14 @@ class NativeSgxApiTest { val DUMMY_CASH_ISSUER = DUMMY_CASH_ISSUER_IDENTITY.party.ref(1) val megaCorp = TestIdentity(CordaX500Name("MegaCorp", "London", "GB")) val MEGA_CORP get() = megaCorp.party - val MEGA_CORP_PUBKEY get() = megaCorp.pubkey - val MINI_CORP_PUBKEY = TestIdentity(CordaX500Name("MiniCorp", "London", "GB")).pubkey + val MEGA_CORP_PUBKEY get() = megaCorp.publicKey + val MINI_CORP_PUBKEY = TestIdentity(CordaX500Name("MiniCorp", "London", "GB")).publicKey } - private val ledgerServices = MockServices(rigorousMock().also { - doReturn(NativeSgxApiTest.MEGA_CORP).whenever(it).partyFromKey(NativeSgxApiTest.MEGA_CORP_PUBKEY) - }, NativeSgxApiTest.MEGA_CORP.name) + private val identityService = rigorousMock().also { + doReturn(MEGA_CORP).whenever(it).partyFromKey(MEGA_CORP_PUBKEY) + } + private val ledgerServices = MockServices(emptyList(), identityService, MEGA_CORP.name) @Ignore("The SGX code is not part of the standard build yet") @Test diff --git a/verify-enclave/src/test/kotlin/com/r3/enclaves/txverify/EnclaveletTest.kt b/verify-enclave/src/test/kotlin/com/r3/enclaves/txverify/EnclaveletTest.kt index 66741aec84..066d5b94ee 100644 --- a/verify-enclave/src/test/kotlin/com/r3/enclaves/txverify/EnclaveletTest.kt +++ b/verify-enclave/src/test/kotlin/com/r3/enclaves/txverify/EnclaveletTest.kt @@ -12,6 +12,7 @@ import net.corda.finance.`issued by` import net.corda.finance.contracts.asset.Cash import net.corda.node.services.api.IdentityServiceInternal import net.corda.testing.* +import net.corda.testing.internal.rigorousMock import net.corda.testing.node.MockServices import net.corda.testing.node.ledger import org.junit.Ignore @@ -31,16 +32,17 @@ class EnclaveletTest { val DUMMY_CASH_ISSUER = DUMMY_CASH_ISSUER_IDENTITY.party.ref(1) val megaCorp = TestIdentity(CordaX500Name("MegaCorp", "London", "GB")) val MEGA_CORP get() = megaCorp.party - val MEGA_CORP_PUBKEY get() = megaCorp.pubkey - val MINI_CORP_PUBKEY = TestIdentity(CordaX500Name("MiniCorp", "London", "GB")).pubkey + val MEGA_CORP_PUBKEY get() = megaCorp.publicKey + val MINI_CORP_PUBKEY = TestIdentity(CordaX500Name("MiniCorp", "London", "GB")).publicKey } @Rule @JvmField val testSerialization = SerializationEnvironmentRule() - private val ledgerServices = MockServices(rigorousMock().also { + private val identityService = rigorousMock().also { doReturn(MEGA_CORP).whenever(it).partyFromKey(MEGA_CORP_PUBKEY) - }, MEGA_CORP.name) + } + private val ledgerServices = MockServices(emptyList(), identityService, MEGA_CORP.name) @Ignore("Pending Gradle bug: https://github.com/gradle/gradle/issues/2657") @Test