use of com.thoughtworks.go.domain.Stage in project gocd by gocd.
the class ArtifactsControllerIntegrationTest method nextLineShouldEqualsStartLineWhenNoOutputReturns.
@Test
public void nextLineShouldEqualsStartLineWhenNoOutputReturns() throws Exception {
prepareConsoleOut("");
Stage firstStage = pipeline.getFirstStage();
int startLineNumber = 0;
ModelAndView view = artifactsController.consoleout(pipeline.getName(), pipeline.getLabel(), firstStage.getName(), "build", String.valueOf(firstStage.getCounter()), startLineNumber);
assertThat(view.getView(), is(instanceOf(ConsoleOutView.class)));
assertThat(((ConsoleOutView) view.getView()).getOffset(), is(0));
assertThat(((ConsoleOutView) view.getView()).getContent(), is(""));
}
use of com.thoughtworks.go.domain.Stage in project gocd by gocd.
the class StageStatusCacheTest method shouldRefreshCurrentStageWhenNewStageComes.
@Test
public void shouldRefreshCurrentStageWhenNewStageComes() {
Stage stage = StageMother.failingStage("dev");
StageIdentifier identifier = new StageIdentifier("cruise", null, "1", "dev", "1");
stage.setIdentifier(identifier);
stageStatusCache.stageStatusChanged(stage);
assertThat(stageStatusCache.currentStage(identifier.stageConfigIdentifier()).stageState(), is(StageState.Failing));
Stage newStage = StageMother.completedFailedStageInstance("pipeline-name", "dev", "linux-firefox");
newStage.setIdentifier(identifier);
stageStatusCache.stageStatusChanged(newStage);
assertThat(stageStatusCache.currentStage(identifier.stageConfigIdentifier()).stageState(), is(StageState.Failed));
}
use of com.thoughtworks.go.domain.Stage 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.domain.Stage in project gocd by gocd.
the class PipelineWithRunOnAllJob method latestPipelineWithIdentifiers.
private Pipeline latestPipelineWithIdentifiers() {
Pipeline pipeline;
pipeline = dbHelper.getPipelineDao().mostRecentPipeline(pipelineName);
//TODO: #2318 - pipeline loaded from DB should contain identifiers
for (Stage stage : pipeline.getStages()) {
stage.setIdentifier(new StageIdentifier(pipeline, stage));
for (JobInstance jobInstance : stage.getJobInstances()) {
jobInstance.setIdentifier(new JobIdentifier(pipeline, stage, jobInstance));
}
}
return pipeline;
}
use of com.thoughtworks.go.domain.Stage in project gocd by gocd.
the class PipelineWithTwoStages method latestPipelineWithIdentifiers.
private Pipeline latestPipelineWithIdentifiers() {
Pipeline pipeline;
pipeline = dbHelper.getPipelineDao().mostRecentPipeline(pipelineName);
//TODO: #2318 - pipeline loaded from DB should contain identifiers
for (Stage stage : pipeline.getStages()) {
stage.setIdentifier(new StageIdentifier(pipeline, stage));
for (JobInstance jobInstance : stage.getJobInstances()) {
jobInstance.setIdentifier(new JobIdentifier(pipeline, stage, jobInstance));
}
}
return pipeline;
}
Aggregations