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)));
}
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));
}
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);
}
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);
}
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();
}
Aggregations