Search in sources :

Example 16 with TrackingTool

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

the class PipelineRepresenter method toJSON.

public static void toJSON(OutputWriter jsonOutputWriter, GoDashboardPipeline model, Username username) {
    String usernameString = username.getUsername().toString();
    jsonOutputWriter.addLinks(linksWriter -> addLinks(linksWriter, model)).add("name", model.name().toString()).add("last_updated_timestamp", model.getLastUpdatedTimeStamp()).add("locked", model.model().getLatestPipelineInstance().isCurrentlyLocked()).addChild("pause_info", getPauseInfoNEW(model)).add("can_operate", model.isPipelineOperator(usernameString)).add("can_administer", model.canBeAdministeredBy(usernameString)).add("can_unlock", model.canBeOperatedBy(usernameString)).add("can_pause", model.canBeOperatedBy(usernameString)).add("from_config_repo", !model.isLocal());
    if (model.getTrackingTool().isPresent()) {
        TrackingTool trackingTool = model.getTrackingTool().get();
        jsonOutputWriter.addChild("tracking_tool", childWriter -> {
            childWriter.add("regex", trackingTool.getRegex()).add("link", trackingTool.getLink());
        });
    }
    jsonOutputWriter.addChild("_embedded", childWriter -> {
        childWriter.addChildList("instances", writeInstances(model));
    });
}
Also used : OutputListWriter(com.thoughtworks.go.api.base.OutputListWriter) Consumer(java.util.function.Consumer) TrackingTool(com.thoughtworks.go.config.TrackingTool) OutputWriter(com.thoughtworks.go.api.base.OutputWriter) StringUtils(org.apache.commons.lang.StringUtils) GoDashboardPipeline(com.thoughtworks.go.server.dashboard.GoDashboardPipeline) Username(com.thoughtworks.go.server.domain.Username) PipelinePauseInfo(com.thoughtworks.go.domain.PipelinePauseInfo) OutputLinkWriter(com.thoughtworks.go.api.base.OutputLinkWriter) Routes(com.thoughtworks.go.spark.Routes) EmptyPipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.EmptyPipelineInstanceModel) TrackingTool(com.thoughtworks.go.config.TrackingTool)

Example 17 with TrackingTool

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

the class ViewCacheKeyTest method shouldGenerateKeyForBuildCause.

@Test
public void shouldGenerateKeyForBuildCause() {
    PipelineModel model = new PipelineModel("pipelineName", true, true, PipelinePauseInfo.notPaused());
    PipelineInstanceModel pipelineInstance = PipelineInstanceModel.createPipeline("pipelineName", 10, "label-10", BuildCause.createExternal(), new StageInstanceModels());
    pipelineInstance.setId(12);
    TrackingTool trackingTool = new TrackingTool("link", "regex");
    pipelineInstance.setTrackingTool(trackingTool);
    model.addPipelineInstance(pipelineInstance);
    PipelineInstanceModel pipelineInstance2 = PipelineInstanceModel.createPipeline("pipelineName", 7, "label-7", BuildCause.createExternal(), new StageInstanceModels());
    pipelineInstance2.setId(14);
    MingleConfig mingleConfig = new MingleConfig("mingle", "project", "mql");
    pipelineInstance2.setMingleConfig(mingleConfig);
    model.addPipelineInstance(pipelineInstance2);
    assertThat(viewCacheKey.forPipelineModelBuildCauses(model), is(String.format("view_buildCausesForPipelineModel_pipelineName[12|%s|%s][14|%s|%s]", trackingTool.hashCode(), -1, -1, mingleConfig.hashCode())));
}
Also used : PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) MingleConfig(com.thoughtworks.go.config.MingleConfig) TrackingTool(com.thoughtworks.go.config.TrackingTool) PipelineModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineModel) 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