sdumitriu commented on code in PR #10:
URL: 
https://github.com/apache/sling-org-apache-sling-testing-jcr-mock/pull/10#discussion_r1108686107


##########
src/main/java/org/apache/sling/testing/mock/jcr/MockNode.java:
##########
@@ -394,6 +394,17 @@ public void setPrimaryType(final String 
primaryNodeTypeName) throws RepositoryEx
             throw new NoSuchNodeTypeException("Not accepting blank node 
types");
         }
     }
+    
+    @Override
+    public void addMixin(final String mixinName) throws RepositoryException {
+        if (StringUtils.isNotBlank(mixinName)) {
+            if(!this.hasProperty(JcrConstants.JCR_MIXINTYPES)) {

Review Comment:
   This is incomplete. From the spec:
   
   > If this node is already of type mixinName...
   
   This doesn't mean "if the node already has a mixin property", but that among 
the values there's this one, so a better approach would be something like:
   
   ```
   if (! has property)
      set property to an array with just this value
   else if (! this value among the array of values for the property)
     set property to an array consisting of the original array of values + this 
new value
   ```
   
   This is still not complete, since a mixin may be inherited from the primary 
type or another mixin, but short of fully implementing node type management, 
the simple "is it among the listed mixins" check above should be enough for 
mocks.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to