use of com.thoughtworks.go.server.service.InstanceFactory in project gocd by gocd.
the class PipelineWithRunOnAllJob method scheduleAndCompleteFollowingStages.
protected void scheduleAndCompleteFollowingStages(Pipeline pipeline, JobResult result) {
Stage ft = new InstanceFactory().createStageInstance(ftStage(), new DefaultSchedulingContext("anyone"), "md5-test", new TimeProvider());
ft.setOrderId(pipeline.getFirstStage().getOrderId() + 1);
dbHelper.getStageDao().saveWithJobs(pipeline, ft);
dbHelper.completeStage(ft, result);
}
use of com.thoughtworks.go.server.service.InstanceFactory in project gocd by gocd.
the class IsSecurityEnabledVoterTest method shouldNotVoteAccessGrantedIfSecurityIsEnabledButAnonymousIsNot.
@Test
public void shouldNotVoteAccessGrantedIfSecurityIsEnabledButAnonymousIsNot() {
configHelper.addBogusSecurity(false);
GoConfigService configService = new GoConfigService(goConfigDao, null, new SystemTimeClock(), mock(GoConfigMigration.class), null, null, ConfigElementImplementationRegistryMother.withNoPlugins(), new InstanceFactory(), mock(CachedGoPartials.class), null);
IsSecurityEnabledVoter voter = new IsSecurityEnabledVoter(configService);
int accessStatus = voter.vote(null, null, null);
assertThat(accessStatus, Is.is(AccessDecisionVoter.ACCESS_ABSTAIN));
}
use of com.thoughtworks.go.server.service.InstanceFactory in project gocd by gocd.
the class PipelineWithMultipleStages method scheduleAndCompleteFollowingStages.
@Override
protected void scheduleAndCompleteFollowingStages(Pipeline pipeline, JobResult result) {
for (int index = 2; index <= stagesSize; index++) {
StageConfig stageConfig = stageConfig(index);
Stage instance = new InstanceFactory().createStageInstance(stageConfig, new DefaultSchedulingContext("anyone"), "md5-test", new TimeProvider());
instance.setOrderId(index);
dbHelper.getStageDao().saveWithJobs(pipeline, instance);
dbHelper.completeStage(instance, result);
}
}
use of com.thoughtworks.go.server.service.InstanceFactory in project gocd by gocd.
the class PipelineHistoryMother method stageHistory.
public static StageInstanceModels stageHistory(PipelineConfig pipelineConfig, Date modificationDate) {
StageInstanceModels history = new StageInstanceModels();
for (StageConfig stageConfig : pipelineConfig) {
StageInstanceModel item = new StageInstanceModel(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;
}
use of com.thoughtworks.go.server.service.InstanceFactory in project gocd by gocd.
the class StageMother method scheduleInstance.
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;
}
Aggregations