use of com.thoughtworks.go.config.BasicCruiseConfig in project gocd by gocd.
the class EmailNotificationListenerTest method shouldNotCreateMailSenderIfMailHostIsNotConfigured.
@Test
public void shouldNotCreateMailSenderIfMailHostIsNotConfigured() {
context.checking(new Expectations() {
{
allowing(goConfigService).currentCruiseConfig();
will(returnValue(new BasicCruiseConfig()));
}
});
emailNotificationListener.onMessage(null);
}
use of com.thoughtworks.go.config.BasicCruiseConfig in project gocd by gocd.
the class UnrunStagesPopulatorTest method shouldAddRemainingStagesToAllDownstreamPipelines.
@Test
public void shouldAddRemainingStagesToAllDownstreamPipelines() throws Exception {
/*
p --> p1 --> p2
\
+-> p3
*/
ValueStreamMap valueStreamMap = new ValueStreamMap("p", revision("p", 1));
Node p1_node = valueStreamMap.addDownstreamNode(new PipelineDependencyNode("p1", "p1"), "p");
Node p2_node = valueStreamMap.addDownstreamNode(new PipelineDependencyNode("p2", "p2"), "p1");
Node p3_node = valueStreamMap.addDownstreamNode(new PipelineDependencyNode("p3", "p3"), "p");
addRevisions(p1_node);
addRevisions(p2_node);
addRevisions(p3_node);
CruiseConfig cruiseConfig = new BasicCruiseConfig();
String grp = "first";
cruiseConfig.addPipeline(grp, pipelineConfig("p"));
cruiseConfig.addPipeline(grp, pipelineConfig("p1"));
cruiseConfig.addPipeline(grp, pipelineConfig("p2"));
cruiseConfig.addPipeline(grp, pipelineConfig("p3"));
when(goConfigService.getCurrentConfig()).thenReturn(cruiseConfig);
unrunStagesPopulator.apply(valueStreamMap);
assertRevision(valueStreamMap.getCurrentPipeline().revisions().get(0));
assertStages(p1_node);
assertStages(p2_node);
assertStages(p3_node);
}
use of com.thoughtworks.go.config.BasicCruiseConfig in project gocd by gocd.
the class TimerSchedulerQuartzIntegrationTest method shouldUpdateJobsInTheQuartzSchedulerOnConfigChange.
@Test
public void shouldUpdateJobsInTheQuartzSchedulerOnConfigChange() throws InterruptedException {
PipelineConfig uat = pipelineConfigWithTimer("uat", "* * * * * ?");
PipelineConfig dist = pipelineConfigWithTimer("dist", "* * * * * ?");
List<PipelineConfig> pipelineConfigs = asList(uat, dist);
GoConfigService goConfigService = mock(GoConfigService.class);
when(goConfigService.getAllPipelineConfigs()).thenReturn(pipelineConfigs);
BuildCauseProducerService buildCauseProducerService = mock(BuildCauseProducerService.class);
TimerScheduler timerScheduler = new TimerScheduler(quartzSchedulerFactory, goConfigService, buildCauseProducerService, null);
timerScheduler.initialize();
CruiseConfig cruiseConfig = new BasicCruiseConfig();
cruiseConfig.getGroups().add(new BasicPipelineConfigs(uat));
timerScheduler.onConfigChange(cruiseConfig);
pauseForScheduling();
verify(buildCauseProducerService, atLeastOnce()).timerSchedulePipeline(eq(uat), any(ServerHealthStateOperationResult.class));
}
use of com.thoughtworks.go.config.BasicCruiseConfig in project gocd by gocd.
the class UpdatePipelineConfigCommandTest method shouldDisallowStaleRequest.
@Test
public void shouldDisallowStaleRequest() {
UpdatePipelineConfigCommand command = new UpdatePipelineConfigCommand(goConfigService, entityHashingService, pipelineConfig, username, "stale_md5", localizedOperationResult);
when(goConfigService.findGroupNameByPipeline(pipelineConfig.name())).thenReturn("group1");
when(goConfigService.canEditPipeline(pipelineConfig.name().toString(), username, localizedOperationResult, "group1")).thenReturn(true);
when(entityHashingService.md5ForEntity(pipelineConfig)).thenReturn("latest_md5");
BasicCruiseConfig basicCruiseConfig = new BasicCruiseConfig(new BasicPipelineConfigs(pipelineConfig));
assertFalse(command.canContinue(basicCruiseConfig));
}
use of com.thoughtworks.go.config.BasicCruiseConfig in project gocd by gocd.
the class ArtifactDirValidatorTest method shouldThrowExceptionWhenUserProvidesEmtpty.
@Test
public void shouldThrowExceptionWhenUserProvidesEmtpty() {
CruiseConfig cruiseConfig = new BasicCruiseConfig();
cruiseConfig.setServerConfig(new ServerConfig("", null));
ArtifactDirValidator dirValidator = new ArtifactDirValidator();
try {
dirValidator.validate(cruiseConfig);
fail("should throw exception");
} catch (Exception e) {
}
}
Aggregations