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 / ShardTransactionChainTest.java
index 0262b8c1457a171c262f5da83dc755d9bcbb174d..c5968c358f87824f3819edf739c5f9cdafcbb664 100644 (file)
@@ -9,6 +9,7 @@ import com.google.common.util.concurrent.MoreExecutors;
 
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard.ShardStats;
 import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionChain;
 import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionChainReply;
 import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction;
@@ -28,7 +29,11 @@ public class ShardTransactionChainTest extends AbstractActorTest {
 
     private static final SchemaContext testSchemaContext = TestModel.createTestContext();
 
-    private static final ShardContext shardContext = new ShardContext();
+    private static final DatastoreContext DATA_STORE_CONTEXT = new DatastoreContext();
+
+    private static final String mockShardName = "mockShardName";
+
+    private final ShardStats shardStats = new ShardStats(mockShardName, "DataStore");
 
     @BeforeClass
     public static void staticSetup() {
@@ -39,7 +44,7 @@ public class ShardTransactionChainTest extends AbstractActorTest {
     public void testOnReceiveCreateTransaction() throws Exception {
         new JavaTestKit(getSystem()) {{
             final Props props = ShardTransactionChain.props(store.createTransactionChain(),
-                    testSchemaContext, shardContext);
+                    testSchemaContext, DATA_STORE_CONTEXT, shardStats);
             final ActorRef subject = getSystem().actorOf(props, "testCreateTransaction");
 
             new Within(duration("1 seconds")) {
@@ -77,7 +82,7 @@ public class ShardTransactionChainTest extends AbstractActorTest {
     public void testOnReceiveCloseTransactionChain() throws Exception {
         new JavaTestKit(getSystem()) {{
             final Props props = ShardTransactionChain.props(store.createTransactionChain(),
-                    testSchemaContext, shardContext);
+                    testSchemaContext, DATA_STORE_CONTEXT, shardStats );
             final ActorRef subject = getSystem().actorOf(props, "testCloseTransactionChain");
 
             new Within(duration("1 seconds")) {