use of org.uberfire.spaces.Space in project kie-wb-common by kiegroup.
the class ProjectExplorerContentResolverTest method setUp.
@Before
public void setUp() throws Exception {
// Ensure URLs use the default:// scheme
fs.forceAsDefault();
final KieModuleService moduleService = mock(KieModuleService.class);
final ExplorerServiceHelper helper = mock(ExplorerServiceHelper.class);
space = new Space("test-realm");
repository = getGitRepository();
final UserExplorerData userExplorerData = new UserExplorerData();
masterModules = new HashSet<>();
masterModules.add(createModule("master", masterBranch, "module 1"));
masterModules.add(createModule("master", masterBranch, "module 2"));
devModules = new HashSet<>();
devModules.add(createModule("dev-1.0.0", devBranch, "module 1"));
devModules.add(createModule("dev-1.0.0", devBranch, "module 2"));
helperWrapper = new HelperWrapper(helper);
when(helper.getLastContent()).thenAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
return helperWrapper.getUserExplorerLastData();
}
});
when(helper.loadUserContent()).thenReturn(userExplorerData);
when(helper.getFolderListing(any(FolderItem.class), any(Module.class), any(Package.class), any(ActiveOptions.class))).thenReturn(new FolderListing(getFileItem(), Collections.EMPTY_LIST, Collections.EMPTY_LIST));
when(moduleService.getAllModules(masterBranch)).thenReturn(masterModules);
when(moduleService.getAllModules(devBranch)).thenReturn(devModules);
when(moduleService.resolveDefaultPackage(any(Module.class))).thenReturn(new Package());
resolver = spy(new ProjectExplorerContentResolver(moduleService, helper, explorerServiceHelper, projectService));
}
use of org.uberfire.spaces.Space in project kie-wb-common by kiegroup.
the class LibraryToolbarPresenterTest method updateSelectedBranch.
@Test
public void updateSelectedBranch() throws Exception {
final Branch devBranch = new Branch("dev", mock(Path.class));
final WorkspaceProject devBranchProject = new WorkspaceProject(selectedOrganizationalUnit, selectedRepository, devBranch, mock(Module.class));
Space space = new Space("test-realm");
doReturn(space).when(selectedRepository).getSpace();
doReturn(devBranchProject).when(projectService).resolveProject(space, devBranch);
selectedRepositoryBranches.add(devBranch);
doReturn(Optional.of(devBranch)).when(selectedRepository).getBranch("dev");
presenter.init(callback);
reset(view);
doReturn(true).when(placeManager).closeAllPlacesOrNothing();
doReturn("dev").when(view).getSelectedBranch();
presenter.onUpdateSelectedBranch();
verify(libraryPlaces).goToProject(devBranchProject);
}
use of org.uberfire.spaces.Space in project kie-wb-common by kiegroup.
the class SocialEventModuleConstraintTest method setUp.
@Before
public void setUp() throws Exception {
Collection<OrganizationalUnit> ous = new ArrayList<OrganizationalUnit>();
final OrganizationalUnitImpl ou = new OrganizationalUnitImpl("ouname", "owner", "groupid");
final OrganizationalUnitImpl ouSpy = spy(ou);
Collection<Repository> repositories = new ArrayList<Repository>();
repository = new GitRepository("repo", new Space("space"));
repositories.add(repository);
ous.add(ouSpy);
when(ouSpy.getRepositories()).thenReturn(repositories);
when(organizationalUnitService.getOrganizationalUnits()).thenReturn(ous);
when(authorizationManager.authorize(ou, user)).thenReturn(true);
when(authorizationManager.authorize(repository, user)).thenReturn(true);
when(userCDIContextHelper.getUser()).thenReturn(user);
when(userCDIContextHelper.thereIsALoggedUserInScope()).thenReturn(true);
socialEventModuleConstraint = createSocialEventModuleConstraint();
}
Aggregations