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));
}
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;
}
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);
}
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));
}
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)));
}
Aggregations