コード例 #1
0
 public void testListNodes() throws Exception {
   for (ComputeMetadata node : client.listNodes()) {
     assert node.getProviderId() != null;
     assert node.getLocation() != null;
     assertEquals(node.getType(), ComputeType.NODE);
   }
 }
コード例 #2
0
 @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);
   }
 }
コード例 #3
0
  @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();
  }
コード例 #4
0
  @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();
  }
コード例 #5
0
 @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());
   }
 }