@Test(enabled = true, dependsOnMethods = "testConcurrentUseOfComputeServiceToCreateNodes")
  public void testCreateTwoNodesWithRunScript() throws Exception {
    try {
      client.destroyNodesMatching(inGroup(group));
    } catch (NoSuchElementException e) {

    }
    refreshTemplate();
    try {
      nodes = newTreeSet(client.createNodesInGroup(group, 2, template));
    } catch (RunNodesException e) {
      nodes = newTreeSet(concat(e.getSuccessfulNodes(), e.getNodeErrors().keySet()));
      throw e;
    }

    assertEquals(nodes.size(), 2, "expected two nodes but was " + nodes);
    checkNodes(nodes, group, "bootstrap");
    NodeMetadata node1 = nodes.first();
    NodeMetadata node2 = nodes.last();
    // credentials aren't always the same
    // assertEquals(node1.getCredentials(), node2.getCredentials());

    assertLocationSameOrChild(
        checkNotNull(node1.getLocation(), "location of %s", node1), template.getLocation());
    assertLocationSameOrChild(
        checkNotNull(node2.getLocation(), "location of %s", node2), template.getLocation());
    checkImageIdMatchesTemplate(node1);
    checkImageIdMatchesTemplate(node2);
    checkOsMatchesTemplate(node1);
    checkOsMatchesTemplate(node2);
  }
  @Test(enabled = true, dependsOnMethods = "testCreateTwoNodesWithRunScript")
  public void testCreateTwoNodesWithOneSpecifiedName() throws Exception {
    template = buildTemplate(client.templateBuilder());
    template.getOptions().nodeNames(ImmutableSet.of("first-node"));
    Set<? extends NodeMetadata> nodes;
    try {
      nodes = newTreeSet(client.createNodesInGroup(group, 2, template));
    } catch (RunNodesException e) {
      nodes = newTreeSet(concat(e.getSuccessfulNodes(), e.getNodeErrors().keySet()));
      throw e;
    }

    assertEquals(nodes.size(), 2, "expected two nodes but was " + nodes);
    NodeMetadata node1 = Iterables.getFirst(nodes, null);
    NodeMetadata node2 = Iterables.getLast(nodes, null);
    // credentials aren't always the same
    // assertEquals(node1.getCredentials(), node2.getCredentials());

    assertTrue(
        node1.getName().equals("first-node") || node2.getName().equals("first-node"),
        "one node should be named 'first-node'");
    assertFalse(
        node1.getName().equals("first-node") && node2.getName().equals("first-node"),
        "one node should be named something other than 'first-node");

    this.nodes.addAll(nodes);
  }
  public void testStartCCInstance() throws Exception {

    Template template =
        view.getComputeService()
            .templateBuilder()
            .fromHardware(EC2HardwareBuilder.cc2_8xlarge().build())
            .osFamily(OsFamily.AMZN_LINUX)
            .build();
    assert template != null : "The returned template was null, but it should have a value.";
    assertEquals(template.getHardware().getProviderId(), InstanceType.CC2_8XLARGE);
    assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "ebs");
    assertEquals(template.getImage().getUserMetadata().get("virtualizationType"), "hvm");
    assertEquals(template.getImage().getUserMetadata().get("hypervisor"), "xen");

    template
        .getOptions()
        .runScript(Statements.newStatementList(AdminAccess.standard(), InstallJDK.fromOpenJDK()));

    String group = PREFIX + "cccluster";
    view.getComputeService().destroyNodesMatching(NodePredicates.inGroup(group));
    // TODO make this not lookup an explicit region
    client
        .getPlacementGroupApi()
        .get()
        .deletePlacementGroupInRegion(null, "jclouds#" + group + "#us-east-1");

    try {
      Set<? extends NodeMetadata> nodes =
          view.getComputeService().createNodesInGroup(group, 1, template);
      NodeMetadata node = getOnlyElement(nodes);

      getOnlyElement(
          getOnlyElement(
              client.getInstanceApi().get().describeInstancesInRegion(null, node.getProviderId())));

    } catch (RunNodesException e) {
      System.err.println(e.getNodeErrors().keySet());
      Throwables.propagate(e);
    } finally {
      view.getComputeService().destroyNodesMatching(NodePredicates.inGroup(group));
    }
  }