/** * Add a request to delete a branch. * * @param at the location of the top node in the existing branch that is to be deleted * @param workspaceName the name of the workspace containing the parent * @return this builder for method chaining; never null * @throws IllegalArgumentException if the location or workspace name is null */ public BatchRequestBuilder deleteBranch( Location at, String workspaceName ) { return add(new DeleteBranchRequest(at, workspaceName)); }
/** * Add a request to delete a branch. * * @param at the location of the top node in the existing branch that is to be deleted * @param workspaceName the name of the workspace containing the parent * @return the request; never null * @throws IllegalArgumentException if the location or workspace name is null */ public DeleteBranchRequest deleteBranch( Location at, String workspaceName ) { return process(new DeleteBranchRequest(at, workspaceName)); }
@Override protected Request createRequest() { return new DeleteBranchRequest(validPathLocation1, workspace1); }
/** * {@inheritDoc} * <p> * This method does not clone the results. * </p> * * @see org.modeshape.graph.request.ChangeRequest#clone() */ @Override public DeleteBranchRequest clone() { DeleteBranchRequest request = new DeleteBranchRequest(actualLocation != null ? actualLocation : at, workspaceName); request.setActualLocationOfNode(actualLocation); return request; }
@Test public void shouldConsiderEqualTwoRequestsWithSameLocations() { request = new DeleteBranchRequest(validPathLocation1, workspace1); DeleteBranchRequest request2 = new DeleteBranchRequest(validPathLocation1, workspace1); assertThat(request, is(request2)); }
@Test( expected = IllegalArgumentException.class ) public void shouldNotAllowCreatingRequestWithNullWorkspaceName() { new DeleteBranchRequest(validPathLocation1, null); }
@Test( expected = IllegalArgumentException.class ) public void shouldNotAllowCreatingRequestWithNullFromLocation() { new DeleteBranchRequest(null, workspace1); }
@Test public void shouldConsiderNotEqualTwoRequestsWithDifferentWorkspaceNames() { request = new DeleteBranchRequest(validPathLocation1, workspace1); DeleteBranchRequest request2 = new DeleteBranchRequest(validPathLocation1, workspace2); assertThat(request.equals(request2), is(false)); } }
@Test public void shouldConsiderNotEqualTwoRequestsWithDifferentLocations() { request = new DeleteBranchRequest(validPathLocation1, workspace1); DeleteBranchRequest request2 = new DeleteBranchRequest(validPathLocation2, workspace1); assertThat(request.equals(request2), is(false)); }
} catch (InvalidPathException e) { process(new DeleteBranchRequest(startingLocation, workspaceName)); return; process(new DeleteBranchRequest(startingLocation, workspaceName)); } else if (depth > 1) {
@Test public void shouldCreateValidRequestWithValidLocation() { request = new DeleteBranchRequest(validPathLocation1, workspace1); assertThat(request.at(), is(sameInstance(validPathLocation1))); assertThat(request.inWorkspace(), is(sameInstance(workspace1))); assertThat(request.hasError(), is(false)); assertThat(request.getError(), is(nullValue())); }
} else { DeleteBranchRequest pushDownRequest = new DeleteBranchRequest(proxy.location(), proxy.workspaceName()); federatedRequest.add(pushDownRequest, proxy.isSameLocationAsOriginal(), false, proxy.projection()); DeleteBranchRequest delete = new DeleteBranchRequest(placeholder.location(), workspace.getName()); delete.setActualLocationOfNode(placeholder.location()); federatedRequest.add(delete, true, true, null);
DeleteBranchRequest deleteChild = new DeleteBranchRequest(child, request.inWorkspace()); process(deleteChild); request.addDeletedChild(child);