Package org.apache.derby.impl.io.vfmem

Examples of org.apache.derby.impl.io.vfmem.DataStore


    /**
     * Opening a random access file on a directory should fail.
     */
    public void testGetRAFOnDirectory() {
        DataStore store = getStore();
        VirtualFile vFile = new VirtualFile("mydir", store);
        assertTrue(vFile.mkdir());
        assertTrue(vFile.exists());
        assertTrue(vFile.isDirectory());
        // Try opening in read mode.
View Full Code Here


    /**
     * Tests that {@code listChildren} doesn't include too many entries.
     */
    public void testListChilderen() {
        DataStore store = getStore();
        VirtualFile dir1 = new VirtualFile(PathUtilTest.abs("mydir"), store);
        VirtualFile dir2 = new VirtualFile(
                PathUtilTest.abs("mydirectory"), store);
        VirtualFile file1 = new VirtualFile(
                PathUtilTest.joinAbs("mydir", "file1.txt"), store);
View Full Code Here

    /**
     * Makes sure that the root can be created.
     */
    public void testCreateRoot() {
        DataStore store = new DataStore("testCreateRootStore");
        String path = PathUtilTest.joinAbs("these", "are", "directories");
        assertTrue(store.createAllParents(path));
        assertNotNull(store.createEntry(path, true));
        VirtualFile vf = new VirtualFile(path, store);
        assertTrue(vf.exists());
        assertTrue(vf.isDirectory());

        // Also test one Windows specific root.
        path = PathUtilTest.join("c:", "Documents and Settings", "directories");
        assertTrue(store.createAllParents(path));
        assertNotNull(store.createEntry(path, true));
        vf = new VirtualFile(path, store);
        assertTrue(vf.exists());
        assertTrue(vf.isDirectory());
    }
View Full Code Here

    /**
     * Verify that the close() method of VirtualRandomAccessFile can be
     * called more than once.
     */
    public void testCloseIdempotent() throws IOException {
        DataStore store = getStore();
        VirtualFile f = new VirtualFile("afile", store);
        StorageRandomAccessFile raf = f.getRandomAccessFile("rw");
        raf.close();
        // The second close() used to throw NullPointerException (DERBY-5960)
        raf.close();
View Full Code Here

    /** A counter used to obtain unique data store names. */
    private static int dbStoreIndex = 0;
    /** Utility method returning a fresh data store. */
    private static synchronized DataStore getStore() {
        DataStore store = new DataStore("testVFMemDB-" + dbStoreIndex++);
        // We need the root to exist.
        assertNotNull(store.createEntry(java.io.File.separator, true));
        return store;
    }
View Full Code Here

    public VirtualFileTest(String name) {
        super(name);
    }

    public void testCreateFileInRoot() {
        DataStore store = getStore();
        VirtualFile vFile = new VirtualFile("service.properties", store);
        assertFalse(new VirtualFile("service.properties", store).exists());
        assertFalse(vFile.exists());
    }
View Full Code Here

        assertFalse(new VirtualFile("service.properties", store).exists());
        assertFalse(vFile.exists());
    }

    public void testCreateDirInRoot() {
        DataStore store = getStore();
        VirtualFile vFile = new VirtualFile("seg0", store);
        assertFalse(vFile.exists());
        vFile.mkdir();
        assertTrue(vFile.exists());
        assertTrue(vFile.isDirectory());
View Full Code Here

        assertTrue(vFile.exists());
        assertTrue(vFile.isDirectory());
    }

    public void testCreateInvalidDir() {
        DataStore store = getStore();
        VirtualFile vFile = new VirtualFile(
                PathUtilTest.join(NON_EXISTING_DIRS),
                store);
        assertFalse(vFile.exists());
        VirtualFile tmp = new VirtualFile("", store);
View Full Code Here

        assertTrue(tmp.mkdir());
        assertFalse("Dir creation should have failed", vFile.mkdir());
    }

    public void testMkdirsValidRelative() {
        DataStore store = getStore();
        VirtualFile vFile = new VirtualFile(
                PathUtilTest.join(NON_EXISTING_DIRS),
                store);
        assertTrue(vFile.mkdirs());
    }
View Full Code Here

                store);
        assertTrue(vFile.mkdirs());
    }

    public void testMkdirsValidAbsolute() {
        DataStore store = getStore();
        VirtualFile vFile = new VirtualFile(
                PathUtilTest.joinAbs(NON_EXISTING_DIRS),
                store);
        assertTrue(vFile.mkdirs());
    }
View Full Code Here

TOP

Related Classes of org.apache.derby.impl.io.vfmem.DataStore

Copyright © 2018 www.massapicom. 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.