use of com.thoughtworks.go.config.PipelineConfigs 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);
}
Aggregations