Search in sources :

Example 1 with Builder

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();
}
Also used : TestEnvironmentOptions(com.uber.cadence.testing.TestEnvironmentOptions) ActivityCompletionClient(com.uber.cadence.client.ActivityCompletionClient) WorkflowClientOptions(com.uber.cadence.client.WorkflowClientOptions) ScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor) Builder(com.uber.cadence.testing.TestEnvironmentOptions.Builder) Worker(com.uber.cadence.worker.Worker) Before(org.junit.Before)

Aggregations

ActivityCompletionClient (com.uber.cadence.client.ActivityCompletionClient)1 WorkflowClientOptions (com.uber.cadence.client.WorkflowClientOptions)1 TestEnvironmentOptions (com.uber.cadence.testing.TestEnvironmentOptions)1 Builder (com.uber.cadence.testing.TestEnvironmentOptions.Builder)1 Worker (com.uber.cadence.worker.Worker)1 ScheduledThreadPoolExecutor (java.util.concurrent.ScheduledThreadPoolExecutor)1 Before (org.junit.Before)1