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