Package org.jboss.dna.graph

Examples of org.jboss.dna.graph.Subgraph


        boolean batch = true;
        createSubgraph(graph, initialPath, depth, numChildrenPerNode, numPropertiesPerNode, batch, sw, System.out, null);

        // Verify that the content doesn't change
        Location root = graph.getCurrentWorkspace().getRoot();
        Subgraph subgraph1 = graph.getSubgraphOfDepth(10).at(root);
        Subgraph subgraph2 = graph.getSubgraphOfDepth(10).at(root);
        assertEquivalentSubgraphs(subgraph1, subgraph2, true, true);
    }
View Full Code Here


        assertThat(nodeB, hasProperty("propD", "valueD"));
        assertThat(nodeB, hasProperty("propE", "valueE"));
        assertThat(nodeB.getChildren(), isEmpty());

        // Get the subgraph ...
        Subgraph subgraph = graph.getSubgraphOfDepth(3).at("/");
        assertThat(subgraph, is(notNullValue()));
        assertThat(subgraph.getNode("."), hasProperty(DnaLexicon.UUID, getRootNodeUuid()));
        assertThat(subgraph.getNode("."), hasProperty("propA", "valueA"));
        assertThat(subgraph.getNode(".").getChildren(), hasChildren(segment("a"), segment("b")));
        assertThat(subgraph.getNode("a"), is(notNullValue()));
        assertThat(subgraph.getNode("a"), hasProperty("propB", "valueB"));
        assertThat(subgraph.getNode("a"), hasProperty("propC", "valueC"));
        assertThat(subgraph.getNode("a").getChildren(), isEmpty());
        assertThat(subgraph.getNode("b"), is(notNullValue()));
        assertThat(subgraph.getNode("b"), hasProperty("propD", "valueD"));
        assertThat(subgraph.getNode("b"), hasProperty("propE", "valueE"));
        assertThat(subgraph.getNode("b").getChildren(), isEmpty());
    }
View Full Code Here

        assertThat(graph.getChildren().of("/node3/node1"), hasChildren(segment("node1"), segment("node2"), segment("node3")));
        assertThat(graph.getChildren().of("/node3/node2"), hasChildren(segment("node1"), segment("node2"), segment("node3")));
        assertThat(graph.getChildren().of("/node3/node3"), hasChildren(segment("node1"), segment("node2"), segment("node3")));
        assertThat(graph.getChildren().of("/node3/node3/node1"), isEmpty());

        Subgraph subgraph = graph.getSubgraphOfDepth(2).at("/node3/node2");
        assertThat(subgraph, is(notNullValue()));
        assertThat(subgraph.getNode(".").getChildren(), hasChildren(segment("node1"), segment("node2"), segment("node3")));
        assertThat(subgraph.getNode("."), hasProperty("property1", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("."), hasProperty("property2", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("."), hasProperty("property3", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node1").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node1"), hasProperty("property1", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node1"), hasProperty("property2", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node1"), hasProperty("property3", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node2"), hasProperty("property1", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2"), hasProperty("property2", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2"), hasProperty("property3", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node3"), hasProperty("property1", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3"), hasProperty("property2", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3"), hasProperty("property3", "The quick brown fox jumped over the moon. What? "));

        subgraph = graph.getSubgraphOfDepth(2).at("/node3");
        assertThat(subgraph, is(notNullValue()));
        assertThat(subgraph.getNode(".").getChildren(), hasChildren(segment("node1"), segment("node2"), segment("node3")));
        assertThat(subgraph.getNode("."), hasProperty("property1", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("."), hasProperty("property2", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("."), hasProperty("property3", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node1").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node1"), hasProperty("property1", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node1"), hasProperty("property2", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node1"), hasProperty("property3", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node2"), hasProperty("property1", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2"), hasProperty("property2", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2"), hasProperty("property3", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node3"), hasProperty("property1", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3"), hasProperty("property2", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3"), hasProperty("property3", "The quick brown fox jumped over the moon. What? "));
    }
View Full Code Here

        int numPropertiesPerNode = 3;
        Stopwatch sw = new Stopwatch();
        boolean batch = true;
        createSubgraph(graph, initialPath, depth, numChildrenPerNode, numPropertiesPerNode, batch, sw, System.out, null);

        Subgraph source = graph.getSubgraphOfDepth(3).at("/node1");

        graph.useWorkspace(defaultWorkspaceName);

        graph.create("/newUuids").and();
        // Copy once to get the UUID into the default workspace
        // graph.copy("/node1").replacingExistingNodesWithSameUuids().fromWorkspace(workspaceName).to("/newUuids/node1");
        graph.clone("/node1")
             .fromWorkspace(workspaceName)
             .as(name("node1"))
             .into("/newUuids")
             .replacingExistingNodesWithSameUuids();

        // Make sure that the node wasn't moved by the clone
        graph.useWorkspace(workspaceName);
        graph.getNodeAt("/node1");
        graph.useWorkspace(defaultWorkspaceName);

        // Create a new child node that in the target workspace that has no corresponding node in the source workspace
        graph.create("/newUuids/node1/shouldBeRemoved");

        // Copy again to test the behavior now that the UUIDs are already in the default workspace
        // This should remove /newUuids/node1/shouldBeRemoved
        // graph.copy("/node1").replacingExistingNodesWithSameUuids().fromWorkspace(workspaceName).to("/newUuids/otherNode");
        graph.clone("/node1")
             .fromWorkspace(workspaceName)
             .as(name("otherNode"))
             .into("/newUuids")
             .replacingExistingNodesWithSameUuids();

        /*
         * Focus on testing node structure, since shouldCopyNodeWithChildren tests that properties get copied
         */
        // /newUuids/node1 should have been removed when the new node was added with the same UUID
        assertThat(graph.getNodeAt("/newUuids").getChildren(), hasChildren(segment("otherNode")));

        try {
            graph.getNodeAt("/newUuids/node1/shouldBeRemoved");
            fail("/newUuids/node1/shouldBeRemoved should no longer exist after the copy-with-remove-conflicting-uuids operation");
        } catch (PathNotFoundException pnfe) {
            // Expected
        }

        Subgraph target = graph.getSubgraphOfDepth(3).at("/newUuids/otherNode");
        assertThat(target, is(notNullValue()));
        assertThat(target.getNode(".").getChildren(), hasChildren(segment("node1"), segment("node2"), segment("node3")));
        assertThat(uuidFor(target.getNode(".")), is(uuidFor(source.getNode("."))));
        assertThat(target.getNode("node1").getChildren(), hasChildren(segment("node1"), segment("node2"), segment("node3")));
        assertThat(uuidFor(target.getNode("node1")), is(uuidFor(source.getNode("node1"))));
        assertThat(target.getNode("node2").getChildren(), hasChildren(segment("node1"), segment("node2"), segment("node3")));
        assertThat(uuidFor(target.getNode("node2")), is(uuidFor(source.getNode("node2"))));
        assertThat(target.getNode("node3").getChildren(), hasChildren(segment("node1"), segment("node2"), segment("node3")));
        assertThat(uuidFor(target.getNode("node3")), is(uuidFor(source.getNode("node3"))));
    }
View Full Code Here

        int numPropertiesPerNode = 3;
        Stopwatch sw = new Stopwatch();
        boolean batch = true;
        createSubgraph(graph, initialPath, depth, numChildrenPerNode, numPropertiesPerNode, batch, sw, System.out, null);

        Subgraph source = graph.getSubgraphOfDepth(3).at("/node1");

        graph.useWorkspace(defaultWorkspaceName);

        graph.create("/segmentTestUuids").and();
        // Copy once to get the UUID into the default workspace
        graph.clone("/node1").fromWorkspace(workspaceName).as(name("node1")).into("/segmentTestUuids").failingIfAnyUuidsMatch();

        // Create a new child node that in the target workspace that has no corresponding node in the source workspace
        PropertyFactory propFactory = context.getPropertyFactory();
        graph.create("/segmentTestUuids/node1", propFactory.create(name("identifier"), "backup copy")).and();

        // Copy again to test the behavior now that the UUIDs are already in the default workspace
        // This should remove /segmentTestUuids/node1[1]
        graph.clone("/node1")
             .fromWorkspace(workspaceName)
             .as(segment("node1[1]"))
             .into("/segmentTestUuids")
             .replacingExistingNodesWithSameUuids();

        /*
         * Focus on testing node structure, since shouldCopyNodeWithChildren tests that properties get copied
         */
        // /segmentTestUuids/node1[1] should have been removed when the new node was added with the same UUID
        // Now "/segmentTestUuids/node1[1]" (which was "/segmentTestUuids/node1[2]") should have same UUID as the
        // node with "identifier=backup copy" property
        assertThat(graph.getNodeAt("/segmentTestUuids").getChildren(), hasChildren(segment("node1"), segment("node1[2]")));
        assertThat(graph.getNodeAt("/segmentTestUuids/node1[1]").getProperty("identifier"), is(nullValue()));
        assertThat(graph.getNodeAt("/segmentTestUuids/node1[2]").getProperty("identifier").getFirstValue().toString(),
                   is("backup copy"));

        Subgraph target = graph.getSubgraphOfDepth(3).at("/segmentTestUuids/node1[1]");
        assertThat(target, is(notNullValue()));
        assertThat(target.getNode(".").getChildren(), hasChildren(segment("node1"), segment("node2"), segment("node3")));
        assertThat(uuidFor(target.getNode(".")), is(uuidFor(source.getNode("."))));
        assertThat(target.getNode("node1").getChildren(), hasChildren(segment("node1"), segment("node2"), segment("node3")));
        assertThat(uuidFor(target.getNode("node1")), is(uuidFor(source.getNode("node1"))));
        assertThat(target.getNode("node2").getChildren(), hasChildren(segment("node1"), segment("node2"), segment("node3")));
        assertThat(uuidFor(target.getNode("node2")), is(uuidFor(source.getNode("node2"))));
        assertThat(target.getNode("node3").getChildren(), hasChildren(segment("node1"), segment("node2"), segment("node3")));
        assertThat(uuidFor(target.getNode("node3")), is(uuidFor(source.getNode("node3"))));
    }
View Full Code Here

        assertThat(graph.getChildren().of("/node3/node2[2]/node3"), hasChildren(segment("node1"),
                                                                                segment("node2"),
                                                                                segment("node3")));
        assertThat(graph.getChildren().of("/node3/node2[2]/node1/node1"), hasChildren());

        Subgraph subgraph = graph.getSubgraphOfDepth(4).at("/node3");
        assertThat(subgraph, is(notNullValue()));
        assertThat(subgraph.getNode(".").getChildren(), hasChildren(segment("node2"), segment("node3")));
        assertThat(subgraph.getNode("."), hasProperty("property1", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("."), hasProperty("property2", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("."), hasProperty("property3", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]").getChildren(), hasChildren(segment("node1"), segment("node2"), segment("node3")));
        assertThat(subgraph.getNode("node2[1]"), hasProperty("property1", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]"), hasProperty("property2", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]"), hasProperty("property3", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node3"), hasProperty("property1", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3"), hasProperty("property2", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3"), hasProperty("property3", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]").getChildren(), hasChildren(segment("node1"), segment("node2"), segment("node3")));
        assertThat(subgraph.getNode("node2[2]"), hasProperty("property1", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]"), hasProperty("property2", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]"), hasProperty("property3", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node1").getChildren(), hasChildren(segment("node1"),
                                                                                 segment("node2"),
                                                                                 segment("node3")));
        assertThat(subgraph.getNode("node2[2]/node1"), hasProperty("property1",
                                                                   "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node1"), hasProperty("property2",
                                                                   "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node1"), hasProperty("property3",
                                                                   "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node1/node1").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node2[2]/node1/node1"), hasProperty("property1",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node1/node1"), hasProperty("property2",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node1/node1"), hasProperty("property3",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node1/node2").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node2[2]/node1/node2"), hasProperty("property1",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node1/node2"), hasProperty("property2",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node1/node2"), hasProperty("property3",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node1/node3").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node2[2]/node1/node3"), hasProperty("property1",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node1/node3"), hasProperty("property2",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node1/node3"), hasProperty("property3",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node2"), hasProperty("property1",
                                                                   "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node2"), hasProperty("property2",
                                                                   "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node2"), hasProperty("property3",
                                                                   "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node2/node1").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node2[2]/node2/node1"), hasProperty("property1",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node2/node1"), hasProperty("property2",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node2/node1"), hasProperty("property3",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node2/node2").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node2[2]/node2/node2"), hasProperty("property1",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node2/node2"), hasProperty("property2",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node2/node2"), hasProperty("property3",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node2/node3").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node2[2]/node2/node3"), hasProperty("property1",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node2/node3"), hasProperty("property2",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node2/node3"), hasProperty("property3",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node3"), hasProperty("property1",
                                                                   "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node3"), hasProperty("property2",
                                                                   "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node3"), hasProperty("property3",
                                                                   "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node3/node1").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node2[2]/node3/node1"), hasProperty("property1",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node3/node1"), hasProperty("property2",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node3/node1"), hasProperty("property3",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node3/node2").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node2[2]/node3/node2"), hasProperty("property1",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node3/node2"), hasProperty("property2",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node3/node2"), hasProperty("property3",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node3/node3").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node2[2]/node3/node3"), hasProperty("property1",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node3/node3"), hasProperty("property2",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]/node3/node3"), hasProperty("property3",
                                                                         "The quick brown fox jumped over the moon. What? "));
    }
View Full Code Here

        assertThat(graph.getChildren().of("/node3/node3[2]/node3"), hasChildren(segment("node1"),
                                                                                segment("node2"),
                                                                                segment("node3")));
        assertThat(graph.getChildren().of("/node3/node3[2]/node1/node1"), hasChildren());

        Subgraph subgraph = graph.getSubgraphOfDepth(4).at("/node3");
        assertThat(subgraph, is(notNullValue()));
        assertThat(subgraph.getNode(".").getChildren(), hasChildren(segment("node2"), segment("node3")));
        assertThat(subgraph.getNode("."), hasProperty("property1", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("."), hasProperty("property2", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("."), hasProperty("property3", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]").getChildren(), hasChildren(segment("node1"), segment("node2"), segment("node3")));
        assertThat(subgraph.getNode("node2[1]"), hasProperty("property1", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]"), hasProperty("property2", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]"), hasProperty("property3", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node3"), hasProperty("property1", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3"), hasProperty("property2", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3"), hasProperty("property3", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]").getChildren(), hasChildren(segment("node1"), segment("node2"), segment("node3")));
        assertThat(subgraph.getNode("node3[2]"), hasProperty("property1", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]"), hasProperty("property2", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]"), hasProperty("property3", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node1").getChildren(), hasChildren(segment("node1"),
                                                                                 segment("node2"),
                                                                                 segment("node3")));
        assertThat(subgraph.getNode("node3[2]/node1"), hasProperty("property1",
                                                                   "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node1"), hasProperty("property2",
                                                                   "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node1"), hasProperty("property3",
                                                                   "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node1/node1").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node3[2]/node1/node1"), hasProperty("property1",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node1/node1"), hasProperty("property2",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node1/node1"), hasProperty("property3",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node1/node2").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node3[2]/node1/node2"), hasProperty("property1",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node1/node2"), hasProperty("property2",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node1/node2"), hasProperty("property3",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node1/node3").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node3[2]/node1/node3"), hasProperty("property1",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node1/node3"), hasProperty("property2",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node1/node3"), hasProperty("property3",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node2"), hasProperty("property1",
                                                                   "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node2"), hasProperty("property2",
                                                                   "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node2"), hasProperty("property3",
                                                                   "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node2/node1").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node3[2]/node2/node1"), hasProperty("property1",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node2/node1"), hasProperty("property2",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node2/node1"), hasProperty("property3",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node2/node2").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node3[2]/node2/node2"), hasProperty("property1",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node2/node2"), hasProperty("property2",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node2/node2"), hasProperty("property3",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node2/node3").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node3[2]/node2/node3"), hasProperty("property1",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node2/node3"), hasProperty("property2",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node2/node3"), hasProperty("property3",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node3"), hasProperty("property1",
                                                                   "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node3"), hasProperty("property2",
                                                                   "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node3"), hasProperty("property3",
                                                                   "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node3/node1").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node3[2]/node3/node1"), hasProperty("property1",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node3/node1"), hasProperty("property2",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node3/node1"), hasProperty("property3",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node3/node2").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node3[2]/node3/node2"), hasProperty("property1",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node3/node2"), hasProperty("property2",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node3/node2"), hasProperty("property3",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node3/node3").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node3[2]/node3/node3"), hasProperty("property1",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node3/node3"), hasProperty("property2",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3[2]/node3/node3"), hasProperty("property3",
                                                                         "The quick brown fox jumped over the moon. What? "));
    }
View Full Code Here

                   hasChildren(segment("node1"), segment("node2"), segment("node3")));
        assertThat(graph.getChildren().of("/node3/nodeX/node3"),
                   hasChildren(segment("node1"), segment("node2"), segment("node3")));
        assertThat(graph.getChildren().of("/node3/nodeX/node1/node1"), hasChildren());

        Subgraph subgraph = graph.getSubgraphOfDepth(4).at("/node3");
        assertThat(subgraph, is(notNullValue()));
        assertThat(subgraph.getNode(".").getChildren(), hasChildren(segment("node2"), segment("node3")));
        assertThat(subgraph.getNode("."), hasProperty("property1", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("."), hasProperty("property2", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("."), hasProperty("property3", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]").getChildren(), hasChildren(segment("node1"), segment("node2"), segment("node3")));
        assertThat(subgraph.getNode("node2[1]"), hasProperty("property1", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]"), hasProperty("property2", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]"), hasProperty("property3", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node3"), hasProperty("property1", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3"), hasProperty("property2", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3"), hasProperty("property3", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX").getChildren(), hasChildren(segment("node1"), segment("node2"), segment("node3")));
        assertThat(subgraph.getNode("nodeX"), hasProperty("property1", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX"), hasProperty("property2", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX"), hasProperty("property3", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node1").getChildren(), hasChildren(segment("node1"),
                                                                              segment("node2"),
                                                                              segment("node3")));
        assertThat(subgraph.getNode("nodeX/node1"), hasProperty("property1", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node1"), hasProperty("property2", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node1"), hasProperty("property3", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node1/node1").getChildren(), isEmpty());
        assertThat(subgraph.getNode("nodeX/node1/node1"), hasProperty("property1",
                                                                      "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node1/node1"), hasProperty("property2",
                                                                      "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node1/node1"), hasProperty("property3",
                                                                      "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node1/node2").getChildren(), isEmpty());
        assertThat(subgraph.getNode("nodeX/node1/node2"), hasProperty("property1",
                                                                      "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node1/node2"), hasProperty("property2",
                                                                      "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node1/node2"), hasProperty("property3",
                                                                      "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node1/node3").getChildren(), isEmpty());
        assertThat(subgraph.getNode("nodeX/node1/node3"), hasProperty("property1",
                                                                      "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node1/node3"), hasProperty("property2",
                                                                      "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node1/node3"), hasProperty("property3",
                                                                      "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node2"), hasProperty("property1", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node2"), hasProperty("property2", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node2"), hasProperty("property3", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node2/node1").getChildren(), isEmpty());
        assertThat(subgraph.getNode("nodeX/node2/node1"), hasProperty("property1",
                                                                      "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node2/node1"), hasProperty("property2",
                                                                      "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node2/node1"), hasProperty("property3",
                                                                      "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node2/node2").getChildren(), isEmpty());
        assertThat(subgraph.getNode("nodeX/node2/node2"), hasProperty("property1",
                                                                      "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node2/node2"), hasProperty("property2",
                                                                      "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node2/node2"), hasProperty("property3",
                                                                      "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node2/node3").getChildren(), isEmpty());
        assertThat(subgraph.getNode("nodeX/node2/node3"), hasProperty("property1",
                                                                      "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node2/node3"), hasProperty("property2",
                                                                      "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node2/node3"), hasProperty("property3",
                                                                      "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node3"), hasProperty("property1", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node3"), hasProperty("property2", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node3"), hasProperty("property3", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node3/node1").getChildren(), isEmpty());
        assertThat(subgraph.getNode("nodeX/node3/node1"), hasProperty("property1",
                                                                      "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node3/node1"), hasProperty("property2",
                                                                      "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node3/node1"), hasProperty("property3",
                                                                      "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node3/node2").getChildren(), isEmpty());
        assertThat(subgraph.getNode("nodeX/node3/node2"), hasProperty("property1",
                                                                      "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node3/node2"), hasProperty("property2",
                                                                      "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node3/node2"), hasProperty("property3",
                                                                      "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node3/node3").getChildren(), isEmpty());
        assertThat(subgraph.getNode("nodeX/node3/node3"), hasProperty("property1",
                                                                      "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node3/node3"), hasProperty("property2",
                                                                      "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("nodeX/node3/node3"), hasProperty("property3",
                                                                      "The quick brown fox jumped over the moon. What? "));
    }
View Full Code Here

        assertThat(graph.getChildren().of("/node3/node2[1]/node3"), hasChildren(segment("node1"),
                                                                                segment("node2"),
                                                                                segment("node3")));
        assertThat(graph.getChildren().of("/node3/node2[1]/node1/node1"), hasChildren());

        Subgraph subgraph = graph.getSubgraphOfDepth(4).at("/node3");
        assertThat(subgraph, is(notNullValue()));
        assertThat(subgraph.getNode(".").getChildren(), hasChildren(segment("node2"), segment("node3")));
        assertThat(subgraph.getNode("."), hasProperty("property1", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("."), hasProperty("property2", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("."), hasProperty("property3", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]").getChildren(), hasChildren(segment("node1"), segment("node2"), segment("node3")));
        assertThat(subgraph.getNode("node2[2]"), hasProperty("property1", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]"), hasProperty("property2", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[2]"), hasProperty("property3", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node3"), hasProperty("property1", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3"), hasProperty("property2", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node3"), hasProperty("property3", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]").getChildren(), hasChildren(segment("node1"), segment("node2"), segment("node3")));
        assertThat(subgraph.getNode("node2[1]"), hasProperty("property1", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]"), hasProperty("property2", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]"), hasProperty("property3", "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node1").getChildren(), hasChildren(segment("node1"),
                                                                                 segment("node2"),
                                                                                 segment("node3")));
        assertThat(subgraph.getNode("node2[1]/node1"), hasProperty("property1",
                                                                   "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node1"), hasProperty("property2",
                                                                   "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node1"), hasProperty("property3",
                                                                   "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node1/node1").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node2[1]/node1/node1"), hasProperty("property1",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node1/node1"), hasProperty("property2",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node1/node1"), hasProperty("property3",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node1/node2").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node2[1]/node1/node2"), hasProperty("property1",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node1/node2"), hasProperty("property2",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node1/node2"), hasProperty("property3",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node1/node3").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node2[1]/node1/node3"), hasProperty("property1",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node1/node3"), hasProperty("property2",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node1/node3"), hasProperty("property3",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node2"), hasProperty("property1",
                                                                   "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node2"), hasProperty("property2",
                                                                   "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node2"), hasProperty("property3",
                                                                   "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node2/node1").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node2[1]/node2/node1"), hasProperty("property1",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node2/node1"), hasProperty("property2",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node2/node1"), hasProperty("property3",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node2/node2").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node2[1]/node2/node2"), hasProperty("property1",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node2/node2"), hasProperty("property2",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node2/node2"), hasProperty("property3",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node2/node3").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node2[1]/node2/node3"), hasProperty("property1",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node2/node3"), hasProperty("property2",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node2/node3"), hasProperty("property3",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node3"), hasProperty("property1",
                                                                   "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node3"), hasProperty("property2",
                                                                   "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node3"), hasProperty("property3",
                                                                   "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node3/node1").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node2[1]/node3/node1"), hasProperty("property1",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node3/node1"), hasProperty("property2",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node3/node1"), hasProperty("property3",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node3/node2").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node2[1]/node3/node2"), hasProperty("property1",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node3/node2"), hasProperty("property2",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node3/node2"), hasProperty("property3",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node3/node3").getChildren(), isEmpty());
        assertThat(subgraph.getNode("node2[1]/node3/node3"), hasProperty("property1",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node3/node3"), hasProperty("property2",
                                                                         "The quick brown fox jumped over the moon. What? "));
        assertThat(subgraph.getNode("node2[1]/node3/node3"), hasProperty("property3",
                                                                         "The quick brown fox jumped over the moon. What? "));
    }
View Full Code Here

        Stopwatch sw = new Stopwatch();
        boolean batch = true;
        createSubgraph(graph, initialPath, depth, numChildrenPerNode, numPropertiesPerNode, batch, sw, System.out, null);

        assertThat(graph.getChildren().of("/"), hasChildren(segment("node1")));
        Subgraph subgraph = graph.getSubgraphOfDepth(2).at("/");
        assertThat(subgraph, is(notNullValue()));

        assertThat(subgraph.getNode("node1"), hasProperty("property1", "The quick brown fox jumped over the moon. What? "));

        graph.addValue("foo").andValue("bar").to("property1").on("node1");

        assertThat(graph.getChildren().of("/"), hasChildren(segment("node1")));
        subgraph = graph.getSubgraphOfDepth(2).at("/");
        assertThat(subgraph, is(notNullValue()));

        assertThat(subgraph.getNode("node1"), hasProperty("property1",
                                                          "The quick brown fox jumped over the moon. What? ",
                                                          "foo",
                                                          "bar"));
    }
View Full Code Here

TOP

Related Classes of org.jboss.dna.graph.Subgraph

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.