Search in sources :

Example 76 with ServerHealthStateOperationResult

use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.

the class SchedulingCheckerServiceIntegrationTest method shouldPassCheckingWhenUserHasPermissionForManualTrigger.

@Test
public void shouldPassCheckingWhenUserHasPermissionForManualTrigger() throws Exception {
    Pipeline pipeline = pipelineFixture.createdPipelineWithAllStagesPassed();
    configFileHelper.addAuthorizedUserForStage(pipeline.getName(), pipelineFixture.devStage, APPROVED_USER);
    assertTrue(schedulingChecker.canManuallyTrigger(pipelineFixture.pipelineConfig(), APPROVED_USER, new ServerHealthStateOperationResult()));
}
Also used : ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.jupiter.api.Test)

Example 77 with ServerHealthStateOperationResult

use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.

the class SchedulingCheckerServiceIntegrationTest method shouldNotPassCheckingWhenAnyStageIsActiveInPipelineForManualTrigger.

@Test
public void shouldNotPassCheckingWhenAnyStageIsActiveInPipelineForManualTrigger() throws Exception {
    Pipeline pipeline = pipelineFixture.createPipelineWithFirstStageScheduled();
    String username = APPROVED_USER;
    PipelineConfig pipelineConfig = pipelineFixture.pipelineConfig();
    ServerHealthStateOperationResult result = new ServerHealthStateOperationResult();
    assertThat(schedulingChecker.canManuallyTrigger(pipelineConfig, username, result), is(false));
    assertThat(result.getServerHealthState().getDescription(), containsString("still in progress"));
    assertThat(result.getServerHealthState().getDescription(), containsString(pipeline.getName()));
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Matchers.containsString(org.hamcrest.Matchers.containsString) ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.jupiter.api.Test)

Example 78 with ServerHealthStateOperationResult

use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.

the class SchedulingCheckerServiceIntegrationTest method shouldNotPassCheckingWhenUserHasNoPermissionForManualTrigger.

@Test
public void shouldNotPassCheckingWhenUserHasNoPermissionForManualTrigger() throws Exception {
    pipelineFixture.createdPipelineWithAllStagesPassed();
    pipelineFixture.configStageAsManualApprovalWithApprovedUsers(pipelineFixture.devStage, APPROVED_USER);
    ServerHealthStateOperationResult result = new ServerHealthStateOperationResult();
    assertThat(schedulingChecker.canManuallyTrigger(pipelineFixture.pipelineConfig(), "gli", result), is(false));
    assertThat(result.getServerHealthState().getDescription(), containsString("does not have permission"));
}
Also used : ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) Test(org.junit.jupiter.api.Test)

Example 79 with ServerHealthStateOperationResult

use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.

the class SchedulingCheckerServiceIntegrationTest method shouldNotPassCheckingWhenTargetStageIsActiveInAnyPipelineForRerun.

@Test
public void shouldNotPassCheckingWhenTargetStageIsActiveInAnyPipelineForRerun() throws Exception {
    Pipeline pipeline = pipelineFixture.createdPipelineWithAllStagesPassed();
    pipelineFixture.createPipelineWithFirstStageScheduled();
    configFileHelper.addAuthorizedUserForStage(pipeline.getName(), pipelineFixture.devStage, APPROVED_USER);
    ServerHealthStateOperationResult result = new ServerHealthStateOperationResult();
    assertThat(schedulingChecker.canScheduleStage(pipeline.getIdentifier(), pipelineFixture.devStage, APPROVED_USER, result), is(false));
    assertThat(result.getServerHealthState().getDescription(), containsString("still in progress"));
    assertThat(result.getServerHealthState().getDescription(), containsString(pipeline.getName()));
    assertThat(result.getServerHealthState().getDescription(), containsString(pipelineFixture.devStage));
}
Also used : ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.jupiter.api.Test)

Example 80 with ServerHealthStateOperationResult

use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.

the class SchedulingCheckerServiceIntegrationTest method shouldNotPassCheckingWhenTargetStageIsActiveInAnyPipelineForManualTrigger.

@Test
public void shouldNotPassCheckingWhenTargetStageIsActiveInAnyPipelineForManualTrigger() throws Exception {
    Pipeline pipeline = pipelineFixture.createdPipelineWithAllStagesPassed();
    pipelineFixture.createPipelineWithFirstStageScheduled();
    ServerHealthStateOperationResult result = new ServerHealthStateOperationResult();
    assertThat(schedulingChecker.canManuallyTrigger(pipelineFixture.pipelineConfig(), APPROVED_USER, result), is(false));
    assertThat(result.getServerHealthState().getDescription(), containsString("still in progress"));
    assertThat(result.getServerHealthState().getDescription(), containsString(pipeline.getName()));
    assertThat(result.getServerHealthState().getDescription(), containsString(pipelineFixture.devStage));
}
Also used : ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) Pipeline(com.thoughtworks.go.domain.Pipeline) 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