Search in sources :

Example 96 with ClusterSpec

use of org.apache.whirr.ClusterSpec in project whirr by apache.

the class ChefServiceDryRunTest method testChefWithDefaultRecipe.

/**
 * Tests that a simple recipe (the default recipe in a cookbook without any
 * configuration parameters) is correctly loaded and executed.
 */
@Test
public void testChefWithDefaultRecipe() throws Exception {
    ClusterSpec cookbookWithDefaultRecipe = newClusterSpecForProperties(ImmutableMap.of("whirr.instance-templates", "1 chef:java"));
    DryRun dryRun = launchWithClusterSpec(cookbookWithDefaultRecipe);
    assertScriptPredicateOnPhase(dryRun, "bootstrap", bootstrapPredicate());
    // chef execution with a default cookbook recipe should contain a
    // particular string
    assertScriptPredicateOnPhase(dryRun, "configure", containsPattern("chef-solo -j /tmp/java::default"));
}
Also used : DryRun(org.apache.whirr.service.DryRunModule.DryRun) ClusterSpec(org.apache.whirr.ClusterSpec) Test(org.junit.Test) BaseServiceDryRunTest(org.apache.whirr.service.BaseServiceDryRunTest)

Example 97 with ClusterSpec

use of org.apache.whirr.ClusterSpec in project whirr by apache.

the class ChefServiceDryRunTest method testChefWithParticularRecipe.

/**
 * Tests that a simple recipe (the default recipe in a cookbook without any
 * configuration parameters) is correctly loaded and executed.
 */
@Test
public void testChefWithParticularRecipe() throws Exception {
    ClusterSpec cookbookWithAttributes = newClusterSpecForProperties(ImmutableMap.<String, String>builder().put("whirr.instance-templates", "1 chef:java").put("java.url", "http://testurl").put("java.version", "1.5").put("java.flavor", "vanilla").build());
    DryRun dryRun = launchWithClusterSpec(cookbookWithAttributes);
    assertScriptPredicateOnPhase(dryRun, "bootstrap", bootstrapPredicate());
    // chef execution with a default cookbook recipe should contain a
    // particular string
    assertScriptPredicateOnPhase(dryRun, "configure", contains(compile("{\"java\":{\"version\":\"1.5\",\"flavor\":\"vanilla\"}", LITERAL)));
}
Also used : DryRun(org.apache.whirr.service.DryRunModule.DryRun) ClusterSpec(org.apache.whirr.ClusterSpec) Test(org.junit.Test) BaseServiceDryRunTest(org.apache.whirr.service.BaseServiceDryRunTest)

Example 98 with ClusterSpec

use of org.apache.whirr.ClusterSpec in project whirr by apache.

the class HadoopDataNodeClusterActionHandler method afterConfigure.

@Override
protected void afterConfigure(ClusterActionEvent event) throws IOException, InterruptedException {
    ClusterSpec clusterSpec = event.getClusterSpec();
    Cluster cluster = event.getCluster();
    // TODO: wait for TTs to come up (done in test for the moment)
    LOG.info("Completed configuration of {} role {}", clusterSpec.getClusterName(), getRole());
// TODO: List data nodes + url to their WEB UI?
}
Also used : Cluster(org.apache.whirr.Cluster) ClusterSpec(org.apache.whirr.ClusterSpec)

Aggregations

ClusterSpec (org.apache.whirr.ClusterSpec)98 Configuration (org.apache.commons.configuration.Configuration)39 Cluster (org.apache.whirr.Cluster)35 Test (org.junit.Test)34 PropertiesConfiguration (org.apache.commons.configuration.PropertiesConfiguration)16 Instance (org.apache.whirr.Cluster.Instance)14 ClusterController (org.apache.whirr.ClusterController)10 InetAddress (java.net.InetAddress)9 DryRun (org.apache.whirr.service.DryRunModule.DryRun)9 OptionSet (joptsimple.OptionSet)8 CompositeConfiguration (org.apache.commons.configuration.CompositeConfiguration)8 ZooKeeperCluster (org.apache.whirr.service.zookeeper.ZooKeeperCluster)8 IOException (java.io.IOException)7 ComputeService (org.jclouds.compute.ComputeService)7 File (java.io.File)6 ClusterControllerFactory (org.apache.whirr.ClusterControllerFactory)6 ComputeServiceContext (org.jclouds.compute.ComputeServiceContext)6 Set (java.util.Set)5 Stack (java.util.Stack)5 Matchers.containsString (org.hamcrest.Matchers.containsString)5