public void testWagonGetFileList()

in wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java [653:701]


    public void testWagonGetFileList() throws Exception {
        setupWagonTestingFixtures();

        setupRepositories();

        String dirName = "file-list";

        String filenames[] = new String[] {
            "test-resource.txt", "test-resource.pom", "test-resource b.txt", "more-resources.dat", ".index.txt"
        };

        for (String filename : filenames) {
            putFile(dirName + "/" + filename, dirName + "/" + filename, filename + "\n");
        }

        Wagon wagon = getWagon();

        wagon.connect(testRepository, getAuthInfo());

        try {
            List<String> list = wagon.getFileList(dirName);
            assertNotNull("file list should not be null.", list);
            assertTrue(
                    "file list should contain more items (actually contains '" + list + "').",
                    list.size() >= filenames.length);

            for (String filename : filenames) {
                assertTrue("Filename '" + filename + "' should be in list.", list.contains(filename));
            }

            // WAGON-250
            list = wagon.getFileList("");
            assertNotNull("file list should not be null.", list);
            assertTrue("file list should contain items (actually contains '" + list + "').", !list.isEmpty());
            assertTrue(list.contains("file-list/"));
            assertFalse(list.contains("file-list"));
            assertFalse(list.contains("."));
            assertFalse(list.contains(".."));
            assertFalse(list.contains("./"));
            assertFalse(list.contains("../"));
        } catch (UnsupportedOperationException e) {
            // Some providers don't support this
            Assume.assumeFalse(false);
        } finally {
            wagon.disconnect();

            tearDownWagonTestingFixtures();
        }
    }