use of org.apache.derby.impl.io.vfmem.DataStore in project derby by apache.
the class VirtualFileTest method testGetRAFNonExisting.
/**
* Getting a random access file in write mode for a non-existing file
* should cause the file to be created.
*/
public void testGetRAFNonExisting() throws FileNotFoundException {
DataStore store = getStore();
VirtualFile vFile = new VirtualFile("aNewFile.txt", store);
assertFalse(vFile.exists());
StorageRandomAccessFile vRAF = vFile.getRandomAccessFile("rw");
assertNotNull(vRAF);
assertTrue(vFile.exists());
}
use of org.apache.derby.impl.io.vfmem.DataStore in project derby by apache.
the class VirtualFileTest method testGetParentAbsolute.
public void testGetParentAbsolute() {
DataStore store = getStore();
VirtualFile vFile = new VirtualFile(PathUtilTest.joinAbs(NON_EXISTING_DIRS), store);
int count = 0;
StorageFile parent = vFile.getParentDir();
while (parent != null) {
count++;
parent = parent.getParentDir();
}
assertEquals(5, count);
}
use of org.apache.derby.impl.io.vfmem.DataStore in project derby by apache.
the class VirtualFileTest method testCreateInvalidDir.
public void testCreateInvalidDir() {
DataStore store = getStore();
VirtualFile vFile = new VirtualFile(PathUtilTest.join(NON_EXISTING_DIRS), store);
assertFalse(vFile.exists());
VirtualFile tmp = new VirtualFile("", store);
assertTrue(tmp.mkdir());
assertFalse("Dir creation should have failed", vFile.mkdir());
}
use of org.apache.derby.impl.io.vfmem.DataStore in project derby by apache.
the class VirtualFileTest method getStore.
/**
* 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;
}
use of org.apache.derby.impl.io.vfmem.DataStore in project derby by apache.
the class VirtualFileTest method testMkdirsValidRelative.
public void testMkdirsValidRelative() {
DataStore store = getStore();
VirtualFile vFile = new VirtualFile(PathUtilTest.join(NON_EXISTING_DIRS), store);
assertTrue(vFile.mkdirs());
}
Aggregations