commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Zeigermann <oliver.zeigerm...@gmail.com>
Subject Re: [transactions] Empty directories being deleted
Date Thu, 17 Nov 2005 11:42:22 GMT
Well, as you are - by contract with the FileResourceManager - not
allowed to access the folder manager by it directly your test case is
invalid as well. In other words, if you follow the contract you will
never see any directories at all.

Oliver

2005/11/16, Niklas Gustavsson <niklas@protocol7.com>:
> 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:niklas@protocol7.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message