use of org.guvnor.common.services.project.model.WorkspaceProject in project kie-wb-common by kiegroup.
the class KieMultipleDocumentEditorTest method testOnRepositoryRemoved.
@Test
public void testOnRepositoryRemoved() {
final Repository repository = mock(Repository.class);
when(workbenchContext.getActiveWorkspaceProject()).thenReturn(Optional.of(new WorkspaceProject(mock(OrganizationalUnit.class), repository, mock(Branch.class), mock(Module.class))));
editor.setupMenuBar();
editor.onRepositoryRemoved(new RepositoryRemovedEvent(repository));
verify(editor, times(1)).enableMenus(eq(false));
verify(editor, times(4)).enableMenuItem(eq(false), any(MenuItems.class));
verify(saveMenuItem, times(1)).setEnabled(eq(false));
verify(versionManagerMenuItem, times(1)).setEnabled(eq(false));
}
use of org.guvnor.common.services.project.model.WorkspaceProject in project kie-wb-common by kiegroup.
the class ProjectScreenTest method setUp.
@Before
public void setUp() {
projectScreenServiceCaller = new CallerMock<>(projectScreenService);
promises = spy(new SyncPromises());
when(assetsScreen.getView()).thenReturn(assetsView);
when(viewHideAlertsButtonPresenter.getView()).thenReturn(viewHideAlertsButtonView);
when(editContributorsPopUpPresenterInstance.get()).thenReturn(editContributorsPopUpPresenter);
when(deleteProjectPopUpScreenInstance.get()).thenReturn(deleteProjectPopUpScreen);
when(renameProjectPopUpScreenInstance.get()).thenReturn(renameProjectPopUpScreen);
final WorkspaceProject workspaceProject = mock(WorkspaceProject.class);
final Module module = mock(Module.class);
when(module.getModuleName()).thenReturn("module-name");
when(workspaceProject.getMainModule()).thenReturn(module);
when(libraryPlaces.getActiveWorkspaceContext()).thenReturn(workspaceProject);
this.presenter = spy(new ProjectScreen(this.view, this.libraryPlaces, this.emptyAssetsScree, this.assetsScreen, this.contributorsListScreen, this.projectMetrictsScreen, this.projectController, this.settingsPresenter, this.organizationalUnitController, this.newFileUploader, this.newResourcePresenter, this.buildExecutor, this.editContributorsPopUpPresenterInstance, this.deleteProjectPopUpScreenInstance, this.renameProjectPopUpScreenInstance, new CallerMock<>(this.libraryService), projectScreenServiceCaller, copyPopUpPresenter, projectNameValidator, promises, notificationEvent, viewHideAlertsButtonPresenter));
this.presenter.workspaceProject = createProject();
}
use of org.guvnor.common.services.project.model.WorkspaceProject in project kie-wb-common by kiegroup.
the class SettingsPresenterTest method testForceSave.
@Test
public void testForceSave() {
WorkspaceProject project = mock(WorkspaceProject.class);
doReturn(project).when(projectScreenService).save(any(), any(), any(), any());
settingsPresenter.concurrentPomUpdateInfo = mock(ObservablePath.OnConcurrentUpdateEvent.class);
settingsPresenter.forceSave("Test comment", null);
assertEquals(null, settingsPresenter.concurrentPomUpdateInfo);
verify(conflictingRepositoriesPopup).hide();
verify(settingsPresenter).saveProjectScreenModel(eq("Test comment"), eq(DeploymentMode.FORCED), any());
}
use of org.guvnor.common.services.project.model.WorkspaceProject in project kie-wb-common by kiegroup.
the class SettingsPresenterTest method testSaveProjectScreenModel.
@Test
public void testSaveProjectScreenModel() {
WorkspaceProject project = mock(WorkspaceProject.class);
Module module = mock(Module.class);
doReturn(module).when(project).getMainModule();
doReturn(project).when(projectScreenService).save(any(), any(), any(), any());
settingsPresenter.saveProjectScreenModel("Test comment", DeploymentMode.VALIDATED, null).catch_(i -> {
fail("Promise should've been resolved!");
return promises.resolve();
});
verify(projectScreenService).save(any(), any(), eq("Test comment"), eq(DeploymentMode.VALIDATED));
verify(projectContext).updateProjectModule(module);
verify(settingsPresenter, never()).handlePomConcurrentUpdate(any(), any());
verify(settingsPresenter, never()).defaultErrorResolution(any());
verify(settingsPresenter, never()).handleSaveProjectScreenModelError(any(), any(), any());
}
use of org.guvnor.common.services.project.model.WorkspaceProject in project kie-wb-common by kiegroup.
the class LibraryPlacesTest method goToNewProject.
@Test
public void goToNewProject() {
final WorkspaceProject project = new WorkspaceProject(activeOrganizationalUnit, activeRepository, activeBranch, mock(Module.class));
libraryPlaces.goToProject(project);
verify(projectContextChangeEvent).fire(any(WorkspaceProjectContextChangeEvent.class));
verify(placeManager).closeAllPlacesOrNothing();
}
Aggregations