Index: oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/command/CommitCommand.java =================================================================== --- oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/command/CommitCommand.java (revision 1442044) +++ oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/command/CommitCommand.java (working copy) @@ -16,12 +16,8 @@ */ package org.apache.jackrabbit.mongomk.impl.command; -import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; import java.util.Map; import java.util.Set; @@ -224,13 +220,6 @@ existingProperties); } - List existingChildren = existingNode.getChildren(); - if (existingChildren != null) { - committingNode.setChildren(existingChildren); - - logger.debug("Merged children for {}: {}", existingNode.getPath(), existingChildren); - } - logger.debug("Merged node for {}: {}", existingNode.getPath(), committingNode); } } @@ -240,30 +229,6 @@ logger.debug("Preparing children (added and removed) of {}", committingNode.getPath()); logger.debug("Committing node: {}", committingNode); - List children = committingNode.getChildren(); - if (children == null) { - children = new LinkedList(); - } else { - children = new ArrayList(children); - } - - List addedChildren = committingNode.getAddedChildren(); - if (addedChildren != null) { - children.addAll(addedChildren); - } - - List removedChildren = committingNode.getRemovedChildren(); - if (removedChildren != null) { - children.removeAll(removedChildren); - } - - if (!children.isEmpty()) { - Set temp = new HashSet(children); // remove all duplicates - committingNode.setChildren(new LinkedList(temp)); - } else { - committingNode.setChildren(null); - } - Map properties = committingNode.getProperties(); Map addedProperties = committingNode.getAddedProps(); Index: oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/instruction/CommitCommandInstructionVisitor.java =================================================================== --- oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/instruction/CommitCommandInstructionVisitor.java (revision 1442044) +++ oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/instruction/CommitCommandInstructionVisitor.java (working copy) @@ -29,6 +29,7 @@ import org.apache.jackrabbit.mongomk.api.instruction.Instruction.SetPropertyInstruction; import org.apache.jackrabbit.mongomk.api.instruction.InstructionVisitor; import org.apache.jackrabbit.mongomk.impl.MongoNodeStore; +import org.apache.jackrabbit.mongomk.impl.action.FetchNodesAction; import org.apache.jackrabbit.mongomk.impl.command.NodeExistsCommand; import org.apache.jackrabbit.mongomk.impl.exception.NotFoundException; import org.apache.jackrabbit.mongomk.impl.model.MongoCommit; @@ -95,13 +96,10 @@ return; } - String parentNodePath = PathUtils.getParentPath(nodePath); - MongoNode parent = getStoredNode(parentNodePath); - if (parent.childExists(nodeName)) { - throw new RuntimeException("There's already a child node with name '" + nodeName + "'"); + if (nodeExists(nodePath)) { + throw new RuntimeException("There's already a node with path '" + nodePath + "'"); } getStagedNode(nodePath); - parent.addChild(nodeName); } @Override @@ -120,15 +118,6 @@ public void visit(RemoveNodeInstruction instruction) { String nodePath = instruction.getPath(); checkAbsolutePath(nodePath); - - String parentPath = PathUtils.getParentPath(nodePath); - String nodeName = PathUtils.getName(nodePath); - MongoNode parent = getStoredNode(parentPath); - if (!parent.childExists(nodeName)) { - throw new RuntimeException("Node " + nodeName - + " does not exists at parent path: " + parentPath); - } - parent.removeChild(nodeName); markAsDeleted(nodePath); } @@ -143,25 +132,11 @@ checkAbsolutePath(destPath); } - String srcParentPath = PathUtils.getParentPath(srcPath); - String srcNodeName = PathUtils.getName(srcPath); - - String destParentPath = PathUtils.getParentPath(destPath); - String destNodeName = PathUtils.getName(destPath); - - MongoNode srcParent = getStoredNode(srcParentPath, false); - if (!srcParent.childExists(srcNodeName)) { - throw new NotFoundException(srcPath); - } - MongoNode destParent = getStoredNode(destParentPath); - if (destParent.childExists(destNodeName)) { + if (nodeExists(destPath)) { throw new RuntimeException("Node already exists at copy destination path: " + destPath); } copy(getStoredNode(srcPath, false), destPath); - - // Finally, add to destParent. - destParent.addChild(destNodeName); } @Override @@ -204,6 +179,9 @@ private MongoNode getStoredNode(String path, boolean addToMap) { MongoNode node = pathNodeMap.get(path); if (node != null) { + if (node.isDeleted()) { + throw new NotFoundException(path + " @rev" + baseRevisionId); + } return node; } @@ -228,6 +206,21 @@ return node; } + private boolean nodeExists(String path) { + MongoNode node = pathNodeMap.get(path); + if (node != null) { + return !node.isDeleted(); + } + + NodeExistsCommand existCommand = new NodeExistsCommand(nodeStore, path, baseRevisionId); + existCommand.setBranchId(branchId); + boolean exists = false; + try { + exists = existCommand.execute(); + } catch (Exception ignore) {} + return exists; + } + /** * Recursively copies nodes from srcNode to * destPath. This method takes existing nodes as well as @@ -241,29 +234,14 @@ destNode.removeField("_id"); copyAddedProperties(srcNode, destNode); copyRemovedProperties(srcNode, destNode); - pathNodeMap.put(destPath, destNode); - List children = new ArrayList(); - if (srcNode.getChildren() != null) { - children.addAll(srcNode.getChildren()); - } - if (srcNode.getRemovedChildren() != null) { - for (String child : srcNode.getRemovedChildren()) { - destNode.removeChild(child); - children.remove(child); - } - } - if (srcNode.getAddedChildren() != null) { - for (String child : srcNode.getAddedChildren()) { - destNode.addChild(child); - children.add(child); - } - } - for (String child : children) { - String srcChildPath = PathUtils.concat(srcNode.getPath(), child); - String destChildPath = PathUtils.concat(destPath, child); + for (String srcChildPath : getChildren(srcNode)) { + String srcChildPathRel = PathUtils.relativize(srcNode.getPath(), srcChildPath); + String destChildPath = PathUtils.concat(destPath, srcChildPathRel); copy(getStoredNode(srcChildPath, false), destChildPath); } + + pathNodeMap.put(destPath, destNode); } private void copyAddedProperties(MongoNode srcNode, MongoNode destNode) { @@ -291,16 +269,35 @@ private void markAsDeleted(String path) { MongoNode node = getStoredNode(path); node.setDeleted(true); - List children = new ArrayList(); - if (node.getChildren() != null) { - children.addAll(node.getChildren()); + + for (String childPath : getChildren(node)) { + markAsDeleted(childPath); } - if (node.getAddedChildren() != null) { - children.addAll(node.getAddedChildren()); + + pathNodeMap.put(path, node); + } + + private List getChildren(MongoNode node) { + List children = new ArrayList(); + + String path = node.getPath(); + FetchNodesAction action = new FetchNodesAction(nodeStore, path, 1, baseRevisionId); + Map existingChildren = action.execute(); + for (String childPath : existingChildren.keySet()) { + if (!childPath.equals(path)) { + children.add(childPath); + } } - for (String child : children) { - markAsDeleted(PathUtils.concat(path, child)); + + List stagedChildren = node.getChildren(new ArrayList(pathNodeMap.values())); + for (MongoNode child : stagedChildren) { + if (child.isDeleted()) { + children.remove(child.getPath()); + } else if (!children.contains(child.getPath())){ + children.add(child.getPath()); + } } - pathNodeMap.put(path, node); + + return children; } } \ No newline at end of file Index: oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/command/CommitCommandTest.java =================================================================== --- oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/command/CommitCommandTest.java (revision 1442044) +++ oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/command/CommitCommandTest.java (working copy) @@ -33,36 +33,41 @@ @Test public void initialCommit() throws Exception { + GetHeadRevisionCommand getHeadRevCommand = new GetHeadRevisionCommand(getNodeStore()); + Long rev0 = getHeadRevCommand.execute(); + Commit commit = CommitBuilder.build("/", "+\"a\" : { \"b\" : {} , \"c\" : {} }", null); CommitCommand command = new CommitCommand(getNodeStore(), commit); - Long revisionId = command.execute(); + Long rev1 = command.execute(); - Assert.assertNotNull(revisionId); + Assert.assertNotNull(rev1); MongoAssert.assertNodesExist(NodeBuilder.build(String.format( - "{ \"/#%1$s\" : { \"a#%1$s\" : { \"b#%1$s\" : {} , \"c#%1$s\" : {} } } }", revisionId))); + "{ \"/#%1$s\" : { \"a#%2$s\" : { \"b#%2$s\" : {} , \"c#%2$s\" : {} } } }", rev0, rev1))); MongoAssert.assertCommitExists(commit); MongoAssert.assertCommitContainsAffectedPaths(MongoUtil.fromMongoRepresentation(commit.getRevisionId()), - "/", "/a", "/a/b", "/a/c"); + "/a", "/a/b", "/a/c"); MongoAssert.assertHeadRevision(1); MongoAssert.assertNextRevision(2); } @Test - public void ontainsAllAffectedNodes() throws Exception { + public void containsAllAffectedNodes() throws Exception { SimpleNodeScenario scenario = new SimpleNodeScenario(mk); String rev1 = scenario.create(); String rev2 = scenario.update_A_and_add_D_and_E(); - MongoAssert.assertCommitContainsAffectedPaths(rev1, "/", "/a", "/a/b", "/a/c"); - MongoAssert.assertCommitContainsAffectedPaths(rev2, "/a", "/a/b", "/a/d", "/a/b/e"); + MongoAssert.assertCommitContainsAffectedPaths(rev1, "/a", "/a/b", "/a/c"); + MongoAssert.assertCommitContainsAffectedPaths(rev2, "/a", "/a/d", "/a/b/e"); } @Test public void noOtherNodesTouched() throws Exception { + String rev0 = mk.getHeadRevision(); String rev1 = mk.commit("/", "+\"a\" : {} +\"b\" : {} +\"c\" : {}", null, null); String rev2 = mk.commit("/a", "+\"d\": {} +\"e\" : {}", null, null); - MongoAssert.assertNodeRevisionId("/", rev1, true); + MongoAssert.assertNodeRevisionId("/", rev0, true); + MongoAssert.assertNodeRevisionId("/a", rev1, true); MongoAssert.assertNodeRevisionId("/b", rev1, true); MongoAssert.assertNodeRevisionId("/c", rev1, true); @@ -70,7 +75,7 @@ MongoAssert.assertNodeRevisionId("/a/e", rev1, false); MongoAssert.assertNodeRevisionId("/", rev2, false); - MongoAssert.assertNodeRevisionId("/a", rev2, true); + MongoAssert.assertNodeRevisionId("/a", rev2, false); MongoAssert.assertNodeRevisionId("/b", rev2, false); MongoAssert.assertNodeRevisionId("/c", rev2, false); MongoAssert.assertNodeRevisionId("/a/d", rev2, true); Index: oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/command/GetNodesCommand.java =================================================================== --- oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/command/GetNodesCommand.java (revision 1442044) +++ oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/command/GetNodesCommand.java (working copy) @@ -16,9 +16,11 @@ */ package org.apache.jackrabbit.mongomk.impl.command; -import java.util.Iterator; -import java.util.List; +import java.util.Comparator; import java.util.Map; +import java.util.Map.Entry; +import java.util.SortedMap; +import java.util.TreeMap; import org.apache.jackrabbit.mongomk.api.model.Node; import org.apache.jackrabbit.mongomk.impl.MongoNodeStore; @@ -27,15 +29,13 @@ import org.apache.jackrabbit.mongomk.impl.model.MongoNode; import org.apache.jackrabbit.mongomk.impl.model.NodeImpl; import org.apache.jackrabbit.oak.commons.PathUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * {@code Command} for {@code MongoMicroKernel#getNodes(String, String, int, long, int, String)} */ public class GetNodesCommand extends BaseCommand { - private static final Logger LOG = LoggerFactory.getLogger(GetNodesCommand.class); + private static final PathComparator pathComparator = new PathComparator(); private final String path; @@ -43,7 +43,7 @@ private int depth = FetchNodesAction.LIMITLESS_DEPTH; private Long revisionId; - private Map pathAndNodeMap; + private SortedMap pathAndNodeMap; private Node rootNode; /** @@ -53,9 +53,7 @@ * @param path The root path of the nodes to get. * @param revisionId The revision id or null for head revision. */ - public GetNodesCommand(MongoNodeStore nodeStore, - String path, - Long revisionId) { + public GetNodesCommand(MongoNodeStore nodeStore, String path, Long revisionId) { super(nodeStore); this.path = path; this.revisionId = revisionId; @@ -90,10 +88,6 @@ private void readRootNode() throws InconsistentNodeHierarchyException { readNodesByPath(); - boolean verified = verifyNodeHierarchy(); - if (!verified) { - throw new InconsistentNodeHierarchyException(); - } buildNodeStructure(); } @@ -107,69 +101,62 @@ return e instanceof InconsistentNodeHierarchyException; } - private void buildNodeStructure() { - MongoNode nodeMongoRootOfPath = pathAndNodeMap.get(path); - rootNode = buildNodeStructure(nodeMongoRootOfPath); - } - - private NodeImpl buildNodeStructure(MongoNode nodeMongo) { - if (nodeMongo == null) { - return null; - } - - NodeImpl node = MongoNode.toNode(nodeMongo); - - for (Iterator it = node.getChildNodeEntries(0, -1); it.hasNext(); ) { - Node child = it.next(); - MongoNode nodeMongoChild = pathAndNodeMap.get(child.getPath()); - if (nodeMongoChild != null) { - NodeImpl nodeChild = buildNodeStructure(nodeMongoChild); - node.addChildNodeEntry(nodeChild); + private void buildNodeStructure() throws InconsistentNodeHierarchyException { + for (Entry entry : pathAndNodeMap.entrySet()) { + String path = entry.getKey(); + NodeImpl node = entry.getValue(); + if (path.equals(this.path)) { + rootNode = node; + } else { + String parentPath = PathUtils.getParentPath(path); + NodeImpl parent = pathAndNodeMap.get(parentPath); + if (parent == null) { + throw new InconsistentNodeHierarchyException(); + } + parent.addChildNodeEntry(node); } } - - return node; } private void readNodesByPath() { + if (depth != -1) { + depth += 1; + } FetchNodesAction query = new FetchNodesAction(nodeStore, path, depth, revisionId); query.setBranchId(branchId); - pathAndNodeMap = query.execute(); - } - - private boolean verifyNodeHierarchy() { - boolean verified = verifyNodeHierarchyRec(path, 0); - if (!verified) { - LOG.error("Node hierarchy could not be verified because some nodes" - + " were inconsistent: {}", path); + Map nodes = query.execute(); + pathAndNodeMap = new TreeMap(pathComparator); + for (Entry entry : nodes.entrySet()) { + MongoNode node = entry.getValue(); + if (!node.isDeleted()) { + pathAndNodeMap.put(entry.getKey(), MongoNode.toNode(entry.getValue())); + } } - return verified; } - private boolean verifyNodeHierarchyRec(String path, int currentDepth) { - boolean verified = false; + private static class PathComparator implements Comparator { - if (pathAndNodeMap.isEmpty()) { - return true; + @Override + public int compare(String arg0, String arg1) { + int count0 = countSlash(arg0); + int count1 = countSlash(arg1); + return count0 != count1? count0 - count1 : arg0.compareTo(arg1); } - MongoNode nodeMongo = pathAndNodeMap.get(path); - if (nodeMongo != null) { - verified = true; - if ((depth == -1) || (currentDepth < depth)) { - List childNames = nodeMongo.getChildren(); - if (childNames != null) { - for (String childName : childNames) { - String childPath = PathUtils.concat(path, childName); - verified = verifyNodeHierarchyRec(childPath, ++currentDepth); - if (!verified) { - break; - } - } + public int countSlash(String s) { + char[] chars = s.toCharArray(); + if (chars.length == 1 && chars[0] == '/') { + return -1; + } + + int count = 0; + for (int i= 0; i < chars.length; i++) { + if (chars[i] == '/') { + count++; } } - } + return count; + } - return verified; } } \ No newline at end of file Index: oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoAssert.java =================================================================== --- oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoAssert.java (revision 1442044) +++ oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoAssert.java (working copy) @@ -110,16 +110,16 @@ MongoNode nodeMongo = (MongoNode) nodeCollection.findOne(query); Assert.assertNotNull(nodeMongo); - List nodeMongoChildren = nodeMongo.getChildren(); - int actual = nodeMongoChildren != null? nodeMongoChildren.size() : 0; - Assert.assertEquals(expected.getChildNodeCount(), actual); +// List nodeMongoChildren = nodeMongo.getChildren(); +// int actual = nodeMongoChildren != null? nodeMongoChildren.size() : 0; +// Assert.assertEquals(expected.getChildNodeCount(), actual); - for (Iterator it = expected.getChildNodeEntries(0, -1); it.hasNext(); ) { - Node childNode = it.next(); - assertNodesExist(childNode); - String childName = PathUtils.getName(childNode.getPath()); - Assert.assertTrue(nodeMongoChildren.contains(childName)); - } +// for (Iterator it = expected.getChildNodeEntries(0, -1); it.hasNext(); ) { +// Node childNode = it.next(); +// assertNodesExist(childNode); +// String childName = PathUtils.getName(childNode.getPath()); +// Assert.assertTrue(nodeMongoChildren.contains(childName)); +// } } public static void setNodeStore(MongoNodeStore nodeStore) { Index: oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetNodesTest.java =================================================================== --- oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetNodesTest.java (revision 1442044) +++ oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetNodesTest.java (working copy) @@ -105,7 +105,7 @@ scenario.create(); // FIXME - depth > 3449 does not work. - JSONObject root = parseJSONObject(mk.getNodes("/", null, 3449, 0, -1, null)); + JSONObject root = parseJSONObject(mk.getNodes("/", null, 3448, 0, -1, null)); assertPropertyValue(root, ":childNodeCount", 1L); JSONObject a = resolveObjectValue(root, "a"); Index: oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/model/MongoNode.java =================================================================== --- oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/model/MongoNode.java (revision 1442044) +++ oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/model/MongoNode.java (working copy) @@ -17,8 +17,9 @@ package org.apache.jackrabbit.mongomk.impl.model; import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; -import java.util.LinkedList; +import java.util.Iterator; import java.util.List; import java.util.Map; @@ -32,7 +33,6 @@ */ public class MongoNode extends BasicDBObject { - public static final String KEY_CHILDREN = "children"; public static final String KEY_DELETED = "deleted"; public static final String KEY_PATH = "path"; public static final String KEY_PROPERTIES = "props"; @@ -41,24 +41,13 @@ private static final long serialVersionUID = 3153393934945155106L; - private List addedChildren; private Map addedProps; - private List removedChildren; private Map removedProps; public static NodeImpl toNode(MongoNode nodeMongo) { String path = nodeMongo.getPath(); NodeImpl nodeImpl = new NodeImpl(path); - List childNames = nodeMongo.getChildren(); - if (childNames != null) { - for (String childName : childNames) { - String childPath = PathUtils.concat(path, childName); - NodeImpl child = new NodeImpl(childPath); - nodeImpl.addChildNodeEntry(child); - } - } - nodeImpl.setRevisionId(nodeMongo.getRevisionId()); for (Map.Entry entry : nodeMongo.getProperties().entrySet()) { nodeImpl.addProperty(entry.getKey(), convertObjectValue(entry.getValue())); @@ -90,19 +79,6 @@ put(KEY_BRANCH_ID, branchId); } - @SuppressWarnings("unchecked") - public List getChildren() { - return (List)get(KEY_CHILDREN); - } - - public void setChildren(List children) { - if (children != null) { - put(KEY_CHILDREN, children); - } else { - removeField(KEY_CHILDREN); - } - } - public boolean isDeleted() { return getBoolean(KEY_DELETED); } @@ -149,10 +125,6 @@ public MongoNode copy() { MongoNode copy = new MongoNode(); copy.putAll((Map) super.copy()); - List children = getChildren(); - if (children != null) { - copy.put(KEY_CHILDREN, new ArrayList(children)); - } copy.put(KEY_PROPERTIES, new HashMap(getProperties())); return copy; } @@ -163,40 +135,17 @@ // //-------------------------------------------------------------------------- - public void addChild(String childName) { - if (removedChildren != null && removedChildren.remove(childName)) { - return; - } - - if (addedChildren == null) { - addedChildren = new LinkedList(); - } - - if (!addedChildren.contains(childName)) { - addedChildren.add(childName); - } - } - - public List getAddedChildren() { - return addedChildren; - } - - public void removeChild(String childName) { - if (addedChildren != null && addedChildren.remove(childName)) { - return; - } - - if (removedChildren == null) { - removedChildren = new LinkedList(); - } - - if (!removedChildren.contains(childName)) { - removedChildren.add(childName); + public List getChildren(Collection nodes) { + List children = new ArrayList(); + for (Iterator iterator = nodes.iterator(); iterator.hasNext();) { + MongoNode node = iterator.next(); + String path = node.getPath(); + if (!PathUtils.denotesRoot(path) && PathUtils.getParentPath(path).equals(getPath())) { + children.add(node); + iterator.remove(); + } } - } - - public List getRemovedChildren() { - return removedChildren; + return children; } public void addProperty(String key, Object value) { @@ -227,39 +176,11 @@ // //-------------------------------------------------------------------------- - public boolean childExists(String childName) { - List children = getChildren(); - if (children != null && !children.isEmpty()) { - if (children.contains(childName) && !childExistsInRemovedChildren(childName)) { - return true; - } - } - return childExistsInAddedChildren(childName); - } - - private boolean childExistsInAddedChildren(String childName) { - return addedChildren != null && !addedChildren.isEmpty()? - addedChildren.contains(childName) : false; - } - - private boolean childExistsInRemovedChildren(String childName) { - return removedChildren != null && !removedChildren.isEmpty()? - removedChildren.contains(childName) : false; - } - @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(super.toString()); sb.deleteCharAt(sb.length() - 1); - if (addedChildren != null && !addedChildren.isEmpty()) { - sb.append(", addedChildren : "); - sb.append(addedChildren); - } - if (removedChildren != null && !removedChildren.isEmpty()) { - sb.append(", removedChildren : "); - sb.append(removedChildren); - } if (addedProps != null && !addedProps.isEmpty()) { sb.append(", addedProps : "); sb.append(addedProps); Index: oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/model/MongoNodeTest.java =================================================================== --- oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/model/MongoNodeTest.java (revision 1442044) +++ oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/model/MongoNodeTest.java (working copy) @@ -19,9 +19,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import java.util.ArrayList; import java.util.HashMap; -import java.util.List; import java.util.Map; import org.junit.Test; @@ -34,9 +32,6 @@ // Create a node with properties MongoNode node = new MongoNode(); node.setBranchId("branchId"); - List children = new ArrayList(); - children.add("child"); - node.setChildren(children); node.setDeleted(true); node.setPath("path"); Map properties = new HashMap(); @@ -47,8 +42,6 @@ // Copy the node and change properties MongoNode copy = node.copy(); copy.setBranchId("branchId2"); - List copyChildren = copy.getChildren(); - copyChildren.add("child2"); copy.setDeleted(false); copy.setPath("path2"); Map copyProperties = copy.getProperties(); @@ -58,9 +51,6 @@ // Assert that original node did not change assertEquals("branchId", node.getBranchId()); - children = node.getChildren(); - assertEquals(1, children.size()); - assertEquals("child", children.get(0)); assertTrue(node.isDeleted()); assertEquals("path", node.getPath()); properties = node.getProperties();