assertEquals(reservedIp, original);
}
@Test(dependsOnMethods = "reserveIp")
public void testAddRemove() throws Exception {
IpDetails added = ipApi.addToServer(reservedIp.getAddress(), serverId);
assertEquals(added.getAddress(), reservedIp.getAddress());
assertEquals(added.getPtr(), reservedIp.getPtr());
assertEquals(added.getServerId(), serverId);
IpDetails again = ipApi.get(reservedIp.getAddress());
assertEquals(again, added);
IpDetails removed = ipApi.removeFromServer(reservedIp.getAddress(), serverId);
assertEquals(removed, added.toBuilder().serverId(null).build());
assertEquals(removed, reservedIp);
Set<String> openVzIps = Sets.newHashSet(ipApi.listFree(4, "Falkenberg", "OpenVZ"));
openVzIps.remove(reservedIp.getAddress());
assertFalse(openVzIps.isEmpty());
added = ipApi.addToServer(reservedIp.getAddress(), serverId);
assertEquals(added.getServerId(), serverId);
removed = ipApi.removeFromServerAndRelease(reservedIp.getAddress(), serverId);
assertNull(removed.getServerId());
assertFalse(removed.isReserved());
// reserve an address again!
reserveIp();
}