use of org.kie.workbench.common.screens.library.api.ProjectAssetsQuery in project kie-wb-common by kiegroup.
the class LibraryServiceImplTest method queryingUnindexedProjectGivesUnindexedResult.
@Test
public void queryingUnindexedProjectGivesUnindexedResult() throws Exception {
Branch branch = new Branch("fake-branch", mockPath("file:///a/b/c"));
final WorkspaceProject project = new WorkspaceProject(ou1, repo1, branch, mock(Module.class));
when(indexOracle.isIndexed(project)).thenReturn(false);
when(ioService.exists(any())).thenReturn(true);
final ProjectAssetsQuery query = new ProjectAssetsQuery(project, "", 0, 10, Collections.emptyList());
AssetQueryResult result = libraryService.getProjectAssets(query);
assertEquals(ResultType.Unindexed, result.getResultType());
assertFalse(result.getAssetInfos().isPresent());
}
use of org.kie.workbench.common.screens.library.api.ProjectAssetsQuery in project kie-wb-common by kiegroup.
the class PopulatedAssetsScreen method resolveAssetsCount.
private void resolveAssetsCount() {
if (!isProjectNull()) {
ProjectAssetsQuery query = this.createProjectQuery(filter, filterType, 0, 0);
assetQueryService.getNumberOfAssets(query).call((Integer numberOfAssets) -> {
int offset = getOffset();
this.view.setPageIndicator(offset + 1, this.getAssetsCount(numberOfAssets, offset + this.pageSize), this.getAssetsCount(numberOfAssets, 0));
this.setTotalPages(numberOfAssets, this.pageSize);
this.view.setTotalPages(this.getTotalPages());
this.checkPaginationButtons();
}, new DefaultErrorCallback());
}
}
use of org.kie.workbench.common.screens.library.api.ProjectAssetsQuery in project kie-wb-common by kiegroup.
the class PopulatedAssetsScreen method createProjectQuery.
protected ProjectAssetsQuery createProjectQuery(String filter, String filterType, int startIndex, int amount) {
Category category = categoriesManagerCache.getCategory(filterType);
List<String> suffixes = this.getSuffixes(category);
return new ProjectAssetsQuery(libraryPlaces.getActiveWorkspace(), filter, startIndex, amount, suffixes);
}
use of org.kie.workbench.common.screens.library.api.ProjectAssetsQuery in project kie-wb-common by kiegroup.
the class PopulatedAssetsScreenTest method testCreateProjectQuery.
@Test
public void testCreateProjectQuery() {
List<String> more = Arrays.asList("xml", "java", "dsl");
String filter = "filter";
Others other = new Others();
doReturn(other).when(this.categoriesManagerCache).getCategory(eq(new Others().getName()));
doReturn(more).when(this.populatedAssetsScreen).getSuffixes(eq(other));
{
String filterType = "ALL";
ProjectAssetsQuery query = this.populatedAssetsScreen.createProjectQuery(filter, filterType, 0, 10);
assertEquals("filter", query.getFilter());
assertThat(query.getExtensions(), is(Collections.emptyList()));
}
{
String filterType = new Others().getName();
ProjectAssetsQuery query = this.populatedAssetsScreen.createProjectQuery(filter, filterType, 0, 10);
assertEquals("filter", query.getFilter());
assertThat(query.getExtensions(), is(more));
}
}
use of org.kie.workbench.common.screens.library.api.ProjectAssetsQuery in project drools-wb by kiegroup.
the class ScenarioSimulationAssetsDropdownProviderTest method createProjectQuery.
@Test
public void createProjectQuery() {
scenarioSimulationAssetsDropdownProvider = spy(new ScenarioSimulationAssetsDropdownProviderBCImpl(scenarioSimulationServiceCallerMock, libraryPlacesMock, assetQueryServiceMock) {
});
final ProjectAssetsQuery retrieved = scenarioSimulationAssetsDropdownProvider.createProjectQuery();
assertEquals(1000, retrieved.getAmount());
assertEquals(0, retrieved.getStartIndex());
assertEquals("", retrieved.getFilter());
assertEquals(workspaceProjectMock, retrieved.getProject());
}
Aggregations