diff --git a/src/main/idls b/src/main/idls index 83d5cae7f..f5ac3a987 160000 --- a/src/main/idls +++ b/src/main/idls @@ -1 +1 @@ -Subproject commit 83d5cae7fc5176f73486ffe82144044711930073 +Subproject commit f5ac3a987dcaf996cf44c72064195faf76c381f3 diff --git a/src/main/java/com/uber/cadence/internal/compatibility/Thrift2ProtoAdapter.java b/src/main/java/com/uber/cadence/internal/compatibility/Thrift2ProtoAdapter.java index a83561749..b4bae6557 100644 --- a/src/main/java/com/uber/cadence/internal/compatibility/Thrift2ProtoAdapter.java +++ b/src/main/java/com/uber/cadence/internal/compatibility/Thrift2ProtoAdapter.java @@ -31,6 +31,8 @@ import com.uber.cadence.DescribeTaskListResponse; import com.uber.cadence.DescribeWorkflowExecutionRequest; import com.uber.cadence.DescribeWorkflowExecutionResponse; +import com.uber.cadence.DiagnoseWorkflowExecutionRequest; +import com.uber.cadence.DiagnoseWorkflowExecutionResponse; import com.uber.cadence.DomainAlreadyExistsError; import com.uber.cadence.DomainNotActiveError; import com.uber.cadence.EntityNotExistsError; @@ -156,6 +158,14 @@ public DescribeDomainResponse DescribeDomain(DescribeDomainRequest describeReque } } + @Override + public DiagnoseWorkflowExecutionResponse DiagnoseWorkflowExecution( + DiagnoseWorkflowExecutionRequest diagnoseRequest) + throws DomainNotActiveError, ServiceBusyError, EntityNotExistsError, + ClientVersionNotSupportedError, TException { + throw new UnsupportedOperationException("DiagnoseWorkflowExecution is not implemented"); + } + @Override public ListDomainsResponse ListDomains(ListDomainsRequest listRequest) throws BadRequestError, EntityNotExistsError, ServiceBusyError, @@ -829,6 +839,13 @@ public void DescribeDomain( throw new UnsupportedOperationException("not implemented"); } + @Override + public void DiagnoseWorkflowExecution( + DiagnoseWorkflowExecutionRequest diagnoseRequest, AsyncMethodCallback resultHandler) + throws TException { + throw new UnsupportedOperationException("not implemented"); + } + @Override public void ListDomains(ListDomainsRequest listRequest, AsyncMethodCallback resultHandler) throws TException { diff --git a/src/main/java/com/uber/cadence/internal/compatibility/proto/RequestMapper.java b/src/main/java/com/uber/cadence/internal/compatibility/proto/RequestMapper.java index 319d3e5ea..c07d67361 100644 --- a/src/main/java/com/uber/cadence/internal/compatibility/proto/RequestMapper.java +++ b/src/main/java/com/uber/cadence/internal/compatibility/proto/RequestMapper.java @@ -29,6 +29,7 @@ import static com.uber.cadence.internal.compatibility.proto.Helpers.newFieldMask; import static com.uber.cadence.internal.compatibility.proto.Helpers.nullToEmpty; import static com.uber.cadence.internal.compatibility.proto.Helpers.secondsToDuration; +import static com.uber.cadence.internal.compatibility.proto.Helpers.unixNanoToTime; import static com.uber.cadence.internal.compatibility.proto.TypeMapper.badBinaries; import static com.uber.cadence.internal.compatibility.proto.TypeMapper.clusterReplicationConfigurationArray; import static com.uber.cadence.internal.compatibility.proto.TypeMapper.failure; @@ -403,6 +404,7 @@ public static DescribeWorkflowExecutionRequest describeWorkflowExecutionRequest( return DescribeWorkflowExecutionRequest.newBuilder() .setDomain(t.getDomain()) .setWorkflowExecution(workflowExecution(t.getExecution())) + .setQueryConsistencyLevel(queryConsistencyLevel(t.getQueryConsistencyLevel())) .build(); } @@ -418,7 +420,8 @@ public static GetWorkflowExecutionHistoryRequest getWorkflowExecutionHistoryRequ .setPageSize(t.getMaximumPageSize()) .setWaitForNewEvent(t.isWaitForNewEvent()) .setHistoryEventFilterType(eventFilterType(t.HistoryEventFilterType)) - .setSkipArchival(t.isSkipArchival()); + .setSkipArchival(t.isSkipArchival()) + .setQueryConsistencyLevel(queryConsistencyLevel(t.getQueryConsistencyLevel())); if (t.getNextPageToken() != null) { builder.setNextPageToken(arrayToByteString(t.getNextPageToken())); } @@ -445,6 +448,9 @@ public static SignalWithStartWorkflowExecutionRequest signalWithStartWorkflowExe .setSearchAttributes(searchAttributes(t.getSearchAttributes())) .setHeader(header(t.getHeader())) .setJitterStart(secondsToDuration(t.getJitterStartSeconds())); + if (t.isSetFirstRunAtTimestamp()) { + builder.setFirstRunAt(unixNanoToTime(t.getFirstRunAtTimestamp())); + } if (t.getRetryPolicy() != null) { builder.setRetryPolicy(retryPolicy(t.getRetryPolicy())); } @@ -530,6 +536,9 @@ public static StartWorkflowExecutionRequest startWorkflowExecutionRequest( .setHeader(header(t.getHeader())) .setDelayStart(secondsToDuration(t.getDelayStartSeconds())) .setJitterStart(secondsToDuration(t.getJitterStartSeconds())); + if (t.isSetFirstRunAtTimestamp()) { + request.setFirstRunAt(unixNanoToTime(t.getFirstRunAtTimestamp())); + } if (t.getRetryPolicy() != null) { request.setRetryPolicy(retryPolicy(t.getRetryPolicy())); } diff --git a/src/main/java/com/uber/cadence/internal/compatibility/thrift/HistoryMapper.java b/src/main/java/com/uber/cadence/internal/compatibility/thrift/HistoryMapper.java index ed1b0b54d..8c49de1f7 100644 --- a/src/main/java/com/uber/cadence/internal/compatibility/thrift/HistoryMapper.java +++ b/src/main/java/com/uber/cadence/internal/compatibility/thrift/HistoryMapper.java @@ -947,6 +947,8 @@ static MarkerRecordedEventAttributes markerRecordedEventAttributes( res.setMemo(memo(t.getMemo())); res.setSearchAttributes(searchAttributes(t.getSearchAttributes())); res.setDelayStartSeconds(durationToSeconds(t.getDelayStart())); + res.setJitterStartSeconds(durationToSeconds(t.getJitterStart())); + res.setFirstRunAtTimestamp(timeToUnixNano(t.getFirstRunAt())); return res; } diff --git a/src/main/java/com/uber/cadence/internal/compatibility/thrift/ResponseMapper.java b/src/main/java/com/uber/cadence/internal/compatibility/thrift/ResponseMapper.java index b517216bc..10fe645e7 100644 --- a/src/main/java/com/uber/cadence/internal/compatibility/thrift/ResponseMapper.java +++ b/src/main/java/com/uber/cadence/internal/compatibility/thrift/ResponseMapper.java @@ -25,6 +25,7 @@ import static com.uber.cadence.internal.compatibility.thrift.HistoryMapper.history; import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.activityLocalDispatchInfoMap; import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.activityType; +import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.autoConfigHint; import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.badBinaries; import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.clusterReplicationConfigurationArray; import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.dataBlobArray; @@ -239,6 +240,7 @@ public static PollForActivityTaskResponse pollForActivityTaskResponse( res.setWorkflowType(workflowType(t.getWorkflowType())); res.setWorkflowDomain(t.getWorkflowDomain()); res.setHeader(header(t.getHeader())); + res.setAutoConfigHint(autoConfigHint(t.getAutoConfigHint())); return res; } @@ -265,6 +267,7 @@ public static PollForDecisionTaskResponse pollForDecisionTaskResponse( res.setStartedTimestamp(timeToUnixNano(t.getStartedTime())); res.setQueries(workflowQueryMap(t.getQueriesMap())); res.setNextEventId(t.getNextEventId()); + res.setAutoConfigHint(autoConfigHint(t.getAutoConfigHint())); return res; } diff --git a/src/main/java/com/uber/cadence/internal/compatibility/thrift/TypeMapper.java b/src/main/java/com/uber/cadence/internal/compatibility/thrift/TypeMapper.java index be2d34855..681b495dd 100644 --- a/src/main/java/com/uber/cadence/internal/compatibility/thrift/TypeMapper.java +++ b/src/main/java/com/uber/cadence/internal/compatibility/thrift/TypeMapper.java @@ -31,6 +31,7 @@ import com.uber.cadence.ActivityLocalDispatchInfo; import com.uber.cadence.ActivityType; +import com.uber.cadence.AutoConfigHint; import com.uber.cadence.BadBinaries; import com.uber.cadence.BadBinaryInfo; import com.uber.cadence.ClusterReplicationConfiguration; @@ -686,4 +687,14 @@ static Map activityLocalDispatchInfoMap( } return v; } + + static AutoConfigHint autoConfigHint(com.uber.cadence.api.v1.AutoConfigHint t) { + if (t == null) { + return null; + } + AutoConfigHint autoConfigHint = new AutoConfigHint(); + autoConfigHint.setEnableAutoConfig(t.getEnableAutoConfig()); + autoConfigHint.setPollerWaitTimeInMs(t.getPollerWaitTimeInMs()); + return autoConfigHint; + } } diff --git a/src/main/java/com/uber/cadence/internal/sync/TestActivityEnvironmentInternal.java b/src/main/java/com/uber/cadence/internal/sync/TestActivityEnvironmentInternal.java index 2ed9218b1..61d804ea5 100644 --- a/src/main/java/com/uber/cadence/internal/sync/TestActivityEnvironmentInternal.java +++ b/src/main/java/com/uber/cadence/internal/sync/TestActivityEnvironmentInternal.java @@ -593,6 +593,13 @@ public void DescribeDomain( impl.DescribeDomain(describeRequest, resultHandler); } + @Override + public void DiagnoseWorkflowExecution( + DiagnoseWorkflowExecutionRequest diagnoseRequest, AsyncMethodCallback resultHandler) + throws TException { + impl.DiagnoseWorkflowExecution(diagnoseRequest, resultHandler); + } + @Override public void ListDomains(ListDomainsRequest listRequest, AsyncMethodCallback resultHandler) throws TException { @@ -921,6 +928,14 @@ public DescribeDomainResponse DescribeDomain(DescribeDomainRequest describeReque return impl.DescribeDomain(describeRequest); } + @Override + public DiagnoseWorkflowExecutionResponse DiagnoseWorkflowExecution( + DiagnoseWorkflowExecutionRequest diagnoseRequest) + throws DomainNotActiveError, ServiceBusyError, EntityNotExistsError, + ClientVersionNotSupportedError, TException { + return impl.DiagnoseWorkflowExecution(diagnoseRequest); + } + @Override public ListDomainsResponse ListDomains(ListDomainsRequest listRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, diff --git a/src/main/java/com/uber/cadence/internal/sync/TestWorkflowEnvironmentInternal.java b/src/main/java/com/uber/cadence/internal/sync/TestWorkflowEnvironmentInternal.java index 5c432d1cc..aa810762e 100644 --- a/src/main/java/com/uber/cadence/internal/sync/TestWorkflowEnvironmentInternal.java +++ b/src/main/java/com/uber/cadence/internal/sync/TestWorkflowEnvironmentInternal.java @@ -29,6 +29,8 @@ import com.uber.cadence.DescribeTaskListResponse; import com.uber.cadence.DescribeWorkflowExecutionRequest; import com.uber.cadence.DescribeWorkflowExecutionResponse; +import com.uber.cadence.DiagnoseWorkflowExecutionRequest; +import com.uber.cadence.DiagnoseWorkflowExecutionResponse; import com.uber.cadence.DomainAlreadyExistsError; import com.uber.cadence.DomainNotActiveError; import com.uber.cadence.EntityNotExistsError; @@ -475,6 +477,13 @@ public void DescribeDomain( impl.DescribeDomain(describeRequest, resultHandler); } + @Override + public void DiagnoseWorkflowExecution( + DiagnoseWorkflowExecutionRequest diagnoseRequest, AsyncMethodCallback resultHandler) + throws TException { + throw new UnsupportedOperationException("DiagnoseWorkflowExecution is not implemented"); + } + @Override public void ListDomains(ListDomainsRequest listRequest, AsyncMethodCallback resultHandler) throws TException { @@ -809,6 +818,14 @@ public DescribeDomainResponse DescribeDomain(DescribeDomainRequest describeReque return impl.DescribeDomain(describeRequest); } + @Override + public DiagnoseWorkflowExecutionResponse DiagnoseWorkflowExecution( + DiagnoseWorkflowExecutionRequest diagnoseRequest) + throws DomainNotActiveError, ServiceBusyError, EntityNotExistsError, + ClientVersionNotSupportedError, TException { + throw new UnsupportedOperationException("DiagnoseWorkflowExecution is not implemented"); + } + @Override public ListDomainsResponse ListDomains(ListDomainsRequest listRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, diff --git a/src/main/java/com/uber/cadence/internal/testservice/TestWorkflowService.java b/src/main/java/com/uber/cadence/internal/testservice/TestWorkflowService.java index 8af30e9d6..d0a87ef40 100644 --- a/src/main/java/com/uber/cadence/internal/testservice/TestWorkflowService.java +++ b/src/main/java/com/uber/cadence/internal/testservice/TestWorkflowService.java @@ -29,6 +29,8 @@ import com.uber.cadence.DescribeTaskListResponse; import com.uber.cadence.DescribeWorkflowExecutionRequest; import com.uber.cadence.DescribeWorkflowExecutionResponse; +import com.uber.cadence.DiagnoseWorkflowExecutionRequest; +import com.uber.cadence.DiagnoseWorkflowExecutionResponse; import com.uber.cadence.DomainAlreadyExistsError; import com.uber.cadence.DomainNotActiveError; import com.uber.cadence.EntityNotExistsError; @@ -206,6 +208,14 @@ public DescribeDomainResponse DescribeDomain(DescribeDomainRequest describeReque throw new UnsupportedOperationException("not implemented"); } + @Override + public DiagnoseWorkflowExecutionResponse DiagnoseWorkflowExecution( + DiagnoseWorkflowExecutionRequest diagnoseRequest) + throws DomainNotActiveError, ServiceBusyError, EntityNotExistsError, + ClientVersionNotSupportedError, TException { + throw new UnsupportedOperationException("DiagnoseWorkflowExecution is not implemented"); + } + @Override public ListDomainsResponse ListDomains(ListDomainsRequest listRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, @@ -834,6 +844,13 @@ public void DescribeDomain( throw new UnsupportedOperationException("not implemented"); } + @Override + public void DiagnoseWorkflowExecution( + DiagnoseWorkflowExecutionRequest diagnoseRequest, AsyncMethodCallback resultHandler) + throws TException { + throw new UnsupportedOperationException("DiagnoseWorkflowExecution is not implemented"); + } + @Override public void ListDomains(ListDomainsRequest listRequest, AsyncMethodCallback resultHandler) throws TException { diff --git a/src/main/java/com/uber/cadence/serviceclient/IWorkflowServiceBase.java b/src/main/java/com/uber/cadence/serviceclient/IWorkflowServiceBase.java index db00bb728..7b1ce458d 100644 --- a/src/main/java/com/uber/cadence/serviceclient/IWorkflowServiceBase.java +++ b/src/main/java/com/uber/cadence/serviceclient/IWorkflowServiceBase.java @@ -43,6 +43,14 @@ public DescribeDomainResponse DescribeDomain(DescribeDomainRequest describeReque throw new UnsupportedOperationException("unimplemented"); } + @Override + public DiagnoseWorkflowExecutionResponse DiagnoseWorkflowExecution( + DiagnoseWorkflowExecutionRequest diagnoseRequest) + throws DomainNotActiveError, ServiceBusyError, EntityNotExistsError, + ClientVersionNotSupportedError, TException { + throw new UnsupportedOperationException("DiagnoseWorkflowExecution is not implemented"); + } + @Override public ListDomainsResponse ListDomains(ListDomainsRequest listRequest) throws BadRequestError, EntityNotExistsError, ServiceBusyError, @@ -377,6 +385,13 @@ public void DescribeDomain( throw new UnsupportedOperationException("unimplemented"); } + @Override + public void DiagnoseWorkflowExecution( + DiagnoseWorkflowExecutionRequest diagnoseRequest, AsyncMethodCallback resultHandler) + throws TException { + throw new UnsupportedOperationException("DiagnoseWorkflowExecution is not implemented"); + } + @Override public void ListDomains(ListDomainsRequest listRequest, AsyncMethodCallback resultHandler) throws TException { diff --git a/src/main/java/com/uber/cadence/serviceclient/WorkflowServiceTChannel.java b/src/main/java/com/uber/cadence/serviceclient/WorkflowServiceTChannel.java index 2878e6fac..d8d22695f 100644 --- a/src/main/java/com/uber/cadence/serviceclient/WorkflowServiceTChannel.java +++ b/src/main/java/com/uber/cadence/serviceclient/WorkflowServiceTChannel.java @@ -443,6 +443,14 @@ private DescribeDomainResponse describeDomain(DescribeDomainRequest describeRequ } } + @Override + public DiagnoseWorkflowExecutionResponse DiagnoseWorkflowExecution( + DiagnoseWorkflowExecutionRequest diagnoseRequest) + throws DomainNotActiveError, ServiceBusyError, EntityNotExistsError, + ClientVersionNotSupportedError, TException { + throw new UnsupportedOperationException("DiagnoseWorkflowExecution is not implemented"); + } + @Override public ListDomainsResponse ListDomains(ListDomainsRequest listRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, @@ -2937,6 +2945,13 @@ public void DescribeDomain( throw new UnsupportedOperationException("not implemented"); } + @Override + public void DiagnoseWorkflowExecution( + DiagnoseWorkflowExecutionRequest diagnoseRequest, AsyncMethodCallback resultHandler) + throws TException { + throw new UnsupportedOperationException("DiagnoseWorkflowExecution is not implemented"); + } + @Override public void ListDomains(ListDomainsRequest listRequest, AsyncMethodCallback resultHandler) throws TException { diff --git a/src/test/java/com/uber/cadence/internal/compatibility/ProtoObjects.java b/src/test/java/com/uber/cadence/internal/compatibility/ProtoObjects.java index c12ae0ea5..b0b261a07 100644 --- a/src/test/java/com/uber/cadence/internal/compatibility/ProtoObjects.java +++ b/src/test/java/com/uber/cadence/internal/compatibility/ProtoObjects.java @@ -80,6 +80,8 @@ public final class ProtoObjects { public static final Header HEADER = Header.newBuilder().putFields("key", payload("value")).build(); public static final Memo MEMO = Memo.newBuilder().putFields("memo", payload("memoValue")).build(); + public static final AutoConfigHint AUTO_CONFIG_HINT = + AutoConfigHint.newBuilder().setEnableAutoConfig(true).setPollerWaitTimeInMs(100).build(); public static final SearchAttributes SEARCH_ATTRIBUTES = SearchAttributes.newBuilder().putIndexedFields("search", payload("attributes")).build(); public static final Map DATA = ImmutableMap.of("dataKey", "dataValue"); @@ -629,6 +631,8 @@ public final class ProtoObjects { .setMemo(MEMO) .setSearchAttributes(SEARCH_ATTRIBUTES) .setDelayStart(seconds(4)) + .setJitterStart(seconds(5)) + .setFirstRunAt(timestampNanos(123456789)) .build(); public static final StartChildWorkflowExecutionFailedEventAttributes @@ -984,6 +988,7 @@ public final class ProtoObjects { DescribeWorkflowExecutionRequest.newBuilder() .setDomain("domain") .setWorkflowExecution(WORKFLOW_EXECUTION) + .setQueryConsistencyLevel(QueryConsistencyLevel.QUERY_CONSISTENCY_LEVEL_STRONG) .build(); public static final GetWorkflowExecutionHistoryRequest GET_WORKFLOW_EXECUTION_HISTORY_REQUEST = @@ -995,6 +1000,7 @@ public final class ProtoObjects { .setHistoryEventFilterType(EventFilterType.EVENT_FILTER_TYPE_CLOSE_EVENT) .setSkipArchival(true) .setNextPageToken(utf8("nextPageToken")) + .setQueryConsistencyLevel(QueryConsistencyLevel.QUERY_CONSISTENCY_LEVEL_STRONG) .build(); public static final StartWorkflowExecutionRequest START_WORKFLOW_EXECUTION = @@ -1016,6 +1022,7 @@ public final class ProtoObjects { .setHeader(HEADER) .setDelayStart(seconds(3)) .setJitterStart(seconds(0)) + .setFirstRunAt(timestampNanos(123456789)) .build(); public static final SignalWithStartWorkflowExecutionRequest SIGNAL_WITH_START_WORKFLOW_EXECUTION = @@ -1301,6 +1308,7 @@ public final class ProtoObjects { .setWorkflowType(WORKFLOW_TYPE) .setWorkflowDomain("domain") .setHeader(HEADER) + .setAutoConfigHint(AUTO_CONFIG_HINT) .build(); public static final PollForDecisionTaskResponse POLL_FOR_DECISION_TASK_RESPONSE = PollForDecisionTaskResponse.newBuilder() @@ -1319,6 +1327,7 @@ public final class ProtoObjects { .setStartedTime(timestampNanos(6)) .putAllQueries(ImmutableMap.of("query", WORKFLOW_QUERY)) .setNextEventId(7) + .setAutoConfigHint(AUTO_CONFIG_HINT) .build(); public static final QueryWorkflowResponse QUERY_WORKFLOW_RESPONSE = diff --git a/src/test/java/com/uber/cadence/internal/compatibility/Thrift2ProtoAdapterTest.java b/src/test/java/com/uber/cadence/internal/compatibility/Thrift2ProtoAdapterTest.java index a8e17d9ec..d28b69804 100644 --- a/src/test/java/com/uber/cadence/internal/compatibility/Thrift2ProtoAdapterTest.java +++ b/src/test/java/com/uber/cadence/internal/compatibility/Thrift2ProtoAdapterTest.java @@ -786,9 +786,11 @@ public void testIsHealthy() throws Exception { @Test public void testAsyncUnsupported() { assertUnsupported(WorkflowService.Iface::RestartWorkflowExecution); + assertUnsupported(WorkflowService.Iface::DiagnoseWorkflowExecution); assertUnsupported(WorkflowService.Iface::GetTaskListsByDomain); assertAsyncUnsupported(WorkflowService.AsyncIface::RegisterDomain); assertAsyncUnsupported(WorkflowService.AsyncIface::DescribeDomain); + assertAsyncUnsupported(WorkflowService.AsyncIface::DiagnoseWorkflowExecution); assertAsyncUnsupported(WorkflowService.AsyncIface::ListDomains); assertAsyncUnsupported(WorkflowService.AsyncIface::UpdateDomain); assertAsyncUnsupported(WorkflowService.AsyncIface::DeprecateDomain); diff --git a/src/test/java/com/uber/cadence/internal/compatibility/ThriftObjects.java b/src/test/java/com/uber/cadence/internal/compatibility/ThriftObjects.java index 7737f01bb..4d6db21e7 100644 --- a/src/test/java/com/uber/cadence/internal/compatibility/ThriftObjects.java +++ b/src/test/java/com/uber/cadence/internal/compatibility/ThriftObjects.java @@ -67,6 +67,8 @@ public final class ThriftObjects { .setErrorMessage("error"); public static final Header HEADER = new Header().setFields(ImmutableMap.of("key", utf8("value"))); public static final Memo MEMO = new Memo().setFields(ImmutableMap.of("memo", utf8("memoValue"))); + public static final AutoConfigHint AUTO_CONFIG_HINT = + new AutoConfigHint().setEnableAutoConfig(true).setPollerWaitTimeInMs(100); public static final SearchAttributes SEARCH_ATTRIBUTES = new SearchAttributes().setIndexedFields(ImmutableMap.of("search", utf8("attributes"))); public static final Map DATA = ImmutableMap.of("dataKey", "dataValue"); @@ -539,7 +541,9 @@ public final class ThriftObjects { .setHeader(HEADER) .setMemo(MEMO) .setSearchAttributes(SEARCH_ATTRIBUTES) - .setDelayStartSeconds(4); + .setDelayStartSeconds(4) + .setJitterStartSeconds(5) + .setFirstRunAtTimestamp(123456789L); public static final StartChildWorkflowExecutionFailedEventAttributes START_CHILD_WORKFLOW_EXECUTION_FAILED_EVENT_ATTRIBUTES = @@ -843,7 +847,10 @@ public final class ThriftObjects { .setQuery("query"); public static final DescribeWorkflowExecutionRequest DESCRIBE_WORKFLOW_EXECUTION_REQUEST = - new DescribeWorkflowExecutionRequest().setDomain("domain").setExecution(WORKFLOW_EXECUTION); + new DescribeWorkflowExecutionRequest() + .setDomain("domain") + .setExecution(WORKFLOW_EXECUTION) + .setQueryConsistencyLevel(QueryConsistencyLevel.STRONG); public static final GetWorkflowExecutionHistoryRequest GET_WORKFLOW_EXECUTION_HISTORY_REQUEST = new GetWorkflowExecutionHistoryRequest() @@ -853,7 +860,8 @@ public final class ThriftObjects { .setWaitForNewEvent(true) .setHistoryEventFilterType(HistoryEventFilterType.CLOSE_EVENT) .setSkipArchival(true) - .setNextPageToken(utf8("nextPageToken")); + .setNextPageToken(utf8("nextPageToken")) + .setQueryConsistencyLevel(QueryConsistencyLevel.STRONG); public static final com.uber.cadence.StartWorkflowExecutionRequest START_WORKFLOW_EXECUTION = new com.uber.cadence.StartWorkflowExecutionRequest() @@ -873,7 +881,8 @@ public final class ThriftObjects { .setSearchAttributes(SEARCH_ATTRIBUTES) .setHeader(HEADER) .setJitterStartSeconds(0) - .setDelayStartSeconds(3); + .setDelayStartSeconds(3) + .setFirstRunAtTimestamp(123456789L); public static final com.uber.cadence.SignalWithStartWorkflowExecutionRequest SIGNAL_WITH_START_WORKFLOW_EXECUTION = new SignalWithStartWorkflowExecutionRequest() @@ -896,7 +905,8 @@ public final class ThriftObjects { .setSearchAttributes(SEARCH_ATTRIBUTES) .setHeader(HEADER) .setDelayStartSeconds(3) - .setJitterStartSeconds(0); + .setJitterStartSeconds(0) + .setFirstRunAtTimestamp(123456789L); public static final StartWorkflowExecutionAsyncRequest START_WORKFLOW_EXECUTION_ASYNC_REQUEST = new StartWorkflowExecutionAsyncRequest().setRequest(START_WORKFLOW_EXECUTION); @@ -1103,7 +1113,8 @@ public final class ThriftObjects { .setHeartbeatDetails(utf8("heartbeatDetails")) .setWorkflowType(WORKFLOW_TYPE) .setWorkflowDomain("domain") - .setHeader(HEADER); + .setHeader(HEADER) + .setAutoConfigHint(AUTO_CONFIG_HINT); public static final PollForDecisionTaskResponse POLL_FOR_DECISION_TASK_RESPONSE = new PollForDecisionTaskResponse() .setTaskToken(utf8("taskToken")) @@ -1120,7 +1131,8 @@ public final class ThriftObjects { .setScheduledTimestamp(5) .setStartedTimestamp(6) .setQueries(ImmutableMap.of("query", WORKFLOW_QUERY)) - .setNextEventId(7); + .setNextEventId(7) + .setAutoConfigHint(AUTO_CONFIG_HINT); public static final QueryWorkflowResponse QUERY_WORKFLOW_RESPONSE = new QueryWorkflowResponse() diff --git a/src/test/java/com/uber/cadence/internal/compatibility/thrift/HistoryMapperEventTest.java b/src/test/java/com/uber/cadence/internal/compatibility/thrift/HistoryMapperEventTest.java index 37fb3caf1..a3072a2d1 100644 --- a/src/test/java/com/uber/cadence/internal/compatibility/thrift/HistoryMapperEventTest.java +++ b/src/test/java/com/uber/cadence/internal/compatibility/thrift/HistoryMapperEventTest.java @@ -283,8 +283,7 @@ public static Object[][] cases() { testCase( EventType.StartChildWorkflowExecutionInitiated, ProtoObjects.START_CHILD_WORKFLOW_EXECUTION_INITIATED_EVENT_ATTRIBUTES, - ThriftObjects.START_CHILD_WORKFLOW_EXECUTION_INITIATED_EVENT_ATTRIBUTES, - "jitterStartSeconds"), + ThriftObjects.START_CHILD_WORKFLOW_EXECUTION_INITIATED_EVENT_ATTRIBUTES), testCase( EventType.StartChildWorkflowExecutionFailed, ProtoObjects.START_CHILD_WORKFLOW_EXECUTION_FAILED_EVENT_ATTRIBUTES, diff --git a/src/test/java/com/uber/cadence/internal/testservice/TestWorkflowServiceDiagnoseTest.java b/src/test/java/com/uber/cadence/internal/testservice/TestWorkflowServiceDiagnoseTest.java new file mode 100644 index 000000000..333abd2c9 --- /dev/null +++ b/src/test/java/com/uber/cadence/internal/testservice/TestWorkflowServiceDiagnoseTest.java @@ -0,0 +1,50 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

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 + * + *

http://aws.amazon.com/apache2.0 + * + *

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.testservice; + +import static org.junit.Assert.assertThrows; + +import com.uber.cadence.DiagnoseWorkflowExecutionRequest; +import org.apache.thrift.async.AsyncMethodCallback; +import org.junit.Test; + +public class TestWorkflowServiceDiagnoseTest { + + private final TestWorkflowService service = new TestWorkflowService(); + + @Test + public void testDiagnoseWorkflowExecutionThrowsUnsupportedOperation() { + DiagnoseWorkflowExecutionRequest request = new DiagnoseWorkflowExecutionRequest(); + assertThrows( + UnsupportedOperationException.class, () -> service.DiagnoseWorkflowExecution(request)); + } + + @Test + public void testDiagnoseWorkflowExecutionAsyncThrowsUnsupportedOperation() { + DiagnoseWorkflowExecutionRequest request = new DiagnoseWorkflowExecutionRequest(); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(Object response) {} + + @Override + public void onError(Exception exception) {} + }; + + assertThrows( + UnsupportedOperationException.class, + () -> service.DiagnoseWorkflowExecution(request, callback)); + } +} diff --git a/src/test/java/com/uber/cadence/serviceclient/IWorkflowServiceBaseTest.java b/src/test/java/com/uber/cadence/serviceclient/IWorkflowServiceBaseTest.java index de02e485e..4408cf4af 100644 --- a/src/test/java/com/uber/cadence/serviceclient/IWorkflowServiceBaseTest.java +++ b/src/test/java/com/uber/cadence/serviceclient/IWorkflowServiceBaseTest.java @@ -36,6 +36,13 @@ public void testDescribeDomain() { assertThrows(UnsupportedOperationException.class, () -> service.DescribeDomain(null, null)); } + public void testDiagnoseWorkflowExecution() { + assertThrows( + UnsupportedOperationException.class, () -> service.DiagnoseWorkflowExecution(null)); + assertThrows( + UnsupportedOperationException.class, () -> service.DiagnoseWorkflowExecution(null, null)); + } + public void testListDomains() { assertThrows(UnsupportedOperationException.class, () -> service.ListDomains(null)); assertThrows(UnsupportedOperationException.class, () -> service.ListDomains(null, null)); diff --git a/src/test/java/com/uber/cadence/serviceclient/WorkflowServiceTChannelDiagnoseTest.java b/src/test/java/com/uber/cadence/serviceclient/WorkflowServiceTChannelDiagnoseTest.java new file mode 100644 index 000000000..536db39d9 --- /dev/null +++ b/src/test/java/com/uber/cadence/serviceclient/WorkflowServiceTChannelDiagnoseTest.java @@ -0,0 +1,59 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

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 + * + *

http://aws.amazon.com/apache2.0 + * + *

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 static org.mockito.Mockito.mock; + +import com.uber.cadence.DiagnoseWorkflowExecutionRequest; +import com.uber.tchannel.api.SubChannel; +import org.apache.thrift.async.AsyncMethodCallback; +import org.junit.Before; +import org.junit.Test; + +public class WorkflowServiceTChannelDiagnoseTest { + + private WorkflowServiceTChannel service; + + @Before + public void setUp() { + SubChannel mockSubChannel = mock(SubChannel.class); + service = new WorkflowServiceTChannel(mockSubChannel, ClientOptions.newBuilder().build()); + } + + @Test + public void testDiagnoseWorkflowExecutionThrowsUnsupportedOperation() { + DiagnoseWorkflowExecutionRequest request = new DiagnoseWorkflowExecutionRequest(); + assertThrows( + UnsupportedOperationException.class, () -> service.DiagnoseWorkflowExecution(request)); + } + + @Test + public void testDiagnoseWorkflowExecutionAsyncThrowsUnsupportedOperation() { + DiagnoseWorkflowExecutionRequest request = new DiagnoseWorkflowExecutionRequest(); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(Object response) {} + + @Override + public void onError(Exception exception) {} + }; + + assertThrows( + UnsupportedOperationException.class, + () -> service.DiagnoseWorkflowExecution(request, callback)); + } +}