Class TestEnvironmentOptions.Builder
java.lang.Object
io.temporal.testing.TestEnvironmentOptions.Builder
- Enclosing class:
TestEnvironmentOptions
-
Method Summary
Modifier and TypeMethodDescriptionbuild()registerSearchAttribute(String name, io.temporal.api.enums.v1.IndexedValueType type) Add a search attribute to be registered on the Temporal Server.setActivityClientOptions(io.temporal.client.ActivityClientOptions activityClientOptions) setInitialTime(Instant initialTime) Set the initial time for the workflow virtual clock.setInitialTimeMillis(long initialTimeMillis) Set the initial time for the workflow virtual clock, milliseconds since epoch.setMetricsScope(com.uber.m3.tally.Scope metricsScope) Sets the scope to be used for metrics reporting.Optional parameter that defines an endpoint which will be used for the communication with standalone temporal service.setUseExternalService(boolean useExternalService) Set to true in order to make test environment use external temporal service or false for in-memory test implementation.setUseTimeskipping(boolean useTimeskipping) Sets whether the TestWorkflowEnvironment will timeskip.setWorkerFactoryOptions(io.temporal.worker.WorkerFactoryOptions options) Set factoryOptions for worker factory used to create workers.setWorkflowClientOptions(io.temporal.client.WorkflowClientOptions workflowClientOptions) setWorkflowServiceStubsOptions(io.temporal.serviceclient.WorkflowServiceStubsOptions options)
-
Method Details
-
setWorkflowClientOptions
public TestEnvironmentOptions.Builder setWorkflowClientOptions(io.temporal.client.WorkflowClientOptions workflowClientOptions) -
setActivityClientOptions
public TestEnvironmentOptions.Builder setActivityClientOptions(io.temporal.client.ActivityClientOptions activityClientOptions) -
setWorkerFactoryOptions
public TestEnvironmentOptions.Builder setWorkerFactoryOptions(io.temporal.worker.WorkerFactoryOptions options) Set factoryOptions for worker factory used to create workers. -
setWorkflowServiceStubsOptions
public TestEnvironmentOptions.Builder setWorkflowServiceStubsOptions(io.temporal.serviceclient.WorkflowServiceStubsOptions options) -
setMetricsScope
Sets the scope to be used for metrics reporting. Optional. Default is to not report metrics.Note: Don't mock
Scopein tests! If you need to verify the metrics behavior, create a real Scope and mock, stub or spy a reporter instance:
StatsReporter reporter = mock(StatsReporter.class); Scope metricsScope = new RootScopeBuilder() .reporter(reporter) .reportEvery(com.uber.m3.util.Duration.ofMillis(10));- Parameters:
metricsScope- the scope to be used for metrics reporting.- Returns:
this
-
setUseExternalService
Set to true in order to make test environment use external temporal service or false for in-memory test implementation. -
setTarget
Optional parameter that defines an endpoint which will be used for the communication with standalone temporal service. Has no effect ifuseExternalServiceis set to false.Defaults to 127.0.0.1:7233
-
setInitialTimeMillis
Set the initial time for the workflow virtual clock, milliseconds since epoch.Default is current time
-
setInitialTime
Set the initial time for the workflow virtual clock.Default is current time
-
setUseTimeskipping
Sets whether the TestWorkflowEnvironment will timeskip. If true, no actual wall-clock time will pass when a workflow sleeps or sets a timer.Default is true
-
registerSearchAttribute
public TestEnvironmentOptions.Builder registerSearchAttribute(String name, io.temporal.api.enums.v1.IndexedValueType type) Add a search attribute to be registered on the Temporal Server.- Parameters:
name- name of the search attributetype- search attribute type- Returns:
this- See Also:
-
build
-
validateAndBuildWithDefaults
-