Package org.apache.commons.configuration

Examples of org.apache.commons.configuration.PropertiesConfiguration$DefaultIOFactory


    sitePp.add("$extlookup_datadir='/etc/puppet/manifests/extdata'");
    sitePp.add("$extlookup_precedence = ['common']");
    sitePp.add("node default {");
    for (String role : roles) {
      String manifestAttribPrefix = role.replaceAll(":+", ".");
      Configuration manifestProps = new PropertiesConfiguration();
      for (@SuppressWarnings("unchecked")
      Iterator<String> it = config.getKeys(manifestAttribPrefix); it.hasNext();) {
        String key = it.next();
        manifestProps.setProperty(key, config.getProperty(key));
      }
      Manifest roleManifest = getManifestForClusterSpecAndRole(role, manifestProps);
      if (isHiera) {
        sitePp.add("include " + roleManifest.getName());
        confHiera.add(roleManifest.getHiera());
View Full Code Here


public class CreateSitePpAndApplyRolesTest {

  @Test
  public void testWithAttribs() throws IOException {
    Configuration conf = new PropertiesConfiguration();
    conf.setProperty("puppet.nginx.module", "git://github.com/puppetlabs/puppetlabs-nginx.git");
    conf.setProperty("nginx.server.hostname", "foohost");

    CreateSitePpAndApplyRoles nginx = new CreateSitePpAndApplyRoles(ImmutableSet.of("nginx::server"),
                                                                    ImmutableSet.of(new Cluster.Instance(
                                                                                          new Credentials("dummy", "dummy"),
                                                                                          Sets.newHashSet("puppet:nginx::server"),
View Full Code Here

  }

  @Test
  public void testDefaultsCanBeOverridden()
    throws ConfigurationException, JSchException, IOException {
    Configuration conf = new PropertiesConfiguration();
    conf.setProperty(ClusterSpec.Property.RUN_URL_BASE.getConfigName(),
      "http://example.org");
    ClusterSpec spec = ClusterSpec.withNoDefaults(conf);
    assertThat(spec.getRunUrlBase(), is("http://example.org"));
  }
View Full Code Here

    assertThat(spec.getRunUrlBase(), is("http://example.org"));
  }
 
  @Test
  public void testAwsEc2SpotPrice() throws ConfigurationException {
    assertEquals(ClusterSpec.withNoDefaults(new PropertiesConfiguration()).getAwsEc2SpotPrice(), null);
    Configuration conf = new PropertiesConfiguration();
    conf.setProperty(ClusterSpec.Property.AWS_EC2_SPOT_PRICE.getConfigName(), "0.30");
    ClusterSpec spec = ClusterSpec.withNoDefaults(conf);
    assertEquals(spec.getAwsEc2SpotPrice(), new Float(0.3));
  }
View Full Code Here

  /**
   * @see ConfigToTemplateBuilderSpecTest for more
   */
  @Test
  public void testTemplateOverrides() throws ConfigurationException {
    Configuration conf = new PropertiesConfiguration();
    conf.setProperty(ClusterSpec.Property.TEMPLATE.getConfigName(), "osFamily=UBUNTU,os64Bit=true,minRam=2048");
    ClusterSpec spec = ClusterSpec.withNoDefaults(conf);
    assertEquals(spec.getTemplate(), TemplateBuilderSpec.parse("osFamily=UBUNTU,os64Bit=true,minRam=2048"));
  }
View Full Code Here

  /**
   * @see ConfigToTemplateBuilderSpecTest for more
   */
  @Test
  public void testNoTemplateSetsUbuntu1004With1GB() throws ConfigurationException {
    Configuration conf = new PropertiesConfiguration();
    ClusterSpec spec = ClusterSpec.withNoDefaults(conf);
    assertEquals(spec.getTemplate(), TemplateBuilderSpec.parse("osFamily=UBUNTU,osVersionMatches=10.04,minRam=1024"));
  }
View Full Code Here

    assertEquals(spec.getTemplate(), TemplateBuilderSpec.parse("osFamily=UBUNTU,osVersionMatches=10.04,minRam=1024"));
  }
 
  @Test
  public void testEndpoint() throws ConfigurationException {
    Configuration conf = new PropertiesConfiguration();
    conf.setProperty(ClusterSpec.Property.ENDPOINT.getConfigName(), "http://compute");
    conf.setProperty(ClusterSpec.Property.BLOBSTORE_ENDPOINT.getConfigName(), "http://blobstore");
    ClusterSpec spec = ClusterSpec.withNoDefaults(conf);
    assertThat(spec.getEndpoint(), is("http://compute"));
    assertThat(spec.getBlobStoreEndpoint(), is("http://blobstore"));
  }
View Full Code Here

  }

  @Test
  public void testGetConfigurationForKeysWithPrefix()
    throws ConfigurationException, JSchException, IOException {
    Configuration conf = new PropertiesConfiguration();
    conf.setProperty("a.b", 1);
    conf.setProperty("b.a", 2);
    conf.setProperty("a.c", 3);

    ClusterSpec spec = ClusterSpec.withNoDefaults(conf);
    Configuration prefixConf = spec.getConfigurationForKeysWithPrefix("a");

    List<String> prefixKeys = Lists.newArrayList();
View Full Code Here

    String undefinedEnvVar = "UNDEFINED_ENV_VAR";
    assertThat(envMap.containsKey(undefinedEnvVar), is(false));

    Entry<String, String> firstEntry = Iterables.get(envMap.entrySet(), 0);
    Configuration conf = new PropertiesConfiguration();
    conf.setProperty("a", String.format("${env:%s}", firstEntry.getKey()));
    conf.setProperty("b", String.format("${env:%s}", undefinedEnvVar));

    assertThat(conf.getString("a"), is(firstEntry.getValue()));
    assertThat(conf.getString("b"),
      is(String.format("${env:%s}", undefinedEnvVar)));
  }
View Full Code Here

  @Test
  public void testDefaultPublicKey()
    throws ConfigurationException, JSchException, IOException {
    Map<String, File> keys = KeyPair.generateTemporaryFiles();

    Configuration conf = new PropertiesConfiguration();
    conf.setProperty("whirr.private-key-file", keys.get("private").getAbsolutePath());
    // If no public-key-file is specified it should append .pub to the private-key-file

    ClusterSpec spec = ClusterSpec.withNoDefaults(conf);
    Assert.assertEquals(IOUtils.toString(
      new FileReader(keys.get("public"))), spec.getPublicKey());
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration.PropertiesConfiguration$DefaultIOFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.