Skip to content

Commit 9d4bed7

Browse files
authored
fix incorrect exception for unsupported method in WorkflowService (#933)
What changed? Change unimplemented methods to throw "unsupported" exception instead add license headers Why? To observe the convention of other unimplemented methods How did you test it? Unit Test
1 parent 948814c commit 9d4bed7

File tree

13 files changed

+910
-99
lines changed

13 files changed

+910
-99
lines changed

src/main/java/com/uber/cadence/serviceclient/IWorkflowServiceBase.java

Lines changed: 94 additions & 94 deletions
Large diffs are not rendered by default.

src/main/java/com/uber/cadence/serviceclient/WorkflowServiceTChannel.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ public RestartWorkflowExecutionResponse RestartWorkflowExecution(
524524
RestartWorkflowExecutionRequest restartRequest)
525525
throws BadRequestError, ServiceBusyError, DomainNotActiveError, LimitExceededError,
526526
EntityNotExistsError, ClientVersionNotSupportedError, TException {
527-
throw new IllegalArgumentException("unimplemented");
527+
throw new UnsupportedOperationException("unimplemented");
528528
}
529529

530530
private void deprecateDomain(DeprecateDomainRequest deprecateRequest) throws TException {
@@ -2808,7 +2808,7 @@ public void SignalWithStartWorkflowExecutionAsync(
28082808
SignalWithStartWorkflowExecutionAsyncRequest signalWithStartRequest,
28092809
AsyncMethodCallback resultHandler)
28102810
throws TException {
2811-
throw new IllegalArgumentException("unimplemented");
2811+
throw new UnsupportedOperationException("unimplemented");
28122812
}
28132813

28142814
@Override
@@ -2951,7 +2951,7 @@ public void DeprecateDomain(
29512951
public void RestartWorkflowExecution(
29522952
RestartWorkflowExecutionRequest restartRequest, AsyncMethodCallback resultHandler)
29532953
throws TException {
2954-
throw new IllegalArgumentException("unimplemented");
2954+
throw new UnsupportedOperationException("unimplemented");
29552955
}
29562956

29572957
@Override

src/test/java/com/uber/cadence/internal/compatibility/EnumMapperTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
/**
2+
* Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* <p>Modifications copyright (C) 2017 Uber Technologies, Inc.
5+
*
6+
* <p>Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file
7+
* except in compliance with the License. A copy of the License is located at
8+
*
9+
* <p>http://aws.amazon.com/apache2.0
10+
*
11+
* <p>or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
13+
* specific language governing permissions and limitations under the License.
14+
*/
115
package com.uber.cadence.internal.compatibility;
216

317
import static org.junit.Assert.assertEquals;

src/test/java/com/uber/cadence/internal/compatibility/thrift/HistoryMapperEventTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
/**
2+
* Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* <p>Modifications copyright (C) 2017 Uber Technologies, Inc.
5+
*
6+
* <p>Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file
7+
* except in compliance with the License. A copy of the License is located at
8+
*
9+
* <p>http://aws.amazon.com/apache2.0
10+
*
11+
* <p>or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
13+
* specific language governing permissions and limitations under the License.
14+
*/
115
package com.uber.cadence.internal.compatibility.thrift;
216

317
import static org.junit.Assert.assertEquals;
Lines changed: 277 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,277 @@
1+
/**
2+
* Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* <p>Modifications copyright (C) 2017 Uber Technologies, Inc.
5+
*
6+
* <p>Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file
7+
* except in compliance with the License. A copy of the License is located at
8+
*
9+
* <p>http://aws.amazon.com/apache2.0
10+
*
11+
* <p>or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
13+
* specific language governing permissions and limitations under the License.
14+
*/
15+
package com.uber.cadence.serviceclient;
16+
17+
import static org.junit.Assert.assertThrows;
18+
19+
import junit.framework.TestCase;
20+
21+
public class IWorkflowServiceBaseTest extends TestCase {
22+
23+
public final IWorkflowServiceBase service = new IWorkflowServiceBase();
24+
25+
public void testGetOptions() {
26+
assertThrows(UnsupportedOperationException.class, () -> service.getOptions());
27+
}
28+
29+
public void testRegisterDomain() {
30+
assertThrows(UnsupportedOperationException.class, () -> service.RegisterDomain(null, null));
31+
}
32+
33+
public void testDescribeDomain() {
34+
assertThrows(UnsupportedOperationException.class, () -> service.DescribeDomain(null, null));
35+
}
36+
37+
public void testListDomains() {
38+
assertThrows(UnsupportedOperationException.class, () -> service.ListDomains(null, null));
39+
}
40+
41+
public void testUpdateDomain() {
42+
assertThrows(UnsupportedOperationException.class, () -> service.UpdateDomain(null, null));
43+
}
44+
45+
public void testDeprecateDomain() {
46+
assertThrows(UnsupportedOperationException.class, () -> service.DeprecateDomain(null, null));
47+
}
48+
49+
public void testRestartWorkflowExecution() {
50+
assertThrows(
51+
UnsupportedOperationException.class, () -> service.RestartWorkflowExecution(null, null));
52+
}
53+
54+
public void testStartWorkflowExecution() {
55+
assertThrows(
56+
UnsupportedOperationException.class, () -> service.StartWorkflowExecution(null, null));
57+
}
58+
59+
public void testStartWorkflowExecutionAsync() {
60+
assertThrows(
61+
UnsupportedOperationException.class, () -> service.StartWorkflowExecutionAsync(null, null));
62+
}
63+
64+
public void testGetWorkflowExecutionHistory() {
65+
assertThrows(
66+
UnsupportedOperationException.class, () -> service.GetWorkflowExecutionHistory(null, null));
67+
}
68+
69+
public void testPollForDecisionTask() {
70+
assertThrows(
71+
UnsupportedOperationException.class, () -> service.PollForDecisionTask(null, null));
72+
}
73+
74+
public void testRespondDecisionTaskCompleted() {
75+
assertThrows(
76+
UnsupportedOperationException.class,
77+
() -> service.RespondDecisionTaskCompleted(null, null));
78+
}
79+
80+
public void testRespondDecisionTaskFailed() {
81+
assertThrows(
82+
UnsupportedOperationException.class, () -> service.RespondDecisionTaskFailed(null, null));
83+
}
84+
85+
public void testPollForActivityTask() {
86+
assertThrows(
87+
UnsupportedOperationException.class, () -> service.PollForActivityTask(null, null));
88+
}
89+
90+
public void testRecordActivityTaskHeartbeat() {
91+
assertThrows(
92+
UnsupportedOperationException.class, () -> service.RecordActivityTaskHeartbeat(null, null));
93+
}
94+
95+
public void testRecordActivityTaskHeartbeatByID() {
96+
assertThrows(
97+
UnsupportedOperationException.class,
98+
() -> service.RecordActivityTaskHeartbeatByID(null, null));
99+
}
100+
101+
public void testRespondActivityTaskCompleted() {
102+
assertThrows(
103+
UnsupportedOperationException.class,
104+
() -> service.RespondActivityTaskCompleted(null, null));
105+
}
106+
107+
public void testRespondActivityTaskCompletedByID() {
108+
assertThrows(
109+
UnsupportedOperationException.class,
110+
() -> service.RespondActivityTaskCompletedByID(null, null));
111+
}
112+
113+
public void testRespondActivityTaskFailed() {
114+
assertThrows(
115+
UnsupportedOperationException.class, () -> service.RespondActivityTaskFailed(null, null));
116+
}
117+
118+
public void testRespondActivityTaskFailedByID() {
119+
assertThrows(
120+
UnsupportedOperationException.class,
121+
() -> service.RespondActivityTaskFailedByID(null, null));
122+
}
123+
124+
public void testRespondActivityTaskCanceled() {
125+
assertThrows(
126+
UnsupportedOperationException.class, () -> service.RespondActivityTaskCanceled(null, null));
127+
}
128+
129+
public void testRespondActivityTaskCanceledByID() {
130+
assertThrows(
131+
UnsupportedOperationException.class,
132+
() -> service.RespondActivityTaskCanceledByID(null, null));
133+
}
134+
135+
public void testRequestCancelWorkflowExecution() {
136+
assertThrows(
137+
UnsupportedOperationException.class,
138+
() -> service.RequestCancelWorkflowExecution(null, null));
139+
}
140+
141+
public void testSignalWorkflowExecution() {
142+
assertThrows(
143+
UnsupportedOperationException.class, () -> service.SignalWorkflowExecution(null, null));
144+
}
145+
146+
public void testSignalWithStartWorkflowExecution() {
147+
assertThrows(
148+
UnsupportedOperationException.class,
149+
() -> service.SignalWithStartWorkflowExecution(null, null));
150+
}
151+
152+
public void testSignalWithStartWorkflowExecutionAsync() {
153+
assertThrows(
154+
UnsupportedOperationException.class,
155+
() -> service.SignalWithStartWorkflowExecutionAsync(null, null));
156+
}
157+
158+
public void testResetWorkflowExecution() {
159+
assertThrows(
160+
UnsupportedOperationException.class, () -> service.ResetWorkflowExecution(null, null));
161+
}
162+
163+
public void testTerminateWorkflowExecution() {
164+
assertThrows(
165+
UnsupportedOperationException.class, () -> service.TerminateWorkflowExecution(null, null));
166+
}
167+
168+
public void testListOpenWorkflowExecutions() {
169+
assertThrows(
170+
UnsupportedOperationException.class, () -> service.ListOpenWorkflowExecutions(null, null));
171+
}
172+
173+
public void testListClosedWorkflowExecutions() {
174+
assertThrows(
175+
UnsupportedOperationException.class,
176+
() -> service.ListClosedWorkflowExecutions(null, null));
177+
}
178+
179+
public void testListWorkflowExecutions() {
180+
assertThrows(
181+
UnsupportedOperationException.class, () -> service.ListWorkflowExecutions(null, null));
182+
}
183+
184+
public void testListArchivedWorkflowExecutions() {
185+
assertThrows(
186+
UnsupportedOperationException.class,
187+
() -> service.ListArchivedWorkflowExecutions(null, null));
188+
}
189+
190+
public void testScanWorkflowExecutions() {
191+
assertThrows(
192+
UnsupportedOperationException.class, () -> service.ScanWorkflowExecutions(null, null));
193+
}
194+
195+
public void testCountWorkflowExecutions() {
196+
assertThrows(
197+
UnsupportedOperationException.class, () -> service.CountWorkflowExecutions(null, null));
198+
}
199+
200+
public void testGetSearchAttributes() {
201+
assertThrows(UnsupportedOperationException.class, () -> service.GetSearchAttributes(null));
202+
}
203+
204+
public void testRespondQueryTaskCompleted() {
205+
assertThrows(
206+
UnsupportedOperationException.class, () -> service.RespondQueryTaskCompleted(null, null));
207+
}
208+
209+
public void testResetStickyTaskList() {
210+
assertThrows(
211+
UnsupportedOperationException.class, () -> service.ResetStickyTaskList(null, null));
212+
}
213+
214+
public void testQueryWorkflow() {
215+
assertThrows(UnsupportedOperationException.class, () -> service.QueryWorkflow(null, null));
216+
}
217+
218+
public void testDescribeWorkflowExecution() {
219+
assertThrows(
220+
UnsupportedOperationException.class, () -> service.DescribeWorkflowExecution(null, null));
221+
}
222+
223+
public void testDescribeTaskList() {
224+
assertThrows(UnsupportedOperationException.class, () -> service.DescribeTaskList(null, null));
225+
}
226+
227+
public void testGetClusterInfo() {
228+
assertThrows(UnsupportedOperationException.class, () -> service.GetClusterInfo(null));
229+
}
230+
231+
public void testGetTaskListsByDomain() {
232+
assertThrows(
233+
UnsupportedOperationException.class, () -> service.GetTaskListsByDomain(null, null));
234+
}
235+
236+
public void testListTaskListPartitions() {
237+
assertThrows(
238+
UnsupportedOperationException.class, () -> service.ListTaskListPartitions(null, null));
239+
}
240+
241+
public void testRefreshWorkflowTasks() {
242+
assertThrows(
243+
UnsupportedOperationException.class, () -> service.RefreshWorkflowTasks(null, null));
244+
}
245+
246+
public void testClose() {
247+
assertThrows(UnsupportedOperationException.class, () -> service.close());
248+
}
249+
250+
public void testStartWorkflowExecutionWithTimeout() {
251+
assertThrows(
252+
UnsupportedOperationException.class,
253+
() -> service.StartWorkflowExecutionWithTimeout(null, null, null));
254+
}
255+
256+
public void testStartWorkflowExecutionAsyncWithTimeout() {
257+
assertThrows(
258+
UnsupportedOperationException.class,
259+
() -> service.StartWorkflowExecutionAsyncWithTimeout(null, null, null));
260+
}
261+
262+
public void testGetWorkflowExecutionHistoryWithTimeout() {
263+
assertThrows(
264+
UnsupportedOperationException.class,
265+
() -> service.GetWorkflowExecutionHistoryWithTimeout(null, null));
266+
}
267+
268+
public void testSignalWorkflowExecutionWithTimeout() {
269+
assertThrows(
270+
UnsupportedOperationException.class,
271+
() -> service.SignalWorkflowExecutionWithTimeout(null, null, null));
272+
}
273+
274+
public void testIsHealthy() {
275+
assertThrows(UnsupportedOperationException.class, () -> service.isHealthy());
276+
}
277+
}

0 commit comments

Comments
 (0)