use of org.kie.workbench.common.screens.library.api.LibraryInfo 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.kie.workbench.common.screens.library.api.LibraryInfo 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.kie.workbench.common.screens.library.api.LibraryInfo in project kie-wb-common by kiegroup.
the class AddProjectPopUpPresenterTest method setup.
@Before
public void setup() {
libraryServiceCaller = new CallerMock<>(libraryService);
validationServiceCaller = new CallerMock<>(validationService);
sessionInfo = new SessionInfoMock();
selectedOrganizationalUnit = mock(OrganizationalUnit.class);
doReturn("selectedOrganizationalUnit").when(selectedOrganizationalUnit).getIdentifier();
when(projectContext.getActiveOrganizationalUnit()).thenReturn(Optional.of(selectedOrganizationalUnit));
when(projectContext.getActiveWorkspaceProject()).thenReturn(Optional.empty());
when(projectContext.getActiveModule()).thenReturn(Optional.empty());
when(projectContext.getActiveRepositoryRoot()).thenReturn(Optional.empty());
when(projectContext.getActivePackage()).thenReturn(Optional.empty());
presenter = spy(new AddProjectPopUpPresenter(libraryServiceCaller, busyIndicatorView, notificationEvent, libraryPlaces, projectContext, view, sessionInfo, newProjectEvent, libraryPreferences, conflictingRepositoriesPopup, validationServiceCaller));
doReturn("baseUrl").when(presenter).getBaseURL();
doReturn("emptyNameMessage").when(view).getEmptyNameMessage();
doReturn("invalidNameMessage").when(view).getInvalidNameMessage();
doReturn("duplicatedProjectMessage").when(view).getDuplicatedProjectMessage();
libraryInfo = new LibraryInfo(new ArrayList<>());
doReturn(libraryInfo).when(libraryService).getLibraryInfo(selectedOrganizationalUnit);
doReturn(true).when(validationService).isProjectNameValid(any());
doReturn(true).when(validationService).validateGroupId(any());
doReturn(true).when(validationService).validateArtifactId(any());
doReturn(true).when(validationService).validateGAVVersion(any());
presenter.setup();
}
Aggregations