Reduce ShardDataTree#getDataTree() callsites
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / entityownership / AbstractEntityOwnershipTest.java
index ea7648efb9df918bd034f858f6d26eebd5a48afd..9315cc2ddef123a21690be402f8e6b55b5b9e8cd 100644 (file)
@@ -45,7 +45,6 @@ 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.DataTreeCandidateTip;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
 
@@ -156,26 +155,21 @@ public class AbstractEntityOwnershipTest extends AbstractActorTest {
 
     static void writeNode(YangInstanceIdentifier path, NormalizedNode<?, ?> node, ShardDataTree shardDataTree)
             throws DataValidationFailedException {
-        DataTreeModification modification = shardDataTree.getDataTree().takeSnapshot().newModification();
+        DataTreeModification modification = shardDataTree.newModification();
         modification.merge(path, node);
         commit(shardDataTree, modification);
     }
 
     static void deleteNode(YangInstanceIdentifier path, ShardDataTree shardDataTree)
             throws DataValidationFailedException {
-        DataTreeModification modification = shardDataTree.getDataTree().takeSnapshot().newModification();
+        DataTreeModification modification = shardDataTree.newModification();
         modification.delete(path);
         commit(shardDataTree, modification);
     }
 
     static void commit(ShardDataTree shardDataTree, DataTreeModification modification)
             throws DataValidationFailedException {
-        modification.ready();
-
-        shardDataTree.getDataTree().validate(modification);
-        DataTreeCandidateTip candidate = shardDataTree.getDataTree().prepare(modification);
-        shardDataTree.getDataTree().commit(candidate);
-        shardDataTree.notifyListeners(candidate);
+        shardDataTree.notifyListeners(shardDataTree.commit(modification));
     }
 
     static EntityOwnershipChange ownershipChange(final Entity expEntity, final boolean expWasOwner,