Package org.apache.whirr.service

Examples of org.apache.whirr.service.ServiceFactory


    if (System.getProperty("config") != null) {
      config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
    }
    config.addConfiguration(new PropertiesConfiguration("whirr-zookeeper-test.properties"));
    clusterSpec = ClusterSpec.fromConfiguration(config);
    Service s = new ServiceFactory().create(clusterSpec.getServiceName());
    assertThat(s, instanceOf(ZooKeeperService.class));
    service = (ZooKeeperService) s;
    cluster = service.launchCluster(clusterSpec);
    System.out.println(cluster.getHosts());
  }
View Full Code Here


public class ClusterSpecCommandTest {

  @Test
  public void testOverrides() throws Exception {
    ClusterSpecCommand clusterSpecCommand = new ClusterSpecCommand("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);
   
    DestroyClusterCommand command = new DestroyClusterCommand(factory);
   
    File privateKeyFile = File.createTempFile("private", "key");
    privateKeyFile.deleteOnExit();
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 (System.getProperty("config") != null) {
      config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
    }
    config.addConfiguration(new PropertiesConfiguration("whirr-hadoop-test.properties"));
    clusterSpec = ClusterSpec.fromConfiguration(config);
    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

* A command to destroy a running cluster (terminate and cleanup).
*/
public class DestroyClusterCommand extends ClusterSpecCommand {

  public DestroyClusterCommand() throws IOException {
    this(new ServiceFactory());
  }
View Full Code Here

* A command to launch a new cluster.
*/
public class LaunchClusterCommand extends ClusterSpecCommand {

  public LaunchClusterCommand() throws IOException {
    this(new ServiceFactory());
  }
View Full Code Here

    if (System.getProperty("config") != null) {
      config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
    }
    config.addConfiguration(new PropertiesConfiguration("whirr-cassandra-test.properties"));
    clusterSpec = ClusterSpec.fromConfiguration(config);
    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

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

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.