Make private methods static
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / DistributedDataStoreRemotingIntegrationTest.java
index 90600f952926de70e615377d7a97c61b9a9ec2eb..c48105e8be1c71f2dc31518e93a6b5f2b0442958 100644 (file)
@@ -133,7 +133,7 @@ public class DistributedDataStoreRemotingIntegrationTest {
         leaderTestKit.waitUntilLeader(leaderDistributedDataStore.getActorContext(), SHARD_NAMES);
     }
 
-    private void verifyCars(DOMStoreReadTransaction readTx, MapEntryNode... entries) throws Exception {
+    private static void verifyCars(DOMStoreReadTransaction readTx, MapEntryNode... entries) throws Exception {
         Optional<NormalizedNode<?, ?>> optional = readTx.read(CarsModel.CAR_LIST_PATH).get(5, TimeUnit.SECONDS);
         assertEquals("isPresent", true, optional.isPresent());
 
@@ -145,14 +145,14 @@ public class DistributedDataStoreRemotingIntegrationTest {
         assertEquals("Car list node", listBuilder.build(), optional.get());
     }
 
-    private void verifyNode(DOMStoreReadTransaction readTx, YangInstanceIdentifier path, NormalizedNode<?, ?> expNode)
+    private static void verifyNode(DOMStoreReadTransaction readTx, YangInstanceIdentifier path, NormalizedNode<?, ?> expNode)
             throws Exception {
         Optional<NormalizedNode<?, ?>> optional = readTx.read(path).get(5, TimeUnit.SECONDS);
         assertEquals("isPresent", true, optional.isPresent());
         assertEquals("Data node", expNode, optional.get());
     }
 
-    private void verifyExists(DOMStoreReadTransaction readTx, YangInstanceIdentifier path) throws Exception {
+    private static void verifyExists(DOMStoreReadTransaction readTx, YangInstanceIdentifier path) throws Exception {
         Boolean exists = readTx.exists(path).get(5, TimeUnit.SECONDS);
         assertEquals("exists", true, exists);
     }
@@ -514,6 +514,7 @@ public class DistributedDataStoreRemotingIntegrationTest {
     @Test
     public void testReadyLocalTransactionForwardedToLeader() throws Exception {
         initDatastores("testReadyLocalTransactionForwardedToLeader");
+        followerTestKit.waitUntilLeader(followerDistributedDataStore.getActorContext(), "cars");
 
         Optional<ActorRef> carsFollowerShard = followerDistributedDataStore.getActorContext().findLocalShard("cars");
         assertEquals("Cars follower shard found", true, carsFollowerShard.isPresent());
@@ -532,7 +533,13 @@ public class DistributedDataStoreRemotingIntegrationTest {
         ReadyLocalTransaction readyLocal = new ReadyLocalTransaction(transactionID , modification, true);
 
         carsFollowerShard.get().tell(readyLocal, followerTestKit.getRef());
-        followerTestKit.expectMsgClass(CommitTransactionReply.SERIALIZABLE_CLASS);
+        Object resp = followerTestKit.expectMsgClass(Object.class);
+        if(resp instanceof akka.actor.Status.Failure) {
+            throw new AssertionError("Unexpected failure response", ((akka.actor.Status.Failure)resp).cause());
+        }
+
+        assertTrue("Expected response of type " + CommitTransactionReply.SERIALIZABLE_CLASS,
+                CommitTransactionReply.SERIALIZABLE_CLASS.equals(resp.getClass()));
 
         verifyCars(leaderDistributedDataStore.newReadOnlyTransaction(), car);
     }