Search in sources :

Example 1 with Space

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();
}
Also used : Space(org.uberfire.spaces.Space) GitRepository(org.guvnor.structure.repositories.impl.git.GitRepository) Repository(org.guvnor.structure.repositories.Repository) GitRepository(org.guvnor.structure.repositories.impl.git.GitRepository) OrganizationalUnit(org.guvnor.structure.organizationalunit.OrganizationalUnit) ArrayList(java.util.ArrayList) OrganizationalUnitImpl(org.guvnor.structure.organizationalunit.impl.OrganizationalUnitImpl) Before(org.junit.Before)

Example 2 with Space

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;
}
Also used : Space(org.uberfire.spaces.Space) GitRepository(org.guvnor.structure.repositories.impl.git.GitRepository) Repository(org.guvnor.structure.repositories.Repository) GitRepository(org.guvnor.structure.repositories.impl.git.GitRepository) SocialEventRepositoryConstraint(org.kie.workbench.common.screens.social.hp.security.SocialEventRepositoryConstraint) HashSet(java.util.HashSet) Before(org.junit.Before)

Example 3 with Space

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"));
}
Also used : Space(org.uberfire.spaces.Space) Repository(org.guvnor.structure.repositories.Repository) WorkspaceProject(org.guvnor.common.services.project.model.WorkspaceProject) Test(org.junit.Test)

Example 4 with Space

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;
}
Also used : Space(org.uberfire.spaces.Space) GitRepository(org.guvnor.structure.repositories.impl.git.GitRepository) HashMap(java.util.HashMap) Branch(org.guvnor.structure.repositories.Branch)

Example 5 with Space

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;
}
Also used : Space(org.uberfire.spaces.Space) Path(org.uberfire.backend.vfs.Path) GitRepository(org.guvnor.structure.repositories.impl.git.GitRepository) HashMap(java.util.HashMap) Branch(org.guvnor.structure.repositories.Branch)

Aggregations

Space (org.uberfire.spaces.Space)8 GitRepository (org.guvnor.structure.repositories.impl.git.GitRepository)5 Repository (org.guvnor.structure.repositories.Repository)4 Before (org.junit.Before)4 Branch (org.guvnor.structure.repositories.Branch)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Module (org.guvnor.common.services.project.model.Module)2 WorkspaceProject (org.guvnor.common.services.project.model.WorkspaceProject)2 OrganizationalUnit (org.guvnor.structure.organizationalunit.OrganizationalUnit)2 OrganizationalUnitImpl (org.guvnor.structure.organizationalunit.impl.OrganizationalUnitImpl)2 Test (org.junit.Test)2 Path (org.uberfire.backend.vfs.Path)2 HashSet (java.util.HashSet)1 Package (org.guvnor.common.services.project.model.Package)1 FolderItem (org.kie.workbench.common.screens.explorer.model.FolderItem)1 FolderListing (org.kie.workbench.common.screens.explorer.model.FolderListing)1 ActiveOptions (org.kie.workbench.common.screens.explorer.service.ActiveOptions)1 SocialEventRepositoryConstraint (org.kie.workbench.common.screens.social.hp.security.SocialEventRepositoryConstraint)1 KieModule (org.kie.workbench.common.services.shared.project.KieModule)1