use of com.thoughtworks.go.config.TrackingTool in project gocd by gocd.
the class JobController method presenter.
private JobDetailPresentationModel presenter(JobInstance current) {
String pipelineName = current.getIdentifier().getPipelineName();
String stageName = current.getIdentifier().getStageName();
JobInstances recent25 = jobInstanceService.latestCompletedJobs(pipelineName, stageName, current.getName());
AgentConfig agentConfig = goConfigService.agentByUuid(current.getAgentUuid());
Pipeline pipelineWithOneBuild = pipelineService.wrapBuildDetails(current);
Tabs customizedTabs = goConfigService.getCustomizedTabs(pipelineWithOneBuild.getName(), pipelineWithOneBuild.getFirstStage().getName(), current.getName());
TrackingTool trackingTool = goConfigService.pipelineConfigNamed(new CaseInsensitiveString(pipelineWithOneBuild.getName())).trackingTool();
Properties properties = propertiesService.getPropertiesForJob(current.getId());
Stage stage = stageService.getStageByBuild(current);
return new JobDetailPresentationModel(current, recent25, agentConfig, pipelineWithOneBuild, customizedTabs, trackingTool, artifactService, properties, stage);
}
use of com.thoughtworks.go.config.TrackingTool in project gocd by gocd.
the class JobDetailPresentationModelJMockTest method setUp.
@Before
public void setUp() {
stubJobInstance = context.mock(JobInstance.class);
TrackingTool trackingTool = context.mock(TrackingTool.class);
artifactService = context.mock(ArtifactsService.class);
jobIdentifier = new JobIdentifier("pipeline", -1, "1", "stageName", "0", "build", 1L);
context.checking(new Expectations() {
{
allowing(stubJobInstance).getName();
will(returnValue("build"));
allowing(stubJobInstance).getId();
will(returnValue(1L));
allowing(stubJobInstance).getIdentifier();
will(returnValue(jobIdentifier));
}
});
Stage stage = StageMother.custom("stageName", stubJobInstance);
Pipeline pipeline = new Pipeline("pipeline", null, stage);
pipeline.setId(1L);
trackingTool = new TrackingTool();
jobDetailPresenter = new JobDetailPresentationModel(stubJobInstance, null, null, pipeline, new Tabs(), trackingTool, artifactService, new Properties(), null);
testFolder = TestFileUtil.createTempFolder("testFiles");
}
use of com.thoughtworks.go.config.TrackingTool in project gocd by gocd.
the class StageJsonPresentationModelTest method shouldGetAPresenterWithLabelAndRelevantBuildPlans.
@Test
public void shouldGetAPresenterWithLabelAndRelevantBuildPlans() throws Exception {
DurationBeans durations = new DurationBeans(new DurationBean(stage.getJobInstances().getByName("job-that-will-fail").getId(), 12L));
StageJsonPresentationModel presenter = new StageJsonPresentationModel(pipeline, stage, null, new Agents(), durations, new TrackingTool());
Map json = presenter.toJson();
new JsonTester(json).shouldContain("{ 'stageName' : 'stage'," + " 'builds' : [" + " { 'name' : 'job-that-will-fail', 'last_build_duration' : '12' }," + " { 'name' : 'job-that-will-pass' }, " + " { 'name' : 'scheduledBuild' }" + " ]," + " 'current_label' : '" + pipeline.getLabel() + "'," + " 'id' : '1' " + "}");
assertFalse("JSON shouldn't contain last_successful_label", json.toString().contains("last_successful_label"));
}
use of com.thoughtworks.go.config.TrackingTool in project gocd by gocd.
the class TrackingToolTest method shouldRenderStringWithSpecifiedRegexAndLink.
@Test
public void shouldRenderStringWithSpecifiedRegexAndLink() throws Exception {
TrackingTool config = new TrackingTool("http://mingle05/projects/cce/cards/${ID}", "#(\\d+)");
String result = config.render("#111: checkin message");
assertThat(result, is("<a href=\"" + "http://mingle05/projects/cce/cards/111\" target=\"story_tracker\">#111</a>: checkin message"));
}
use of com.thoughtworks.go.config.TrackingTool in project gocd by gocd.
the class TrackingToolTest method shouldReturnOriginalStringIfRegexDoesNotMatch.
@Test
public void shouldReturnOriginalStringIfRegexDoesNotMatch() throws Exception {
String toRender = "evo-abc: checkin message";
TrackingTool config = new TrackingTool("http://mingle05/projects/cce/cards/${ID}", "#(\\d+)");
assertThat(config.render(toRender), is(toRender));
}
Aggregations