public void testListNodes() throws Exception {
   for (ComputeMetadata node : client.listNodes()) {
     assert node.getProviderId() != null;
     assert node.getLocation() != null;
     assertEquals(node.getType(), ComputeType.NODE);
   }
 }
 @Test(enabled = true, dependsOnMethods = "testSuspendResume")
 public void testListNodes() throws Exception {
   for (ComputeMetadata node : client.listNodes()) {
     assert node.getProviderId() != null : node;
     assert node.getLocation() != null : node;
     assertEquals(node.getType(), ComputeType.NODE);
   }
 }
  @Test(enabled = true, dependsOnMethods = "testGet")
  public void testReboot() throws Exception {
    Set<? extends NodeMetadata> rebootNodes = client.rebootNodesMatching(inGroup(group));
    for (ComputeMetadata node : rebootNodes) {
      assertNotNull(node);
      assert node.getProviderId() != null : node;
      assert node.getLocation() != null : node;
    }

    // validation
    testGet();
  }
 @Override
 public void testListNodes() throws Exception {
   for (ComputeMetadata node : client.listNodes()) {
     assert node.getProviderId() != null;
     assert node.getLocation() != null;
     assertEquals(node.getType(), ComputeType.NODE);
     NodeMetadata allData = client.getNodeMetadata(node.getId());
     System.out.println(allData.getHardware());
     RestContext<TerremarkVCloudClient, TerremarkVCloudClient> tmContext =
         new ComputeServiceContextFactory()
             .createContext(provider, identity, credential)
             .getProviderSpecificContext();
     VCloudExpressVApp vApp =
         tmContext.getApi().findVAppInOrgVDCNamed(null, null, allData.getName());
     assertEquals(vApp.getName(), allData.getName());
   }
 }
Beispiel #5
0
  /** Rigorous Test :-) */
  public void testCanUseStub() throws IOException {

    Iterable<String> providers = ComputeServiceUtils.getSupportedProviders();

    ComputeServiceContext context =
        new ComputeServiceContextFactory().createContext("stub", "foo", "bar");

    ComputeService client = context.getComputeService();

    // Set<? extends ComputeMetadata> nodes =
    // Sets.newHashSet(connection.getNodes().values());

    for (ComputeMetadata node : client.listNodes()) {
      assertNotNull(node.getId());
      assertNotNull(node.getLocation().getId()); // where in the
      // world is the node
    }
  }
  @Test(enabled = true, dependsOnMethods = "testReboot")
  public void testSuspendResume() throws Exception {

    Set<? extends NodeMetadata> suspendedNodes = client.suspendNodesMatching(inGroup(group));
    for (ComputeMetadata node : suspendedNodes) {
      assertNotNull(node);
      assert node.getProviderId() != null : node;
      assert node.getLocation() != null : node;
    }

    Set<? extends NodeMetadata> stoppedNodes = refreshNodes();

    assert Iterables.all(
            stoppedNodes,
            new Predicate<NodeMetadata>() {

              @Override
              public boolean apply(NodeMetadata input) {
                boolean returnVal = input.getStatus() == Status.SUSPENDED;
                if (!returnVal)
                  getAnonymousLogger()
                      .warning(format("node %s in state %s%n", input.getId(), input.getStatus()));
                return returnVal;
              }
            })
        : stoppedNodes;

    Set<? extends NodeMetadata> resumedNodes = client.resumeNodesMatching(inGroup(group));
    for (ComputeMetadata node : resumedNodes) {
      assertNotNull(node);
      assert node.getProviderId() != null : node;
      assert node.getLocation() != null : node;
    }

    testGet();
  }