X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.jcr%2Fext%2Ftest%2Forg%2Fargeo%2Fjcr%2Ffs%2FJcrFileSystemTest.java;h=886efa3675450c7c14faf7c1fc1346bdcc7a4078;hb=6d8432bcf931c7525ecc4254b2a95e8a413a06f1;hp=190eb949a0f0bcacc4308470a0725d96d5922051;hpb=0c293102b1857cd0eca6b58cbb1a88d0835a2095;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.jcr/ext/test/org/argeo/jcr/fs/JcrFileSystemTest.java b/org.argeo.jcr/ext/test/org/argeo/jcr/fs/JcrFileSystemTest.java index 190eb949a..886efa367 100644 --- a/org.argeo.jcr/ext/test/org/argeo/jcr/fs/JcrFileSystemTest.java +++ b/org.argeo.jcr/ext/test/org/argeo/jcr/fs/JcrFileSystemTest.java @@ -13,11 +13,14 @@ import java.util.Arrays; import java.util.Map; import javax.jcr.Property; +import javax.jcr.RepositoryException; +import javax.jcr.Session; import javax.jcr.nodetype.NodeType; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.jackrabbit.core.RepositoryImpl; import org.argeo.jackrabbit.fs.JackrabbitMemoryFsProvider; import junit.framework.TestCase; @@ -25,6 +28,38 @@ import junit.framework.TestCase; public class JcrFileSystemTest extends TestCase { private final static Log log = LogFactory.getLog(JcrFileSystemTest.class); + public void testMounts() throws Exception { + JackrabbitMemoryFsProvider fsProvider = new JackrabbitMemoryFsProvider() { + + @Override + protected void postRepositoryCreation(RepositoryImpl repositoryImpl) throws RepositoryException { + // create workspace + Session session = login(); + session.getWorkspace().createWorkspace("test"); + } + + }; + + Path rootPath = fsProvider.getPath(new URI("jcr+memory:/")); + log.debug("Got root " + rootPath); + + Path testMount = fsProvider.getPath(new URI("jcr+memory:/test")); + log.debug("Test path"); + assertEquals(rootPath, testMount.getParent()); + assertEquals(testMount.getFileName(), rootPath.relativize(testMount)); + + Path testPath = testMount.resolve("test.txt"); + log.debug("Create file " + testPath); + Files.createFile(testPath); + BasicFileAttributes bfa = Files.readAttributes(testPath, BasicFileAttributes.class); + FileTime ft = bfa.creationTime(); + assertNotNull(ft); + assertTrue(bfa.isRegularFile()); + log.debug("Created " + testPath + " (" + ft + ")"); + Files.delete(testPath); + log.debug("Deleted " + testPath); + } + public void testSimple() throws Exception { FileSystemProvider fsProvider = new JackrabbitMemoryFsProvider();