X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fconfig-persister-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fpersist%2Fimpl%2FPersisterAggregatorTest.java;h=bef1237f980116f84f0f0ba8dc0f58b10028850b;hb=de4ef13b0a23eeec25e3cdd6461864d486707023;hp=227018bf5b8761e82b88760cdd3dc8a4a6e23705;hpb=ac65af650d550ae56dd02b660e1c5eef24b78740;p=controller.git diff --git a/opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/PersisterAggregatorTest.java b/opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/PersisterAggregatorTest.java index 227018bf5b..bef1237f98 100644 --- a/opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/PersisterAggregatorTest.java +++ b/opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/PersisterAggregatorTest.java @@ -8,10 +8,12 @@ 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; -import org.opendaylight.controller.config.persist.storage.file.FileStorageAdapter; +import org.opendaylight.controller.config.persist.storage.file.xml.XmlFileStorageAdapter; import org.opendaylight.controller.netconf.persist.impl.osgi.ConfigPersisterActivator; import org.opendaylight.controller.netconf.persist.impl.osgi.PropertiesProviderBaseImpl; @@ -21,11 +23,11 @@ import java.util.Arrays; import java.util.List; import java.util.Properties; +import static org.hamcrest.CoreMatchers.containsString; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertThat; import static org.junit.Assert.fail; -import static org.junit.matchers.JUnitMatchers.containsString; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.opendaylight.controller.netconf.persist.impl.PersisterAggregator.PersisterWithConfiguration; @@ -87,13 +89,29 @@ 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")); List persisters = persisterAggregator.getPersisterWithConfigurations(); assertEquals(1, persisters.size()); PersisterWithConfiguration persister = persisters.get(0); - assertEquals(FileStorageAdapter.class.getName() ,persister.getStorage().getClass().getName()); + assertEquals(XmlFileStorageAdapter.class.getName() ,persister.getStorage().getClass().getName()); assertFalse(persister.isReadOnly()); }