Search in sources :

Example 1 with PolicyV1Filter

use of org.forgerock.openam.entitlement.rest.PolicyV1Filter in project OpenAM by OpenRock.

the class PolicyV1FilterTest method setUp.

@BeforeMethod
public void setUp() {
    MockitoAnnotations.initMocks(this);
    EntitlementsExceptionMappingHandler resourceErrorHandler = new EntitlementsExceptionMappingHandler(EntitlementRestGuiceModule.getEntitlementsErrorHandlers());
    filter = new PolicyV1Filter(applicationServiceFactory, resourceErrorHandler, contextHelper, debug);
    subject = new Subject();
    when(requestHandler.handleAction(any(Context.class), any(ActionRequest.class))).thenReturn(Promises.<ActionResponse, ResourceException>newResultPromise(newActionResponse((json(object(field("ttl", "1234567890")))))));
    when(requestHandler.handleCreate(any(Context.class), any(CreateRequest.class))).thenReturn(Promises.<ResourceResponse, ResourceException>newResultPromise(newResourceResponse("A", "1", (json(object(field("resourceTypeUuid", "abc-def-hij")))))));
    when(requestHandler.handleUpdate(any(Context.class), any(UpdateRequest.class))).thenReturn(Promises.<ResourceResponse, ResourceException>newResultPromise(newResourceResponse("A", "1", (json(object(field("resourceTypeUuid", "abc-def-hij")))))));
    when(requestHandler.handleRead(any(Context.class), any(ReadRequest.class))).thenReturn(Promises.<ResourceResponse, ResourceException>newResultPromise(newResourceResponse("A", "1", (json(object(field("resourceTypeUuid", "abc-def-hij")))))));
}
Also used : EntitlementsExceptionMappingHandler(org.forgerock.openam.entitlement.rest.EntitlementsExceptionMappingHandler) Context(org.forgerock.services.context.Context) PolicyV1Filter(org.forgerock.openam.entitlement.rest.PolicyV1Filter) ActionRequest(org.forgerock.json.resource.ActionRequest) UpdateRequest(org.forgerock.json.resource.UpdateRequest) CreateRequest(org.forgerock.json.resource.CreateRequest) Subject(javax.security.auth.Subject) ReadRequest(org.forgerock.json.resource.ReadRequest) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

Subject (javax.security.auth.Subject)1 ActionRequest (org.forgerock.json.resource.ActionRequest)1 CreateRequest (org.forgerock.json.resource.CreateRequest)1 ReadRequest (org.forgerock.json.resource.ReadRequest)1 UpdateRequest (org.forgerock.json.resource.UpdateRequest)1 EntitlementsExceptionMappingHandler (org.forgerock.openam.entitlement.rest.EntitlementsExceptionMappingHandler)1 PolicyV1Filter (org.forgerock.openam.entitlement.rest.PolicyV1Filter)1 Context (org.forgerock.services.context.Context)1 BeforeMethod (org.testng.annotations.BeforeMethod)1