Search in sources :

Example 66 with ServerHealthStateOperationResult

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

the class BuildCauseProducerServiceIntegrationTest method shouldScheduleANewPipelineWhenManuallyTrigeredWithNoChanges.

@Test
public void shouldScheduleANewPipelineWhenManuallyTrigeredWithNoChanges() throws Exception {
    final HashMap<String, String> revisions = new HashMap<>();
    final HashMap<String, String> environmentVariables = new HashMap<>();
    buildCauseProducer.manualProduceBuildCauseAndSave(MINGLE_PIPELINE_NAME, Username.ANONYMOUS, new ScheduleOptions(revisions, environmentVariables, new HashMap<>()), new ServerHealthStateOperationResult());
    assertThat(scheduleHelper.waitForAnyScheduled(5).keySet(), hasItem(new CaseInsensitiveString(MINGLE_PIPELINE_NAME)));
}
Also used : ScheduleOptions(com.thoughtworks.go.server.scheduling.ScheduleOptions) HashMap(java.util.HashMap) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.jupiter.api.Test)

Example 67 with ServerHealthStateOperationResult

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

the class BuildCauseProducerServiceIntegrationTest method shouldNotAutoSchedulePausedPipeline.

@Test
public void shouldNotAutoSchedulePausedPipeline() throws Exception {
    ScheduleTestUtil u = new ScheduleTestUtil(transactionTemplate, materialRepository, dbHelper, configHelper);
    HgMaterial hg = new HgMaterial("url", null);
    String[] hg_revs = { "h1", "h2" };
    u.checkinInOrder(hg, hg_revs);
    ScheduleTestUtil.AddedPipeline p1 = u.saveConfigWith("p1", u.m(hg));
    ScheduleTestUtil.AddedPipeline p2 = u.saveConfigWith("p2", u.m(hg));
    pipelinePauseService.pause(p1.config.name().toString(), "pausing p1", Username.ANONYMOUS);
    ServerHealthStateOperationResult p1Result = new ServerHealthStateOperationResult();
    service.autoSchedulePipeline(p1.config.name().toString(), p1Result, 1234);
    assertThat(p1Result.canContinue(), is(false));
    ServerHealthStateOperationResult p2Result = new ServerHealthStateOperationResult();
    service.autoSchedulePipeline(p2.config.name().toString(), p2Result, 1234);
    assertThat(p2Result.canContinue(), is(true));
}
Also used : HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) Test(org.junit.jupiter.api.Test)

Example 68 with ServerHealthStateOperationResult

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

the class BuildCauseProducerServiceWithFlipModificationTest method shouldHaveModificationChangedAsFalseWhenForceBuildWithoutModification.

@Test
public void shouldHaveModificationChangedAsFalseWhenForceBuildWithoutModification() throws Exception {
    mingleConfig = configHelper.addPipeline(PIPELINE_NAME, STAGE_NAME, svnMaterialConfig, "unit", "functional");
    consume(buildCause());
    final HashMap<String, String> revisions = new HashMap<>();
    final HashMap<String, String> environmentVariables = new HashMap<>();
    buildCauseProducer.manualProduceBuildCauseAndSave(PIPELINE_NAME, new Username(new CaseInsensitiveString("pavan")), new ScheduleOptions(revisions, environmentVariables, new HashMap<>()), new ServerHealthStateOperationResult());
    verifyBuildCauseHasModificationsWith(pipelineScheduleQueue.toBeScheduled(), false);
}
Also used : ScheduleOptions(com.thoughtworks.go.server.scheduling.ScheduleOptions) HashMap(java.util.HashMap) Username(com.thoughtworks.go.server.domain.Username) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.jupiter.api.Test)

Example 69 with ServerHealthStateOperationResult

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

the class BuildCauseProducerServiceWithFlipModificationTest method shouldHaveModificationChangedAsTrueForNewRevisions.

@Test
public void shouldHaveModificationChangedAsTrueForNewRevisions() throws Exception {
    mingleConfig = configHelper.addPipeline(PIPELINE_NAME, STAGE_NAME, svnMaterialConfig, "unit", "functional");
    consume(buildCause());
    svnRepository.checkInOneFile("abc");
    final HashMap<String, String> revisions = new HashMap<>();
    final HashMap<String, String> environmentVariables = new HashMap<>();
    buildCauseProducer.manualProduceBuildCauseAndSave(PIPELINE_NAME, new Username(new CaseInsensitiveString("pavan")), new ScheduleOptions(revisions, environmentVariables, new HashMap<>()), new ServerHealthStateOperationResult());
    verifyBuildCauseHasModificationsWith(pipelineScheduleQueue.toBeScheduled(), true);
}
Also used : ScheduleOptions(com.thoughtworks.go.server.scheduling.ScheduleOptions) HashMap(java.util.HashMap) Username(com.thoughtworks.go.server.domain.Username) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.jupiter.api.Test)

Example 70 with ServerHealthStateOperationResult

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

the class ScheduleHelper method manuallySchedulePipelineWithRealMaterials.

public ServerHealthState manuallySchedulePipelineWithRealMaterials(String pipeline, Username username, Map<String, String> pegging) throws Exception {
    updateMaterials(pipeline);
    ServerHealthStateOperationResult result = new ServerHealthStateOperationResult();
    final HashMap<String, String> environmentVariables = new HashMap<>();
    HashMap<String, String> secureEnvironmentVariables = new HashMap<>();
    pipelineScheduler.manualProduceBuildCauseAndSave(pipeline, username, new ScheduleOptions(pegging, environmentVariables, secureEnvironmentVariables), result);
    if (result.canContinue()) {
        waitForAnyScheduled(30);
    }
    return result.getServerHealthState();
}
Also used : HashMap(java.util.HashMap) ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString)

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