Search in sources :

Example 11 with PipelineLabel

use of com.thoughtworks.go.domain.label.PipelineLabel in project gocd by gocd.

the class PipelineLabelTest method shouldUseCounterAsDefaultTemplate.

@Test
public void shouldUseCounterAsDefaultTemplate() throws Exception {
    PipelineLabel defaultLabel = PipelineLabel.defaultLabel();
    assertThat(defaultLabel.toString(), is("${COUNT}"));
}
Also used : PipelineLabel(com.thoughtworks.go.domain.label.PipelineLabel) Test(org.junit.Test)

Example 12 with PipelineLabel

use of com.thoughtworks.go.domain.label.PipelineLabel in project gocd by gocd.

the class PipelineLabelTest method getReplacedLabelFor.

private PipelineLabel getReplacedLabelFor(String name, String labelFormat) {
    MaterialRevisions materialRevisions = ModificationsMother.oneUserOneFile();
    PipelineLabel label = PipelineLabel.create(labelFormat);
    ((SvnMaterial) materialRevisions.getRevisions().get(0).getMaterial()).setName(new CaseInsensitiveString(name));
    label.updateLabel(materialRevisions.getNamedRevisions());
    return label;
}
Also used : PipelineLabel(com.thoughtworks.go.domain.label.PipelineLabel) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString)

Example 13 with PipelineLabel

use of com.thoughtworks.go.domain.label.PipelineLabel in project gocd by gocd.

the class PipelineLabelTest method shouldReplaceTheTemplateWithGitMaterialRevision.

@Test
public void shouldReplaceTheTemplateWithGitMaterialRevision() throws Exception {
    PipelineLabel label = PipelineLabel.create("release-${svnMaterial}-${git}");
    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() + "-8c8a273e12a45e57fed5ce978d830eb482f6f666"));
}
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)

Example 14 with PipelineLabel

use of com.thoughtworks.go.domain.label.PipelineLabel in project gocd by gocd.

the class PipelineLabelTest method assertLabelGroupsMatchingAndReplace.

private String assertLabelGroupsMatchingAndReplace(String labelTemplate, String[][] expectedGroups) throws Exception {
    assertLabelGroupsMatching(labelTemplate, expectedGroups);
    PipelineLabel label = new PipelineLabel(labelTemplate);
    label.updateLabel(MATERIAL_REVISIONS);
    return label.toString();
}
Also used : PipelineLabel(com.thoughtworks.go.domain.label.PipelineLabel)

Example 15 with PipelineLabel

use of com.thoughtworks.go.domain.label.PipelineLabel in project gocd by gocd.

the class PipelineLabelTest method shouldCreateDefaultLabelIfTemplateIsNull.

@Test
public void shouldCreateDefaultLabelIfTemplateIsNull() {
    PipelineLabel label = PipelineLabel.create(null);
    assertThat(label, Is.is(PipelineLabel.defaultLabel()));
}
Also used : PipelineLabel(com.thoughtworks.go.domain.label.PipelineLabel) 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