1 package org.opendaylight.controller.cluster.raft;
3 import akka.testkit.JavaTestKit;
5 import org.opendaylight.controller.cluster.raft.internal.messages.SendHeartBeat;
7 import java.util.concurrent.atomic.AtomicLong;
9 import static org.junit.Assert.assertEquals;
11 public class RaftReplicatorTest extends AbstractActorTest {
14 public void testThatHeartBeatIsGenerated () throws Exception {
15 new JavaTestKit(getSystem()) {{
17 new Within(duration("1 seconds")) {
18 protected void run() {
20 getSystem().actorOf(RaftReplicator.props(
21 new FollowerLogInformationImpl("test",
22 new AtomicLong(100), new AtomicLong(100)),
25 final String out = new ExpectMsg<String>(duration("1 seconds"), "match hint") {
26 // do not put code outside this method, will run afterwards
27 protected String match(Object in) {
28 if (in instanceof SendHeartBeat) {
34 }.get(); // this extracts the received message
36 assertEquals("match", out);