use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.
the class ArtifactsDiskSpaceFullCheckerTest method shouldSendEmailOnlyOnce.
@Test
public void shouldSendEmailOnlyOnce() throws Exception {
when(goConfigService.adminEmail()).thenReturn("admin@tw.com");
full.onSetUp();
checker.check(new ServerHealthStateOperationResult());
// call once more
checker.check(new ServerHealthStateOperationResult());
verify(emailSender).sendEmail(any(SendEmailMessage.class));
}
use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.
the class PipelinePauseCheckerTest method shouldReturnFailureResultIfPipelineIsPaused.
@Test
public void shouldReturnFailureResultIfPipelineIsPaused() {
when(pipelinePauseService.isPaused(pipelineName)).thenReturn(true);
ServerHealthStateOperationResult result = new ServerHealthStateOperationResult();
checker.check(result);
assertThat(result.getServerHealthState().isSuccess(), is(false));
assertThat(result.getServerHealthState().getDescription(), is("Pipeline cruise is paused"));
}
use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.
the class PipelinePauseCheckerTest method shouldReturnPassExceptionIfPipelineIsNotPaused.
@Test
public void shouldReturnPassExceptionIfPipelineIsNotPaused() {
when(pipelinePauseService.isPaused(pipelineName)).thenReturn(false);
ServerHealthStateOperationResult result = new ServerHealthStateOperationResult();
checker.check(result);
assertThat(result.getServerHealthState().isSuccess(), is(true));
}
use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.
the class StageAuthorizationCheckerTest method shouldPassIfUserHasPermission.
@Test
public void shouldPassIfUserHasPermission() {
when(securityService.hasOperatePermissionForStage(pipelineName, stageName, username)).thenReturn(true);
ServerHealthStateOperationResult result = new ServerHealthStateOperationResult();
checker.check(result);
assertThat(result.getServerHealthState().isSuccess(), is(true));
}
use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.
the class StageAuthorizationCheckerTest method shouldFailIfUserHasNoPermission.
@Test
public void shouldFailIfUserHasNoPermission() {
when(securityService.hasOperatePermissionForStage(pipelineName, stageName, username)).thenReturn(false);
ServerHealthStateOperationResult result = new ServerHealthStateOperationResult();
checker.check(result);
assertThat(result.getServerHealthState().isSuccess(), is(false));
assertThat(result.getServerHealthState().getDescription(), is("User gli does not have permission to schedule cruise/dev"));
}
Aggregations