Search in sources :

Example 71 with PipelineConfig

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

the class ValueStreamMapPerformanceTest method shouldTestVSMForMeshInUpstreamAndDownstream.

@Test(timeout = 240000)
@RunIf(value = DatabaseChecker.class, arguments = { DatabaseChecker.H2 })
public void shouldTestVSMForMeshInUpstreamAndDownstream() throws Exception {
    int numberOfNodesPerLevel = 5;
    int numberOfLevels = 5;
    int numberOfInstancesForUpstream = 1;
    int numberOfInstancesForDownstream = 10;
    ScmMaterial svn = u.wf((ScmMaterial) MaterialsMother.defaultMaterials().get(0), "folder1");
    String[] svn_revs = { "svn_1" };
    u.checkinInOrder(svn, svn_revs);
    PipelineConfig upstreamConfig = graphGenerator.createPipelineWithInstances("upstream", new ArrayList<>(), 1);
    PipelineConfig currentConfig = graphGenerator.createMesh(upstreamConfig, "current", "up", numberOfInstancesForUpstream, numberOfNodesPerLevel, numberOfLevels);
    graphGenerator.createMesh(currentConfig, "downstream", "down", numberOfInstancesForDownstream, numberOfNodesPerLevel, numberOfLevels);
    long start = System.currentTimeMillis();
    DefaultLocalizedOperationResult result = new DefaultLocalizedOperationResult();
    ValueStreamMapPresentationModel presentationModel = valueStreamMapService.getValueStreamMap("current", 1, Username.ANONYMOUS, result);
    long timeTaken = (System.currentTimeMillis() - start) / 1000;
    assertThat(String.format("VSM took %ds. Should have been generated in 30s.", timeTaken), timeTaken, Matchers.lessThan(30l));
    assertThat(result.isSuccessful(), is(true));
    assertThat(presentationModel.getNodesAtEachLevel().size(), is(14));
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) DefaultLocalizedOperationResult(com.thoughtworks.go.server.service.result.DefaultLocalizedOperationResult) ScmMaterial(com.thoughtworks.go.config.materials.ScmMaterial) ValueStreamMapPresentationModel(com.thoughtworks.go.server.presentation.models.ValueStreamMapPresentationModel) RunIf(com.googlecode.junit.ext.RunIf) Test(org.junit.Test)

Example 72 with PipelineConfig

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

the class ScheduleTestUtil method addMaterialToPipeline.

public AddedPipeline addMaterialToPipeline(AddedPipeline pipeline, MaterialDeclaration mDecl) {
    MaterialConfig materialConfig = AutoTriggerDependencyResolutionTest.CLONER.deepClone(mDecl.materialConfig());
    PipelineConfig cfg = configHelper.addMaterialToPipeline(pipeline.config.name().toString(), materialConfig);
    return new AddedPipeline(cfg, pipeline.material);
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) PackageMaterialConfig(com.thoughtworks.go.config.materials.PackageMaterialConfig)

Example 73 with PipelineConfig

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

the class ScheduleTestUtil method renamePipelineAndFirstStage.

public AddedPipeline renamePipelineAndFirstStage(AddedPipeline pipeline, String newPipelineName, String stageName) {
    PipelineConfig oldConfig = pipeline.config;
    configHelper.removePipeline(CaseInsensitiveString.str(oldConfig.name()));
    PipelineConfig newPipeline = PipelineConfigMother.renamePipeline(oldConfig, newPipelineName);
    StageConfigMother.renameStage(newPipeline.get(0), stageName);
    configHelper.addPipeline(newPipeline);
    return new AddedPipeline(newPipeline, pipeline.material);
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig)

Example 74 with PipelineConfig

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

the class ScheduleTestUtil method saveConfigWithTimer.

public AddedPipeline saveConfigWithTimer(String pipelineName, TimerConfig timer, MaterialDeclaration... materialDeclaration) {
    String stageName = AutoTriggerDependencyResolutionTest.STAGE_NAME;
    MaterialConfigs materialConfigs = new MaterialConfigs();
    for (MaterialDeclaration mDecl : materialDeclaration) {
        MaterialConfig materialConfig = AutoTriggerDependencyResolutionTest.CLONER.deepClone(mDecl.material.config());
        materialConfigs.add(materialConfig);
    }
    PipelineConfig cfg = configHelper.addPipelineWithGroupAndTimer(DEFAULT_GROUP, pipelineName, materialConfigs, stageName, timer, "job1");
    return new AddedPipeline(cfg, new DependencyMaterial(str(pipelineName), str(stageName)));
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) PipelineConfig(com.thoughtworks.go.config.PipelineConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) PackageMaterialConfig(com.thoughtworks.go.config.materials.PackageMaterialConfig) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial)

Example 75 with PipelineConfig

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

the class StageApprovalAuthorizationTest method shouldAuthorizeIfRoleIsInApprovalList.

@Test
public void shouldAuthorizeIfRoleIsInApprovalList() throws Exception {
    CONFIG_HELPER.addSecurityWithAdminConfig();
    CONFIG_HELPER.addRole(new RoleConfig(new CaseInsensitiveString("adminRole"), new RoleUser(new CaseInsensitiveString("tester"))));
    StageConfig stage = StageConfigMother.custom("test", authConfigWithAdminRole);
    PipelineConfig pipeline = CONFIG_HELPER.addStageToPipeline(PIPELINE_NAME, stage);
    assertThat("User tester should have permission on test stage", securityService.hasOperatePermissionForStage(CaseInsensitiveString.str(pipeline.name()), CaseInsensitiveString.str(stage.name()), "tester"), is(true));
}
Also used : RoleConfig(com.thoughtworks.go.config.RoleConfig) PipelineConfig(com.thoughtworks.go.config.PipelineConfig) RoleUser(com.thoughtworks.go.config.RoleUser) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) StageConfig(com.thoughtworks.go.config.StageConfig) Test(org.junit.Test)

Aggregations

PipelineConfig (com.thoughtworks.go.config.PipelineConfig)186 Test (org.junit.Test)129 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)76 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)32 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)19 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)17 TimeProvider (com.thoughtworks.go.util.TimeProvider)16 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)15 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)13 Pipeline (com.thoughtworks.go.domain.Pipeline)13 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)13 Date (java.util.Date)13 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)12 PipelineConfigDependencyGraph (com.thoughtworks.go.server.domain.PipelineConfigDependencyGraph)12 StageConfig (com.thoughtworks.go.config.StageConfig)11 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)11 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)11 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)11 PipelineConfigs (com.thoughtworks.go.config.PipelineConfigs)9 SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)9