use of com.thoughtworks.go.config.CaseInsensitiveString in project gocd by gocd.
the class GoDashboardTemplateConfigChangeHandlerTest method shouldRefreshAllPipelinesAssociatedWithATemplateInCacheWhenATemplateChanges.
@Test
public void shouldRefreshAllPipelinesAssociatedWithATemplateInCacheWhenATemplateChanges() throws Exception {
CruiseConfig cruiseConfig = mock(CruiseConfig.class);
PipelineTemplateConfig templateConfig = new PipelineTemplateConfig(new CaseInsensitiveString("template1"));
CaseInsensitiveString pipeline1 = new CaseInsensitiveString("p1");
CaseInsensitiveString pipeline2 = new CaseInsensitiveString("p2");
when(goConfigService.currentCruiseConfig()).thenReturn(cruiseConfig);
when(cruiseConfig.pipelinesAssociatedWithTemplate(templateConfig.name())).thenReturn(a(pipeline1, pipeline2));
handler.call(templateConfig);
verify(cacheUpdateService).updateCacheForPipeline(pipeline1);
verify(cacheUpdateService).updateCacheForPipeline(pipeline2);
}
use of com.thoughtworks.go.config.CaseInsensitiveString in project gocd by gocd.
the class PipelineConfigDependencyGraphTest method shouldReturnTheSetOfFingerprintsOfAllMaterials.
@Test
public void shouldReturnTheSetOfFingerprintsOfAllMaterials() throws Exception {
HgMaterialConfig common = MaterialConfigsMother.hgMaterialConfig();
SvnMaterialConfig firstOrderSVNMaterial = MaterialConfigsMother.svnMaterialConfig();
GitMaterialConfig firstOrderGitMaterial = MaterialConfigsMother.gitMaterialConfig("url", "submodule", "branch", false);
P4MaterialConfig firstOrderP4Material = MaterialConfigsMother.p4MaterialConfig();
DependencyMaterialConfig up1DependencyMaterial = new DependencyMaterialConfig(new CaseInsensitiveString("up1"), new CaseInsensitiveString("first"));
DependencyMaterialConfig up2DependencyMaterial = new DependencyMaterialConfig(new CaseInsensitiveString("up2"), new CaseInsensitiveString("first"));
DependencyMaterialConfig uppestDependencyMaterial = new DependencyMaterialConfig(new CaseInsensitiveString("uppest"), new CaseInsensitiveString("first"));
PipelineConfig current = GoConfigMother.createPipelineConfigWithMaterialConfig("current", common, up1DependencyMaterial, up2DependencyMaterial);
PipelineConfig up1 = GoConfigMother.createPipelineConfigWithMaterialConfig("up1", common, firstOrderGitMaterial, uppestDependencyMaterial);
PipelineConfig up2 = GoConfigMother.createPipelineConfigWithMaterialConfig("up2", firstOrderSVNMaterial, common, uppestDependencyMaterial);
PipelineConfig uppest = GoConfigMother.createPipelineConfigWithMaterialConfig("uppest", common, firstOrderP4Material);
PipelineConfigDependencyGraph uppestGraph = new PipelineConfigDependencyGraph(uppest);
PipelineConfigDependencyGraph up1Graph = new PipelineConfigDependencyGraph(up1, uppestGraph);
PipelineConfigDependencyGraph up2Graph = new PipelineConfigDependencyGraph(up2, uppestGraph);
PipelineConfigDependencyGraph dependencyGraph = new PipelineConfigDependencyGraph(current, up1Graph, up2Graph);
assertThat(dependencyGraph.allMaterialFingerprints().size(), is(7));
assertThat(dependencyGraph.allMaterialFingerprints(), hasItems(common.getFingerprint(), firstOrderSVNMaterial.getFingerprint(), firstOrderGitMaterial.getFingerprint(), firstOrderP4Material.getFingerprint(), up1DependencyMaterial.getFingerprint(), up2DependencyMaterial.getFingerprint(), uppestDependencyMaterial.getFingerprint()));
}
use of com.thoughtworks.go.config.CaseInsensitiveString in project gocd by gocd.
the class PipelineTimelineTest method assertBeforeAfter.
private void assertBeforeAfter(PipelineTimeline mods, PipelineTimelineEntry actual, PipelineTimelineEntry before, PipelineTimelineEntry after) {
PipelineTimelineEntry actualBefore = mods.runBefore(actual.getId(), new CaseInsensitiveString(pipelineName));
PipelineTimelineEntry actualAfter = mods.runAfter(actual.getId(), new CaseInsensitiveString(pipelineName));
assertEquals("Expected " + before + " to be before " + actual + ". Got " + actualBefore, actualBefore, before);
assertEquals("Expected " + after + " to be after " + actual + ". Got " + actualAfter, actualAfter, after);
}
use of com.thoughtworks.go.config.CaseInsensitiveString in project gocd by gocd.
the class StageNotificationServiceTest method shouldNotHaveFailedTestsSectionWhenThereAreNoFailedTests.
@Test
public void shouldNotHaveFailedTestsSectionWhenThereAreNoFailedTests() {
String jezMail = prepareOneMatchedUser();
stubPipelineAndStage(new Date());
when(systemEnvironment.isShineEnabled()).thenReturn(true);
when(shineDao.failedTestsFor(stageIdentifier)).thenReturn(new ArrayList<>());
stageNotificationService.sendNotifications(stageIdentifier, StageEvent.Fails, new Username(new CaseInsensitiveString("loser")));
String body = inMemoryEmailNotificationTopic.getBody(jezMail);
assertThat(body, not(containsString(StageNotificationService.FAILED_TEST_SECTION)));
}
use of com.thoughtworks.go.config.CaseInsensitiveString in project gocd by gocd.
the class StageNotificationServiceTest method stubPipelineAndStage.
private void stubPipelineAndStage(Date date) {
final PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfig("go", "dev", "compile", "test", "twist");
final Modification svnModification = new Modification("lgao", "Fixing the not checked in files", "jez@cruise.com", date, "123");
svnModification.createModifiedFile("build.xml", "some_dir", ModifiedAction.added);
svnModification.createModifiedFile("some.xml", "other_dir", ModifiedAction.deleted);
Pipeline pipeline = instanceFactory.createPipelineInstance(pipelineConfig, new ManualBuild(new Username(new CaseInsensitiveString("loser"))).onModifications(new MaterialRevisions(new MaterialRevision(new MaterialConfigConverter().toMaterials(pipelineConfig.materialConfigs()).get(0), svnModification)), false, null), new DefaultSchedulingContext("loser"), "md5-test", new TimeProvider());
Stage stage = pipeline.getStages().get(0);
when(stageService.findStageWithIdentifier(stageIdentifier)).thenReturn(stage);
stage.setPipelineId(100L);
when(pipelineService.fullPipelineById(100)).thenReturn(pipeline);
}
Aggregations