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