jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1157001 - in /jackrabbit/trunk: jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/acl/ReadTest.java jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/xml/SessionImportTest.java
Date Fri, 12 Aug 2011 08:13:39 GMT
Author: angela
Date: Fri Aug 12 08:13:39 2011
New Revision: 1157001

URL: http://svn.apache.org/viewvc?rev=1157001&view=rev
Log:
tests

Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/acl/ReadTest.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/xml/SessionImportTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/acl/ReadTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/acl/ReadTest.java?rev=1157001&r1=1157000&r2=1157001&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/acl/ReadTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/acl/ReadTest.java
Fri Aug 12 08:13:39 2011
@@ -338,4 +338,21 @@ public class ReadTest extends AbstractEv
         assertFalse(testSession.hasPermission(propPath, javax.jcr.Session.ACTION_READ));
         assertFalse(testSession.propertyExists(propPath));
     }
+
+    public void testRemoveMixin() throws Exception {
+        Node n = superuser.getNode(path);
+        
+        Privilege[] privileges = privilegesFromName(Privilege.JCR_READ);
+
+        withdrawPrivileges(path, privileges, getRestrictions(superuser, path));
+
+        assertTrue(n.hasNode("rep:policy"));
+        assertTrue(n.isNodeType("rep:AccessControllable"));
+
+        n.removeMixin("rep:AccessControllable");
+
+        superuser.save();
+        assertFalse(n.hasNode("rep:policy"));
+        assertFalse(n.isNodeType("rep:AccessControllable"));
+    }
 }
\ No newline at end of file

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/xml/SessionImportTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/xml/SessionImportTest.java?rev=1157001&r1=1157000&r2=1157001&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/xml/SessionImportTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/xml/SessionImportTest.java
Fri Aug 12 08:13:39 2011
@@ -25,6 +25,7 @@ import java.util.UUID;
 
 import javax.jcr.ImportUUIDBehavior;
 import javax.jcr.Item;
+import javax.jcr.Node;
 import javax.jcr.Property;
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
@@ -204,6 +205,55 @@ public class SessionImportTest extends A
         superuser.importXML(testRootNode.getPath(), in, ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW);
     }
 
+    /**
+     *
+     * @throws IOException
+     * @throws RepositoryException
+     */
+    public void testMixVersionable() throws IOException, RepositoryException {
+        String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+                "<sv:node sv:name=\"test\" xmlns:mix=\"http://www.jcp.org/jcr/mix/1.0\"
" +
+                "xmlns:nt=\"http://www.jcp.org/jcr/nt/1.0\" " +
+                "xmlns:fn_old=\"http://www.w3.org/2004/10/xpath-functions\" " +
+                "xmlns:fn=\"http://www.w3.org/2005/xpath-functions\" " +
+                "xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" " +
+                "xmlns:sv=\"http://www.jcp.org/jcr/sv/1.0\" " +
+                "xmlns:rep=\"internal\" " +
+                "xmlns:jcr=\"http://www.jcp.org/jcr/1.0\">" +
+                "<sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\">" +
+                "   <sv:value>nt:unstructured</sv:value>" +
+                "</sv:property>" +
+                "<sv:property sv:name=\"jcr:mixinTypes\" sv:type=\"Name\" sv:multiple=\"true\">"
+
+                "   <sv:value>mix:versionable</sv:value>" +
+                "</sv:property>" +
+                "<sv:property sv:name=\"jcr:uuid\" sv:type=\"String\">" +
+                "   <sv:value>75806b92-317f-4cb3-bc3d-ee87a95cf21f</sv:value>"
+
+                "</sv:property>" +
+                "<sv:property sv:name=\"jcr:baseVersion\" sv:type=\"Reference\">" +
+                "   <sv:value>6b91c6e5-1b83-4921-94a1-5d92ca389b3f</sv:value>"
+
+                "</sv:property>" +
+                "<sv:property sv:name=\"jcr:isCheckedOut\" sv:type=\"Boolean\">" +
+                "   <sv:value>true</sv:value>" +
+                "</sv:property>" +
+                "<sv:property sv:name=\"jcr:predecessors\" sv:type=\"Reference\" sv:multiple=\"true\">"
+
+                "   <sv:value>6b91c6e5-1b83-4921-94a1-5d92ca389b3f</sv:value>"
+
+                "</sv:property>" +
+                "<sv:property sv:name=\"jcr:versionHistory\" sv:type=\"Reference\">"
+
+                "   <sv:value>99b5ec0f-49cb-4ccf-b9fd-9fba82349420</sv:value>"
+
+                "</sv:property>" +
+                "</sv:node>";
+
+        InputStream in = new ByteArrayInputStream(xml.getBytes());
+        superuser.importXML(testRootNode.getPath(), in, ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW);
+        superuser.save();
+        
+        assertTrue("test node must be present", testRootNode.hasNode("test"));
+        Node n = testRootNode.getNode("test");
+        assertTrue("node must be mix:versionable", n.isNodeType(mixVersionable));
+        assertTrue("node must be mix:referenceable", n.isNodeType(mixReferenceable));
+        assertEquals("75806b92-317f-4cb3-bc3d-ee87a95cf21f", n.getUUID());
+    }
+
     private static String getUnknownURI(Session session, String uriHint) throws RepositoryException
{
         String uri = uriHint;
         int index = 0;



Mime
View raw message