use of com.thoughtworks.go.domain.PipelineIdentifier in project gocd by gocd.
the class SchedulingCheckerServiceUnitTest method shouldCheckIfScheduleCheckersCalledOnStageRerun.
@Test
public void shouldCheckIfScheduleCheckersCalledOnStageRerun() {
schedulingChecker.canRerunStage(new PipelineIdentifier("pipeline_name", 1), "stage_name", "user", operationResult);
verify(schedulingChecker).buildScheduleCheckers(argumentCaptor.capture());
verify(compositeChecker).check(operationResult);
assertFor(argumentCaptor.getValue(), StageAuthorizationChecker.class);
assertFor(argumentCaptor.getValue(), PipelinePauseChecker.class);
assertFor(argumentCaptor.getValue(), PipelineActiveChecker.class);
assertFor(argumentCaptor.getValue(), StageActiveChecker.class);
assertFor(argumentCaptor.getValue(), OutOfDiskSpaceChecker.class);
}
use of com.thoughtworks.go.domain.PipelineIdentifier in project gocd by gocd.
the class SchedulingCheckerServiceUnitTest method shouldCheckIfScheduleCheckersCalledOnScheduleStage.
@Test
public void shouldCheckIfScheduleCheckersCalledOnScheduleStage() {
schedulingChecker.canScheduleStage(new PipelineIdentifier("name", 1), "stage", "user", operationResult);
verify(schedulingChecker).buildScheduleCheckers(argumentCaptor.capture());
verify(compositeChecker).check(operationResult);
assertFor(argumentCaptor.getValue(), StageAuthorizationChecker.class);
assertFor(argumentCaptor.getValue(), StageLockChecker.class);
assertFor(argumentCaptor.getValue(), PipelinePauseChecker.class);
assertFor(argumentCaptor.getValue(), PipelineActiveChecker.class);
assertFor(argumentCaptor.getValue(), StageActiveChecker.class);
assertFor(argumentCaptor.getValue(), OutOfDiskSpaceChecker.class);
}
use of com.thoughtworks.go.domain.PipelineIdentifier in project gocd by gocd.
the class DownstreamInstancePopulator method populateRevisionsFor.
private void populateRevisionsFor(Node currentMaterial, MaterialInstance currentMaterialInstance, HashSet<Revision> visitedRevisions) {
String revision = currentMaterial.revisions().get(0).getRevisionString();
List<Node> downstreamPipelines = currentMaterial.getChildren();
for (Node downstreamPipeline : downstreamPipelines) {
List<PipelineIdentifier> pipelineIdentifiers = pipelineDao.getPipelineInstancesTriggeredWithDependencyMaterial(downstreamPipeline.getName(), currentMaterialInstance, revision);
addRevisionsToNode(downstreamPipeline, pipelineIdentifiers);
populateRevisionsForAllChildrenOf(downstreamPipeline, visitedRevisions);
}
}
use of com.thoughtworks.go.domain.PipelineIdentifier in project gocd by gocd.
the class PipelineUnlockApiServiceTest method unlockShouldSetResultToNotAuthorizedWhenUserDoesNotHaveOperatePermissions.
@Test
public void unlockShouldSetResultToNotAuthorizedWhenUserDoesNotHaveOperatePermissions() throws Exception {
String pipelineName = "pipeline-name";
Mockito.when(securityService.hasOperatePermissionForPipeline(new CaseInsensitiveString("username"), pipelineName)).thenReturn(false);
Mockito.when(goConfigService.hasPipelineNamed(new CaseInsensitiveString(pipelineName))).thenReturn(true);
Mockito.when(goConfigService.isLockable(pipelineName)).thenReturn(true);
StageIdentifier identifier = new StageIdentifier(pipelineName, 10, "10", "stage", "1");
Mockito.when(pipelineLockService.lockedPipeline(pipelineName)).thenReturn(identifier);
Mockito.when(stageService.isAnyStageActiveForPipeline(new PipelineIdentifier(pipelineName, 10, "10"))).thenReturn(false);
HttpOperationResult result = new HttpOperationResult();
pipelineUnlockApiService.unlock(pipelineName, new Username(new CaseInsensitiveString("username")), result);
assertThat(result.httpCode(), is(403));
assertThat(result.message(), is("user does not have operate permission on the pipeline"));
}
use of com.thoughtworks.go.domain.PipelineIdentifier in project gocd by gocd.
the class PipelineActiveCheckerTest method setUp.
@BeforeEach
public void setUp() throws Exception {
service = mock(StageService.class);
pipelineIdentifier = new PipelineIdentifier("cruise", 1, "label-1");
checker = new PipelineActiveChecker(service, pipelineIdentifier);
}
Aggregations