use of org.guvnor.common.services.project.model.WorkspaceProject in project kie-wb-common by kiegroup.
the class LibraryServiceImplTest method getLibraryInfoTest.
@Test
public void getLibraryInfoTest() {
final Path path = mockPath("file://the_project");
final WorkspaceProject project = mock(WorkspaceProject.class);
when(project.getRootPath()).thenReturn(path);
doReturn(true).when(ioService).exists(any());
final Set<WorkspaceProject> projects = new HashSet<>();
projects.add(project);
doReturn(projects).when(projectService).getAllWorkspaceProjects(ou1);
final LibraryInfo libraryInfo = libraryService.getLibraryInfo(ou1);
assertEquals(new HashSet<>(projects), libraryInfo.getProjects());
}
use of org.guvnor.common.services.project.model.WorkspaceProject in project kie-wb-common by kiegroup.
the class LibraryServiceImplTest method thereIsAModuleInTheWorkbenchTest.
@Test
public void thereIsAModuleInTheWorkbenchTest() {
Set<WorkspaceProject> projects = new HashSet<>();
projects.add(new WorkspaceProject(ou1, repo1, new Branch("master", mock(Path.class)), mock(Module.class)));
doReturn(projects).when(projectService).getAllWorkspaceProjects();
final Boolean thereIsAModuleInTheWorkbench = libraryService.thereIsAProjectInTheWorkbench();
assertTrue(thereIsAModuleInTheWorkbench);
verify(projectService, times(1)).getAllWorkspaceProjects();
}
use of org.guvnor.common.services.project.model.WorkspaceProject in project kie-wb-common by kiegroup.
the class ImportRepositoryPopUpPresenter method importRepository.
public void importRepository() {
final String repositoryUrl = view.getRepositoryURL();
if (isEmpty(repositoryUrl)) {
view.showError(view.getEmptyRepositoryURLValidationMessage());
return;
}
OrganizationalUnit ou = context.getActiveOrganizationalUnit().orElseThrow(() -> new IllegalStateException("Cannot import project without an active organizational unit."));
view.showBusyIndicator(view.getLoadingMessage());
libraryService.call((WorkspaceProject project) -> {
view.hideBusyIndicator();
view.hide();
libraryPlaces.goToProject(project);
}, new DefaultErrorCallback() {
@Override
public boolean error(Message message, Throwable throwable) {
view.hideBusyIndicator();
view.showError(view.getNoProjectsToImportMessage());
return false;
}
}).importProject(ou, repositoryUrl, view.getUserName(), view.getPassword());
}
use of org.guvnor.common.services.project.model.WorkspaceProject in project kie-wb-common by kiegroup.
the class ProjectExplorerContentResolverDefaultSelectionsTest method getContentQuery.
private ProjectExplorerContentQuery getContentQuery(final Repository repository, final String branchName, final Module module) {
final Branch branch = new Branch(branchName, mock(Path.class));
final ProjectExplorerContentQuery moduleExplorerContentQuery = new ProjectExplorerContentQuery(repository, branch, module);
doReturn(new WorkspaceProject(mock(OrganizationalUnit.class), repository, branch, module)).when(projectService).resolveProject(repository.getSpace(), branch);
final ActiveOptions options = new ActiveOptions();
options.add(Option.TREE_NAVIGATOR);
options.add(Option.EXCLUDE_HIDDEN_ITEMS);
options.add(Option.BUSINESS_CONTENT);
moduleExplorerContentQuery.setOptions(options);
return moduleExplorerContentQuery;
}
use of org.guvnor.common.services.project.model.WorkspaceProject in project kie-wb-common by kiegroup.
the class ActiveContextManager method initActiveContext.
public void initActiveContext(final WorkspaceProjectContext context) {
WorkspaceProject activeProject = context.getActiveWorkspaceProject().orElseThrow(() -> new IllegalStateException("Cannot initialize active context without an active project."));
initActiveContext(activeProject.getRepository(), activeProject.getBranch(), /*
* XXX I think these are allowed to be null but this should be
* documented somewhere, like on the ProjectExplorerContentQuery
*/
context.getActiveModule().orElse(null), context.getActivePackage().orElse(null));
}
Aggregations