use of org.openstack4j.model.common.ActionResponse in project openstack4j by ContainX.
the class KeystoneUserServiceTests method changeUserPassword_fail_Test.
/**
* tries to change the password for an non existent user fails
*
* @throws Exception
*/
public void changeUserPassword_fail_Test() throws Exception {
respondWithCodeAndResource(404, JSON_USER_CHANGE_PASSWORD_FAIL);
ActionResponse response_changePassword_fail = osv3().identity().users().changePassword("invalidUser", "OriginalPassword", "password");
assertFalse(response_changePassword_fail.isSuccess());
}
use of org.openstack4j.model.common.ActionResponse in project openstack4j by ContainX.
the class ServerTagTests method deleteAllTags.
@Test
public void deleteAllTags() {
respondWith(204);
ActionResponse delete = osv3().compute().serverTags().deleteAll("1");
System.out.println(delete.getCode());
assertTrue(delete.isSuccess());
}
use of org.openstack4j.model.common.ActionResponse in project openstack4j by ContainX.
the class FloatingIPTests method addFloatingIP.
@Test(dataProvider = "floatingIPs")
public void addFloatingIP(String ip) {
String serverId = "255b83fd-1193-44a8-aba5-9887b347a41d";
// Test add floatingIP success
respondWith(202);
ActionResponse successResponse = osv3().compute().floatingIps().addFloatingIP(serverId, ip);
assertNotNull(successResponse);
assertTrue(successResponse.isSuccess());
// Test add floatingIP fail -- server instance not existed
String jsonResponse = String.format("{\"itemNotFound\": {" + "\"message\": \"Instance %s could not be found.\", " + "\"code\": 404}}", serverId);
respondWith(404, jsonResponse);
ActionResponse failureResponse = osv3().compute().floatingIps().addFloatingIP(serverId, ip);
assertNotNull(failureResponse);
assertFalse(failureResponse.isSuccess());
assertEquals(failureResponse.getCode(), 404);
// Test add 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().addFloatingIP(serverId, ip);
assertNotNull(failureResponse2);
assertFalse(failureResponse2.isSuccess());
assertEquals(failureResponse2.getCode(), 404);
}
use of org.openstack4j.model.common.ActionResponse in project camel by apache.
the class SnapshotProducer method doDelete.
private void doDelete(Exchange exchange) {
final Message msg = exchange.getIn();
final String id = msg.getHeader(OpenstackConstants.ID, msg.getHeader(CinderConstants.SNAPSHOT_ID, String.class), String.class);
ObjectHelper.notEmpty(id, "Cinder Snapshot ID");
final ActionResponse out = os.blockStorage().snapshots().delete(id);
checkFailure(out, msg, "Delete snapshot " + id);
}
use of org.openstack4j.model.common.ActionResponse in project camel by apache.
the class SnapshotProducer method doUpdate.
private void doUpdate(Exchange exchange) {
final Message msg = exchange.getIn();
final String id = msg.getHeader(OpenstackConstants.ID, msg.getHeader(CinderConstants.SNAPSHOT_ID, String.class), String.class);
final VolumeSnapshot vs = messageToSnapshot(msg);
ObjectHelper.notEmpty(id, "Cinder Snapshot ID");
final ActionResponse out = os.blockStorage().snapshots().update(id, vs.getName(), vs.getDescription());
checkFailure(out, msg, "Update volume snapshot " + id);
}
Aggregations