Class ExecutionContextExtension
- java.lang.Object
-
- io.servicetalk.transport.netty.internal.ExecutionContextExtension
-
- All Implemented Interfaces:
ExecutionContext
,org.junit.jupiter.api.extension.AfterAllCallback
,org.junit.jupiter.api.extension.AfterEachCallback
,org.junit.jupiter.api.extension.BeforeAllCallback
,org.junit.jupiter.api.extension.BeforeEachCallback
,org.junit.jupiter.api.extension.Extension
public final class ExecutionContextExtension extends java.lang.Object implements org.junit.jupiter.api.extension.AfterEachCallback, org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.AfterAllCallback, org.junit.jupiter.api.extension.BeforeAllCallback, ExecutionContext
Test helper that creates and disposes anExecutionContext
for your test case or suite.Can be used with a @
RegisterExtension
field.
-
-
Constructor Summary
Constructors Constructor Description ExecutionContextExtension(java.util.function.Supplier<BufferAllocator> allocatorSupplier, java.util.function.Supplier<IoExecutor> ioExecutorSupplier, java.util.function.Supplier<Executor> executorSupplier)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterAll(org.junit.jupiter.api.extension.ExtensionContext context)
void
afterEach(org.junit.jupiter.api.extension.ExtensionContext context)
void
beforeAll(org.junit.jupiter.api.extension.ExtensionContext context)
void
beforeEach(org.junit.jupiter.api.extension.ExtensionContext context)
BufferAllocator
bufferAllocator()
Return theBufferAllocator
that can be used to allocateBuffer
s if needed.static ExecutionContextExtension
cached()
static ExecutionContextExtension
cached(java.lang.String ioThreadPrefix, java.lang.String executorThreadPrefix)
static ExecutionContextExtension
cached(java.util.concurrent.ThreadFactory ioThreadFactory)
ExecutionStrategy
executionStrategy()
Returns theExecutionStrategy
associated with this context.Executor
executor()
Get theExecutor
that is used to create any asynchronous sources.static ExecutionContextExtension
immediate()
IoExecutor
ioExecutor()
Get theIoExecutor
that is used to handle the IO.ExecutionContextExtension
setClassLevel(boolean classLevel)
static ExecutionContextExtension
single()
static ExecutionContextExtension
single(java.util.concurrent.ThreadFactory ioThreadFactory)
-
-
-
Constructor Detail
-
ExecutionContextExtension
public ExecutionContextExtension(java.util.function.Supplier<BufferAllocator> allocatorSupplier, java.util.function.Supplier<IoExecutor> ioExecutorSupplier, java.util.function.Supplier<Executor> executorSupplier)
-
-
Method Detail
-
immediate
public static ExecutionContextExtension immediate()
-
cached
public static ExecutionContextExtension cached()
-
cached
public static ExecutionContextExtension cached(java.util.concurrent.ThreadFactory ioThreadFactory)
-
cached
public static ExecutionContextExtension cached(java.lang.String ioThreadPrefix, java.lang.String executorThreadPrefix)
-
single
public static ExecutionContextExtension single()
-
single
public static ExecutionContextExtension single(java.util.concurrent.ThreadFactory ioThreadFactory)
-
setClassLevel
public ExecutionContextExtension setClassLevel(boolean classLevel)
-
bufferAllocator
public BufferAllocator bufferAllocator()
Description copied from interface:ExecutionContext
Return theBufferAllocator
that can be used to allocateBuffer
s if needed.- Specified by:
bufferAllocator
in interfaceExecutionContext
- Returns:
- the
BufferAllocator
to use
-
ioExecutor
public IoExecutor ioExecutor()
Description copied from interface:ExecutionContext
Get theIoExecutor
that is used to handle the IO.- Specified by:
ioExecutor
in interfaceExecutionContext
- Returns:
- The
IoExecutor
that is used to handle the.
-
executor
public Executor executor()
Description copied from interface:ExecutionContext
Get theExecutor
that is used to create any asynchronous sources.- Specified by:
executor
in interfaceExecutionContext
- Returns:
- The
Executor
that is used to create any asynchronous sources.
-
executionStrategy
public ExecutionStrategy executionStrategy()
Description copied from interface:ExecutionContext
Returns theExecutionStrategy
associated with this context.- Specified by:
executionStrategy
in interfaceExecutionContext
- Returns:
- The
ExecutionStrategy
associated with this context.
-
afterEach
public void afterEach(org.junit.jupiter.api.extension.ExtensionContext context)
- Specified by:
afterEach
in interfaceorg.junit.jupiter.api.extension.AfterEachCallback
-
beforeEach
public void beforeEach(org.junit.jupiter.api.extension.ExtensionContext context)
- Specified by:
beforeEach
in interfaceorg.junit.jupiter.api.extension.BeforeEachCallback
-
afterAll
public void afterAll(org.junit.jupiter.api.extension.ExtensionContext context)
- Specified by:
afterAll
in interfaceorg.junit.jupiter.api.extension.AfterAllCallback
-
beforeAll
public void beforeAll(org.junit.jupiter.api.extension.ExtensionContext context)
- Specified by:
beforeAll
in interfaceorg.junit.jupiter.api.extension.BeforeAllCallback
-
-