}
}
@Test(dependsOnMethods = "testSetDriveData")
public void testCreateAndDestroyStaticIP() throws Exception {
StaticIPInfo ip = client.createStaticIP();
StaticIPInfo ip2 = client.createStaticIP();
Server server = null;
try {
ip = client.getStaticIPInfo(ip.getAddress());
assertNotNull(ip);
Logger.getAnonymousLogger().info("preparing drive");
prepareDrive();
Server serverRequest = Servers.smallWithStaticIP(prefix, drive.getUuid(), vncPassword, ip.getAddress())
.build();
Logger.getAnonymousLogger().info("starting server");
server = client.createServer(serverRequest);
assertEquals(server.getNics().get(0).getDhcp(), ip.getAddress());
client.stopServer(server.getUuid());
server = client.setServerConfiguration(server.getUuid(), Servers.changeIP(server, ip2.getAddress()));
assertEquals(server.getNics().get(0).getDhcp(), ip2.getAddress());
} finally {
if (server != null) {
client.destroyServer(server.getUuid());
client.destroyDrive(drive.getUuid());
}
client.destroyStaticIP(ip.getAddress());
client.destroyStaticIP(ip2.getAddress());
}
}