From: Tom Pantelis Date: Tue, 30 May 2017 12:42:27 +0000 (-0400) Subject: Remove deprecated ShardDataTree#commit method X-Git-Tag: release/nitrogen~141 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=04ce3cfa566f7667800abb376d533f41246ff909;hp=763995ce31cdaed38be580781df1f5c20edf5225 Remove deprecated ShardDataTree#commit method Change-Id: Id9eaa309f1270e555202e7afafa9ce69c63405da Signed-off-by: Tom Pantelis --- diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTree.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTree.java index c32c369a03..694be4d1d1 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTree.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTree.java @@ -673,24 +673,6 @@ public class ShardDataTree extends ShardDataTreeTransactionParent { return dataTree.takeSnapshot().newModification(); } - /** - * Commits a modification. - * - * @deprecated This method violates DataTree containment and will be removed. - */ - @VisibleForTesting - @Deprecated - public DataTreeCandidate commit(final DataTreeModification modification) throws DataValidationFailedException { - // Direct modification commit is a utility, which cannot be used while we have transactions in-flight - Preconditions.checkState(tip == dataTree, "Cannot modify data tree while transacgitons are pending"); - - modification.ready(); - dataTree.validate(modification); - DataTreeCandidate candidate = dataTree.prepare(modification); - dataTree.commit(candidate); - return candidate; - } - public Collection getAndClearPendingTransactions() { Collection ret = new ArrayList<>(getQueueSize()); 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..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 @@ -310,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, @@ -334,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 { @@ -406,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") diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/AbstractEntityOwnershipTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/AbstractEntityOwnershipTest.java index da8de325a2..05d37fd1b2 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/AbstractEntityOwnershipTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/AbstractEntityOwnershipTest.java @@ -58,6 +58,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode; import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode; import org.opendaylight.yangtools.yang.data.api.schema.MapNode; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; +import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException; import org.slf4j.Logger; @@ -204,7 +205,11 @@ public class AbstractEntityOwnershipTest extends AbstractActorTest { static void commit(ShardDataTree shardDataTree, DataTreeModification modification) throws DataValidationFailedException { - shardDataTree.notifyListeners(shardDataTree.commit(modification)); + modification.ready(); + shardDataTree.getDataTree().validate(modification); + final DataTreeCandidate candidate = shardDataTree.getDataTree().prepare(modification); + shardDataTree.getDataTree().commit(candidate); + shardDataTree.notifyListeners(candidate); } static DOMEntityOwnershipChange ownershipChange(final DOMEntity expEntity, final boolean expWasOwner,