Package org.apache.whirr.service

Examples of org.apache.whirr.service.Service


   * @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


 
  @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,
        Lists.newArrayList("100.0.0.1"),
        Lists.newArrayList("10.0.0.1"), null);
    NodeMetadata node2 = new NodeMetadataImpl(null, "name2", "id2",
        new LocationImpl(LocationScope.PROVIDER, "location-id2",
            "location-desc2", null),
        null, Collections.<String,String>emptyMap(), null, null, "image-id",
        null, NodeState.RUNNING,
        Lists.newArrayList("100.0.0.2"),
        Lists.newArrayList("10.0.0.2"), null);
    when(service.getNodes((ClusterSpec) any())).thenReturn(
        (Set) Sets.newLinkedHashSet(Lists.newArrayList(node1, node2)));
   
    ListClusterCommand command = new ListClusterCommand(factory);
   
    int rc = command.run(null, out, null, Lists.newArrayList(
View Full Code Here

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

      Service service = factory.create(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

 
  @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");
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");
    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(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

    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

 
  @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");
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.