/** * Request to delete the node with the given UUID. This request is submitted to the repository immediately. * * @param at the UUID of the node that is to be deleted * @return an object that may be used to start another request */ public Conjunction<Graph> delete( UUID at ) { return delete(Location.create(at)); }
/** * Request to delete the node at the given path. This request is submitted to the repository immediately. * * @param at the path of the node that is to be deleted * @return an object that may be used to start another request */ public Conjunction<Graph> delete( Path at ) { return delete(Location.create(at)); }
/** * Request to delete the node with the given identification properties. The identification properties should uniquely identify * a single node. This request is submitted to the repository immediately. * * @param firstIdProperty the first identification property of the node that is to be copied * @param additionalIdProperties the remaining identification properties of the node that is to be copied * @return an object that may be used to start another request */ public Conjunction<Graph> delete( Property firstIdProperty, Property... additionalIdProperties ) { return delete(Location.create(firstIdProperty, additionalIdProperties)); }
/** * Request to delete the node with the given unique identification property. This request is submitted to the repository * immediately. * * @param idProperty the unique identifying property of the node that is to be deleted * @return an object that may be used to start another request */ public Conjunction<Graph> delete( Property idProperty ) { return delete(Location.create(idProperty)); }
/** * Request to delete the node at the given path. This request is submitted to the repository immediately. * * @param atPath the path of the node that is to be deleted * @return an object that may be used to start another request */ public Conjunction<Graph> delete( String atPath ) { return delete(Location.create(createPath(atPath))); }
@Test( expected = InvalidPathException.class ) public void shouldPropogateExceptionFromConnectorWhenDeleteLocationIsNotFound() { connection.error = new InvalidPathException(); graph.delete(validUuid); }
@Test public void shouldAllowDeletingNodeAtBottomOfOffset() { // This is not below the offset '/a/b' and should therefore fail ... federated.delete("/a/b"); // This deletes everything, and recreates /a/b (since it is a placeholder) ... assertSameNode("/"); assertThat(federated.getChildren().of("/a/b").size(), is(0)); }
@Test public void shouldDeleteNodeWellBelowRootFromMirrorSource() { federated.delete("/Cars/Luxury/Cadillac DTS"); assertNoNode("/Cars/Luxury/Cadillac DTS"); // And make sure the parent node is the same ... assertSameNode("/Cars/Luxury"); } }
@Test public void shouldDeleteNodeWellBelowRootInOffsetSource() { // Delete the node below the offset ... federated.delete("/a/b/Cars/Luxury/Cadillac DTS"); assertNoNode("/Cars/Luxury/Cadillac DTS"); // And make sure the parent node is the same ... assertSameNode("/Cars/Luxury"); } }
@Test public void shouldDeleteEverythingInMirrorAndOffsetIfDeletingRoot() { federated.delete("/"); // The branch node should still exist, since it's a placeholder ... assertThat(federated.getChildren().of("/").size(), is(1)); assertBranchNode("/Aircraft"); } }
@Test public void shouldNodeAllowDeletingNodeWithinOffset() { federated.delete("/a"); assertSameNode("/"); // All nodes should be removed, but the placeholders should remain ... assertThat(federated.getChildren().of("/a").size(), is(1)); assertThat(federated.getChildren().of("/a/b").size(), is(0)); }
@Test( expected = InvalidRequestException.class ) public void shouldNotAllowDeletingNodes() { // Find a child under the root ... for (Location child : graph.getChildren().of("/")) { graph.delete(child); // first one should fail fail("No error when attempting to delete the first child under root"); } }
@Test public void shouldDeleteNodeUnderRootInBranchSource() { federated.delete("/Aircraft/Business"); assertNoNode("/Aircraft/Business"); assertBranchNode("/Aircraft"); assertBranchNode("/Aircraft/Commercial"); }
@Test public void shouldDeleteNodeWellBelowRootInMirrorSource() { federated.delete("/Cars/Luxury/Cadillac DTS"); assertNoNode("/Cars/Luxury/Cadillac DTS"); assertMirrorNode("/Cars/Luxury/Lexus IS350"); assertMirrorNode("/Cars/Luxury"); }
@Test public void shouldDeleteNodeUnderRootFromMirrorSource() { // Create a node that we can delete ... federated.createAt("/Hovercraft").with("prop1", "value1").and(); assertSameNode("/Hovercraft"); federated.delete("/Hovercraft"); assertNoNode("/Hovercraft"); // And make sure the parent node is the same ... assertSameNode("/"); // Delete the cars node (which is everything) ... federated.delete("/Cars"); // And make sure the parent node is the same ... assertSameNode("/"); }
@Test public void shouldDeleteNode() { graph.delete(validPath); assertThat(numberOfExecutions, is(1)); assertNextRequestIsDelete(Location.create(validPath)); assertNoMoreRequests(); graph.delete(validPathString); assertThat(numberOfExecutions, is(1)); assertNextRequestIsDelete(Location.create(validPath)); assertNoMoreRequests(); graph.delete(validUuid); assertThat(numberOfExecutions, is(1)); assertNextRequestIsDelete(Location.create(validUuid)); assertNoMoreRequests(); graph.delete(validIdProperty1); assertThat(numberOfExecutions, is(1)); assertNextRequestIsDelete(Location.create(validIdProperty1)); assertNoMoreRequests(); graph.delete(validIdProperty1, validIdProperty2); assertThat(numberOfExecutions, is(1)); assertNextRequestIsDelete(Location.create(validIdProperty1, validIdProperty2)); assertNoMoreRequests(); }
@Test public void shouldDeleteNodeWellBelowRootInBranchSource() { federated.delete("/Aircraft/Business/Learjet 45"); assertNoNode("/Aircraft/Business/Learjet 45"); assertBranchNode("/Aircraft/Business/Gulfstream V"); assertBranchNode("/Aircraft/Business"); assertBranchNode("/Aircraft/Commercial"); }
@Test public void shouldDeleteNodeUnderRootInOffsetSource() { // Create the node below the offset ... federated.createAt("/a/b/Hovercraft").with("prop1", "value1").and(); // Verify it is the same from the federation and source ... assertSameNode("/Hovercraft"); // And make sure the parent node is the same ... assertSameNode("/"); // Delete the node below the offset ... federated.delete("/a/b/Hovercraft"); // Verify it is the same from the federation and source ... assertNoNode("/Hovercraft"); assertSameNode("/"); // Delete the node below the offset ... federated.delete("/a/b/Cars"); // Verify it is the same from the federation and source ... assertSameNode("/"); }
@Test public void shouldDeleteNodeUnderRootInMirrorSource() { // Create a new node (since there's only one node under the root) ... federated.createAt("/Hovercraft").with("prop1", "value1").and(); assertMirrorNode("/Hovercraft"); assertSameNode("/", "/", mirrorSourceName, mirrorWorkspaceName, "Aircraft"); // Now delete it ... federated.delete("/Hovercraft"); assertNoNode("/Hovercraft"); }
@FixFor( {"MODE-1071", "MODE-1066"} ) @Test public void shouldSuccessfullyCollectGarbageMultiplePassesAfterCreatingContentAndDeletingSome() { String workspaceName = "copyChildrenSource"; tryCreatingAWorkspaceNamed(workspaceName); graph.useWorkspace(workspaceName); String initialPath = ""; int depth = 4; int numChildrenPerNode = 6; int numPropertiesPerNode = 10; Stopwatch sw = new Stopwatch(); boolean batch = true; useLargeValues = true; useUniqueLargeValues = true; createSubgraph(graph, initialPath, depth, numChildrenPerNode, numPropertiesPerNode, batch, sw, System.out, null); collectGarbage(1); graph.delete("/node2").and(); int passes = 3; collectGarbage(passes); } }