diff --git a/src/fr/devinsy/sikevadb/filetree/FileTreeSikevaDB.java b/src/fr/devinsy/sikevadb/filetree/FileTreeSikevaDB.java index 9f7388d..1276be2 100644 --- a/src/fr/devinsy/sikevadb/filetree/FileTreeSikevaDB.java +++ b/src/fr/devinsy/sikevadb/filetree/FileTreeSikevaDB.java @@ -27,9 +27,9 @@ import org.joda.time.format.ISODateTimeFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import fr.devinsy.sikevadb.core.Archiver; import fr.devinsy.sikevadb.core.Element; import fr.devinsy.sikevadb.core.Elements; -import fr.devinsy.sikevadb.core.Archiver; import fr.devinsy.sikevadb.core.SikevaDB; import fr.devinsy.sikevadb.core.SikevaDBException; import fr.devinsy.util.strings.StringList; @@ -57,8 +57,8 @@ public class FileTreeSikevaDB implements SikevaDB CLOSED }; - private final Logger logger = LoggerFactory.getLogger(FileTreeSikevaDB.class); private static final DateTimeFormatter ISOFormatter = ISODateTimeFormat.dateHourMinuteSecondMillis(); + private final Logger logger = LoggerFactory.getLogger(FileTreeSikevaDB.class); private Status status; private String login; @@ -413,15 +413,7 @@ public class FileTreeSikevaDB implements SikevaDB } else if (file.isDirectory()) { - File[] subFiles = file.listFiles(); - - for (File subFile : subFiles) - { - if (file.isFile()) - { - result.add(subFile.getName()); - } - } + result.add(file.getName()); } } diff --git a/test/fr/devinsy/sikevadb/filetree/TreeFileSikevaDBTest.java b/test/fr/devinsy/sikevadb/filetree/TreeFileSikevaDBTest.java index 8ee7903..e7f2bf2 100644 --- a/test/fr/devinsy/sikevadb/filetree/TreeFileSikevaDBTest.java +++ b/test/fr/devinsy/sikevadb/filetree/TreeFileSikevaDBTest.java @@ -70,6 +70,7 @@ public class TreeFileSikevaDBTest database.put("alpha01s", "bravo5", "qlskjfmlqj"); Assert.assertEquals(0, database.getSubkeys("none").size()); + Assert.assertEquals(5, database.getSubkeys("alpha01s").size()); // logger.debug("===== test done."); @@ -101,10 +102,11 @@ public class TreeFileSikevaDBTest StringList keys = database.getKeys(); - Assert.assertEquals(5, keys.size()); + Assert.assertEquals(6, keys.size()); Assert.assertTrue(keys.contains("alpha03")); Assert.assertEquals(0, database.getSubkeys("alpha03s").size()); Assert.assertEquals(5, database.getSubkeys("alpha01s").size()); + Assert.assertFalse(keys.contains("bravo4")); // logger.debug("===== test done.");