Ejemplo n.º 1
0
  @Test(
      enabled = true,
      dependsOnMethods = "testCreateAnotherNodeWithANewContextToEnsureSharedMemIsntRequired")
  public void testGet() throws Exception {
    Map<String, ? extends NodeMetadata> metadataMap =
        newLinkedHashMap(
            uniqueIndex(
                filter(client.listNodesDetailsMatching(all()), and(withTag(tag), not(TERMINATED))),
                new Function<NodeMetadata, String>() {

                  @Override
                  public String apply(NodeMetadata from) {
                    return from.getId();
                  }
                }));
    for (NodeMetadata node : nodes) {
      metadataMap.remove(node.getId());
      NodeMetadata metadata = client.getNodeMetadata(node.getId());
      assertEquals(metadata.getProviderId(), node.getProviderId());
      assertEquals(metadata.getTag(), node.getTag());
      assertLocationSameOrChild(metadata.getLocation(), template.getLocation());
      checkImageIdMatchesTemplate(metadata);
      checkOsMatchesTemplate(metadata);
      assertEquals(metadata.getState(), NodeState.RUNNING);
      // due to DHCP the addresses can actually change in-between runs.
      assertEquals(metadata.getPrivateAddresses().size(), node.getPrivateAddresses().size());
      assertEquals(metadata.getPublicAddresses().size(), node.getPublicAddresses().size());
    }
    assertNodeZero(metadataMap.values());
  }
 @Test(
     enabled = true,
     dependsOnMethods = "testCreateAnotherNodeWithANewContextToEnsureSharedMemIsntRequired")
 public void testGet() throws Exception {
   Set<? extends NodeMetadata> metadataSet =
       Sets.newHashSet(
           Iterables.filter(
               client.listNodesDetailsMatching(NodePredicates.all()),
               Predicates.and(
                   NodePredicates.withTag(tag), Predicates.not(NodePredicates.TERMINATED))));
   for (NodeMetadata node : nodes) {
     metadataSet.remove(node);
     NodeMetadata metadata = client.getNodeMetadata(node.getId());
     assertEquals(metadata.getProviderId(), node.getProviderId());
     assertEquals(metadata.getTag(), node.getTag());
     assertLocationSameOrChild(metadata.getLocation(), template.getLocation());
     assertEquals(metadata.getImage(), template.getImage());
     assertEquals(metadata.getState(), NodeState.RUNNING);
     assertEquals(metadata.getPrivateAddresses(), node.getPrivateAddresses());
     assertEquals(metadata.getPublicAddresses(), node.getPublicAddresses());
   }
   assertNodeZero(metadataSet);
 }