Package org.h2.store.fs

Examples of org.h2.store.fs.FileSystem.listFiles()


        stat.execute("backup to '" + getBaseDir() + "/fsJar.zip'");
        conn.close();

        deleteDb("fsJar");
        FileSystem fs = FileSystem.getInstance("zip:" + getBaseDir() + "/fsJar.zip");
        for (String f : fs.listFiles("zip:" + getBaseDir() + "/fsJar.zip")) {
            assertTrue(fs.isAbsolute(f));
            assertTrue(!fs.isDirectory(f));
            assertTrue(fs.length(f) > 0);
            assertTrue(f.endsWith(fs.getFileName(f)));
        }
View Full Code Here


    }

    private void testSimple(String fsBase) throws Exception {
        FileSystem fs = FileSystem.getInstance(fsBase);
        long time = System.currentTimeMillis();
        for (String s : fs.listFiles(fsBase)) {
            fs.delete(s);
        }
        fs.createDirs(fsBase + "/test/x");
        fs.delete(fsBase + "/test");
        fs.delete(fsBase + "/test2");
View Full Code Here

        if (lastMod < time - 1999) {
            // at most 2 seconds difference
            assertEquals(time, lastMod);
        }
        assertEquals(10000, fs.length(fsBase + "/test"));
        String[] list = fs.listFiles(fsBase);
        assertEquals(1, list.length);
        assertTrue(list[0].endsWith("test"));
        IOUtils.copy(fsBase + "/test", fsBase + "/test3");
        fs.rename(fsBase + "/test3", fsBase + "/test2");
        assertTrue(!fs.exists(fsBase + "/test3"));
View Full Code Here

        stat.execute("insert into test values(0)");
        conn.close();

        FileSystem fs = FileSystem.getInstance(getBaseDir());

        List<String> filesWithoutSerialized = Arrays.asList(fs.listFiles(getBaseDir()));
        deleteDb("fileLockSerialized");

        // with serialized
        url = "jdbc:h2:" + getBaseDir() + "/fileLockSerialized;FILE_LOCK=SERIALIZED";
        conn = DriverManager.getConnection(url);
View Full Code Here

        stat.execute("create table test(id int)");
        Thread.sleep(500);
        stat.execute("insert into test values(0)");
        conn.close();

        List<String> filesWithSerialized = Arrays.asList(fs.listFiles(getBaseDir()));
        if (filesWithoutSerialized.size() !=  filesWithSerialized.size()) {
            for (int i = 0; i < filesWithoutSerialized.size(); i++) {
                if (!filesWithSerialized.contains(filesWithoutSerialized.get(i))) {
                    System.out.println("File left from 'without serialized' mode: " + filesWithoutSerialized.get(i));
                }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.