/** * Add a request to obtain the information about the available workspaces. * * @return this builder for method chaining; never null */ public BatchRequestBuilder getWorkspaces() { return add(new GetWorkspacesRequest()); }
/** * Add a request to obtain the information about the available workspaces. * * @return the request; never null */ public GetWorkspacesRequest getWorkspaces() { GetWorkspacesRequest request = new GetWorkspacesRequest(); process(request); return request; }
@Override protected Request createRequest() { return new GetWorkspacesRequest(); }
@Test public void shouldConsiderEqualAnyTwoRequests() { assertThat(new GetWorkspacesRequest(), is(new GetWorkspacesRequest())); } }
/** * Index (or re-index) all of the content in all of the workspaces within the source. This method operates synchronously and * returns when the requested indexing is completed. * * @return this object for convenience in method chaining; never null * @throws RepositorySourceException if there is a problem accessing the content * @throws SearchEngineException if there is a problem updating the indexes * @throws IllegalArgumentException if the context is null, or if depth per read is not positive */ public SearchEngineIndexer indexAllWorkspaces() throws RepositorySourceException, SearchEngineException { // Get the names of all the workspaces ... GetWorkspacesRequest getWorkspaces = new GetWorkspacesRequest(); try { channel.addAndAwait(getWorkspaces); checkRequestForErrors(getWorkspaces); } catch (InterruptedException e) { // Clear the interrupted status of the thread and continue ... Thread.interrupted(); return this; } // Index all of the workspaces ... Path rootPath = context.getValueFactories().getPathFactory().createRootPath(); Location rootLocation = Location.create(rootPath); for (String workspaceName : getWorkspaces.getAvailableWorkspaceNames()) { index(workspaceName, rootLocation); } return this; }
@Test public void shouldMakeAvailablePredefinedWorkspaces() { RepositoryConnection connection = source.getConnection(); GetWorkspacesRequest request = new GetWorkspacesRequest(); connection.execute(context, request); Set<String> workspaces = request.getAvailableWorkspaceNames(); Set<String> graphWorkspaces = new HashSet<String>(Arrays.asList(predefinedWorkspaces)); assertThat(workspaces, is(graphWorkspaces)); // Use each workspace ... for (String workspaceName : predefinedWorkspaces) { ReadNodeRequest readRoot = new ReadNodeRequest(locationFor("/"), workspaceName); connection.execute(context, readRoot); assertThat(readRoot.getActualLocationOfNode().getPath(), is(pathFor("/"))); } }