|
19 | 19 |
|
20 | 20 | package io.temporal.workflow;
|
21 | 21 |
|
22 |
| -import io.temporal.activity.Activity; |
23 |
| -import io.temporal.activity.ActivityExecutionContext; |
24 |
| -import io.temporal.activity.ActivityInterface; |
25 |
| -import io.temporal.activity.ActivityMethod; |
26 |
| -import io.temporal.activity.ActivityOptions; |
27 |
| -import io.temporal.activity.ManualActivityCompletionClient; |
| 22 | +import io.temporal.activity.*; |
28 | 23 | import io.temporal.common.RetryOptions;
|
29 | 24 | import io.temporal.worker.WorkerOptions;
|
30 | 25 | import io.temporal.workflow.shared.SDKTestWorkflowRule;
|
@@ -54,13 +49,33 @@ public class LocalAsyncCompletionWorkflowTest {
|
54 | 49 | .setTestTimeoutSeconds(15)
|
55 | 50 | .build();
|
56 | 51 |
|
| 52 | + /** |
| 53 | + * This test runs 10 async activities in parallel. The expectation is that |
| 54 | + * MAX_CONCURRENT_ACTIVITIES limit is being respected and only 1 activity should be running at the |
| 55 | + * same time. |
| 56 | + */ |
| 57 | + @Test |
| 58 | + public void verifyLocalActivityCompletionRespectsConcurrencySettings() { |
| 59 | + String taskQueue = testWorkflowRule.getTaskQueue(); |
| 60 | + TestWorkflow workflow = testWorkflowRule.newWorkflowStub(TestWorkflow.class); |
| 61 | + String result = workflow.execute(taskQueue); |
| 62 | + Assert.assertEquals("success", result); |
| 63 | + } |
| 64 | + |
57 | 65 | @WorkflowInterface
|
58 | 66 | public interface TestWorkflow {
|
59 | 67 |
|
60 | 68 | @WorkflowMethod
|
61 | 69 | String execute(String taskQueue);
|
62 | 70 | }
|
63 | 71 |
|
| 72 | + @ActivityInterface |
| 73 | + public interface TestActivity { |
| 74 | + |
| 75 | + @ActivityMethod |
| 76 | + int execute(int value); |
| 77 | + } |
| 78 | + |
64 | 79 | public static class TestWorkflowImpl implements TestWorkflow {
|
65 | 80 |
|
66 | 81 | @Override
|
@@ -91,13 +106,6 @@ public String execute(String taskQueue) {
|
91 | 106 | }
|
92 | 107 | }
|
93 | 108 |
|
94 |
| - @ActivityInterface |
95 |
| - public interface TestActivity { |
96 |
| - |
97 |
| - @ActivityMethod |
98 |
| - int execute(int value); |
99 |
| - } |
100 |
| - |
101 | 109 | public static class AsyncActivityWithManualCompletion implements TestActivity {
|
102 | 110 | private final AtomicInteger concurrentActivitiesCount = new AtomicInteger(0);
|
103 | 111 |
|
@@ -129,17 +137,4 @@ private void asyncActivityFn(int value, ManualActivityCompletionClient completio
|
129 | 137 | }
|
130 | 138 | }
|
131 | 139 | }
|
132 |
| - |
133 |
| - /** |
134 |
| - * This test runs 10 async activities in parallel. The expectation is that |
135 |
| - * MAX_CONCURRENT_ACTIVITIES limit is being respected and only 1 activity should be running at the |
136 |
| - * same time. |
137 |
| - */ |
138 |
| - @Test |
139 |
| - public void verifyLocalActivityCompletionRespectsConcurrencySettings() { |
140 |
| - String taskQueue = testWorkflowRule.getTaskQueue(); |
141 |
| - TestWorkflow workflow = testWorkflowRule.newWorkflowStub(TestWorkflow.class); |
142 |
| - String result = workflow.execute(taskQueue); |
143 |
| - Assert.assertEquals("success", result); |
144 |
| - } |
145 | 140 | }
|
0 commit comments