use of com.uber.cadence.internal.testservice.TestWorkflowService in project cadence-client by uber-java.
the class ReplayDeciderTaskHandlerTests method ifStickyExecutionAttributesAreSetThenWorkflowsAreCached.
@Test
public void ifStickyExecutionAttributesAreSetThenWorkflowsAreCached() throws Throwable {
// Arrange
DeciderCache cache = new DeciderCache(10, NoopScope.getInstance());
DecisionTaskHandler taskHandler = new ReplayDecisionTaskHandler("domain", setUpMockWorkflowFactory(), cache, SingleWorkerOptions.newBuilder().build(), "sticky", Duration.ofSeconds(5), new TestWorkflowService(), null);
PollForDecisionTaskResponse decisionTask = HistoryUtils.generateDecisionTaskWithInitialHistory();
// Act
DecisionTaskHandler.Result result = taskHandler.handleDecisionTask(decisionTask);
// Assert
assertEquals(1, cache.size());
assertNotNull(result.getTaskCompleted());
StickyExecutionAttributes attributes = result.getTaskCompleted().getStickyAttributes();
assertEquals("sticky", attributes.getWorkerTaskList().name);
assertEquals(5, attributes.getScheduleToStartTimeoutSeconds());
}
Aggregations