Skip to content

Commit 08baa9a

Browse files
committed
Fix proto and thrift mappers
1 parent ca5360f commit 08baa9a

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

src/main/java/com/uber/cadence/internal/compatibility/proto/RequestMapper.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import static com.uber.cadence.internal.compatibility.proto.Helpers.newFieldMask;
3030
import static com.uber.cadence.internal.compatibility.proto.Helpers.nullToEmpty;
3131
import static com.uber.cadence.internal.compatibility.proto.Helpers.secondsToDuration;
32+
import static com.uber.cadence.internal.compatibility.proto.Helpers.unixNanoToTime;
3233
import static com.uber.cadence.internal.compatibility.proto.TypeMapper.badBinaries;
3334
import static com.uber.cadence.internal.compatibility.proto.TypeMapper.clusterReplicationConfigurationArray;
3435
import static com.uber.cadence.internal.compatibility.proto.TypeMapper.failure;
@@ -403,6 +404,7 @@ public static DescribeWorkflowExecutionRequest describeWorkflowExecutionRequest(
403404
return DescribeWorkflowExecutionRequest.newBuilder()
404405
.setDomain(t.getDomain())
405406
.setWorkflowExecution(workflowExecution(t.getExecution()))
407+
.setQueryConsistencyLevel(queryConsistencyLevel(t.getQueryConsistencyLevel()))
406408
.build();
407409
}
408410

@@ -418,7 +420,8 @@ public static GetWorkflowExecutionHistoryRequest getWorkflowExecutionHistoryRequ
418420
.setPageSize(t.getMaximumPageSize())
419421
.setWaitForNewEvent(t.isWaitForNewEvent())
420422
.setHistoryEventFilterType(eventFilterType(t.HistoryEventFilterType))
421-
.setSkipArchival(t.isSkipArchival());
423+
.setSkipArchival(t.isSkipArchival())
424+
.setQueryConsistencyLevel(queryConsistencyLevel(t.getQueryConsistencyLevel()));
422425
if (t.getNextPageToken() != null) {
423426
builder.setNextPageToken(arrayToByteString(t.getNextPageToken()));
424427
}
@@ -445,6 +448,9 @@ public static SignalWithStartWorkflowExecutionRequest signalWithStartWorkflowExe
445448
.setSearchAttributes(searchAttributes(t.getSearchAttributes()))
446449
.setHeader(header(t.getHeader()))
447450
.setJitterStart(secondsToDuration(t.getJitterStartSeconds()));
451+
if (t.isSetFirstRunAtTimestamp()) {
452+
builder.setFirstRunAt(unixNanoToTime(t.getFirstRunAtTimestamp()));
453+
}
448454
if (t.getRetryPolicy() != null) {
449455
builder.setRetryPolicy(retryPolicy(t.getRetryPolicy()));
450456
}
@@ -530,6 +536,9 @@ public static StartWorkflowExecutionRequest startWorkflowExecutionRequest(
530536
.setHeader(header(t.getHeader()))
531537
.setDelayStart(secondsToDuration(t.getDelayStartSeconds()))
532538
.setJitterStart(secondsToDuration(t.getJitterStartSeconds()));
539+
if (t.isSetFirstRunAtTimestamp()) {
540+
request.setFirstRunAt(unixNanoToTime(t.getFirstRunAtTimestamp()));
541+
}
533542
if (t.getRetryPolicy() != null) {
534543
request.setRetryPolicy(retryPolicy(t.getRetryPolicy()));
535544
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,7 @@ public final class ProtoObjects {
984984
DescribeWorkflowExecutionRequest.newBuilder()
985985
.setDomain("domain")
986986
.setWorkflowExecution(WORKFLOW_EXECUTION)
987+
.setQueryConsistencyLevel(QueryConsistencyLevel.QUERY_CONSISTENCY_LEVEL_STRONG)
987988
.build();
988989

989990
public static final GetWorkflowExecutionHistoryRequest GET_WORKFLOW_EXECUTION_HISTORY_REQUEST =
@@ -995,6 +996,7 @@ public final class ProtoObjects {
995996
.setHistoryEventFilterType(EventFilterType.EVENT_FILTER_TYPE_CLOSE_EVENT)
996997
.setSkipArchival(true)
997998
.setNextPageToken(utf8("nextPageToken"))
999+
.setQueryConsistencyLevel(QueryConsistencyLevel.QUERY_CONSISTENCY_LEVEL_STRONG)
9981000
.build();
9991001

10001002
public static final StartWorkflowExecutionRequest START_WORKFLOW_EXECUTION =
@@ -1016,6 +1018,7 @@ public final class ProtoObjects {
10161018
.setHeader(HEADER)
10171019
.setDelayStart(seconds(3))
10181020
.setJitterStart(seconds(0))
1021+
.setFirstRunAt(timestampNanos(123456789))
10191022
.build();
10201023

10211024
public static final SignalWithStartWorkflowExecutionRequest SIGNAL_WITH_START_WORKFLOW_EXECUTION =

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,10 @@ public final class ThriftObjects {
843843
.setQuery("query");
844844

845845
public static final DescribeWorkflowExecutionRequest DESCRIBE_WORKFLOW_EXECUTION_REQUEST =
846-
new DescribeWorkflowExecutionRequest().setDomain("domain").setExecution(WORKFLOW_EXECUTION);
846+
new DescribeWorkflowExecutionRequest()
847+
.setDomain("domain")
848+
.setExecution(WORKFLOW_EXECUTION)
849+
.setQueryConsistencyLevel(QueryConsistencyLevel.STRONG);
847850

848851
public static final GetWorkflowExecutionHistoryRequest GET_WORKFLOW_EXECUTION_HISTORY_REQUEST =
849852
new GetWorkflowExecutionHistoryRequest()
@@ -853,7 +856,8 @@ public final class ThriftObjects {
853856
.setWaitForNewEvent(true)
854857
.setHistoryEventFilterType(HistoryEventFilterType.CLOSE_EVENT)
855858
.setSkipArchival(true)
856-
.setNextPageToken(utf8("nextPageToken"));
859+
.setNextPageToken(utf8("nextPageToken"))
860+
.setQueryConsistencyLevel(QueryConsistencyLevel.STRONG);
857861

858862
public static final com.uber.cadence.StartWorkflowExecutionRequest START_WORKFLOW_EXECUTION =
859863
new com.uber.cadence.StartWorkflowExecutionRequest()
@@ -873,7 +877,8 @@ public final class ThriftObjects {
873877
.setSearchAttributes(SEARCH_ATTRIBUTES)
874878
.setHeader(HEADER)
875879
.setJitterStartSeconds(0)
876-
.setDelayStartSeconds(3);
880+
.setDelayStartSeconds(3)
881+
.setFirstRunAtTimestamp(123456789L);
877882
public static final com.uber.cadence.SignalWithStartWorkflowExecutionRequest
878883
SIGNAL_WITH_START_WORKFLOW_EXECUTION =
879884
new SignalWithStartWorkflowExecutionRequest()
@@ -896,7 +901,8 @@ public final class ThriftObjects {
896901
.setSearchAttributes(SEARCH_ATTRIBUTES)
897902
.setHeader(HEADER)
898903
.setDelayStartSeconds(3)
899-
.setJitterStartSeconds(0);
904+
.setJitterStartSeconds(0)
905+
.setFirstRunAtTimestamp(123456789L);
900906

901907
public static final StartWorkflowExecutionAsyncRequest START_WORKFLOW_EXECUTION_ASYNC_REQUEST =
902908
new StartWorkflowExecutionAsyncRequest().setRequest(START_WORKFLOW_EXECUTION);

0 commit comments

Comments
 (0)