Search in sources :

Example 6 with IgnoredFiles

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

the class P4MaterialConfigTest method shouldSetConfigAttributes.

@Test
public void shouldSetConfigAttributes() {
    P4MaterialConfig p4MaterialConfig = new P4MaterialConfig("", "");
    Map<String, String> map = new HashMap<>();
    map.put(P4MaterialConfig.SERVER_AND_PORT, "serverAndPort");
    map.put(P4MaterialConfig.USERNAME, "username");
    map.put(P4MaterialConfig.PASSWORD, "password");
    map.put(P4MaterialConfig.USE_TICKETS, "true");
    map.put(P4MaterialConfig.VIEW, "some-view");
    map.put(ScmMaterialConfig.FOLDER, "folder");
    map.put(ScmMaterialConfig.AUTO_UPDATE, "false");
    map.put(ScmMaterialConfig.FILTER, "/root,/**/*.help");
    map.put(AbstractMaterialConfig.MATERIAL_NAME, "material-name");
    p4MaterialConfig.setConfigAttributes(map);
    assertThat(p4MaterialConfig.getServerAndPort(), is("serverAndPort"));
    assertThat(p4MaterialConfig.getUserName(), is("username"));
    assertThat(p4MaterialConfig.getView(), is("some-view"));
    assertThat(p4MaterialConfig.getUseTickets(), is(true));
    assertThat(p4MaterialConfig.getFolder(), is("folder"));
    assertThat(p4MaterialConfig.getName(), is(new CaseInsensitiveString("material-name")));
    assertThat(p4MaterialConfig.isAutoUpdate(), is(false));
    assertThat(p4MaterialConfig.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 7 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 8 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 9 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");
    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();
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) SvnTestRepo(com.thoughtworks.go.helper.SvnTestRepo) TransactionStatus(org.springframework.transaction.TransactionStatus) HgTestRepo(com.thoughtworks.go.helper.HgTestRepo) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause) SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) 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 10 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");
    hgMaterial = MaterialsMother.hgMaterial(hgTestRepo.projectRepositoryUrl());
    hgMaterial.setFilter(new Filter(new IgnoredFiles("helper/**/*.*")));
    workingFolder = TestFileUtil.createTempFolder("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) Before(org.junit.Before)

Aggregations

Filter (com.thoughtworks.go.config.materials.Filter)25 IgnoredFiles (com.thoughtworks.go.config.materials.IgnoredFiles)25 Test (org.junit.Test)23 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)9 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)6 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)6 DependencyMaterialRevision (com.thoughtworks.go.domain.materials.dependency.DependencyMaterialRevision)6 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 HashMap (java.util.HashMap)5 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)4 PluggableSCMMaterialConfig (com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig)4 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)4 TfsMaterialConfig (com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig)4 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)4 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)4 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)4 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)3 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)3