X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FAbstractShardTest.java;h=31f2b6b0674a6be403468f364487e861f111c00b;hp=8c6e84115287ee39fb60ad1470c7247f02c6a06b;hb=805e9821a737d305f7f591ae51055e475e26fcdc;hpb=abaef4a5ae37f27542155457fe7306a4662b1eeb diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractShardTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractShardTest.java index 8c6e841152..31f2b6b067 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractShardTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractShardTest.java @@ -93,21 +93,20 @@ import scala.concurrent.duration.FiniteDuration; public abstract class AbstractShardTest extends AbstractActorTest { protected static final EffectiveModelContext SCHEMA_CONTEXT = TestModel.createTestContext(); - private static final AtomicInteger NEXT_SHARD_NUM = new AtomicInteger(); - + protected static final AtomicInteger SHARD_NUM = new AtomicInteger(); protected static final int HEARTBEAT_MILLIS = 100; - protected final ShardIdentifier shardID = ShardIdentifier.create("inventory", MemberName.forName("member-1"), - "config" + NEXT_SHARD_NUM.getAndIncrement()); - protected final Builder dataStoreContextBuilder = DatastoreContext.newBuilder() .shardJournalRecoveryLogBatchSize(3).shardSnapshotBatchCount(5000) .shardHeartbeatIntervalInMillis(HEARTBEAT_MILLIS); protected final TestActorFactory actorFactory = new TestActorFactory(getSystem()); + protected final int nextShardNum = SHARD_NUM.getAndIncrement(); + protected final ShardIdentifier shardID = ShardIdentifier.create("inventory", MemberName.forName("member-1"), + "config" + nextShardNum); @Before - public void setUp() { + public void setUp() throws Exception { InMemorySnapshotStore.clear(); InMemoryJournal.clear(); } @@ -132,7 +131,7 @@ public abstract class AbstractShardTest extends AbstractActorTest { .schemaContextProvider(() -> SCHEMA_CONTEXT); } - protected void testRecovery(final Set listEntryKeys) throws Exception { + protected void testRecovery(final Set listEntryKeys, final boolean stopActorOnFinish) throws Exception { // Create the actor and wait for recovery complete. final int nListEntries = listEntryKeys.size(); @@ -184,7 +183,9 @@ public abstract class AbstractShardTest extends AbstractActorTest { assertEquals("Last applied", nListEntries, shard.underlyingActor().getShardMBean().getLastApplied()); - shard.tell(PoisonPill.getInstance(), ActorRef.noSender()); + if (stopActorOnFinish) { + shard.tell(PoisonPill.getInstance(), ActorRef.noSender()); + } } protected void verifyLastApplied(final TestActorRef shard, final long expectedValue) {