Do not use Strings for internal messages
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / RoleChangeNotifierTest.java
index de852c0887d49d9cd3224c7a3ea659100ffb6328..bec679c16327789106d0f8938166f6c80bf0836c 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 package org.opendaylight.controller.cluster.datastore;
 
 
@@ -9,7 +17,6 @@ import akka.actor.Props;
 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;
@@ -17,6 +24,7 @@ import org.opendaylight.controller.cluster.notifications.RoleChangeNotification;
 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  {
 
@@ -31,11 +39,11 @@ 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);
         }};
@@ -60,11 +68,11 @@ public class RoleChangeNotifierTest extends AbstractActorTest  {
             // 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());