use of com.thoughtworks.go.domain.label.PipelineLabel in project gocd by gocd.
the class PipelineLabelTest method shouldCreateDefaultLabelIfTemplateIsEmtpty.
@Test
public void shouldCreateDefaultLabelIfTemplateIsEmtpty() {
PipelineLabel label = PipelineLabel.create("");
assertThat(label, Is.is(PipelineLabel.defaultLabel()));
}
use of com.thoughtworks.go.domain.label.PipelineLabel in project gocd by gocd.
the class PipelineLabelTest method shouldTrimLongLabelTo255.
@Test
public void shouldTrimLongLabelTo255() {
PipelineLabel label = PipelineLabel.create("Pipeline-${upstream}");
HashMap<CaseInsensitiveString, String> namedRevisions = new HashMap<>();
namedRevisions.put(new CaseInsensitiveString("upstream"), longLabel(300));
label.updateLabel(namedRevisions);
assertThat(label.toString().length(), Is.is(255));
}
use of com.thoughtworks.go.domain.label.PipelineLabel in project gocd by gocd.
the class PipelineLabelTest method shouldReplaceTheTemplateWithMaterialRevision.
@Test
public void shouldReplaceTheTemplateWithMaterialRevision() 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 ensureLabelIsNOTReplaced.
private void ensureLabelIsNOTReplaced(String name) {
String labelFormat = String.format("release-${%s}", name);
PipelineLabel label = getReplacedLabelFor(name, labelFormat);
assertThat(label.toString(), is(labelFormat));
}
use of com.thoughtworks.go.domain.label.PipelineLabel in project gocd by gocd.
the class PipelineLabelTest method shouldTruncateMaterialRevision.
@Test
public void shouldTruncateMaterialRevision() throws Exception {
PipelineLabel label = PipelineLabel.create("release-${svnMaterial}-${git[:6]}");
MaterialRevisions materialRevisions = ModificationsMother.oneUserOneFile();
ScmMaterial material = MaterialsMother.gitMaterial("");
material.setName(new CaseInsensitiveString("git"));
Modification modification = new Modification();
modification.setRevision("8c8a273e12a45e57fed5ce978d830eb482f6f666");
materialRevisions.addRevision(material, modification);
label.updateLabel(materialRevisions.getNamedRevisions());
assertThat(label.toString(), is("release-" + ModificationsMother.currentRevision() + "-8c8a27"));
}
Aggregations