Hi

when deleting a file, FileResourceManager will automatically delete any empty directories up to the store root on comiit. This would in many cases not be the expected behavior. Would it be okay to make this optional? The following test case shows the behavior:

    public void testDeleteOfEmptyDirs() throws Exception {
        File storeDir = new File("test-store");
        File subDir = new File(storeDir, "1/2/3");
        File workDir = new File("test-work");
        File testFile = new File(subDir, "foo.txt");

        subDir.mkdirs();
        workDir.mkdirs();

        testFile.createNewFile();

        FileResourceManager rm = new FileResourceManager(
                storeDir.getPath(),
                workDir.getPath(),
                false, new Log4jLogger(Logger.getLogger("logger")));

        rm.start();
        String txId = rm.generatedUniqueTxId();
        rm.startTransaction(txId);

        rm.deleteResource(txId, "1/2/3/foo.txt");
        rm.commitTransaction(txId);

        assertFalse(testFile.exists());
        assertTrue(storeDir.exists());
        assertTrue(subDir.exists());
        assertTrue(workDir.exists());
    }

/niklas

-------
Niklas Gustavsson
http://www.protocol7.com
mailto:[EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to