@Test public void newer_in_target() throws Exception { final Node node = createNode(CreateNodeParams.create().name("mynode").parent(NodePath.ROOT).build()); doPushNode(WS_OTHER, rootNode); doPushNode(WS_OTHER, node); CTX_OTHER.runWith(() -> doUpdateNode(node)); assertEquals(1, getDiff(WS_DEFAULT, WS_OTHER).getNodesWithDifferences().getSize()); assertEquals(1, getDiff(WS_OTHER, WS_DEFAULT).getNodesWithDifferences().getSize()); }
@Test public void assure_correct_diff_order_when_there_are_children() { final Node node1 = createNode( CreateNodeParams.create() .setNodeId(NodeId.from("dddd")) .parent(NodePath.ROOT) .name("dddd") .build()); final Node node1_1 = createNode( CreateNodeParams.create() .setNodeId(NodeId.from("ccc")) .parent(node1.path()) .name("ccc") .build()); final Node node1_1_1 = createNode( CreateNodeParams.create() .setNodeId(NodeId.from("11")) .parent(node1_1.path()) .name("11") .build()); final Node node1_1_1_1 = createNode( CreateNodeParams.create() .setNodeId(NodeId.from("_a")) .parent(node1_1_1.path()) .name("_a") .build()); final Node node2 = createNode( CreateNodeParams.create() .setNodeId(NodeId.from("node2")) .parent(NodePath.ROOT) .name("node2") .build()); pushNodes(WS_OTHER, node1.id(), node1_1_1_1.id(), node1_1_1.id(), node1_1.id(), node2.id()); CTX_OTHER.runWith(() -> doUpdateNode(node1_1_1_1)); CTX_OTHER.runWith(() -> doUpdateNode(node1_1_1)); CTX_OTHER.runWith(() -> doUpdateNode(node1_1)); CTX_OTHER.runWith(() -> doUpdateNode(node1)); NodeVersionDiffResult result = getDiff(WS_DEFAULT, WS_OTHER, node1.path()); assertEquals(4, result.getNodesWithDifferences().getSize()); int counter = 0; for (final NodeId nodeId : result.getNodesWithDifferences()) { if (counter == 0) { assertEquals("dddd", nodeId.toString()); } else if (counter == 1) { assertEquals("ccc", nodeId.toString()); } else if (counter == 2) { assertEquals("11", nodeId.toString()); } else if (counter == 3) { assertEquals("_a", nodeId.toString()); } counter++; } }