use of com.thoughtworks.go.config.materials.dependency.DependencyMaterial in project gocd by gocd.
the class MaterialRevisionTest method shouldDetectOldestAndLatestDependencyRevision.
@Test
public void shouldDetectOldestAndLatestDependencyRevision() throws Exception {
DependencyMaterial dependencyMaterial = new DependencyMaterial(new CaseInsensitiveString("upstream"), new CaseInsensitiveString("stage"));
MaterialRevision materialRevision = new MaterialRevision(dependencyMaterial, new Modification(new Date(), "upstream/3/stage/1", "1.3-3", null), new Modification(new Date(), "upstream/2/stage/1", "1.3-2", null));
assertThat(materialRevision.getOldestRevision(), is(DependencyMaterialRevision.create("upstream/2/stage/1", "1.3-2")));
assertThat(materialRevision.getRevision(), is(DependencyMaterialRevision.create("upstream/3/stage/1", "1.3-3")));
}
use of com.thoughtworks.go.config.materials.dependency.DependencyMaterial in project gocd by gocd.
the class ModificationBuildCauseTest method shouldGetBuildCausedByIfIsDenpendencyMaterial.
@Test
public void shouldGetBuildCausedByIfIsDenpendencyMaterial() throws Exception {
MaterialRevisions revisions = new MaterialRevisions();
Modification modification = new Modification(new Date(), "pipelineName/10/stageName/1", "MOCK_LABEL-12", null);
revisions.addRevision(new DependencyMaterial(new CaseInsensitiveString("cruise"), new CaseInsensitiveString("dev")), modification);
assertThat(BuildCause.createWithModifications(revisions, "").getBuildCauseMessage(), is("triggered by pipelineName/10/stageName/1"));
}
use of com.thoughtworks.go.config.materials.dependency.DependencyMaterial in project gocd by gocd.
the class ModificationBuildCauseTest method shouldReturnBuildCauseMessageForLegacyDependencyRevision.
@Test
public void shouldReturnBuildCauseMessageForLegacyDependencyRevision() {
MaterialRevisions revisions = new MaterialRevisions();
Modification modification = new Modification(new Date(), "pipelineName/10/stageName/1", "MOCK_LABEL-12", null);
revisions.addRevision(new DependencyMaterial(new CaseInsensitiveString("cruise"), new CaseInsensitiveString("dev")), modification);
BuildCause modificationBuildCause = BuildCause.createWithModifications(revisions, "");
String message = modificationBuildCause.getBuildCauseMessage();
assertThat(message, containsString("triggered by pipelineName/10/stageName/1"));
}
use of com.thoughtworks.go.config.materials.dependency.DependencyMaterial in project gocd by gocd.
the class ModificationBuildCauseTest method shouldReturnBuildCauseMessage.
@Test
public void shouldReturnBuildCauseMessage() {
MaterialRevisions revisions = new MaterialRevisions();
Modification modification = new Modification(new Date(), "pipelineName/123/stageName/1", "MOCK_LABEL-12", null);
revisions.addRevision(new DependencyMaterial(new CaseInsensitiveString("cruise"), new CaseInsensitiveString("dev")), modification);
BuildCause modificationBuildCause = BuildCause.createWithModifications(revisions, "");
String message = modificationBuildCause.getBuildCauseMessage();
assertThat(message, containsString("triggered by pipelineName/123/stageName/1"));
}
use of com.thoughtworks.go.config.materials.dependency.DependencyMaterial in project gocd by gocd.
the class DependencyMaterialUpdateNotifierTest method shouldScheduleOnlyNewDepenedencyMaterialsForUpdateOnSubsequentConfigChanges.
@Test
public void shouldScheduleOnlyNewDepenedencyMaterialsForUpdateOnSubsequentConfigChanges() {
DependencyMaterial dependencyMaterialForP1S1 = MaterialsMother.dependencyMaterial("p1", "s1");
Set<DependencyMaterialConfig> schedulableMaterialConfigs = new HashSet<>(Arrays.asList((DependencyMaterialConfig) dependencyMaterialForP1S1.config()));
when(goConfigService.getSchedulableDependencyMaterials()).thenReturn(schedulableMaterialConfigs);
when(materialConfigConverter.toMaterial(dependencyMaterialForP1S1.config())).thenReturn(dependencyMaterialForP1S1);
notifier = new DependencyMaterialUpdateNotifier(goConfigService, materialConfigConverter, materialUpdateService, serverHealthService);
notifier.initialize();
DependencyMaterial dependencyMaterialForP2S2 = MaterialsMother.dependencyMaterial("p2", "s2");
schedulableMaterialConfigs = new HashSet<>(Arrays.asList((DependencyMaterialConfig) dependencyMaterialForP2S2.config()));
when(goConfigService.getSchedulableDependencyMaterials()).thenReturn(schedulableMaterialConfigs);
when(materialConfigConverter.toMaterial(dependencyMaterialForP2S2.config())).thenReturn(dependencyMaterialForP2S2);
notifier.onConfigChange(mock(CruiseConfig.class));
verify(materialUpdateService).updateMaterial(dependencyMaterialForP2S2);
}
Aggregations