use of org.guvnor.common.services.project.model.WorkspaceProject in project kie-wb-common by kiegroup.
the class LibraryToolbarPresenter method onUpdateSelectedBranch.
void onUpdateSelectedBranch() {
if (placeManager.closeAllPlacesOrNothing()) {
Repository repository = projectContext.getActiveWorkspaceProject().map(workspaceProject -> workspaceProject.getRepository()).orElseThrow(() -> new IllegalStateException("Cannot get repository without an active workspace project"));
projectService.call(new RemoteCallback<WorkspaceProject>() {
@Override
public void callback(WorkspaceProject project) {
libraryPlaces.goToProject(project);
setBranchSelectorVisibility();
}
}).resolveProject(repository.getSpace(), repository.getBranch(view.getSelectedBranch()).get());
} else {
setUpBranches();
}
}
use of org.guvnor.common.services.project.model.WorkspaceProject in project kie-wb-common by kiegroup.
the class PopulatedLibraryScreenTest method mockProject.
private WorkspaceProject mockProject(final String projectName) {
final WorkspaceProject result = mock(WorkspaceProject.class);
doReturn(projectName).when(result).getName();
doReturn(mock(Module.class)).when(result).getMainModule();
return result;
}
use of org.guvnor.common.services.project.model.WorkspaceProject in project kie-wb-common by kiegroup.
the class PopulatedLibraryScreenTest method setup.
@Before
public void setup() {
libraryServiceCaller = new CallerMock<>(libraryService);
libraryScreen = spy(new PopulatedLibraryScreen(view, libraryPlaces, projectDetailEvent, libraryServiceCaller, projectController, projectContext, tileWidgets, addProjectButtonPresenter));
doReturn(true).when(projectController).canCreateProjects();
project1 = mockProject("project1Name");
project2 = mockProject("project2Name");
project3 = mockProject("project3Name");
final List<WorkspaceProject> projects = new ArrayList<>();
projects.add(project1);
projects.add(project2);
projects.add(project3);
when(projectContext.getActiveOrganizationalUnit()).thenReturn(Optional.of(organizationalUnit));
when(projectContext.getActiveWorkspaceProject()).thenReturn(Optional.empty());
when(projectContext.getActiveModule()).thenReturn(Optional.empty());
when(projectContext.getActiveRepositoryRoot()).thenReturn(Optional.empty());
when(projectContext.getActivePackage()).thenReturn(Optional.empty());
final LibraryInfo libraryInfo = new LibraryInfo(projects);
doReturn(libraryInfo).when(libraryService).getLibraryInfo(organizationalUnit);
doReturn(mock(TileWidget.View.class)).when(tileWidget).getView();
doReturn(tileWidget).when(tileWidgets).get();
doReturn(mock(AddProjectButtonPresenter.View.class)).when(addProjectButtonPresenter).getView();
libraryScreen.setup();
}
use of org.guvnor.common.services.project.model.WorkspaceProject in project kie-wb-common by kiegroup.
the class ProjectScreenTestBase method createProject.
protected WorkspaceProject createProject() {
final Path rootPath = mock(Path.class);
doReturn("git://modulePath").when(rootPath).toURI();
final Module module = mock(Module.class);
doReturn("mainModuleName").when(module).getModuleName();
doReturn("modulePath").when(module).getIdentifier();
doReturn(rootPath).when(module).getRootPath();
final Path pomPath = mock(Path.class);
doReturn(pomPath).when(module).getPomXMLPath();
final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);
final Repository repository = mock(Repository.class);
final Path repositoryRootPath = mock(Path.class);
doReturn(Optional.of(new Branch("master", repositoryRootPath))).when(repository).getDefaultBranch();
doReturn("rootpath").when(repositoryRootPath).toURI();
return new WorkspaceProject(organizationalUnit, repository, new Branch("master", mock(Path.class)), module);
}
use of org.guvnor.common.services.project.model.WorkspaceProject in project kie-wb-common by kiegroup.
the class SettingsPresenterTest method testSave.
@Test
public void testSave() {
WorkspaceProject project = mock(WorkspaceProject.class);
doReturn(project).when(projectScreenService).save(any(), any(), any(), any());
final Section section1 = newMockedSection();
final Section section2 = newMockedSection();
doReturn(promises.resolve()).when(settingsPresenter).resetDirtyIndicator(eq(section1));
doReturn(promises.resolve()).when(settingsPresenter).resetDirtyIndicator(eq(section2));
settingsPresenter.sections = new ArrayList<>(Arrays.asList(section1, section2));
settingsPresenter.save("Test comment");
verify(section1).save(eq("Test comment"), any());
verify(section2).save(eq("Test comment"), any());
verify(settingsPresenter).saveProjectScreenModel(eq("Test comment"), eq(DeploymentMode.VALIDATED), any());
verify(settingsPresenter).resetDirtyIndicator(eq(section1));
verify(settingsPresenter).resetDirtyIndicator(eq(section2));
verify(settingsPresenter).displaySuccessMessage();
}
Aggregations