Search in sources :

Example 11 with TrackingTool

use of com.thoughtworks.go.config.TrackingTool in project gocd by gocd.

the class TrackingToolTest method shouldPopulateErrorsWhenOnlyLinkOrOnlyRegexIsSpecified.

@Test
public void shouldPopulateErrorsWhenOnlyLinkOrOnlyRegexIsSpecified() {
    trackingTool = new TrackingTool("link", "");
    trackingTool.validate(null);
    assertThat(trackingTool.errors().on(TrackingTool.REGEX), is("Regex should be populated"));
    trackingTool = new TrackingTool("", "regex");
    trackingTool.validate(null);
    assertThat(trackingTool.errors().on(TrackingTool.LINK), is("Link should be populated"));
}
Also used : TrackingTool(com.thoughtworks.go.config.TrackingTool) Test(org.junit.Test)

Example 12 with TrackingTool

use of com.thoughtworks.go.config.TrackingTool in project gocd by gocd.

the class TrackingToolTest method shouldEnsureTrackingToolLinkContainsIDForTheMatchingRegexGroup.

@Test
public void shouldEnsureTrackingToolLinkContainsIDForTheMatchingRegexGroup() {
    TrackingTool trackingTool = new TrackingTool("http://no-id.com", "some-regex");
    trackingTool.validate(null);
    ConfigErrors configErrors = trackingTool.errors();
    List<String> errors = configErrors.getAllOn(TrackingTool.LINK);
    assertThat(errors.size(), is(1));
    assertThat(errors, hasItem("Link must be a URL containing '${ID}'. Go will replace the string '${ID}' with the first matched group from the regex at run-time."));
}
Also used : TrackingTool(com.thoughtworks.go.config.TrackingTool) Test(org.junit.Test)

Example 13 with TrackingTool

use of com.thoughtworks.go.config.TrackingTool in project gocd by gocd.

the class TrackingToolTest method shouldSetTrackingToolAttributesFromConfigMap.

@Test
public void shouldSetTrackingToolAttributesFromConfigMap() {
    trackingTool = new TrackingTool();
    HashMap attributeMap = new HashMap();
    String expectedLink = "http://blah.com";
    attributeMap.put(TrackingTool.LINK, expectedLink);
    String expectedRegex = "[a-z]*";
    attributeMap.put(TrackingTool.REGEX, expectedRegex);
    trackingTool.setConfigAttributes(attributeMap);
    assertThat(trackingTool.getLink(), is(expectedLink));
    assertThat(trackingTool.getRegex(), is(expectedRegex));
}
Also used : HashMap(java.util.HashMap) TrackingTool(com.thoughtworks.go.config.TrackingTool) Test(org.junit.Test)

Example 14 with TrackingTool

use of com.thoughtworks.go.config.TrackingTool in project gocd by gocd.

the class TrackingToolTest method shouldValidate.

@Test
public void shouldValidate() {
    TrackingTool tool = new TrackingTool();
    tool.validateTree(null);
    assertThat(tool.errors().on(TrackingTool.LINK), is("Link should be populated"));
    assertThat(tool.errors().on(TrackingTool.REGEX), is("Regex should be populated"));
}
Also used : TrackingTool(com.thoughtworks.go.config.TrackingTool) Test(org.junit.Test)

Example 15 with TrackingTool

use of com.thoughtworks.go.config.TrackingTool in project gocd by gocd.

the class MingleConfigTest method shouldGetMingleConfigAsTrackingTool.

@Test
public void shouldGetMingleConfigAsTrackingTool() {
    MingleConfig mingleConfig = new MingleConfig("http://foo.bar:7019/baz", "go-project");
    TrackingTool expectedTrackingTool = new TrackingTool("http://foo.bar:7019/baz/projects/go-project/cards/${ID}", "#(\\d+)");
    assertThat(mingleConfig.asTrackingTool(), is(expectedTrackingTool));
}
Also used : MingleConfig(com.thoughtworks.go.config.MingleConfig) TrackingTool(com.thoughtworks.go.config.TrackingTool) Test(org.junit.Test)

Aggregations

TrackingTool (com.thoughtworks.go.config.TrackingTool)17 Test (org.junit.Test)12 MingleConfig (com.thoughtworks.go.config.MingleConfig)3 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)2 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)2 DurationBeans (com.thoughtworks.go.dto.DurationBeans)2 PipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel)2 Before (org.junit.Before)2 Gson (com.google.gson.Gson)1 OutputLinkWriter (com.thoughtworks.go.api.base.OutputLinkWriter)1 OutputListWriter (com.thoughtworks.go.api.base.OutputListWriter)1 OutputWriter (com.thoughtworks.go.api.base.OutputWriter)1 Tabs (com.thoughtworks.go.config.Tabs)1 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)1 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)1 PipelinePauseInfo (com.thoughtworks.go.domain.PipelinePauseInfo)1 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)1 Modification (com.thoughtworks.go.domain.materials.Modification)1 DurationBean (com.thoughtworks.go.dto.DurationBean)1 EmptyPipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.EmptyPipelineInstanceModel)1