Search in sources :

Example 6 with PatchRequest

use of org.forgerock.json.resource.PatchRequest in project OpenAM by OpenRock.

the class UmaPolicyResourceTest method shouldThrowNotSupportedExceptionForPatchInstance.

@Test
@SuppressWarnings("unchecked")
public void shouldThrowNotSupportedExceptionForPatchInstance() {
    //Given
    Context context = mock(Context.class);
    PatchRequest request = Requests.newPatchRequest("/policies");
    //When
    Promise<ResourceResponse, ResourceException> result = policyResource.patchInstance(context, "RESOURCE_SET_UID", request);
    //Then
    assertThat(result).failedWithResourceException().isInstanceOf(NotSupportedException.class);
}
Also used : Context(org.forgerock.services.context.Context) ResourceResponse(org.forgerock.json.resource.ResourceResponse) ResourceException(org.forgerock.json.resource.ResourceException) PatchRequest(org.forgerock.json.resource.PatchRequest) Test(org.testng.annotations.Test)

Example 7 with PatchRequest

use of org.forgerock.json.resource.PatchRequest in project OpenAM by OpenRock.

the class ResourceSetResourceTest method patchShouldNotBeSupported.

@Test
public void patchShouldNotBeSupported() {
    //Given
    Context context = mock(Context.class);
    PatchRequest request = mock(PatchRequest.class);
    //When
    Promise<ResourceResponse, ResourceException> promise = resource.patchInstance(context, "RESOURCE_SET_UID", request);
    //Then
    assertThat(promise).failedWithException().isInstanceOf(NotSupportedException.class);
}
Also used : Context(org.forgerock.services.context.Context) ResourceResponse(org.forgerock.json.resource.ResourceResponse) ResourceException(org.forgerock.json.resource.ResourceException) PatchRequest(org.forgerock.json.resource.PatchRequest) Test(org.testng.annotations.Test)

Aggregations

PatchRequest (org.forgerock.json.resource.PatchRequest)7 ResourceException (org.forgerock.json.resource.ResourceException)5 ResourceResponse (org.forgerock.json.resource.ResourceResponse)5 Context (org.forgerock.services.context.Context)5 Test (org.testng.annotations.Test)5 JsonValue (org.forgerock.json.JsonValue)2 RealmContext (org.forgerock.openam.rest.RealmContext)2 DelegationPermission (com.sun.identity.delegation.DelegationPermission)1 HashSet (java.util.HashSet)1 UriRouterContext (org.forgerock.http.routing.UriRouterContext)1 ActionRequest (org.forgerock.json.resource.ActionRequest)1 CreateRequest (org.forgerock.json.resource.CreateRequest)1 DeleteRequest (org.forgerock.json.resource.DeleteRequest)1 FilterChain (org.forgerock.json.resource.FilterChain)1 QueryRequest (org.forgerock.json.resource.QueryRequest)1 QueryResourceHandler (org.forgerock.json.resource.QueryResourceHandler)1 ReadRequest (org.forgerock.json.resource.ReadRequest)1 RequestHandler (org.forgerock.json.resource.RequestHandler)1 Router (org.forgerock.json.resource.Router)1 UpdateRequest (org.forgerock.json.resource.UpdateRequest)1