use of org.kie.workbench.common.screens.examples.model.ImportProject in project kie-wb-common by kiegroup.
the class BranchSelectorPopUpPresenterTest method setupTest.
@Test
public void setupTest() {
final ImportProject importProject = mock(ImportProject.class);
final List<String> branches = Arrays.asList("master", "branch1");
doReturn(branches).when(importProject).getSelectedBranches();
final HTMLElement branchSelectorContainer = mock(HTMLElement.class);
doReturn(branchSelectorContainer).when(view).getBranchSelectorContainer();
presenter.setup(importProject, b -> {
});
verify(view).init(presenter);
verify(branchSelector).setup(same(branchSelectorContainer), any(), eq(Arrays.asList("branch1", "master")), any());
verify(view).show();
}
use of org.kie.workbench.common.screens.examples.model.ImportProject in project kie-wb-common by kiegroup.
the class ImportPresenter method ok.
public void ok() {
final List<ImportProject> projects = projectWidgetsByProject.entrySet().stream().filter(p -> p.getValue().isSelected()).map(Map.Entry::getKey).collect(Collectors.toList());
if (projects.isEmpty()) {
notificationEvent.fire(new NotificationEvent(view.getNoProjectsSelectedMessage(), NotificationEvent.NotificationType.ERROR));
return;
}
view.showBusyIndicator(view.getImportingMessage());
importProjects(projects, event -> {
view.hideBusyIndicator();
notificationEvent.fire(new NotificationEvent(view.getImportProjectsSuccessMessage(), NotificationEvent.NotificationType.SUCCESS));
projectContextChangeEvent.fire(event);
// In this case we've imported multiple projects, so just go to the space screen.
if (event.getWorkspaceProject() == null) {
libraryPlaces.goToLibrary();
}
}, new HasBusyIndicatorDefaultErrorCallback(view));
}
Aggregations