Search in sources :

Example 1 with TrackingTool

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);
}
Also used : AgentConfig(com.thoughtworks.go.config.AgentConfig) Tabs(com.thoughtworks.go.config.Tabs) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) JobDetailPresentationModel(com.thoughtworks.go.server.presentation.models.JobDetailPresentationModel) Properties(com.thoughtworks.go.domain.Properties) TrackingTool(com.thoughtworks.go.config.TrackingTool) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString)

Example 2 with TrackingTool

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");
}
Also used : Expectations(org.jmock.Expectations) ArtifactsService(com.thoughtworks.go.server.service.ArtifactsService) JobInstance(com.thoughtworks.go.domain.JobInstance) Stage(com.thoughtworks.go.domain.Stage) Tabs(com.thoughtworks.go.config.Tabs) JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) Properties(com.thoughtworks.go.domain.Properties) TrackingTool(com.thoughtworks.go.config.TrackingTool) Pipeline(com.thoughtworks.go.domain.Pipeline) Before(org.junit.Before)

Example 3 with TrackingTool

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"));
}
Also used : DurationBean(com.thoughtworks.go.dto.DurationBean) Agents(com.thoughtworks.go.config.Agents) Map(java.util.Map) DurationBeans(com.thoughtworks.go.dto.DurationBeans) TrackingTool(com.thoughtworks.go.config.TrackingTool) Test(org.junit.Test)

Example 4 with TrackingTool

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"));
}
Also used : TrackingTool(com.thoughtworks.go.config.TrackingTool) Test(org.junit.Test)

Example 5 with TrackingTool

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

Aggregations

TrackingTool (com.thoughtworks.go.config.TrackingTool)15 Test (org.junit.Test)10 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)3 MingleConfig (com.thoughtworks.go.config.MingleConfig)2 Tabs (com.thoughtworks.go.config.Tabs)2 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)2 Properties (com.thoughtworks.go.domain.Properties)2 DurationBeans (com.thoughtworks.go.dto.DurationBeans)2 PipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel)2 Before (org.junit.Before)2 AgentConfig (com.thoughtworks.go.config.AgentConfig)1 Agents (com.thoughtworks.go.config.Agents)1 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)1 JobIdentifier (com.thoughtworks.go.domain.JobIdentifier)1 JobInstance (com.thoughtworks.go.domain.JobInstance)1 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)1 Pipeline (com.thoughtworks.go.domain.Pipeline)1 Stage (com.thoughtworks.go.domain.Stage)1 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)1 Modification (com.thoughtworks.go.domain.materials.Modification)1