use of com.uber.cadence.testing.TestEnvironmentOptions.Builder in project cadence-client by uber-java.
the class WorkflowTest method setUp.
@Before
public void setUp() {
if (testName.getMethodName().equals("testExecute[TestService]") || testName.getMethodName().equals("testStart[TestService]")) {
taskList = ANNOTATION_TASK_LIST;
} else {
taskList = "WorkflowTest-" + testName.getMethodName();
}
if (useExternalService) {
worker = new Worker(domain, taskList);
workflowClient = WorkflowClient.newInstance(domain);
WorkflowClientOptions clientOptions = new WorkflowClientOptions.Builder().setDataConverter(JsonDataConverter.getInstance()).build();
workflowClientWithOptions = WorkflowClient.newInstance(domain, clientOptions);
scheduledExecutor = new ScheduledThreadPoolExecutor(1);
} else {
TestEnvironmentOptions testOptions = new Builder().setDomain(domain).build();
testEnvironment = TestWorkflowEnvironment.newInstance(testOptions);
worker = testEnvironment.newWorker(taskList);
workflowClient = testEnvironment.newWorkflowClient();
workflowClientWithOptions = testEnvironment.newWorkflowClient();
}
ActivityCompletionClient completionClient = workflowClient.newActivityCompletionClient();
activitiesImpl = new TestActivitiesImpl(completionClient);
worker.registerActivitiesImplementations(activitiesImpl);
newWorkflowOptionsBuilder(taskList);
newActivityOptions1(taskList);
activitiesImpl.invocations.clear();
activitiesImpl.procResult.clear();
}
Aggregations