protected final <T> Callable<T> wrap(Callable<T> delegate) { return DelegatingSecurityContextCallable.create(delegate, securityContext); } }
private ScheduledExecutorService getDelegate() { return (ScheduledExecutorService) getDelegateExecutor(); } }
private ExecutorService getDelegate() { return (ExecutorService) getDelegateExecutor(); } }
@Test public void callOnSameThread() throws Exception { originalSecurityContext = securityContext; SecurityContextHolder.setContext(originalSecurityContext); executor = synchronousExecutor(); runnable = new DelegatingSecurityContextRunnable(delegate, securityContext); assertWrapped(runnable); }
@Test public void call() throws Exception { callable = new DelegatingSecurityContextCallable<>(delegate, securityContext); assertWrapped(callable); }
@Test public void call() throws Exception { runnable = new DelegatingSecurityContextRunnable(delegate, securityContext); assertWrapped(runnable); }
@Test public void create() throws Exception { runnable = DelegatingSecurityContextRunnable.create(delegate, securityContext); assertWrapped(runnable); }
@Test public void create() throws Exception { callable = DelegatingSecurityContextCallable.create(delegate, securityContext); assertWrapped(callable); }
@Override protected DelegatingSecurityContextExecutorService create() { return new DelegatingSecurityContextExecutorService(delegate); } }
protected final Runnable wrap(Runnable delegate) { return DelegatingSecurityContextRunnable.create(delegate, securityContext); }
@Override protected DelegatingSecurityContextExecutor create() { return new DelegatingSecurityContextExecutor(getExecutor()); } }
@Override protected DelegatingSecurityContextExecutor create() { return new DelegatingSecurityContextExecutor(getExecutor(), securityContext); } }
@Override protected DelegatingSecurityContextScheduledExecutorService create() { return new DelegatingSecurityContextScheduledExecutorService(delegate, securityContext); } }
@Test public void wrapCallableNullSecurityContext() throws Exception { currentSecurityContextPowermockSetup(); support = new ConcreteDelegatingSecurityContextSupport(null); assertThat(support.wrap(callable)).isSameAs(wrappedCallable); }
@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); runnable = DelegatingSecurityContextRunnable.create(delegate, null); SecurityContextHolder.clearContext(); // ensure runnable is what sets up the // SecurityContextHolder assertWrapped(runnable); }
@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); }
@Override protected DelegatingSecurityContextExecutorService create() { return new DelegatingSecurityContextExecutorService(delegate, securityContext); } }
@Override protected DelegatingSecurityContextScheduledExecutorService create() { return new DelegatingSecurityContextScheduledExecutorService(delegate); }
@Test public void wrapRunnableNullSecurityContext() throws Exception { currentSecurityContextPowermockSetup(); support = new ConcreteDelegatingSecurityContextSupport(null); assertThat(support.wrap(runnable)).isSameAs(wrappedRunnable); }