Package org.apache.commons.configuration

Examples of org.apache.commons.configuration.CompositeConfiguration


  private Cluster cluster;
  private RetryablePredicate<HostAndPort> socketTester;

  @Before
  public void setUp() throws Exception {
    CompositeConfiguration config = new CompositeConfiguration();
    if (System.getProperty("config") != null) {
      config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
    }
    config.addConfiguration(new PropertiesConfiguration("whirr-puppet-test.properties"));

    clusterSpec = ClusterSpec.withTemporaryKeys(config);
    controller = new ClusterController();
    cluster = controller.launchCluster(clusterSpec);
    socketTester = new RetryablePredicate<HostAndPort>(new InetSocketAddressConnect(), 60, 1, TimeUnit.SECONDS);
View Full Code Here


  public static void beforeClass() throws ConfigurationException, JSchException, IOException, InterruptedException {
    String solrConfigTarballDestination = "target/solrconfig.tar.gz";
    Tarball.createFromDirectory("src/test/resources/conf", solrConfigTarballDestination);
    LOG.info("Created Solr config tarball at "  + solrConfigTarballDestination);

    CompositeConfiguration config = new CompositeConfiguration();
    if (System.getProperty("conf") != null) {
      config.addConfiguration(new PropertiesConfiguration(System.getProperty("conf")));
    }
    config.addConfiguration(new PropertiesConfiguration("whirr-solr-test.properties"));
    clusterSpec = ClusterSpec.withTemporaryKeys(config);
    controller = new ClusterController();

    cluster = controller.launchCluster(clusterSpec);
  }
View Full Code Here

    return config.getList(key.getConfigName());
  }

  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

    assertSpotPriceIs(clusterSpec, "role1", 0.1f);
    assertSpotPriceIs(clusterSpec, "role2", 0.3f);
  }

  private ClusterSpec buildClusterSpecWith(Map<String, String> overrides) throws Exception {
    CompositeConfiguration config = new CompositeConfiguration();
    config.setProperty("whirr.image-id", "us-east-1/ami-123");
    for (String key : overrides.keySet()) {
      config.setProperty(key, overrides.get(key));
    }
    return ClusterSpec.withTemporaryKeys(config);
  }
View Full Code Here

    }
  }

  public synchronized void startup() throws Exception {
    LOG.info("Starting up cluster...");
    CompositeConfiguration config = new CompositeConfiguration();
    if (System.getProperty("config") != null) {
      config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
    }
    config.addConfiguration(new PropertiesConfiguration(this.configResource));
    clusterSpec = ClusterSpec.withTemporaryKeys(config);
    controller = new ClusterController();

    cluster = controller.launchCluster(clusterSpec);
    proxy = new HadoopProxy(clusterSpec, cluster);
View Full Code Here

  private static ClusterSpec clusterSpec;
  private static ClusterController controller;

  @BeforeClass
  public static void setUp() throws Exception {
    CompositeConfiguration config = new CompositeConfiguration();
    if (System.getProperty("config") != null) {
      config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
    }
    config.addConfiguration(new PropertiesConfiguration("whirr-mahout-test.properties"));
    clusterSpec = ClusterSpec.withTemporaryKeys(config);
    controller = new ClusterController();
    controller.launchCluster(clusterSpec);
  }
View Full Code Here

  /**
   * Build a configuration by adding the expected defaults
   */
  public static Configuration buildConfig(ClusterSpec spec, Cluster cluster) {
    CompositeConfiguration config = new CompositeConfiguration();

    config.addConfiguration(spec.getConfiguration());
    try {
      config.addConfiguration(
        new PropertiesConfiguration("whirr-elasticsearch-default.properties"));
    } catch (ConfigurationException e) {
      LOG.error("Configuration error", e); // this should never happen
    }

    if ("aws-ec2".equals(spec.getProvider()) || "ec2".equals(spec.getProvider())) {
      addDefaultsForEC2(spec, config);
    } else {
      addDefaultsForUnicast(cluster, config);
    }
    if (!config.containsKey("es.cluster.name")) {
      config.addProperty("es.cluster.name", spec.getClusterName());
    }

    return config;
  }
View Full Code Here

  private ClusterController controller;
  private Cluster cluster;

  @Before
  public void setUp() throws Exception {
    CompositeConfiguration config = new CompositeConfiguration();
    if (System.getProperty("config") != null) {
      config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
    }
    config.addConfiguration(new PropertiesConfiguration("whirr-cassandra-test.properties"));
    clusterSpec = ClusterSpec.withTemporaryKeys(config);
   
    controller = new ClusterController();
    cluster = controller.launchCluster(clusterSpec);
View Full Code Here

  }
     

  @Test
  public void testApplySubroleAliases() throws ConfigurationException {
    CompositeConfiguration c = new CompositeConfiguration();
    Configuration config = new PropertiesConfiguration();
    config.addProperty("whirr.instance-templates",
      "1 puppet:somepup::pet+something-else, 1 something-else-only");
    c.addConfiguration(config);
    InstanceTemplate template = InstanceTemplate.parse(c).get(0);
    Set<String> expected = Sets.newLinkedHashSet(Arrays.asList(new String[]{
      "puppet:somepup::pet", "something-else"}));
    assertThat(template.getRoles(), is(expected));
View Full Code Here

    }
  }
 
  public synchronized void startup() throws Exception {
    LOG.info("Starting up cluster...");
    CompositeConfiguration config = new CompositeConfiguration();
    if (System.getProperty("config") != null) {
      config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
    }
    config.addConfiguration(configuration);
    clusterSpec = ClusterSpec.withTemporaryKeys(config);
    controller = new ClusterController();
   
    cluster = controller.launchCluster(clusterSpec);
    proxy = new HadoopProxy(clusterSpec, cluster);
View Full Code Here

TOP

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

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.