Package org.apache.commons.configuration

Examples of org.apache.commons.configuration.PropertiesConfiguration


  }

  @Test(expected = ConfigurationException.class)
  public void testInstanceTemplateNotFoundForHardwareId() throws Exception {
    PropertiesConfiguration conf = new PropertiesConfiguration("whirr-core-test.properties");
    conf.setProperty("whirr.instance-templates", "1 role1+role2");
    conf.setProperty("whirr.templates.role1.hardware-id", "m1.large");

    ClusterSpec.withTemporaryKeys(conf);
  }
View Full Code Here


    ClusterSpec.withTemporaryKeys(conf);
  }

  @Test(expected = IllegalArgumentException.class)
  public void testFailIfRunningAsRootOrClusterUserIsRoot() throws ConfigurationException {
    PropertiesConfiguration conf = new PropertiesConfiguration("whirr-core-test.properties");
    conf.setProperty("whirr.cluster-user", "root");

    ClusterSpec.withNoDefaults(conf);
  }
View Full Code Here

   * Create an instance that uses a temporary RSA key pair.
   */
  @VisibleForTesting
  public static ClusterSpec withTemporaryKeys()
  throws ConfigurationException, JSchException, IOException {
    return withTemporaryKeys(new PropertiesConfiguration());
  }
View Full Code Here

  /**
   * Create new empty instance for testing.
   */
  @VisibleForTesting
  public static ClusterSpec withNoDefaults() throws ConfigurationException {
    return withNoDefaults(new PropertiesConfiguration());
  }
View Full Code Here

  private Configuration config;

  private Map<String,Node> byonNodes;
 
  public ClusterSpec() throws ConfigurationException {
    this(new PropertiesConfiguration());
  }
View Full Code Here

 
  private Configuration composeWithDefaults(Configuration userConfig)
      throws ConfigurationException {
    CompositeConfiguration composed = new CompositeConfiguration();
    composed.addConfiguration(userConfig);
    composed.addConfiguration(new PropertiesConfiguration(
        getClass().getClassLoader().getResource(DEFAULT_PROPERTIES)));
    return composed;
  }
View Full Code Here

  public Configuration getConfiguration() {
    return config;
  }
 
  public Configuration getConfigurationForKeysWithPrefix(String prefix) {
    Configuration c = new PropertiesConfiguration();
    for (@SuppressWarnings("unchecked")
        Iterator<String> it = config.getKeys(prefix); it.hasNext(); ) {
      String key = it.next();
      c.setProperty(key, config.getProperty(key));
    }
    return c;
  }
View Full Code Here

    }
    return c;
  }
 
  public Configuration getConfigurationForKeysMatching(Pattern pattern) {
    Configuration c = new PropertiesConfiguration();
    for (@SuppressWarnings("unchecked")
        Iterator<String> it = config.getKeys(); it.hasNext(); ) {
      String key = it.next();
      if (pattern.matcher(key).matches()) {
        c.setProperty(key, config.getProperty(key));
      }
    }
    return c;
  }
View Full Code Here

  private ComputeServiceContext context;
  private FirewallManager manager;

  private ClusterSpec getTestClusterSpec() throws Exception {
    return ClusterSpec.withTemporaryKeys(
      new PropertiesConfiguration("whirr-core-test.properties"));
  }
View Full Code Here

        config = new CompositeConfiguration();
        if (System.getProperty("whirr.config") != null)
        {
            config.addConfiguration(
                new PropertiesConfiguration(System.getProperty("whirr.config")));
        }
        config.addConfiguration(new PropertiesConfiguration("whirr-default.properties"));

        clusterSpec = new ClusterSpec(config);
        if (clusterSpec.getPrivateKey() == null)
        {
            Map<String, String> pair = KeyPair.generate();
View Full Code Here

TOP

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

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.