Search in sources :

Example 11 with PipelineGroups

use of com.thoughtworks.go.domain.PipelineGroups in project gocd by gocd.

the class BasicCruiseConfigTest method shouldGetPipelinesWithGroupName.

@Test
public void shouldGetPipelinesWithGroupName() throws Exception {
    PipelineConfigs group1 = createGroup("group1", createPipelineConfig("pipeline1", "stage1"));
    PipelineConfigs group2 = createGroup("group2", createPipelineConfig("pipeline2", "stage2"));
    CruiseConfig config = createCruiseConfig();
    config.setGroup(new PipelineGroups(group1, group2));
    assertThat(config.pipelines("group1"), is(group1));
    assertThat(config.pipelines("group2"), is(group2));
}
Also used : PipelineGroups(com.thoughtworks.go.domain.PipelineGroups) Test(org.junit.Test)

Example 12 with PipelineGroups

use of com.thoughtworks.go.domain.PipelineGroups in project gocd by gocd.

the class PartialConfigMother method invalidPartial.

public static PartialConfig invalidPartial(String name, RepoConfigOrigin repoOrigin) {
    PipelineConfig pipe = PipelineConfigMother.pipelineConfig(name);
    pipe.getFirstStageConfig().setName(new CaseInsensitiveString(""));
    BasicPipelineConfigs pipes = new BasicPipelineConfigs("grp", new Authorization(), pipe);
    PartialConfig partialConfig = new PartialConfig(new PipelineGroups(pipes));
    partialConfig.setOrigins(repoOrigin);
    return partialConfig;
}
Also used : PipelineGroups(com.thoughtworks.go.domain.PipelineGroups) PartialConfig(com.thoughtworks.go.config.remote.PartialConfig)

Example 13 with PipelineGroups

use of com.thoughtworks.go.domain.PipelineGroups in project gocd by gocd.

the class MaterialConfigServiceTest method setup.

@Before
public void setup() throws Exception {
    initMocks(this);
    user = "looser";
    when(securityService.hasViewPermissionForGroup(user, "group1")).thenReturn(true);
    when(securityService.hasViewPermissionForGroup(user, "group2")).thenReturn(false);
    when(securityService.hasViewPermissionForGroup(user, "group3")).thenReturn(true);
    PipelineConfigs pipelineGroup1 = new BasicPipelineConfigs();
    pipelineGroup1.setGroup("group1");
    PipelineConfig pipelineConfig1 = new PipelineConfig();
    GitMaterialConfig gitMaterialConfig1 = new GitMaterialConfig("http://test.com");
    pipelineConfig1.addMaterialConfig(gitMaterialConfig1);
    GitMaterialConfig getMaterialConfig2 = new GitMaterialConfig("http://crap.com");
    pipelineConfig1.addMaterialConfig(getMaterialConfig2);
    pipelineGroup1.add(pipelineConfig1);
    PipelineConfigs pipelineGroup2 = new BasicPipelineConfigs();
    pipelineGroup2.setGroup("group2");
    PipelineConfig pipelineConfig2 = new PipelineConfig();
    GitMaterialConfig gitMaterialConfig3 = new GitMaterialConfig("http://another.com");
    pipelineConfig2.addMaterialConfig(gitMaterialConfig3);
    pipelineGroup2.add(pipelineConfig2);
    PipelineConfigs pipelineGroup3 = new BasicPipelineConfigs();
    pipelineGroup3.setGroup("group3");
    PipelineConfig pipelineConfig3 = new PipelineConfig();
    GitMaterialConfig gitMaterialConfig4 = new GitMaterialConfig("http://test.com");
    pipelineConfig1.addMaterialConfig(gitMaterialConfig4);
    pipelineGroup3.add(pipelineConfig3);
    PipelineGroups pipelineGroups = new PipelineGroups(pipelineGroup1, pipelineGroup2, pipelineGroup3);
    when(goConfigService.groups()).thenReturn(pipelineGroups);
    materialConfigService = new MaterialConfigService(goConfigService, securityService);
}
Also used : PipelineGroups(com.thoughtworks.go.domain.PipelineGroups) PipelineConfig(com.thoughtworks.go.config.PipelineConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) PipelineConfigs(com.thoughtworks.go.config.PipelineConfigs) BasicPipelineConfigs(com.thoughtworks.go.config.BasicPipelineConfigs) BasicPipelineConfigs(com.thoughtworks.go.config.BasicPipelineConfigs) Before(org.junit.Before)

Example 14 with PipelineGroups

use of com.thoughtworks.go.domain.PipelineGroups in project gocd by gocd.

the class XmlPartialConfigProviderTest method shouldLoadDirectoryWithTwoPipelineGroupsAndEnvironment.

@Test
public void shouldLoadDirectoryWithTwoPipelineGroupsAndEnvironment() throws Exception {
    GoConfigMother mother = new GoConfigMother();
    PipelineGroups groups = mother.cruiseConfigWithTwoPipelineGroups().getGroups();
    EnvironmentConfig env = EnvironmentConfigMother.environment("dev");
    helper.addFileWithPipelineGroup("group1.gocd.xml", groups.get(0));
    helper.addFileWithPipelineGroup("group2.gocd.xml", groups.get(1));
    helper.addFileWithEnvironment("dev-env.gocd.xml", env);
    PartialConfig part = xmlPartialProvider.load(tmpFolder, mock(PartialConfigLoadContext.class));
    PipelineGroups groupsRead = part.getGroups();
    assertThat(groupsRead.size(), is(2));
    EnvironmentsConfig loadedEnvs = part.getEnvironments();
    assertThat(loadedEnvs.size(), is(1));
    assertThat(loadedEnvs.get(0), is(env));
}
Also used : PipelineGroups(com.thoughtworks.go.domain.PipelineGroups) PartialConfig(com.thoughtworks.go.config.remote.PartialConfig) GoConfigMother(com.thoughtworks.go.helper.GoConfigMother) Test(org.junit.Test)

Example 15 with PipelineGroups

use of com.thoughtworks.go.domain.PipelineGroups in project gocd by gocd.

the class PipelineConfigsServiceTest method shouldGetPipelineGroupsForUser.

@Test
public void shouldGetPipelineGroupsForUser() {
    PipelineConfig pipelineInGroup1 = new PipelineConfig();
    PipelineConfigs group1 = new BasicPipelineConfigs(pipelineInGroup1);
    group1.setGroup("group1");
    PipelineConfig pipelineInGroup2 = new PipelineConfig();
    PipelineConfigs group2 = new BasicPipelineConfigs(pipelineInGroup2);
    group2.setGroup("group2");
    when(goConfigService.groups()).thenReturn(new PipelineGroups(group1, group2));
    String user = "looser";
    when(securityService.hasViewPermissionForGroup(user, "group1")).thenReturn(true);
    when(securityService.hasViewPermissionForGroup(user, "group2")).thenReturn(false);
    List<PipelineConfigs> gotPipelineGroups = service.getGroupsForUser(user);
    verify(goConfigService, never()).getAllPipelinesInGroup("group1");
    assertThat(gotPipelineGroups, is(Arrays.asList(group1)));
}
Also used : PipelineGroups(com.thoughtworks.go.domain.PipelineGroups) Test(org.junit.Test)

Aggregations

PipelineGroups (com.thoughtworks.go.domain.PipelineGroups)15 PartialConfig (com.thoughtworks.go.config.remote.PartialConfig)7 Test (org.junit.Test)7 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)2 Username (com.thoughtworks.go.server.domain.Username)2 BasicPipelineConfigs (com.thoughtworks.go.config.BasicPipelineConfigs)1 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)1 PipelineConfigs (com.thoughtworks.go.config.PipelineConfigs)1 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)1 ScmMaterial (com.thoughtworks.go.config.materials.ScmMaterial)1 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)1 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)1 SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)1 PipelinePauseInfo (com.thoughtworks.go.domain.PipelinePauseInfo)1 Material (com.thoughtworks.go.domain.materials.Material)1 GoConfigMother (com.thoughtworks.go.helper.GoConfigMother)1 PostCommitHookImplementer (com.thoughtworks.go.server.materials.postcommit.PostCommitHookImplementer)1 PostCommitHookMaterialType (com.thoughtworks.go.server.materials.postcommit.PostCommitHookMaterialType)1 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)1 Before (org.junit.Before)1