jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r884562 - in /jackrabbit/trunk/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/NodeImpl.java test/java/org/apache/jackrabbit/core/NodeImplTest.java
Date Thu, 26 Nov 2009 14:04:02 GMT
Author: stefan
Date: Thu Nov 26 14:04:02 2009
New Revision: 884562

URL: http://svn.apache.org/viewvc?rev=884562&view=rev
Log:
JCR-2408: minor fix and added test case

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NodeImplTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java?rev=884562&r1=884561&r2=884562&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
Thu Nov 26 14:04:02 2009
@@ -1074,7 +1074,7 @@
                 PropertyImpl prop = (PropertyImpl) itemMgr.getItem(id);
                 PropertyDefinition oldDef = affectedProps.get(id);
 
-                if (prop.getDefinition().isProtected()) {
+                if (oldDef.isProtected()) {
                     // remove 'orphaned' protected properties immediately
                     removeChildProperty(id.getName());
                     continue;

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NodeImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NodeImplTest.java?rev=884562&r1=884561&r2=884562&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NodeImplTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NodeImplTest.java
Thu Nov 26 14:04:02 2009
@@ -200,4 +200,36 @@
         assertEquals(PropertyType.nameFromValue(PropertyType.LONG),
                 PropertyType.nameFromValue(p.getType()));
     }
+
+    /**
+     * Test case for JCR-2130 and JCR-2408.
+     *
+     * @throws RepositoryException
+     */
+    public void testAddRemoveMixin() throws RepositoryException {
+        Node n = testRootNode.addNode(nodeName1, "nt:folder");
+        n.addMixin("mix:title");
+        n.setProperty("jcr:title", "blah blah");
+        testRootNode.getSession().save();
+
+        n.removeMixin("mix:title");
+        testRootNode.getSession().save();
+        assertFalse(n.hasProperty("jcr:title"));
+
+        Node n1 = testRootNode.addNode(nodeName2, ntUnstructured);
+        n1.addMixin("mix:title");
+        n1.setProperty("jcr:title", "blah blah");
+        assertEquals(
+                n1.getProperty("jcr:title").getDefinition().getDeclaringNodeType().getName(),
+                "mix:title");
+        testRootNode.getSession().save();
+
+        n1.removeMixin("mix:title");
+        testRootNode.getSession().save();
+        assertTrue(n1.hasProperty("jcr:title"));
+
+        assertEquals(
+                n1.getProperty("jcr:title").getDefinition().getDeclaringNodeType().getName(),
+                ntUnstructured);
+    }
 }



Mime
View raw message