use of com.thoughtworks.go.domain.StageIdentifier in project gocd by gocd.
the class FailedBuildHistoryCacheSweeperTest method shouldClearFbhForPipelinesAfterUpdatedPipeline.
@Test
public void shouldClearFbhForPipelinesAfterUpdatedPipeline() {
PipelineIdentifier pipelineIdentifier = entryAfterNew.getPipelineLocator();
Stage stage = StageMother.cancelledStage("dev", "rspec");
stage.setIdentifier(new StageIdentifier(pipelineIdentifier, "dev", "2"));
String pipelineKey = key.forFbhOfStagesUnderPipeline(pipelineIdentifier);
String stageKey = key.forFailedBuildHistoryStage(stage, "html");
goCache.put(pipelineKey, stageKey, "fragment");
sweeper.added(newlyAddedEntry, timeline);
assertThat(goCache.get(pipelineKey), is(nullValue()));
}
use of com.thoughtworks.go.domain.StageIdentifier in project gocd by gocd.
the class PipelineHistoryMother method pipelineHistoryItemWithOneStage.
public static PipelineInstanceModel pipelineHistoryItemWithOneStage(String pipelineName, String stageName, Date modifiedDate) {
StageInstanceModels stageHistory = new StageInstanceModels();
stageHistory.add(new StageInstanceModel(stageName, "1", StageResult.Passed, new StageIdentifier(pipelineName, 1, "1", stageName, "1")));
return singlePipeline(pipelineName, stageHistory, modifiedDate);
}
use of com.thoughtworks.go.domain.StageIdentifier in project gocd by gocd.
the class RestfulServiceTest method shouldTranslateLatestStageCounter.
@Test
public void shouldTranslateLatestStageCounter() {
Pipeline pipeline = fixture.createdPipelineWithAllStagesPassed();
StageIdentifier stageIdentifier = restfulService.translateStageCounter(pipeline.getIdentifier(), fixture.devStage, "latest");
assertThat(stageIdentifier, is(new StageIdentifier(pipeline, pipeline.getStages().byName(fixture.devStage))));
}
use of com.thoughtworks.go.domain.StageIdentifier in project gocd by gocd.
the class StageSqlMapDaoTest method shouldLoadTheStageHistoryEntryNextInTimeFromAGivenStageHistoryEntry.
@Test
public void shouldLoadTheStageHistoryEntryNextInTimeFromAGivenStageHistoryEntry() throws Exception {
StageIdentifier stageIdentifier = mock(StageIdentifier.class);
String pipelineName = "some_pipeline_name";
String stageName = "stage_name";
long pipelineId = 41l;
when(stageIdentifier.getPipelineName()).thenReturn(pipelineName);
when(stageIdentifier.getStageName()).thenReturn(stageName);
StageHistoryEntry topOfThisPage = mock(StageHistoryEntry.class);
StageHistoryEntry bottomOfPreviousPage = mock(StageHistoryEntry.class);
when(topOfThisPage.getId()).thenReturn(pipelineId);
when(topOfThisPage.getIdentifier()).thenReturn(stageIdentifier);
HashMap args = new HashMap();
args.put("pipelineName", pipelineName);
args.put("stageName", stageName);
args.put("id", pipelineId);
args.put("limit", 1);
when(sqlMapClientTemplate.queryForObject("findStageHistoryEntryBefore", args)).thenReturn(bottomOfPreviousPage);
StageHistoryEntry actual = stageSqlMapDao.findImmediateChronologicallyForwardStageHistoryEntry(topOfThisPage);
assertThat(actual, is(bottomOfPreviousPage));
verify(stageIdentifier).getPipelineName();
verify(stageIdentifier).getStageName();
verify(topOfThisPage).getId();
verify(topOfThisPage).getIdentifier();
verify(sqlMapClientTemplate).queryForObject("findStageHistoryEntryBefore", args);
}
use of com.thoughtworks.go.domain.StageIdentifier in project gocd by gocd.
the class PipelineInstanceModelTest method shouldReturnTrueIfThePipelineHasStage.
@Test
public void shouldReturnTrueIfThePipelineHasStage() {
PipelineInstanceModel pim = PipelineHistoryMother.pipelineHistoryItemWithOneStage("pipeline", "stage", new Date());
assertThat(pim.hasStage(pim.getStageHistory().first().getIdentifier()), is(true));
assertThat(pim.hasStage(new StageIdentifier("pipeline", 1, "1", "stagex", "2")), is(false));
}
Aggregations