use of org.openstack4j.model.common.ActionResponse in project openstack4j by ContainX.
the class FloatingIPTests method deallocateFloatingIP.
@Test(dataProvider = "floatingIPs")
public void deallocateFloatingIP(String ip) {
// Test deallocate success
respondWith(202);
ActionResponse successResponse = osv3().compute().floatingIps().deallocateIP(ip);
assertNotNull(successResponse);
assertTrue(successResponse.isSuccess());
String jsonResponse = String.format("{\"itemNotFound\": {" + "\"message\": \"Floating ip not found for id %s\", " + "\"code\": 404}}", ip);
// Test deallocate error
respondWith(404, jsonResponse);
ActionResponse failureResponse = osv3().compute().floatingIps().deallocateIP(ip);
assertNotNull(failureResponse);
assertFalse(failureResponse.isSuccess());
assertEquals(failureResponse.getCode(), 404);
}
use of org.openstack4j.model.common.ActionResponse in project openstack4j by ContainX.
the class FloatingIPTests method removeFloatingIP.
@Test(dataProvider = "floatingIPs")
public void removeFloatingIP(String ip) {
String serverId = "255b83fd-1193-44a8-aba5-9887b347a41d";
// Test remove floatingIP success
respondWith(202);
ActionResponse successResponse = osv3().compute().floatingIps().removeFloatingIP(serverId, ip);
assertNotNull(successResponse);
assertTrue(successResponse.isSuccess());
// Test remove floatingIP fail -- Floating ip existed but not bind to server or server instance not existed
String jsonResponse = String.format("{\"itemNotFound\": {" + "\"message\": \"Floating ip %s is not associated with instance %s.\", " + "\"code\": 409}}", ip, serverId);
respondWith(409, jsonResponse);
ActionResponse failureResponse = osv3().compute().floatingIps().removeFloatingIP(serverId, ip);
assertNotNull(failureResponse);
assertFalse(failureResponse.isSuccess());
assertEquals(failureResponse.getCode(), 409);
// Test remove floatingIP fail -- floatingIP not existed
String jsonResponse2 = String.format("{\"itemNotFound\": {" + "\"message\": \"floating ip not found\", " + "\"code\": 404}}");
respondWith(404, jsonResponse2);
ActionResponse failureResponse2 = osv3().compute().floatingIps().removeFloatingIP(serverId, ip);
assertNotNull(failureResponse2);
assertFalse(failureResponse2.isSuccess());
assertEquals(failureResponse2.getCode(), 404);
}
use of org.openstack4j.model.common.ActionResponse in project openstack4j by ContainX.
the class PolicyTargetServiceTest method testDeletePolicyTarget.
@Test
public void testDeletePolicyTarget() {
respondWith(200);
String id = "0d65eebe-4efe-456e-aec3-7856e4e839b4";
ActionResponse result = osv2().gbp().policyTarget().delete(id);
assertTrue(result.isSuccess());
}
use of org.openstack4j.model.common.ActionResponse in project openstack4j by ContainX.
the class DesignateZoneServiceTest method zoneDeleteTest.
public void zoneDeleteTest() throws Exception {
respondWith(204);
ActionResponse zoneDeleteResponse = osv3().dns().zones().delete(ZONE_ID);
assertTrue(zoneDeleteResponse.isSuccess());
}
use of org.openstack4j.model.common.ActionResponse in project openstack4j by ContainX.
the class ExternalPolicyServiceTest method testDeleteExternalPolicy.
@Test
public void testDeleteExternalPolicy() {
respondWith(200);
String id = "8d14b663-c67d-4fa7-b23f-0732cb9aa292";
ActionResponse result = osv2().gbp().externalPolicy().delete(id);
assertTrue(result.isSuccess());
}
Aggregations