Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "BUG-1612 Update netconf testtool to use new ssh server wrapper"
[controller.git]
/
opendaylight
/
md-sal
/
sal-distributed-datastore
/
src
/
test
/
java
/
org
/
opendaylight
/
controller
/
cluster
/
datastore
/
ShardTransactionFailureTest.java
diff --git
a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionFailureTest.java
b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionFailureTest.java
index 8a6534b87ef5f2e21d735d6299aad58ba3ae24e1..17731de5cd48918a1d03d04ec6dece68b9321e5a 100644
(file)
--- a/
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionFailureTest.java
+++ b/
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionFailureTest.java
@@
-13,13
+13,12
@@
package org.opendaylight.controller.cluster.datastore;
import akka.actor.ActorRef;
import akka.actor.Props;
import akka.testkit.TestActorRef;
import akka.actor.ActorRef;
import akka.actor.Props;
import akka.testkit.TestActorRef;
-
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
-
import org.junit.BeforeClass;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.identifiers.ShardIdentifier;
import org.junit.BeforeClass;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.identifiers.ShardIdentifier;
+import org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard.ShardStats;
import org.opendaylight.controller.cluster.datastore.node.utils.serialization.NormalizedNodeSerializer;
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.controller.cluster.datastore.node.utils.serialization.NormalizedNodeSerializer;
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
@@
-29,11
+28,9
@@
import org.opendaylight.controller.protobuff.messages.transaction.ShardTransacti
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-
import scala.concurrent.Await;
import scala.concurrent.Future;
import scala.concurrent.duration.Duration;
import scala.concurrent.Await;
import scala.concurrent.Future;
import scala.concurrent.duration.Duration;
-
import java.util.Collections;
import java.util.concurrent.TimeUnit;
import java.util.Collections;
import java.util.concurrent.TimeUnit;
@@
-57,21
+54,27
@@
public class ShardTransactionFailureTest extends AbstractActorTest {
ShardIdentifier.builder().memberName("member-1")
.shardName("inventory").type("operational").build();
ShardIdentifier.builder().memberName("member-1")
.shardName("inventory").type("operational").build();
- private final ShardContext shardContext = new ShardContext();
+ private final DatastoreContext datastoreContext = DatastoreContext.newBuilder().build();
+
+ private final ShardStats shardStats = new ShardStats(SHARD_IDENTIFIER.toString(), "DataStore");
@BeforeClass
public static void staticSetup() {
store.onGlobalContextUpdated(testSchemaContext);
}
@BeforeClass
public static void staticSetup() {
store.onGlobalContextUpdated(testSchemaContext);
}
+ private ActorRef createShard(){
+ return getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP, datastoreContext,
+ TestModel.createTestContext()));
+ }
+
@Test(expected = ReadFailedException.class)
public void testNegativeReadWithReadOnlyTransactionClosed()
throws Throwable {
@Test(expected = ReadFailedException.class)
public void testNegativeReadWithReadOnlyTransactionClosed()
throws Throwable {
- final ActorRef shard =
- getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP, new ShardContext()));
+ final ActorRef shard = createShard();
final Props props = ShardTransaction.props(store.newReadOnlyTransaction(), shard,
final Props props = ShardTransaction.props(store.newReadOnlyTransaction(), shard,
- testSchemaContext,
shardContext
);
+ testSchemaContext,
datastoreContext, shardStats, "txn"
);
final TestActorRef<ShardTransaction> subject = TestActorRef
.create(getSystem(), props,
final TestActorRef<ShardTransaction> subject = TestActorRef
.create(getSystem(), props,
@@
-98,10
+101,9
@@
public class ShardTransactionFailureTest extends AbstractActorTest {
public void testNegativeReadWithReadWriteTransactionClosed()
throws Throwable {
public void testNegativeReadWithReadWriteTransactionClosed()
throws Throwable {
- final ActorRef shard =
- getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP, new ShardContext()));
+ final ActorRef shard = createShard();
final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard,
final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard,
- testSchemaContext,
shardContext
);
+ testSchemaContext,
datastoreContext, shardStats, "txn"
);
final TestActorRef<ShardTransaction> subject = TestActorRef
.create(getSystem(), props,
final TestActorRef<ShardTransaction> subject = TestActorRef
.create(getSystem(), props,
@@
-128,10
+130,9
@@
public class ShardTransactionFailureTest extends AbstractActorTest {
public void testNegativeExistsWithReadWriteTransactionClosed()
throws Throwable {
public void testNegativeExistsWithReadWriteTransactionClosed()
throws Throwable {
- final ActorRef shard =
- getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP, new ShardContext()));
+ final ActorRef shard = createShard();
final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard,
final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard,
- testSchemaContext,
shardContext
);
+ testSchemaContext,
datastoreContext, shardStats, "txn"
);
final TestActorRef<ShardTransaction> subject = TestActorRef
.create(getSystem(), props,
final TestActorRef<ShardTransaction> subject = TestActorRef
.create(getSystem(), props,
@@
-158,10
+159,9
@@
public class ShardTransactionFailureTest extends AbstractActorTest {
public void testNegativeWriteWithTransactionReady() throws Exception {
public void testNegativeWriteWithTransactionReady() throws Exception {
- final ActorRef shard =
- getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP, new ShardContext()));
+ final ActorRef shard = createShard();
final Props props = ShardTransaction.props(store.newWriteOnlyTransaction(), shard,
final Props props = ShardTransaction.props(store.newWriteOnlyTransaction(), shard,
- testSchemaContext,
shardContext
);
+ testSchemaContext,
datastoreContext, shardStats, "txn"
);
final TestActorRef<ShardTransaction> subject = TestActorRef
.create(getSystem(), props,
final TestActorRef<ShardTransaction> subject = TestActorRef
.create(getSystem(), props,
@@
-191,10
+191,9
@@
public class ShardTransactionFailureTest extends AbstractActorTest {
public void testNegativeReadWriteWithTransactionReady() throws Exception {
public void testNegativeReadWriteWithTransactionReady() throws Exception {
- final ActorRef shard =
- getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP, new ShardContext()));
+ final ActorRef shard = createShard();
final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard,
final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard,
- testSchemaContext,
shardContext
);
+ testSchemaContext,
datastoreContext, shardStats, "txn"
);
final TestActorRef<ShardTransaction> subject = TestActorRef
.create(getSystem(), props,
final TestActorRef<ShardTransaction> subject = TestActorRef
.create(getSystem(), props,
@@
-229,10
+228,9
@@
public class ShardTransactionFailureTest extends AbstractActorTest {
public void testNegativeMergeTransactionReady() throws Exception {
public void testNegativeMergeTransactionReady() throws Exception {
- final ActorRef shard =
- getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP, new ShardContext()));
+ final ActorRef shard = createShard();
final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard,
final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard,
- testSchemaContext,
shardContext
);
+ testSchemaContext,
datastoreContext, shardStats, "txn"
);
final TestActorRef<ShardTransaction> subject = TestActorRef
.create(getSystem(), props, "testNegativeMergeTransactionReady");
final TestActorRef<ShardTransaction> subject = TestActorRef
.create(getSystem(), props, "testNegativeMergeTransactionReady");
@@
-262,10
+260,9
@@
public class ShardTransactionFailureTest extends AbstractActorTest {
public void testNegativeDeleteDataWhenTransactionReady() throws Exception {
public void testNegativeDeleteDataWhenTransactionReady() throws Exception {
- final ActorRef shard =
- getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP, new ShardContext()));
+ final ActorRef shard = createShard();
final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard,
final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard,
- testSchemaContext,
shardContext
);
+ testSchemaContext,
datastoreContext, shardStats, "txn"
);
final TestActorRef<ShardTransaction> subject = TestActorRef
.create(getSystem(), props,
final TestActorRef<ShardTransaction> subject = TestActorRef
.create(getSystem(), props,