Search in sources :

Example 56 with ServerHealthStateOperationResult

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));
}
Also used : SendEmailMessage(com.thoughtworks.go.server.messaging.SendEmailMessage) ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) Test(org.junit.jupiter.api.Test)

Example 57 with ServerHealthStateOperationResult

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"));
}
Also used : ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) Test(org.junit.jupiter.api.Test)

Example 58 with ServerHealthStateOperationResult

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));
}
Also used : ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) Test(org.junit.jupiter.api.Test)

Example 59 with ServerHealthStateOperationResult

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));
}
Also used : ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) Test(org.junit.jupiter.api.Test)

Example 60 with ServerHealthStateOperationResult

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"));
}
Also used : ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) Test(org.junit.jupiter.api.Test)

Aggregations

ServerHealthStateOperationResult (com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult)89 Test (org.junit.jupiter.api.Test)78 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)28 ScheduleOptions (com.thoughtworks.go.server.scheduling.ScheduleOptions)17 HashMap (java.util.HashMap)17 Pipeline (com.thoughtworks.go.domain.Pipeline)16 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)15 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)12 RepoConfigOrigin (com.thoughtworks.go.config.remote.RepoConfigOrigin)12 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)11 Modification (com.thoughtworks.go.domain.materials.Modification)10 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)8 Username (com.thoughtworks.go.server.domain.Username)8 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)6 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)6 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)6 SendEmailMessage (com.thoughtworks.go.server.messaging.SendEmailMessage)6 BasicCruiseConfig (com.thoughtworks.go.config.BasicCruiseConfig)5 Materials (com.thoughtworks.go.config.materials.Materials)5 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)5