Search in sources :

Example 6 with PipelineLabel

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()));
}
Also used : PipelineLabel(com.thoughtworks.go.domain.label.PipelineLabel) Test(org.junit.Test)

Example 7 with PipelineLabel

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));
}
Also used : HashMap(java.util.HashMap) PipelineLabel(com.thoughtworks.go.domain.label.PipelineLabel) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.Test)

Example 8 with PipelineLabel

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()));
}
Also used : PipelineLabel(com.thoughtworks.go.domain.label.PipelineLabel) Test(org.junit.Test)

Example 9 with PipelineLabel

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));
}
Also used : PipelineLabel(com.thoughtworks.go.domain.label.PipelineLabel) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString)

Example 10 with PipelineLabel

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"));
}
Also used : Modification(com.thoughtworks.go.domain.materials.Modification) PipelineLabel(com.thoughtworks.go.domain.label.PipelineLabel) ScmMaterial(com.thoughtworks.go.config.materials.ScmMaterial) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.Test)

Aggregations

PipelineLabel (com.thoughtworks.go.domain.label.PipelineLabel)18 Test (org.junit.Test)14 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)7 Modification (com.thoughtworks.go.domain.materials.Modification)3 ScmMaterial (com.thoughtworks.go.config.materials.ScmMaterial)2 HashMap (java.util.HashMap)2 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)1 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)1