Package org.apache.whirr.service

Examples of org.apache.whirr.service.Service


    if (System.getProperty("config") != null) {
      config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
    }
    config.addConfiguration(new PropertiesConfiguration("whirr-hbase-test.properties"));
    clusterSpec = ClusterSpec.withTemporaryKeys(config);
    service = new Service();

    cluster = service.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-zookeeper-test.properties"));
    clusterSpec = ClusterSpec.withTemporaryKeys(config);
    service = new Service();
   
    cluster = service.launchCluster(clusterSpec);
    hosts = ZooKeeperCluster.getHosts(cluster);
  }
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);
    service = new Service();
   
    cluster = service.launchCluster(clusterSpec);
    proxy = new HadoopProxy(clusterSpec, cluster);
    proxy.start();
  }
View Full Code Here

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

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

   * @param serviceName
   * @return
   * @throws IllegalArgumentException if serviceName is not found
   */
  protected Service createService(String serviceName) {
    Service service = factory.create(serviceName);
    if (service == null) {
      throw new IllegalArgumentException("Unable to find service "
          + serviceName + ", exiting");
    }
    return service;
View Full Code Here

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

      Service service = createService(clusterSpec.getServiceName());
      Set<? extends NodeMetadata> nodes = service.getNodes(clusterSpec);
      for (NodeMetadata node : nodes) {
        out.println(Joiner.on('\t').join(node.getId(), node.getImageId(),
            getFirstAddress(node.getPublicAddresses()),
            getFirstAddress(node.getPrivateAddresses()),
            node.getState(), node.getLocation().getId()));
View Full Code Here

      return -1;
    }
   
    try {
      ClusterSpec clusterSpec = getClusterSpec(optionSet);
      Service service = createService(clusterSpec.getServiceName());
      Cluster cluster = service.launchCluster(clusterSpec);
      out.printf("Started cluster of %s instances\n",
          cluster.getInstances().size());
      out.println(cluster);
      return 0;
    } catch (IllegalArgumentException e) {
View Full Code Here

 
  @Test
  public void testAllOptions() throws Exception {
   
    ServiceFactory factory = mock(ServiceFactory.class);
    Service service = mock(Service.class);
    when(factory.create((String) any())).thenReturn(service);
    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("100.0.0.1"))
        .privateAddresses(Lists.newArrayList("10.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("100.0.0.2"))
        .privateAddresses(Lists.newArrayList("10.0.0.2")).build();
    when(service.getNodes((ClusterSpec) any())).thenReturn(
        (Set) Sets.newLinkedHashSet(Lists.newArrayList(node1, node2)));

    ListClusterCommand command = new ListClusterCommand(factory);

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

  }

  @Test
  public void testDestroyInstanceById() throws Exception {
    ServiceFactory factory = mock(ServiceFactory.class);
    Service service = mock(Service.class);
    when(factory.create((String) any())).thenReturn(service);

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

 
  @Test
  public void testAllOptions() throws Exception {
   
    ServiceFactory factory = mock(ServiceFactory.class);
    Service service = mock(Service.class);
    Cluster cluster = mock(Cluster.class);
    when(factory.create((String) any())).thenReturn(service);
    when(service.launchCluster((ClusterSpec) any())).thenReturn(cluster);
   
    LaunchClusterCommand command = new LaunchClusterCommand(factory);
    Map<String, File> keys = KeyPair.generateTemporaryFiles();
   
    int rc = command.run(null, out, null, Lists.newArrayList(
View Full Code Here

TOP

Related Classes of org.apache.whirr.service.Service

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.