private void assertWrapped(Callable<Object> callable) throws Exception { Future<Object> submit = executor.submit(callable); assertWrapped(submit.get()); }
@Test public void create() throws Exception { callable = DelegatingSecurityContextCallable.create(delegate, securityContext); assertWrapped(callable); }
@Test public void call() throws Exception { callable = new DelegatingSecurityContextCallable<>(delegate, securityContext); assertWrapped(callable); }
@Test public void callOnSameThread() throws Exception { originalSecurityContext = securityContext; SecurityContextHolder.setContext(originalSecurityContext); callable = new DelegatingSecurityContextCallable<>(delegate, securityContext); assertWrapped(callable.call()); }
@Test public void callDefaultSecurityContext() throws Exception { SecurityContextHolder.setContext(securityContext); callable = new DelegatingSecurityContextCallable<>(delegate); SecurityContextHolder.clearContext(); // ensure callable is what sets up the // SecurityContextHolder assertWrapped(callable); }
@Test public void createNullSecurityContext() throws Exception { SecurityContextHolder.setContext(securityContext); callable = DelegatingSecurityContextCallable.create(delegate, null); SecurityContextHolder.clearContext(); // ensure callable is what sets up the // SecurityContextHolder assertWrapped(callable); }