Search in sources :

Example 11 with Repository

use of org.guvnor.structure.repositories.Repository 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 12 with Repository

use of org.guvnor.structure.repositories.Repository in project kie-wb-common by kiegroup.

the class ExplorerMenuTest method testOnArchiveActiveRepo.

@Test
public void testOnArchiveActiveRepo() throws Exception {
    final Path rootRepoPath = mock(Path.class);
    final Repository repository = mock(Repository.class);
    when(repository.getDefaultBranch()).thenReturn(Optional.of(new Branch("master", rootRepoPath)));
    final WorkspaceProject project = mock(WorkspaceProject.class);
    when(project.getRepository()).thenReturn(repository);
    when(context.getActiveWorkspaceProject()).thenReturn(Optional.of(project));
    menu.onArchiveActiveRepository();
    verify(view).archive(rootRepoPath);
}
Also used : Path(org.uberfire.backend.vfs.Path) Repository(org.guvnor.structure.repositories.Repository) Branch(org.guvnor.structure.repositories.Branch) WorkspaceProject(org.guvnor.common.services.project.model.WorkspaceProject) Test(org.junit.Test)

Example 13 with Repository

use of org.guvnor.structure.repositories.Repository in project kie-wb-common by kiegroup.

the class BaseViewPresenterTest method testAutomaticModuleBuildDisabled.

@Test
public void testAutomaticModuleBuildDisabled() {
    final OrganizationalUnit ou = mock(OrganizationalUnit.class);
    final Repository repository = mock(Repository.class);
    final Module module = mock(Module.class);
    ApplicationPreferences.setUp(new HashMap<String, String>() {

        {
            put(ExplorerService.BUILD_PROJECT_PROPERTY_NAME, "true");
        }
    });
    when(activeContextItems.setupActiveModule(content)).thenReturn(true);
    final WorkspaceProject project = mock(WorkspaceProject.class);
    when(project.getOrganizationalUnit()).thenReturn(ou);
    when(project.getRepository()).thenReturn(repository);
    when(project.getBranch()).thenReturn(new Branch("master", mock(Path.class)));
    when(activeContextItems.getActiveProject()).thenReturn(project);
    when(activeContextItems.getActiveModule()).thenReturn(module);
    presenter.doContentCallback(content);
    verify(buildServiceActual, never()).build(any(Module.class));
}
Also used : Repository(org.guvnor.structure.repositories.Repository) OrganizationalUnit(org.guvnor.structure.organizationalunit.OrganizationalUnit) WorkspaceProject(org.guvnor.common.services.project.model.WorkspaceProject) Branch(org.guvnor.structure.repositories.Branch) Module(org.guvnor.common.services.project.model.Module) Test(org.junit.Test)

Example 14 with Repository

use of org.guvnor.structure.repositories.Repository 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 15 with Repository

use of org.guvnor.structure.repositories.Repository in project kie-wb-common by kiegroup.

the class ProjectScreenServiceImplTest method testCopyNoPOM.

@Test
public void testCopyNoPOM() throws Exception {
    final WorkspaceProject project = mock(WorkspaceProject.class);
    final OrganizationalUnit ou = mock(OrganizationalUnit.class);
    final Path projectRoot = mock(Path.class);
    doReturn(ou).when(project).getOrganizationalUnit();
    doReturn(projectRoot).when(project).getRootPath();
    final Repository newRepository = mock(Repository.class);
    final Path newRepositoryRoot = PathFactory.newPath("root", "file:///root");
    doReturn(Optional.of(new Branch("master", newRepositoryRoot))).when(newRepository).getDefaultBranch();
    doReturn(newRepository).when(repositoryCopier).copy(ou, "newName", projectRoot);
    doReturn(null).when(pomService).load(any(Path.class));
    service.copy(project, "newName");
    verify(repositoryCopier).copy(ou, "newName", projectRoot);
    verify(metadataService, never()).getMetadata(any(Path.class));
    verify(pomService, never()).save(any(Path.class), any(POM.class), any(Metadata.class), anyString(), anyBoolean());
}
Also used : Path(org.uberfire.backend.vfs.Path) Repository(org.guvnor.structure.repositories.Repository) OrganizationalUnit(org.guvnor.structure.organizationalunit.OrganizationalUnit) WorkspaceProject(org.guvnor.common.services.project.model.WorkspaceProject) Branch(org.guvnor.structure.repositories.Branch) Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) MavenRepositoryMetadata(org.guvnor.common.services.project.model.MavenRepositoryMetadata) POM(org.guvnor.common.services.project.model.POM) Test(org.junit.Test)

Aggregations

Repository (org.guvnor.structure.repositories.Repository)51 Test (org.junit.Test)25 OrganizationalUnit (org.guvnor.structure.organizationalunit.OrganizationalUnit)21 Branch (org.guvnor.structure.repositories.Branch)21 WorkspaceProject (org.guvnor.common.services.project.model.WorkspaceProject)20 GitRepository (org.guvnor.structure.repositories.impl.git.GitRepository)15 Module (org.guvnor.common.services.project.model.Module)14 ArrayList (java.util.ArrayList)13 Path (org.uberfire.backend.vfs.Path)13 ExampleRepository (org.kie.workbench.common.screens.examples.model.ExampleRepository)10 POM (org.guvnor.common.services.project.model.POM)7 KieModule (org.kie.workbench.common.services.shared.project.KieModule)7 ExampleOrganizationalUnit (org.kie.workbench.common.screens.examples.model.ExampleOrganizationalUnit)5 HashMap (java.util.HashMap)4 MavenRepositoryMetadata (org.guvnor.common.services.project.model.MavenRepositoryMetadata)4 Before (org.junit.Before)4 Metadata (org.guvnor.common.services.shared.metadata.model.Metadata)3 RepositoryEnvironmentConfigurations (org.guvnor.structure.repositories.RepositoryEnvironmentConfigurations)3 ConfigGroup (org.guvnor.structure.server.config.ConfigGroup)3 Space (org.uberfire.spaces.Space)3