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 1446: Add JMX stats for clustered data store"
[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 4fe60f6467d2dab4db24dd34df03b4b6d9c9c7d8..869f47578711ea313181e4011444dc82ca35feaa 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
@@
-20,6
+20,7
@@
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;
@@
-59,19
+60,24
@@
public class ShardTransactionFailureTest extends AbstractActorTest {
private final DatastoreContext datastoreContext = new DatastoreContext();
private final DatastoreContext datastoreContext = new DatastoreContext();
+ 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, new 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 DatastoreContext()));
+ final ActorRef shard = createShard();
final Props props = ShardTransaction.props(store.newReadOnlyTransaction(), shard,
final Props props = ShardTransaction.props(store.newReadOnlyTransaction(), shard,
- testSchemaContext, datastoreContext,
SHARD_IDENTIFIER.toString()
);
+ testSchemaContext, datastoreContext,
shardStats
);
final TestActorRef<ShardTransaction> subject = TestActorRef
.create(getSystem(), props,
final TestActorRef<ShardTransaction> subject = TestActorRef
.create(getSystem(), props,
@@
-98,10
+104,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 DatastoreContext()));
+ final ActorRef shard = createShard();
final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard,
final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard,
- testSchemaContext, datastoreContext,
SHARD_IDENTIFIER.toString()
);
+ testSchemaContext, datastoreContext,
shardStats
);
final TestActorRef<ShardTransaction> subject = TestActorRef
.create(getSystem(), props,
final TestActorRef<ShardTransaction> subject = TestActorRef
.create(getSystem(), props,
@@
-128,10
+133,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 DatastoreContext()));
+ final ActorRef shard = createShard();
final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard,
final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard,
- testSchemaContext, datastoreContext,
SHARD_IDENTIFIER.toString()
);
+ testSchemaContext, datastoreContext,
shardStats
);
final TestActorRef<ShardTransaction> subject = TestActorRef
.create(getSystem(), props,
final TestActorRef<ShardTransaction> subject = TestActorRef
.create(getSystem(), props,
@@
-158,10
+162,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 DatastoreContext()));
+ final ActorRef shard = createShard();
final Props props = ShardTransaction.props(store.newWriteOnlyTransaction(), shard,
final Props props = ShardTransaction.props(store.newWriteOnlyTransaction(), shard,
- testSchemaContext, datastoreContext,
SHARD_IDENTIFIER.toString()
);
+ testSchemaContext, datastoreContext,
shardStats
);
final TestActorRef<ShardTransaction> subject = TestActorRef
.create(getSystem(), props,
final TestActorRef<ShardTransaction> subject = TestActorRef
.create(getSystem(), props,
@@
-191,10
+194,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 DatastoreContext()));
+ final ActorRef shard = createShard();
final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard,
final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard,
- testSchemaContext, datastoreContext,
SHARD_IDENTIFIER.toString()
);
+ testSchemaContext, datastoreContext,
shardStats
);
final TestActorRef<ShardTransaction> subject = TestActorRef
.create(getSystem(), props,
final TestActorRef<ShardTransaction> subject = TestActorRef
.create(getSystem(), props,
@@
-229,10
+231,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 DatastoreContext()));
+ final ActorRef shard = createShard();
final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard,
final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard,
- testSchemaContext, datastoreContext,
SHARD_IDENTIFIER.toString()
);
+ testSchemaContext, datastoreContext,
shardStats
);
final TestActorRef<ShardTransaction> subject = TestActorRef
.create(getSystem(), props, "testNegativeMergeTransactionReady");
final TestActorRef<ShardTransaction> subject = TestActorRef
.create(getSystem(), props, "testNegativeMergeTransactionReady");
@@
-262,10
+263,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 DatastoreContext()));
+ final ActorRef shard = createShard();
final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard,
final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard,
- testSchemaContext, datastoreContext,
SHARD_IDENTIFIER.toString()
);
+ testSchemaContext, datastoreContext,
shardStats
);
final TestActorRef<ShardTransaction> subject = TestActorRef
.create(getSystem(), props,
final TestActorRef<ShardTransaction> subject = TestActorRef
.create(getSystem(), props,