X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FThreePhaseCommitCohortProxyTest.java;h=4eca5671f626543b5c9ca8052f1427945c72a302;hb=d206d27042eef2185c875f85cf6eac61a1bd77c4;hp=8ff785c8797eecb166c0381ab3e7a92980fa8396;hpb=44c747db358bf0d49434d5f818121286b5928d4a;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxyTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxyTest.java index 8ff785c879..4eca5671f6 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxyTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxyTest.java @@ -2,8 +2,14 @@ package org.opendaylight.controller.cluster.datastore; import akka.actor.ActorRef; import akka.actor.Props; + import com.google.common.util.concurrent.ListenableFuture; +import com.google.common.util.concurrent.ListeningExecutorService; +import com.google.common.util.concurrent.MoreExecutors; + import junit.framework.Assert; + +import org.junit.After; import org.junit.Before; import org.junit.Test; import org.opendaylight.controller.cluster.datastore.messages.AbortTransactionReply; @@ -14,7 +20,6 @@ import org.opendaylight.controller.cluster.datastore.utils.MessageCollectorActor import org.opendaylight.controller.cluster.datastore.utils.MockActorContext; import java.util.Arrays; -import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import static org.junit.Assert.assertNotNull; @@ -25,7 +30,8 @@ public class ThreePhaseCommitCohortProxyTest extends AbstractActorTest { private Props props; private ActorRef actorRef; private MockActorContext actorContext; - private ExecutorService executor = Executors.newSingleThreadExecutor(); + private final ListeningExecutorService executor = MoreExecutors.listeningDecorator( + Executors.newSingleThreadExecutor()); @Before public void setUp(){ @@ -39,9 +45,14 @@ public class ThreePhaseCommitCohortProxyTest extends AbstractActorTest { } + @After + public void tearDown() { + executor.shutdownNow(); + } + @Test public void testCanCommit() throws Exception { - actorContext.setExecuteRemoteOperationResponse(new CanCommitTransactionReply(true)); + actorContext.setExecuteRemoteOperationResponse(new CanCommitTransactionReply(true).toSerializable()); ListenableFuture future = proxy.canCommit(); @@ -51,7 +62,7 @@ public class ThreePhaseCommitCohortProxyTest extends AbstractActorTest { @Test public void testPreCommit() throws Exception { - actorContext.setExecuteRemoteOperationResponse(new PreCommitTransactionReply()); + actorContext.setExecuteRemoteOperationResponse(new PreCommitTransactionReply().toSerializable()); ListenableFuture future = proxy.preCommit(); @@ -61,7 +72,7 @@ public class ThreePhaseCommitCohortProxyTest extends AbstractActorTest { @Test public void testAbort() throws Exception { - actorContext.setExecuteRemoteOperationResponse(new AbortTransactionReply()); + actorContext.setExecuteRemoteOperationResponse(new AbortTransactionReply().toSerializable()); ListenableFuture future = proxy.abort(); @@ -71,7 +82,7 @@ public class ThreePhaseCommitCohortProxyTest extends AbstractActorTest { @Test public void testCommit() throws Exception { - actorContext.setExecuteRemoteOperationResponse(new CommitTransactionReply()); + actorContext.setExecuteRemoteOperationResponse(new CommitTransactionReply().toSerializable()); ListenableFuture future = proxy.commit();