Search in sources :

Example 1 with ServiceErrorRestRep

use of com.emc.storageos.model.errorhandling.ServiceErrorRestRep in project coprhd-controller by CoprHD.

the class ApiTestUserGroup method deleteUserGroupAndExpectFailure.

private void deleteUserGroupAndExpectFailure(URI id) {
    String userGroupDeleteApi = getTestEditApi(id);
    ClientResponse clientResponseUserGroupDelete = rSys.path(userGroupDeleteApi).delete(ClientResponse.class);
    Assert.assertEquals(HttpStatus.SC_BAD_REQUEST, clientResponseUserGroupDelete.getStatus());
    final String partialExpectedErrorString = "Deleting or editing the domain of an user group is not allowed because";
    final ServiceErrorRestRep actualErrorMsg = clientResponseUserGroupDelete.getEntity(ServiceErrorRestRep.class);
    Assert.assertTrue(actualErrorMsg.getDetailedMessage().contains(partialExpectedErrorString));
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) ServiceErrorRestRep(com.emc.storageos.model.errorhandling.ServiceErrorRestRep)

Example 2 with ServiceErrorRestRep

use of com.emc.storageos.model.errorhandling.ServiceErrorRestRep in project coprhd-controller by CoprHD.

the class ApiTestUserGroup method validateUserGroupBadRequest.

private void validateUserGroupBadRequest(int expectedStatus, String expectedErrorMsg, ClientResponse actual) {
    Assert.assertNotNull(actual);
    Assert.assertEquals(expectedStatus, actual.getStatus());
    final ServiceErrorRestRep actualErrorMsg = actual.getEntity(ServiceErrorRestRep.class);
    Assert.assertTrue(actualErrorMsg.getDetailedMessage().contains(expectedErrorMsg));
}
Also used : ServiceErrorRestRep(com.emc.storageos.model.errorhandling.ServiceErrorRestRep)

Example 3 with ServiceErrorRestRep

use of com.emc.storageos.model.errorhandling.ServiceErrorRestRep in project coprhd-controller by CoprHD.

the class ApiTestAuthnProviders method validateAuthProviderBadRequest.

private void validateAuthProviderBadRequest(int expectedStatus, String expectedErrorMsg, ClientResponse actual) {
    Assert.assertNotNull(actual);
    Assert.assertEquals(expectedStatus, actual.getStatus());
    final ServiceErrorRestRep actualErrorMsg = actual.getEntity(ServiceErrorRestRep.class);
    Assert.assertTrue(actualErrorMsg.getDetailedMessage().startsWith(expectedErrorMsg));
}
Also used : ServiceErrorRestRep(com.emc.storageos.model.errorhandling.ServiceErrorRestRep)

Example 4 with ServiceErrorRestRep

use of com.emc.storageos.model.errorhandling.ServiceErrorRestRep in project coprhd-controller by CoprHD.

the class ApiTestBase method assertExpectedError.

protected void assertExpectedError(final ClientResponse actualResponse, final int expectedStatusCode, final ServiceCode expectedServiceCode, final String expectedMessage) {
    Assert.assertEquals(expectedStatusCode, actualResponse.getStatus());
    try {
        final ServiceErrorRestRep error = actualResponse.getEntity(ServiceErrorRestRep.class);
        assertServiceError(expectedServiceCode.getCode(), expectedServiceCode.getSummary(), expectedMessage, error);
    } catch (final ClientHandlerException e) {
        Assert.fail("Expected a ServiceError object");
    }
}
Also used : ClientHandlerException(com.sun.jersey.api.client.ClientHandlerException) ServiceErrorRestRep(com.emc.storageos.model.errorhandling.ServiceErrorRestRep)

Example 5 with ServiceErrorRestRep

use of com.emc.storageos.model.errorhandling.ServiceErrorRestRep in project coprhd-controller by CoprHD.

the class ApiTestTenants method validateTenantCreateAndEditBadRequest.

private void validateTenantCreateAndEditBadRequest(int expectedStatus, String expectedErrorMsg, ClientResponse actual) {
    Assert.assertNotNull(actual);
    Assert.assertEquals(expectedStatus, actual.getStatus());
    final ServiceErrorRestRep actualErrorMsg = actual.getEntity(ServiceErrorRestRep.class);
    Assert.assertTrue(actualErrorMsg.getDetailedMessage().startsWith(expectedErrorMsg));
}
Also used : ServiceErrorRestRep(com.emc.storageos.model.errorhandling.ServiceErrorRestRep)

Aggregations

ServiceErrorRestRep (com.emc.storageos.model.errorhandling.ServiceErrorRestRep)22 ClientResponse (com.sun.jersey.api.client.ClientResponse)8 AuthSvcInternalApiClientIterator (com.emc.storageos.security.authentication.AuthSvcInternalApiClientIterator)4 SecurityException (com.emc.storageos.security.exceptions.SecurityException)4 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)4 ClientHandlerException (com.sun.jersey.api.client.ClientHandlerException)4 UnsupportedEncodingException (java.io.UnsupportedEncodingException)4 FatalSecurityException (com.emc.storageos.security.exceptions.FatalSecurityException)3 InternalServerErrorException (com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException)3 ServiceErrorException (com.emc.vipr.client.exceptions.ServiceErrorException)2 Response (javax.ws.rs.core.Response)2 CustomConfigPreviewRep (com.emc.storageos.model.customconfig.CustomConfigPreviewRep)1 GeoException (com.emc.storageos.security.geo.exceptions.GeoException)1 ServiceErrorFactory.toServiceErrorRestRep (com.emc.storageos.svcs.errorhandling.resources.ServiceErrorFactory.toServiceErrorRestRep)1 ViPRHttpException (com.emc.vipr.client.exceptions.ViPRHttpException)1 Locale (java.util.Locale)1 ResponseBuilder (javax.ws.rs.core.Response.ResponseBuilder)1 StatusType (javax.ws.rs.core.Response.StatusType)1