use of org.kie.workbench.common.screens.explorer.model.URIStructureExplorerModel in project kie-wb-common by kiegroup.
the class LibraryPlacesTest method setup.
@Before
public void setup() {
when(user.getIdentifier()).thenReturn("user");
when(sessionInfo.getIdentity()).thenReturn(user);
when(libraryPerspective.getPlace()).thenReturn(LIBRARY_PERSPECTIVE_PLACE_REQUEST);
when(otherPerspective.getPlace()).thenReturn(OTHER_PERSPECTIVE_PLACE_REQUEST);
windowParameters = new HashMap<>();
libraryServiceCaller = new CallerMock<>(libraryService);
vfsServiceCaller = new CallerMock<>(vfsService);
repositoryServiceCaller = new CallerMock<>(repositoryService);
organizationalUnitServiceCaller = new CallerMock<>(organizationalUnitService);
libraryBreadcrumbs = spy(new LibraryBreadcrumbs(breadcrumbs, translationUtils, ts, resourceUtils, projectBranchBreadcrumb));
libraryPlaces = spy(new LibraryPlaces(breadcrumbs, ts, assetDetailEvent, libraryServiceCaller, new CallerMock<>(projectService), new CallerMock<>(moduleService), placeManager, projectContext, projectContextChangeEvent, notificationEvent, translationUtils, vfsServiceCaller, importRepositoryPopUpPresenters, assetListUpdateEvent, closeUnsavedProjectAssetsPopUpPresenter, projectsSetupEvent, libraryBreadcrumbs, sessionInfo, repositoryServiceCaller, new SyncPromises(), mock(OrganizationalUnitController.class), organizationalUnitServiceCaller, logger, cookie, perspectiveManager) {
@Override
protected Map<String, List<String>> getParameterMap() {
return windowParameters;
}
});
doNothing().when(libraryPlaces).expose();
libraryPlaces.setup();
libraryPlaces.init(mock(LibraryPerspective.class));
activeOrganizationalUnit = mock(OrganizationalUnit.class);
activeSpace = mock(Space.class);
activeRepository = mock(Repository.class);
activeBranch = new Branch("main", mock(Path.class));
activeModule = mock(Module.class);
doReturn(Optional.of(activeOrganizationalUnit)).when(projectContext).getActiveOrganizationalUnit();
activeProject = new WorkspaceProject(activeOrganizationalUnit, activeRepository, activeBranch, activeModule);
doReturn(Optional.of(activeProject)).when(projectContext).getActiveWorkspaceProject();
doReturn(Optional.of(activeModule)).when(projectContext).getActiveModule();
doReturn(Optional.empty()).when(projectContext).getActiveRepositoryRoot();
doReturn(Optional.empty()).when(projectContext).getActivePackage();
when(current.getOrganizationalUnit()).thenReturn(activeOrganizationalUnit);
when(current.getWorkspaceProject()).thenReturn(activeProject);
when(current.getModule()).thenReturn(activeModule);
when(activeOrganizationalUnit.getSpace()).thenReturn(activeSpace);
when(activeRepository.getAlias()).thenReturn("repository");
when(activeRepository.getIdentifier()).thenReturn("repository");
when(activeRepository.getSpace()).thenReturn(activeSpace);
final URIStructureExplorerModel model = mock(URIStructureExplorerModel.class);
doReturn(mock(Repository.class)).when(model).getRepository();
doReturn(mock(Module.class)).when(model).getModule();
doReturn(mock(Path.class)).when(vfsService).get(any());
final PathPlaceRequest pathPlaceRequest = mock(PathPlaceRequest.class);
doReturn(mock(ObservablePath.class)).when(pathPlaceRequest).getPath();
doReturn(pathPlaceRequest).when(libraryPlaces).createPathPlaceRequest(any());
doReturn(importRepositoryPopUpPresenter).when(importRepositoryPopUpPresenters).get();
lastSpaceCookie = user.getIdentifier() + "_lastSpace";
lastProjectCookie = user.getIdentifier() + "_lastProject";
lastBranchCookie = user.getIdentifier() + "_" + activeProject.getName() + "_lastBranch";
doReturn("").when(cookie).get(any());
}
Aggregations