Package org.apache.whirr.service

Examples of org.apache.whirr.service.ServiceFactory


            config.setProperty(CassandraClusterActionHandler.BIN_TARBALL, blob.right.toURL().toString());
            // TODO: parse the CassandraVersion property file instead
            config.setProperty(CassandraClusterActionHandler.MAJOR_VERSION, "0.7");
        }

        service = (CassandraService)new ServiceFactory().create(clusterSpec.getServiceName());
        cluster = service.launchCluster(clusterSpec);
        computeService = ComputeServiceContextBuilder.build(clusterSpec).getComputeService();
        hosts = new ArrayList<InetAddress>();
        for (Instance instance : cluster.getInstances())
        {
View Full Code Here


public class AbstractClusterSpecCommandTest {

  @Test
  public void testOverrides() throws Exception {
    AbstractClusterSpecCommand clusterSpecCommand = new AbstractClusterSpecCommand("name",
        "description", new ServiceFactory()) {
      @Override
      public int run(InputStream in, PrintStream out, PrintStream err,
          List<String> args) throws Exception {
        return 0;
      }
View Full Code Here

   * Ensure that an invalid service name causes failure
   */
  @Test(expected=IllegalArgumentException.class)
  public void testCreateServerWithInvalidServiceName() throws Exception {
    AbstractClusterSpecCommand clusterSpecCommand = new AbstractClusterSpecCommand("name",
        "description", new ServiceFactory()) {
      @Override
      public int run(InputStream in, PrintStream out, PrintStream err,
          List<String> args) throws Exception {
        return 0;
      }
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 NodeMetadataImpl(null, "name1", "id1",
        new LocationImpl(LocationScope.PROVIDER, "location-id1",
            "location-desc1", null),
        null, Collections.<String,String>emptyMap(), null, null, "image-id",
        null, NodeState.RUNNING,
View Full Code Here

* A command to list the nodes in a cluster.
*/
public class ListClusterCommand extends AbstractClusterSpecCommand {

  public ListClusterCommand() throws IOException {
    this(new ServiceFactory());
  }
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);
   
    DestroyClusterCommand command = new DestroyClusterCommand(factory);
   
    File privateKeyFile = File.createTempFile("private", "key");
    privateKeyFile.deleteOnExit();
View Full Code Here

    if (clusterSpec.getPrivateKey() == null) {
      Map<String, String> pair = KeyPair.generate();
      clusterSpec.setPublicKey(pair.get("public"));
      clusterSpec.setPrivateKey(pair.get("private"));
    }
    Service s = new ServiceFactory().create(clusterSpec.getServiceName());
    assertThat(s, instanceOf(ZooKeeperService.class));
    service = (ZooKeeperService) s;
    cluster = service.launchCluster(clusterSpec);
  }
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);
   
    File privateKeyFile = File.createTempFile("private", "key");
View Full Code Here

    if (clusterSpec.getPrivateKey() == null) {
      Map<String, String> pair = KeyPair.generate();
      clusterSpec.setPublicKey(pair.get("public"));
      clusterSpec.setPrivateKey(pair.get("private"));
    }
    Service s = new ServiceFactory().create(clusterSpec.getServiceName());
    assertThat(s, instanceOf(CassandraService.class));
    service = (CassandraService) s;
    cluster = service.launchCluster(clusterSpec);

    // give it a sec to boot up the cluster
View Full Code Here

    if (clusterSpec.getPrivateKey() == null) {
      Map<String, String> pair = KeyPair.generate();
      clusterSpec.setPublicKey(pair.get("public"));
      clusterSpec.setPrivateKey(pair.get("private"));
    }
    Service s = new ServiceFactory().create(clusterSpec.getServiceName());
    assertThat(s, instanceOf(HadoopService.class));
    service = (HadoopService) s;
   
    cluster = service.launchCluster(clusterSpec);
    proxy = new HadoopProxy(clusterSpec, cluster);
View Full Code Here

TOP

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

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.