Index: oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java =================================================================== --- oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java (revision 1522877) +++ oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java (working copy) @@ -501,6 +501,28 @@ } @Test + public void anonymousCanRead() throws RepositoryException { + final Session admin = getAdminSession(); + final String newName = "anonymousCanRead_" + System.currentTimeMillis(); + final String newPath = TEST_PATH + "/" + newName; + assertFalse(admin.nodeExists(newPath)); + getNode(TEST_PATH).addNode(newName); + assertTrue(admin.nodeExists(newPath)); + admin.save(); + + // TODO should use createAnonymousSession but that returns an admin session for now + final Session anon = getRepository().login(new GuestCredentials()); + try { + assertTrue("Expecting admin to see " + newPath, admin.nodeExists(newPath)); + assertNotNull("Expecting admin to get " + newPath, admin.getNode(newPath)); + assertTrue("Expecting anonymous to see " + newPath, anon.nodeExists(newPath)); + assertNotNull("Expecting anonymous to get " + newPath, anon.getNode(newPath)); + } finally { + anon.logout(); + } + } + + @Test public void testAddNodeWithExpandedName() throws RepositoryException { Session session = getAdminSession();