Search in sources :

Example 1 with IgnoredFiles

use of com.thoughtworks.go.config.materials.IgnoredFiles in project gocd by gocd.

the class GitMaterialConfigTest method shouldSetConfigAttributes.

@Test
public void shouldSetConfigAttributes() {
    GitMaterialConfig gitMaterialConfig = new GitMaterialConfig("");
    Map<String, String> map = new HashMap<>();
    map.put(GitMaterialConfig.URL, "url");
    map.put(GitMaterialConfig.BRANCH, "some-branch");
    map.put(GitMaterialConfig.SHALLOW_CLONE, "true");
    map.put(ScmMaterialConfig.FOLDER, "folder");
    map.put(ScmMaterialConfig.AUTO_UPDATE, null);
    map.put(ScmMaterialConfig.FILTER, "/root,/**/*.help");
    map.put(AbstractMaterialConfig.MATERIAL_NAME, "material-name");
    gitMaterialConfig.setConfigAttributes(map);
    assertThat(gitMaterialConfig.getUrl(), is("url"));
    assertThat(gitMaterialConfig.getFolder(), is("folder"));
    assertThat(gitMaterialConfig.getBranch(), is("some-branch"));
    assertThat(gitMaterialConfig.getName(), is(new CaseInsensitiveString("material-name")));
    assertThat(gitMaterialConfig.isAutoUpdate(), is(false));
    assertThat(gitMaterialConfig.isShallowClone(), is(true));
    assertThat(gitMaterialConfig.filter(), is(new Filter(new IgnoredFiles("/root"), new IgnoredFiles("/**/*.help"))));
}
Also used : HashMap(java.util.HashMap) Filter(com.thoughtworks.go.config.materials.Filter) IgnoredFiles(com.thoughtworks.go.config.materials.IgnoredFiles) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.Test)

Example 2 with IgnoredFiles

use of com.thoughtworks.go.config.materials.IgnoredFiles in project gocd by gocd.

the class HgMaterialConfigTest method shouldSetConfigAttributes.

@Test
public void shouldSetConfigAttributes() {
    HgMaterialConfig hgMaterialConfig = new HgMaterialConfig("", null);
    Map<String, String> map = new HashMap<>();
    map.put(HgMaterialConfig.URL, "url");
    map.put(ScmMaterialConfig.FOLDER, "folder");
    map.put(ScmMaterialConfig.AUTO_UPDATE, "0");
    map.put(ScmMaterialConfig.FILTER, "/root,/**/*.help");
    map.put(AbstractMaterialConfig.MATERIAL_NAME, "material-name");
    hgMaterialConfig.setConfigAttributes(map);
    assertThat(hgMaterialConfig.getUrl(), is("url"));
    assertThat(hgMaterialConfig.getFolder(), is("folder"));
    assertThat(hgMaterialConfig.getName(), is(new CaseInsensitiveString("material-name")));
    assertThat(hgMaterialConfig.isAutoUpdate(), is(false));
    assertThat(hgMaterialConfig.filter(), is(new Filter(new IgnoredFiles("/root"), new IgnoredFiles("/**/*.help"))));
}
Also used : HashMap(java.util.HashMap) Filter(com.thoughtworks.go.config.materials.Filter) IgnoredFiles(com.thoughtworks.go.config.materials.IgnoredFiles) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.Test)

Example 3 with IgnoredFiles

use of com.thoughtworks.go.config.materials.IgnoredFiles in project gocd by gocd.

the class BuildCauseProducerServiceIntegrationHgTest method setup.

@Before
public void setup() throws Exception {
    dbHelper.onSetUp();
    configHelper.onSetUp();
    configHelper.usingCruiseConfigDao(goConfigDao).initializeConfigFile();
    hgTestRepo = new HgTestRepo("hgTestRepo1", temporaryFolder);
    hgMaterial = MaterialsMother.hgMaterial(hgTestRepo.projectRepositoryUrl());
    hgMaterial.setFilter(new Filter(new IgnoredFiles("helper/**/*.*")));
    workingFolder = temporaryFolder.newFolder("workingFolder");
    outputStreamConsumer = inMemoryConsumer();
    mingleConfig = configHelper.addPipeline("cruise", STAGE_NAME, this.hgMaterial.config(), "unit", "functional");
}
Also used : Filter(com.thoughtworks.go.config.materials.Filter) IgnoredFiles(com.thoughtworks.go.config.materials.IgnoredFiles) HgTestRepo(com.thoughtworks.go.helper.HgTestRepo) Before(org.junit.Before)

Example 4 with IgnoredFiles

use of com.thoughtworks.go.config.materials.IgnoredFiles in project gocd by gocd.

the class BuildCauseProducerServiceIntegrationTest method setup.

@Before
public void setup() throws Exception {
    diskSpaceSimulator = new DiskSpaceSimulator();
    new HgTestRepo("testHgRepo", temporaryFolder);
    svnRepository = new SvnTestRepo(temporaryFolder);
    dbHelper.onSetUp();
    configHelper.onSetUp();
    configHelper.usingCruiseConfigDao(goConfigDao).initializeConfigFile();
    repository = new SvnCommand(null, svnRepository.projectRepositoryUrl());
    PipelineConfig 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.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();
    result = new HttpOperationResult();
    scheduleOptions = new ScheduleOptions();
    u = new ScheduleTestUtil(transactionTemplate, materialRepository, dbHelper, configHelper);
    materialForManualTriggerPipeline = u.wf(new SvnMaterial("svn", "username", "password", false), "folder1");
    u.checkinInOrder(materialForManualTriggerPipeline, u.d(1), "s1");
    manualTriggerPipeline = configHelper.addPipeline(UUID.randomUUID().toString(), STAGE_NAME, materialForManualTriggerPipeline.config(), "build");
    username = Username.ANONYMOUS;
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) HttpOperationResult(com.thoughtworks.go.server.service.result.HttpOperationResult) PipelineConfig(com.thoughtworks.go.config.PipelineConfig) MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) TransactionStatus(org.springframework.transaction.TransactionStatus) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause) SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) ScheduleOptions(com.thoughtworks.go.server.scheduling.ScheduleOptions) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) Filter(com.thoughtworks.go.config.materials.Filter) IgnoredFiles(com.thoughtworks.go.config.materials.IgnoredFiles) SvnCommand(com.thoughtworks.go.domain.materials.svn.SvnCommand) TransactionCallbackWithoutResult(org.springframework.transaction.support.TransactionCallbackWithoutResult) Before(org.junit.Before)

Example 5 with IgnoredFiles

use of com.thoughtworks.go.config.materials.IgnoredFiles in project gocd by gocd.

the class FilterTest method shouldAddErrorToItsErrorCollection.

@Test
public void shouldAddErrorToItsErrorCollection() {
    IgnoredFiles ignore = new IgnoredFiles("helper/*.*");
    Filter filter = new Filter(ignore);
    filter.addError("key", "some error");
    assertThat(filter.errors().on("key"), is("some error"));
}
Also used : Filter(com.thoughtworks.go.config.materials.Filter) IgnoredFiles(com.thoughtworks.go.config.materials.IgnoredFiles) Test(org.junit.Test)

Aggregations

Filter (com.thoughtworks.go.config.materials.Filter)33 IgnoredFiles (com.thoughtworks.go.config.materials.IgnoredFiles)33 Test (org.junit.jupiter.api.Test)19 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)8 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)7 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)6 DependencyMaterialRevision (com.thoughtworks.go.domain.materials.dependency.DependencyMaterialRevision)6 HashMap (java.util.HashMap)6 Test (org.junit.Test)6 PluggableSCMMaterialConfig (com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig)5 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)5 P4MaterialConfig (com.thoughtworks.go.config.materials.perforce.P4MaterialConfig)5 SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)5 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)5 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)5 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)4 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)4 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)4 TfsMaterialConfig (com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig)4 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)4