Search in sources :

Example 1 with Stage

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(""));
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) Stage(com.thoughtworks.go.domain.Stage) Test(org.junit.Test)

Example 2 with Stage

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));
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) Stage(com.thoughtworks.go.domain.Stage) Test(org.junit.Test)

Example 3 with Stage

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);
}
Also used : TimeProvider(com.thoughtworks.go.util.TimeProvider) InstanceFactory(com.thoughtworks.go.server.service.InstanceFactory) Stage(com.thoughtworks.go.domain.Stage) DefaultSchedulingContext(com.thoughtworks.go.domain.DefaultSchedulingContext)

Example 4 with Stage

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;
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) JobInstance(com.thoughtworks.go.domain.JobInstance) Stage(com.thoughtworks.go.domain.Stage) JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) Pipeline(com.thoughtworks.go.domain.Pipeline)

Example 5 with Stage

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;
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) JobInstance(com.thoughtworks.go.domain.JobInstance) Stage(com.thoughtworks.go.domain.Stage) JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) Pipeline(com.thoughtworks.go.domain.Pipeline)

Aggregations

Stage (com.thoughtworks.go.domain.Stage)119 Test (org.junit.jupiter.api.Test)60 Pipeline (com.thoughtworks.go.domain.Pipeline)36 JobInstance (com.thoughtworks.go.domain.JobInstance)25 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)21 Test (org.junit.Test)21 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)16 NullStage (com.thoughtworks.go.domain.NullStage)15 Modification (com.thoughtworks.go.domain.materials.Modification)14 Date (java.util.Date)14 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)11 Stages (com.thoughtworks.go.domain.Stages)11 ProjectStatus (com.thoughtworks.go.domain.activity.ProjectStatus)9 ModelAndView (org.springframework.web.servlet.ModelAndView)8 JobIdentifier (com.thoughtworks.go.domain.JobIdentifier)7 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)7 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)7 ArrayList (java.util.ArrayList)7 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)6 StageNotificationData (com.thoughtworks.go.domain.notificationdata.StageNotificationData)6