use of org.kie.workbench.common.screens.archetype.mgmt.shared.model.PaginatedArchetypeList in project kie-wb-common by kiegroup.
the class AbstractArchetypeTablePresenterTest method configureViewWhenSearchEmptyTest.
@Test
public void configureViewWhenSearchEmptyTest() {
setPresenterPrivateField("searchFilter", "keyword");
final ArchetypeTableConfiguration config = new ArchetypeTableConfiguration.Builder().withAddAction().withIncludeColumn().withStatusColumn().build();
doReturn(config).when(presenter).getConfiguration();
final PaginatedArchetypeList paginatedArchetypeList = new PaginatedArchetypeList(Collections.emptyList(), 0, 0, 0);
presenter.configureView(paginatedArchetypeList);
verify(view).showAddAction(true);
verify(view).showIncludeHeader(true);
verify(view).showStatusHeader(true);
verify(view).showSelectionCounter(true);
verify(view).showNoResults(true);
verify(view).showPagination(false);
verify(view).showToolbar(true);
verify(view).showEmpty(false);
}
use of org.kie.workbench.common.screens.archetype.mgmt.shared.model.PaginatedArchetypeList in project kie-wb-common by kiegroup.
the class AbstractArchetypeTablePresenterTest method configureViewWhenPopulatedTest.
@Test
public void configureViewWhenPopulatedTest() {
final ArchetypeTableConfiguration config = new ArchetypeTableConfiguration.Builder().withAddAction().withIncludeColumn().withStatusColumn().build();
doReturn(config).when(presenter).getConfiguration();
final PaginatedArchetypeList paginatedArchetypeList = new PaginatedArchetypeList(Collections.nCopies(10, mock(Archetype.class)), 0, 10, 10);
presenter.configureView(paginatedArchetypeList);
verify(view).showAddAction(true);
verify(view).showIncludeHeader(true);
verify(view).showStatusHeader(true);
verify(view).showSelectionCounter(true);
verify(view).showNoResults(false);
verify(view).showPagination(true);
verify(view).showToolbar(true);
verify(view).showEmpty(false);
}
use of org.kie.workbench.common.screens.archetype.mgmt.shared.model.PaginatedArchetypeList in project kie-wb-common by kiegroup.
the class AbstractArchetypeTablePresenterTest method loadPreferencesSuccessCallbackTest.
@Test
public void loadPreferencesSuccessCallbackTest() {
final PaginatedArchetypeList paginatedArchetypeList = mock(PaginatedArchetypeList.class);
doNothing().when(presenter).finishLoadList(paginatedArchetypeList);
presenter.loadPreferencesSuccessCallback(paginatedArchetypeList, mock(Promise.PromiseExecutorCallbackFn.ResolveCallbackFn.class)).execute(archetypePreferences);
verify(presenter).finishLoadList(paginatedArchetypeList);
}
use of org.kie.workbench.common.screens.archetype.mgmt.shared.model.PaginatedArchetypeList in project kie-wb-common by kiegroup.
the class ArchetypeServiceImplTest method listAllPaginatedTest.
@Test
public void listAllPaginatedTest() {
mockArchetypesOrgUnit();
doReturn(Collections.nCopies(13, mock(Repository.class))).when(repositoryService).getAllRepositories(Mockito.<Space>any());
doReturn(createArchetype()).when(archetypeConfigStorage).loadArchetype(Mockito.<String>any());
PaginatedArchetypeList result = service.list(0, 5, "");
assertThat(result.getTotal()).isEqualTo(13);
assertThat(result.getArchetypes()).hasSize(5);
assertThat(result.getPageNumber()).isEqualTo(0);
assertThat(result.getPageSize()).isEqualTo(5);
result = service.list(1, 5, "");
assertThat(result.getTotal()).isEqualTo(13);
assertThat(result.getArchetypes()).hasSize(5);
assertThat(result.getPageNumber()).isEqualTo(1);
assertThat(result.getPageSize()).isEqualTo(5);
result = service.list(2, 5, "");
assertThat(result.getTotal()).isEqualTo(13);
assertThat(result.getArchetypes()).hasSize(3);
assertThat(result.getPageNumber()).isEqualTo(2);
assertThat(result.getPageSize()).isEqualTo(5);
}
use of org.kie.workbench.common.screens.archetype.mgmt.shared.model.PaginatedArchetypeList in project kie-wb-common by kiegroup.
the class ArchetypeServiceImplTest method listAllWithFilterPaginatedTest.
@Test
public void listAllWithFilterPaginatedTest() {
mockArchetypesOrgUnit();
final Archetype archetype1 = createArchetypeWithAlias("findme");
final Archetype archetype2 = createArchetypeWithAlias("hidden");
final List<Archetype> archetypes = new ArrayList<>();
archetypes.addAll(Collections.nCopies(13, archetype1));
archetypes.addAll(Collections.nCopies(30, archetype2));
final List<Repository> repositories = new ArrayList<>();
archetypes.forEach(archetype -> {
doReturn(archetype).when(archetypeConfigStorage).loadArchetype(archetype.getAlias());
final Repository repository = mock(Repository.class);
doReturn(archetype.getAlias()).when(repository).getAlias();
repositories.add(repository);
});
final String filterText = "findme";
doReturn(repositories).when(repositoryService).getAllRepositories(Mockito.<Space>any());
PaginatedArchetypeList result = service.list(0, 5, filterText);
assertThat(result.getTotal()).isEqualTo(13);
assertThat(result.getArchetypes()).hasSize(5);
assertThat(result.getPageNumber()).isEqualTo(0);
assertThat(result.getPageSize()).isEqualTo(5);
result = service.list(1, 5, filterText);
assertThat(result.getTotal()).isEqualTo(13);
assertThat(result.getArchetypes()).hasSize(5);
assertThat(result.getPageNumber()).isEqualTo(1);
assertThat(result.getPageSize()).isEqualTo(5);
result = service.list(2, 5, filterText);
assertThat(result.getTotal()).isEqualTo(13);
assertThat(result.getArchetypes()).hasSize(3);
assertThat(result.getPageNumber()).isEqualTo(2);
assertThat(result.getPageSize()).isEqualTo(5);
}
Aggregations