import akka.testkit.JavaTestKit;
import akka.testkit.TestActorRef;
import org.junit.Test;
-import org.opendaylight.controller.cluster.datastore.utils.MessageCollectorActor;
import org.opendaylight.controller.cluster.notifications.LeaderStateChanged;
import org.opendaylight.controller.cluster.notifications.RegisterRoleChangeListener;
import org.opendaylight.controller.cluster.notifications.RegisterRoleChangeListenerReply;
import org.opendaylight.controller.cluster.notifications.RoleChangeNotifier;
import org.opendaylight.controller.cluster.notifications.RoleChanged;
import org.opendaylight.controller.cluster.raft.RaftState;
+import org.opendaylight.controller.cluster.raft.utils.MessageCollectorActor;
public class RoleChangeNotifierTest extends AbstractActorTest {
notifierTestActorRef.tell(new RegisterRoleChangeListener(), listenerActor);
- RegisterRoleChangeListenerReply reply = (RegisterRoleChangeListenerReply)
+ RegisterRoleChangeListenerReply reply =
MessageCollectorActor.getFirstMatching(listenerActor, RegisterRoleChangeListenerReply.class);
assertNotNull(reply);
- RoleChangeNotification notification = (RoleChangeNotification)
+ RoleChangeNotification notification =
MessageCollectorActor.getFirstMatching(listenerActor, RoleChangeNotification.class);
assertNull(notification);
}};
// listener registers after role has been changed, ensure we sent the latest role change after a reply
notifierTestActorRef.tell(new RegisterRoleChangeListener(), listenerActor);
- RegisterRoleChangeListenerReply reply = (RegisterRoleChangeListenerReply)
+ RegisterRoleChangeListenerReply reply =
MessageCollectorActor.getFirstMatching(listenerActor, RegisterRoleChangeListenerReply.class);
assertNotNull(reply);
- RoleChangeNotification notification = (RoleChangeNotification)
+ RoleChangeNotification notification =
MessageCollectorActor.getFirstMatching(listenerActor, RoleChangeNotification.class);
assertNotNull(notification);
assertEquals(RaftState.Candidate.name(), notification.getOldRole());