@Test public void testHandleSimpleGetInvalidateViewer() throws Exception { String path = "/cache/invalidate"; RestHandler operation = registry.getRestHandler(path, "GET"); invalidationService.invalidateUserResources( eq(ImmutableSet.of("userX")), eq(token)); expectLastCall(); replay(); operation.execute(params, null, token, converter).get(); verify(); reset(); }
@Test public void testHandleSimpleGetInvalidateViewer() throws Exception { String path = "/cache/invalidate"; RestHandler operation = registry.getRestHandler(path, "GET"); invalidationService.invalidateUserResources( eq(ImmutableSet.of("userX")), eq(token)); expectLastCall(); replay(); operation.execute(params, null, token, converter).get(); verify(); reset(); }
@Test public void testHandleSimpleGetInvalidateViewer() throws Exception { String path = "/cache/invalidate"; RestHandler operation = registry.getRestHandler(path, "GET"); invalidationService.invalidateUserResources( eq(ImmutableSet.of("userX")), eq(token)); expectLastCall(); replay(); operation.execute(params, null, token, converter).get(); verify(); reset(); }
@Test public void testAllowConsumerAuthInvalidateAppResource() throws Exception { String path = "/cache/invalidate"; RestHandler operation = registry.getRestHandler(path, "POST"); params.put(InvalidationHandler.KEYS_PARAM, new String[]{"http://www.example.org/gadget.xml"}); token.setAuthenticationMode(AuthenticationMode.OAUTH_CONSUMER_REQUEST.name()); invalidationService.invalidateApplicationResources( eq(ImmutableSet.of(Uri.parse("http://www.example.org/gadget.xml"))), eq(token)); expectLastCall(); replay(); operation.execute(params, null, token, converter).get(); verify(); reset(); }
@Test public void testAllowConsumerAuthInvalidateAppResource() throws Exception { String path = "/cache/invalidate"; RestHandler operation = registry.getRestHandler(path, "POST"); params.put(InvalidationHandler.KEYS_PARAM, new String[]{"http://www.example.org/gadget.xml"}); token.setAuthenticationMode(AuthenticationMode.OAUTH_CONSUMER_REQUEST.name()); invalidationService.invalidateApplicationResources( eq(ImmutableSet.of(Uri.parse("http://www.example.org/gadget.xml"))), eq(token)); expectLastCall(); replay(); operation.execute(params, null, token, converter).get(); verify(); reset(); }
@Test public void testAllowConsumerAuthInvalidateAppResource() throws Exception { String path = "/cache/invalidate"; RestHandler operation = registry.getRestHandler(path, "POST"); params.put(InvalidationHandler.KEYS_PARAM, new String[]{"http://www.example.org/gadget.xml"}); token.setAuthenticationMode(AuthenticationMode.OAUTH_CONSUMER_REQUEST.name()); invalidationService.invalidateApplicationResources( eq(ImmutableSet.of(Uri.parse("http://www.example.org/gadget.xml"))), eq(token)); expectLastCall(); replay(); operation.execute(params, null, token, converter).get(); verify(); reset(); }