private static final Object TX_COMMIT_TIMEOUT_CHECK_MESSAGE = "txCommitTimeoutCheck";
+ @VisibleForTesting
+ static final Object GET_SHARD_MBEAN_MESSAGE = "getShardMBeanMessage";
+
@VisibleForTesting
static final String DEFAULT_NAME = "default";
onDatastoreContext((DatastoreContext)message);
} else if(message instanceof RegisterRoleChangeListener){
roleChangeNotifier.get().forward(message, context());
- } else if (message instanceof FollowerInitialSyncUpStatus){
+ } else if (message instanceof FollowerInitialSyncUpStatus) {
shardMBean.setFollowerInitialSyncStatus(((FollowerInitialSyncUpStatus) message).isInitialSyncDone());
context().parent().tell(message, self());
+ } else if(GET_SHARD_MBEAN_MESSAGE.equals(message)){
+ sender().tell(getShardMBean(), self());
} else {
super.onReceiveCommand(message);
}
import org.opendaylight.controller.cluster.DataPersistenceProvider;
import org.opendaylight.controller.cluster.DelegatingPersistentDataProvider;
import org.opendaylight.controller.cluster.datastore.identifiers.ShardIdentifier;
+import org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard.ShardStats;
import org.opendaylight.controller.cluster.datastore.messages.AbortTransaction;
import org.opendaylight.controller.cluster.datastore.messages.AbortTransactionReply;
import org.opendaylight.controller.cluster.datastore.messages.BatchedModifications;
inOrder.verify(cohort).preCommit();
inOrder.verify(cohort).commit();
+ shard.tell(Shard.GET_SHARD_MBEAN_MESSAGE, getRef());
+ ShardStats shardStats = expectMsgClass(duration, ShardStats.class);
+
// Use MBean for verification
// Committed transaction count should increase as usual
- assertEquals(1,shard.underlyingActor().getShardMBean().getCommittedTransactionsCount());
+ assertEquals(1,shardStats.getCommittedTransactionsCount());
// Commit index should not advance because this does not go into the journal
- assertEquals(-1, shard.underlyingActor().getShardMBean().getCommitIndex());
+ assertEquals(-1, shardStats.getCommitIndex());
shard.tell(PoisonPill.getInstance(), ActorRef.noSender());
inOrder.verify(cohort).preCommit();
inOrder.verify(cohort).commit();
+ shard.tell(Shard.GET_SHARD_MBEAN_MESSAGE, getRef());
+ ShardStats shardStats = expectMsgClass(duration, ShardStats.class);
+
// Use MBean for verification
// Committed transaction count should increase as usual
- assertEquals(1, shard.underlyingActor().getShardMBean().getCommittedTransactionsCount());
+ assertEquals(1, shardStats.getCommittedTransactionsCount());
// Commit index should advance as we do not have an empty modification
- assertEquals(0, shard.underlyingActor().getShardMBean().getCommitIndex());
+ assertEquals(0, shardStats.getCommitIndex());
shard.tell(PoisonPill.getInstance(), ActorRef.noSender());