public class ThreadContextTest
extends org.jboss.arquillian.testng.Arquillian
Constructor and Description |
---|
ThreadContextTest() |
Modifier and Type | Method and Description |
---|---|
void |
after() |
void |
afterMethod(Method m,
org.testng.ITestResult result) |
void |
before() |
void |
beforeMethod(Method m) |
void |
builderForThreadContextIsProvided() |
void |
clearTransactionContextJTA()
Verify that if JTA transactions are supported, then configuring cleared=TRANSACTION
results in the active transaction being suspended before running a task and resumed afterward,
such that a task can use its own transactions if so desired.
|
void |
clearUnspecifiedContexts()
Verify that the ThreadContext implementation clears context
types that are not configured under propagated, unchanged, or cleared.
|
void |
contextControlsForThreadContextBuilder()
Verify the MicroProfile Context Propagation implementation of propagate(), cleared(), and unchanged()
for ThreadContext.Builder.
|
void |
contextualBiConsumerRunsWithContext()
Verify that the ThreadContext's contextualConsumer
method can be used to wrap a BiConsumer instance with the context that is captured from the
current thread per the configuration of the ThreadContext builder, and that the context is
applied when the BiConsumer accept method runs.
|
void |
contextualBiFunctionRunsWithContext()
Verify that the ThreadContext's contextualFunction
method can be used to wrap a BiFunction instance with the context that is captured from the
current thread per the configuration of the ThreadContext builder, and that the context is
applied when the BiFunction apply method runs.
|
void |
contextualCallableRunsWithContext()
Verify that the ThreadContext's contextualCallable
method can be used to wrap a Callable instance with the context that is captured from the
current thread per the configuration of the ThreadContext builder, and that the context is
applied when the Callable call method runs.
|
void |
contextualConsumerRunsWithContext()
Verify that the ThreadContext's contextualConsumer
method can be used to wrap a Consumer instance with the context that is captured from the
current thread per the configuration of the ThreadContext builder, and that the context is
applied when the Consumer accept method runs.
|
void |
contextualFunctionRunsWithContext()
Verify that the ThreadContext's contextualFunction
method can be used to wrap a Function instance with the context that is captured from the
current thread per the configuration of the ThreadContext builder, and that the context is
applied when the Function apply method runs.
|
void |
contextualRunnableRunsWithContext()
Verify that the ThreadContext's contextualRunnable
method can be used to wrap a Runnable instance with the context that is captured from the
current thread per the configuration of the ThreadContext builder, and that the context is
applied when the Runnable run method runs.
|
void |
contextualSupplierRunsWithContext()
Verify that the ThreadContext's contextualSupplier
method can be used to wrap a Supplier instance with the context that is captured from the
current thread per the configuration of the ThreadContext builder, and that the context is
applied when the Supplier get method runs.
|
static org.jboss.shrinkwrap.api.spec.WebArchive |
createDeployment() |
void |
currentContextExecutorRunsWithContext()
Verify that the ThreadContext's currentContextExecutor
method can be used to create an Executor instance with the context that is captured from the
current thread per the configuration of the ThreadContext builder, and that the context is
applied to the thread where the Executor's execute method runs.
|
void |
reuseThreadContextBuilder()
Verify that the ThreadContext.Builder can be used to create multiple ThreadContexts with
different configured contexts.
|
void |
thirdPartyContextProvidersAreIncludedInThreadContext()
Verify that the MicroProfile Context Propagation implementation finds third-party thread context providers
that are made available to the ServiceLoader, allows their configuration via the ThreadContext builder,
and correctly captures and propagates or clears these thread context types per the builder configuration.
|
void |
unchangedContextListDefaultsToEmpty()
It is optional to specify the set of unchanged context.
|
void |
withContextCaptureDependentCompletableFuturesRunWithContext()
Verify that the ThreadContext's withContextCapture
method can be used to create a dependent CompletableFuture instance that completes when the
original stage completes and runs dependent stage actions with context that is captured
from the thread that creates the dependent stage.
|
void |
withContextCaptureDependentCompletionStagesRunWithContext()
Verify that the ThreadContext's withContextCapture
method can be used to create a dependent CompletionStage instance that completes when the
original stage completes and runs dependent stage actions with context that is captured
from the thread that creates the dependent stage.
|
void |
withContextCaptureDependentStageForcedCompletion()
Verify that dependent stages created via withContextCapture can be completed independently
of the original stage.
|
void |
withContextCaptureMultipleThreadContexts()
The withContextCapture method should be able to create multiple dependent stages
having a single parent stage, where each of the dependent stages propagates a
different set of thread context.
|
void |
withContextCaptureSwitchThreadContext()
The withContextCapture method should be able to create a dependent stage that is
associated with a thread context even if its parent stage is already associated with
a different thread context.
|
void |
withDefaultExecutorServiceContextCanInvokeAsyncActions()
Verify that the presence of a default executor service allows contextualised CompletableFuture/CompletionStage
to run async actions on them, and that they are running on that executor service.
|
void |
withoutDefaultExecutorServiceContextCannotInvokeAsyncActions()
Verify that the lack of a default executor service bans contextualised CompletableFuture/CompletionStage
from running async actions on them.
|
@AfterClass public void after()
@AfterMethod public void afterMethod(Method m, org.testng.ITestResult result)
@BeforeClass public void before()
@BeforeMethod public void beforeMethod(Method m)
@Deployment public static org.jboss.shrinkwrap.api.spec.WebArchive createDeployment()
public void builderForThreadContextIsProvided()
public void clearTransactionContextJTA() throws Exception
UserTransaction
via JNDI and via CDI.
Should neither work, it still doesn't throw exception but instead returns.Exception
- indicates test failurepublic void clearUnspecifiedContexts() throws Exception
Exception
- indicates test failurepublic void contextualBiConsumerRunsWithContext() throws InterruptedException
InterruptedException
- indicates test failurepublic void contextualBiFunctionRunsWithContext() throws ExecutionException, InterruptedException, TimeoutException
ExecutionException
- indicates test failureInterruptedException
- indicates test failureTimeoutException
- indicates test failurepublic void contextualCallableRunsWithContext() throws ExecutionException, InterruptedException, TimeoutException
ExecutionException
- indicates test failureInterruptedException
- indicates test failureTimeoutException
- indicates test failurepublic void contextualConsumerRunsWithContext() throws InterruptedException
InterruptedException
- indicates test failurepublic void contextualFunctionRunsWithContext() throws ExecutionException, InterruptedException, TimeoutException
ExecutionException
- indicates test failureInterruptedException
- indicates test failureTimeoutException
- indicates test failurepublic void contextualRunnableRunsWithContext() throws ExecutionException, InterruptedException, TimeoutException
ExecutionException
- indicates test failureInterruptedException
- indicates test failureTimeoutException
- indicates test failurepublic void contextualSupplierRunsWithContext() throws InterruptedException
InterruptedException
- indicates test failurepublic void reuseThreadContextBuilder() throws Exception
Exception
- indicates test failurepublic void unchangedContextListDefaultsToEmpty()
public void thirdPartyContextProvidersAreIncludedInThreadContext()
public void withContextCaptureDependentCompletableFuturesRunWithContext() throws ExecutionException, InterruptedException, TimeoutException
ExecutionException
- indicates test failureInterruptedException
- indicates test failureTimeoutException
- indicates test failurepublic void withContextCaptureDependentCompletionStagesRunWithContext() throws ExecutionException, InterruptedException, TimeoutException
ExecutionException
- indicates test failureInterruptedException
- indicates test failureTimeoutException
- indicates test failurepublic void withContextCaptureDependentStageForcedCompletion() throws ExecutionException, InterruptedException
ExecutionException
- indicates test failureInterruptedException
- indicates test failurepublic void withContextCaptureMultipleThreadContexts() throws ExecutionException, InterruptedException, TimeoutException
ExecutionException
- indicates test failureInterruptedException
- indicates test failureTimeoutException
- indicates test failurepublic void withContextCaptureSwitchThreadContext() throws ExecutionException, InterruptedException, TimeoutException
ExecutionException
- indicates test failureInterruptedException
- indicates test failureTimeoutException
- indicates test failurepublic void contextControlsForThreadContextBuilder() throws InterruptedException, ExecutionException, TimeoutException
ExecutionException
- indicates test failureInterruptedException
- indicates test failureTimeoutException
- indicates test failurepublic void currentContextExecutorRunsWithContext() throws InterruptedException, ExecutionException, TimeoutException
ExecutionException
- indicates test failureInterruptedException
- indicates test failureTimeoutException
- indicates test failurepublic void withDefaultExecutorServiceContextCanInvokeAsyncActions() throws ExecutionException, InterruptedException, TimeoutException
ExecutionException
- indicates test failureInterruptedException
- indicates test failureTimeoutException
- indicates test failurepublic void withoutDefaultExecutorServiceContextCannotInvokeAsyncActions() throws ExecutionException, InterruptedException, TimeoutException
ExecutionException
- indicates test failureInterruptedException
- indicates test failureTimeoutException
- indicates test failureCopyright © 2021 Eclipse Foundation. All rights reserved.