use of com.thoughtworks.go.domain.label.PipelineLabel in project gocd by gocd.
the class PipelineLabelTest method shouldNotReplaceTemplateWithoutMaterial.
@Test
public void shouldNotReplaceTemplateWithoutMaterial() throws Exception {
PipelineLabel label = new PipelineLabel("1.5.0");
label.updateLabel(new HashMap<>());
assertThat(label, is(new PipelineLabel("1.5.0")));
}
use of com.thoughtworks.go.domain.label.PipelineLabel in project gocd by gocd.
the class PipelineLabelTest method shouldReplaceTheTemplateWithMultipleMaterialRevision.
@Test
public void shouldReplaceTheTemplateWithMultipleMaterialRevision() throws Exception {
PipelineLabel label = PipelineLabel.create("release-${svnMaterial}-${hg}");
MaterialRevisions materialRevisions = ModificationsMother.oneUserOneFile();
HgMaterial material = MaterialsMother.hgMaterial();
material.setName(new CaseInsensitiveString("hg"));
Modification modification = new Modification();
modification.setRevision("ae09876hj");
materialRevisions.addRevision(material, modification);
label.updateLabel(materialRevisions.getNamedRevisions());
assertThat(label.toString(), is("release-" + ModificationsMother.currentRevision() + "-ae09876hj"));
}
use of com.thoughtworks.go.domain.label.PipelineLabel in project gocd by gocd.
the class PipelineLabelTest method shouldReplaceTheTemplateCaseInsensitively.
@Test
public void shouldReplaceTheTemplateCaseInsensitively() throws Exception {
PipelineLabel label = PipelineLabel.create("release-${SVNMaterial}");
MaterialRevisions materialRevisions = ModificationsMother.oneUserOneFile();
label.updateLabel(materialRevisions.getNamedRevisions());
assertThat(label.toString(), is("release-" + ModificationsMother.currentRevision()));
}
use of com.thoughtworks.go.domain.label.PipelineLabel in project gocd by gocd.
the class PipelineLabelTest method shouldFormatLabelAccordingToCountingTemplate.
@Test
public void shouldFormatLabelAccordingToCountingTemplate() throws Exception {
PipelineLabel label = PipelineLabel.create(testingTemplate);
label.updateLabel(getNamedRevision(99));
assertThat(label.toString(), is("testing.99.label"));
}
use of com.thoughtworks.go.domain.label.PipelineLabel in project gocd by gocd.
the class PipelineLabelTest method shouldKeepLabelIfLessThan255.
@Test
public void shouldKeepLabelIfLessThan255() {
PipelineLabel label = PipelineLabel.create("${upstream}");
HashMap<CaseInsensitiveString, String> namedRevisions = new HashMap<>();
namedRevisions.put(new CaseInsensitiveString("upstream"), longLabel(154));
label.updateLabel(namedRevisions);
assertThat(label.toString().length(), Is.is(154));
}
Aggregations