@Before public void setUp() throws Exception { instanceFactory = new InstanceFactory(); this.clock = mock(Clock.class); }
private static Pipeline createPipelineInstance(PipelineConfig pipelineConfig, BuildCause cause, String approvedBy) { return new InstanceFactory().createPipelineInstance(pipelineConfig, cause, new DefaultSchedulingContext(approvedBy), "md5-test", new TimeProvider()); }
private static Stage scheduleInstance(StageConfig stageConfig) { Stage stageInstance = new InstanceFactory().createStageInstance(stageConfig, new DefaultSchedulingContext(DEFAULT_APPROVED_BY), "md5-test", new TimeProvider()); stageInstance.building(); return stageInstance; }
public static StageInstanceModels stageHistory(PipelineConfig pipelineConfig, Date modificationDate) { StageInstanceModels history = new StageInstanceModels(); for (StageConfig stageConfig : pipelineConfig) { StageInstanceModel item = new StageInstanceModel(CaseInsensitiveString.str(stageConfig.name()), "1", buildHistory(stageConfig, modificationDate)); item.setCounter("1"); item.setApprovalType(new InstanceFactory().createStageInstance(stageConfig, new DefaultSchedulingContext("anyone"), md5, new TimeProvider()).getApprovalType()); if (stageConfig.requiresApproval()) { item.setApprovedBy(APPROVED_BY); } else { item.setApprovedBy(GoConstants.DEFAULT_APPROVED_BY); } history.add(item); } return history; }