Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Tune replication and stabilize tests
[controller.git]
/
opendaylight
/
md-sal
/
sal-distributed-datastore
/
src
/
test
/
java
/
org
/
opendaylight
/
controller
/
cluster
/
datastore
/
ThreePhaseCommitCohortProxyTest.java
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 af3da575714c57d3b39786313a089d63d6419615..4eca5671f626543b5c9ca8052f1427945c72a302 100644
(file)
--- 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 akka.actor.ActorRef;
import akka.actor.Props;
+
import com.google.common.util.concurrent.ListenableFuture;
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 junit.framework.Assert;
+
+import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.messages.AbortTransactionReply;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.messages.AbortTransactionReply;
@@
-14,6
+20,7
@@
import org.opendaylight.controller.cluster.datastore.utils.MessageCollectorActor
import org.opendaylight.controller.cluster.datastore.utils.MockActorContext;
import java.util.Arrays;
import org.opendaylight.controller.cluster.datastore.utils.MockActorContext;
import java.util.Arrays;
+import java.util.concurrent.Executors;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotNull;
@@
-23,6
+30,8
@@
public class ThreePhaseCommitCohortProxyTest extends AbstractActorTest {
private Props props;
private ActorRef actorRef;
private MockActorContext actorContext;
private Props props;
private ActorRef actorRef;
private MockActorContext actorContext;
+ private final ListeningExecutorService executor = MoreExecutors.listeningDecorator(
+ Executors.newSingleThreadExecutor());
@Before
public void setUp(){
@Before
public void setUp(){
@@
-32,13
+41,18
@@
public class ThreePhaseCommitCohortProxyTest extends AbstractActorTest {
proxy =
new ThreePhaseCommitCohortProxy(actorContext,
proxy =
new ThreePhaseCommitCohortProxy(actorContext,
- Arrays.asList(actorRef.path()));
+ Arrays.asList(actorRef.path()), "txn-1", executor);
+
+ }
+ @After
+ public void tearDown() {
+ executor.shutdownNow();
}
@Test
public void testCanCommit() throws Exception {
}
@Test
public void testCanCommit() throws Exception {
- actorContext.setExecuteRemoteOperationResponse(new CanCommitTransactionReply(true));
+ actorContext.setExecuteRemoteOperationResponse(new CanCommitTransactionReply(true)
.toSerializable()
);
ListenableFuture<Boolean> future = proxy.canCommit();
ListenableFuture<Boolean> future = proxy.canCommit();
@@
-48,7
+62,7
@@
public class ThreePhaseCommitCohortProxyTest extends AbstractActorTest {
@Test
public void testPreCommit() throws Exception {
@Test
public void testPreCommit() throws Exception {
- actorContext.setExecuteRemoteOperationResponse(new PreCommitTransactionReply());
+ actorContext.setExecuteRemoteOperationResponse(new PreCommitTransactionReply()
.toSerializable()
);
ListenableFuture<Void> future = proxy.preCommit();
ListenableFuture<Void> future = proxy.preCommit();
@@
-58,7
+72,7
@@
public class ThreePhaseCommitCohortProxyTest extends AbstractActorTest {
@Test
public void testAbort() throws Exception {
@Test
public void testAbort() throws Exception {
- actorContext.setExecuteRemoteOperationResponse(new AbortTransactionReply());
+ actorContext.setExecuteRemoteOperationResponse(new AbortTransactionReply()
.toSerializable()
);
ListenableFuture<Void> future = proxy.abort();
ListenableFuture<Void> future = proxy.abort();
@@
-68,7
+82,7
@@
public class ThreePhaseCommitCohortProxyTest extends AbstractActorTest {
@Test
public void testCommit() throws Exception {
@Test
public void testCommit() throws Exception {
- actorContext.setExecuteRemoteOperationResponse(new CommitTransactionReply());
+ actorContext.setExecuteRemoteOperationResponse(new CommitTransactionReply()
.toSerializable()
);
ListenableFuture<Void> future = proxy.commit();
ListenableFuture<Void> future = proxy.commit();