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


##########
src/main/java/org/apache/sling/testing/mock/jcr/MockNode.java:
##########
@@ -368,8 +372,26 @@ public boolean equals(Object obj) {
 
     @Override
     public NodeType[] getMixinNodeTypes() throws RepositoryException {
-        // we have no real mixin support - just assume no mixin nodetypes are 
set
-        return new NodeType[0];
+        Value[] mixinNames = 
getProperty(JcrConstants.JCR_MIXINTYPES).getValues();
+
+        return Arrays.stream(mixinNames)
+                .map(value -> {
+                    try {
+                        return value.getString();
+                    } catch (RepositoryException e) {
+                        return new NodeType[0];

Review Comment:
   i assume this should return null in case of error - to be filtered out in 
the next step?



##########
src/main/java/org/apache/sling/testing/mock/jcr/MockNode.java:
##########
@@ -368,8 +372,26 @@ public boolean equals(Object obj) {
 
     @Override
     public NodeType[] getMixinNodeTypes() throws RepositoryException {
-        // we have no real mixin support - just assume no mixin nodetypes are 
set
-        return new NodeType[0];
+        Value[] mixinNames = 
getProperty(JcrConstants.JCR_MIXINTYPES).getValues();
+
+        return Arrays.stream(mixinNames)
+                .map(value -> {
+                    try {
+                        return value.getString();
+                    } catch (RepositoryException e) {
+                        return new NodeType[0];
+                    }
+                })
+                .filter(Objects::nonNull)
+                .map(name -> {
+                    try {
+                        return 
getSession().getWorkspace().getNodeTypeManager().getNodeType(name.toString());
+                    } catch (RepositoryException e) {
+                        return new NodeType[0];

Review Comment:
   i assume this should return null in case of error - to be filtered out in 
the next step?



##########
src/test/java/org/apache/sling/testing/mock/jcr/MockNodeTest.java:
##########
@@ -18,32 +18,22 @@
  */
 package org.apache.sling.testing.mock.jcr;
 
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
-import javax.jcr.ItemNotFoundException;
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.Property;
-import javax.jcr.PropertyIterator;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
+import javax.jcr.*;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
+import javax.jcr.nodetype.NodeType;

Review Comment:
   cosmetic: please remove unused import



-- 
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