X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FAbstractShardTest.java;h=6f7d8fb9df716fc474a3759e312be2816d1920ba;hb=c32a09739f0f7a008fe203b7b4ca172755136307;hp=1c8686c1b1daac3b34d546fc3fe40b1cbdfe2f72;hpb=ff818d5df82e34d0031289901e0335fe15c91303;p=controller.git 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 1c8686c1b1..6f7d8fb9df 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 @@ -95,11 +95,14 @@ public abstract class AbstractShardTest extends AbstractActorTest { private static final AtomicInteger NEXT_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(100); + .shardJournalRecoveryLogBatchSize(3).shardSnapshotBatchCount(5000) + .shardHeartbeatIntervalInMillis(HEARTBEAT_MILLIS); protected final TestActorFactory actorFactory = new TestActorFactory(getSystem()); @@ -306,11 +309,11 @@ public abstract class AbstractShardTest extends AbstractActorTest { } public static void writeToStore(final ShardDataTree store, final YangInstanceIdentifier id, - final NormalizedNode node) throws Exception { + final NormalizedNode node) throws DataValidationFailedException { BatchedModifications batched = newBatchedModifications(nextTransactionId(), id, node, true, true, 1); DataTreeModification modification = store.getDataTree().takeSnapshot().newModification(); batched.apply(modification); - store.notifyListeners(store.commit(modification)); + store.notifyListeners(commitTransaction(store.getDataTree(), modification)); } public static void writeToStore(final DataTree store, final YangInstanceIdentifier id, @@ -325,7 +328,7 @@ public abstract class AbstractShardTest extends AbstractActorTest { } public void mergeToStore(final ShardDataTree store, final YangInstanceIdentifier id, - final NormalizedNode node) throws Exception { + final NormalizedNode node) throws DataValidationFailedException { final BatchedModifications batched = new BatchedModifications(nextTransactionId(), CURRENT_VERSION); batched.addModification(new MergeModification(id, node)); batched.setReady(true); @@ -334,7 +337,7 @@ public abstract class AbstractShardTest extends AbstractActorTest { DataTreeModification modification = store.getDataTree().takeSnapshot().newModification(); batched.apply(modification); - store.notifyListeners(store.commit(modification)); + store.notifyListeners(commitTransaction(store.getDataTree(), modification)); } DataTree setupInMemorySnapshotStore() throws DataValidationFailedException { @@ -406,11 +409,13 @@ public abstract class AbstractShardTest extends AbstractActorTest { return mockCandidate; } - static void commitTransaction(final DataTree store, final DataTreeModification modification) + static DataTreeCandidate commitTransaction(final DataTree store, final DataTreeModification modification) throws DataValidationFailedException { modification.ready(); store.validate(modification); - store.commit(store.prepare(modification)); + final DataTreeCandidate candidate = store.prepare(modification); + store.commit(candidate); + return candidate; } @SuppressWarnings("serial")