use of org.uberfire.spaces.Space in project kie-wb-common by kiegroup.
the class SocialEventRepositoryConstraintTest 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);
socialEventRepositoryConstraint = createSocialEventRepositoryContraint();
}
use of org.uberfire.spaces.Space in project kie-wb-common by kiegroup.
the class RepositoryListServiceImplTest method setup.
@Before
public void setup() {
Set<Repository> repositories = new HashSet<Repository>();
repositories.add(new GitRepository("dora", new Space("space")));
final SocialEventRepositoryConstraint socialEventRepositoryConstraint = mock(SocialEventRepositoryConstraint.class);
when(socialEventRepositoryConstraint.getAuthorizedRepositories()).thenReturn(repositories);
service.repositoryConstraint = socialEventRepositoryConstraint;
}
use of org.uberfire.spaces.Space in project kie-wb-common by kiegroup.
the class ProjectScreenServiceImplTest method testDelete.
@Test
public void testDelete() throws Exception {
final WorkspaceProject project = mock(WorkspaceProject.class);
final Repository repository = mock(Repository.class);
final String ouName = "test-realm";
final Space space = new Space(ouName);
doReturn(repository).when(project).getRepository();
doReturn("myrepo").when(repository).getAlias();
doReturn(space).when(repository).getSpace();
service.delete(project);
verify(repositoryService).removeRepository(eq(space), eq("myrepo"));
}
use of org.uberfire.spaces.Space in project kie-wb-common by kiegroup.
the class ExamplesServiceImplTest method makeGitRepository.
private GitRepository makeGitRepository() {
final GitRepository repository = new GitRepository("guvnorng-playground", new Space("space"));
final HashMap<String, Branch> branches = new HashMap<>();
branches.put("master", new Branch("master", mock(Path.class)));
repository.setBranches(branches);
return repository;
}
use of org.uberfire.spaces.Space in project kie-wb-common by kiegroup.
the class ProjectExplorerContentResolverDefaultSelectionsTest method getGitRepository.
private GitRepository getGitRepository(final String alias) {
final GitRepository repository = new GitRepository(alias, new Space("scheme"));
final HashMap<String, Branch> branches = new HashMap<>();
final Path path = PathFactory.newPath("/", "file://master@module/");
branches.put("master", new Branch("master", path));
repository.setBranches(branches);
return repository;
}
Aggregations