Package org.apache.whirr.service

Examples of org.apache.whirr.service.ClusterSpec$InstanceTemplate


    };
   
    OptionSet optionSet = clusterSpecCommand.parser.parse(
        "--service-name", "overridden-test-service",
        "--config", "whirr-override-test.properties");
    ClusterSpec clusterSpec = clusterSpecCommand.getClusterSpec(optionSet);
    assertThat(clusterSpec.getServiceName(), is("overridden-test-service"));
    assertThat(clusterSpec.getClusterName(), is("test-cluster"));
  }
View Full Code Here


        "--public-key-file", publicKeyFile.getAbsolutePath()
        ));
   
    assertThat(rc, is(0));

    ClusterSpec expectedClusterSpec = new ClusterSpec();
    expectedClusterSpec.setServiceName("test-service");
    expectedClusterSpec.setProvider("rackspace");
    expectedClusterSpec.setIdentity("myusername");
    expectedClusterSpec.setCredential("mypassword");
    expectedClusterSpec.setClusterName("test-cluster");
    expectedClusterSpec.setPrivateKey(privateKeyFile);
    expectedClusterSpec.setPublicKey(publicKeyFile);
   
    verify(factory).create("test-service");
   
    verify(service).destroyCluster(expectedClusterSpec);
   
View Full Code Here

        "--public-key-file", publicKeyFile.getAbsolutePath()
        ));
   
    assertThat(rc, is(0));

    ClusterSpec expectedClusterSpec = new ClusterSpec();
    expectedClusterSpec.setInstanceTemplates(Lists.newArrayList(
        new ClusterSpec.InstanceTemplate(1, Sets.newHashSet("role1", "role2")),
        new ClusterSpec.InstanceTemplate(2, Sets.newHashSet("role3"))
    ));
    expectedClusterSpec.setServiceName("test-service");
    expectedClusterSpec.setProvider("rackspace");
    expectedClusterSpec.setIdentity("myusername");
    expectedClusterSpec.setCredential("mypassword");
    expectedClusterSpec.setClusterName("test-cluster");
    expectedClusterSpec.setPrivateKey(privateKeyFile);
    expectedClusterSpec.setPublicKey(publicKeyFile);
   
    verify(factory).create("test-service");
   
    verify(service).launchCluster(expectedClusterSpec);
   
View Full Code Here

    if (!optionSet.nonOptionArguments().isEmpty()) {
      printUsage(parser, err);
      return -1;
    }
    try {
      ClusterSpec clusterSpec = getClusterSpec(optionSet);

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

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

    return ROLE;
  }

  @Override
  protected void beforeBootstrap(ClusterActionEvent event) throws IOException {
    ClusterSpec clusterSpec = event.getClusterSpec();
    addRunUrl(event, "util/configure-hostnames", "-c", clusterSpec.getProvider());
    String hadoopInstallRunUrl = clusterSpec.getConfiguration().getString(
        "whirr.hadoop-install-runurl", "apache/hadoop/install");
    addRunUrl(event, "sun/java/install");
    addRunUrl(event, hadoopInstallRunUrl, "-c", clusterSpec.getProvider());
    event.setTemplateBuilderStrategy(new HadoopTemplateBuilderStrategy());
  }
View Full Code Here

  }
 
  @Override
  protected void beforeConfigure(ClusterActionEvent event)
      throws IOException, InterruptedException {
    ClusterSpec clusterSpec = event.getClusterSpec();
    Cluster cluster = event.getCluster();
   
    Instance instance = cluster.getInstanceMatching(
        role(HadoopNameNodeClusterActionHandler.ROLE));
    InetAddress namenodePublicAddress = instance.getPublicAddress();
    InetAddress jobtrackerPublicAddress = namenodePublicAddress;

    String hadoopConfigureRunUrl = clusterSpec.getConfiguration().getString(
        "whirr.hadoop-configure-runurl", "apache/hadoop/post-configure");
    addRunUrl(event, hadoopConfigureRunUrl,
        "dn,tt",
        "-n", DnsUtil.resolveAddress(namenodePublicAddress.getHostAddress()),
        "-j", DnsUtil.resolveAddress(jobtrackerPublicAddress.getHostAddress()),
        "-c", clusterSpec.getProvider());
  }
View Full Code Here

    OptionSet optionSet = clusterSpecCommand.parser.parse(
        "--service-name", "overridden-test-service",
        "--config", "whirr-override-test.properties",
        "--private-key-file", keys.get("private").getAbsolutePath()
    );
    ClusterSpec clusterSpec = clusterSpecCommand.getClusterSpec(optionSet);
    assertThat(clusterSpec.getServiceName(), is("overridden-test-service"));
    assertThat(clusterSpec.getClusterName(), is("test-cluster"));
  }
View Full Code Here

    OptionSet optionSet = clusterSpecCommand.parser.parse(
        "--service-name", "foo",
        "--config", "whirr-override-test.properties",
        "--private-key-file", keys.get("private").getAbsolutePath()
    );
    ClusterSpec clusterSpec = clusterSpecCommand.getClusterSpec(optionSet);
    // this should fail - non-existent service
    clusterSpecCommand.createService("bar");
  }
View Full Code Here

    assertThat(rc, is(0));

    Configuration conf = new PropertiesConfiguration();
    conf.addProperty("whirr.version", "version-string");

    ClusterSpec expectedClusterSpec = ClusterSpec.withNoDefaults(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(service).destroyCluster(expectedClusterSpec);
   
View Full Code Here

TOP

Related Classes of org.apache.whirr.service.ClusterSpec$InstanceTemplate

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.