Search in sources :

Example 6 with ClusterController

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

the class BaseServiceDryRunTest method launchWithClusterSpec.

protected DryRun launchWithClusterSpec(ClusterSpec clusterSpec) throws IOException, InterruptedException {
    ClusterController controller = new ClusterController();
    DryRun dryRun = controller.getCompute().apply(clusterSpec).utils().injector().getInstance(DryRun.class);
    dryRun.reset();
    controller.launchCluster(clusterSpec);
    return dryRun;
}
Also used : ClusterController(org.apache.whirr.ClusterController) DryRun(org.apache.whirr.service.DryRunModule.DryRun)

Example 7 with ClusterController

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

the class DruidServiceTest method setUp.

@Before
public void setUp() throws Exception {
    CompositeConfiguration config = new CompositeConfiguration();
    config.addConfiguration(new PropertiesConfiguration("whirr-druid-test.properties"));
    if (System.getProperty("config") != null) {
        config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
    }
    clusterSpec = ClusterSpec.withTemporaryKeys(config);
    controller = new ClusterController();
    // controller = new ClusterControllerFactory().create(clusterSpec.getServiceName());
    cluster = controller.launchCluster(clusterSpec);
}
Also used : ClusterController(org.apache.whirr.ClusterController) CompositeConfiguration(org.apache.commons.configuration.CompositeConfiguration) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) Before(org.junit.Before)

Example 8 with ClusterController

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

the class ChefServiceTest method setUp.

// private static Cluster cluster;
@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-chef-test.properties"));
    clusterSpec = ClusterSpec.withTemporaryKeys(config);
    controller = new ClusterController();
    controller.launchCluster(clusterSpec);
}
Also used : ClusterController(org.apache.whirr.ClusterController) CompositeConfiguration(org.apache.commons.configuration.CompositeConfiguration) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) BeforeClass(org.junit.BeforeClass)

Example 9 with ClusterController

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

the class HamaServiceController method startup.

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(HamaServiceController.class.getResource("/whirr-hama-test.properties")));
    clusterSpec = ClusterSpec.withTemporaryKeys(config);
    controller = new ClusterController();
    cluster = controller.launchCluster(clusterSpec);
    proxy = new HadoopProxy(clusterSpec, cluster);
    proxy.start();
    HamaConfiguration conf = getConfiguration();
    BSPJobClient client = new BSPJobClient(conf);
    waitForGroomServers(client);
    running = true;
}
Also used : ClusterController(org.apache.whirr.ClusterController) BSPJobClient(org.apache.hama.bsp.BSPJobClient) CompositeConfiguration(org.apache.commons.configuration.CompositeConfiguration) HadoopProxy(org.apache.whirr.service.hadoop.HadoopProxy) HamaConfiguration(org.apache.hama.HamaConfiguration) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration)

Example 10 with ClusterController

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

the class DestroyClusterCommandTest method testAllOptions.

@Test
public void testAllOptions() throws Exception {
    ClusterControllerFactory factory = mock(ClusterControllerFactory.class);
    ClusterController controller = mock(ClusterController.class);
    when(factory.create((String) any())).thenReturn(controller);
    DestroyClusterCommand command = new DestroyClusterCommand(factory);
    Map<String, File> keys = KeyPair.generateTemporaryFiles();
    int rc = command.run(null, out, null, Lists.newArrayList("--instance-templates", "1 noop", "--service-name", "test-service", "--cluster-name", "test-cluster", "--provider", "rackspace", "--identity", "myusername", "--credential", "mypassword", "--private-key-file", keys.get("private").getAbsolutePath(), "--version", "version-string"));
    assertThat(rc, is(0));
    Configuration conf = new PropertiesConfiguration();
    conf.addProperty("whirr.version", "version-string");
    conf.addProperty("whirr.instance-templates", "1 noop");
    ClusterSpec expectedClusterSpec = ClusterSpec.withTemporaryKeys(conf);
    expectedClusterSpec.setServiceName("test-service");
    expectedClusterSpec.setProvider("rackspace");
    expectedClusterSpec.setIdentity("myusername");
    expectedClusterSpec.setCredential("mypassword");
    expectedClusterSpec.setClusterName("test-cluster");
    expectedClusterSpec.setPrivateKey(keys.get("private"));
    expectedClusterSpec.setPublicKey(keys.get("public"));
    verify(factory).create("test-service");
    verify(controller).destroyCluster(expectedClusterSpec);
}
Also used : ClusterController(org.apache.whirr.ClusterController) Configuration(org.apache.commons.configuration.Configuration) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) Matchers.containsString(org.hamcrest.Matchers.containsString) ClusterSpec(org.apache.whirr.ClusterSpec) ClusterControllerFactory(org.apache.whirr.ClusterControllerFactory) File(java.io.File) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) Test(org.junit.Test)

Aggregations

ClusterController (org.apache.whirr.ClusterController)42 PropertiesConfiguration (org.apache.commons.configuration.PropertiesConfiguration)23 CompositeConfiguration (org.apache.commons.configuration.CompositeConfiguration)22 Test (org.junit.Test)12 ClusterSpec (org.apache.whirr.ClusterSpec)10 ClusterControllerFactory (org.apache.whirr.ClusterControllerFactory)9 HadoopProxy (org.apache.whirr.service.hadoop.HadoopProxy)9 Before (org.junit.Before)8 File (java.io.File)7 Matchers.containsString (org.hamcrest.Matchers.containsString)7 NodeMetadata (org.jclouds.compute.domain.NodeMetadata)7 BeforeClass (org.junit.BeforeClass)7 Cluster (org.apache.whirr.Cluster)6 DryRun (org.apache.whirr.service.DryRunModule.DryRun)5 Collection (java.util.Collection)3 Configuration (org.apache.commons.configuration.Configuration)3 Configuration (org.apache.hadoop.conf.Configuration)3 JobClient (org.apache.hadoop.mapred.JobClient)3 JobConf (org.apache.hadoop.mapred.JobConf)3 ClusterStateStore (org.apache.whirr.state.ClusterStateStore)3