Skip to content

Commit 77e44c5

Browse files
committed
hearbeat working
1 parent b6e911b commit 77e44c5

File tree

3 files changed

+47
-42
lines changed

3 files changed

+47
-42
lines changed

Features/schedulablestate-heartbeat/contracts/src/main/java/net/corda/samples/heartbeat/states/HeartState.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,6 @@ public ScheduledActivity nextScheduledActivity(@NotNull StateRef thisStateRef, @
6060
// We get the time when the scheduled activity will occur in the constructor rather than in this method. This is
6161
// because calling Instant.now() in nextScheduledActivity returns the time at which the function is called, rather
6262
// than the time at which the state was created.
63-
return new ScheduledActivity(flowLogicRefFactory.create("com.heartbeat.flows.HeartbeatFlow", thisStateRef), nextActivityTime);
63+
return new ScheduledActivity(flowLogicRefFactory.create("net.corda.samples.heartbeat.flows.HeartbeatFlow", thisStateRef), nextActivityTime);
6464
}
6565
}

Features/schedulablestate-heartbeat/contracts/src/test/java/net/corda/samples/heartbeat/contracts/StateTests.java

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package net.corda.samples.heartbeat.states;
2+
3+
import net.corda.core.contracts.ContractState;
4+
import net.corda.core.contracts.SchedulableState;
5+
import net.corda.core.identity.CordaX500Name;
6+
import net.corda.testing.core.TestIdentity;
7+
import org.junit.Test;
8+
9+
import static org.jgroups.util.Util.assertFalse;
10+
import static org.jgroups.util.Util.assertTrue;
11+
12+
public class StateTests {
13+
14+
private final TestIdentity a = new TestIdentity(new CordaX500Name("Alice", "", "GB"));
15+
private final TestIdentity b = new TestIdentity(new CordaX500Name("Bob", "", "GB"));
16+
17+
@Test
18+
public void constructorTest() {
19+
HeartState st = new HeartState(a.getParty());
20+
21+
assertTrue(st.getParticipants().contains(a.getParty()));
22+
assertFalse(st.getParticipants().contains(b.getParty()));
23+
}
24+
25+
@Test
26+
public void stateImplementsContractStateTest() {
27+
HeartState st = new HeartState(a.getParty());
28+
assertTrue(st instanceof ContractState);
29+
assertTrue(st instanceof SchedulableState);
30+
}
31+
}
32+
33+
34+
//public class StateTests {
35+
// private final MockServices ledgerServices = new MockServices();
36+
//
37+
// @Test
38+
// public void hasFieldOfCorrectType() throws NoSuchFieldException {
39+
//// // Does the message field exist?
40+
//// HeartState.class.getDeclaredField("me");
41+
//// // Is the message field of the correct type?
42+
//// assert(HeartState.class.getDeclaredField("me").getType().equals(Party.class));
43+
// }
44+
//}
45+
46+

0 commit comments

Comments
 (0)