Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix unimplementented methods of TestWorkflowEnvironment #945

Merged
merged 2 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -780,16 +780,22 @@
}

@Override
public void GetClusterInfo(AsyncMethodCallback resultHandler) throws TException {}
public void GetClusterInfo(AsyncMethodCallback resultHandler) throws TException {
impl.GetClusterInfo(resultHandler);
}

Check warning on line 785 in src/main/java/com/uber/cadence/internal/sync/TestWorkflowEnvironmentInternal.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/uber/cadence/internal/sync/TestWorkflowEnvironmentInternal.java#L784-L785

Added lines #L784 - L785 were not covered by tests

@Override
public void ListTaskListPartitions(
ListTaskListPartitionsRequest request, AsyncMethodCallback resultHandler)
throws TException {}
throws TException {
impl.ListTaskListPartitions(request, resultHandler);
}

Check warning on line 792 in src/main/java/com/uber/cadence/internal/sync/TestWorkflowEnvironmentInternal.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/uber/cadence/internal/sync/TestWorkflowEnvironmentInternal.java#L791-L792

Added lines #L791 - L792 were not covered by tests

@Override
public void RefreshWorkflowTasks(
RefreshWorkflowTasksRequest request, AsyncMethodCallback resultHandler) throws TException {}
RefreshWorkflowTasksRequest request, AsyncMethodCallback resultHandler) throws TException {
impl.RefreshWorkflowTasks(request, resultHandler);
}

Check warning on line 798 in src/main/java/com/uber/cadence/internal/sync/TestWorkflowEnvironmentInternal.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/uber/cadence/internal/sync/TestWorkflowEnvironmentInternal.java#L797-L798

Added lines #L797 - L798 were not covered by tests

@Override
public void RegisterDomain(RegisterDomainRequest registerRequest)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,9 @@ public void ListWorkflowExecutions(
@Override
public void ListArchivedWorkflowExecutions(
ListArchivedWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler)
throws TException {}
throws TException {
throw new UnsupportedOperationException("not implemented");
}

@Override
public void ScanWorkflowExecutions(
Expand Down Expand Up @@ -1175,15 +1177,21 @@ public void DescribeTaskList(DescribeTaskListRequest request, AsyncMethodCallbac
}

@Override
public void GetClusterInfo(AsyncMethodCallback resultHandler) throws TException {}
public void GetClusterInfo(AsyncMethodCallback resultHandler) throws TException {
throw new UnsupportedOperationException("not implemented");
}

@Override
public void ListTaskListPartitions(
ListTaskListPartitionsRequest request, AsyncMethodCallback resultHandler) throws TException {}
ListTaskListPartitionsRequest request, AsyncMethodCallback resultHandler) throws TException {
throw new UnsupportedOperationException("not implemented");
}

@Override
public void RefreshWorkflowTasks(
RefreshWorkflowTasksRequest request, AsyncMethodCallback resultHandler) throws TException {}
RefreshWorkflowTasksRequest request, AsyncMethodCallback resultHandler) throws TException {
throw new UnsupportedOperationException("not implemented");
}

private <R> R requireNotNull(String fieldName, R value) throws BadRequestError {
if (value == null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
/**
* 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.testing;

import static org.junit.Assert.assertThrows;

import com.uber.cadence.*;
import com.uber.cadence.serviceclient.IWorkflowService;
import junit.framework.TestCase;

public class TestWorkflowEnvironmentTest extends TestCase {
TestWorkflowEnvironment testEnvironment;

public void setUp() throws Exception {
testEnvironment = TestWorkflowEnvironment.newInstance();
}

public void testWorkflowService() {
IWorkflowService service = testEnvironment.getWorkflowService();
// unimplemented
assertThrows(
UnsupportedOperationException.class,
() -> service.RegisterDomain(new RegisterDomainRequest()));
assertThrows(
UnsupportedOperationException.class,
() -> service.DescribeDomain(new DescribeDomainRequest()));
assertThrows(
UnsupportedOperationException.class, () -> service.ListDomains(new ListDomainsRequest()));
assertThrows(
UnsupportedOperationException.class, () -> service.UpdateDomain(new UpdateDomainRequest()));
assertThrows(
UnsupportedOperationException.class,
() -> service.DeprecateDomain(new DeprecateDomainRequest()));
assertThrows(
UnsupportedOperationException.class,
() -> service.RestartWorkflowExecution(new RestartWorkflowExecutionRequest()));
assertThrows(
UnsupportedOperationException.class,
() -> service.GetTaskListsByDomain(new GetTaskListsByDomainRequest()));
assertThrows(
UnsupportedOperationException.class,
() -> service.TerminateWorkflowExecution(new TerminateWorkflowExecutionRequest()));
assertThrows(
UnsupportedOperationException.class,
() -> service.ListWorkflowExecutions(new ListWorkflowExecutionsRequest()));
assertThrows(
UnsupportedOperationException.class,
() -> service.ListArchivedWorkflowExecutions(new ListArchivedWorkflowExecutionsRequest()));
assertThrows(
UnsupportedOperationException.class,
() -> service.ScanWorkflowExecutions(new ListWorkflowExecutionsRequest()));
assertThrows(
UnsupportedOperationException.class,
() -> service.CountWorkflowExecutions(new CountWorkflowExecutionsRequest()));
assertThrows(UnsupportedOperationException.class, () -> service.GetSearchAttributes());
assertThrows(
UnsupportedOperationException.class,
() -> service.ResetStickyTaskList(new ResetStickyTaskListRequest()));
assertThrows(
UnsupportedOperationException.class,
() -> service.DescribeWorkflowExecution(new DescribeWorkflowExecutionRequest()));
assertThrows(
UnsupportedOperationException.class,
() -> service.DescribeTaskList(new DescribeTaskListRequest()));
assertThrows(UnsupportedOperationException.class, () -> service.GetClusterInfo());
assertThrows(
UnsupportedOperationException.class,
() -> service.ResetStickyTaskList(new ResetStickyTaskListRequest()));
assertThrows(
UnsupportedOperationException.class,
() -> service.ListTaskListPartitions(new ListTaskListPartitionsRequest()));
assertThrows(
UnsupportedOperationException.class,
() -> service.RefreshWorkflowTasks(new RefreshWorkflowTasksRequest()));

assertThrows(
UnsupportedOperationException.class,
() -> service.RegisterDomain(new RegisterDomainRequest(), null));
assertThrows(
UnsupportedOperationException.class,
() -> service.DescribeDomain(new DescribeDomainRequest(), null));
assertThrows(
UnsupportedOperationException.class,
() -> service.ListDomains(new ListDomainsRequest(), null));
assertThrows(
UnsupportedOperationException.class,
() -> service.UpdateDomain(new UpdateDomainRequest(), null));
assertThrows(
UnsupportedOperationException.class,
() -> service.DeprecateDomain(new DeprecateDomainRequest(), null));
assertThrows(
UnsupportedOperationException.class,
() -> service.RestartWorkflowExecution(new RestartWorkflowExecutionRequest(), null));
assertThrows(
UnsupportedOperationException.class,
() -> service.GetTaskListsByDomain(new GetTaskListsByDomainRequest(), null));
assertThrows(
UnsupportedOperationException.class,
() -> service.TerminateWorkflowExecution(new TerminateWorkflowExecutionRequest(), null));
assertThrows(
UnsupportedOperationException.class,
() -> service.ListWorkflowExecutions(new ListWorkflowExecutionsRequest(), null));
assertThrows(
UnsupportedOperationException.class,
() ->
service.ListArchivedWorkflowExecutions(
new ListArchivedWorkflowExecutionsRequest(), null));
assertThrows(
UnsupportedOperationException.class,
() -> service.ScanWorkflowExecutions(new ListWorkflowExecutionsRequest(), null));
assertThrows(
UnsupportedOperationException.class,
() -> service.CountWorkflowExecutions(new CountWorkflowExecutionsRequest(), null));
assertThrows(UnsupportedOperationException.class, () -> service.GetSearchAttributes(null));
assertThrows(
UnsupportedOperationException.class,
() -> service.ResetStickyTaskList(new ResetStickyTaskListRequest(), null));
assertThrows(
UnsupportedOperationException.class,
() -> service.DescribeWorkflowExecution(new DescribeWorkflowExecutionRequest(), null));
assertThrows(
UnsupportedOperationException.class,
() -> service.DescribeTaskList(new DescribeTaskListRequest(), null));
assertThrows(UnsupportedOperationException.class, () -> service.GetClusterInfo(null));
assertThrows(
UnsupportedOperationException.class,
() -> service.ResetStickyTaskList(new ResetStickyTaskListRequest(), null));
assertThrows(
UnsupportedOperationException.class,
() -> service.ListTaskListPartitions(new ListTaskListPartitionsRequest(), null));
assertThrows(
UnsupportedOperationException.class,
() -> service.RefreshWorkflowTasks(new RefreshWorkflowTasksRequest(), null));
}
}