コード例 #1
0
  @AfterClass
  public void restorePrivateIp() {
    AsyncTask task = env.virtualMachine.setNics(Lists.<Ip<?, ?>>newArrayList(privateIp));
    assertNull(task);

    List<Ip<?, ?>> nics = env.virtualMachine.listAttachedNics();
    assertEquals(nics.size(), 1);
    assertEquals(nics.get(0).getId(), privateIp.getId());

    String address = publicIpCloud.getIp();
    env.virtualDatacenter.releaseePublicIp(publicIpCloud);
    assertNull(
        env.virtualDatacenter.findPurchasedPublicIp(IpPredicates.<PublicIp>address(address)));
  }
コード例 #2
0
  @BeforeClass
  public void setupIps() {
    privateIp = env.privateNetwork.listUnusedIps().get(0);
    assertNotNull(privateIp);

    externalIp = env.externalNetwork.listUnusedIps().get(0);
    assertNotNull(externalIp);

    publicIpInfrastructure = env.virtualDatacenter.listAvailablePublicIps().get(0);
    env.virtualDatacenter.purchasePublicIp(publicIpInfrastructure);

    publicIpCloud =
        env.virtualDatacenter.findPurchasedPublicIp(
            IpPredicates.<PublicIp>address(publicIpInfrastructure.getIp()));
    assertNotNull(publicIpCloud);
  }