Search in sources :

Example 46 with PipelineInstanceModel

use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel in project gocd by gocd.

the class PipelineHistoryMother method pipeline.

public static PipelineModel pipeline() {
    PipelineModel pipelineModel = new PipelineModel("pipe1", true, true, PipelinePauseInfo.notPaused());
    MaterialRevisions materialRevisions = ModificationsMother.createHgMaterialRevisions();
    PipelineInstanceModel instanceModel = PipelineInstanceModel.createPipeline("pipe1", -1, "label1", BuildCause.createWithModifications(materialRevisions, "foo-bar"), new StageInstanceModels());
    instanceModel.setMaterialConfigs(new MaterialConfigs(materialRevisions.getMaterialRevision(0).getMaterial().config()));
    instanceModel.setLatestRevisions(materialRevisions);
    pipelineModel.addPipelineInstance(instanceModel);
    return pipelineModel;
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) PipelineModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineModel)

Example 47 with PipelineInstanceModel

use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel in project gocd by gocd.

the class GoDashboardCurrentStateLoader method instancesFor.

private PipelineInstanceModels instancesFor(PipelineConfig pipelineConfig, PipelineInstanceModels historyForDashboard) {
    PipelineInstanceModels pims = findPIMsWithFallbacks(pipelineConfig, historyForDashboard);
    boolean isCurrentlyLocked = pipelineLockService.isLocked(str(pipelineConfig.name()));
    boolean isUnlockable = pipelineUnlockApiService.isUnlockable(str(pipelineConfig.name()));
    for (PipelineInstanceModel instanceModel : pims) {
        populateStagesWhichHaventRunFromConfig(instanceModel, pipelineConfig);
        populateLockStatus(instanceModel, pipelineConfig.isLockable(), isCurrentlyLocked, isUnlockable);
    }
    return pims;
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) PipelineInstanceModels.createPipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels.createPipelineInstanceModels) PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) PipelineInstanceModel.createEmptyPipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel.createEmptyPipelineInstanceModel)

Example 48 with PipelineInstanceModel

use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel in project gocd by gocd.

the class PipelineSqlMapDao method loadHistoryByIdWithBuildCause.

public PipelineInstanceModel loadHistoryByIdWithBuildCause(Long id) {
    PipelineInstanceModel model = loadHistory(id);
    loadPipelineHistoryBuildCause(model);
    return model;
}
Also used : PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel)

Example 49 with PipelineInstanceModel

use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel in project gocd by gocd.

the class PipelineSqlMapDao method loadHistory.

private PipelineInstanceModels loadHistory(String pipelineName, List<Long> ids) {
    if (ids.isEmpty()) {
        return PipelineInstanceModels.createPipelineInstanceModels();
    }
    Map<String, Object> args = arguments("pipelineName", pipelineName).and("from", Collections.min(ids)).and("to", Collections.max(ids)).asMap();
    PipelineInstanceModels history = PipelineInstanceModels.createPipelineInstanceModels((List<PipelineInstanceModel>) getSqlMapClientTemplate().queryForList("getPipelineHistoryByName", args));
    for (PipelineInstanceModel pipelineInstanceModel : history) {
        loadPipelineHistoryBuildCause(pipelineInstanceModel);
    }
    return history;
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString)

Example 50 with PipelineInstanceModel

use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel in project gocd by gocd.

the class PipelineSqlMapDao method groupPipelineInstanceIdsByPipelineName.

private Map<String, TreeSet<Long>> groupPipelineInstanceIdsByPipelineName(List<PipelineInstanceModel> pipelines) {
    Map<String, TreeSet<Long>> result;
    result = new HashMap<String, TreeSet<Long>>();
    for (PipelineInstanceModel pipeline : pipelines) {
        TreeSet<Long> ids = initializePipelineInstances(result, pipeline.getName());
        ids.add(pipeline.getId());
    }
    return result;
}
Also used : PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString)

Aggregations

PipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel)60 Test (org.junit.Test)31 StageInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels)15 PipelineInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels)12 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)11 PipelineModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineModel)9 StageInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel)7 NullStageHistoryItem (com.thoughtworks.go.presentation.pipelinehistory.NullStageHistoryItem)6 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)5 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)5 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)4 PipelineDependencyGraphOld (com.thoughtworks.go.domain.PipelineDependencyGraphOld)4 Modification (com.thoughtworks.go.domain.materials.Modification)4 PipelineHistoryGroups (com.thoughtworks.go.server.presentation.models.PipelineHistoryGroups)4 Matchers.anyString (org.mockito.Matchers.anyString)4 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)3 EmptyPipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.EmptyPipelineInstanceModel)3 TimeProvider (com.thoughtworks.go.util.TimeProvider)3 MingleConfig (com.thoughtworks.go.config.MingleConfig)2 TrackingTool (com.thoughtworks.go.config.TrackingTool)2