jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1333103 - in /jackrabbit/oak/trunk: oak-it/jcr/pom.xml oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
Date Wed, 02 May 2012 16:37:48 GMT
Author: reschke
Date: Wed May  2 16:37:48 2012
New Revision: 1333103

URL: http://svn.apache.org/viewvc?rev=1333103&view=rev
Log:
OAK-66: add a few naive node type checks to mixion related Node methods, update test exclusions

Modified:
    jackrabbit/oak/trunk/oak-it/jcr/pom.xml
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java

Modified: jackrabbit/oak/trunk/oak-it/jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-it/jcr/pom.xml?rev=1333103&r1=1333102&r2=1333103&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-it/jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-it/jcr/pom.xml Wed May  2 16:37:48 2012
@@ -70,12 +70,7 @@ org.apache.jackrabbit.test.api.SetProper
 org.apache.jackrabbit.test.api.SetPropertyValueTest#testSetSingleValueArrayValueFormatExceptionWithPropertyType
 org.apache.jackrabbit.test.api.SetPropertyConstraintViolationExceptionTest
 org.apache.jackrabbit.test.api.SetPropertyAssumeTypeTest
-org.apache.jackrabbit.test.api.NodeAddMixinTest#testAddNonExisting
 org.apache.jackrabbit.test.api.NodeAddMixinTest#testAddInheritedMixin
-org.apache.jackrabbit.test.api.NodeCanAddMixinTest#testNonExisting
-org.apache.jackrabbit.test.api.NodeSetPrimaryTypeTest#testAddNonExisting
-org.apache.jackrabbit.test.api.NodeSetPrimaryTypeTest#testSetMixinAsPrimaryType
-org.apache.jackrabbit.test.api.NodeSetPrimaryTypeTest#testSetAbstractAsPrimaryType
 org.apache.jackrabbit.test.api.WorkspaceCloneReferenceableTest
 org.apache.jackrabbit.test.api.WorkspaceCloneSameNameSibsTest
 org.apache.jackrabbit.test.api.WorkspaceCloneTest

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java?rev=1333103&r1=1333102&r2=1333103&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
Wed May  2 16:37:48 2012
@@ -622,6 +622,14 @@ public class NodeImpl extends ItemImpl i
     public void setPrimaryType(String nodeTypeName) throws RepositoryException {
         checkStatus();
 
+        // TODO: figure out the right place for this check
+        NodeTypeManager ntm = sessionContext.getNodeTypeManager();
+        NodeType nt = ntm.getNodeType(nodeTypeName); // throws on not found
+        if (nt.isAbstract() || nt.isMixin()) {
+            throw new ConstraintViolationException();
+        }
+        // TODO: END
+
         CoreValue cv = ValueConverter.toCoreValue(nodeTypeName, PropertyType.NAME, sessionContext);
         dlg.setProperty(toOakPath(Property.JCR_PRIMARY_TYPE), cv);
     }
@@ -629,6 +637,10 @@ public class NodeImpl extends ItemImpl i
     @Override
     public void addMixin(String mixinName) throws RepositoryException {
         checkStatus();
+        // TODO: figure out the right place for this check
+        NodeTypeManager ntm = sessionContext.getNodeTypeManager();
+        ntm.getNodeType(mixinName); // throws on not found
+        // TODO: END
 
         // todo implement addMixin
     }
@@ -642,7 +654,11 @@ public class NodeImpl extends ItemImpl i
 
     @Override
     public boolean canAddMixin(String mixinName) throws RepositoryException {
-        // TODO
+        // TODO: figure out the right place for this check
+        NodeTypeManager ntm = sessionContext.getNodeTypeManager();
+        ntm.getNodeType(mixinName); // throws on not found
+        // TODO: END
+
         return false;
     }
 



Mime
View raw message