use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class BuildCauseProducerServiceIntegrationTest method setup.
@Before
public void setup() throws Exception {
diskSpaceSimulator = new DiskSpaceSimulator();
new HgTestRepo("testHgRepo", temporaryFolder);
svnRepository = new SvnTestRepo(temporaryFolder);
dbHelper.onSetUp();
configHelper.onSetUp();
configHelper.usingCruiseConfigDao(goConfigDao).initializeConfigFile();
repository = new SvnCommand(null, svnRepository.projectRepositoryUrl());
PipelineConfig goParentPipelineConfig = configHelper.addPipeline(GO_PIPELINE_UPSTREAM, STAGE_NAME, new MaterialConfigs(new GitMaterialConfig("foo-bar")), "unit");
goPipelineConfig = configHelper.addPipeline(GO_PIPELINE_NAME, STAGE_NAME, repository, "unit");
svnMaterialRevs = new MaterialRevisions();
svnMaterial = SvnMaterial.createSvnMaterialWithMock(repository);
svnMaterialRevs.addRevision(svnMaterial, svnMaterial.latestModification(null, new ServerSubprocessExecutionContext(goConfigService, new SystemEnvironment())));
final MaterialRevisions materialRevisions = new MaterialRevisions();
SvnMaterial anotherSvnMaterial = SvnMaterial.createSvnMaterialWithMock(repository);
materialRevisions.addRevision(anotherSvnMaterial, anotherSvnMaterial.latestModification(null, subprocessExecutionContext));
transactionTemplate.execute(new TransactionCallbackWithoutResult() {
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) {
materialRepository.save(svnMaterialRevs);
}
});
BuildCause buildCause = BuildCause.createWithModifications(svnMaterialRevs, "");
mingleConfig = configHelper.addPipeline(MINGLE_PIPELINE_NAME, STAGE_NAME, repository, new Filter(new IgnoredFiles("**/*.doc")), "unit", "functional");
latestPipeline = PipelineMother.schedule(this.mingleConfig, buildCause);
latestPipeline = pipelineDao.saveWithStages(latestPipeline);
dbHelper.passStage(latestPipeline.getStages().first());
pipelineScheduleQueue.clear();
result = new HttpOperationResult();
scheduleOptions = new ScheduleOptions();
u = new ScheduleTestUtil(transactionTemplate, materialRepository, dbHelper, configHelper);
materialForManualTriggerPipeline = u.wf(new SvnMaterial("svn", "username", "password", false), "folder1");
u.checkinInOrder(materialForManualTriggerPipeline, u.d(1), "s1");
manualTriggerPipeline = configHelper.addPipeline(UUID.randomUUID().toString(), STAGE_NAME, materialForManualTriggerPipeline.config(), "build");
username = Username.ANONYMOUS;
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class JobStatusListenerTest method setUp.
@Before
public void setUp() throws Exception {
goCache.clear();
dbHelper.onSetUp();
configHelper.usingCruiseConfigDao(goConfigDao);
configHelper.onSetUp();
PipelineConfig pipelineConfig = withSingleStageWithMaterials(PIPELINE_NAME, STAGE_NAME, withBuildPlans(JOB_NAME));
configHelper.addPipeline(PIPELINE_NAME, STAGE_NAME);
savedPipeline = scheduleHelper.schedule(pipelineConfig, BuildCause.createWithModifications(modifyOneFile(pipelineConfig), ""), GoConstants.DEFAULT_APPROVED_BY);
JobInstance job = savedPipeline.getStages().first().getJobInstances().first();
job.setAgentUuid(UUID);
mockery = new ClassMockery();
stageStatusTopic = mockery.mock(StageStatusTopic.class);
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class ParamConfigTest method shouldValidateName.
@Test
public void shouldValidateName() {
ParamConfig paramConfig = new ParamConfig();
ValidationContext validationContext = mock(ValidationContext.class);
when(validationContext.getPipeline()).thenReturn(new PipelineConfig(new CaseInsensitiveString("p"), null));
paramConfig.validateName(new HashMap<>(), validationContext);
assertThat(paramConfig.errors().on(ParamConfig.NAME), is("Parameter cannot have an empty name for pipeline 'p'."));
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class DeletePipelineConfigCommand method isValid.
@Override
public boolean isValid(CruiseConfig preprocessedConfig) {
for (PipelineConfig pipeline : preprocessedConfig.getAllPipelineConfigs()) {
if (pipeline.materialConfigs().hasDependencyMaterial(pipelineConfig)) {
Localizable.CurryableLocalizable message = LocalizedMessage.string("CANNOT_DELETE_PIPELINE_USED_AS_MATERIALS", pipelineConfig.name(), String.format("%s (%s)", pipeline.name(), pipeline.getOriginDisplayName()));
this.result.unprocessableEntity(message);
return false;
}
}
for (EnvironmentConfig environment : preprocessedConfig.getEnvironments()) {
if (environment.getPipelineNames().contains(pipelineConfig.name())) {
Localizable.CurryableLocalizable message = LocalizedMessage.string("CANNOT_DELETE_PIPELINE_IN_ENVIRONMENT", pipelineConfig.name(), environment.name());
this.result.unprocessableEntity(message);
return false;
}
}
return true;
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class PipelineHistoryController method list.
@RequestMapping(value = "/tab/pipeline/history", method = RequestMethod.GET)
public ModelAndView list(@RequestParam("pipelineName") String pipelineName) throws Exception {
Map model = new HashMap();
try {
PipelineConfig pipelineConfig = goConfigService.pipelineConfigNamed(new CaseInsensitiveString(pipelineName));
model.put("pipelineName", pipelineConfig.name());
model.put("l", localizer);
model.put("isEditableViaUI", goConfigService.isPipelineEditable(pipelineName));
return new ModelAndView("pipeline/pipeline_history", model);
} catch (PipelineNotFoundException e) {
model.put("errorMessage", e.getMessage());
return new ModelAndView("exceptions_page", model);
}
}
Aggregations