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=f5a7551176028427cbf6feb64270da4897696f0f;hb=6602310b78b5bf54899456e2efa867d116731267;hp=4e29d4d5bb47ab1f4e3687303e2a92e74d697305;hpb=5e7cf2452ef634dc934a3ea5a2dd95059fbab68c;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 4e29d4d5bb..f5a7551176 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 @@ -55,7 +55,7 @@ import org.opendaylight.controller.cluster.datastore.modification.MergeModificat import org.opendaylight.controller.cluster.datastore.modification.MutableCompositeModification; import org.opendaylight.controller.cluster.datastore.modification.WriteModification; import org.opendaylight.controller.cluster.datastore.persisted.CommitTransactionPayload; -import org.opendaylight.controller.cluster.datastore.persisted.PreBoronShardDataTreeSnapshot; +import org.opendaylight.controller.cluster.datastore.persisted.MetadataShardDataTreeSnapshot; import org.opendaylight.controller.cluster.datastore.persisted.ShardSnapshotState; import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry; import org.opendaylight.controller.cluster.raft.TestActorFactory; @@ -125,7 +125,8 @@ public abstract class AbstractShardTest extends AbstractActorTest { } protected Shard.Builder newShardBuilder() { - return Shard.builder().id(shardID).datastoreContext(newDatastoreContext()).schemaContext(SCHEMA_CONTEXT); + return Shard.builder().id(shardID).datastoreContext(newDatastoreContext()) + .schemaContextProvider(() -> SCHEMA_CONTEXT); } protected void testRecovery(final Set listEntryKeys) throws Exception { @@ -309,7 +310,7 @@ public abstract class AbstractShardTest extends AbstractActorTest { 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, @@ -333,7 +334,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 { @@ -345,7 +346,7 @@ public abstract class AbstractShardTest extends AbstractActorTest { final NormalizedNode root = readStore(testStore, YangInstanceIdentifier.EMPTY); InMemorySnapshotStore.addSnapshot(shardID.toString(), Snapshot.create( - new ShardSnapshotState(new PreBoronShardDataTreeSnapshot(root)), + new ShardSnapshotState(new MetadataShardDataTreeSnapshot(root)), Collections.emptyList(), 0, 1, -1, -1, 1, null, null)); return testStore; } @@ -405,11 +406,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")