Search in sources :

Example 6 with BasicPipelineConfigs

use of com.thoughtworks.go.config.BasicPipelineConfigs 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 7 with BasicPipelineConfigs

use of com.thoughtworks.go.config.BasicPipelineConfigs in project gocd by gocd.

the class FanInGraphTest method shouldConstructAFaninGraph.

@Test
public void shouldConstructAFaninGraph() throws Exception {
    GitMaterialConfig git = new GitMaterialConfig("giturl", "dest");
    HgMaterialConfig hg = new HgMaterialConfig("hgurl", "dest");
    PipelineConfig p1 = PipelineConfigMother.pipelineConfig("p1", new MaterialConfigs(git));
    DependencyMaterialConfig p1Dep = new DependencyMaterialConfig(p1.name(), p1.get(0).name());
    PipelineConfig p2 = PipelineConfigMother.pipelineConfig("p2", new MaterialConfigs(p1Dep));
    PipelineConfig p3 = PipelineConfigMother.pipelineConfig("p3", new MaterialConfigs(p1Dep, hg));
    DependencyMaterialConfig p2Dep = new DependencyMaterialConfig(p2.name(), p2.get(0).name());
    DependencyMaterialConfig p3Dep = new DependencyMaterialConfig(p3.name(), p3.get(0).name());
    PipelineConfig p4 = PipelineConfigMother.pipelineConfig("p4", new MaterialConfigs(p2Dep, p3Dep));
    CruiseConfig cruiseConfig = new BasicCruiseConfig(new BasicPipelineConfigs(p1, p2, p3, p4));
    FanInGraph faninGraph = new FanInGraph(cruiseConfig, p4.name(), null, null, null, null);
    List<ScmMaterialConfig> scmMaterialNodes = faninGraph.getScmMaterials();
    List<String> scmMaterialUrls = new ArrayList<>();
    for (ScmMaterialConfig scmMaterialNode : scmMaterialNodes) {
        scmMaterialUrls.add(scmMaterialNode.getUrl().toString());
    }
    assertThat(scmMaterialUrls.contains("giturl"), is(true));
    assertThat(scmMaterialUrls.contains("hgurl"), is(true));
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) PipelineConfig(com.thoughtworks.go.config.PipelineConfig) HgMaterialConfig(com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig) ArrayList(java.util.ArrayList) CruiseConfig(com.thoughtworks.go.config.CruiseConfig) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig) BasicPipelineConfigs(com.thoughtworks.go.config.BasicPipelineConfigs) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) ScmMaterialConfig(com.thoughtworks.go.config.materials.ScmMaterialConfig) Test(org.junit.Test)

Aggregations

BasicPipelineConfigs (com.thoughtworks.go.config.BasicPipelineConfigs)7 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)6 Test (org.junit.Test)6 BasicCruiseConfig (com.thoughtworks.go.config.BasicCruiseConfig)4 PipelineConfigs (com.thoughtworks.go.config.PipelineConfigs)3 CruiseConfig (com.thoughtworks.go.config.CruiseConfig)2 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)2 FileConfigOrigin (com.thoughtworks.go.config.remote.FileConfigOrigin)2 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)1 ScmMaterialConfig (com.thoughtworks.go.config.materials.ScmMaterialConfig)1 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)1 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)1 PartialConfig (com.thoughtworks.go.config.remote.PartialConfig)1 RepoConfigOrigin (com.thoughtworks.go.config.remote.RepoConfigOrigin)1 PipelineGroups (com.thoughtworks.go.domain.PipelineGroups)1 BuildCauseProducerService (com.thoughtworks.go.server.scheduling.BuildCauseProducerService)1 ServerHealthStateOperationResult (com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult)1 ArrayList (java.util.ArrayList)1 Before (org.junit.Before)1