Search in sources :

Example 26 with ActionResponse

use of org.openstack4j.model.common.ActionResponse in project openstack4j by ContainX.

the class KeystoneRoleServiceTests method revokeDomainUserRole_fail_Test.

/**
     * try to revoke a domain role from a user that isn't assigned to him
     * results in failing ActionResponse
     *
     * @throws Exception
     */
public void revokeDomainUserRole_fail_Test() throws Exception {
    respondWithCodeAndResource(404, JSON_ROLES_REVOKEROLE_ERROR);
    ActionResponse response_fail = osv3().identity().roles().revokeDomainUserRole(USER_DOMAIN_ID, USER_ID, "existingUnassignedRoleId");
    assertFalse(response_fail.isSuccess());
}
Also used : ActionResponse(org.openstack4j.model.common.ActionResponse)

Example 27 with ActionResponse

use of org.openstack4j.model.common.ActionResponse in project openstack4j by ContainX.

the class KeystoneRoleServiceTests method revokeProjectUserRole_fail_Test.

/**
     * try to revoke a project role from a user that isn't assigned to him
     * results in failing ActionResponse
     *
     * @throws Exception
     */
public void revokeProjectUserRole_fail_Test() throws Exception {
    respondWithCodeAndResource(404, JSON_ROLES_REVOKEROLE_ERROR);
    ActionResponse response_fail = osv3().identity().roles().revokeProjectUserRole(PROJECT_ID, USER_ID, "existingUnassignedRoleId");
    assertFalse(response_fail.isSuccess());
}
Also used : ActionResponse(org.openstack4j.model.common.ActionResponse)

Example 28 with ActionResponse

use of org.openstack4j.model.common.ActionResponse in project openstack4j by ContainX.

the class KeystoneRoleServiceTests method addRoleToUserInProject_check_correct_response.

public void addRoleToUserInProject_check_correct_response() throws Exception {
    respondWith(204);
    ActionResponse actionResponse = osv3().identity().roles().grantProjectUserRole("fake", "fake", "fake");
    assertTrue(actionResponse.isSuccess());
}
Also used : ActionResponse(org.openstack4j.model.common.ActionResponse)

Example 29 with ActionResponse

use of org.openstack4j.model.common.ActionResponse in project openstack4j by ContainX.

the class KeystoneRoleServiceTests method checkProjectUserRole_fail_Test.

// TODO: this test is disabled due to a malformed response returned by
// OpenStack as described in issue #530
/**
     * checks if a user has a role in domain context
     *
     * @throws Exception
     */
@Test(enabled = false)
public void checkProjectUserRole_fail_Test() throws Exception {
    respondWith(404);
    ActionResponse response_success = osv3().identity().roles().checkProjectUserRole(PROJECT_ID, USER_ID, "existingUnassignedRoleId");
    assertFalse(response_success.isSuccess());
}
Also used : ActionResponse(org.openstack4j.model.common.ActionResponse) AbstractTest(org.openstack4j.api.AbstractTest) Test(org.testng.annotations.Test)

Example 30 with ActionResponse

use of org.openstack4j.model.common.ActionResponse in project openstack4j by ContainX.

the class KeystoneRoleServiceTests method grantProjectUserRole_fail_Test.

/**
     * try to grant a project role to a user using role that doesn't exist
     * results in failing ActionResponse
     *
     * @throws Exception
     */
public void grantProjectUserRole_fail_Test() throws Exception {
    respondWithCodeAndResource(404, JSON_ROLES_GRANTROLE_ERROR);
    ActionResponse response_fail = osv3().identity().roles().grantProjectUserRole(PROJECT_ID, USER_ID, "nonExistingRoleId");
    assertFalse(response_fail.isSuccess());
}
Also used : ActionResponse(org.openstack4j.model.common.ActionResponse)

Aggregations

ActionResponse (org.openstack4j.model.common.ActionResponse)123 AbstractTest (org.openstack4j.api.AbstractTest)54 Test (org.testng.annotations.Test)54 Message (org.apache.camel.Message)25 ArrayList (java.util.ArrayList)2 CreateUpdateContainerOptions (org.openstack4j.model.storage.object.options.CreateUpdateContainerOptions)2 TroveBuilders (org.openstack4j.openstack.trove.builder.TroveBuilders)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 File (java.io.File)1 InputStream (java.io.InputStream)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)1 ResponseToActionResponse (org.openstack4j.core.transport.functions.ResponseToActionResponse)1 Action (org.openstack4j.model.compute.Action)1 User (org.openstack4j.model.identity.v3.User)1 Volume (org.openstack4j.model.storage.block.Volume)1 VolumeSnapshot (org.openstack4j.model.storage.block.VolumeSnapshot)1 KeystoneUser (org.openstack4j.openstack.identity.v3.domain.KeystoneUser)1 TroveDatabase (org.openstack4j.openstack.trove.domain.TroveDatabase)1