public final class TestWorkflowEnvironmentInternal extends java.lang.Object implements TestWorkflowEnvironment
| Constructor and Description |
|---|
TestWorkflowEnvironmentInternal(TestEnvironmentOptions options) |
| Modifier and Type | Method and Description |
|---|---|
void |
awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit)
Blocks until all tasks have completed execution after a shutdown request, or the timeout
occurs, or the current thread is interrupted, whichever happens first.
|
void |
close()
|
long |
currentTimeMillis()
Returns the current in-memory test Temporal service time in milliseconds.
|
java.lang.String |
getDiagnostics()
Returns the diagnostic data about the internal service state.
|
java.lang.String |
getNamespace() |
io.temporal.worker.WorkerFactory |
getWorkerFactory() |
io.temporal.client.WorkflowClient |
getWorkflowClient()
Creates a WorkflowClient that is connected to the in-memory test Temporal service.
|
io.temporal.serviceclient.WorkflowServiceStubs |
getWorkflowService()
Returns the in-memory test Temporal service that is owned by this.
|
boolean |
isShutdown()
|
boolean |
isStarted()
Was
TestWorkflowEnvironment.start() called? |
boolean |
isTerminated()
Are all tasks done after
TestWorkflowEnvironment.shutdownNow() or TestWorkflowEnvironment.shutdown()? |
io.temporal.worker.Worker |
newWorker(java.lang.String taskQueue)
Creates a new Worker instance that is connected to the in-memory test Temporal service.
|
io.temporal.worker.Worker |
newWorker(java.lang.String taskQueue,
io.temporal.worker.WorkerOptions options)
Creates a new Worker instance that is connected to the in-memory test Temporal service.
|
void |
registerDelayedCallback(java.time.Duration delay,
java.lang.Runnable r)
Registers a callback to run after the specified delay according to the test Temporal service
internal clock.
|
void |
shutdown()
Initiates an orderly shutdown in which polls are stopped and already received workflow and
activity tasks are executed.
|
void |
shutdownNow()
Initiates an orderly shutdown in which polls are stopped and already received workflow and
activity tasks are attempted to be stopped.
|
void |
sleep(java.time.Duration duration)
Wait until internal test Temporal service time passes the specified duration.
|
void |
start()
Start all workers created by this factory.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitnewInstance, newInstancepublic TestWorkflowEnvironmentInternal(TestEnvironmentOptions options)
public io.temporal.worker.Worker newWorker(java.lang.String taskQueue)
TestWorkflowEnvironmentnewWorker in interface TestWorkflowEnvironmenttaskQueue - task queue to poll.public io.temporal.worker.Worker newWorker(java.lang.String taskQueue,
io.temporal.worker.WorkerOptions options)
TestWorkflowEnvironmentnewWorker in interface TestWorkflowEnvironmenttaskQueue - task queue to poll.public io.temporal.client.WorkflowClient getWorkflowClient()
TestWorkflowEnvironmentgetWorkflowClient in interface TestWorkflowEnvironmentpublic long currentTimeMillis()
TestWorkflowEnvironmentSystem.currentTimeMillis() due to time skipping.currentTimeMillis in interface TestWorkflowEnvironmentpublic void sleep(java.time.Duration duration)
TestWorkflowEnvironmentsleep in interface TestWorkflowEnvironmentpublic void registerDelayedCallback(java.time.Duration delay,
java.lang.Runnable r)
TestWorkflowEnvironmentregisterDelayedCallback in interface TestWorkflowEnvironmentpublic io.temporal.serviceclient.WorkflowServiceStubs getWorkflowService()
TestWorkflowEnvironmentgetWorkflowService in interface TestWorkflowEnvironmentpublic java.lang.String getNamespace()
getNamespace in interface TestWorkflowEnvironmentpublic java.lang.String getDiagnostics()
TestWorkflowEnvironment
@Rule
public TestWatcher watchman =
new TestWatcher() {
@Override
protected void failed(Throwable e, Description description) {
System.err.println(testEnvironment.getDiagnostics());
testEnvironment.close();
}
};
getDiagnostics in interface TestWorkflowEnvironmentpublic void close()
TestWorkflowEnvironmentTestWorkflowEnvironment.shutdownNow() and TestWorkflowEnvironment.awaitTermination(long, TimeUnit).close in interface TestWorkflowEnvironmentpublic void start()
TestWorkflowEnvironmentstart in interface TestWorkflowEnvironmentpublic boolean isStarted()
TestWorkflowEnvironmentTestWorkflowEnvironment.start() called?isStarted in interface TestWorkflowEnvironmentpublic boolean isShutdown()
TestWorkflowEnvironmentisShutdown in interface TestWorkflowEnvironmentpublic boolean isTerminated()
TestWorkflowEnvironmentTestWorkflowEnvironment.shutdownNow() or TestWorkflowEnvironment.shutdown()?isTerminated in interface TestWorkflowEnvironmentpublic void shutdown()
TestWorkflowEnvironmentActivityExecutionContext.heartbeat(Object) start throwing ActivityWorkerShutdownException. Invocation has no additional effect if
already shut down. This method does not wait for previously received tasks to complete
execution. Use TestWorkflowEnvironment.awaitTermination(long, TimeUnit) to do that.shutdown in interface TestWorkflowEnvironmentpublic void shutdownNow()
TestWorkflowEnvironmentActivityExecutionContext.heartbeat(Object) start throwing ActivityWorkerShutdownException. Invocation has no additional effect if
already shut down. This method does not wait for previously received tasks to complete
execution. Use TestWorkflowEnvironment.awaitTermination(long, TimeUnit) to do that.shutdownNow in interface TestWorkflowEnvironmentpublic void awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit)
TestWorkflowEnvironmentawaitTermination in interface TestWorkflowEnvironmentpublic io.temporal.worker.WorkerFactory getWorkerFactory()
getWorkerFactory in interface TestWorkflowEnvironment