mirror of
https://github.com/corda/corda.git
synced 2025-01-27 22:59:54 +00:00
Fix compilation errors on Tests following rebase from OS.
This commit is contained in:
parent
671e711dda
commit
79f288dcf6
@ -40,7 +40,7 @@ public class CordaRPCJavaClientTest extends NodeBasedTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ClassRule
|
@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));
|
IntegrationTestKt.toDatabaseSchemaName(DUMMY_NOTARY_NAME));
|
||||||
|
|
||||||
private List<String> perms = Arrays.asList(
|
private List<String> perms = Arrays.asList(
|
||||||
|
@ -32,6 +32,7 @@ import net.corda.testing.IntegrationTest
|
|||||||
import net.corda.testing.IntegrationTestSchemas
|
import net.corda.testing.IntegrationTestSchemas
|
||||||
import net.corda.testing.common.internal.testNetworkParameters
|
import net.corda.testing.common.internal.testNetworkParameters
|
||||||
import net.corda.testing.contracts.DummyContract
|
import net.corda.testing.contracts.DummyContract
|
||||||
|
import net.corda.testing.dummyCommand
|
||||||
import net.corda.testing.node.MockNetwork
|
import net.corda.testing.node.MockNetwork
|
||||||
import net.corda.testing.node.MockNetwork.MockNode
|
import net.corda.testing.node.MockNetwork.MockNode
|
||||||
import net.corda.testing.node.MockNodeParameters
|
import net.corda.testing.node.MockNodeParameters
|
||||||
|
@ -101,10 +101,13 @@ class P2PMessagingTest : IntegrationTest() {
|
|||||||
|
|
||||||
// Restart the node and expect a response
|
// Restart the node and expect a response
|
||||||
val aliceRestarted = startAlice()
|
val aliceRestarted = startAlice()
|
||||||
val responseFuture = openFuture<Any>() aliceRestarted.network.runOnNextMessage("test.response") {
|
|
||||||
|
val responseFuture = openFuture<Any>()
|
||||||
|
aliceRestarted.network.runOnNextMessage("test.response") {
|
||||||
responseFuture.set(it.data.deserialize())
|
responseFuture.set(it.data.deserialize())
|
||||||
}
|
}
|
||||||
val response = responseFuture.getOrThrow()
|
val response = responseFuture.getOrThrow()
|
||||||
|
|
||||||
assertThat(crashingNodes.requestsReceived.get()).isGreaterThan(numberOfRequestsReceived)
|
assertThat(crashingNodes.requestsReceived.get()).isGreaterThan(numberOfRequestsReceived)
|
||||||
assertThat(response).isEqualTo(responseMessage)
|
assertThat(response).isEqualTo(responseMessage)
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ import net.corda.nodeapi.internal.persistence.DatabaseTransaction;
|
|||||||
import net.corda.testing.SerializationEnvironmentRule;
|
import net.corda.testing.SerializationEnvironmentRule;
|
||||||
import net.corda.testing.TestIdentity;
|
import net.corda.testing.TestIdentity;
|
||||||
import net.corda.testing.internal.vault.DummyLinearContract;
|
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.internal.vault.VaultFiller;
|
||||||
import net.corda.testing.node.MockServices;
|
import net.corda.testing.node.MockServices;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
|
@ -38,6 +38,7 @@ import net.corda.nodeapi.internal.persistence.DatabaseConfig
|
|||||||
import net.corda.nodeapi.internal.persistence.HibernateConfiguration
|
import net.corda.nodeapi.internal.persistence.HibernateConfiguration
|
||||||
import net.corda.testing.*
|
import net.corda.testing.*
|
||||||
import net.corda.testing.internal.rigorousMock
|
import net.corda.testing.internal.rigorousMock
|
||||||
|
import net.corda.testing.internal.vault.DummyDealStateSchemaV1
|
||||||
import net.corda.testing.internal.vault.VaultFiller
|
import net.corda.testing.internal.vault.VaultFiller
|
||||||
import net.corda.testing.node.MockServices
|
import net.corda.testing.node.MockServices
|
||||||
import net.corda.testing.node.MockServices.Companion.makeTestDataSourceProperties
|
import net.corda.testing.node.MockServices.Companion.makeTestDataSourceProperties
|
||||||
|
@ -6,9 +6,9 @@ import com.nhaarman.mockito_kotlin.verify
|
|||||||
import com.nhaarman.mockito_kotlin.whenever
|
import com.nhaarman.mockito_kotlin.whenever
|
||||||
import net.corda.node.internal.configureDatabase
|
import net.corda.node.internal.configureDatabase
|
||||||
import net.corda.nodeapi.internal.persistence.CordaPersistence
|
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.makeTestDataSourceProperties
|
||||||
import net.corda.testing.node.MockServices.Companion.makeTestDatabaseProperties
|
import net.corda.testing.node.MockServices.Companion.makeTestDatabaseProperties
|
||||||
import net.corda.testing.rigorousMock
|
|
||||||
import org.junit.After
|
import org.junit.After
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
|
@ -18,23 +18,19 @@ import net.corda.finance.contracts.CommercialPaper
|
|||||||
import net.corda.finance.contracts.Commodity
|
import net.corda.finance.contracts.Commodity
|
||||||
import net.corda.finance.contracts.DealState
|
import net.corda.finance.contracts.DealState
|
||||||
import net.corda.finance.contracts.asset.Cash
|
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
|
||||||
import net.corda.finance.schemas.CashSchemaV1.PersistentCashState
|
import net.corda.finance.schemas.CashSchemaV1.PersistentCashState
|
||||||
import net.corda.finance.schemas.CommercialPaperSchemaV1
|
import net.corda.finance.schemas.CommercialPaperSchemaV1
|
||||||
import net.corda.finance.sampleschemas.SampleCashSchemaV3
|
|
||||||
import net.corda.node.internal.configureDatabase
|
import net.corda.node.internal.configureDatabase
|
||||||
import net.corda.nodeapi.internal.persistence.CordaPersistence
|
import net.corda.nodeapi.internal.persistence.CordaPersistence
|
||||||
import net.corda.nodeapi.internal.persistence.DatabaseConfig
|
import net.corda.nodeapi.internal.persistence.DatabaseConfig
|
||||||
import net.corda.testing.*
|
import net.corda.testing.*
|
||||||
import net.corda.testing.internal.rigorousMock
|
import net.corda.testing.internal.rigorousMock
|
||||||
import net.corda.testing.internal.vault.DUMMY_LINEAR_CONTRACT_PROGRAM_ID
|
import net.corda.testing.internal.vault.*
|
||||||
import net.corda.testing.internal.vault.DummyLinearContract
|
|
||||||
import net.corda.testing.internal.vault.VaultFiller
|
|
||||||
import net.corda.testing.node.MockServices
|
import net.corda.testing.node.MockServices
|
||||||
import net.corda.testing.node.MockServices.Companion.makeTestDatabaseAndMockServices
|
import net.corda.testing.node.MockServices.Companion.makeTestDatabaseAndMockServices
|
||||||
import net.corda.testing.node.makeTestIdentityService
|
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.assertThat
|
||||||
import org.assertj.core.api.Assertions.assertThatThrownBy
|
import org.assertj.core.api.Assertions.assertThatThrownBy
|
||||||
import org.junit.*
|
import org.junit.*
|
||||||
|
@ -18,6 +18,10 @@ import net.corda.core.utilities.days
|
|||||||
import net.corda.core.utilities.seconds
|
import net.corda.core.utilities.seconds
|
||||||
import net.corda.node.services.api.IdentityServiceInternal
|
import net.corda.node.services.api.IdentityServiceInternal
|
||||||
import net.corda.testing.*
|
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.MockServices
|
||||||
import net.corda.testing.node.ledger
|
import net.corda.testing.node.ledger
|
||||||
import net.corda.testing.node.makeTestIdentityService
|
import net.corda.testing.node.makeTestIdentityService
|
||||||
@ -44,7 +48,7 @@ interface CommercialPaperTestTemplate {
|
|||||||
private val megaCorp = TestIdentity(CordaX500Name("MegaCorp", "London", "GB"))
|
private val megaCorp = TestIdentity(CordaX500Name("MegaCorp", "London", "GB"))
|
||||||
private val MEGA_CORP get() = megaCorp.party
|
private val MEGA_CORP get() = megaCorp.party
|
||||||
private val MEGA_CORP_IDENTITY get() = megaCorp.identity
|
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 {
|
class KotlinCommercialPaperTest : CommercialPaperTestTemplate {
|
||||||
@ -89,13 +93,13 @@ class CommercialPaperTestsGeneric {
|
|||||||
private val dummyNotary = TestIdentity(DUMMY_NOTARY_NAME, 20)
|
private val dummyNotary = TestIdentity(DUMMY_NOTARY_NAME, 20)
|
||||||
private val miniCorp = TestIdentity(CordaX500Name("MiniCorp", "London", "GB"))
|
private val miniCorp = TestIdentity(CordaX500Name("MiniCorp", "London", "GB"))
|
||||||
private val ALICE get() = alice.party
|
private val ALICE get() = alice.party
|
||||||
private val ALICE_KEY get() = alice.key
|
private val ALICE_KEY get() = alice.keyPair
|
||||||
private val ALICE_PUBKEY get() = alice.pubkey
|
private val ALICE_PUBKEY get() = alice.publicKey
|
||||||
private val DUMMY_NOTARY get() = dummyNotary.party
|
private val DUMMY_NOTARY get() = dummyNotary.party
|
||||||
private val DUMMY_NOTARY_IDENTITY get() = dummyNotary.identity
|
private val DUMMY_NOTARY_IDENTITY get() = dummyNotary.identity
|
||||||
private val MINI_CORP get() = miniCorp.party
|
private val MINI_CORP get() = miniCorp.party
|
||||||
private val MINI_CORP_IDENTITY get() = miniCorp.identity
|
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
|
@JvmField
|
||||||
val testSerialization = SerializationEnvironmentRule()
|
val testSerialization = SerializationEnvironmentRule()
|
||||||
val issuer = MEGA_CORP.ref(123)
|
val issuer = MEGA_CORP.ref(123)
|
||||||
private val ledgerServices = MockServices(rigorousMock<IdentityServiceInternal>().also {
|
private val ledgerServices = MockServices(emptyList(), rigorousMock<IdentityServiceInternal>().also {
|
||||||
doReturn(MEGA_CORP).whenever(it).partyFromKey(MEGA_CORP_PUBKEY)
|
doReturn(MEGA_CORP).whenever(it).partyFromKey(MEGA_CORP_PUBKEY)
|
||||||
doReturn(MINI_CORP).whenever(it).partyFromKey(MINI_CORP_PUBKEY)
|
doReturn(MINI_CORP).whenever(it).partyFromKey(MINI_CORP_PUBKEY)
|
||||||
doReturn(null).whenever(it).partyFromKey(ALICE_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, "Alice's profit", aliceGetsBack.STATE ownedBy ALICE)
|
||||||
output(Cash.PROGRAM_ID, "Change", (someProfits - aliceGetsBack).STATE ownedBy MEGA_CORP)
|
output(Cash.PROGRAM_ID, "Change", (someProfits - aliceGetsBack).STATE ownedBy MEGA_CORP)
|
||||||
}
|
}
|
||||||
|
|
||||||
command(MEGA_CORP_PUBKEY, Cash.Commands.Move())
|
command(MEGA_CORP_PUBKEY, Cash.Commands.Move())
|
||||||
command(ALICE_PUBKEY, thisTest.getRedeemCommand(DUMMY_NOTARY))
|
command(ALICE_PUBKEY, thisTest.getRedeemCommand(DUMMY_NOTARY))
|
||||||
|
|
||||||
tweak {
|
tweak {
|
||||||
outputs(700.DOLLARS `issued by` issuer)
|
outputs(700.DOLLARS `issued by` issuer)
|
||||||
timeWindow(TEST_TX_TIME + 8.days)
|
timeWindow(TEST_TX_TIME + 8.days)
|
||||||
@ -249,17 +251,17 @@ class CommercialPaperTestsGeneric {
|
|||||||
private lateinit var aliceVaultService: VaultService
|
private lateinit var aliceVaultService: VaultService
|
||||||
private lateinit var alicesVault: Vault<ContractState>
|
private lateinit var alicesVault: Vault<ContractState>
|
||||||
|
|
||||||
private val notaryServices = MockServices(rigorousMock(), MEGA_CORP.name, dummyNotary.key)
|
private val notaryServices = MockServices(emptyList(), rigorousMock(), MEGA_CORP.name, dummyNotary.keyPair)
|
||||||
private val issuerServices = MockServices(rigorousMock(), MEGA_CORP.name, DUMMY_CASH_ISSUER_KEY)
|
private val issuerServices = MockServices(listOf("net.corda.finance.contracts", "net.corda.finance.schemas"), rigorousMock(), MEGA_CORP.name, dummyCashIssuer.keyPair)
|
||||||
|
|
||||||
private lateinit var moveTX: SignedTransaction
|
private lateinit var moveTX: SignedTransaction
|
||||||
|
|
||||||
// @Test
|
@Test
|
||||||
fun `issue move and then redeem`() = withTestSerialization{
|
fun `issue move and then redeem`() = {
|
||||||
val aliceDatabaseAndServices = MockServices.makeTestDatabaseAndMockServices(
|
val aliceDatabaseAndServices = MockServices.makeTestDatabaseAndMockServices(
|
||||||
listOf(ALICE_KEY),
|
listOf("net.corda.finance.contracts"),
|
||||||
makeTestIdentityService(listOf(MEGA_CORP_IDENTITY, MINI_CORP_IDENTITY, DUMMY_CASH_ISSUER_IDENTITY, DUMMY_NOTARY_IDENTITY)),
|
makeTestIdentityService(MEGA_CORP_IDENTITY, MINI_CORP_IDENTITY, DUMMY_CASH_ISSUER_IDENTITY, DUMMY_NOTARY_IDENTITY),
|
||||||
initialIdentityName = MEGA_CORP.name)
|
TestIdentity(MEGA_CORP.name, ALICE_KEY))
|
||||||
val databaseAlice = aliceDatabaseAndServices.first
|
val databaseAlice = aliceDatabaseAndServices.first
|
||||||
aliceServices = aliceDatabaseAndServices.second
|
aliceServices = aliceDatabaseAndServices.second
|
||||||
aliceVaultService = aliceServices.vaultService
|
aliceVaultService = aliceServices.vaultService
|
||||||
@ -270,9 +272,9 @@ class CommercialPaperTestsGeneric {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val bigCorpDatabaseAndServices = MockServices.makeTestDatabaseAndMockServices(
|
val bigCorpDatabaseAndServices = MockServices.makeTestDatabaseAndMockServices(
|
||||||
listOf(BIG_CORP_KEY),
|
listOf("net.corda.finance.contracts"),
|
||||||
makeTestIdentityService(listOf(MEGA_CORP_IDENTITY, MINI_CORP_IDENTITY, DUMMY_CASH_ISSUER_IDENTITY, DUMMY_NOTARY_IDENTITY)),
|
makeTestIdentityService(MEGA_CORP_IDENTITY, MINI_CORP_IDENTITY, DUMMY_CASH_ISSUER_IDENTITY, DUMMY_NOTARY_IDENTITY),
|
||||||
initialIdentityName = MEGA_CORP.name)
|
TestIdentity(MEGA_CORP.name, BIG_CORP_KEY))
|
||||||
val databaseBigCorp = bigCorpDatabaseAndServices.first
|
val databaseBigCorp = bigCorpDatabaseAndServices.first
|
||||||
bigCorpServices = bigCorpDatabaseAndServices.second
|
bigCorpServices = bigCorpDatabaseAndServices.second
|
||||||
bigCorpVaultService = bigCorpServices.vaultService
|
bigCorpVaultService = bigCorpServices.vaultService
|
||||||
@ -298,8 +300,8 @@ class CommercialPaperTestsGeneric {
|
|||||||
// Alice pays $9000 to BigCorp to own some of their debt.
|
// Alice pays $9000 to BigCorp to own some of their debt.
|
||||||
moveTX = run {
|
moveTX = run {
|
||||||
val builder = TransactionBuilder(DUMMY_NOTARY)
|
val builder = TransactionBuilder(DUMMY_NOTARY)
|
||||||
Cash.generateSpend(aliceServices, builder, 9000.DOLLARS, AnonymousParty(bigCorpServices.key.public))
|
Cash.generateSpend(aliceServices, builder, 9000.DOLLARS, AnonymousParty(BIG_CORP_KEY.public))
|
||||||
CommercialPaper().generateMove(builder, issueTx.tx.outRef(0), AnonymousParty(aliceServices.key.public))
|
CommercialPaper().generateMove(builder, issueTx.tx.outRef(0), AnonymousParty(ALICE_PUBKEY))
|
||||||
val ptx = aliceServices.signInitialTransaction(builder)
|
val ptx = aliceServices.signInitialTransaction(builder)
|
||||||
val ptx2 = bigCorpServices.addSignature(ptx)
|
val ptx2 = bigCorpServices.addSignature(ptx)
|
||||||
val stx = notaryServices.addSignature(ptx2)
|
val stx = notaryServices.addSignature(ptx2)
|
||||||
|
@ -11,7 +11,6 @@ import com.r3.corda.enterprise.perftestcordapp.utils.sumCashOrNull
|
|||||||
import com.r3.corda.enterprise.perftestcordapp.utils.sumCashOrZero
|
import com.r3.corda.enterprise.perftestcordapp.utils.sumCashOrZero
|
||||||
import net.corda.core.contracts.*
|
import net.corda.core.contracts.*
|
||||||
import net.corda.core.crypto.SecureHash
|
import net.corda.core.crypto.SecureHash
|
||||||
import net.corda.core.crypto.generateKeyPair
|
|
||||||
import net.corda.core.identity.AbstractParty
|
import net.corda.core.identity.AbstractParty
|
||||||
import net.corda.core.identity.AnonymousParty
|
import net.corda.core.identity.AnonymousParty
|
||||||
import net.corda.core.identity.CordaX500Name
|
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.nodeapi.internal.persistence.CordaPersistence
|
||||||
import net.corda.testing.*
|
import net.corda.testing.*
|
||||||
import net.corda.testing.contracts.DummyState
|
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
|
||||||
import net.corda.testing.node.MockServices.Companion.makeTestDatabaseAndMockServices
|
import net.corda.testing.node.MockServices.Companion.makeTestDatabaseAndMockServices
|
||||||
import net.corda.testing.node.ledger
|
import net.corda.testing.node.ledger
|
||||||
@ -77,27 +81,27 @@ fun ServiceHub.fillWithSomeTestCash(howMuch: Amount<Currency>,
|
|||||||
class CashTests {
|
class CashTests {
|
||||||
private companion object {
|
private companion object {
|
||||||
val alice = TestIdentity(ALICE_NAME, 70)
|
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 charlie = TestIdentity(CHARLIE_NAME, 90)
|
||||||
val DUMMY_CASH_ISSUER_IDENTITY = TestIdentity(CordaX500Name("Snake Oil Issuer", "London", "GB"), 10).identity
|
val DUMMY_CASH_ISSUER_IDENTITY = TestIdentity(CordaX500Name("Snake Oil Issuer", "London", "GB"), 10).identity
|
||||||
val dummyNotary = TestIdentity(DUMMY_NOTARY_NAME, 20)
|
val dummyNotary = TestIdentity(DUMMY_NOTARY_NAME, 20)
|
||||||
val megaCorp = TestIdentity(CordaX500Name("MegaCorp", "London", "GB"))
|
val megaCorp = TestIdentity(CordaX500Name("MegaCorp", "London", "GB"))
|
||||||
val miniCorp = TestIdentity(CordaX500Name("MiniCorp", "London", "GB"))
|
val miniCorp = TestIdentity(CordaX500Name("MiniCorp", "London", "GB"))
|
||||||
val ALICE get() = alice.party
|
val ALICE get() = alice.party
|
||||||
val ALICE_PUBKEY get() = alice.pubkey
|
val ALICE_PUBKEY get() = alice.publicKey
|
||||||
val CHARLIE get() = charlie.party
|
val CHARLIE get() = charlie.party
|
||||||
val CHARLIE_IDENTITY get() = charlie.identity
|
val CHARLIE_IDENTITY get() = charlie.identity
|
||||||
val DUMMY_NOTARY get() = dummyNotary.party
|
val DUMMY_NOTARY get() = dummyNotary.party
|
||||||
val DUMMY_NOTARY_IDENTITY get() = dummyNotary.identity
|
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 get() = megaCorp.party
|
||||||
val MEGA_CORP_IDENTITY get() = megaCorp.identity
|
val MEGA_CORP_IDENTITY get() = megaCorp.identity
|
||||||
val MEGA_CORP_KEY get() = megaCorp.key
|
val MEGA_CORP_KEY get() = megaCorp.keyPair
|
||||||
val MEGA_CORP_PUBKEY get() = megaCorp.pubkey
|
val MEGA_CORP_PUBKEY get() = megaCorp.publicKey
|
||||||
val MINI_CORP get() = miniCorp.party
|
val MINI_CORP get() = miniCorp.party
|
||||||
val MINI_CORP_IDENTITY get() = miniCorp.identity
|
val MINI_CORP_IDENTITY get() = miniCorp.identity
|
||||||
val MINI_CORP_KEY get() = miniCorp.key
|
val MINI_CORP_KEY get() = miniCorp.keyPair
|
||||||
val MINI_CORP_PUBKEY get() = miniCorp.pubkey
|
val MINI_CORP_PUBKEY get() = miniCorp.publicKey
|
||||||
}
|
}
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
@ -133,22 +137,15 @@ class CashTests {
|
|||||||
@Before
|
@Before
|
||||||
fun setUp() {
|
fun setUp() {
|
||||||
LogHelper.setLevel(NodeVaultService::class)
|
LogHelper.setLevel(NodeVaultService::class)
|
||||||
megaCorpServices = MockServices(
|
megaCorpServices = MockServices(listOf("net.corda.finance.contracts.asset", "net.corda.finance.schemas"), rigorousMock(), MEGA_CORP.name, MEGA_CORP_KEY)
|
||||||
listOf("com.r3.corda.enterprise.perftestcordapp.contracts.asset", "com.r3.corda.enterprise.perftestcordapp.schemas"),
|
miniCorpServices = MockServices(listOf("net.corda.finance.contracts.asset", "net.corda.finance.schemas"), rigorousMock<IdentityServiceInternal>().also {
|
||||||
rigorousMock(), MEGA_CORP.name, MEGA_CORP_KEY)
|
doNothing().whenever(it).justVerifyAndRegisterIdentity(argThat { name == MINI_CORP.name })
|
||||||
miniCorpServices = MockServices(
|
}, MINI_CORP.name, MINI_CORP_KEY)
|
||||||
listOf("com.r3.corda.enterprise.perftestcordapp.contracts.asset", "com.r3.corda.enterprise.perftestcordapp.schemas"),
|
val notaryServices = MockServices(listOf("net.corda.finance.contracts.asset"), rigorousMock(), DUMMY_NOTARY.name, DUMMY_NOTARY_KEY)
|
||||||
rigorousMock<IdentityServiceInternal>().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)
|
|
||||||
val databaseAndServices = makeTestDatabaseAndMockServices(
|
val databaseAndServices = makeTestDatabaseAndMockServices(
|
||||||
cordappPackages = listOf("com.r3.corda.enterprise.perftestcordapp.contracts.asset", "com.r3.corda.enterprise.perftestcordapp.schemas"),
|
listOf("net.corda.finance.contracts.asset"),
|
||||||
initialIdentityName = CordaX500Name(organisation = "Me", locality = "London", country = "GB"),
|
makeTestIdentityService(MEGA_CORP_IDENTITY, MINI_CORP_IDENTITY, DUMMY_CASH_ISSUER_IDENTITY, DUMMY_NOTARY_IDENTITY),
|
||||||
keys = listOf(generateKeyPair()),
|
TestIdentity(CordaX500Name("Me", "London", "GB")))
|
||||||
identityService = makeTestIdentityService(listOf(MEGA_CORP_IDENTITY, MINI_CORP_IDENTITY, DUMMY_CASH_ISSUER_IDENTITY, DUMMY_NOTARY_IDENTITY)))
|
|
||||||
database = databaseAndServices.first
|
database = databaseAndServices.first
|
||||||
ourServices = databaseAndServices.second
|
ourServices = databaseAndServices.second
|
||||||
|
|
||||||
@ -184,7 +181,7 @@ class CashTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun transaction(script: TransactionDSL<TransactionDSLInterpreter>.() -> EnforceVerifyOrFail) = run {
|
private fun transaction(script: TransactionDSL<TransactionDSLInterpreter>.() -> EnforceVerifyOrFail) = run {
|
||||||
MockServices(rigorousMock<IdentityServiceInternal>().also {
|
MockServices(emptyList(), rigorousMock<IdentityServiceInternal>().also {
|
||||||
doReturn(MEGA_CORP).whenever(it).partyFromKey(MEGA_CORP_PUBKEY)
|
doReturn(MEGA_CORP).whenever(it).partyFromKey(MEGA_CORP_PUBKEY)
|
||||||
doReturn(MINI_CORP).whenever(it).partyFromKey(MINI_CORP_PUBKEY)
|
doReturn(MINI_CORP).whenever(it).partyFromKey(MINI_CORP_PUBKEY)
|
||||||
doReturn(null).whenever(it).partyFromKey(ALICE_PUBKEY)
|
doReturn(null).whenever(it).partyFromKey(ALICE_PUBKEY)
|
||||||
@ -882,7 +879,7 @@ class CashTests {
|
|||||||
transaction {
|
transaction {
|
||||||
attachment(Cash.PROGRAM_ID)
|
attachment(Cash.PROGRAM_ID)
|
||||||
input("MEGA_CORP cash")
|
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<Cash.State>().copy(owner = ALICE))
|
output(Cash.PROGRAM_ID, "MEGA_CORP cash 3", "MEGA_CORP cash".output<Cash.State>().copy(owner = ALICE))
|
||||||
command(MEGA_CORP_PUBKEY, Cash.Commands.Move())
|
command(MEGA_CORP_PUBKEY, Cash.Commands.Move())
|
||||||
this.verifies()
|
this.verifies()
|
||||||
|
@ -47,6 +47,12 @@ import net.corda.node.services.persistence.DBTransactionStorage
|
|||||||
import net.corda.node.services.statemachine.Checkpoint
|
import net.corda.node.services.statemachine.Checkpoint
|
||||||
import net.corda.nodeapi.internal.persistence.CordaPersistence
|
import net.corda.nodeapi.internal.persistence.CordaPersistence
|
||||||
import net.corda.testing.*
|
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 net.corda.testing.node.*
|
||||||
import org.assertj.core.api.Assertions.assertThat
|
import org.assertj.core.api.Assertions.assertThat
|
||||||
import org.junit.After
|
import org.junit.After
|
||||||
@ -127,8 +133,7 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
|
|||||||
bobNode.internals.disableDBCloseOnStop()
|
bobNode.internals.disableDBCloseOnStop()
|
||||||
|
|
||||||
bobNode.database.transaction {
|
bobNode.database.transaction {
|
||||||
bobNode.services.fillWithSomeTestCash(2000.DOLLARS, bankNode.services, outputNotary = notary,
|
VaultFiller(bobNode.services, dummyNotary, notary, ::Random).fillWithSomeTestCash(2000.DOLLARS, bankNode.services, 3, 10, cashIssuer)
|
||||||
issuedBy = cashIssuer)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val alicesFakePaper = aliceNode.database.transaction {
|
val alicesFakePaper = aliceNode.database.transaction {
|
||||||
|
@ -17,9 +17,9 @@ import net.corda.node.services.api.IdentityServiceInternal
|
|||||||
import net.corda.testing.DUMMY_NOTARY_NAME
|
import net.corda.testing.DUMMY_NOTARY_NAME
|
||||||
import net.corda.testing.TestIdentity
|
import net.corda.testing.TestIdentity
|
||||||
import net.corda.testing.getTestPartyAndCertificate
|
import net.corda.testing.getTestPartyAndCertificate
|
||||||
|
import net.corda.testing.internal.rigorousMock
|
||||||
import net.corda.testing.node.MockServices
|
import net.corda.testing.node.MockServices
|
||||||
import net.corda.testing.node.ledger
|
import net.corda.testing.node.ledger
|
||||||
import net.corda.testing.rigorousMock
|
|
||||||
import org.junit.Ignore
|
import org.junit.Ignore
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.math.BigInteger
|
import java.math.BigInteger
|
||||||
@ -34,13 +34,14 @@ class NativeSgxApiTest {
|
|||||||
val DUMMY_CASH_ISSUER = DUMMY_CASH_ISSUER_IDENTITY.party.ref(1)
|
val DUMMY_CASH_ISSUER = DUMMY_CASH_ISSUER_IDENTITY.party.ref(1)
|
||||||
val megaCorp = TestIdentity(CordaX500Name("MegaCorp", "London", "GB"))
|
val megaCorp = TestIdentity(CordaX500Name("MegaCorp", "London", "GB"))
|
||||||
val MEGA_CORP get() = megaCorp.party
|
val MEGA_CORP get() = megaCorp.party
|
||||||
val MEGA_CORP_PUBKEY get() = megaCorp.pubkey
|
val MEGA_CORP_PUBKEY get() = megaCorp.publicKey
|
||||||
val MINI_CORP_PUBKEY = TestIdentity(CordaX500Name("MiniCorp", "London", "GB")).pubkey
|
val MINI_CORP_PUBKEY = TestIdentity(CordaX500Name("MiniCorp", "London", "GB")).publicKey
|
||||||
}
|
}
|
||||||
|
|
||||||
private val ledgerServices = MockServices(rigorousMock<IdentityServiceInternal>().also {
|
private val identityService = rigorousMock<IdentityServiceInternal>().also {
|
||||||
doReturn(NativeSgxApiTest.MEGA_CORP).whenever(it).partyFromKey(NativeSgxApiTest.MEGA_CORP_PUBKEY)
|
doReturn(MEGA_CORP).whenever(it).partyFromKey(MEGA_CORP_PUBKEY)
|
||||||
}, NativeSgxApiTest.MEGA_CORP.name)
|
}
|
||||||
|
private val ledgerServices = MockServices(emptyList(), identityService, MEGA_CORP.name)
|
||||||
|
|
||||||
@Ignore("The SGX code is not part of the standard build yet")
|
@Ignore("The SGX code is not part of the standard build yet")
|
||||||
@Test
|
@Test
|
||||||
|
@ -12,6 +12,7 @@ import net.corda.finance.`issued by`
|
|||||||
import net.corda.finance.contracts.asset.Cash
|
import net.corda.finance.contracts.asset.Cash
|
||||||
import net.corda.node.services.api.IdentityServiceInternal
|
import net.corda.node.services.api.IdentityServiceInternal
|
||||||
import net.corda.testing.*
|
import net.corda.testing.*
|
||||||
|
import net.corda.testing.internal.rigorousMock
|
||||||
import net.corda.testing.node.MockServices
|
import net.corda.testing.node.MockServices
|
||||||
import net.corda.testing.node.ledger
|
import net.corda.testing.node.ledger
|
||||||
import org.junit.Ignore
|
import org.junit.Ignore
|
||||||
@ -31,16 +32,17 @@ class EnclaveletTest {
|
|||||||
val DUMMY_CASH_ISSUER = DUMMY_CASH_ISSUER_IDENTITY.party.ref(1)
|
val DUMMY_CASH_ISSUER = DUMMY_CASH_ISSUER_IDENTITY.party.ref(1)
|
||||||
val megaCorp = TestIdentity(CordaX500Name("MegaCorp", "London", "GB"))
|
val megaCorp = TestIdentity(CordaX500Name("MegaCorp", "London", "GB"))
|
||||||
val MEGA_CORP get() = megaCorp.party
|
val MEGA_CORP get() = megaCorp.party
|
||||||
val MEGA_CORP_PUBKEY get() = megaCorp.pubkey
|
val MEGA_CORP_PUBKEY get() = megaCorp.publicKey
|
||||||
val MINI_CORP_PUBKEY = TestIdentity(CordaX500Name("MiniCorp", "London", "GB")).pubkey
|
val MINI_CORP_PUBKEY = TestIdentity(CordaX500Name("MiniCorp", "London", "GB")).publicKey
|
||||||
}
|
}
|
||||||
@Rule
|
@Rule
|
||||||
@JvmField
|
@JvmField
|
||||||
val testSerialization = SerializationEnvironmentRule()
|
val testSerialization = SerializationEnvironmentRule()
|
||||||
|
|
||||||
private val ledgerServices = MockServices(rigorousMock<IdentityServiceInternal>().also {
|
private val identityService = rigorousMock<IdentityServiceInternal>().also {
|
||||||
doReturn(MEGA_CORP).whenever(it).partyFromKey(MEGA_CORP_PUBKEY)
|
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")
|
@Ignore("Pending Gradle bug: https://github.com/gradle/gradle/issues/2657")
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user