use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class PackageMaterialAddWithNewPackageDefinitionCommand method updateConfig.
@Override
protected void updateConfig(CruiseConfig cruiseConfig) {
PackageDefinition packageDefinition = createNewPackageDefinition(cruiseConfig);
packageMaterialConfig.setPackageDefinition(packageDefinition);
PipelineConfig pipelineConfig = cruiseConfig.pipelineConfigByName(new CaseInsensitiveString(pipeline));
pipelineConfig.addMaterialConfig(packageMaterialConfig);
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class UnrunStagesPopulator method populateUnrunStages.
private void populateUnrunStages(Node node) {
List<Revision> revisions = node.revisions();
PipelineConfig pipelineConfig = goConfigService.getCurrentConfig().pipelineConfigByName(new CaseInsensitiveString(node.getName()));
if (revisions.isEmpty()) {
populateConfiguredStages(node, pipelineConfig);
}
for (Revision revision : revisions) {
appendUnrunStages(pipelineConfig, (PipelineRevision) revision);
}
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class CcTrayActivityListenerTest method postIntializationAndStartOfDaemon_WhenPipelineConfigChanges_ShouldInvokeConfigChangeHandler.
@Test
public void postIntializationAndStartOfDaemon_WhenPipelineConfigChanges_ShouldInvokeConfigChangeHandler() throws InterruptedException {
PipelineConfig pipelineConfig = mock(PipelineConfig.class);
CaseInsensitiveString p1 = new CaseInsensitiveString("p1");
when(pipelineConfig.name()).thenReturn(p1);
CcTrayConfigChangeHandler ccTrayConfigChangeHandler = mock(CcTrayConfigChangeHandler.class);
ArgumentCaptor<ConfigChangedListener> captor = ArgumentCaptor.forClass(ConfigChangedListener.class);
doNothing().when(goConfigService).register(captor.capture());
CcTrayActivityListener listener = new CcTrayActivityListener(goConfigService, mock(CcTrayJobStatusChangeHandler.class), mock(CcTrayStageStatusChangeHandler.class), ccTrayConfigChangeHandler);
listener.initialize();
listener.startDaemon();
List<ConfigChangedListener> listeners = captor.getAllValues();
assertThat(listeners.get(1) instanceof EntityConfigChangedListener, is(true));
EntityConfigChangedListener<PipelineConfig> pipelineConfigChangeListener = (EntityConfigChangedListener<PipelineConfig>) listeners.get(1);
pipelineConfigChangeListener.onEntityConfigChange(pipelineConfig);
waitForProcessingToHappen();
verify(ccTrayConfigChangeHandler).call(pipelineConfig);
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class DeletePackageRepositoryCommandTest method shouldNotDeletePackageRepositoryIfItIsUsedAsAMaterialInPipeline.
@Test
public void shouldNotDeletePackageRepositoryIfItIsUsedAsAMaterialInPipeline() throws Exception {
PackageDefinition pkg = new PackageDefinition();
pkg.setId("pkg");
packageRepository.addPackage(pkg);
PackageMaterialConfig packageMaterial = new PackageMaterialConfig("pkg");
PipelineConfig pipeline = new PipelineConfig();
pipeline.setMaterialConfigs(new MaterialConfigs(packageMaterial));
cruiseConfig.addPipeline("first", pipeline);
assertThat(cruiseConfig.getPackageRepositories().size(), is(1));
assertThat(cruiseConfig.getPackageRepositories().find(repoId), is(packageRepository));
DeletePackageRepositoryCommand command = new DeletePackageRepositoryCommand(goConfigService, packageRepository, currentUser, result);
command.update(cruiseConfig);
assertFalse(command.isValid(cruiseConfig));
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class PipelineTemplateConfigViewModelTest method shouldSetConfigAttributesBasedOnExistingPipeline.
@Test
public void shouldSetConfigAttributesBasedOnExistingPipeline() {
StageConfig stage1 = StageConfigMother.custom("stage_foo", "foo1", "foo2");
StageConfig stage2 = StageConfigMother.custom("stage_bar", "bar1", "bar2");
PipelineConfig pipeline = PipelineConfigMother.pipelineConfig("pipeline", stage1, stage2);
PipelineTemplateConfigViewModel viewModel = new PipelineTemplateConfigViewModel(new PipelineTemplateConfig(), "", Arrays.asList(PipelineConfigMother.pipelineConfig("foo_bar"), pipeline));
Map m = m("template", m(PipelineTemplateConfig.NAME, "template_name"), PipelineTemplateConfigViewModel.USE_EXISTING_PIPELINE, "1", PipelineTemplateConfigViewModel.SELECTED_PIPELINE_NAME, pipeline.name().toString());
viewModel.setConfigAttributes(m);
assertThat(viewModel.useExistingPipeline(), is(true));
assertThat(viewModel.selectedPipelineName(), is(pipeline.name().toString()));
PipelineTemplateConfig template = viewModel.templateConfig();
assertThat(template.name(), is(new CaseInsensitiveString("template_name")));
assertThat(template.size(), is(2));
assertThat(template.get(0), is(stage1));
assertThat(template.get(1), is(stage2));
}
Aggregations