BUG-1521 Add missing unit tests for config-persister-impl
[controller.git] / opendaylight / netconf / config-persister-impl / src / test / java / org / opendaylight / controller / netconf / persist / impl / PersisterAggregatorTest.java
index acea75a7432d37dbede7c219ed961784b1f63b86..cd646aeb079100a72a230f9d62624504a72a5ad2 100644 (file)
@@ -8,6 +8,8 @@
 
 package org.opendaylight.controller.netconf.persist.impl;
 
+import com.google.common.collect.Lists;
+
 import org.junit.Test;
 import org.opendaylight.controller.config.persist.api.ConfigSnapshotHolder;
 import org.opendaylight.controller.config.persist.api.Persister;
@@ -87,6 +89,22 @@ public class PersisterAggregatorTest {
         assertEquals(1, DummyAdapter.props);
     }
 
+    @Test
+    public void testNoopAdapter() throws Exception {
+        final NoOpStorageAdapter noOpStorageAdapter = new NoOpStorageAdapter();
+        final PersisterAggregator persisterAggregator =
+                new PersisterAggregator(Lists.newArrayList(new PersisterWithConfiguration(noOpStorageAdapter, false)));
+
+        noOpStorageAdapter.instantiate(null);
+
+        persisterAggregator.persistConfig(null);
+        persisterAggregator.loadLastConfigs();
+        persisterAggregator.persistConfig(null);
+        persisterAggregator.loadLastConfigs();
+
+        noOpStorageAdapter.close();
+    }
+
     @Test
     public void testLoadFromPropertyFile() throws Exception {
         PersisterAggregator persisterAggregator = PersisterAggregator.createFromProperties(loadFile("test2.properties"));