Create DatastoreSnapshotRestore instance via blueprint
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / DatastoreSnapshotRestoreTest.java
index 7adc93c8f3d3bec2f9d9d3089b4f4fda82ed2975..9f0b1b5341ff861f07954f6dc133e21d1e21de29 100644 (file)
@@ -65,19 +65,18 @@ public class DatastoreSnapshotRestoreTest {
             SerializationUtils.serialize(snapshotList, fos);
         }
 
-        DatastoreSnapshotRestore.createInstance(restoreDirectoryPath);
+        DatastoreSnapshotRestore instance = DatastoreSnapshotRestore.instance(restoreDirectoryPath);
 
-        verifySnapshot(configSnapshot, DatastoreSnapshotRestore.instance().getAndRemove("config"));
-        verifySnapshot(operSnapshot, DatastoreSnapshotRestore.instance().getAndRemove("oper"));
+        verifySnapshot(configSnapshot, instance.getAndRemove("config"));
+        verifySnapshot(operSnapshot, instance.getAndRemove("oper"));
 
-        assertNull("DatastoreSnapshot was not removed", DatastoreSnapshotRestore.instance().getAndRemove("config"));
+        assertNull("DatastoreSnapshot was not removed", instance.getAndRemove("config"));
 
         assertFalse(backupFile + " was not deleted", backupFile.exists());
 
-        DatastoreSnapshotRestore.removeInstance();
-        DatastoreSnapshotRestore.createInstance("target/does-not-exist");
-        assertNull("Expected null DatastoreSnapshot", DatastoreSnapshotRestore.instance().getAndRemove("config"));
-        assertNull("Expected null DatastoreSnapshot", DatastoreSnapshotRestore.instance().getAndRemove("oper"));
+        instance = DatastoreSnapshotRestore.instance(restoreDirectoryPath);
+        assertNull("Expected null DatastoreSnapshot", instance.getAndRemove("config"));
+        assertNull("Expected null DatastoreSnapshot", instance.getAndRemove("oper"));
     }
 
     private static void verifySnapshot(DatastoreSnapshot expected, DatastoreSnapshot actual) {