mirror of
https://github.com/corda/corda.git
synced 2025-06-03 16:10:58 +00:00
Retire setCordappPackages. (#1860)
This commit is contained in:
parent
c96031d311
commit
4ee250a19b
@ -28,11 +28,13 @@ import static kotlin.test.AssertionsKt.assertEquals;
|
|||||||
import static net.corda.finance.Currencies.DOLLARS;
|
import static net.corda.finance.Currencies.DOLLARS;
|
||||||
import static net.corda.finance.contracts.GetBalances.getCashBalance;
|
import static net.corda.finance.contracts.GetBalances.getCashBalance;
|
||||||
import static net.corda.node.services.FlowPermissions.startFlowPermission;
|
import static net.corda.node.services.FlowPermissions.startFlowPermission;
|
||||||
import static net.corda.testing.CoreTestUtils.setCordappPackages;
|
|
||||||
import static net.corda.testing.CoreTestUtils.unsetCordappPackages;
|
|
||||||
import static net.corda.testing.TestConstants.getALICE;
|
import static net.corda.testing.TestConstants.getALICE;
|
||||||
|
|
||||||
public class CordaRPCJavaClientTest extends NodeBasedTest {
|
public class CordaRPCJavaClientTest extends NodeBasedTest {
|
||||||
|
public CordaRPCJavaClientTest() {
|
||||||
|
super(Collections.singletonList("net.corda.finance.contracts"));
|
||||||
|
}
|
||||||
|
|
||||||
private List<String> perms = Arrays.asList(startFlowPermission(CashPaymentFlow.class), startFlowPermission(CashIssueFlow.class));
|
private List<String> perms = Arrays.asList(startFlowPermission(CashPaymentFlow.class), startFlowPermission(CashIssueFlow.class));
|
||||||
private Set<String> permSet = new HashSet<>(perms);
|
private Set<String> permSet = new HashSet<>(perms);
|
||||||
private User rpcUser = new User("user1", "test", permSet);
|
private User rpcUser = new User("user1", "test", permSet);
|
||||||
@ -49,7 +51,6 @@ public class CordaRPCJavaClientTest extends NodeBasedTest {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws ExecutionException, InterruptedException {
|
public void setUp() throws ExecutionException, InterruptedException {
|
||||||
setCordappPackages("net.corda.finance.contracts");
|
|
||||||
CordaFuture<StartedNode<Node>> nodeFuture = startNotaryNode(getALICE().getName(), singletonList(rpcUser), true);
|
CordaFuture<StartedNode<Node>> nodeFuture = startNotaryNode(getALICE().getName(), singletonList(rpcUser), true);
|
||||||
node = nodeFuture.get();
|
node = nodeFuture.get();
|
||||||
node.getInternals().registerCustomSchemas(Collections.singleton(CashSchemaV1.INSTANCE));
|
node.getInternals().registerCustomSchemas(Collections.singleton(CashSchemaV1.INSTANCE));
|
||||||
@ -59,7 +60,6 @@ public class CordaRPCJavaClientTest extends NodeBasedTest {
|
|||||||
@After
|
@After
|
||||||
public void done() throws IOException {
|
public void done() throws IOException {
|
||||||
connection.close();
|
connection.close();
|
||||||
unsetCordappPackages();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -23,7 +23,7 @@ import org.junit.rules.ExpectedException
|
|||||||
@CordaSerializable
|
@CordaSerializable
|
||||||
data class Packet(val x: () -> Long)
|
data class Packet(val x: () -> Long)
|
||||||
|
|
||||||
class BlacklistKotlinClosureTest : NodeBasedTest() {
|
class BlacklistKotlinClosureTest : NodeBasedTest(listOf("net.corda.client.rpc")) {
|
||||||
companion object {
|
companion object {
|
||||||
@Suppress("UNUSED") val logger = loggerFor<BlacklistKotlinClosureTest>()
|
@Suppress("UNUSED") val logger = loggerFor<BlacklistKotlinClosureTest>()
|
||||||
const val EVIL: Long = 666
|
const val EVIL: Long = 666
|
||||||
@ -66,7 +66,6 @@ class BlacklistKotlinClosureTest : NodeBasedTest() {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setUp() {
|
fun setUp() {
|
||||||
setCordappPackages("net.corda.client.rpc")
|
|
||||||
aliceNode = startNode(ALICE.name, rpcUsers = listOf(rpcUser)).getOrThrow()
|
aliceNode = startNode(ALICE.name, rpcUsers = listOf(rpcUser)).getOrThrow()
|
||||||
bobNode = startNode(BOB.name, rpcUsers = listOf(rpcUser)).getOrThrow()
|
bobNode = startNode(BOB.name, rpcUsers = listOf(rpcUser)).getOrThrow()
|
||||||
bobNode.registerInitiatedFlow(RemoteFlowC::class.java)
|
bobNode.registerInitiatedFlow(RemoteFlowC::class.java)
|
||||||
@ -78,7 +77,6 @@ class BlacklistKotlinClosureTest : NodeBasedTest() {
|
|||||||
connection?.close()
|
connection?.close()
|
||||||
bobNode.internals.stop()
|
bobNode.internals.stop()
|
||||||
aliceNode.internals.stop()
|
aliceNode.internals.stop()
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -23,8 +23,6 @@ import net.corda.nodeapi.User
|
|||||||
import net.corda.testing.ALICE
|
import net.corda.testing.ALICE
|
||||||
import net.corda.testing.chooseIdentity
|
import net.corda.testing.chooseIdentity
|
||||||
import net.corda.testing.node.NodeBasedTest
|
import net.corda.testing.node.NodeBasedTest
|
||||||
import net.corda.testing.setCordappPackages
|
|
||||||
import net.corda.testing.unsetCordappPackages
|
|
||||||
import org.apache.activemq.artemis.api.core.ActiveMQSecurityException
|
import org.apache.activemq.artemis.api.core.ActiveMQSecurityException
|
||||||
import org.assertj.core.api.Assertions.assertThatExceptionOfType
|
import org.assertj.core.api.Assertions.assertThatExceptionOfType
|
||||||
import org.junit.After
|
import org.junit.After
|
||||||
@ -34,7 +32,7 @@ import kotlin.test.assertEquals
|
|||||||
import kotlin.test.assertFalse
|
import kotlin.test.assertFalse
|
||||||
import kotlin.test.assertTrue
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
class CordaRPCClientTest : NodeBasedTest() {
|
class CordaRPCClientTest : NodeBasedTest(listOf("net.corda.finance.contracts")) {
|
||||||
private val rpcUser = User("user1", "test", permissions = setOf(
|
private val rpcUser = User("user1", "test", permissions = setOf(
|
||||||
startFlowPermission<CashIssueFlow>(),
|
startFlowPermission<CashIssueFlow>(),
|
||||||
startFlowPermission<CashPaymentFlow>()
|
startFlowPermission<CashPaymentFlow>()
|
||||||
@ -49,7 +47,6 @@ class CordaRPCClientTest : NodeBasedTest() {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setUp() {
|
fun setUp() {
|
||||||
setCordappPackages("net.corda.finance.contracts")
|
|
||||||
node = startNotaryNode(ALICE.name, rpcUsers = listOf(rpcUser)).getOrThrow()
|
node = startNotaryNode(ALICE.name, rpcUsers = listOf(rpcUser)).getOrThrow()
|
||||||
node.internals.registerCustomSchemas(setOf(CashSchemaV1))
|
node.internals.registerCustomSchemas(setOf(CashSchemaV1))
|
||||||
client = CordaRPCClient(node.internals.configuration.rpcAddress!!)
|
client = CordaRPCClient(node.internals.configuration.rpcAddress!!)
|
||||||
@ -58,7 +55,6 @@ class CordaRPCClientTest : NodeBasedTest() {
|
|||||||
@After
|
@After
|
||||||
fun done() {
|
fun done() {
|
||||||
connection?.close()
|
connection?.close()
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -28,15 +28,13 @@ class IdentitySyncFlowTests {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun before() {
|
fun before() {
|
||||||
setCordappPackages("net.corda.finance.contracts.asset")
|
|
||||||
// We run this in parallel threads to help catch any race conditions that may exist.
|
// We run this in parallel threads to help catch any race conditions that may exist.
|
||||||
mockNet = MockNetwork(networkSendManuallyPumped = false, threadPerNode = true)
|
mockNet = MockNetwork(networkSendManuallyPumped = false, threadPerNode = true, cordappPackages = listOf("net.corda.finance.contracts.asset"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
fun cleanUp() {
|
fun cleanUp() {
|
||||||
mockNet.stopNodes()
|
mockNet.stopNodes()
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -23,6 +23,10 @@ import kotlin.reflect.KClass
|
|||||||
import kotlin.test.assertFailsWith
|
import kotlin.test.assertFailsWith
|
||||||
|
|
||||||
class CollectSignaturesFlowTests {
|
class CollectSignaturesFlowTests {
|
||||||
|
companion object {
|
||||||
|
private val cordappPackages = listOf("net.corda.testing.contracts")
|
||||||
|
}
|
||||||
|
|
||||||
lateinit var mockNet: MockNetwork
|
lateinit var mockNet: MockNetwork
|
||||||
lateinit var aliceNode: StartedNode<MockNetwork.MockNode>
|
lateinit var aliceNode: StartedNode<MockNetwork.MockNode>
|
||||||
lateinit var bobNode: StartedNode<MockNetwork.MockNode>
|
lateinit var bobNode: StartedNode<MockNetwork.MockNode>
|
||||||
@ -31,8 +35,7 @@ class CollectSignaturesFlowTests {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
setCordappPackages("net.corda.testing.contracts")
|
mockNet = MockNetwork(cordappPackages = cordappPackages)
|
||||||
mockNet = MockNetwork()
|
|
||||||
val notaryNode = mockNet.createNotaryNode()
|
val notaryNode = mockNet.createNotaryNode()
|
||||||
aliceNode = mockNet.createPartyNode(ALICE.name)
|
aliceNode = mockNet.createPartyNode(ALICE.name)
|
||||||
bobNode = mockNet.createPartyNode(BOB.name)
|
bobNode = mockNet.createPartyNode(BOB.name)
|
||||||
@ -45,7 +48,6 @@ class CollectSignaturesFlowTests {
|
|||||||
@After
|
@After
|
||||||
fun tearDown() {
|
fun tearDown() {
|
||||||
mockNet.stopNodes()
|
mockNet.stopNodes()
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun registerFlowOnAllNodes(flowClass: KClass<out FlowLogic<*>>) {
|
private fun registerFlowOnAllNodes(flowClass: KClass<out FlowLogic<*>>) {
|
||||||
@ -174,7 +176,7 @@ class CollectSignaturesFlowTests {
|
|||||||
@Test
|
@Test
|
||||||
fun `fails when not signed by initiator`() {
|
fun `fails when not signed by initiator`() {
|
||||||
val onePartyDummyContract = DummyContract.generateInitial(1337, notary, aliceNode.info.chooseIdentity().ref(1))
|
val onePartyDummyContract = DummyContract.generateInitial(1337, notary, aliceNode.info.chooseIdentity().ref(1))
|
||||||
val miniCorpServices = MockServices(MINI_CORP_KEY)
|
val miniCorpServices = MockServices(cordappPackages, MINI_CORP_KEY)
|
||||||
val ptx = miniCorpServices.signInitialTransaction(onePartyDummyContract)
|
val ptx = miniCorpServices.signInitialTransaction(onePartyDummyContract)
|
||||||
val flow = aliceNode.services.startFlow(CollectSignaturesFlow(ptx, emptySet()))
|
val flow = aliceNode.services.startFlow(CollectSignaturesFlow(ptx, emptySet()))
|
||||||
mockNet.runNetwork()
|
mockNet.runNetwork()
|
||||||
|
@ -40,8 +40,7 @@ class ContractUpgradeFlowTest {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
setCordappPackages("net.corda.testing.contracts", "net.corda.finance.contracts.asset", "net.corda.core.flows")
|
mockNet = MockNetwork(cordappPackages = listOf("net.corda.testing.contracts", "net.corda.finance.contracts.asset", "net.corda.core.flows"))
|
||||||
mockNet = MockNetwork()
|
|
||||||
val notaryNode = mockNet.createNotaryNode()
|
val notaryNode = mockNet.createNotaryNode()
|
||||||
aliceNode = mockNet.createPartyNode(ALICE.name)
|
aliceNode = mockNet.createPartyNode(ALICE.name)
|
||||||
bobNode = mockNet.createPartyNode(BOB.name)
|
bobNode = mockNet.createPartyNode(BOB.name)
|
||||||
@ -56,7 +55,6 @@ class ContractUpgradeFlowTest {
|
|||||||
@After
|
@After
|
||||||
fun tearDown() {
|
fun tearDown() {
|
||||||
mockNet.stopNodes()
|
mockNet.stopNodes()
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -23,8 +23,7 @@ class FinalityFlowTests {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
setCordappPackages("net.corda.finance.contracts.asset")
|
mockNet = MockNetwork(cordappPackages = listOf("net.corda.finance.contracts.asset"))
|
||||||
mockNet = MockNetwork()
|
|
||||||
mockNet.createNotaryNode()
|
mockNet.createNotaryNode()
|
||||||
aliceNode = mockNet.createPartyNode(ALICE.name)
|
aliceNode = mockNet.createPartyNode(ALICE.name)
|
||||||
bobNode = mockNet.createPartyNode(BOB.name)
|
bobNode = mockNet.createPartyNode(BOB.name)
|
||||||
@ -36,7 +35,6 @@ class FinalityFlowTests {
|
|||||||
@After
|
@After
|
||||||
fun tearDown() {
|
fun tearDown() {
|
||||||
mockNet.stopNodes()
|
mockNet.stopNodes()
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -36,8 +36,7 @@ class ResolveTransactionsFlowTest {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
setCordappPackages("net.corda.testing.contracts")
|
mockNet = MockNetwork(cordappPackages = listOf("net.corda.testing.contracts"))
|
||||||
mockNet = MockNetwork()
|
|
||||||
notaryNode = mockNet.createNotaryNode()
|
notaryNode = mockNet.createNotaryNode()
|
||||||
megaCorpNode = mockNet.createPartyNode(MEGA_CORP.name)
|
megaCorpNode = mockNet.createPartyNode(MEGA_CORP.name)
|
||||||
miniCorpNode = mockNet.createPartyNode(MINI_CORP.name)
|
miniCorpNode = mockNet.createPartyNode(MINI_CORP.name)
|
||||||
@ -52,7 +51,6 @@ class ResolveTransactionsFlowTest {
|
|||||||
@After
|
@After
|
||||||
fun tearDown() {
|
fun tearDown() {
|
||||||
mockNet.stopNodes()
|
mockNet.stopNodes()
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
}
|
||||||
// DOCEND 3
|
// DOCEND 3
|
||||||
|
|
||||||
|
@ -26,8 +26,7 @@ class CustomVaultQueryTest {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
setCordappPackages("net.corda.finance.contracts.asset")
|
mockNet = MockNetwork(threadPerNode = true, cordappPackages = listOf("net.corda.finance.contracts.asset"))
|
||||||
mockNet = MockNetwork(threadPerNode = true)
|
|
||||||
mockNet.createNotaryNode(legalName = DUMMY_NOTARY.name)
|
mockNet.createNotaryNode(legalName = DUMMY_NOTARY.name)
|
||||||
nodeA = mockNet.createPartyNode()
|
nodeA = mockNet.createPartyNode()
|
||||||
nodeB = mockNet.createPartyNode()
|
nodeB = mockNet.createPartyNode()
|
||||||
@ -42,7 +41,6 @@ class CustomVaultQueryTest {
|
|||||||
@After
|
@After
|
||||||
fun cleanUp() {
|
fun cleanUp() {
|
||||||
mockNet.stopNodes()
|
mockNet.stopNodes()
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -24,8 +24,7 @@ class FxTransactionBuildTutorialTest {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
setCordappPackages("net.corda.finance.contracts.asset")
|
mockNet = MockNetwork(threadPerNode = true, cordappPackages = listOf("net.corda.finance.contracts.asset"))
|
||||||
mockNet = MockNetwork(threadPerNode = true)
|
|
||||||
mockNet.createNotaryNode(legalName = DUMMY_NOTARY.name)
|
mockNet.createNotaryNode(legalName = DUMMY_NOTARY.name)
|
||||||
nodeA = mockNet.createPartyNode()
|
nodeA = mockNet.createPartyNode()
|
||||||
nodeB = mockNet.createPartyNode()
|
nodeB = mockNet.createPartyNode()
|
||||||
@ -38,7 +37,6 @@ class FxTransactionBuildTutorialTest {
|
|||||||
@After
|
@After
|
||||||
fun cleanUp() {
|
fun cleanUp() {
|
||||||
mockNet.stopNodes()
|
mockNet.stopNodes()
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -12,8 +12,6 @@ import net.corda.node.internal.StartedNode
|
|||||||
import net.corda.testing.DUMMY_NOTARY
|
import net.corda.testing.DUMMY_NOTARY
|
||||||
import net.corda.testing.chooseIdentity
|
import net.corda.testing.chooseIdentity
|
||||||
import net.corda.testing.node.MockNetwork
|
import net.corda.testing.node.MockNetwork
|
||||||
import net.corda.testing.setCordappPackages
|
|
||||||
import net.corda.testing.unsetCordappPackages
|
|
||||||
import org.junit.After
|
import org.junit.After
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@ -32,8 +30,7 @@ class WorkflowTransactionBuildTutorialTest {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
setCordappPackages("net.corda.docs")
|
mockNet = MockNetwork(threadPerNode = true, cordappPackages = listOf("net.corda.docs"))
|
||||||
mockNet = MockNetwork(threadPerNode = true)
|
|
||||||
mockNet.createNotaryNode(legalName = DUMMY_NOTARY.name)
|
mockNet.createNotaryNode(legalName = DUMMY_NOTARY.name)
|
||||||
nodeA = mockNet.createPartyNode()
|
nodeA = mockNet.createPartyNode()
|
||||||
nodeB = mockNet.createPartyNode()
|
nodeB = mockNet.createPartyNode()
|
||||||
@ -43,7 +40,6 @@ class WorkflowTransactionBuildTutorialTest {
|
|||||||
@After
|
@After
|
||||||
fun cleanUp() {
|
fun cleanUp() {
|
||||||
mockNet.stopNodes()
|
mockNet.stopNodes()
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -5,16 +5,18 @@ import net.corda.finance.contracts.FixOf
|
|||||||
import net.corda.finance.contracts.Frequency
|
import net.corda.finance.contracts.Frequency
|
||||||
import net.corda.finance.contracts.Tenor
|
import net.corda.finance.contracts.Tenor
|
||||||
import net.corda.testing.DUMMY_NOTARY
|
import net.corda.testing.DUMMY_NOTARY
|
||||||
import net.corda.testing.setCordappPackages
|
import net.corda.testing.EnforceVerifyOrFail
|
||||||
import net.corda.testing.transaction
|
import net.corda.testing.TransactionDSL
|
||||||
import net.corda.testing.unsetCordappPackages
|
import net.corda.testing.TransactionDSLInterpreter
|
||||||
import org.junit.After
|
|
||||||
import org.junit.Before
|
|
||||||
import org.junit.Ignore
|
import org.junit.Ignore
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
|
|
||||||
|
fun transaction(script: TransactionDSL<TransactionDSLInterpreter>.() -> EnforceVerifyOrFail) = run {
|
||||||
|
net.corda.testing.transaction(cordappPackages = listOf("net.corda.finance.contracts.universal"), dsl = script)
|
||||||
|
}
|
||||||
|
|
||||||
class Cap {
|
class Cap {
|
||||||
|
|
||||||
val TEST_TX_TIME_1: Instant get() = Instant.parse("2017-09-02T12:00:00.00Z")
|
val TEST_TX_TIME_1: Instant get() = Instant.parse("2017-09-02T12:00:00.00Z")
|
||||||
@ -167,16 +169,6 @@ class Cap {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
|
||||||
fun setup() {
|
|
||||||
setCordappPackages("net.corda.finance.contracts.universal")
|
|
||||||
}
|
|
||||||
|
|
||||||
@After
|
|
||||||
fun tearDown() {
|
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun issue() {
|
fun issue() {
|
||||||
transaction {
|
transaction {
|
||||||
|
@ -3,11 +3,6 @@ package net.corda.finance.contracts.universal
|
|||||||
import net.corda.finance.contracts.FixOf
|
import net.corda.finance.contracts.FixOf
|
||||||
import net.corda.finance.contracts.Tenor
|
import net.corda.finance.contracts.Tenor
|
||||||
import net.corda.testing.DUMMY_NOTARY
|
import net.corda.testing.DUMMY_NOTARY
|
||||||
import net.corda.testing.setCordappPackages
|
|
||||||
import net.corda.testing.transaction
|
|
||||||
import net.corda.testing.unsetCordappPackages
|
|
||||||
import org.junit.After
|
|
||||||
import org.junit.Before
|
|
||||||
import org.junit.Ignore
|
import org.junit.Ignore
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
@ -53,17 +48,6 @@ class Caplet {
|
|||||||
val stateFixed = UniversalContract.State(listOf(DUMMY_NOTARY), contractFixed)
|
val stateFixed = UniversalContract.State(listOf(DUMMY_NOTARY), contractFixed)
|
||||||
|
|
||||||
val stateFinal = UniversalContract.State(listOf(DUMMY_NOTARY), contractFinal)
|
val stateFinal = UniversalContract.State(listOf(DUMMY_NOTARY), contractFinal)
|
||||||
|
|
||||||
@Before
|
|
||||||
fun setup() {
|
|
||||||
setCordappPackages("net.corda.finance.contracts.universal")
|
|
||||||
}
|
|
||||||
|
|
||||||
@After
|
|
||||||
fun tearDown() {
|
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun issue() {
|
fun issue() {
|
||||||
transaction {
|
transaction {
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
package net.corda.finance.contracts.universal
|
package net.corda.finance.contracts.universal
|
||||||
|
|
||||||
import net.corda.testing.DUMMY_NOTARY
|
import net.corda.testing.DUMMY_NOTARY
|
||||||
import net.corda.testing.setCordappPackages
|
|
||||||
import net.corda.testing.transaction
|
|
||||||
import net.corda.testing.unsetCordappPackages
|
|
||||||
import org.junit.After
|
|
||||||
import org.junit.Before
|
|
||||||
import org.junit.Ignore
|
import org.junit.Ignore
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
@ -50,17 +45,6 @@ class FXFwdTimeOption
|
|||||||
val inState = UniversalContract.State(listOf(DUMMY_NOTARY), initialContract)
|
val inState = UniversalContract.State(listOf(DUMMY_NOTARY), initialContract)
|
||||||
val outState1 = UniversalContract.State(listOf(DUMMY_NOTARY), outContract1)
|
val outState1 = UniversalContract.State(listOf(DUMMY_NOTARY), outContract1)
|
||||||
val outState2 = UniversalContract.State(listOf(DUMMY_NOTARY), outContract2)
|
val outState2 = UniversalContract.State(listOf(DUMMY_NOTARY), outContract2)
|
||||||
|
|
||||||
@Before
|
|
||||||
fun setup() {
|
|
||||||
setCordappPackages("net.corda.finance.contracts.universal")
|
|
||||||
}
|
|
||||||
|
|
||||||
@After
|
|
||||||
fun tearDown() {
|
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `issue - signature`() {
|
fun `issue - signature`() {
|
||||||
transaction {
|
transaction {
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
package net.corda.finance.contracts.universal
|
package net.corda.finance.contracts.universal
|
||||||
|
|
||||||
import net.corda.testing.DUMMY_NOTARY
|
import net.corda.testing.DUMMY_NOTARY
|
||||||
import net.corda.testing.setCordappPackages
|
|
||||||
import net.corda.testing.transaction
|
|
||||||
import net.corda.testing.unsetCordappPackages
|
|
||||||
import org.junit.After
|
|
||||||
import org.junit.Before
|
|
||||||
import org.junit.Ignore
|
import org.junit.Ignore
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
@ -41,17 +36,6 @@ class FXSwap {
|
|||||||
val outStateBad3 = UniversalContract.State(listOf(DUMMY_NOTARY), transferBad3)
|
val outStateBad3 = UniversalContract.State(listOf(DUMMY_NOTARY), transferBad3)
|
||||||
|
|
||||||
val inState = UniversalContract.State(listOf(DUMMY_NOTARY), contract)
|
val inState = UniversalContract.State(listOf(DUMMY_NOTARY), contract)
|
||||||
|
|
||||||
@Before
|
|
||||||
fun setup() {
|
|
||||||
setCordappPackages("net.corda.finance.contracts.universal")
|
|
||||||
}
|
|
||||||
|
|
||||||
@After
|
|
||||||
fun tearDown() {
|
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `issue - signature`() {
|
fun `issue - signature`() {
|
||||||
|
|
||||||
|
@ -4,11 +4,6 @@ import net.corda.finance.contracts.FixOf
|
|||||||
import net.corda.finance.contracts.Frequency
|
import net.corda.finance.contracts.Frequency
|
||||||
import net.corda.finance.contracts.Tenor
|
import net.corda.finance.contracts.Tenor
|
||||||
import net.corda.testing.DUMMY_NOTARY
|
import net.corda.testing.DUMMY_NOTARY
|
||||||
import net.corda.testing.setCordappPackages
|
|
||||||
import net.corda.testing.transaction
|
|
||||||
import net.corda.testing.unsetCordappPackages
|
|
||||||
import org.junit.After
|
|
||||||
import org.junit.Before
|
|
||||||
import org.junit.Ignore
|
import org.junit.Ignore
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
@ -132,17 +127,6 @@ class IRS {
|
|||||||
val stateAfterExecutionFirst = UniversalContract.State(listOf(DUMMY_NOTARY), contractAfterExecutionFirst)
|
val stateAfterExecutionFirst = UniversalContract.State(listOf(DUMMY_NOTARY), contractAfterExecutionFirst)
|
||||||
|
|
||||||
val statePaymentFirst = UniversalContract.State(listOf(DUMMY_NOTARY), paymentFirst)
|
val statePaymentFirst = UniversalContract.State(listOf(DUMMY_NOTARY), paymentFirst)
|
||||||
|
|
||||||
@Before
|
|
||||||
fun setup() {
|
|
||||||
setCordappPackages("net.corda.finance.contracts.universal")
|
|
||||||
}
|
|
||||||
|
|
||||||
@After
|
|
||||||
fun tearDown() {
|
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun issue() {
|
fun issue() {
|
||||||
transaction {
|
transaction {
|
||||||
|
@ -2,11 +2,6 @@ package net.corda.finance.contracts.universal
|
|||||||
|
|
||||||
import net.corda.finance.contracts.Frequency
|
import net.corda.finance.contracts.Frequency
|
||||||
import net.corda.testing.DUMMY_NOTARY
|
import net.corda.testing.DUMMY_NOTARY
|
||||||
import net.corda.testing.setCordappPackages
|
|
||||||
import net.corda.testing.transaction
|
|
||||||
import net.corda.testing.unsetCordappPackages
|
|
||||||
import org.junit.After
|
|
||||||
import org.junit.Before
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
@ -122,16 +117,6 @@ class RollOutTests {
|
|||||||
next()
|
next()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
|
||||||
fun setup() {
|
|
||||||
setCordappPackages("net.corda.finance.contracts.universal")
|
|
||||||
}
|
|
||||||
|
|
||||||
@After
|
|
||||||
fun tearDown() {
|
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `arrangement equality transfer`() {
|
fun `arrangement equality transfer`() {
|
||||||
assertEquals(contract_transfer1, contract_transfer2)
|
assertEquals(contract_transfer1, contract_transfer2)
|
||||||
|
@ -3,11 +3,6 @@ package net.corda.finance.contracts.universal
|
|||||||
import net.corda.finance.contracts.Frequency
|
import net.corda.finance.contracts.Frequency
|
||||||
import net.corda.finance.contracts.Tenor
|
import net.corda.finance.contracts.Tenor
|
||||||
import net.corda.testing.DUMMY_NOTARY
|
import net.corda.testing.DUMMY_NOTARY
|
||||||
import net.corda.testing.setCordappPackages
|
|
||||||
import net.corda.testing.transaction
|
|
||||||
import net.corda.testing.unsetCordappPackages
|
|
||||||
import org.junit.After
|
|
||||||
import org.junit.Before
|
|
||||||
import org.junit.Ignore
|
import org.junit.Ignore
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
@ -59,17 +54,6 @@ class Swaption {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val stateInitial = UniversalContract.State(listOf(DUMMY_NOTARY), contractInitial)
|
val stateInitial = UniversalContract.State(listOf(DUMMY_NOTARY), contractInitial)
|
||||||
|
|
||||||
@Before
|
|
||||||
fun setup() {
|
|
||||||
setCordappPackages("net.corda.finance.contracts.universal")
|
|
||||||
}
|
|
||||||
|
|
||||||
@After
|
|
||||||
fun tearDown() {
|
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun issue() {
|
fun issue() {
|
||||||
transaction {
|
transaction {
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
package net.corda.finance.contracts.universal
|
package net.corda.finance.contracts.universal
|
||||||
|
|
||||||
import net.corda.testing.DUMMY_NOTARY
|
import net.corda.testing.DUMMY_NOTARY
|
||||||
import net.corda.testing.setCordappPackages
|
|
||||||
import net.corda.testing.transaction
|
|
||||||
import net.corda.testing.unsetCordappPackages
|
|
||||||
import org.junit.After
|
|
||||||
import org.junit.Before
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
@ -43,17 +38,6 @@ class ZeroCouponBond {
|
|||||||
val outStateWrong = UniversalContract.State(listOf(DUMMY_NOTARY), transferWrong)
|
val outStateWrong = UniversalContract.State(listOf(DUMMY_NOTARY), transferWrong)
|
||||||
|
|
||||||
val outStateMove = UniversalContract.State(listOf(DUMMY_NOTARY), contractMove)
|
val outStateMove = UniversalContract.State(listOf(DUMMY_NOTARY), contractMove)
|
||||||
|
|
||||||
@Before
|
|
||||||
fun setup() {
|
|
||||||
setCordappPackages("net.corda.finance.contracts.universal")
|
|
||||||
}
|
|
||||||
|
|
||||||
@After
|
|
||||||
fun tearDown() {
|
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun basic() {
|
fun basic() {
|
||||||
assertEquals(Zero(), Zero())
|
assertEquals(Zero(), Zero())
|
||||||
|
@ -231,7 +231,6 @@ class CommercialPaperTestsGeneric {
|
|||||||
// @Test
|
// @Test
|
||||||
@Ignore
|
@Ignore
|
||||||
fun `issue move and then redeem`() {
|
fun `issue move and then redeem`() {
|
||||||
setCordappPackages("net.corda.finance.contracts")
|
|
||||||
initialiseTestSerialization()
|
initialiseTestSerialization()
|
||||||
val aliceDatabaseAndServices = makeTestDatabaseAndMockServices(keys = listOf(ALICE_KEY))
|
val aliceDatabaseAndServices = makeTestDatabaseAndMockServices(keys = listOf(ALICE_KEY))
|
||||||
val databaseAlice = aliceDatabaseAndServices.first
|
val databaseAlice = aliceDatabaseAndServices.first
|
||||||
|
@ -593,7 +593,6 @@ class ObligationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try defaulting an obligation that is now in the past
|
// Try defaulting an obligation that is now in the past
|
||||||
unsetCordappPackages()
|
|
||||||
ledger {
|
ledger {
|
||||||
transaction("Settlement") {
|
transaction("Settlement") {
|
||||||
attachments(Obligation.PROGRAM_ID)
|
attachments(Obligation.PROGRAM_ID)
|
||||||
|
@ -28,8 +28,7 @@ class CashExitFlowTests {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun start() {
|
fun start() {
|
||||||
setCordappPackages("net.corda.finance.contracts.asset")
|
mockNet = MockNetwork(servicePeerAllocationStrategy = RoundRobin(), cordappPackages = listOf("net.corda.finance.contracts.asset"))
|
||||||
mockNet = MockNetwork(servicePeerAllocationStrategy = RoundRobin())
|
|
||||||
notaryNode = mockNet.createNotaryNode()
|
notaryNode = mockNet.createNotaryNode()
|
||||||
bankOfCordaNode = mockNet.createPartyNode(BOC.name)
|
bankOfCordaNode = mockNet.createPartyNode(BOC.name)
|
||||||
notary = notaryNode.services.getDefaultNotary()
|
notary = notaryNode.services.getDefaultNotary()
|
||||||
@ -45,7 +44,6 @@ class CashExitFlowTests {
|
|||||||
@After
|
@After
|
||||||
fun cleanUp() {
|
fun cleanUp() {
|
||||||
mockNet.stopNodes()
|
mockNet.stopNodes()
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -10,11 +10,9 @@ import net.corda.node.internal.StartedNode
|
|||||||
import net.corda.testing.chooseIdentity
|
import net.corda.testing.chooseIdentity
|
||||||
import net.corda.testing.getDefaultNotary
|
import net.corda.testing.getDefaultNotary
|
||||||
import net.corda.testing.BOC
|
import net.corda.testing.BOC
|
||||||
import net.corda.testing.DUMMY_NOTARY
|
|
||||||
import net.corda.testing.node.InMemoryMessagingNetwork.ServicePeerAllocationStrategy.RoundRobin
|
import net.corda.testing.node.InMemoryMessagingNetwork.ServicePeerAllocationStrategy.RoundRobin
|
||||||
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.setCordappPackages
|
|
||||||
import org.junit.After
|
import org.junit.After
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@ -30,8 +28,7 @@ class CashIssueFlowTests {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun start() {
|
fun start() {
|
||||||
setCordappPackages("net.corda.finance.contracts.asset")
|
mockNet = MockNetwork(servicePeerAllocationStrategy = RoundRobin(), cordappPackages = listOf("net.corda.finance.contracts.asset"))
|
||||||
mockNet = MockNetwork(servicePeerAllocationStrategy = RoundRobin())
|
|
||||||
notaryNode = mockNet.createNotaryNode()
|
notaryNode = mockNet.createNotaryNode()
|
||||||
bankOfCordaNode = mockNet.createPartyNode(BOC.name)
|
bankOfCordaNode = mockNet.createPartyNode(BOC.name)
|
||||||
bankOfCorda = bankOfCordaNode.info.chooseIdentity()
|
bankOfCorda = bankOfCordaNode.info.chooseIdentity()
|
||||||
|
@ -31,8 +31,7 @@ class CashPaymentFlowTests {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun start() {
|
fun start() {
|
||||||
setCordappPackages("net.corda.finance.contracts.asset")
|
mockNet = MockNetwork(servicePeerAllocationStrategy = RoundRobin(), cordappPackages = listOf("net.corda.finance.contracts.asset"))
|
||||||
mockNet = MockNetwork(servicePeerAllocationStrategy = RoundRobin())
|
|
||||||
notaryNode = mockNet.createNotaryNode()
|
notaryNode = mockNet.createNotaryNode()
|
||||||
bankOfCordaNode = mockNet.createPartyNode(BOC.name)
|
bankOfCordaNode = mockNet.createPartyNode(BOC.name)
|
||||||
bankOfCorda = bankOfCordaNode.info.chooseIdentity()
|
bankOfCorda = bankOfCordaNode.info.chooseIdentity()
|
||||||
|
@ -9,7 +9,6 @@ import net.corda.core.transactions.LedgerTransaction
|
|||||||
import net.corda.core.transactions.TransactionBuilder
|
import net.corda.core.transactions.TransactionBuilder
|
||||||
import net.corda.testing.*
|
import net.corda.testing.*
|
||||||
import net.corda.testing.node.MockServices
|
import net.corda.testing.node.MockServices
|
||||||
import org.junit.After
|
|
||||||
import org.junit.Assert.*
|
import org.junit.Assert.*
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@ -48,11 +47,6 @@ class AttachmentsClassLoaderStaticContractTests : TestDependencyInjectionBase()
|
|||||||
serviceHub = MockServices(cordappPackages = listOf("net.corda.nodeapi.internal"))
|
serviceHub = MockServices(cordappPackages = listOf("net.corda.nodeapi.internal"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
|
||||||
fun `clear packages`() {
|
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `test serialization of WireTransaction with statically loaded contract`() {
|
fun `test serialization of WireTransaction with statically loaded contract`() {
|
||||||
val tx = AttachmentDummyContract().generateInitial(MEGA_CORP.ref(0), 42, DUMMY_NOTARY)
|
val tx = AttachmentDummyContract().generateInitial(MEGA_CORP.ref(0), 42, DUMMY_NOTARY)
|
||||||
|
@ -16,26 +16,14 @@ import net.corda.node.services.transactions.RaftValidatingNotaryService
|
|||||||
import net.corda.testing.*
|
import net.corda.testing.*
|
||||||
import net.corda.testing.contracts.DummyContract
|
import net.corda.testing.contracts.DummyContract
|
||||||
import net.corda.testing.node.NodeBasedTest
|
import net.corda.testing.node.NodeBasedTest
|
||||||
import org.junit.After
|
|
||||||
import org.junit.Before
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
import kotlin.test.assertFailsWith
|
import kotlin.test.assertFailsWith
|
||||||
|
|
||||||
class RaftNotaryServiceTests : NodeBasedTest() {
|
class RaftNotaryServiceTests : NodeBasedTest(listOf("net.corda.testing.contracts")) {
|
||||||
private val notaryName = CordaX500Name(RaftValidatingNotaryService.id, "RAFT Notary Service", "London", "GB")
|
private val notaryName = CordaX500Name(RaftValidatingNotaryService.id, "RAFT Notary Service", "London", "GB")
|
||||||
|
|
||||||
@Before
|
|
||||||
fun setup() {
|
|
||||||
setCordappPackages("net.corda.testing.contracts")
|
|
||||||
}
|
|
||||||
|
|
||||||
@After
|
|
||||||
fun tearDown() {
|
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `detect double spend`() {
|
fun `detect double spend`() {
|
||||||
val (bankA) = listOf(
|
val (bankA) = listOf(
|
||||||
|
@ -102,6 +102,7 @@ import net.corda.core.crypto.generateKeyPair as cryptoGenerateKeyPair
|
|||||||
abstract class AbstractNode(config: NodeConfiguration,
|
abstract class AbstractNode(config: NodeConfiguration,
|
||||||
val platformClock: Clock,
|
val platformClock: Clock,
|
||||||
protected val versionInfo: VersionInfo,
|
protected val versionInfo: VersionInfo,
|
||||||
|
protected val cordappLoader: CordappLoader,
|
||||||
@VisibleForTesting val busyNodeLatch: ReusableLatch = ReusableLatch()) : SingletonSerializeAsToken() {
|
@VisibleForTesting val busyNodeLatch: ReusableLatch = ReusableLatch()) : SingletonSerializeAsToken() {
|
||||||
open val configuration = config.apply {
|
open val configuration = config.apply {
|
||||||
require(minimumPlatformVersion <= versionInfo.platformVersion) {
|
require(minimumPlatformVersion <= versionInfo.platformVersion) {
|
||||||
@ -151,8 +152,6 @@ abstract class AbstractNode(config: NodeConfiguration,
|
|||||||
protected val runOnStop = ArrayList<() -> Any?>()
|
protected val runOnStop = ArrayList<() -> Any?>()
|
||||||
protected lateinit var database: CordaPersistence
|
protected lateinit var database: CordaPersistence
|
||||||
lateinit var cordappProvider: CordappProviderImpl
|
lateinit var cordappProvider: CordappProviderImpl
|
||||||
protected val cordappLoader by lazy { makeCordappLoader() }
|
|
||||||
|
|
||||||
protected val _nodeReadyFuture = openFuture<Unit>()
|
protected val _nodeReadyFuture = openFuture<Unit>()
|
||||||
/** Completes once the node has successfully registered with the network map service
|
/** Completes once the node has successfully registered with the network map service
|
||||||
* or has loaded network map data from local database */
|
* or has loaded network map data from local database */
|
||||||
@ -472,19 +471,6 @@ abstract class AbstractNode(config: NodeConfiguration,
|
|||||||
return tokenizableServices
|
return tokenizableServices
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun makeCordappLoader(): CordappLoader {
|
|
||||||
val scanPackages = System.getProperty("net.corda.node.cordapp.scan.packages")
|
|
||||||
return if (CordappLoader.testPackages.isNotEmpty()) {
|
|
||||||
check(configuration.devMode) { "Package scanning can only occur in dev mode" }
|
|
||||||
CordappLoader.createDefaultWithTestPackages(configuration.baseDirectory, CordappLoader.testPackages)
|
|
||||||
} else if (scanPackages != null) {
|
|
||||||
check(configuration.devMode) { "Package scanning can only occur in dev mode" }
|
|
||||||
CordappLoader.createDefaultWithTestPackages(configuration.baseDirectory, scanPackages.split(","))
|
|
||||||
} else {
|
|
||||||
CordappLoader.createDefault(configuration.baseDirectory)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected open fun makeTransactionStorage(): WritableTransactionStorage = DBTransactionStorage()
|
protected open fun makeTransactionStorage(): WritableTransactionStorage = DBTransactionStorage()
|
||||||
|
|
||||||
private fun makeVaultObservers() {
|
private fun makeVaultObservers() {
|
||||||
|
@ -15,6 +15,7 @@ import net.corda.core.node.ServiceHub
|
|||||||
import net.corda.core.serialization.SerializationDefaults
|
import net.corda.core.serialization.SerializationDefaults
|
||||||
import net.corda.core.utilities.*
|
import net.corda.core.utilities.*
|
||||||
import net.corda.node.VersionInfo
|
import net.corda.node.VersionInfo
|
||||||
|
import net.corda.node.internal.cordapp.CordappLoader
|
||||||
import net.corda.node.serialization.KryoServerSerializationScheme
|
import net.corda.node.serialization.KryoServerSerializationScheme
|
||||||
import net.corda.node.serialization.NodeClock
|
import net.corda.node.serialization.NodeClock
|
||||||
import net.corda.node.services.RPCUserService
|
import net.corda.node.services.RPCUserService
|
||||||
@ -22,6 +23,7 @@ import net.corda.node.services.RPCUserServiceImpl
|
|||||||
import net.corda.node.services.api.NetworkMapCacheInternal
|
import net.corda.node.services.api.NetworkMapCacheInternal
|
||||||
import net.corda.node.services.api.SchemaService
|
import net.corda.node.services.api.SchemaService
|
||||||
import net.corda.node.services.config.FullNodeConfiguration
|
import net.corda.node.services.config.FullNodeConfiguration
|
||||||
|
import net.corda.node.services.config.NodeConfiguration
|
||||||
import net.corda.node.services.messaging.ArtemisMessagingServer
|
import net.corda.node.services.messaging.ArtemisMessagingServer
|
||||||
import net.corda.node.services.messaging.ArtemisMessagingServer.Companion.ipDetectRequestProperty
|
import net.corda.node.services.messaging.ArtemisMessagingServer.Companion.ipDetectRequestProperty
|
||||||
import net.corda.node.services.messaging.ArtemisMessagingServer.Companion.ipDetectResponseProperty
|
import net.corda.node.services.messaging.ArtemisMessagingServer.Companion.ipDetectResponseProperty
|
||||||
@ -62,8 +64,9 @@ import kotlin.system.exitProcess
|
|||||||
*/
|
*/
|
||||||
open class Node(override val configuration: FullNodeConfiguration,
|
open class Node(override val configuration: FullNodeConfiguration,
|
||||||
versionInfo: VersionInfo,
|
versionInfo: VersionInfo,
|
||||||
val initialiseSerialization: Boolean = true
|
val initialiseSerialization: Boolean = true,
|
||||||
) : AbstractNode(configuration, createClock(configuration), versionInfo) {
|
cordappLoader: CordappLoader = makeCordappLoader(configuration)
|
||||||
|
) : AbstractNode(configuration, createClock(configuration), versionInfo, cordappLoader) {
|
||||||
companion object {
|
companion object {
|
||||||
private val logger = loggerFor<Node>()
|
private val logger = loggerFor<Node>()
|
||||||
var renderBasicInfoToConsole = true
|
var renderBasicInfoToConsole = true
|
||||||
@ -86,6 +89,13 @@ open class Node(override val configuration: FullNodeConfiguration,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private val sameVmNodeCounter = AtomicInteger()
|
private val sameVmNodeCounter = AtomicInteger()
|
||||||
|
val scanPackagesSystemProperty = "net.corda.node.cordapp.scan.packages"
|
||||||
|
val scanPackagesSeparator = ","
|
||||||
|
private fun makeCordappLoader(configuration: NodeConfiguration): CordappLoader {
|
||||||
|
return System.getProperty(scanPackagesSystemProperty)?.let { scanPackages ->
|
||||||
|
CordappLoader.createDefaultWithTestPackages(configuration, scanPackages.split(scanPackagesSeparator))
|
||||||
|
} ?: CordappLoader.createDefault(configuration.baseDirectory)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override val log: Logger get() = logger
|
override val log: Logger get() = logger
|
||||||
|
@ -14,6 +14,7 @@ import net.corda.core.serialization.SerializationWhitelist
|
|||||||
import net.corda.core.serialization.SerializeAsToken
|
import net.corda.core.serialization.SerializeAsToken
|
||||||
import net.corda.core.utilities.loggerFor
|
import net.corda.core.utilities.loggerFor
|
||||||
import net.corda.node.internal.classloading.requireAnnotation
|
import net.corda.node.internal.classloading.requireAnnotation
|
||||||
|
import net.corda.node.services.config.NodeConfiguration
|
||||||
import net.corda.nodeapi.internal.serialization.DefaultWhitelist
|
import net.corda.nodeapi.internal.serialization.DefaultWhitelist
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileOutputStream
|
import java.io.FileOutputStream
|
||||||
@ -64,14 +65,12 @@ class CordappLoader private constructor(private val cordappJarPaths: List<URL>)
|
|||||||
/**
|
/**
|
||||||
* Create a dev mode CordappLoader for test environments that creates and loads cordapps from the classpath
|
* Create a dev mode CordappLoader for test environments that creates and loads cordapps from the classpath
|
||||||
* and plugins directory. This is intended mostly for use by the driver.
|
* and plugins directory. This is intended mostly for use by the driver.
|
||||||
*
|
|
||||||
* @param baseDir See [createDefault.baseDir]
|
|
||||||
* @param testPackages See [createWithTestPackages.testPackages]
|
|
||||||
*/
|
*/
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
@JvmOverloads
|
fun createDefaultWithTestPackages(configuration: NodeConfiguration, testPackages: List<String>): CordappLoader {
|
||||||
fun createDefaultWithTestPackages(baseDir: Path, testPackages: List<String> = CordappLoader.testPackages)
|
check(configuration.devMode) { "Package scanning can only occur in dev mode" }
|
||||||
= CordappLoader(getCordappsInDirectory(getPluginsPath(baseDir)) + testPackages.flatMap(this::createScanPackage))
|
return CordappLoader(getCordappsInDirectory(getPluginsPath(configuration.baseDirectory)) + testPackages.flatMap(this::createScanPackage))
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a dev mode CordappLoader for test environments that creates and loads cordapps from the classpath.
|
* Create a dev mode CordappLoader for test environments that creates and loads cordapps from the classpath.
|
||||||
@ -81,8 +80,7 @@ class CordappLoader private constructor(private val cordappJarPaths: List<URL>)
|
|||||||
* CorDapps.
|
* CorDapps.
|
||||||
*/
|
*/
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
@JvmOverloads
|
fun createWithTestPackages(testPackages: List<String>)
|
||||||
fun createWithTestPackages(testPackages: List<String> = CordappLoader.testPackages)
|
|
||||||
= CordappLoader(testPackages.flatMap(this::createScanPackage))
|
= CordappLoader(testPackages.flatMap(this::createScanPackage))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -147,11 +145,6 @@ class CordappLoader private constructor(private val cordappJarPaths: List<URL>)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* A list of test packages that will be scanned as CorDapps and compiled into CorDapp JARs for use in tests only.
|
|
||||||
*/
|
|
||||||
@VisibleForTesting
|
|
||||||
var testPackages: List<String> = emptyList()
|
|
||||||
private val generatedCordapps = mutableMapOf<URL, URI>()
|
private val generatedCordapps = mutableMapOf<URL, URI>()
|
||||||
|
|
||||||
/** A list of the core RPC flows present in Corda */
|
/** A list of the core RPC flows present in Corda */
|
||||||
|
@ -43,15 +43,15 @@ public class VaultQueryJavaTests extends TestDependencyInjectionBase {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
setCordappPackages("net.corda.testing.contracts", "net.corda.finance.contracts.asset");
|
List<String> cordappPackages = Arrays.asList("net.corda.testing.contracts", "net.corda.finance.contracts.asset");
|
||||||
ArrayList<KeyPair> keys = new ArrayList<>();
|
ArrayList<KeyPair> keys = new ArrayList<>();
|
||||||
keys.add(getMEGA_CORP_KEY());
|
keys.add(getMEGA_CORP_KEY());
|
||||||
keys.add(getDUMMY_NOTARY_KEY());
|
keys.add(getDUMMY_NOTARY_KEY());
|
||||||
Set<MappedSchema> requiredSchemas = Collections.singleton(CashSchemaV1.INSTANCE);
|
Set<MappedSchema> requiredSchemas = Collections.singleton(CashSchemaV1.INSTANCE);
|
||||||
IdentityService identitySvc = makeTestIdentityService();
|
IdentityService identitySvc = makeTestIdentityService();
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
Pair<CordaPersistence, MockServices> databaseAndServices = makeTestDatabaseAndMockServices(requiredSchemas, keys, () -> identitySvc, Collections.EMPTY_LIST);
|
Pair<CordaPersistence, MockServices> databaseAndServices = makeTestDatabaseAndMockServices(requiredSchemas, keys, () -> identitySvc, cordappPackages);
|
||||||
issuerServices = new MockServices(getDUMMY_CASH_ISSUER_KEY(), getBOC_KEY());
|
issuerServices = new MockServices(cordappPackages, getDUMMY_CASH_ISSUER_KEY(), getBOC_KEY());
|
||||||
database = databaseAndServices.getFirst();
|
database = databaseAndServices.getFirst();
|
||||||
services = databaseAndServices.getSecond();
|
services = databaseAndServices.getSecond();
|
||||||
vaultService = services.getVaultService();
|
vaultService = services.getVaultService();
|
||||||
@ -60,7 +60,6 @@ public class VaultQueryJavaTests extends TestDependencyInjectionBase {
|
|||||||
@After
|
@After
|
||||||
public void cleanUp() throws IOException {
|
public void cleanUp() throws IOException {
|
||||||
database.close();
|
database.close();
|
||||||
unsetCordappPackages();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -62,9 +62,7 @@ class CordaRPCOpsImplTest {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
setCordappPackages("net.corda.finance.contracts.asset")
|
mockNet = MockNetwork(cordappPackages = listOf("net.corda.finance.contracts.asset"))
|
||||||
|
|
||||||
mockNet = MockNetwork()
|
|
||||||
aliceNode = mockNet.createNode()
|
aliceNode = mockNet.createNode()
|
||||||
notaryNode = mockNet.createNotaryNode(validating = false)
|
notaryNode = mockNet.createNotaryNode(validating = false)
|
||||||
rpc = CordaRPCOpsImpl(aliceNode.services, aliceNode.smm, aliceNode.database)
|
rpc = CordaRPCOpsImpl(aliceNode.services, aliceNode.smm, aliceNode.database)
|
||||||
@ -81,7 +79,6 @@ class CordaRPCOpsImplTest {
|
|||||||
@After
|
@After
|
||||||
fun cleanUp() {
|
fun cleanUp() {
|
||||||
mockNet.stopNodes()
|
mockNet.stopNodes()
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -100,7 +97,6 @@ class CordaRPCOpsImplTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Tell the monitoring service node to issue some cash
|
// Tell the monitoring service node to issue some cash
|
||||||
val recipient = aliceNode.info.chooseIdentity()
|
|
||||||
val result = rpc.startFlow(::CashIssueFlow, Amount(quantity, GBP), ref, notary)
|
val result = rpc.startFlow(::CashIssueFlow, Amount(quantity, GBP), ref, notary)
|
||||||
mockNet.runNetwork()
|
mockNet.runNetwork()
|
||||||
|
|
||||||
|
@ -15,8 +15,6 @@ import net.corda.finance.flows.CashIssueFlow
|
|||||||
import net.corda.node.internal.cordapp.DummyRPCFlow
|
import net.corda.node.internal.cordapp.DummyRPCFlow
|
||||||
import net.corda.testing.DUMMY_NOTARY
|
import net.corda.testing.DUMMY_NOTARY
|
||||||
import net.corda.testing.node.MockNetwork
|
import net.corda.testing.node.MockNetwork
|
||||||
import net.corda.testing.setCordappPackages
|
|
||||||
import net.corda.testing.unsetCordappPackages
|
|
||||||
import org.junit.After
|
import org.junit.After
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@ -74,9 +72,7 @@ class TestCordaService2(val appServiceHub: AppServiceHub): SingletonSerializeAsT
|
|||||||
}
|
}
|
||||||
|
|
||||||
@CordaService
|
@CordaService
|
||||||
class LegacyCordaService(val simpleServiceHub: ServiceHub): SingletonSerializeAsToken() {
|
class LegacyCordaService(@Suppress("UNUSED_PARAMETER") simpleServiceHub: ServiceHub) : SingletonSerializeAsToken()
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class CordaServiceTest {
|
class CordaServiceTest {
|
||||||
lateinit var mockNet: MockNetwork
|
lateinit var mockNet: MockNetwork
|
||||||
@ -85,8 +81,7 @@ class CordaServiceTest {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun start() {
|
fun start() {
|
||||||
setCordappPackages("net.corda.node.internal","net.corda.finance")
|
mockNet = MockNetwork(threadPerNode = true, cordappPackages = listOf("net.corda.node.internal","net.corda.finance"))
|
||||||
mockNet = MockNetwork(threadPerNode = true)
|
|
||||||
notaryNode = mockNet.createNotaryNode(legalName = DUMMY_NOTARY.name, validating = true)
|
notaryNode = mockNet.createNotaryNode(legalName = DUMMY_NOTARY.name, validating = true)
|
||||||
nodeA = mockNet.createNode()
|
nodeA = mockNet.createNode()
|
||||||
mockNet.startNodes()
|
mockNet.startNodes()
|
||||||
@ -95,7 +90,6 @@ class CordaServiceTest {
|
|||||||
@After
|
@After
|
||||||
fun cleanUp() {
|
fun cleanUp() {
|
||||||
mockNet.stopNodes()
|
mockNet.stopNodes()
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -45,6 +45,7 @@ import net.corda.testing.*
|
|||||||
import net.corda.testing.contracts.fillWithSomeTestCash
|
import net.corda.testing.contracts.fillWithSomeTestCash
|
||||||
import net.corda.testing.node.InMemoryMessagingNetwork
|
import net.corda.testing.node.InMemoryMessagingNetwork
|
||||||
import net.corda.testing.node.MockNetwork
|
import net.corda.testing.node.MockNetwork
|
||||||
|
import net.corda.testing.node.MockServices
|
||||||
import net.corda.testing.node.pumpReceive
|
import net.corda.testing.node.pumpReceive
|
||||||
import org.assertj.core.api.Assertions.assertThat
|
import org.assertj.core.api.Assertions.assertThat
|
||||||
import org.junit.After
|
import org.junit.After
|
||||||
@ -73,6 +74,7 @@ import kotlin.test.assertTrue
|
|||||||
@RunWith(Parameterized::class)
|
@RunWith(Parameterized::class)
|
||||||
class TwoPartyTradeFlowTests(val anonymous: Boolean) {
|
class TwoPartyTradeFlowTests(val anonymous: Boolean) {
|
||||||
companion object {
|
companion object {
|
||||||
|
private val cordappPackages = listOf("net.corda.finance.contracts")
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@Parameterized.Parameters
|
@Parameterized.Parameters
|
||||||
fun data(): Collection<Boolean> {
|
fun data(): Collection<Boolean> {
|
||||||
@ -84,7 +86,6 @@ class TwoPartyTradeFlowTests(val anonymous: Boolean) {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun before() {
|
fun before() {
|
||||||
setCordappPackages("net.corda.finance.contracts")
|
|
||||||
LogHelper.setLevel("platform.trade", "core.contract.TransactionGroup", "recordingmap")
|
LogHelper.setLevel("platform.trade", "core.contract.TransactionGroup", "recordingmap")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +93,6 @@ class TwoPartyTradeFlowTests(val anonymous: Boolean) {
|
|||||||
fun after() {
|
fun after() {
|
||||||
mockNet.stopNodes()
|
mockNet.stopNodes()
|
||||||
LogHelper.reset("platform.trade", "core.contract.TransactionGroup", "recordingmap")
|
LogHelper.reset("platform.trade", "core.contract.TransactionGroup", "recordingmap")
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -100,9 +100,8 @@ class TwoPartyTradeFlowTests(val anonymous: Boolean) {
|
|||||||
// We run this in parallel threads to help catch any race conditions that may exist. The other tests
|
// We run this in parallel threads to help catch any race conditions that may exist. The other tests
|
||||||
// we run in the unit test thread exclusively to speed things up, ensure deterministic results and
|
// we run in the unit test thread exclusively to speed things up, ensure deterministic results and
|
||||||
// allow interruption half way through.
|
// allow interruption half way through.
|
||||||
mockNet = MockNetwork(false, true)
|
mockNet = MockNetwork(false, true, cordappPackages = cordappPackages)
|
||||||
|
ledger(MockServices(cordappPackages), initialiseSerialization = false) {
|
||||||
ledger(initialiseSerialization = false) {
|
|
||||||
val notaryNode = mockNet.createNotaryNode()
|
val notaryNode = mockNet.createNotaryNode()
|
||||||
val aliceNode = mockNet.createPartyNode(ALICE.name)
|
val aliceNode = mockNet.createPartyNode(ALICE.name)
|
||||||
val bobNode = mockNet.createPartyNode(BOB.name)
|
val bobNode = mockNet.createPartyNode(BOB.name)
|
||||||
@ -149,9 +148,8 @@ class TwoPartyTradeFlowTests(val anonymous: Boolean) {
|
|||||||
|
|
||||||
@Test(expected = InsufficientBalanceException::class)
|
@Test(expected = InsufficientBalanceException::class)
|
||||||
fun `trade cash for commercial paper fails using soft locking`() {
|
fun `trade cash for commercial paper fails using soft locking`() {
|
||||||
mockNet = MockNetwork(false, true)
|
mockNet = MockNetwork(false, true, cordappPackages = cordappPackages)
|
||||||
|
ledger(MockServices(cordappPackages), initialiseSerialization = false) {
|
||||||
ledger(initialiseSerialization = false) {
|
|
||||||
val notaryNode = mockNet.createNotaryNode()
|
val notaryNode = mockNet.createNotaryNode()
|
||||||
val aliceNode = mockNet.createPartyNode(ALICE.name)
|
val aliceNode = mockNet.createPartyNode(ALICE.name)
|
||||||
val bobNode = mockNet.createPartyNode(BOB.name)
|
val bobNode = mockNet.createPartyNode(BOB.name)
|
||||||
@ -204,8 +202,8 @@ class TwoPartyTradeFlowTests(val anonymous: Boolean) {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `shutdown and restore`() {
|
fun `shutdown and restore`() {
|
||||||
mockNet = MockNetwork(false)
|
mockNet = MockNetwork(false, cordappPackages = cordappPackages)
|
||||||
ledger(initialiseSerialization = false) {
|
ledger(MockServices(cordappPackages), initialiseSerialization = false) {
|
||||||
val notaryNode = mockNet.createNotaryNode()
|
val notaryNode = mockNet.createNotaryNode()
|
||||||
val aliceNode = mockNet.createPartyNode(ALICE.name)
|
val aliceNode = mockNet.createPartyNode(ALICE.name)
|
||||||
var bobNode = mockNet.createPartyNode(BOB.name)
|
var bobNode = mockNet.createPartyNode(BOB.name)
|
||||||
@ -222,8 +220,6 @@ class TwoPartyTradeFlowTests(val anonymous: Boolean) {
|
|||||||
bobNode.internals.disableDBCloseOnStop()
|
bobNode.internals.disableDBCloseOnStop()
|
||||||
|
|
||||||
val bobAddr = bobNode.network.myAddress as InMemoryMessagingNetwork.PeerHandle
|
val bobAddr = bobNode.network.myAddress as InMemoryMessagingNetwork.PeerHandle
|
||||||
val networkMapAddress = notaryNode.network.myAddress
|
|
||||||
|
|
||||||
mockNet.runNetwork() // Clear network map registration messages
|
mockNet.runNetwork() // Clear network map registration messages
|
||||||
val notary = aliceNode.services.getDefaultNotary()
|
val notary = aliceNode.services.getDefaultNotary()
|
||||||
|
|
||||||
@ -331,8 +327,7 @@ class TwoPartyTradeFlowTests(val anonymous: Boolean) {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `check dependencies of sale asset are resolved`() {
|
fun `check dependencies of sale asset are resolved`() {
|
||||||
mockNet = MockNetwork(false)
|
mockNet = MockNetwork(false, cordappPackages = cordappPackages)
|
||||||
|
|
||||||
val notaryNode = mockNet.createNotaryNode()
|
val notaryNode = mockNet.createNotaryNode()
|
||||||
val aliceNode = makeNodeWithTracking(ALICE.name)
|
val aliceNode = makeNodeWithTracking(ALICE.name)
|
||||||
val bobNode = makeNodeWithTracking(BOB.name)
|
val bobNode = makeNodeWithTracking(BOB.name)
|
||||||
@ -436,8 +431,7 @@ class TwoPartyTradeFlowTests(val anonymous: Boolean) {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `track works`() {
|
fun `track works`() {
|
||||||
mockNet = MockNetwork(false)
|
mockNet = MockNetwork(false, cordappPackages = cordappPackages)
|
||||||
|
|
||||||
val notaryNode = mockNet.createNotaryNode()
|
val notaryNode = mockNet.createNotaryNode()
|
||||||
val aliceNode = makeNodeWithTracking(ALICE.name)
|
val aliceNode = makeNodeWithTracking(ALICE.name)
|
||||||
val bobNode = makeNodeWithTracking(BOB.name)
|
val bobNode = makeNodeWithTracking(BOB.name)
|
||||||
@ -517,16 +511,16 @@ class TwoPartyTradeFlowTests(val anonymous: Boolean) {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `dependency with error on buyer side`() {
|
fun `dependency with error on buyer side`() {
|
||||||
mockNet = MockNetwork(false)
|
mockNet = MockNetwork(false, cordappPackages = cordappPackages)
|
||||||
ledger(initialiseSerialization = false) {
|
ledger(MockServices(cordappPackages), initialiseSerialization = false) {
|
||||||
runWithError(true, false, "at least one cash input")
|
runWithError(true, false, "at least one cash input")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `dependency with error on seller side`() {
|
fun `dependency with error on seller side`() {
|
||||||
mockNet = MockNetwork(false)
|
mockNet = MockNetwork(false, cordappPackages = cordappPackages)
|
||||||
ledger(initialiseSerialization = false) {
|
ledger(MockServices(cordappPackages), initialiseSerialization = false) {
|
||||||
runWithError(false, true, "Issuances have a time-window")
|
runWithError(false, true, "Issuances have a time-window")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,7 @@ class NotaryChangeTests {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setUp() {
|
fun setUp() {
|
||||||
setCordappPackages("net.corda.testing.contracts")
|
mockNet = MockNetwork(cordappPackages = listOf("net.corda.testing.contracts"))
|
||||||
mockNet = MockNetwork()
|
|
||||||
oldNotaryNode = mockNet.createNotaryNode(legalName = DUMMY_NOTARY.name)
|
oldNotaryNode = mockNet.createNotaryNode(legalName = DUMMY_NOTARY.name)
|
||||||
clientNodeA = mockNet.createNode()
|
clientNodeA = mockNet.createNode()
|
||||||
clientNodeB = mockNet.createNode()
|
clientNodeB = mockNet.createNode()
|
||||||
@ -50,7 +49,6 @@ class NotaryChangeTests {
|
|||||||
@After
|
@After
|
||||||
fun cleanUp() {
|
fun cleanUp() {
|
||||||
mockNet.stopNodes()
|
mockNet.stopNodes()
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -72,7 +72,6 @@ class NodeSchedulerServiceTest : SingletonSerializeAsToken() {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
setCordappPackages("net.corda.testing.contracts")
|
|
||||||
initialiseTestSerialization()
|
initialiseTestSerialization()
|
||||||
countDown = CountDownLatch(1)
|
countDown = CountDownLatch(1)
|
||||||
smmHasRemovedAllFlows = CountDownLatch(1)
|
smmHasRemovedAllFlows = CountDownLatch(1)
|
||||||
@ -98,7 +97,7 @@ class NodeSchedulerServiceTest : SingletonSerializeAsToken() {
|
|||||||
network = mockMessagingService), TestReference {
|
network = mockMessagingService), TestReference {
|
||||||
override val vaultService: VaultServiceInternal = NodeVaultService(testClock, kms, stateLoader, database.hibernateConfig)
|
override val vaultService: VaultServiceInternal = NodeVaultService(testClock, kms, stateLoader, database.hibernateConfig)
|
||||||
override val testReference = this@NodeSchedulerServiceTest
|
override val testReference = this@NodeSchedulerServiceTest
|
||||||
override val cordappProvider: CordappProviderImpl = CordappProviderImpl(CordappLoader.createWithTestPackages()).start(attachments)
|
override val cordappProvider = CordappProviderImpl(CordappLoader.createWithTestPackages(listOf("net.corda.testing.contracts"))).start(attachments)
|
||||||
}
|
}
|
||||||
smmExecutor = AffinityExecutor.ServiceAffinityExecutor("test", 1)
|
smmExecutor = AffinityExecutor.ServiceAffinityExecutor("test", 1)
|
||||||
scheduler = NodeSchedulerService(services, schedulerGatedExecutor, serverThread = smmExecutor)
|
scheduler = NodeSchedulerService(services, schedulerGatedExecutor, serverThread = smmExecutor)
|
||||||
@ -124,7 +123,6 @@ class NodeSchedulerServiceTest : SingletonSerializeAsToken() {
|
|||||||
smmExecutor.awaitTermination(60, TimeUnit.SECONDS)
|
smmExecutor.awaitTermination(60, TimeUnit.SECONDS)
|
||||||
database.close()
|
database.close()
|
||||||
resetTestSerialization()
|
resetTestSerialization()
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestState(val flowLogicRef: FlowLogicRef, val instant: Instant, val myIdentity: Party) : LinearState, SchedulableState {
|
class TestState(val flowLogicRef: FlowLogicRef, val instant: Instant, val myIdentity: Party) : LinearState, SchedulableState {
|
||||||
|
@ -91,8 +91,7 @@ class ScheduledFlowTests {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
setCordappPackages("net.corda.testing.contracts")
|
mockNet = MockNetwork(threadPerNode = true, cordappPackages = listOf("net.corda.testing.contracts"))
|
||||||
mockNet = MockNetwork(threadPerNode = true)
|
|
||||||
notaryNode = mockNet.createNotaryNode(legalName = DUMMY_NOTARY.name)
|
notaryNode = mockNet.createNotaryNode(legalName = DUMMY_NOTARY.name)
|
||||||
val a = mockNet.createUnstartedNode()
|
val a = mockNet.createUnstartedNode()
|
||||||
val b = mockNet.createUnstartedNode()
|
val b = mockNet.createUnstartedNode()
|
||||||
@ -107,7 +106,6 @@ class ScheduledFlowTests {
|
|||||||
@After
|
@After
|
||||||
fun cleanUp() {
|
fun cleanUp() {
|
||||||
mockNet.stopNodes()
|
mockNet.stopNodes()
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -73,14 +73,14 @@ class HibernateConfigurationTest : TestDependencyInjectionBase() {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setUp() {
|
fun setUp() {
|
||||||
setCordappPackages("net.corda.testing.contracts", "net.corda.finance.contracts.asset")
|
val cordappPackages = listOf("net.corda.testing.contracts", "net.corda.finance.contracts.asset")
|
||||||
issuerServices = MockServices(DUMMY_CASH_ISSUER_KEY, BOB_KEY, BOC_KEY)
|
issuerServices = MockServices(cordappPackages, DUMMY_CASH_ISSUER_KEY, BOB_KEY, BOC_KEY)
|
||||||
val dataSourceProps = makeTestDataSourceProperties()
|
val dataSourceProps = makeTestDataSourceProperties()
|
||||||
val defaultDatabaseProperties = makeTestDatabaseProperties()
|
val defaultDatabaseProperties = makeTestDatabaseProperties()
|
||||||
database = configureDatabase(dataSourceProps, defaultDatabaseProperties, NodeSchemaService(), ::makeTestIdentityService)
|
database = configureDatabase(dataSourceProps, defaultDatabaseProperties, NodeSchemaService(), ::makeTestIdentityService)
|
||||||
database.transaction {
|
database.transaction {
|
||||||
hibernateConfig = database.hibernateConfig
|
hibernateConfig = database.hibernateConfig
|
||||||
services = object : MockServices(BOB_KEY, BOC_KEY, DUMMY_NOTARY_KEY) {
|
services = object : MockServices(cordappPackages, BOB_KEY, BOC_KEY, DUMMY_NOTARY_KEY) {
|
||||||
override val vaultService = makeVaultService(database.hibernateConfig)
|
override val vaultService = makeVaultService(database.hibernateConfig)
|
||||||
override fun recordTransactions(notifyVault: Boolean, txs: Iterable<SignedTransaction>) {
|
override fun recordTransactions(notifyVault: Boolean, txs: Iterable<SignedTransaction>) {
|
||||||
for (stx in txs) {
|
for (stx in txs) {
|
||||||
@ -105,7 +105,6 @@ class HibernateConfigurationTest : TestDependencyInjectionBase() {
|
|||||||
@After
|
@After
|
||||||
fun cleanUp() {
|
fun cleanUp() {
|
||||||
database.close()
|
database.close()
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpDb() {
|
private fun setUpDb() {
|
||||||
|
@ -65,8 +65,7 @@ class FlowFrameworkTests {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun start() {
|
fun start() {
|
||||||
setCordappPackages("net.corda.finance.contracts", "net.corda.testing.contracts")
|
mockNet = MockNetwork(servicePeerAllocationStrategy = RoundRobin(), cordappPackages = listOf("net.corda.finance.contracts", "net.corda.testing.contracts"))
|
||||||
mockNet = MockNetwork(servicePeerAllocationStrategy = RoundRobin())
|
|
||||||
node1 = mockNet.createNode()
|
node1 = mockNet.createNode()
|
||||||
node2 = mockNet.createNode()
|
node2 = mockNet.createNode()
|
||||||
|
|
||||||
@ -87,7 +86,6 @@ class FlowFrameworkTests {
|
|||||||
fun cleanUp() {
|
fun cleanUp() {
|
||||||
mockNet.stopNodes()
|
mockNet.stopNodes()
|
||||||
receivedSessionMessages.clear()
|
receivedSessionMessages.clear()
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -33,8 +33,7 @@ class NotaryServiceTests {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
setCordappPackages("net.corda.testing.contracts")
|
mockNet = MockNetwork(cordappPackages = listOf("net.corda.testing.contracts"))
|
||||||
mockNet = MockNetwork()
|
|
||||||
notaryNode = mockNet.createNotaryNode(legalName = DUMMY_NOTARY.name, validating = false)
|
notaryNode = mockNet.createNotaryNode(legalName = DUMMY_NOTARY.name, validating = false)
|
||||||
clientNode = mockNet.createNode()
|
clientNode = mockNet.createNode()
|
||||||
mockNet.runNetwork() // Clear network map registration messages
|
mockNet.runNetwork() // Clear network map registration messages
|
||||||
@ -45,7 +44,6 @@ class NotaryServiceTests {
|
|||||||
@After
|
@After
|
||||||
fun cleanUp() {
|
fun cleanUp() {
|
||||||
mockNet.stopNodes()
|
mockNet.stopNodes()
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -33,8 +33,7 @@ class ValidatingNotaryServiceTests {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
setCordappPackages("net.corda.testing.contracts")
|
mockNet = MockNetwork(cordappPackages = listOf("net.corda.testing.contracts"))
|
||||||
mockNet = MockNetwork()
|
|
||||||
notaryNode = mockNet.createNotaryNode(legalName = DUMMY_NOTARY.name)
|
notaryNode = mockNet.createNotaryNode(legalName = DUMMY_NOTARY.name)
|
||||||
clientNode = mockNet.createNode()
|
clientNode = mockNet.createNode()
|
||||||
mockNet.runNetwork() // Clear network map registration messages
|
mockNet.runNetwork() // Clear network map registration messages
|
||||||
@ -45,7 +44,6 @@ class ValidatingNotaryServiceTests {
|
|||||||
@After
|
@After
|
||||||
fun cleanUp() {
|
fun cleanUp() {
|
||||||
mockNet.stopNodes()
|
mockNet.stopNodes()
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -45,27 +45,30 @@ import kotlin.test.assertFalse
|
|||||||
import kotlin.test.assertTrue
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
class NodeVaultServiceTest : TestDependencyInjectionBase() {
|
class NodeVaultServiceTest : TestDependencyInjectionBase() {
|
||||||
|
companion object {
|
||||||
|
private val cordappPackages = listOf("net.corda.finance.contracts.asset")
|
||||||
|
}
|
||||||
|
|
||||||
lateinit var services: MockServices
|
lateinit var services: MockServices
|
||||||
lateinit var issuerServices: MockServices
|
private lateinit var issuerServices: MockServices
|
||||||
val vaultService get() = services.vaultService as NodeVaultService
|
val vaultService get() = services.vaultService as NodeVaultService
|
||||||
lateinit var database: CordaPersistence
|
lateinit var database: CordaPersistence
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setUp() {
|
fun setUp() {
|
||||||
setCordappPackages("net.corda.finance.contracts.asset")
|
|
||||||
LogHelper.setLevel(NodeVaultService::class)
|
LogHelper.setLevel(NodeVaultService::class)
|
||||||
val databaseAndServices = makeTestDatabaseAndMockServices(keys = listOf(BOC_KEY, DUMMY_CASH_ISSUER_KEY),
|
val databaseAndServices = makeTestDatabaseAndMockServices(keys = listOf(BOC_KEY, DUMMY_CASH_ISSUER_KEY),
|
||||||
customSchemas = setOf(CashSchemaV1))
|
customSchemas = setOf(CashSchemaV1),
|
||||||
|
cordappPackages = cordappPackages)
|
||||||
database = databaseAndServices.first
|
database = databaseAndServices.first
|
||||||
services = databaseAndServices.second
|
services = databaseAndServices.second
|
||||||
issuerServices = MockServices(DUMMY_CASH_ISSUER_KEY, BOC_KEY)
|
issuerServices = MockServices(cordappPackages, DUMMY_CASH_ISSUER_KEY, BOC_KEY)
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
fun tearDown() {
|
fun tearDown() {
|
||||||
database.close()
|
database.close()
|
||||||
LogHelper.reset(NodeVaultService::class)
|
LogHelper.reset(NodeVaultService::class)
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suspendable
|
@Suspendable
|
||||||
@ -440,8 +443,7 @@ class NodeVaultServiceTest : TestDependencyInjectionBase() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun addNoteToTransaction() {
|
fun addNoteToTransaction() {
|
||||||
val megaCorpServices = MockServices(MEGA_CORP_KEY)
|
val megaCorpServices = MockServices(cordappPackages, MEGA_CORP_KEY)
|
||||||
|
|
||||||
database.transaction {
|
database.transaction {
|
||||||
val freshKey = services.myInfo.chooseIdentity().owningKey
|
val freshKey = services.myInfo.chooseIdentity().owningKey
|
||||||
|
|
||||||
|
@ -45,6 +45,9 @@ import java.time.temporal.ChronoUnit
|
|||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class VaultQueryTests : TestDependencyInjectionBase() {
|
class VaultQueryTests : TestDependencyInjectionBase() {
|
||||||
|
companion object {
|
||||||
|
private val cordappPackages = listOf("net.corda.testing.contracts", "net.corda.finance.contracts")
|
||||||
|
}
|
||||||
|
|
||||||
private lateinit var services: MockServices
|
private lateinit var services: MockServices
|
||||||
private lateinit var notaryServices: MockServices
|
private lateinit var notaryServices: MockServices
|
||||||
@ -59,23 +62,21 @@ class VaultQueryTests : TestDependencyInjectionBase() {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setUp() {
|
fun setUp() {
|
||||||
setCordappPackages("net.corda.testing.contracts", "net.corda.finance.contracts")
|
|
||||||
|
|
||||||
// register additional identities
|
// register additional identities
|
||||||
identitySvc.verifyAndRegisterIdentity(CASH_NOTARY_IDENTITY)
|
identitySvc.verifyAndRegisterIdentity(CASH_NOTARY_IDENTITY)
|
||||||
identitySvc.verifyAndRegisterIdentity(BOC_IDENTITY)
|
identitySvc.verifyAndRegisterIdentity(BOC_IDENTITY)
|
||||||
val databaseAndServices = makeTestDatabaseAndMockServices(keys = listOf(MEGA_CORP_KEY, DUMMY_NOTARY_KEY),
|
val databaseAndServices = makeTestDatabaseAndMockServices(keys = listOf(MEGA_CORP_KEY, DUMMY_NOTARY_KEY),
|
||||||
createIdentityService = { identitySvc },
|
createIdentityService = { identitySvc },
|
||||||
customSchemas = setOf(CashSchemaV1, CommercialPaperSchemaV1, DummyLinearStateSchemaV1))
|
customSchemas = setOf(CashSchemaV1, CommercialPaperSchemaV1, DummyLinearStateSchemaV1),
|
||||||
|
cordappPackages = cordappPackages)
|
||||||
database = databaseAndServices.first
|
database = databaseAndServices.first
|
||||||
services = databaseAndServices.second
|
services = databaseAndServices.second
|
||||||
notaryServices = MockServices(DUMMY_NOTARY_KEY, DUMMY_CASH_ISSUER_KEY, BOC_KEY, MEGA_CORP_KEY)
|
notaryServices = MockServices(cordappPackages, DUMMY_NOTARY_KEY, DUMMY_CASH_ISSUER_KEY, BOC_KEY, MEGA_CORP_KEY)
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
fun tearDown() {
|
fun tearDown() {
|
||||||
database.close()
|
database.close()
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1490,18 +1491,16 @@ class VaultQueryTests : TestDependencyInjectionBase() {
|
|||||||
// GBP issuer
|
// GBP issuer
|
||||||
val gbpCashIssuerKey = entropyToKeyPair(BigInteger.valueOf(1001))
|
val gbpCashIssuerKey = entropyToKeyPair(BigInteger.valueOf(1001))
|
||||||
val gbpCashIssuer = Party(CordaX500Name(organisation = "British Pounds Cash Issuer", locality = "London", country = "GB"), gbpCashIssuerKey.public).ref(1)
|
val gbpCashIssuer = Party(CordaX500Name(organisation = "British Pounds Cash Issuer", locality = "London", country = "GB"), gbpCashIssuerKey.public).ref(1)
|
||||||
val gbpCashIssuerServices = MockServices(gbpCashIssuerKey)
|
val gbpCashIssuerServices = MockServices(cordappPackages, gbpCashIssuerKey)
|
||||||
// USD issuer
|
// USD issuer
|
||||||
val usdCashIssuerKey = entropyToKeyPair(BigInteger.valueOf(1002))
|
val usdCashIssuerKey = entropyToKeyPair(BigInteger.valueOf(1002))
|
||||||
val usdCashIssuer = Party(CordaX500Name(organisation = "US Dollars Cash Issuer", locality = "New York", country = "US"), usdCashIssuerKey.public).ref(1)
|
val usdCashIssuer = Party(CordaX500Name(organisation = "US Dollars Cash Issuer", locality = "New York", country = "US"), usdCashIssuerKey.public).ref(1)
|
||||||
val usdCashIssuerServices = MockServices(usdCashIssuerKey)
|
val usdCashIssuerServices = MockServices(cordappPackages, usdCashIssuerKey)
|
||||||
// CHF issuer
|
// CHF issuer
|
||||||
val chfCashIssuerKey = entropyToKeyPair(BigInteger.valueOf(1003))
|
val chfCashIssuerKey = entropyToKeyPair(BigInteger.valueOf(1003))
|
||||||
val chfCashIssuer = Party(CordaX500Name(organisation = "Swiss Francs Cash Issuer", locality = "Zurich", country = "CH"), chfCashIssuerKey.public).ref(1)
|
val chfCashIssuer = Party(CordaX500Name(organisation = "Swiss Francs Cash Issuer", locality = "Zurich", country = "CH"), chfCashIssuerKey.public).ref(1)
|
||||||
val chfCashIssuerServices = MockServices(chfCashIssuerKey)
|
val chfCashIssuerServices = MockServices(cordappPackages, chfCashIssuerKey)
|
||||||
|
|
||||||
database.transaction {
|
database.transaction {
|
||||||
|
|
||||||
services.fillWithSomeTestCash(100.POUNDS, gbpCashIssuerServices, DUMMY_NOTARY, 1, 1, Random(0L), issuedBy = (gbpCashIssuer))
|
services.fillWithSomeTestCash(100.POUNDS, gbpCashIssuerServices, DUMMY_NOTARY, 1, 1, Random(0L), issuedBy = (gbpCashIssuer))
|
||||||
services.fillWithSomeTestCash(100.DOLLARS, usdCashIssuerServices, DUMMY_NOTARY, 1, 1, Random(0L), issuedBy = (usdCashIssuer))
|
services.fillWithSomeTestCash(100.DOLLARS, usdCashIssuerServices, DUMMY_NOTARY, 1, 1, Random(0L), issuedBy = (usdCashIssuer))
|
||||||
services.fillWithSomeTestCash(100.SWISS_FRANCS, chfCashIssuerServices, DUMMY_NOTARY, 1, 1, Random(0L), issuedBy = (chfCashIssuer))
|
services.fillWithSomeTestCash(100.SWISS_FRANCS, chfCashIssuerServices, DUMMY_NOTARY, 1, 1, Random(0L), issuedBy = (chfCashIssuer))
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package net.corda.node.services.vaultService
|
package net.corda.node.services.vault
|
||||||
|
|
||||||
import net.corda.core.contracts.ContractState
|
import net.corda.core.contracts.ContractState
|
||||||
import net.corda.core.contracts.LinearState
|
import net.corda.core.contracts.LinearState
|
||||||
@ -34,6 +34,10 @@ import kotlin.test.assertEquals
|
|||||||
// TODO: Move this to the cash contract tests once mock services are further split up.
|
// TODO: Move this to the cash contract tests once mock services are further split up.
|
||||||
|
|
||||||
class VaultWithCashTest : TestDependencyInjectionBase() {
|
class VaultWithCashTest : TestDependencyInjectionBase() {
|
||||||
|
companion object {
|
||||||
|
private val cordappPackages = listOf("net.corda.testing.contracts", "net.corda.finance.contracts.asset")
|
||||||
|
}
|
||||||
|
|
||||||
lateinit var services: MockServices
|
lateinit var services: MockServices
|
||||||
lateinit var issuerServices: MockServices
|
lateinit var issuerServices: MockServices
|
||||||
val vaultService: VaultService get() = services.vaultService
|
val vaultService: VaultService get() = services.vaultService
|
||||||
@ -42,22 +46,20 @@ class VaultWithCashTest : TestDependencyInjectionBase() {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setUp() {
|
fun setUp() {
|
||||||
setCordappPackages("net.corda.testing.contracts", "net.corda.finance.contracts.asset")
|
|
||||||
|
|
||||||
LogHelper.setLevel(VaultWithCashTest::class)
|
LogHelper.setLevel(VaultWithCashTest::class)
|
||||||
val databaseAndServices = makeTestDatabaseAndMockServices(keys = listOf(DUMMY_CASH_ISSUER_KEY, DUMMY_NOTARY_KEY),
|
val databaseAndServices = makeTestDatabaseAndMockServices(keys = listOf(DUMMY_CASH_ISSUER_KEY, DUMMY_NOTARY_KEY),
|
||||||
customSchemas = setOf(CashSchemaV1))
|
customSchemas = setOf(CashSchemaV1),
|
||||||
|
cordappPackages = cordappPackages)
|
||||||
database = databaseAndServices.first
|
database = databaseAndServices.first
|
||||||
services = databaseAndServices.second
|
services = databaseAndServices.second
|
||||||
issuerServices = MockServices(DUMMY_CASH_ISSUER_KEY, MEGA_CORP_KEY)
|
issuerServices = MockServices(cordappPackages, DUMMY_CASH_ISSUER_KEY, MEGA_CORP_KEY)
|
||||||
notaryServices = MockServices(DUMMY_NOTARY_KEY)
|
notaryServices = MockServices(cordappPackages, DUMMY_NOTARY_KEY)
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
fun tearDown() {
|
fun tearDown() {
|
||||||
LogHelper.reset(VaultWithCashTest::class)
|
LogHelper.reset(VaultWithCashTest::class)
|
||||||
database.close()
|
database.close()
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -81,7 +83,7 @@ class VaultWithCashTest : TestDependencyInjectionBase() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `issue and spend total correctly and irrelevant ignored`() {
|
fun `issue and spend total correctly and irrelevant ignored`() {
|
||||||
val megaCorpServices = MockServices(MEGA_CORP_KEY)
|
val megaCorpServices = MockServices(cordappPackages, MEGA_CORP_KEY)
|
||||||
val freshKey = services.keyManagementService.freshKey()
|
val freshKey = services.keyManagementService.freshKey()
|
||||||
|
|
||||||
val usefulTX =
|
val usefulTX =
|
||||||
|
@ -14,7 +14,6 @@ import net.corda.finance.contracts.Fix
|
|||||||
import net.corda.finance.contracts.FixOf
|
import net.corda.finance.contracts.FixOf
|
||||||
import net.corda.finance.contracts.asset.CASH
|
import net.corda.finance.contracts.asset.CASH
|
||||||
import net.corda.finance.contracts.asset.Cash
|
import net.corda.finance.contracts.asset.Cash
|
||||||
import net.corda.finance.contracts.asset.ownedBy
|
|
||||||
import net.corda.irs.flows.RatesFixFlow
|
import net.corda.irs.flows.RatesFixFlow
|
||||||
import net.corda.node.utilities.CordaPersistence
|
import net.corda.node.utilities.CordaPersistence
|
||||||
import net.corda.node.utilities.configureDatabase
|
import net.corda.node.utilities.configureDatabase
|
||||||
@ -63,7 +62,6 @@ class NodeInterestRatesTest : TestDependencyInjectionBase() {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setUp() {
|
fun setUp() {
|
||||||
setCordappPackages("net.corda.finance.contracts")
|
|
||||||
database = configureDatabase(makeTestDataSourceProperties(), makeTestDatabaseProperties(), createIdentityService = ::makeTestIdentityService)
|
database = configureDatabase(makeTestDataSourceProperties(), makeTestDatabaseProperties(), createIdentityService = ::makeTestIdentityService)
|
||||||
database.transaction {
|
database.transaction {
|
||||||
oracle = createMockCordaService(services, NodeInterestRates::Oracle)
|
oracle = createMockCordaService(services, NodeInterestRates::Oracle)
|
||||||
@ -74,7 +72,6 @@ class NodeInterestRatesTest : TestDependencyInjectionBase() {
|
|||||||
@After
|
@After
|
||||||
fun tearDown() {
|
fun tearDown() {
|
||||||
database.close()
|
database.close()
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -203,7 +200,7 @@ class NodeInterestRatesTest : TestDependencyInjectionBase() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `network tearoff`() {
|
fun `network tearoff`() {
|
||||||
val mockNet = MockNetwork(initialiseSerialization = false)
|
val mockNet = MockNetwork(initialiseSerialization = false, cordappPackages = listOf("net.corda.finance.contracts"))
|
||||||
val n1 = mockNet.createNotaryNode()
|
val n1 = mockNet.createNotaryNode()
|
||||||
val oracleNode = mockNet.createNode().apply {
|
val oracleNode = mockNet.createNode().apply {
|
||||||
internals.registerInitiatedFlow(NodeInterestRates.FixQueryHandler::class.java)
|
internals.registerInitiatedFlow(NodeInterestRates.FixQueryHandler::class.java)
|
||||||
|
@ -141,7 +141,7 @@ abstract class Simulation(val networkSendManuallyPumped: Boolean,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val mockNet = MockNetwork(networkSendManuallyPumped, runAsync)
|
val mockNet = MockNetwork(networkSendManuallyPumped, runAsync, cordappPackages = listOf("net.corda.irs.contract", "net.corda.finance.contract"))
|
||||||
// This one must come first.
|
// This one must come first.
|
||||||
val networkMap = mockNet.startNetworkMapNode(nodeFactory = NetworkMapNodeFactory)
|
val networkMap = mockNet.startNetworkMapNode(nodeFactory = NetworkMapNodeFactory)
|
||||||
val notary = mockNet.createNotaryNode(validating = false, nodeFactory = NotaryNodeFactory)
|
val notary = mockNet.createNotaryNode(validating = false, nodeFactory = NotaryNodeFactory)
|
||||||
@ -255,7 +255,6 @@ abstract class Simulation(val networkSendManuallyPumped: Boolean,
|
|||||||
val networkInitialisationFinished = allOf(*mockNet.nodes.map { it.nodeReadyFuture.toCompletableFuture() }.toTypedArray())
|
val networkInitialisationFinished = allOf(*mockNet.nodes.map { it.nodeReadyFuture.toCompletableFuture() }.toTypedArray())
|
||||||
|
|
||||||
fun start(): Future<Unit> {
|
fun start(): Future<Unit> {
|
||||||
setCordappPackages("net.corda.irs.contract", "net.corda.finance.contract")
|
|
||||||
mockNet.startNodes()
|
mockNet.startNodes()
|
||||||
// Wait for all the nodes to have finished registering with the network map service.
|
// Wait for all the nodes to have finished registering with the network map service.
|
||||||
return networkInitialisationFinished.thenCompose { startMainSimulation() }
|
return networkInitialisationFinished.thenCompose { startMainSimulation() }
|
||||||
|
@ -2,25 +2,10 @@ package net.corda.netmap.simulation
|
|||||||
|
|
||||||
import net.corda.core.utilities.getOrThrow
|
import net.corda.core.utilities.getOrThrow
|
||||||
import net.corda.testing.LogHelper
|
import net.corda.testing.LogHelper
|
||||||
import net.corda.testing.setCordappPackages
|
|
||||||
import net.corda.testing.unsetCordappPackages
|
|
||||||
import org.junit.After
|
|
||||||
import org.junit.Before
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class IRSSimulationTest {
|
class IRSSimulationTest {
|
||||||
// TODO: These tests should be a lot more complete.
|
// TODO: These tests should be a lot more complete.
|
||||||
|
|
||||||
@Before
|
|
||||||
fun setup() {
|
|
||||||
setCordappPackages("net.corda.irs.contract")
|
|
||||||
}
|
|
||||||
|
|
||||||
@After
|
|
||||||
fun tearDown() {
|
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `runs to completion`() {
|
fun `runs to completion`() {
|
||||||
LogHelper.setLevel("+messages") // FIXME: Don't manipulate static state in tests.
|
LogHelper.setLevel("+messages") // FIXME: Don't manipulate static state in tests.
|
||||||
|
@ -11,8 +11,6 @@ import net.corda.vega.api.PortfolioApiUtils
|
|||||||
import net.corda.vega.api.SwapDataModel
|
import net.corda.vega.api.SwapDataModel
|
||||||
import net.corda.vega.api.SwapDataView
|
import net.corda.vega.api.SwapDataView
|
||||||
import org.assertj.core.api.Assertions.assertThat
|
import org.assertj.core.api.Assertions.assertThat
|
||||||
import org.junit.After
|
|
||||||
import org.junit.Before
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.math.BigDecimal
|
import java.math.BigDecimal
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
@ -26,19 +24,9 @@ class SimmValuationTest : IntegrationTestCategory {
|
|||||||
val testTradeId = "trade1"
|
val testTradeId = "trade1"
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
|
||||||
fun setup() {
|
|
||||||
setCordappPackages("net.corda.vega.contracts")
|
|
||||||
}
|
|
||||||
|
|
||||||
@After
|
|
||||||
fun tearDown() {
|
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `runs SIMM valuation demo`() {
|
fun `runs SIMM valuation demo`() {
|
||||||
driver(isDebug = true) {
|
driver(isDebug = true, extraCordappPackagesToScan = listOf("net.corda.vega.contracts")) {
|
||||||
startNotaryNode(DUMMY_NOTARY.name, validating = false).getOrThrow()
|
startNotaryNode(DUMMY_NOTARY.name, validating = false).getOrThrow()
|
||||||
val nodeAFuture = startNode(providedName = nodeALegalName)
|
val nodeAFuture = startNode(providedName = nodeALegalName)
|
||||||
val nodeBFuture = startNode(providedName = nodeBLegalName)
|
val nodeBFuture = startNode(providedName = nodeBLegalName)
|
||||||
|
@ -17,23 +17,10 @@ import net.corda.traderdemo.flow.BuyerFlow
|
|||||||
import net.corda.traderdemo.flow.CommercialPaperIssueFlow
|
import net.corda.traderdemo.flow.CommercialPaperIssueFlow
|
||||||
import net.corda.traderdemo.flow.SellerFlow
|
import net.corda.traderdemo.flow.SellerFlow
|
||||||
import org.assertj.core.api.Assertions.assertThat
|
import org.assertj.core.api.Assertions.assertThat
|
||||||
import org.junit.After
|
|
||||||
import org.junit.Before
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.util.concurrent.Executors
|
import java.util.concurrent.Executors
|
||||||
|
|
||||||
class TraderDemoTest : NodeBasedTest() {
|
class TraderDemoTest : NodeBasedTest(listOf("net.corda.finance.contracts.asset", "net.corda.finance.contracts")) {
|
||||||
|
|
||||||
@Before
|
|
||||||
fun setup() {
|
|
||||||
setCordappPackages("net.corda.finance.contracts.asset", "net.corda.finance.contracts")
|
|
||||||
}
|
|
||||||
|
|
||||||
@After
|
|
||||||
fun tearDown() {
|
|
||||||
unsetCordappPackages()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `runs trader demo`() {
|
fun `runs trader demo`() {
|
||||||
val demoUser = User("demo", "demo", setOf(startFlowPermission<SellerFlow>()))
|
val demoUser = User("demo", "demo", setOf(startFlowPermission<SellerFlow>()))
|
||||||
|
@ -46,8 +46,9 @@ fun transaction(
|
|||||||
transactionLabel: String? = null,
|
transactionLabel: String? = null,
|
||||||
transactionBuilder: TransactionBuilder = TransactionBuilder(notary = DUMMY_NOTARY),
|
transactionBuilder: TransactionBuilder = TransactionBuilder(notary = DUMMY_NOTARY),
|
||||||
initialiseSerialization: Boolean = true,
|
initialiseSerialization: Boolean = true,
|
||||||
|
cordappPackages: List<String> = emptyList(),
|
||||||
dsl: TransactionDSL<TransactionDSLInterpreter>.() -> EnforceVerifyOrFail
|
dsl: TransactionDSL<TransactionDSLInterpreter>.() -> EnforceVerifyOrFail
|
||||||
) = ledger(initialiseSerialization = initialiseSerialization) {
|
) = ledger(services = MockServices(cordappPackages), initialiseSerialization = initialiseSerialization) {
|
||||||
dsl(TransactionDSL(TestTransactionDSLInterpreter(this.interpreter, transactionBuilder)))
|
dsl(TransactionDSL(TestTransactionDSLInterpreter(this.interpreter, transactionBuilder)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ import net.corda.core.utilities.*
|
|||||||
import net.corda.node.internal.Node
|
import net.corda.node.internal.Node
|
||||||
import net.corda.node.internal.NodeStartup
|
import net.corda.node.internal.NodeStartup
|
||||||
import net.corda.node.internal.StartedNode
|
import net.corda.node.internal.StartedNode
|
||||||
|
import net.corda.node.internal.cordapp.CordappLoader
|
||||||
import net.corda.node.services.config.*
|
import net.corda.node.services.config.*
|
||||||
import net.corda.node.services.network.NetworkMapService
|
import net.corda.node.services.network.NetworkMapService
|
||||||
import net.corda.node.utilities.ServiceIdentityGenerator
|
import net.corda.node.utilities.ServiceIdentityGenerator
|
||||||
@ -511,7 +512,6 @@ class ShutdownManager(private val executorService: ExecutorService) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun shutdown() {
|
fun shutdown() {
|
||||||
unsetCordappPackages()
|
|
||||||
val shutdownActionFutures = state.locked {
|
val shutdownActionFutures = state.locked {
|
||||||
if (isShutdown) {
|
if (isShutdown) {
|
||||||
emptyList<CordaFuture<() -> Unit>>()
|
emptyList<CordaFuture<() -> Unit>>()
|
||||||
@ -595,14 +595,14 @@ class DriverDSL(
|
|||||||
val isDebug: Boolean,
|
val isDebug: Boolean,
|
||||||
val networkMapStartStrategy: NetworkMapStartStrategy,
|
val networkMapStartStrategy: NetworkMapStartStrategy,
|
||||||
val startNodesInProcess: Boolean,
|
val startNodesInProcess: Boolean,
|
||||||
val extraCordappPackagesToScan: List<String>
|
extraCordappPackagesToScan: List<String>
|
||||||
) : DriverDSLInternalInterface {
|
) : DriverDSLInternalInterface {
|
||||||
private val dedicatedNetworkMapAddress = portAllocation.nextHostAndPort()
|
private val dedicatedNetworkMapAddress = portAllocation.nextHostAndPort()
|
||||||
private var _executorService: ScheduledExecutorService? = null
|
private var _executorService: ScheduledExecutorService? = null
|
||||||
val executorService get() = _executorService!!
|
val executorService get() = _executorService!!
|
||||||
private var _shutdownManager: ShutdownManager? = null
|
private var _shutdownManager: ShutdownManager? = null
|
||||||
override val shutdownManager get() = _shutdownManager!!
|
override val shutdownManager get() = _shutdownManager!!
|
||||||
private val packagesToScanString = extraCordappPackagesToScan + getCallerPackage()
|
private val cordappPackages = extraCordappPackagesToScan + getCallerPackage()
|
||||||
|
|
||||||
class State {
|
class State {
|
||||||
val processes = ArrayList<CordaFuture<Process>>()
|
val processes = ArrayList<CordaFuture<Process>>()
|
||||||
@ -821,8 +821,6 @@ class DriverDSL(
|
|||||||
override fun start() {
|
override fun start() {
|
||||||
_executorService = Executors.newScheduledThreadPool(2, ThreadFactoryBuilder().setNameFormat("driver-pool-thread-%d").build())
|
_executorService = Executors.newScheduledThreadPool(2, ThreadFactoryBuilder().setNameFormat("driver-pool-thread-%d").build())
|
||||||
_shutdownManager = ShutdownManager(executorService)
|
_shutdownManager = ShutdownManager(executorService)
|
||||||
// We set this property so that in-process nodes find cordapps. Out-of-process nodes need this passed in when started.
|
|
||||||
setCordappPackages(*packagesToScanString.toTypedArray())
|
|
||||||
if (networkMapStartStrategy.startDedicated) {
|
if (networkMapStartStrategy.startDedicated) {
|
||||||
startDedicatedNetworkMapService().andForget(log) // Allow it to start concurrently with other nodes.
|
startDedicatedNetworkMapService().andForget(log) // Allow it to start concurrently with other nodes.
|
||||||
}
|
}
|
||||||
@ -859,7 +857,7 @@ class DriverDSL(
|
|||||||
private fun startNodeInternal(config: Config, webAddress: NetworkHostAndPort, startInProcess: Boolean?, maximumHeapSize: String): CordaFuture<NodeHandle> {
|
private fun startNodeInternal(config: Config, webAddress: NetworkHostAndPort, startInProcess: Boolean?, maximumHeapSize: String): CordaFuture<NodeHandle> {
|
||||||
val nodeConfiguration = config.parseAs<FullNodeConfiguration>()
|
val nodeConfiguration = config.parseAs<FullNodeConfiguration>()
|
||||||
if (startInProcess ?: startNodesInProcess) {
|
if (startInProcess ?: startNodesInProcess) {
|
||||||
val nodeAndThreadFuture = startInProcessNode(executorService, nodeConfiguration, config)
|
val nodeAndThreadFuture = startInProcessNode(executorService, nodeConfiguration, config, cordappPackages)
|
||||||
shutdownManager.registerShutdown(
|
shutdownManager.registerShutdown(
|
||||||
nodeAndThreadFuture.map { (node, thread) ->
|
nodeAndThreadFuture.map { (node, thread) ->
|
||||||
{
|
{
|
||||||
@ -877,7 +875,7 @@ class DriverDSL(
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val debugPort = if (isDebug) debugPortAllocation.nextPort() else null
|
val debugPort = if (isDebug) debugPortAllocation.nextPort() else null
|
||||||
val processFuture = startOutOfProcessNode(executorService, nodeConfiguration, config, quasarJarPath, debugPort, systemProperties, packagesToScanString.joinToString(","), maximumHeapSize)
|
val processFuture = startOutOfProcessNode(executorService, nodeConfiguration, config, quasarJarPath, debugPort, systemProperties, cordappPackages, maximumHeapSize)
|
||||||
registerProcess(processFuture)
|
registerProcess(processFuture)
|
||||||
return processFuture.flatMap { process ->
|
return processFuture.flatMap { process ->
|
||||||
val processDeathFuture = poll(executorService, "process death") {
|
val processDeathFuture = poll(executorService, "process death") {
|
||||||
@ -920,14 +918,15 @@ class DriverDSL(
|
|||||||
private fun startInProcessNode(
|
private fun startInProcessNode(
|
||||||
executorService: ScheduledExecutorService,
|
executorService: ScheduledExecutorService,
|
||||||
nodeConf: FullNodeConfiguration,
|
nodeConf: FullNodeConfiguration,
|
||||||
config: Config
|
config: Config,
|
||||||
|
cordappPackages: List<String>
|
||||||
): CordaFuture<Pair<StartedNode<Node>, Thread>> {
|
): CordaFuture<Pair<StartedNode<Node>, Thread>> {
|
||||||
return executorService.fork {
|
return executorService.fork {
|
||||||
log.info("Starting in-process Node ${nodeConf.myLegalName.organisation}")
|
log.info("Starting in-process Node ${nodeConf.myLegalName.organisation}")
|
||||||
// Write node.conf
|
// Write node.conf
|
||||||
writeConfig(nodeConf.baseDirectory, "node.conf", config)
|
writeConfig(nodeConf.baseDirectory, "node.conf", config)
|
||||||
// TODO pass the version in?
|
// TODO pass the version in?
|
||||||
val node = Node(nodeConf, MOCK_VERSION_INFO, initialiseSerialization = false).start()
|
val node = Node(nodeConf, MOCK_VERSION_INFO, initialiseSerialization = false, cordappLoader = CordappLoader.createDefaultWithTestPackages(nodeConf, cordappPackages)).start()
|
||||||
val nodeThread = thread(name = nodeConf.myLegalName.organisation) {
|
val nodeThread = thread(name = nodeConf.myLegalName.organisation) {
|
||||||
node.internals.run()
|
node.internals.run()
|
||||||
}
|
}
|
||||||
@ -942,7 +941,7 @@ class DriverDSL(
|
|||||||
quasarJarPath: String,
|
quasarJarPath: String,
|
||||||
debugPort: Int?,
|
debugPort: Int?,
|
||||||
overriddenSystemProperties: Map<String, String>,
|
overriddenSystemProperties: Map<String, String>,
|
||||||
packagesToScanString: String,
|
cordappPackages: List<String>,
|
||||||
maximumHeapSize: String
|
maximumHeapSize: String
|
||||||
): CordaFuture<Process> {
|
): CordaFuture<Process> {
|
||||||
val processFuture = executorService.fork {
|
val processFuture = executorService.fork {
|
||||||
@ -953,7 +952,7 @@ class DriverDSL(
|
|||||||
val systemProperties = overriddenSystemProperties + mapOf(
|
val systemProperties = overriddenSystemProperties + mapOf(
|
||||||
"name" to nodeConf.myLegalName,
|
"name" to nodeConf.myLegalName,
|
||||||
"visualvm.display.name" to "corda-${nodeConf.myLegalName}",
|
"visualvm.display.name" to "corda-${nodeConf.myLegalName}",
|
||||||
"net.corda.node.cordapp.scan.packages" to packagesToScanString,
|
Node.scanPackagesSystemProperty to cordappPackages.joinToString(Node.scanPackagesSeparator),
|
||||||
"java.io.tmpdir" to System.getProperty("java.io.tmpdir") // Inherit from parent process
|
"java.io.tmpdir" to System.getProperty("java.io.tmpdir") // Inherit from parent process
|
||||||
)
|
)
|
||||||
// See experimental/quasar-hook/README.md for how to generate.
|
// See experimental/quasar-hook/README.md for how to generate.
|
||||||
|
@ -26,6 +26,7 @@ import net.corda.core.utilities.loggerFor
|
|||||||
import net.corda.finance.utils.WorldMapLocation
|
import net.corda.finance.utils.WorldMapLocation
|
||||||
import net.corda.node.internal.AbstractNode
|
import net.corda.node.internal.AbstractNode
|
||||||
import net.corda.node.internal.StartedNode
|
import net.corda.node.internal.StartedNode
|
||||||
|
import net.corda.node.internal.cordapp.CordappLoader
|
||||||
import net.corda.node.services.api.NetworkMapCacheInternal
|
import net.corda.node.services.api.NetworkMapCacheInternal
|
||||||
import net.corda.node.services.api.SchemaService
|
import net.corda.node.services.api.SchemaService
|
||||||
import net.corda.node.services.config.BFTSMaRtConfiguration
|
import net.corda.node.services.config.BFTSMaRtConfiguration
|
||||||
@ -82,7 +83,8 @@ class MockNetwork(private val networkSendManuallyPumped: Boolean = false,
|
|||||||
servicePeerAllocationStrategy: InMemoryMessagingNetwork.ServicePeerAllocationStrategy =
|
servicePeerAllocationStrategy: InMemoryMessagingNetwork.ServicePeerAllocationStrategy =
|
||||||
InMemoryMessagingNetwork.ServicePeerAllocationStrategy.Random(),
|
InMemoryMessagingNetwork.ServicePeerAllocationStrategy.Random(),
|
||||||
private val defaultFactory: Factory<*> = MockNetwork.DefaultFactory,
|
private val defaultFactory: Factory<*> = MockNetwork.DefaultFactory,
|
||||||
private val initialiseSerialization: Boolean = true) : Closeable {
|
private val initialiseSerialization: Boolean = true,
|
||||||
|
private val cordappPackages: List<String> = emptyList()) : Closeable {
|
||||||
companion object {
|
companion object {
|
||||||
// TODO In future PR we're removing the concept of network map node so the details of this mock are not important.
|
// TODO In future PR we're removing the concept of network map node so the details of this mock are not important.
|
||||||
val MOCK_NET_MAP = Party(CordaX500Name(organisation = "Mock Network Map", locality = "Madrid", country = "ES"), DUMMY_KEY_1.public)
|
val MOCK_NET_MAP = Party(CordaX500Name(organisation = "Mock Network Map", locality = "Madrid", country = "ES"), DUMMY_KEY_1.public)
|
||||||
@ -160,7 +162,7 @@ class MockNetwork(private val networkSendManuallyPumped: Boolean = false,
|
|||||||
val id: Int,
|
val id: Int,
|
||||||
internal val notaryIdentity: Pair<ServiceInfo, KeyPair>?,
|
internal val notaryIdentity: Pair<ServiceInfo, KeyPair>?,
|
||||||
val entropyRoot: BigInteger = BigInteger.valueOf(random63BitValue())) :
|
val entropyRoot: BigInteger = BigInteger.valueOf(random63BitValue())) :
|
||||||
AbstractNode(config, TestClock(), MOCK_VERSION_INFO, mockNet.busyLatch) {
|
AbstractNode(config, TestClock(), MOCK_VERSION_INFO, CordappLoader.createDefaultWithTestPackages(config, mockNet.cordappPackages), mockNet.busyLatch) {
|
||||||
var counter = entropyRoot
|
var counter = entropyRoot
|
||||||
override val log: Logger = loggerFor<MockNode>()
|
override val log: Logger = loggerFor<MockNode>()
|
||||||
override val serverThread: AffinityExecutor =
|
override val serverThread: AffinityExecutor =
|
||||||
|
@ -167,9 +167,8 @@ open class MockServices(
|
|||||||
return NodeInfo(emptyList(), listOf(identity), 1, serial = 1L)
|
return NodeInfo(emptyList(), listOf(identity), 1, serial = 1L)
|
||||||
}
|
}
|
||||||
override val transactionVerifierService: TransactionVerifierService get() = InMemoryTransactionVerifierService(2)
|
override val transactionVerifierService: TransactionVerifierService get() = InMemoryTransactionVerifierService(2)
|
||||||
val mockCordappProvider: MockCordappProvider = MockCordappProvider(CordappLoader.createWithTestPackages(cordappPackages + CordappLoader.testPackages)).start(attachments) as MockCordappProvider
|
val mockCordappProvider = MockCordappProvider(CordappLoader.createWithTestPackages(cordappPackages)).start(attachments) as MockCordappProvider
|
||||||
override val cordappProvider: CordappProvider = mockCordappProvider
|
override val cordappProvider: CordappProvider get() = mockCordappProvider
|
||||||
|
|
||||||
lateinit var hibernatePersister: HibernateObserver
|
lateinit var hibernatePersister: HibernateObserver
|
||||||
|
|
||||||
fun makeVaultService(hibernateConfig: HibernateConfiguration = HibernateConfiguration(NodeSchemaService(), makeTestDatabaseProperties(), { identityService })): VaultServiceInternal {
|
fun makeVaultService(hibernateConfig: HibernateConfiguration = HibernateConfiguration(NodeSchemaService(), makeTestDatabaseProperties(), { identityService })): VaultServiceInternal {
|
||||||
|
@ -9,6 +9,7 @@ import net.corda.core.utilities.NetworkHostAndPort
|
|||||||
import net.corda.core.utilities.getOrThrow
|
import net.corda.core.utilities.getOrThrow
|
||||||
import net.corda.node.internal.Node
|
import net.corda.node.internal.Node
|
||||||
import net.corda.node.internal.StartedNode
|
import net.corda.node.internal.StartedNode
|
||||||
|
import net.corda.node.internal.cordapp.CordappLoader
|
||||||
import net.corda.node.services.config.*
|
import net.corda.node.services.config.*
|
||||||
import net.corda.node.utilities.ServiceIdentityGenerator
|
import net.corda.node.utilities.ServiceIdentityGenerator
|
||||||
import net.corda.nodeapi.User
|
import net.corda.nodeapi.User
|
||||||
@ -31,7 +32,7 @@ import kotlin.concurrent.thread
|
|||||||
* purposes. Use the driver if you need to run the nodes in separate processes otherwise this class will suffice.
|
* purposes. Use the driver if you need to run the nodes in separate processes otherwise this class will suffice.
|
||||||
*/
|
*/
|
||||||
// TODO Some of the logic here duplicates what's in the driver
|
// TODO Some of the logic here duplicates what's in the driver
|
||||||
abstract class NodeBasedTest : TestDependencyInjectionBase() {
|
abstract class NodeBasedTest(private val cordappPackages: List<String> = emptyList()) : TestDependencyInjectionBase() {
|
||||||
companion object {
|
companion object {
|
||||||
private val WHITESPACE = "\\s++".toRegex()
|
private val WHITESPACE = "\\s++".toRegex()
|
||||||
}
|
}
|
||||||
@ -193,7 +194,8 @@ abstract class NodeBasedTest : TestDependencyInjectionBase() {
|
|||||||
val node = Node(
|
val node = Node(
|
||||||
parsedConfig,
|
parsedConfig,
|
||||||
MOCK_VERSION_INFO.copy(platformVersion = platformVersion),
|
MOCK_VERSION_INFO.copy(platformVersion = platformVersion),
|
||||||
initialiseSerialization = false).start()
|
initialiseSerialization = false,
|
||||||
|
cordappLoader = CordappLoader.createDefaultWithTestPackages(parsedConfig, cordappPackages)).start()
|
||||||
nodes += node
|
nodes += node
|
||||||
thread(name = legalName.organisation) {
|
thread(name = legalName.organisation) {
|
||||||
node.internals.run()
|
node.internals.run()
|
||||||
|
@ -17,7 +17,6 @@ import net.corda.core.utilities.NetworkHostAndPort
|
|||||||
import net.corda.core.utilities.OpaqueBytes
|
import net.corda.core.utilities.OpaqueBytes
|
||||||
import net.corda.core.utilities.loggerFor
|
import net.corda.core.utilities.loggerFor
|
||||||
import net.corda.finance.contracts.asset.DUMMY_CASH_ISSUER
|
import net.corda.finance.contracts.asset.DUMMY_CASH_ISSUER
|
||||||
import net.corda.node.internal.cordapp.CordappLoader
|
|
||||||
import net.corda.node.services.config.configureDevKeyAndTrustStores
|
import net.corda.node.services.config.configureDevKeyAndTrustStores
|
||||||
import net.corda.node.services.identity.InMemoryIdentityService
|
import net.corda.node.services.identity.InMemoryIdentityService
|
||||||
import net.corda.node.utilities.CertificateAndKeyPair
|
import net.corda.node.utilities.CertificateAndKeyPair
|
||||||
@ -169,18 +168,3 @@ fun NodeInfo.chooseIdentityAndCert(): PartyAndCertificate = legalIdentitiesAndCe
|
|||||||
fun NodeInfo.chooseIdentity(): Party = chooseIdentityAndCert().party
|
fun NodeInfo.chooseIdentity(): Party = chooseIdentityAndCert().party
|
||||||
/** Returns the identity of the first notary found on the network */
|
/** Returns the identity of the first notary found on the network */
|
||||||
fun ServiceHub.getDefaultNotary(): Party = networkMapCache.notaryIdentities.first()
|
fun ServiceHub.getDefaultNotary(): Party = networkMapCache.notaryIdentities.first()
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the package to scan for cordapps - this overrides the default behaviour of scanning the cordapps directory
|
|
||||||
* @param packageNames A package name that you wish to scan for cordapps
|
|
||||||
*/
|
|
||||||
fun setCordappPackages(vararg packageNames: String) {
|
|
||||||
CordappLoader.testPackages = packageNames.toList()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unsets the default overriding behaviour of [setCordappPackages]
|
|
||||||
*/
|
|
||||||
fun unsetCordappPackages() {
|
|
||||||
CordappLoader.testPackages = emptyList()
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user