use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class BuildCauseTest method shouldNotThrowWhenMaterialAndConfigOriginRevisionDontMatch_WhenManualTrigger.
@Test
public void shouldNotThrowWhenMaterialAndConfigOriginRevisionDontMatch_WhenManualTrigger() {
SvnMaterial material = MaterialsMother.svnMaterial();
MaterialConfig materialConfig = material.config();
MaterialRevisions first = new MaterialRevisions(new MaterialRevision(material, oneModifiedFile("revision1")));
BuildCause buildCause = BuildCause.createManualForced();
buildCause.setMaterialRevisions(first);
PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfigWithStages("pipe1", "build");
pipelineConfig.materialConfigs().clear();
pipelineConfig.materialConfigs().add(materialConfig);
pipelineConfig.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(materialConfig, "plug"), "revision2"));
buildCause.assertPipelineConfigAndMaterialRevisionMatch(pipelineConfig);
}
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 MyGoController method getPipelineModelsSortedByNameFor.
private List<PipelineViewModel> getPipelineModelsSortedByNameFor(List<PipelineConfigs> groups) {
List<PipelineViewModel> pipelineModels = new ArrayList<>();
List<PipelineViewModel.StageViewModel> anyPipelineStageModels = new ArrayList<>();
anyPipelineStageModels.add(new PipelineViewModel.StageViewModel(GoConstants.ANY_STAGE));
pipelineModels.add(new PipelineViewModel(GoConstants.ANY_PIPELINE, anyPipelineStageModels));
for (PipelineConfigs group : groups) {
for (PipelineConfig pipelineConfig : group) {
pipelineModels.add(new PipelineViewModel(CaseInsensitiveString.str(pipelineConfig.name()), getStagesModelsFor(pipelineConfig)));
}
}
Collections.sort(pipelineModels);
return pipelineModels;
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class PipelineScheduleServiceTest method shouldSaveBuildStateCorrectly.
@Test
public void shouldSaveBuildStateCorrectly() throws Exception {
PipelineConfig cruisePlan = configHelper.addPipeline("cruise", "dev", repository);
goConfigService.forceNotifyListeners();
autoSchedulePipelines("mingle", "evolve", "cruise");
Stage cruise = stageDao.mostRecentWithBuilds(CaseInsensitiveString.str(cruisePlan.name()), cruisePlan.findBy(new CaseInsensitiveString("dev")));
JobInstance instance = cruise.getJobInstances().first();
assertThat(instance.getState(), is(JobState.Scheduled));
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class CcTrayActivityListenerTest method shouldInvokeConfigChangeHandlerWhenPipelineConfigChanges.
@Test
public void shouldInvokeConfigChangeHandlerWhenPipelineConfigChanges() 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());
when(goConfigService.findGroupNameByPipeline(p1)).thenReturn("group1");
CcTrayActivityListener listener = new CcTrayActivityListener(goConfigService, mock(CcTrayJobStatusChangeHandler.class), mock(CcTrayStageStatusChangeHandler.class), ccTrayConfigChangeHandler);
listener.initialize();
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, "group1");
}
Aggregations