X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fconfig%2Fconfig-persister-directory-xml-adapter%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fpersist%2Fstorage%2Fdirectory%2Fxml%2FDirectoryStorageAdapterTest.java;h=b652dce1aa56a74eb79917a1d20014b8ffdfccfd;hb=4497e2212e73e13356447b9644bbdc935411949a;hp=7af06bd3e39cdd341e917779961150b21af4a6f9;hpb=259b65622b8c29c49235c2210609b9f7a68826eb;p=controller.git diff --git a/opendaylight/config/config-persister-directory-xml-adapter/src/test/java/org/opendaylight/controller/config/persist/storage/directory/xml/DirectoryStorageAdapterTest.java b/opendaylight/config/config-persister-directory-xml-adapter/src/test/java/org/opendaylight/controller/config/persist/storage/directory/xml/DirectoryStorageAdapterTest.java index 7af06bd3e3..b652dce1aa 100644 --- a/opendaylight/config/config-persister-directory-xml-adapter/src/test/java/org/opendaylight/controller/config/persist/storage/directory/xml/DirectoryStorageAdapterTest.java +++ b/opendaylight/config/config-persister-directory-xml-adapter/src/test/java/org/opendaylight/controller/config/persist/storage/directory/xml/DirectoryStorageAdapterTest.java @@ -13,12 +13,12 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import com.google.common.base.Optional; import java.io.File; import java.io.IOException; import java.util.Collections; import java.util.List; import java.util.SortedSet; - import org.junit.Test; import org.opendaylight.controller.config.persist.api.ConfigSnapshotHolder; import org.opendaylight.controller.config.persist.api.Persister; @@ -27,13 +27,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.xml.sax.SAXException; -import com.google.common.base.Optional; - public class DirectoryStorageAdapterTest { + private static final Logger LOG = LoggerFactory.getLogger(DirectoryStorageAdapterTest.class); Persister tested; - Logger logger = LoggerFactory.getLogger(DirectoryStorageAdapterTest.class.toString()); - private Persister instantiatePersisterFromAdapter(File file, Optional extensions){ + private Persister instantiatePersisterFromAdapter(final File file, final Optional extensions){ PropertiesProviderTest pp = new PropertiesProviderTest(); pp.addProperty(XmlDirectoryStorageAdapter.DIRECTORY_STORAGE_PROP,file.getPath()); if(extensions.isPresent()) { @@ -44,7 +42,7 @@ public class DirectoryStorageAdapterTest { return dsa.instantiate(pp); } - private Persister instantiatePersisterFromAdapter(File file){ + private Persister instantiatePersisterFromAdapter(final File file){ return instantiatePersisterFromAdapter(file, Optional.absent()); } @@ -74,7 +72,7 @@ public class DirectoryStorageAdapterTest { } } - private File getFolder(String folderName) { + private File getFolder(final String folderName) { File result = new File(("src/test/resources/" + folderName).replace("/", File.separator)); assertTrue(result + " is not a directory", result.isDirectory()); @@ -86,7 +84,7 @@ public class DirectoryStorageAdapterTest { File folder = getFolder("oneFile"); tested = instantiatePersisterFromAdapter(folder, Optional.of("xml")); - logger.info("Testing : " + tested.toString()); + LOG.info("Testing : {}", tested); List results = tested.loadLastConfigs(); assertEquals(1, results.size()); ConfigSnapshotHolder result = results.get(0); @@ -97,10 +95,10 @@ public class DirectoryStorageAdapterTest { public void testOneFileWrongExtension() throws Exception { File folder = getFolder("oneFile"); tested = instantiatePersisterFromAdapter(folder, Optional.of("aa, bb")); - logger.info("Testing : " + tested.toString()); + LOG.info("Testing : {}", tested); } - private void assertResult(ConfigSnapshotHolder result, String s, String... caps) throws SAXException, IOException { + private void assertResult(final ConfigSnapshotHolder result, final String s, final String... caps) throws SAXException, IOException { assertXMLEqual(s, result.getConfigSnapshot()); int i = 0; for (String capFromSnapshot : result.getCapabilities()) { @@ -112,7 +110,7 @@ public class DirectoryStorageAdapterTest { public void testTwoFilesAllExtensions() throws Exception { File folder = getFolder("twoFiles"); tested = instantiatePersisterFromAdapter(folder); - logger.info("Testing : " + tested.toString()); + LOG.info("Testing : {}", tested); List results = tested.loadLastConfigs(); assertEquals(2, results.size()); @@ -124,7 +122,7 @@ public class DirectoryStorageAdapterTest { public void testTwoFilesTwoExtensions() throws Exception { File folder = getFolder("twoFiles"); tested = instantiatePersisterFromAdapter(folder, Optional.of("xml, xml2")); - logger.info("Testing : " + tested.toString()); + LOG.info("Testing : {}", tested); assertEquals(2, tested.loadLastConfigs().size()); } @@ -132,7 +130,7 @@ public class DirectoryStorageAdapterTest { public void testTwoFilesOnlyOneExtension() throws Exception { File folder = getFolder("twoFiles"); tested = instantiatePersisterFromAdapter(folder, Optional.of("xml")); - logger.info("Testing : " + tested.toString()); + LOG.info("Testing : ", tested); List results = tested.loadLastConfigs(); assertEquals(1, results.size()); @@ -143,7 +141,7 @@ public class DirectoryStorageAdapterTest { public void testTwoFilesOneInvalid() throws Exception { File folder = getFolder("twoFiles_corrupt"); tested = instantiatePersisterFromAdapter(folder, Optional.of("xml")); - logger.info("Testing : " + tested.toString()); + LOG.info("Testing : {}", tested); List results = tested.loadLastConfigs(); assertEquals(1, results.size());