Skip to content

Commit c744c2d

Browse files
committed
negotiation revamp
1 parent f0f13a4 commit c744c2d

File tree

6 files changed

+56
-8
lines changed

6 files changed

+56
-8
lines changed

Advanced/negotiation-cordapp/contracts/src/test/java/net/corda/samples/negotiation/states/TradeState.java renamed to Advanced/negotiation-cordapp/contracts/src/test/java/net/corda/samples/negotiation/states/ProposalStateTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
package net.corda.samples.negotiation.states;
2-
3-
public class TradeState {
2+
//TODO
3+
public class ProposalStateTest {
44
}

Advanced/negotiation-cordapp/contracts/src/test/java/net/corda/samples/negotiation/states/ProposalState.java renamed to Advanced/negotiation-cordapp/contracts/src/test/java/net/corda/samples/negotiation/states/TradeStateTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
package net.corda.samples.negotiation.states;
2-
3-
public class ProposalState {
2+
//TODO
3+
public class TradeStateTest {
44
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
name=Test
1+
name=Negotiation Cordapp
22
group=com.negotiation
33
version=0.2

Advanced/negotiation-cordapp/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package net.corda.samples.negotiation.flows;
2+
3+
import com.google.common.collect.ImmutableList;
4+
import net.corda.core.concurrent.CordaFuture;
5+
import net.corda.core.identity.CordaX500Name;
6+
import net.corda.testing.core.TestIdentity;
7+
import net.corda.testing.driver.DriverParameters;
8+
import net.corda.testing.driver.NodeHandle;
9+
import net.corda.testing.driver.NodeParameters;
10+
import org.junit.Test;
11+
12+
import java.util.List;
13+
14+
import static net.corda.testing.driver.Driver.driver;
15+
import static org.junit.Assert.assertEquals;
16+
17+
public class DriverBasedTest {
18+
private final TestIdentity bankA = new TestIdentity(new CordaX500Name("BankA", "", "GB"));
19+
private final TestIdentity bankB = new TestIdentity(new CordaX500Name("BankB", "", "US"));
20+
21+
@Test
22+
public void nodeTest() {
23+
driver(new DriverParameters().withIsDebug(true).withStartNodesInProcess(true), dsl -> {
24+
// Start a pair of nodes and wait for them both to be ready.
25+
List<CordaFuture<NodeHandle>> handleFutures = ImmutableList.of(
26+
dsl.startNode(new NodeParameters().withProvidedName(bankA.getName())),
27+
dsl.startNode(new NodeParameters().withProvidedName(bankB.getName()))
28+
);
29+
30+
try {
31+
NodeHandle partyAHandle = handleFutures.get(0).get();
32+
NodeHandle partyBHandle = handleFutures.get(1).get();
33+
34+
// From each node, make an RPC call to retrieve another node's name from the network map, to verify that the
35+
// nodes have started and can communicate.
36+
37+
// This is a very basic test: in practice tests would be starting flows, and verifying the states in the vault
38+
// and other important metrics to ensure that your CorDapp is working as intended.
39+
assertEquals(partyAHandle.getRpc().wellKnownPartyFromX500Name(bankB.getName()).getName(), bankB.getName());
40+
assertEquals(partyBHandle.getRpc().wellKnownPartyFromX500Name(bankA.getName()).getName(), bankA.getName());
41+
} catch (Exception e) {
42+
throw new RuntimeException("Caught exception during test: ", e);
43+
}
44+
45+
return null;
46+
});
47+
}
48+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
name=Test
1+
name=Obligation CorDapp
22
group=com.obligation
3-
version=0.1
3+
version=1.0

0 commit comments

Comments
 (0)