- void testWriteTransaction(DistributedDataStore dataStore, YangInstanceIdentifier nodePath,
- NormalizedNode<?, ?> nodeToWrite) throws Exception {
+ public static void verifyShardStats(final AbstractDataStore datastore, final String shardName,
+ final ShardStatsVerifier verifier) throws Exception {
+ ActorContext actorContext = datastore.getActorContext();
+
+ Future<ActorRef> future = actorContext.findLocalShardAsync(shardName);
+ ActorRef shardActor = Await.result(future, Duration.create(10, TimeUnit.SECONDS));
+
+ AssertionError lastError = null;
+ Stopwatch sw = Stopwatch.createStarted();
+ while (sw.elapsed(TimeUnit.SECONDS) <= 5) {
+ ShardStats shardStats = (ShardStats)actorContext
+ .executeOperation(shardActor, Shard.GET_SHARD_MBEAN_MESSAGE);
+
+ try {
+ verifier.verify(shardStats);
+ return;
+ } catch (AssertionError e) {
+ lastError = e;
+ Uninterruptibles.sleepUninterruptibly(50, TimeUnit.MILLISECONDS);
+ }
+ }
+
+ throw lastError;
+ }
+
+ void testWriteTransaction(final AbstractDataStore dataStore, final YangInstanceIdentifier nodePath,
+ final NormalizedNode<?, ?> nodeToWrite) throws Exception {