/** * Add a request to read the children of a node at the supplied location in the designated workspace. * * @param of the location of the node whose children are to be read * @param workspaceName the name of the workspace * @return this builder for method chaining; never null * @throws IllegalArgumentException if the location or workspace name is null */ public BatchRequestBuilder readAllChildren( Location of, String workspaceName ) { return add(new ReadAllChildrenRequest(of, workspaceName)); }
/** * Add a request to read the children of a node at the supplied location in the designated workspace. * * @param of the location of the node whose children are to be read * @param workspaceName the name of the workspace * @return the request; never null * @throws IllegalArgumentException if the location or workspace name is null */ public ReadAllChildrenRequest readAllChildren( Location of, String workspaceName ) { return process(new ReadAllChildrenRequest(of, workspaceName)); }
@Override protected Request createRequest() { return new ReadAllChildrenRequest(validPathLocation1, workspace1); }
@Test( expected = IllegalArgumentException.class ) public void shouldNotAllowCreatingRequestWithNullFromLocation() { new ReadAllChildrenRequest(null, workspace1); }
@Test( expected = IllegalArgumentException.class ) public void shouldNotAllowCreatingRequestWithNullWorkspaceName() { new ReadAllChildrenRequest(validPathLocation1, null); }
@Test public void shouldConsiderEqualTwoRequestsWithSameLocationsAndWorkspaceNames() { request = new ReadAllChildrenRequest(validPathLocation1, workspace1); ReadAllChildrenRequest request2 = new ReadAllChildrenRequest(validPathLocation1, workspace1); assertThat(request, is(request2)); }
@Test public void shouldConsiderNotEqualTwoRequestsWithDifferentLocations() { request = new ReadAllChildrenRequest(validPathLocation1, workspace1); ReadAllChildrenRequest request2 = new ReadAllChildrenRequest(validPathLocation2, workspace1); assertThat(request.equals(request2), is(false)); }
@Test public void shouldConsiderNotEqualTwoRequestsWithDifferentWorkspaces() { request = new ReadAllChildrenRequest(validPathLocation1, workspace1); ReadAllChildrenRequest request2 = new ReadAllChildrenRequest(validPathLocation1, workspace2); assertThat(request.equals(request2), is(false)); }
if (request == null) return; ReadAllChildrenRequest readAll = new ReadAllChildrenRequest(request.of(), request.inWorkspace()); process(readAll); if (readAll.hasError()) {
@Override @Before public void beforeEach() { super.beforeEach(); Request request1 = new ReadPropertyRequest(validPathLocation1, "workspace1", createName("property")); Request request2 = new ReadPropertyRequest(validPathLocation2, "workspace1", createName("property")); Request request3 = new ReadAllChildrenRequest(validPathLocation, "workspace1"); requests = new Request[] {request1, request2, request3}; requestList = Arrays.asList(requests); }
@Test public void shouldAllowAddingChildren() { request = new ReadAllChildrenRequest(validPathLocation1, workspace1); request.addChild(validPathLocation1); request.addChild(validPathLocation2); assertThat(request.getChildren().size(), is(2)); assertThat(request.getChildren(), hasItems(validPathLocation1, validPathLocation2)); } }
@Test public void shouldIncludeTimeLoadedInReadAllChildrenRequests() { String workspaceName = graph.getCurrentWorkspaceName(); // Don't use the graph so that we can obtain and interrogate the request ... CacheableRequest request = new ReadAllChildrenRequest(location("/"), workspaceName); execute(request); assertThat(request.getTimeLoaded(), is(notNullValue())); }
@Test public void shouldCreateValidRequestWithValidLocation() { request = new ReadAllChildrenRequest(validPathLocation1, workspace1); assertThat(request.of(), is(sameInstance(validPathLocation1))); assertThat(request.inWorkspace(), is(sameInstance(workspace1))); assertThat(request.hasError(), is(false)); assertThat(request.getError(), is(nullValue())); }
if (!children.isEmpty()) { ReadAllChildrenRequest placeholderRequest = new ReadAllChildrenRequest(placeholder.location(), request.inWorkspace()); placeholderRequest.addChildren(children); ReadAllChildrenRequest placeholderRequest = new ReadAllChildrenRequest(placeholder.location(), request.inWorkspace()); placeholderRequest.addChildren(children); ProxyNode proxy = projectedNode.asProxy(); ReadAllChildrenRequest pushDownRequest = new ReadAllChildrenRequest(proxy.location(), proxy.workspaceName()); federatedRequest.add(pushDownRequest, proxy.isSameLocationAsOriginal(), false, proxy.projection());
if (request.isCancelled()) return; ReadAllChildrenRequest readChildren = new ReadAllChildrenRequest(request.at(), request.inWorkspace()); process(readChildren); if (readChildren.hasError()) {
ReadAllChildrenRequest readChildren = new ReadAllChildrenRequest(request.at(), request.inWorkspace()); process(readChildren); if (readChildren.hasError()) {
ReadAllChildrenRequest readAll = new ReadAllChildrenRequest(Location.create(parentPath), request.inWorkspace()); process(readAll); if (readAll.hasError()) {