コード例 #1
0
 @Test
 public void shouldNotSchedulePipelineWithManualFirstStageForAutomaticBuild() throws Exception {
   configHelper.configureStageAsManualApproval(MINGLE_PIPELINE_NAME, STAGE_NAME);
   svnRepository.checkInOneFile("a.java");
   scheduleHelper.autoSchedulePipelinesWithRealMaterials(MINGLE_PIPELINE_NAME);
   assertThat(pipelineScheduleQueue.toBeScheduled().keySet(), not(hasItem(MINGLE_PIPELINE_NAME)));
 }
コード例 #2
0
 public void addAuthorizedUserForStage(String pipelineName, String stageName, String... users) {
   configureStageAsManualApproval(pipelineName, stageName);
   CruiseConfig cruiseConfig = loadForEdit();
   StageConfig stageConfig =
       cruiseConfig.stageConfigByName(
           new CaseInsensitiveString(pipelineName), new CaseInsensitiveString(stageName));
   Approval approval = stageConfig.getApproval();
   for (String user : users) {
     approval.getAuthConfig().add(new AdminUser(new CaseInsensitiveString(user)));
   }
   writeConfigFile(cruiseConfig);
 }
コード例 #3
0
  @Test
  public void shouldSchedulePipelineWithManualFirstStageWhenManuallyTriggered() throws Exception {
    configHelper.configureStageAsManualApproval(MINGLE_PIPELINE_NAME, STAGE_NAME);

    svnRepository.checkInOneFile("a.java");
    materialDatabaseUpdater.updateMaterial(svnRepository.material());

    final HashMap<String, String> revisions = new HashMap<String, String>();
    final HashMap<String, String> environmentVariables = new HashMap<String, String>();
    buildCauseProducer.manualProduceBuildCauseAndSave(
        MINGLE_PIPELINE_NAME,
        Username.ANONYMOUS,
        new ScheduleOptions(revisions, environmentVariables, new HashMap<String, String>()),
        new ServerHealthStateOperationResult());

    Map<String, BuildCause> afterLoad = scheduleHelper.waitForAnyScheduled(5);
    assertThat(afterLoad.keySet(), hasItem(MINGLE_PIPELINE_NAME));
    BuildCause cause = afterLoad.get(MINGLE_PIPELINE_NAME);
    assertThat(cause.getBuildCauseMessage(), containsString("Forced by anonymous"));
  }