Tabnine Logo
MaterialConfigs.get
Code IndexAdd Tabnine to your IDE (free)

How to use
get
method
in
com.thoughtworks.go.config.materials.MaterialConfigs

Best Java code snippets using com.thoughtworks.go.config.materials.MaterialConfigs.get (Showing top 20 results out of 315)

origin: gocd/gocd

public Validatable updatedNode(CruiseConfig cruiseConfig) {
  if (packageMaterialConfig.getPackageDefinition() != null) {
    return cruiseConfig.pipelineConfigByName(new CaseInsensitiveString(pipeline)).materialConfigs().get(packageMaterialConfig);
  }
  return packageMaterialConfig;
}
origin: gocd/gocd

  @Override
  protected void updateConfig(CruiseConfig cruiseConfig) {
    PackageDefinition packageDefinition = createNewPackageDefinition(cruiseConfig);
    packageMaterialConfig = (PackageMaterialConfig) cruiseConfig.pipelineConfigByName(new CaseInsensitiveString(pipeline)).materialConfigs().get(packageMaterialConfig);
    packageMaterialConfig.setPackageDefinition(packageDefinition);
  }
}
origin: gocd/gocd

  @Override
  protected void updateConfig(CruiseConfig cruiseConfig) {
    PackageDefinition packageDefinition = getPackageDefinition(cruiseConfig);
    packageMaterialConfig = (PackageMaterialConfig) cruiseConfig.pipelineConfigByName(new CaseInsensitiveString(pipeline)).materialConfigs().get(packageMaterialConfig);
    packageMaterialConfig.setPackageDefinition(packageDefinition);
  }
}
origin: gocd/gocd

@Test
public void shouldLoadMaterialNameIfPresent() throws Exception {
  CruiseConfig config = ConfigMigrator.loadWithMigration(MATERIAL_WITH_NAME).config;
  MaterialConfigs materialConfigs = config.pipelineConfigByName(new CaseInsensitiveString("pipeline")).materialConfigs();
  assertThat(materialConfigs.get(0).getName(), is(new CaseInsensitiveString("svn")));
  assertThat(materialConfigs.get(1).getName(), is(new CaseInsensitiveString("hg")));
}
origin: gocd/gocd

@Test
public void shouldNotResolveOptedOutConfigAttributes() throws NoSuchFieldException {
  PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfig("cruise-#{foo}-#{bar}", "dev", "ant");
  SvnMaterialConfig svn = (SvnMaterialConfig) pipelineConfig.materialConfigs().get(0);
  svn.setPassword("#quux-#{foo}-#{bar}");
  pipelineConfig.setLabelTemplate("2.1-${COUNT}-#{foo}-bar-#{bar}");
  new ParamResolver(new ParamSubstitutionHandlerFactory(params(param("foo", "pavan"), param("bar", "jj"))), fieldCache).resolve(pipelineConfig);
  assertThat(pipelineConfig.getLabelTemplate(), is("2.1-${COUNT}-pavan-bar-jj"));
  assertThat(pipelineConfig.name(), is(new CaseInsensitiveString("cruise-#{foo}-#{bar}")));
  assertThat(((SvnMaterialConfig) pipelineConfig.materialConfigs().get(0)).getPassword(), is("#quux-#{foo}-#{bar}"));
  assertThat(pipelineConfig.getClass().getDeclaredField("name").getAnnotation(SkipParameterResolution.class), isA(SkipParameterResolution.class));
}
origin: gocd/gocd

@Test
public void shouldNotIncludePluggableSCMMaterialsWithAutoUpdateFalse() {
  PipelineConfig pipeline1 = pipelineWithManyMaterials(false);
  PluggableSCMMaterialConfig autoUpdateMaterialConfig = new PluggableSCMMaterialConfig(null, SCMMother.create("scm-id-1"), null, null);
  pipeline1.addMaterialConfig(autoUpdateMaterialConfig);
  PluggableSCMMaterialConfig nonAutoUpdateMaterialConfig = new PluggableSCMMaterialConfig(null, SCMMother.create("scm-id-2"), null, null);
  nonAutoUpdateMaterialConfig.getSCMConfig().setAutoUpdate(false);
  pipeline1.addMaterialConfig(nonAutoUpdateMaterialConfig);
  pipeline1.add(new StageConfig(new CaseInsensitiveString("manual-stage"), new JobConfigs(), new Approval()));
  CruiseConfig config = new BasicCruiseConfig(new BasicPipelineConfigs(pipeline1));
  Set<MaterialConfig> materialsBelongingToAutoPipelines = config.getAllUniqueMaterialsBelongingToAutoPipelines();
  assertThat(materialsBelongingToAutoPipelines.size(), is(4));
  assertThat(materialsBelongingToAutoPipelines, containsInAnyOrder(pipeline1.materialConfigs().get(1), pipeline1.materialConfigs().get(2), pipeline1.materialConfigs().get(3), pipeline1.materialConfigs().get(4)));
}
origin: gocd/gocd

@Test
public void shouldNotFailIfAllScmMaterialsInAPipelineHaveDifferentFolders() {
  HgMaterialConfig materialOne = new HgMaterialConfig("http://url1", null);
  materialOne.setConfigAttributes(Collections.singletonMap(ScmMaterialConfig.FOLDER, "folder1"));
  HgMaterialConfig materialTwo = new HgMaterialConfig("http://url2", null);
  materialTwo.setConfigAttributes(Collections.singletonMap(ScmMaterialConfig.FOLDER, "folder2"));
  CruiseConfig config = GoConfigMother.configWithPipelines("one");
  PipelineConfig pipelineOne = config.pipelineConfigByName(new CaseInsensitiveString("one"));
  pipelineOne.setMaterialConfigs(new MaterialConfigs(materialOne, materialTwo));
  pipelineOne.materialConfigs().validate(ConfigSaveValidationContext.forChain(config));
  assertThat(pipelineOne.materialConfigs().get(0).errors().isEmpty(), is(true));
  assertThat(pipelineOne.materialConfigs().get(1).errors().isEmpty(), is(true));
}
origin: gocd/gocd

@Test
public void shouldGetAllMaterialsByFingerPrint() throws Exception {
  CruiseConfig cruiseConfig = new GoConfigMother().cruiseConfigWithPipelineUsingTwoMaterials();
  MaterialConfig expectedMaterial = MaterialConfigsMother.multipleMaterialConfigs().get(1);
  PipelineConfigSaveValidationContext context = PipelineConfigSaveValidationContext.forChain(true, "group", cruiseConfig);
  MaterialConfigs allMaterialsByFingerPrint = context.getAllMaterialsByFingerPrint(expectedMaterial.getFingerprint());
  assertThat(allMaterialsByFingerPrint.size(), is(1));
  assertThat(allMaterialsByFingerPrint.first(), is(expectedMaterial));
}
@Test
origin: gocd/gocd

@Test
public void shouldNotFailIfMultipleMaterialsHaveUniqueDestinationFolderSet() {
  HgMaterialConfig materialOne = new HgMaterialConfig("http://url1", null);
  materialOne.setConfigAttributes(Collections.singletonMap(ScmMaterialConfig.FOLDER, "folder"));
  HgMaterialConfig materialTwo = new HgMaterialConfig("http://url2", null);
  materialTwo.setConfigAttributes(Collections.singletonMap(ScmMaterialConfig.FOLDER, "folder2"));
  CruiseConfig config = GoConfigMother.configWithPipelines("one");
  PipelineConfig pipelineOne = config.pipelineConfigByName(new CaseInsensitiveString("one"));
  pipelineOne.setMaterialConfigs(new MaterialConfigs(materialOne, materialTwo));
  pipelineOne.materialConfigs().validate(ConfigSaveValidationContext.forChain(config));
  assertThat(pipelineOne.materialConfigs().get(0).errors().isEmpty(), is(true));
  assertThat(pipelineOne.materialConfigs().get(1).errors().isEmpty(), is(true));
}
origin: gocd/gocd

@Test
public void shouldFailIfMultipleMaterialsDoNotHaveDestinationFolderSet() {
  HgMaterialConfig materialConfigOne = new HgMaterialConfig("http://url1", null);
  materialConfigOne.setConfigAttributes(Collections.singletonMap(ScmMaterialConfig.FOLDER, "folder"));
  HgMaterialConfig materialConfigTwo = new HgMaterialConfig("http://url2", null);
  PluggableSCMMaterialConfig materialConfigThree = new PluggableSCMMaterialConfig(null, SCMMother.create("scm-id"), null, null);
  CruiseConfig config = GoConfigMother.configWithPipelines("one");
  PipelineConfig pipelineOne = config.pipelineConfigByName(new CaseInsensitiveString("one"));
  pipelineOne.setMaterialConfigs((new MaterialConfigs(materialConfigOne, materialConfigTwo, materialConfigThree)));
  pipelineOne.materialConfigs().validate(ConfigSaveValidationContext.forChain(config));
  assertThat(pipelineOne.materialConfigs().get(0).errors().isEmpty(), is(true));
  assertThat(pipelineOne.materialConfigs().get(1).errors().on(ScmMaterialConfig.FOLDER), is("Destination directory is required when specifying multiple scm materials"));
  assertThat(pipelineOne.materialConfigs().get(2).errors().on(PluggableSCMMaterialConfig.FOLDER), is("Destination directory is required when specifying multiple scm materials"));
}
origin: gocd/gocd

@Test
public void shouldBeAbleToSaveADependencyMaterialToConfig() throws Exception {
  DependencyMaterialConfig originalMaterial = new DependencyMaterialConfig(new CaseInsensitiveString("pipeline-name"), new CaseInsensitiveString("stage-name"));
  NewGoConfigMother mother = new NewGoConfigMother();
  mother.addPipeline("pipeline-name", "stage-name", "job-name");
  mother.addPipeline("dependent", "stage-name", "job-name").addMaterialConfig(originalMaterial);
  ByteArrayOutputStream buffer = new ByteArrayOutputStream();
  writer.write(mother.cruiseConfig(), buffer, false);
  final ByteArrayInputStream inputStream = new ByteArrayInputStream(buffer.toByteArray());
  CruiseConfig config = loader.loadConfigHolder(IOUtils.toString(inputStream, UTF_8)).config;
  DependencyMaterialConfig material = (DependencyMaterialConfig) config.pipelineConfigByName(new CaseInsensitiveString("dependent")).materialConfigs().get(1);
  assertThat(material, is(originalMaterial));
  assertThat(material.getPipelineName(), is(new CaseInsensitiveString("pipeline-name")));
  assertThat(material.getStageName(), is(new CaseInsensitiveString("stage-name")));
}
origin: gocd/gocd

@Test
public void shouldGetUniqueMaterialsWithConfigRepos() {
  BasicCruiseConfig mainCruiseConfig = new BasicCruiseConfig(pipelines);
  ConfigReposConfig reposConfig = new ConfigReposConfig();
  GitMaterialConfig configRepo = new GitMaterialConfig("http://git");
  reposConfig.add(new ConfigRepoConfig(configRepo, "myplug"));
  mainCruiseConfig.setConfigRepos(reposConfig);
  PartialConfig partialConfig = PartialConfigMother.withPipeline("pipe2");
  MaterialConfig pipeRepo = partialConfig.getGroups().get(0).get(0).materialConfigs().get(0);
  cruiseConfig = new BasicCruiseConfig(mainCruiseConfig, partialConfig);
  Set<MaterialConfig> materials = cruiseConfig.getAllUniqueMaterialsBelongingToAutoPipelinesAndConfigRepos();
  assertThat(materials, hasItem(configRepo));
  assertThat(materials, hasItem(pipeRepo));
  assertThat(materials.size(), is(2));
}
origin: gocd/gocd

@Test
public void shouldGetUniqueMaterialsWithoutConfigRepos() {
  BasicCruiseConfig mainCruiseConfig = new BasicCruiseConfig(pipelines);
  ConfigReposConfig reposConfig = new ConfigReposConfig();
  GitMaterialConfig configRepo = new GitMaterialConfig("http://git");
  reposConfig.add(new ConfigRepoConfig(configRepo, "myplug"));
  mainCruiseConfig.setConfigRepos(reposConfig);
  PartialConfig partialConfig = PartialConfigMother.withPipeline("pipe2");
  MaterialConfig pipeRepo = partialConfig.getGroups().get(0).get(0).materialConfigs().get(0);
  cruiseConfig = new BasicCruiseConfig(mainCruiseConfig, partialConfig);
  Set<MaterialConfig> materials = cruiseConfig.getAllUniqueMaterialsBelongingToAutoPipelines();
  assertThat(materials, hasItem(pipeRepo));
  assertThat(materials.size(), is(1));
}
origin: gocd/gocd

@Test
public void shouldResolveInheritedAttributes() throws NoSuchFieldException {
  PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfig("cruise", "dev", "ant");
  HgMaterialConfig materialConfig = MaterialConfigsMother.hgMaterialConfig();
  materialConfig.setConfigAttributes(Collections.singletonMap(ScmMaterialConfig.FOLDER, "work/#{foo}/#{bar}/baz"));
  pipelineConfig.addMaterialConfig(materialConfig);
  new ParamResolver(new ParamSubstitutionHandlerFactory(params(param("foo", "pavan"), param("bar", "jj"))), fieldCache).resolve(pipelineConfig);
  assertThat(pipelineConfig.materialConfigs().get(1).getFolder(), is("work/pavan/jj/baz"));
}
origin: gocd/gocd

@Test
public void shouldResolveCollections() throws NoSuchFieldException {
  PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfig("cruise", "dev", "ant");
  pipelineConfig.setLabelTemplate("2.1-${COUNT}-#{foo}-bar-#{bar}");
  HgMaterialConfig materialConfig = MaterialConfigsMother.hgMaterialConfig("http://#{foo}.com/#{bar}");
  pipelineConfig.addMaterialConfig(materialConfig);
  new ParamResolver(new ParamSubstitutionHandlerFactory(params(param("foo", "pavan"), param("bar", "jj"))), fieldCache).resolve(pipelineConfig);
  assertThat(pipelineConfig.getLabelTemplate(), is("2.1-${COUNT}-pavan-bar-jj"));
  assertThat(pipelineConfig.materialConfigs().get(1).getUriForDisplay(), is("http://pavan.com/jj"));
}
origin: gocd/gocd

@Test
public void shouldResolveInBasicPipelineConfigs() throws NoSuchFieldException {
  PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfig("cruise", "dev", "ant");
  pipelineConfig.setLabelTemplate("2.1-${COUNT}-#{foo}-bar-#{bar}");
  HgMaterialConfig materialConfig = MaterialConfigsMother.hgMaterialConfig("http://#{foo}.com/#{bar}");
  pipelineConfig.addMaterialConfig(materialConfig);
  BasicPipelineConfigs pipelines = new BasicPipelineConfigs(pipelineConfig);
  new ParamResolver(new ParamSubstitutionHandlerFactory(params(param("foo", "pavan"), param("bar", "jj"))), fieldCache).resolve(pipelines);
  assertThat(pipelineConfig.getLabelTemplate(), is("2.1-${COUNT}-pavan-bar-jj"));
  assertThat(pipelineConfig.materialConfigs().get(1).getUriForDisplay(), is("http://pavan.com/jj"));
}
origin: gocd/gocd

@Test
public void shouldNotThrowUpOnMaterialIfAutoUpdateValuesAreCorrect() throws Exception {
  HgMaterialConfig materialOne = new HgMaterialConfig("http://url1", null);
  materialOne.setAutoUpdate(true);
  HgMaterialConfig materialTwo = new HgMaterialConfig("http://url1", null);
  materialTwo.setAutoUpdate(true);
  CruiseConfig config = GoConfigMother.configWithPipelines("one", "two", "three");
  PipelineConfig pipelineOne = config.pipelineConfigByName(new CaseInsensitiveString("one"));
  pipelineOne.setMaterialConfigs(new MaterialConfigs(materialOne));
  PipelineConfig pipelineTwo = config.pipelineConfigByName(new CaseInsensitiveString("two"));
  pipelineTwo.setMaterialConfigs(new MaterialConfigs(materialTwo));
  pipelineOne.materialConfigs().validate(ConfigSaveValidationContext.forChain(config));
  assertThat(pipelineOne.materialConfigs().get(0).errors().isEmpty(), is(true));
  assertThat(pipelineTwo.materialConfigs().get(0).errors().isEmpty(), is(true));
}
origin: gocd/gocd

@Test
public void shouldAddErrorWhenMatchingPackageIDDoesNotExist(){
  PackageMaterialConfig packageMaterialConfig = new PackageMaterialConfig(new CaseInsensitiveString("package-name"), "package-id", PackageDefinitionMother.create("package-id"));
  CruiseConfig config = GoConfigMother.configWithPipelines("one");
  PipelineConfig pipelineConfig = config.pipelineConfigByName(new CaseInsensitiveString("one"));
  MaterialConfigs materialConfigs = new MaterialConfigs(packageMaterialConfig);
  pipelineConfig.setMaterialConfigs(materialConfigs);
  materialConfigs.validateTree(PipelineConfigSaveValidationContext.forChain(true, "group", config));
  assertThat(pipelineConfig.materialConfigs().get(0).errors().on(packageMaterialConfig.PACKAGE_ID), is("Could not find repository for given package id:[package-id]"));
}
origin: gocd/gocd

@Test
public void shouldResolveInMergePipelineConfigs() throws NoSuchFieldException {
  PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfig("cruise", "dev", "ant");
  pipelineConfig.setLabelTemplate("2.1-${COUNT}-#{foo}-bar-#{bar}");
  HgMaterialConfig materialConfig = MaterialConfigsMother.hgMaterialConfig("http://#{foo}.com/#{bar}");
  pipelineConfig.addMaterialConfig(materialConfig);
  MergePipelineConfigs merge = new MergePipelineConfigs(new BasicPipelineConfigs(),new BasicPipelineConfigs(pipelineConfig));
  new ParamResolver(new ParamSubstitutionHandlerFactory(params(param("foo", "pavan"), param("bar", "jj"))), fieldCache).resolve(merge);
  assertThat(pipelineConfig.getLabelTemplate(), is("2.1-${COUNT}-pavan-bar-jj"));
  assertThat(pipelineConfig.materialConfigs().get(1).getUriForDisplay(), is("http://pavan.com/jj"));
}
origin: gocd/gocd

@Test
public void shouldAddErrorWhenMatchingScmConfigDoesNotExist(){
  PluggableSCMMaterialConfig scmMaterialConfig = new PluggableSCMMaterialConfig(null, SCMMother.create("scm-id"), null, null);
  PackageMaterialConfig packageMaterialConfig = new PackageMaterialConfig(new CaseInsensitiveString("package-name"), "package-id", PackageDefinitionMother.create("package-id"));
  CruiseConfig config = GoConfigMother.configWithPipelines("one");
  PipelineConfig pipelineConfig = config.pipelineConfigByName(new CaseInsensitiveString("one"));
  MaterialConfigs materialConfigs = new MaterialConfigs(scmMaterialConfig,packageMaterialConfig);
  pipelineConfig.setMaterialConfigs(materialConfigs);
  materialConfigs.validateTree(PipelineConfigSaveValidationContext.forChain(true, "group", config));
  assertThat(pipelineConfig.materialConfigs().get(0).errors().on(scmMaterialConfig.SCM_ID), is("Could not find SCM for given scm-id: [scm-id]."));
}
com.thoughtworks.go.config.materialsMaterialConfigsget

Popular methods of MaterialConfigs

  • <init>
  • add
  • clear
  • first
  • errors
  • findDependencyMaterial
  • forEach
  • size
  • validate
  • getExistingOrDefaultMaterial
  • hasDependencyMaterial
  • hasMaterialWithFingerprint
  • hasDependencyMaterial,
  • hasMaterialWithFingerprint,
  • isEmpty,
  • setConfigAttributes,
  • validateTree,
  • addAll,
  • addError,
  • addMaterialConfig,
  • displayNameFor

Popular in Java

  • Creating JSON documents from java classes using gson
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getContentResolver (Context)
  • setContentView (Activity)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now