Reduce ShardDataTree#getDataTree() callsites
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / ShardRecoveryCoordinatorTest.java
index 4778c569b4d9f55781cc337444469c9651ce9020..a3c9a6cca4bd569c501797e492c09a21bcc4db83 100644 (file)
@@ -142,29 +142,21 @@ public class ShardRecoveryCoordinatorTest {
 
     private Optional<NormalizedNode<?,?>> readCars(final ShardDataTree shardDataTree){
         final TipProducingDataTree dataTree = shardDataTree.getDataTree();
+        // FIXME: this should not be called here
         dataTree.setSchemaContext(peopleSchemaContext);
 
-        final DataTreeSnapshot snapshot = dataTree.takeSnapshot();
-
-        final DataTreeModification modification = snapshot.newModification();
-
-        return modification.readNode(CarsModel.BASE_PATH);
+        return shardDataTree.readNode(CarsModel.BASE_PATH);
     }
 
     private Optional<NormalizedNode<?,?>> readPeople(final ShardDataTree shardDataTree){
         final TipProducingDataTree dataTree = shardDataTree.getDataTree();
+        // FIXME: this should not be called here
         dataTree.setSchemaContext(peopleSchemaContext);
 
-        final DataTreeSnapshot snapshot = dataTree.takeSnapshot();
-
-        final DataTreeModification modification = snapshot.newModification();
-
-        return modification.readNode(PeopleModel.BASE_PATH);
+        return shardDataTree.readNode(PeopleModel.BASE_PATH);
     }
 
-
-
-    private byte[] createSnapshot(){
+    private static byte[] createSnapshot(){
         final TipProducingDataTree dataTree = InMemoryDataTreeFactory.getInstance().create();
         dataTree.setSchemaContext(SchemaContextHelper.select(SchemaContextHelper.CARS_YANG, SchemaContextHelper.PEOPLE_YANG));