use of org.openstack4j.model.common.ActionResponse in project openstack4j by ContainX.
the class DBUserServiceImplTest method testDeleteDatabaseUser.
@Test
public void testDeleteDatabaseUser() {
String databaseId = "54c91755526e44b9808385a263db4aa6";
respondWith(200);
ActionResponse result = osv2().trove().databaseUsersService().delete(databaseId, "dbuser3");
assertTrue(result.isSuccess());
}
use of org.openstack4j.model.common.ActionResponse in project openstack4j by ContainX.
the class DBUserServiceImplTest method testCreateDatabaseUser.
@Test
public void testCreateDatabaseUser() throws Exception {
String databaseInstanceId = "54c91755526e44b9808385a263db4aa6";
respondWith(200);
TroveBuilders troveBuilders = new TroveBuilders();
TroveDatabaseUser databaseUser = (TroveDatabaseUser) troveBuilders.databaseUserCreate().username("dbuser4").password("password").build();
List<TroveDatabaseUser> troveDatabaseUsers = new ArrayList<>();
troveDatabaseUsers.add(databaseUser);
DatabaseUsers databaseUsers = new DatabaseUsers();
databaseUsers.setTroveDatabaseUserList(troveDatabaseUsers);
ActionResponse result = osv2().trove().databaseUsersService().create(databaseInstanceId, databaseUsers);
assertTrue(result.isSuccess());
}
use of org.openstack4j.model.common.ActionResponse in project openstack4j by ContainX.
the class ResponseToActionResponse method apply.
public ActionResponse apply(HttpResponse response, boolean returnNullIfNotMapped) {
if (Parser.isContentTypeText(response.getContentType())) {
return ActionResponse.actionFailed(response.getStatusMessage(), response.getStatus());
}
@SuppressWarnings("unchecked") Map<String, Object> map = response.readEntity(Map.class);
ActionResponse ar = new ParseActionResponseFromJsonMap(response).apply(map);
if (ar != null)
return ar;
if (ar == null && returnNullIfNotMapped)
return null;
return ActionResponse.actionFailed(String.format("Status: %d, Reason: %s", response.getStatus(), response.getStatusMessage()), response.getStatus());
}
use of org.openstack4j.model.common.ActionResponse in project openstack4j by ContainX.
the class NodeServiceTest method testDeleteNode.
@Test
public void testDeleteNode() {
respondWith(200);
ActionResponse result = osv3().senlin().node().delete(ID);
assertTrue(result.isSuccess());
}
use of org.openstack4j.model.common.ActionResponse in project openstack4j by ContainX.
the class PolicyServiceTest method testDeletePolicy.
@Test
public void testDeletePolicy() {
respondWith(200);
String id = "3ad6a92c-f969-4d69-8a83-0301f319fc78";
ActionResponse result = osv3().senlin().policy().delete(id);
assertTrue(result.isSuccess());
}
Aggregations