Search in sources :

Example 51 with Repository

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

the class SourceServiceImplTest method testGetBranches.

@Test
public void testGetBranches() {
    final List<Branch> branches = new ArrayList<>();
    branches.add(new Branch("branch1", mock(Path.class)));
    branches.add(new Branch("branch2", mock(Path.class)));
    branches.add(new Branch("branch3", mock(Path.class)));
    Repository repository = mock(Repository.class);
    when(repository.getBranches()).thenReturn(branches);
    when(repositoryService.getRepositoryFromSpace(SPACE, REPO_NAME)).thenReturn(repository);
    final Collection<String> result = service.getBranches(SPACE, REPO_NAME);
    final List<String> originalBranchNames = new ArrayList<>();
    for (final Branch branch : branches) {
        originalBranchNames.add(branch.getName());
    }
    assertEquals(originalBranchNames, result);
}
Also used : Repository(org.guvnor.structure.repositories.Repository) Branch(org.guvnor.structure.repositories.Branch) ArrayList(java.util.ArrayList) 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