use of io.temporal.internal.testservice.TestWorkflowService in project sdk-java by temporalio.
the class WorkflowCachingTest method setUp.
@Before
public void setUp() {
testService = new TestWorkflowService();
testService.lockTimeSkipping(CALLER);
service = testService.newClientStub();
}
use of io.temporal.internal.testservice.TestWorkflowService in project sdk-java by temporalio.
the class PollWorkflowTaskDispatcherTests method setUp.
@Before
public void setUp() {
testService = new TestWorkflowService();
service = testService.newClientStub();
}
use of io.temporal.internal.testservice.TestWorkflowService in project sdk-java by temporalio.
the class HistoryUtils method generateWorkflowTaskWithPartialHistory.
public static PollWorkflowTaskQueueResponse generateWorkflowTaskWithPartialHistory(String namespace, String taskqueueName, String workflowType) throws Exception {
TestWorkflowService testService = new TestWorkflowService(true);
WorkflowServiceStubs service = testService.newClientStub();
try {
PollWorkflowTaskQueueResponse response = generateWorkflowTaskWithInitialHistory(namespace, taskqueueName, workflowType, service);
return generateWorkflowTaskWithPartialHistoryFromExistingTask(response, namespace, HOST_TASK_QUEUE, service);
} finally {
service.shutdownNow();
service.awaitTermination(1, TimeUnit.SECONDS);
testService.close();
}
}
use of io.temporal.internal.testservice.TestWorkflowService in project sdk-java by temporalio.
the class HistoryUtils method generateWorkflowTaskWithInitialHistory.
public static PollWorkflowTaskQueueResponse generateWorkflowTaskWithInitialHistory() throws Exception {
TestWorkflowService testService = new TestWorkflowService(true);
WorkflowServiceStubs service = testService.newClientStub();
try {
return generateWorkflowTaskWithInitialHistory(NAMESPACE, TASK_QUEUE, WORKFLOW_TYPE, service);
} finally {
service.shutdownNow();
service.awaitTermination(1, TimeUnit.SECONDS);
testService.close();
}
}
use of io.temporal.internal.testservice.TestWorkflowService in project sdk-java by temporalio.
the class ReplayWorkflowRunTaskHandlerCacheTests method whenHistoryIsFullNewWorkflowExecutorIsReturned_InitiallyCached.
@Test
public void whenHistoryIsFullNewWorkflowExecutorIsReturned_InitiallyCached() throws Exception {
TestWorkflowService testService = new TestWorkflowService();
WorkflowServiceStubs service = testService.newClientStub();
// Arrange
WorkflowExecutorCache cache = new WorkflowExecutorCache(10, new NoopScope());
PollWorkflowTaskQueueResponse workflowTask1 = HistoryUtils.generateWorkflowTaskWithInitialHistory("namespace", "taskQueue", "workflowType", service);
WorkflowRunTaskHandler workflowRunTaskHandler = cache.getOrCreate(workflowTask1, metricsScope, () -> createFakeExecutor(workflowTask1));
cache.addToCache(workflowTask1.getWorkflowExecution(), workflowRunTaskHandler);
PollWorkflowTaskQueueResponse workflowTask2 = HistoryUtils.generateWorkflowTaskWithPartialHistoryFromExistingTask(workflowTask1, "namespace", "stickyTaskQueue", service);
assertEquals(workflowRunTaskHandler, cache.getOrCreate(workflowTask2, metricsScope, () -> doNotCreateFakeExecutor(workflowTask2)));
// Act
WorkflowRunTaskHandler workflowRunTaskHandler2 = cache.getOrCreate(workflowTask2, metricsScope, () -> createFakeExecutor(workflowTask2));
// Assert
assertEquals(workflowRunTaskHandler2, cache.getOrCreate(workflowTask2, metricsScope, () -> createFakeExecutor(workflowTask2)));
assertSame(workflowRunTaskHandler2, workflowRunTaskHandler);
testService.close();
}
Aggregations