forked from corda/corda
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CORDA-2345: Updated docs to use the new TestCordapp API, rather than …
…the old scan cordapp packages (corda#4491) Also made some improvements to the API, especially for Java users.
- Loading branch information
1 parent
ad1a96f
commit f590300
Showing
16 changed files
with
144 additions
and
348 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
docs/source/example-code/src/main/java/net/corda/docs/java/MockNetworkTestsTutorial.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package net.corda.docs.java; | ||
|
||
// DOCSTART 1 | ||
import net.corda.core.identity.CordaX500Name; | ||
import net.corda.testing.node.MockNetwork; | ||
import net.corda.testing.node.MockNetworkParameters; | ||
import net.corda.testing.node.StartedMockNode; | ||
import org.junit.After; | ||
import org.junit.Before; | ||
|
||
import static java.util.Collections.singletonList; | ||
import static net.corda.testing.node.TestCordapp.findCordapp; | ||
|
||
public class MockNetworkTestsTutorial { | ||
|
||
private final MockNetwork mockNet = new MockNetwork(new MockNetworkParameters(singletonList(findCordapp("com.mycordapp.package")))); | ||
|
||
@After | ||
public void cleanUp() { | ||
mockNet.stopNodes(); | ||
} | ||
// DOCEND 1 | ||
|
||
// DOCSTART 2 | ||
private StartedMockNode nodeA; | ||
private StartedMockNode nodeB; | ||
|
||
@Before | ||
public void setUp() { | ||
nodeA = mockNet.createNode(); | ||
// We can optionally give the node a name. | ||
nodeB = mockNet.createNode(new CordaX500Name("Bank B", "London", "GB")); | ||
} | ||
// DOCEND 2 | ||
} |
33 changes: 33 additions & 0 deletions
33
docs/source/example-code/src/main/kotlin/net/corda/docs/kotlin/MockNetworkTestsTutorial.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package net.corda.docs.kotlin | ||
|
||
// DOCSTART 1 | ||
import net.corda.core.identity.CordaX500Name | ||
import net.corda.testing.node.MockNetwork | ||
import net.corda.testing.node.MockNetworkParameters | ||
import net.corda.testing.node.StartedMockNode | ||
import net.corda.testing.node.TestCordapp.Companion.findCordapp | ||
import org.junit.After | ||
import org.junit.Before | ||
|
||
class MockNetworkTestsTutorial { | ||
|
||
private val mockNet = MockNetwork(MockNetworkParameters(listOf(findCordapp("com.mycordapp.package")))) | ||
|
||
@After | ||
fun cleanUp() { | ||
mockNet.stopNodes() | ||
} | ||
// DOCEND 1 | ||
|
||
// DOCSTART 2 | ||
private lateinit var nodeA: StartedMockNode | ||
private lateinit var nodeB: StartedMockNode | ||
|
||
@Before | ||
fun setUp() { | ||
nodeA = mockNet.createNode() | ||
// We can optionally give the node a name. | ||
nodeB = mockNet.createNode(CordaX500Name("Bank B", "London", "GB")) | ||
} | ||
// DOCEND 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.