コード例 #1
0
  @Before
  public void setup() throws Exception {
    diskSpaceSimulator = new DiskSpaceSimulator();
    new HgTestRepo("testHgRepo");

    svnRepository = new SvnTestRepo("testSvnRepo");

    dbHelper.onSetUp();
    configHelper.onSetUp();
    configHelper.usingCruiseConfigDao(goConfigDao).initializeConfigFile();

    repository = new SvnCommand(null, svnRepository.projectRepositoryUrl());

    goParentPipelineConfig =
        configHelper.addPipeline(
            GO_PIPELINE_UPSTREAM,
            STAGE_NAME,
            new MaterialConfigs(new GitMaterialConfig("foo-bar")),
            "unit");

    goPipelineConfig = configHelper.addPipeline(GO_PIPELINE_NAME, STAGE_NAME, repository, "unit");

    svnMaterialRevs = new MaterialRevisions();
    SvnMaterial svnMaterial = SvnMaterial.createSvnMaterialWithMock(repository);
    svnMaterialRevs.addRevision(
        svnMaterial,
        svnMaterial.latestModification(
            null, new ServerSubprocessExecutionContext(goConfigService, new SystemEnvironment())));

    final MaterialRevisions materialRevisions = new MaterialRevisions();
    SvnMaterial anotherSvnMaterial = SvnMaterial.createSvnMaterialWithMock(repository);
    materialRevisions.addRevision(
        anotherSvnMaterial,
        anotherSvnMaterial.latestModification(null, subprocessExecutionContext));

    transactionTemplate.execute(
        new TransactionCallbackWithoutResult() {
          @Override
          protected void doInTransactionWithoutResult(TransactionStatus status) {
            materialRepository.save(svnMaterialRevs);
          }
        });

    BuildCause buildCause = BuildCause.createWithModifications(svnMaterialRevs, "");

    mingleConfig =
        configHelper.addPipeline(
            MINGLE_PIPELINE_NAME,
            STAGE_NAME,
            repository,
            new Filter(new IgnoredFiles("**/*.doc")),
            "unit",
            "functional");
    latestPipeline = PipelineMother.schedule(this.mingleConfig, buildCause);
    latestPipeline = pipelineDao.saveWithStages(latestPipeline);
    dbHelper.passStage(latestPipeline.getStages().first());
    pipelineScheduleQueue.clear();
  }
コード例 #2
0
 @Test
 public void should_NOT_schedulePipeline_whenOneOfTheMaterialsHasNoModificationsPresent()
     throws Exception {
   Pipeline latestGoInstance =
       PipelineMother.schedule(
           goPipelineConfig,
           BuildCause.createManualForced(
               svnMaterialRevs, new Username(new CaseInsensitiveString("loser"))));
   latestGoInstance = pipelineDao.saveWithStages(latestGoInstance);
   dbHelper.passStage(latestGoInstance.getStages().first());
   configHelper.addMaterialToPipeline(
       GO_PIPELINE_NAME,
       new DependencyMaterialConfig(
           new CaseInsensitiveString(GO_PIPELINE_UPSTREAM),
           new CaseInsensitiveString(STAGE_NAME)));
   svnRepository.checkInOneFile("a.java");
   scheduleHelper.autoSchedulePipelinesWithRealMaterials(GO_PIPELINE_NAME);
   assertThat(pipelineScheduleQueue.toBeScheduled().keySet(), not(hasItem(GO_PIPELINE_NAME)));
 }
コード例 #3
0
 private void runAndPass(MaterialRevisions mingleRev) {
   BuildCause buildCause = BuildCause.createWithModifications(mingleRev, "boozer");
   latestPipeline = PipelineMother.schedule(mingleConfig, buildCause);
   latestPipeline = pipelineDao.saveWithStages(latestPipeline);
   dbHelper.passStage(latestPipeline.getStages().first());
 }