@Test public void testSearch() { ComponentSearchParams searchParams = ComponentSearchParams.builder() .withComponentType(SW360ComponentType.INNER_SOURCE) .retrieveFields("name", "releaseIds") .orderAscending("createdOn") .build(); when(componentClient.search(searchParams)) .thenReturn(createSearchResult(Collections.singletonList(sparseComponent))); List<SW360SparseComponent> components = block(componentClientAdapter.search(searchParams)); assertThat(components).hasSize(1); assertThat(components).containsExactly(sparseComponent); }
@Override public CompletableFuture<List<SW360SparseComponent>> search(ComponentSearchParams searchParams) { return searchWithPaging(searchParams) .thenApply(PagingResult::getResult); }
SW360ComponentClientAdapterAsyncImpl implements SW360ComponentClientAdapterAsync { @Override public CompletableFuture<List<SW360SparseComponent>> search(ComponentSearchParams searchParams) { return searchWithPaging(searchParams) .thenApply(PagingResult::getResult); } }
SW360ComponentClientAdapterAsyncImpl implements SW360ComponentClientAdapterAsync { @Override public CompletableFuture<List<SW360SparseComponent>> search(ComponentSearchParams searchParams) { return searchWithPaging(searchParams) .thenApply(PagingResult::getResult); } SW360ComponentClientAdapterAsyncImpl(SW360ComponentClient client); }
SW360ComponentClientAdapterAsyncImpl implements SW360ComponentClientAdapterAsync { @Override public CompletableFuture<List<SW360SparseComponent>> search(ComponentSearchParams searchParams) { return searchWithPaging(searchParams) .thenApply(PagingResult::getResult); } SW360ComponentClientAdapterAsyncImpl(SW360ComponentClient client); @Override SW360ComponentClient getComponentClient(); @Override CompletableFuture<SW360Component> createComponent(SW360Component component); @Override CompletableFuture<Optional<SW360Component>> getComponentById(String componentId); @Override CompletableFuture<Optional<SW360Component>> getComponentByName(String componentName); @Override CompletableFuture<List<SW360SparseComponent>> search(ComponentSearchParams searchParams); @Override CompletableFuture<PagingResult<SW360SparseComponent>> searchWithPaging(ComponentSearchParams searchParams); @Override CompletableFuture<SW360Component> updateComponent(SW360Component component); @Override CompletableFuture<MultiStatusResponse> deleteComponents(Collection<String> idsToDelete); @Override CompletableFuture<Void> deleteComponent(String componentId); }
SW360ComponentClientAdapterAsyncImpl implements SW360ComponentClientAdapterAsync { @Override public CompletableFuture<List<SW360SparseComponent>> search(ComponentSearchParams searchParams) { return searchWithPaging(searchParams) .thenApply(PagingResult::getResult); } SW360ComponentClientAdapterAsyncImpl(SW360ComponentClient client); @Override SW360ComponentClient getComponentClient(); @Override CompletableFuture<SW360Component> createComponent(SW360Component component); @Override CompletableFuture<Optional<SW360Component>> getComponentById(String componentId); @Override CompletableFuture<Optional<SW360Component>> getComponentByName(String componentName); @Override CompletableFuture<List<SW360SparseComponent>> search(ComponentSearchParams searchParams); @Override CompletableFuture<PagingResult<SW360SparseComponent>> searchWithPaging(ComponentSearchParams searchParams); @Override CompletableFuture<SW360Component> updateComponent(SW360Component component); @Override CompletableFuture<MultiStatusResponse> deleteComponents(Collection<String> idsToDelete); @Override CompletableFuture<Void> deleteComponent(String componentId);  }