Search in sources :

Example 26 with Pipeline

use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.

the class StageIntegrationTest method createPipelineWithFirstStageBuilding.

private Pipeline createPipelineWithFirstStageBuilding() throws StageAlreadyBuildingException {
    Pipeline scheduledPipeline = schedulePipeline();
    dbHelper.saveBuildingStage(scheduledPipeline.getFirstStage());
    return pipelineDao.mostRecentPipeline(CaseInsensitiveString.str(mingle.name()));
}
Also used : Pipeline(com.thoughtworks.go.domain.Pipeline)

Example 27 with Pipeline

use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.

the class StageCctrayPresentationModelTest method setUp.

@Before
public void setUp() throws Exception {
    Stage stage = StageMother.passedStageInstance("cruise", "ft", "firefox", DATE);
    stage.setId(STAGE_ID);
    stage.setCompletedByTransitionId(100L);
    stage.getJobInstances().getByName("firefox").setId(BUILD_ID);
    Pipeline pipeline = PipelineMother.pipeline("cruise", stage);
    // used to mock pipeline label
    pipeline.setId(ID);
    // used to mock pipeline label
    pipeline.setLabel(LABEL);
    cctrayXmlPresenter = new StageCctrayPresentationModel(pipeline, stage);
}
Also used : Stage(com.thoughtworks.go.domain.Stage) Pipeline(com.thoughtworks.go.domain.Pipeline) Before(org.junit.Before)

Example 28 with Pipeline

use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.

the class BackgroundStageLoaderIntegrationTest method handleAStageURLNotYetSeenShouldStoreStageResourceIntoStageStorage.

@Test
public void handleAStageURLNotYetSeenShouldStoreStageResourceIntoStageStorage() {
    TestFailureSetup.SavedStage savedStage = failureSetup.setupPipelineInstanceWithoutTestXmlStubbing(true, null, new Date());
    loader.handle(feedEntry(savedStage), pipelineInstanceLoader);
    assertTrue(stageStorage.isStageStored(savedStage.stageId));
    Graph storedGraph = stageStorage.load(savedStage.stageId);
    Stage stage = savedStage.stage;
    String baseUrl = "https://localhost:8154/go";
    String jobUrl = new JobXmlViewModel(stage.getJobInstances().first()).httpUrl(baseUrl);
    assertTrue(storedGraph.containsResourceWithURI(jobUrl));
    assertTrue(storedGraph.containsResourceWithURI(new StageXmlViewModel(stage).httpUrl(baseUrl)));
    Pipeline pipeline = savedStage.pipeline;
    assertTrue(storedGraph.containsResourceWithURI(PipelineXmlViewModel.httpUrlForPipeline(baseUrl, pipeline.getId(), pipeline.getName())));
    Modification latestModification = pipeline.getMaterialRevisions().getRevisions().get(0).getLatestModification();
    assertTrue(storedGraph.containsResourceWithURI(ScmMaterial.changesetUrl(latestModification, baseUrl, latestModification.getMaterialInstance().getId())));
}
Also used : Modification(com.thoughtworks.go.domain.materials.Modification) Graph(com.thoughtworks.studios.shine.semweb.Graph) StageXmlViewModel(com.thoughtworks.go.server.domain.xml.StageXmlViewModel) JobXmlViewModel(com.thoughtworks.go.server.domain.xml.JobXmlViewModel) TestFailureSetup(com.thoughtworks.go.server.dao.sparql.TestFailureSetup) Stage(com.thoughtworks.go.domain.Stage) Date(java.util.Date) Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.Test)

Example 29 with Pipeline

use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.

the class CachedCurrentActivityServiceIntegrationTest method testShouldReturnFalseIfAStageOfAPipelineHasNotStarted.

@Test
public void testShouldReturnFalseIfAStageOfAPipelineHasNotStarted() {
    Pipeline pipeline = fixture.createPipelineWithFirstStagePassedAndSecondStageHasNotStarted();
    assertThat(cachedCurrentActivityService.isAnyStageActive(pipeline.getIdentifier()), is(false));
}
Also used : Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.Test)

Example 30 with Pipeline

use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.

the class ScheduleServiceSecurityTest method shouldCancelStageGivenValidPipelineAndStageName.

@Test
public void shouldCancelStageGivenValidPipelineAndStageName() throws Exception {
    configHelper.enableSecurity();
    Username user = UserHelper.getUserName();
    configHelper.setOperatePermissionForGroup("defaultGroup", user.getUsername().toString());
    Pipeline pipeline = fixture.createPipelineWithFirstStagePassedAndSecondStageRunning();
    HttpLocalizedOperationResult operationResult = new HttpLocalizedOperationResult();
    Stage stageForCancellation = pipeline.getStages().byName(fixture.ftStage);
    Stage resultStage = scheduleService.cancelAndTriggerRelevantStages(pipeline.getName(), stageForCancellation.getName(), user, operationResult);
    assertThat(resultStage, is(not(nullValue())));
    assertThat(operationResult.isSuccessful(), is(true));
    assertThat(operationResult.httpCode(), is(SC_OK));
}
Also used : HttpLocalizedOperationResult(com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult) Username(com.thoughtworks.go.server.domain.Username) Stage(com.thoughtworks.go.domain.Stage) Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.Test)

Aggregations

Pipeline (com.thoughtworks.go.domain.Pipeline)177 Test (org.junit.jupiter.api.Test)73 Test (org.junit.Test)55 Stage (com.thoughtworks.go.domain.Stage)40 JobInstance (com.thoughtworks.go.domain.JobInstance)26 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)23 Username (com.thoughtworks.go.server.domain.Username)17 ServerHealthStateOperationResult (com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult)16 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)14 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)12 JobIdentifier (com.thoughtworks.go.domain.JobIdentifier)12 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)11 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)10 ModelAndView (org.springframework.web.servlet.ModelAndView)10 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)9 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)9 Modification (com.thoughtworks.go.domain.materials.Modification)9 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)7 PipelineState (com.thoughtworks.go.domain.PipelineState)6 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)6