WorkflowSettings extends ModelObject { public int getMaxSubsequentStateExecutions(WorkflowState state) { return maxSubsequentStateExecutionsPerState.getOrDefault(state, maxSubsequentStateExecutions); } WorkflowSettings(Builder builder); DateTime getErrorTransitionActivation(int retryCount); DateTime getShortTransitionActivation(); int getMaxSubsequentStateExecutions(WorkflowState state); boolean deleteWorkflowInstanceHistory(); Short getDefaultPriority(); final int minErrorTransitionDelay; final int maxErrorTransitionDelay; final int shortTransitionDelay; final int immediateTransitionDelay; final int maxRetries; final int maxSubsequentStateExecutions; final Map<WorkflowState, Integer> maxSubsequentStateExecutionsPerState; final ReadablePeriod historyDeletableAfter; final BooleanSupplier deleteHistoryCondition; final short defaultPriority; }
@Test public void getMaxSubsequentStateExecutionsReturns100ByDefault() { WorkflowSettings s = new WorkflowSettings.Builder().build(); assertThat(s.getMaxSubsequentStateExecutions(TestWorkflow.State.begin), is(equalTo(100))); }
@Test public void getMaxSubsequentStateExecutionsReturnsValueDefinedForTheState() { int executionsDefault = 200; int executionsForBegin = 300; WorkflowSettings s = new WorkflowSettings.Builder().setMaxSubsequentStateExecutions(executionsDefault) .setMaxSubsequentStateExecutions(TestWorkflow.State.begin, executionsForBegin).build(); assertThat(s.getMaxSubsequentStateExecutions(TestWorkflow.State.begin), is(equalTo(executionsForBegin))); }
@Test public void getMaxSubsequentStateExecutionsReturnsGivenDefaultValueWhenNotDefinedForState() { int executionsDefault = 200; WorkflowSettings s = new WorkflowSettings.Builder().setMaxSubsequentStateExecutions(executionsDefault).build(); assertThat(s.getMaxSubsequentStateExecutions(TestWorkflow.State.begin), is(equalTo(executionsDefault))); }