Search in sources :

Example 11 with APIMgtSecurityException

use of org.wso2.carbon.apimgt.rest.api.common.exception.APIMgtSecurityException in project carbon-apimgt by wso2.

the class PoliciesApiServiceImplTest method getRequest.

private Request getRequest() throws APIMgtSecurityException {
    HTTPCarbonMessage carbonMessage = Mockito.mock(HTTPCarbonMessage.class);
    Request request = new Request(carbonMessage);
    try {
        PowerMockito.whenNew(Request.class).withArguments(carbonMessage).thenReturn(request);
    } catch (Exception e) {
        throw new APIMgtSecurityException("Error while mocking Request Object ", e);
    }
    return request;
}
Also used : HTTPCarbonMessage(org.wso2.transport.http.netty.message.HTTPCarbonMessage) APIMgtSecurityException(org.wso2.carbon.apimgt.rest.api.common.exception.APIMgtSecurityException) Request(org.wso2.msf4j.Request) NotFoundException(org.wso2.carbon.apimgt.rest.api.admin.NotFoundException) APIManagementException(org.wso2.carbon.apimgt.core.exception.APIManagementException) APIMgtSecurityException(org.wso2.carbon.apimgt.rest.api.common.exception.APIMgtSecurityException) UnsupportedThrottleLimitTypeException(org.wso2.carbon.apimgt.rest.api.admin.exceptions.UnsupportedThrottleLimitTypeException)

Example 12 with APIMgtSecurityException

use of org.wso2.carbon.apimgt.rest.api.common.exception.APIMgtSecurityException in project carbon-apimgt by wso2.

the class BlacklistApiServiceImplTest method getRequest.

private Request getRequest() throws APIMgtSecurityException {
    HTTPCarbonMessage carbonMessage = Mockito.mock(HTTPCarbonMessage.class);
    Request request = new Request(carbonMessage);
    try {
        PowerMockito.whenNew(Request.class).withArguments(carbonMessage).thenReturn(request);
    } catch (Exception e) {
        throw new APIMgtSecurityException("Error while mocking Request Object ", e);
    }
    return request;
}
Also used : HTTPCarbonMessage(org.wso2.transport.http.netty.message.HTTPCarbonMessage) APIMgtSecurityException(org.wso2.carbon.apimgt.rest.api.common.exception.APIMgtSecurityException) Request(org.wso2.msf4j.Request) NotFoundException(org.wso2.carbon.apimgt.rest.api.admin.NotFoundException) APIManagementException(org.wso2.carbon.apimgt.core.exception.APIManagementException) APIMgtSecurityException(org.wso2.carbon.apimgt.rest.api.common.exception.APIMgtSecurityException)

Example 13 with APIMgtSecurityException

use of org.wso2.carbon.apimgt.rest.api.common.exception.APIMgtSecurityException in project carbon-apimgt by wso2.

the class SdkGenApiServiceImplTestCase method getRequest.

// Sample request to be used by tests
private Request getRequest() throws APIMgtSecurityException {
    HTTPCarbonMessage carbonMessage = Mockito.mock(HTTPCarbonMessage.class);
    Mockito.when(carbonMessage.getProperty("LOGGED_IN_USER")).thenReturn(USER);
    Request request = new Request(carbonMessage);
    return request;
}
Also used : HTTPCarbonMessage(org.wso2.transport.http.netty.message.HTTPCarbonMessage) Request(org.wso2.msf4j.Request)

Example 14 with APIMgtSecurityException

use of org.wso2.carbon.apimgt.rest.api.common.exception.APIMgtSecurityException in project carbon-apimgt by wso2.

the class TestUtil method getRequest.

// Sample request to be used by tests
protected static Request getRequest() throws APIMgtSecurityException {
    HTTPCarbonMessage carbonMessage = Mockito.mock(HTTPCarbonMessage.class);
    Mockito.when(carbonMessage.getProperty("LOGGED_IN_USER")).thenReturn(USER);
    Request request = new Request(carbonMessage);
    return request;
}
Also used : HTTPCarbonMessage(org.wso2.transport.http.netty.message.HTTPCarbonMessage) Request(org.wso2.msf4j.Request)

Aggregations

Request (org.wso2.msf4j.Request)10 APIMgtSecurityException (org.wso2.carbon.apimgt.rest.api.common.exception.APIMgtSecurityException)9 HTTPCarbonMessage (org.wso2.transport.http.netty.message.HTTPCarbonMessage)9 APIManagementException (org.wso2.carbon.apimgt.core.exception.APIManagementException)7 ErrorHandler (org.wso2.carbon.apimgt.core.exception.ErrorHandler)3 Response (org.wso2.msf4j.Response)3 ServiceMethodInfo (org.wso2.msf4j.ServiceMethodInfo)3 HttpHeaders (javax.ws.rs.core.HttpHeaders)2 AccessTokenInfo (org.wso2.carbon.apimgt.core.models.AccessTokenInfo)2 NotFoundException (org.wso2.carbon.apimgt.rest.api.admin.NotFoundException)2 TypeToken (com.google.gson.reflect.TypeToken)1 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 Swagger (io.swagger.models.Swagger)1 SwaggerParser (io.swagger.parser.SwaggerParser)1 Arrays (java.util.Arrays)1 List (java.util.List)1 Locale (java.util.Locale)1 Optional (java.util.Optional)1 StringUtils (org.apache.commons.lang3.StringUtils)1 Test (org.junit.Test)1