Author: bdelacretaz Date: Wed Oct 12 13:27:39 2016 New Revision: 1764462 URL: http://svn.apache.org/viewvc?rev=1764462&view=rev Log: SLING-6130 - revert revision 1764259 which breaks the launchpad with 'unknown node type sling:Folder' (I'll explain in jira)
Modified: sling/trunk/bundles/jcr/oak-server/src/main/java/org/apache/sling/jcr/oak/server/internal/OakSlingRepositoryManager.java sling/trunk/bundles/jcr/oak-server/src/test/java/org/apache/sling/jcr/oak/server/it/OakServerIT.java sling/trunk/bundles/jcr/oak-server/src/test/java/org/apache/sling/jcr/oak/server/it/OakServerTestSupport.java Modified: sling/trunk/bundles/jcr/oak-server/src/main/java/org/apache/sling/jcr/oak/server/internal/OakSlingRepositoryManager.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/oak-server/src/main/java/org/apache/sling/jcr/oak/server/internal/OakSlingRepositoryManager.java?rev=1764462&r1=1764461&r2=1764462&view=diff ============================================================================== --- sling/trunk/bundles/jcr/oak-server/src/main/java/org/apache/sling/jcr/oak/server/internal/OakSlingRepositoryManager.java (original) +++ sling/trunk/bundles/jcr/oak-server/src/main/java/org/apache/sling/jcr/oak/server/internal/OakSlingRepositoryManager.java Wed Oct 12 13:27:39 2016 @@ -30,7 +30,6 @@ import javax.jcr.security.Privilege; import org.apache.jackrabbit.JcrConstants; import org.apache.jackrabbit.api.JackrabbitRepository; -import org.apache.jackrabbit.commons.JcrUtils; import org.apache.jackrabbit.commons.jackrabbit.authorization.AccessControlUtils; import org.apache.jackrabbit.oak.Oak; import org.apache.jackrabbit.oak.jcr.Jcr; @@ -199,11 +198,10 @@ public class OakSlingRepositoryManager e try { // TODO do we need to go via PrivilegeManager for the names? See OAK-1016 example. session = repository.loginAdministrative(getDefaultWorkspace()); - JcrUtils.getOrAddNode(session.getRootNode(), "content", "sling:Folder"); final String[] privileges = new String[]{Privilege.JCR_READ}; AccessControlUtils.addAccessControlEntry( session, - "/content", + "/", EveryonePrincipal.getInstance(), privileges, true); Modified: sling/trunk/bundles/jcr/oak-server/src/test/java/org/apache/sling/jcr/oak/server/it/OakServerIT.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/oak-server/src/test/java/org/apache/sling/jcr/oak/server/it/OakServerIT.java?rev=1764462&r1=1764461&r2=1764462&view=diff ============================================================================== --- sling/trunk/bundles/jcr/oak-server/src/test/java/org/apache/sling/jcr/oak/server/it/OakServerIT.java (original) +++ sling/trunk/bundles/jcr/oak-server/src/test/java/org/apache/sling/jcr/oak/server/it/OakServerIT.java Wed Oct 12 13:27:39 2016 @@ -35,7 +35,6 @@ import javax.jcr.query.Query; import org.apache.jackrabbit.commons.cnd.CndImporter; import org.apache.sling.api.SlingConstants; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.junit.PaxExam; @@ -106,7 +105,7 @@ public class OakServerIT extends OakServ @Test public void testAnonymousHasReadAccess() throws RepositoryException { - final String path = assertCreateRetrieveNode(null, "content/foo"); + final String path = assertCreateRetrieveNode(null); final Session s = repository.login(); try { assertTrue("Expecting anonymous to see " + path, s.itemExists(path)); @@ -118,12 +117,6 @@ public class OakServerIT extends OakServ } @Test - @Ignore - public void testAnonymousHasNoReadAccess() throws RepositoryException { - // TODO - } - - @Test public void testSqlQuery() throws RepositoryException { final Session s = repository.loginAdministrative(null); final String id = "ID_" + System.currentTimeMillis(); Modified: sling/trunk/bundles/jcr/oak-server/src/test/java/org/apache/sling/jcr/oak/server/it/OakServerTestSupport.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/oak-server/src/test/java/org/apache/sling/jcr/oak/server/it/OakServerTestSupport.java?rev=1764462&r1=1764461&r2=1764462&view=diff ============================================================================== --- sling/trunk/bundles/jcr/oak-server/src/test/java/org/apache/sling/jcr/oak/server/it/OakServerTestSupport.java (original) +++ sling/trunk/bundles/jcr/oak-server/src/test/java/org/apache/sling/jcr/oak/server/it/OakServerTestSupport.java Wed Oct 12 13:27:39 2016 @@ -29,7 +29,6 @@ import javax.jcr.Session; import javax.jcr.observation.EventIterator; import javax.jcr.observation.EventListener; import javax.jcr.observation.ObservationManager; -import org.apache.jackrabbit.commons.JcrUtils; import org.apache.sling.api.resource.ResourceResolverFactory; import org.apache.sling.jcr.api.SlingRepository; import org.apache.sling.testing.paxexam.SlingOptions; @@ -113,30 +112,24 @@ public abstract class OakServerTestSuppo * @return the path of the test node that was created. */ protected String assertCreateRetrieveNode(String nodeType) throws RepositoryException { - return assertCreateRetrieveNode(nodeType, null); - } - - protected String assertCreateRetrieveNode(String nodeType, String relParentPath) throws RepositoryException { - Session session = repository.loginAdministrative(null); + Session s = repository.loginAdministrative(null); try { - final Node root = session.getRootNode(); + final Node root = s.getRootNode(); final String name = uniqueName("assertCreateRetrieveNode"); final String propName = "PN_" + name; final String propValue = "PV_" + name; - final Node parent = relParentPath == null ? root : JcrUtils.getOrAddNode(root, relParentPath); - final Node child = nodeType == null ? parent.addNode(name) : parent.addNode(name, nodeType); + final Node child = nodeType == null ? root.addNode(name) : root.addNode(name, nodeType); child.setProperty(propName, propValue); child.setProperty("foo", child.getPath()); - session.save(); - session.logout(); - session = repository.loginAdministrative(null); - final String path = relParentPath == null ? "/" + name : "/" + relParentPath + "/" + name; - final Node n = session.getNode(path); + s.save(); + s.logout(); + s = repository.loginAdministrative(null); + final Node n = s.getNode("/" + name); assertNotNull(n); assertEquals(propValue, n.getProperty(propName).getString()); return n.getPath(); } finally { - session.logout(); + s.logout(); } }