Skip to content

Commit

Permalink
fix incorrect exception for unsupported method in WorkflowService
Browse files Browse the repository at this point in the history
  • Loading branch information
shijiesheng committed Oct 31, 2024
1 parent 948814c commit 45212cb
Show file tree
Hide file tree
Showing 13 changed files with 910 additions and 99 deletions.
188 changes: 94 additions & 94 deletions src/main/java/com/uber/cadence/serviceclient/IWorkflowServiceBase.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ public RestartWorkflowExecutionResponse RestartWorkflowExecution(
RestartWorkflowExecutionRequest restartRequest)
throws BadRequestError, ServiceBusyError, DomainNotActiveError, LimitExceededError,
EntityNotExistsError, ClientVersionNotSupportedError, TException {
throw new IllegalArgumentException("unimplemented");
throw new UnsupportedOperationException("unimplemented");
}

private void deprecateDomain(DeprecateDomainRequest deprecateRequest) throws TException {
Expand Down Expand Up @@ -2808,7 +2808,7 @@ public void SignalWithStartWorkflowExecutionAsync(
SignalWithStartWorkflowExecutionAsyncRequest signalWithStartRequest,
AsyncMethodCallback resultHandler)
throws TException {
throw new IllegalArgumentException("unimplemented");
throw new UnsupportedOperationException("unimplemented");
}

@Override
Expand Down Expand Up @@ -2951,7 +2951,7 @@ public void DeprecateDomain(
public void RestartWorkflowExecution(
RestartWorkflowExecutionRequest restartRequest, AsyncMethodCallback resultHandler)
throws TException {
throw new IllegalArgumentException("unimplemented");
throw new UnsupportedOperationException("unimplemented");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/**
* Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* <p>Modifications copyright (C) 2017 Uber Technologies, Inc.
*
* <p>Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file
* except in compliance with the License. A copy of the License is located at
*
* <p>http://aws.amazon.com/apache2.0
*
* <p>or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package com.uber.cadence.internal.compatibility;

import static org.junit.Assert.assertEquals;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/**
* Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* <p>Modifications copyright (C) 2017 Uber Technologies, Inc.
*
* <p>Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file
* except in compliance with the License. A copy of the License is located at
*
* <p>http://aws.amazon.com/apache2.0
*
* <p>or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package com.uber.cadence.internal.compatibility.thrift;

import static org.junit.Assert.assertEquals;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,277 @@
/**
* Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* <p>Modifications copyright (C) 2017 Uber Technologies, Inc.
*
* <p>Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file
* except in compliance with the License. A copy of the License is located at
*
* <p>http://aws.amazon.com/apache2.0
*
* <p>or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package com.uber.cadence.serviceclient;

import static org.junit.Assert.assertThrows;

import junit.framework.TestCase;

public class IWorkflowServiceBaseTest extends TestCase {

public final IWorkflowServiceBase service = new IWorkflowServiceBase();

public void testGetOptions() {
assertThrows(UnsupportedOperationException.class, () -> service.getOptions());
}

public void testRegisterDomain() {
assertThrows(UnsupportedOperationException.class, () -> service.RegisterDomain(null, null));
}

public void testDescribeDomain() {
assertThrows(UnsupportedOperationException.class, () -> service.DescribeDomain(null, null));
}

public void testListDomains() {
assertThrows(UnsupportedOperationException.class, () -> service.ListDomains(null, null));
}

public void testUpdateDomain() {
assertThrows(UnsupportedOperationException.class, () -> service.UpdateDomain(null, null));
}

public void testDeprecateDomain() {
assertThrows(UnsupportedOperationException.class, () -> service.DeprecateDomain(null, null));
}

public void testRestartWorkflowExecution() {
assertThrows(
UnsupportedOperationException.class, () -> service.RestartWorkflowExecution(null, null));
}

public void testStartWorkflowExecution() {
assertThrows(
UnsupportedOperationException.class, () -> service.StartWorkflowExecution(null, null));
}

public void testStartWorkflowExecutionAsync() {
assertThrows(
UnsupportedOperationException.class, () -> service.StartWorkflowExecutionAsync(null, null));
}

public void testGetWorkflowExecutionHistory() {
assertThrows(
UnsupportedOperationException.class, () -> service.GetWorkflowExecutionHistory(null, null));
}

public void testPollForDecisionTask() {
assertThrows(
UnsupportedOperationException.class, () -> service.PollForDecisionTask(null, null));
}

public void testRespondDecisionTaskCompleted() {
assertThrows(
UnsupportedOperationException.class,
() -> service.RespondDecisionTaskCompleted(null, null));
}

public void testRespondDecisionTaskFailed() {
assertThrows(
UnsupportedOperationException.class, () -> service.RespondDecisionTaskFailed(null, null));
}

public void testPollForActivityTask() {
assertThrows(
UnsupportedOperationException.class, () -> service.PollForActivityTask(null, null));
}

public void testRecordActivityTaskHeartbeat() {
assertThrows(
UnsupportedOperationException.class, () -> service.RecordActivityTaskHeartbeat(null, null));
}

public void testRecordActivityTaskHeartbeatByID() {
assertThrows(
UnsupportedOperationException.class,
() -> service.RecordActivityTaskHeartbeatByID(null, null));
}

public void testRespondActivityTaskCompleted() {
assertThrows(
UnsupportedOperationException.class,
() -> service.RespondActivityTaskCompleted(null, null));
}

public void testRespondActivityTaskCompletedByID() {
assertThrows(
UnsupportedOperationException.class,
() -> service.RespondActivityTaskCompletedByID(null, null));
}

public void testRespondActivityTaskFailed() {
assertThrows(
UnsupportedOperationException.class, () -> service.RespondActivityTaskFailed(null, null));
}

public void testRespondActivityTaskFailedByID() {
assertThrows(
UnsupportedOperationException.class,
() -> service.RespondActivityTaskFailedByID(null, null));
}

public void testRespondActivityTaskCanceled() {
assertThrows(
UnsupportedOperationException.class, () -> service.RespondActivityTaskCanceled(null, null));
}

public void testRespondActivityTaskCanceledByID() {
assertThrows(
UnsupportedOperationException.class,
() -> service.RespondActivityTaskCanceledByID(null, null));
}

public void testRequestCancelWorkflowExecution() {
assertThrows(
UnsupportedOperationException.class,
() -> service.RequestCancelWorkflowExecution(null, null));
}

public void testSignalWorkflowExecution() {
assertThrows(
UnsupportedOperationException.class, () -> service.SignalWorkflowExecution(null, null));
}

public void testSignalWithStartWorkflowExecution() {
assertThrows(
UnsupportedOperationException.class,
() -> service.SignalWithStartWorkflowExecution(null, null));
}

public void testSignalWithStartWorkflowExecutionAsync() {
assertThrows(
UnsupportedOperationException.class,
() -> service.SignalWithStartWorkflowExecutionAsync(null, null));
}

public void testResetWorkflowExecution() {
assertThrows(
UnsupportedOperationException.class, () -> service.ResetWorkflowExecution(null, null));
}

public void testTerminateWorkflowExecution() {
assertThrows(
UnsupportedOperationException.class, () -> service.TerminateWorkflowExecution(null, null));
}

public void testListOpenWorkflowExecutions() {
assertThrows(
UnsupportedOperationException.class, () -> service.ListOpenWorkflowExecutions(null, null));
}

public void testListClosedWorkflowExecutions() {
assertThrows(
UnsupportedOperationException.class,
() -> service.ListClosedWorkflowExecutions(null, null));
}

public void testListWorkflowExecutions() {
assertThrows(
UnsupportedOperationException.class, () -> service.ListWorkflowExecutions(null, null));
}

public void testListArchivedWorkflowExecutions() {
assertThrows(
UnsupportedOperationException.class,
() -> service.ListArchivedWorkflowExecutions(null, null));
}

public void testScanWorkflowExecutions() {
assertThrows(
UnsupportedOperationException.class, () -> service.ScanWorkflowExecutions(null, null));
}

public void testCountWorkflowExecutions() {
assertThrows(
UnsupportedOperationException.class, () -> service.CountWorkflowExecutions(null, null));
}

public void testGetSearchAttributes() {
assertThrows(UnsupportedOperationException.class, () -> service.GetSearchAttributes(null));
}

public void testRespondQueryTaskCompleted() {
assertThrows(
UnsupportedOperationException.class, () -> service.RespondQueryTaskCompleted(null, null));
}

public void testResetStickyTaskList() {
assertThrows(
UnsupportedOperationException.class, () -> service.ResetStickyTaskList(null, null));
}

public void testQueryWorkflow() {
assertThrows(UnsupportedOperationException.class, () -> service.QueryWorkflow(null, null));
}

public void testDescribeWorkflowExecution() {
assertThrows(
UnsupportedOperationException.class, () -> service.DescribeWorkflowExecution(null, null));
}

public void testDescribeTaskList() {
assertThrows(UnsupportedOperationException.class, () -> service.DescribeTaskList(null, null));
}

public void testGetClusterInfo() {
assertThrows(UnsupportedOperationException.class, () -> service.GetClusterInfo(null));
}

public void testGetTaskListsByDomain() {
assertThrows(
UnsupportedOperationException.class, () -> service.GetTaskListsByDomain(null, null));
}

public void testListTaskListPartitions() {
assertThrows(
UnsupportedOperationException.class, () -> service.ListTaskListPartitions(null, null));
}

public void testRefreshWorkflowTasks() {
assertThrows(
UnsupportedOperationException.class, () -> service.RefreshWorkflowTasks(null, null));
}

public void testClose() {
assertThrows(UnsupportedOperationException.class, () -> service.close());
}

public void testStartWorkflowExecutionWithTimeout() {
assertThrows(
UnsupportedOperationException.class,
() -> service.StartWorkflowExecutionWithTimeout(null, null, null));
}

public void testStartWorkflowExecutionAsyncWithTimeout() {
assertThrows(
UnsupportedOperationException.class,
() -> service.StartWorkflowExecutionAsyncWithTimeout(null, null, null));
}

public void testGetWorkflowExecutionHistoryWithTimeout() {
assertThrows(
UnsupportedOperationException.class,
() -> service.GetWorkflowExecutionHistoryWithTimeout(null, null));
}

public void testSignalWorkflowExecutionWithTimeout() {
assertThrows(
UnsupportedOperationException.class,
() -> service.SignalWorkflowExecutionWithTimeout(null, null, null));
}

public void testIsHealthy() {
assertThrows(UnsupportedOperationException.class, () -> service.isHealthy());
}
}
Loading

0 comments on commit 45212cb

Please sign in to comment.