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"));
}
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."));
}
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));
}
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"));
}
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));
}
Aggregations