use of com.thoughtworks.go.domain.activity.ProjectStatus in project gocd by gocd.
the class CcTrayStageStatusChangeHandlerTest method shouldCreateStatusesWithStageActivityAndWebUrl.
@Test
public void shouldCreateStatusesWithStageActivityAndWebUrl() throws Exception {
Stage stage = StageMother.custom("stage1", JobInstanceMother.building("job1"));
List<ProjectStatus> statuses = handler.statusesOfStageAndItsJobsFor(stage);
ProjectStatus statusOfStage = statuses.get(0);
assertThat(activityOf(statusOfStage), is("Building"));
assertThat(webUrlOf(statusOfStage), is(webUrlFor("stage1")));
}
use of com.thoughtworks.go.domain.activity.ProjectStatus in project gocd by gocd.
the class CcTrayStageStatusChangeHandlerTest method shouldReuseViewersListFromExistingStatusWhenCreatingNewStatus.
@Test
public void shouldReuseViewersListFromExistingStatusWhenCreatingNewStatus() throws Exception {
Viewers viewers = viewers("viewer1", "viewer2");
String projectName = "pipeline :: stage1";
ProjectStatus existingStageStatus = new ProjectStatus(projectName, "OldActivity", "OldStatus", "OldLabel", new Date(), webUrlFor("stage1"));
existingStageStatus.updateViewers(viewers);
when(cache.get(projectName)).thenReturn(existingStageStatus);
Stage stage = StageMother.custom("stage1", JobInstanceMother.building("job1"));
List<ProjectStatus> statuses = handler.statusesOfStageAndItsJobsFor(stage);
ProjectStatus statusOfStage = statuses.get(0);
assertThat(statusOfStage.viewers(), is(viewers));
}
use of com.thoughtworks.go.domain.activity.ProjectStatus in project gocd by gocd.
the class CcTrayStageStatusChangeHandlerTest method shouldUpdateBuildDetailsOfStageWhenStageIsCompleted.
@Test
public void shouldUpdateBuildDetailsOfStageWhenStageIsCompleted() throws Exception {
Stage completedStage = StageMother.createPassedStage("pipeline", 1, "stage1", 1, "job1", new Date());
completedStage.setCompletedByTransitionId(1L);
List<ProjectStatus> statuses = handler.statusesOfStageAndItsJobsFor(completedStage);
ProjectStatus statusOfStage = statuses.get(0);
assertThat(completedStage.isCompleted(), is(true));
assertThat(statusOfStage.getLastBuildStatus(), is("Success"));
assertThat(statusOfStage.getLastBuildTime(), is(completedStage.completedDate()));
assertThat(statusOfStage.getLastBuildLabel(), is("LABEL-1"));
}
use of com.thoughtworks.go.domain.activity.ProjectStatus in project gocd by gocd.
the class CcTrayStageStatusChangeHandlerTest method shouldLeaveBuildDetailsOfStageSameAsTheOneInCache_WhenStageIsNotCompleted_AndThereIsAnExistingStageInCache.
@Test
public void shouldLeaveBuildDetailsOfStageSameAsTheOneInCache_WhenStageIsNotCompleted_AndThereIsAnExistingStageInCache() throws Exception {
String projectName = "pipeline :: stage1";
ProjectStatus existingStageStatus = new ProjectStatus(projectName, "OldActivity", "OldStatus", "OldLabel", new Date(), webUrlFor("stage1"));
when(cache.get(projectName)).thenReturn(existingStageStatus);
Stage stage = StageMother.custom("stage1", JobInstanceMother.building("job1"));
List<ProjectStatus> statuses = handler.statusesOfStageAndItsJobsFor(stage);
ProjectStatus statusOfStage = statuses.get(0);
assertThat(stage.getState().completed(), is(not(true)));
assertThat(statusOfStage.getLastBuildStatus(), is(existingStageStatus.getLastBuildStatus()));
assertThat(statusOfStage.getLastBuildTime(), is(existingStageStatus.getLastBuildTime()));
assertThat(statusOfStage.getLastBuildLabel(), is(existingStageStatus.getLastBuildLabel()));
}
use of com.thoughtworks.go.domain.activity.ProjectStatus in project gocd by gocd.
the class CcTrayStageStatusChangeHandlerTest method shouldCalculateBreakersForStage.
@Test
public void shouldCalculateBreakersForStage() throws Exception {
Stage stage = StageMother.custom("stage1", JobInstanceMother.building("job1"));
when(breakersCalculator.calculateFor(stage)).thenReturn(s("breaker1", "breaker2"));
List<ProjectStatus> statuses = handler.statusesOfStageAndItsJobsFor(stage);
assertThat(statuses.get(0).getBreakers(), is(s("breaker1", "breaker2")));
}
Aggregations