Package org.apache.whirr

Examples of org.apache.whirr.ClusterController


    config.addConfiguration(new PropertiesConfiguration("whirr-elasticsearch-test.properties"));
    if (System.getProperty("config") != null) {
      config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
    }
    clusterSpec = ClusterSpec.withTemporaryKeys(config);
    controller = new ClusterController();
    cluster = controller.launchCluster(clusterSpec);
  }
View Full Code Here


      return -1;
    }
    try {
      ClusterSpec clusterSpec = getClusterSpec(optionSet);

      ClusterController controller = createClusterController(clusterSpec.getServiceName());
      controller.destroyCluster(clusterSpec);
      return 0;
    } catch (IllegalArgumentException e) {
      err.println(e.getMessage());
      printUsage(parser, err);
      return -1;
View Full Code Here

  @Test
  public void testAllOptions() throws Exception {

    ClusterControllerFactory factory = mock(ClusterControllerFactory.class);
    ClusterController controller = mock(ClusterController.class);
    when(factory.create((String) any())).thenReturn(controller);

    NodeMetadata node1 = new NodeMetadataBuilder().name("name1").ids("id1")
        .location(new LocationBuilder().scope(LocationScope.PROVIDER)
          .id("location-id1").description("location-desc1").build())
        .imageId("image-id").state(NodeState.RUNNING)
        .publicAddresses(Lists.newArrayList("127.0.0.1"))
        .privateAddresses(Lists.newArrayList("127.0.0.1")).build();

    NodeMetadata node2 = new NodeMetadataBuilder().name("name2").ids("id2")
        .location(new LocationBuilder().scope(LocationScope.PROVIDER)
          .id("location-id2").description("location-desc2").build())
        .imageId("image-id").state(NodeState.RUNNING)
        .publicAddresses(Lists.newArrayList("127.0.0.2"))
        .privateAddresses(Lists.newArrayList("127.0.0.2")).build();

    when(controller.getNodes((ClusterSpec) any())).thenReturn(
        (Set) Sets.newLinkedHashSet(Lists.newArrayList(node1, node2)));
    when(controller.getInstances((ClusterSpec)any(), (ClusterStateStore)any()))
        .thenCallRealMethod();

    ClusterStateStore memStore = new MemoryClusterStateStore();
    memStore.save(createTestCluster(
      new String[]{"id1", "id2"}, new String[]{"role1", "role2"}));
View Full Code Here

  }

  @Test
  public void testRunScriptByInstanceId() throws Exception {
    ClusterControllerFactory factory = mock(ClusterControllerFactory.class);
    ClusterController controller = mock(ClusterController.class);

    when(factory.create((String)any())).thenReturn(controller);

    RunScriptCommand command = new RunScriptCommand(factory);
    Map<String, File> keys = KeyPair.generateTemporaryFiles();
View Full Code Here

  }

  @Test
  public void testRunScriptByRole() throws Exception {
    ClusterControllerFactory factory = mock(ClusterControllerFactory.class);
    ClusterController controller = mock(ClusterController.class);
    when(factory.create((String)any())).thenReturn(controller);

    ClusterStateStore memStore = new MemoryClusterStateStore();
    memStore.save(createTestCluster(
      new String[]{"reg/A", "reg/B"}, new String[]{"A", "B"}));
View Full Code Here

      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);

    // give it a sec to boot up the cluster
    waitForCassandra();
  }
View Full Code Here

    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);
    proxy.start();
View Full Code Here

    if (System.getProperty("config") != null) {
      config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
    }
    config.addConfiguration(new PropertiesConfiguration("whirr-hadoop-test.properties"));
    clusterSpec = ClusterSpec.withTemporaryKeys(config);
    controller = new ClusterController();
   
    cluster = controller.launchCluster(clusterSpec);
    proxy = new HadoopProxy(clusterSpec, cluster);
    proxy.start();
   
View Full Code Here

      return -2;
    }

    try {
      ClusterSpec spec = getClusterSpec(optionSet);
      ClusterController controller = createClusterController(spec.getServiceName());

      Predicate<NodeMetadata> condition = buildFilterPredicate(optionSet, spec);

      return handleScriptOutput(out, err, controller.runScriptOnNodesMatching(
        spec, condition, execFile(optionSet.valueOf(scriptOption))));

    } catch(IllegalArgumentException e) {
      err.println(e.getMessage());
      printUsage(parser, err);
View Full Code Here

      return -1;
    }
    try {
      ClusterSpec clusterSpec = getClusterSpec(optionSet);
      ClusterStateStore stateStore = createClusterStateStore(clusterSpec);
      ClusterController controller = createClusterController(clusterSpec.getServiceName());

      for (Cluster.Instance instance : controller.getInstances(clusterSpec, stateStore)) {
        out.println(Joiner.on('\t').join(
            instance.getId(),
            instance.getNodeMetadata().getImageId(),
            instance.getPublicIp(),
            instance.getPrivateIp(),
View Full Code Here

TOP

Related Classes of org.apache.whirr.ClusterController

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.