• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

uber / cadence-java-client / 2616

06 Nov 2024 07:00PM UTC coverage: 76.181% (-2.0%) from 78.135%
2616

Pull #945

buildkite

shijiesheng
remove unneeded file
Pull Request #945: fix unimplementented methods of TestWorkflowEnvironment

4 of 10 new or added lines in 2 files covered. (40.0%)

414 existing lines in 7 files now uncovered.

14770 of 19388 relevant lines covered (76.18%)

0.76 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

24.51
/src/main/java/com/uber/cadence/internal/compatibility/thrift/TypeMapper.java
1
/*
2
 *  Modifications Copyright (c) 2017-2021 Uber Technologies Inc.
3
 *  Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
 *
5
 *  Licensed under the Apache License, Version 2.0 (the "License"). You may not
6
 *  use this file except in compliance with the License. A copy of the License is
7
 *  located at
8
 *
9
 *  http://aws.amazon.com/apache2.0
10
 *
11
 *  or in the "license" file accompanying this file. This file is distributed on
12
 *  an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13
 *  express or implied. See the License for the specific language governing
14
 *  permissions and limitations under the License.
15
 */
16
package com.uber.cadence.internal.compatibility.thrift;
17

18
import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.archivalStatus;
19
import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.domainStatus;
20
import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.encodingType;
21
import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.indexedValueType;
22
import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.parentClosePolicy;
23
import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.pendingActivityState;
24
import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.pendingDecisionState;
25
import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.taskListKind;
26
import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.workflowExecutionCloseStatus;
27
import static com.uber.cadence.internal.compatibility.thrift.Helpers.byteStringToArray;
28
import static com.uber.cadence.internal.compatibility.thrift.Helpers.durationToDays;
29
import static com.uber.cadence.internal.compatibility.thrift.Helpers.durationToSeconds;
30
import static com.uber.cadence.internal.compatibility.thrift.Helpers.timeToUnixNano;
31

32
import com.uber.cadence.ActivityLocalDispatchInfo;
33
import com.uber.cadence.ActivityType;
34
import com.uber.cadence.BadBinaries;
35
import com.uber.cadence.BadBinaryInfo;
36
import com.uber.cadence.ClusterReplicationConfiguration;
37
import com.uber.cadence.DataBlob;
38
import com.uber.cadence.DescribeDomainResponse;
39
import com.uber.cadence.DomainConfiguration;
40
import com.uber.cadence.DomainInfo;
41
import com.uber.cadence.DomainReplicationConfiguration;
42
import com.uber.cadence.Header;
43
import com.uber.cadence.IndexedValueType;
44
import com.uber.cadence.Memo;
45
import com.uber.cadence.PendingActivityInfo;
46
import com.uber.cadence.PendingChildExecutionInfo;
47
import com.uber.cadence.PendingDecisionInfo;
48
import com.uber.cadence.PollerInfo;
49
import com.uber.cadence.QueryRejected;
50
import com.uber.cadence.ResetPointInfo;
51
import com.uber.cadence.ResetPoints;
52
import com.uber.cadence.RetryPolicy;
53
import com.uber.cadence.SearchAttributes;
54
import com.uber.cadence.SupportedClientVersions;
55
import com.uber.cadence.TaskIDBlock;
56
import com.uber.cadence.TaskList;
57
import com.uber.cadence.TaskListPartitionMetadata;
58
import com.uber.cadence.TaskListStatus;
59
import com.uber.cadence.WorkflowExecution;
60
import com.uber.cadence.WorkflowExecutionConfiguration;
61
import com.uber.cadence.WorkflowExecutionInfo;
62
import com.uber.cadence.WorkflowQuery;
63
import com.uber.cadence.WorkflowType;
64
import java.nio.ByteBuffer;
65
import java.util.ArrayList;
66
import java.util.HashMap;
67
import java.util.List;
68
import java.util.Map;
69

70
class TypeMapper {
×
71

72
  static byte[] payload(com.uber.cadence.api.v1.Payload t) {
73
    if (t == null || t == com.uber.cadence.api.v1.Payload.getDefaultInstance()) {
1✔
74
      return null;
×
75
    }
76
    if (t.getData() == null || t.getData().size() == 0) {
1✔
77
      // protoPayload will not generate this case
78
      // however, Data field will be dropped by the encoding if it's empty
79
      // and receiver side will see null for the Data field
80
      // since we already know p is not null, Data field must be an empty byte array
81
      return new byte[0];
×
82
    }
83
    return byteStringToArray(t.getData());
1✔
84
  }
85

86
  static String failureReason(com.uber.cadence.api.v1.Failure t) {
87
    if (t == null || t == com.uber.cadence.api.v1.Failure.getDefaultInstance()) {
1✔
88
      return null;
×
89
    }
90
    return t.getReason();
1✔
91
  }
92

93
  static byte[] failureDetails(com.uber.cadence.api.v1.Failure t) {
94
    if (t == null || t == com.uber.cadence.api.v1.Failure.getDefaultInstance()) {
1✔
95
      return null;
×
96
    }
97
    return byteStringToArray(t.getDetails());
1✔
98
  }
99

100
  static WorkflowExecution workflowExecution(com.uber.cadence.api.v1.WorkflowExecution t) {
101
    if (t == null || t == com.uber.cadence.api.v1.WorkflowExecution.getDefaultInstance()) {
1✔
102
      return null;
×
103
    }
104
    WorkflowExecution we = new WorkflowExecution();
1✔
105
    we.setWorkflowId(t.getWorkflowId());
1✔
106
    we.setRunId(t.getRunId());
1✔
107
    return we;
1✔
108
  }
109

110
  static String workflowId(com.uber.cadence.api.v1.WorkflowExecution t) {
UNCOV
111
    if (t == null || t == com.uber.cadence.api.v1.WorkflowExecution.getDefaultInstance()) {
×
112
      return null;
×
113
    }
UNCOV
114
    return t.getWorkflowId();
×
115
  }
116

117
  static String runId(com.uber.cadence.api.v1.WorkflowExecution t) {
UNCOV
118
    if (t == null || t == com.uber.cadence.api.v1.WorkflowExecution.getDefaultInstance()) {
×
119
      return null;
×
120
    }
UNCOV
121
    return t.getRunId();
×
122
  }
123

124
  static ActivityType activityType(com.uber.cadence.api.v1.ActivityType t) {
125
    if (t == null || t == com.uber.cadence.api.v1.ActivityType.getDefaultInstance()) {
1✔
126
      return null;
×
127
    }
128
    ActivityType activityType = new ActivityType();
1✔
129
    activityType.setName(t.getName());
1✔
130
    return activityType;
1✔
131
  }
132

133
  static WorkflowType workflowType(com.uber.cadence.api.v1.WorkflowType t) {
134
    if (t == null || t == com.uber.cadence.api.v1.WorkflowType.getDefaultInstance()) {
1✔
135
      return null;
×
136
    }
137
    WorkflowType wt = new WorkflowType();
1✔
138
    wt.setName(t.getName());
1✔
139

140
    return wt;
1✔
141
  }
142

143
  static TaskList taskList(com.uber.cadence.api.v1.TaskList t) {
144
    if (t == null || t == com.uber.cadence.api.v1.TaskList.getDefaultInstance()) {
1✔
145
      return null;
×
146
    }
147
    TaskList taskList = new TaskList();
1✔
148
    taskList.setName(t.getName());
1✔
149
    taskList.setKind(taskListKind(t.getKind()));
1✔
150
    return taskList;
1✔
151
  }
152

153
  static RetryPolicy retryPolicy(com.uber.cadence.api.v1.RetryPolicy t) {
154
    if (t == null || t == com.uber.cadence.api.v1.RetryPolicy.getDefaultInstance()) {
1✔
155
      return null;
×
156
    }
157
    RetryPolicy res = new RetryPolicy();
1✔
158
    res.setInitialIntervalInSeconds(durationToSeconds(t.getInitialInterval()));
1✔
159
    res.setBackoffCoefficient(t.getBackoffCoefficient());
1✔
160
    res.setMaximumIntervalInSeconds(durationToSeconds(t.getMaximumInterval()));
1✔
161
    res.setMaximumAttempts(t.getMaximumAttempts());
1✔
162
    res.setNonRetriableErrorReasons(t.getNonRetryableErrorReasonsList());
1✔
163
    res.setExpirationIntervalInSeconds(durationToSeconds(t.getExpirationInterval()));
1✔
164
    return res;
1✔
165
  }
166

167
  static Header header(com.uber.cadence.api.v1.Header t) {
168
    if (t == null || t == com.uber.cadence.api.v1.Header.getDefaultInstance()) {
1✔
169
      return null;
×
170
    }
171
    Header res = new Header();
1✔
172
    res.setFields(payloadMap(t.getFieldsMap()));
1✔
173
    return res;
1✔
174
  }
175

176
  static Memo memo(com.uber.cadence.api.v1.Memo t) {
177
    if (t == null || t == com.uber.cadence.api.v1.Memo.getDefaultInstance()) {
1✔
178
      return null;
×
179
    }
180
    Memo res = new Memo();
1✔
181
    res.setFields(payloadMap(t.getFieldsMap()));
1✔
182
    return res;
1✔
183
  }
184

185
  static SearchAttributes searchAttributes(com.uber.cadence.api.v1.SearchAttributes t) {
186
    if (t == null
1✔
187
        || t.getAllFields().size() == 0
1✔
188
        || t == com.uber.cadence.api.v1.SearchAttributes.getDefaultInstance()) {
1✔
189
      return null;
×
190
    }
191
    SearchAttributes res = new SearchAttributes();
1✔
192
    res.setIndexedFields(payloadMap(t.getIndexedFieldsMap()));
1✔
193
    return res;
1✔
194
  }
195

196
  static BadBinaries badBinaries(com.uber.cadence.api.v1.BadBinaries t) {
197
    if (t == null || t == com.uber.cadence.api.v1.BadBinaries.getDefaultInstance()) {
1✔
198
      return null;
1✔
199
    }
UNCOV
200
    BadBinaries badBinaries = new BadBinaries();
×
UNCOV
201
    badBinaries.setBinaries(badBinaryInfoMap(t.getBinariesMap()));
×
UNCOV
202
    return badBinaries;
×
203
  }
204

205
  static BadBinaryInfo badBinaryInfo(com.uber.cadence.api.v1.BadBinaryInfo t) {
UNCOV
206
    if (t == null || t == com.uber.cadence.api.v1.BadBinaryInfo.getDefaultInstance()) {
×
207
      return null;
×
208
    }
UNCOV
209
    BadBinaryInfo res = new BadBinaryInfo();
×
UNCOV
210
    res.setReason(t.getReason());
×
UNCOV
211
    res.setOperator(t.getOperator());
×
UNCOV
212
    res.setCreatedTimeNano(timeToUnixNano(t.getCreatedTime()));
×
UNCOV
213
    return res;
×
214
  }
215

216
  static Map<String, BadBinaryInfo> badBinaryInfoMap(
217
      Map<String, com.uber.cadence.api.v1.BadBinaryInfo> t) {
UNCOV
218
    if (t == null) {
×
219
      return null;
×
220
    }
UNCOV
221
    Map<String, BadBinaryInfo> v = new HashMap<>();
×
UNCOV
222
    for (String key : t.keySet()) {
×
UNCOV
223
      v.put(key, badBinaryInfo(t.get(key)));
×
UNCOV
224
    }
×
UNCOV
225
    return v;
×
226
  }
227

228
  static WorkflowQuery workflowQuery(com.uber.cadence.api.v1.WorkflowQuery t) {
UNCOV
229
    if (t == null || t == com.uber.cadence.api.v1.WorkflowQuery.getDefaultInstance()) {
×
230
      return null;
×
231
    }
UNCOV
232
    WorkflowQuery res = new WorkflowQuery();
×
UNCOV
233
    res.setQueryType(t.getQueryType());
×
UNCOV
234
    res.setQueryArgs(payload(t.getQueryArgs()));
×
UNCOV
235
    return res;
×
236
  }
237

238
  static Map<String, ByteBuffer> payloadMap(Map<String, com.uber.cadence.api.v1.Payload> t) {
239
    if (t == null) {
1✔
240
      return null;
×
241
    }
242
    Map<String, ByteBuffer> v = new HashMap<>();
1✔
243
    for (String key : t.keySet()) {
1✔
244
      v.put(key, ByteBuffer.wrap(payload(t.get(key))));
1✔
245
    }
1✔
246
    return v;
1✔
247
  }
248

249
  static List<ClusterReplicationConfiguration> clusterReplicationConfigurationArray(
250
      List<com.uber.cadence.api.v1.ClusterReplicationConfiguration> t) {
251
    if (t == null) {
1✔
252
      return null;
×
253
    }
254
    List<ClusterReplicationConfiguration> v = new ArrayList<>();
1✔
255
    for (int i = 0; i < t.size(); i++) {
1✔
UNCOV
256
      v.add(clusterReplicationConfiguration(t.get(i)));
×
257
    }
258
    return v;
1✔
259
  }
260

261
  static ClusterReplicationConfiguration clusterReplicationConfiguration(
262
      com.uber.cadence.api.v1.ClusterReplicationConfiguration t) {
UNCOV
263
    if (t == null
×
UNCOV
264
        || t == com.uber.cadence.api.v1.ClusterReplicationConfiguration.getDefaultInstance()) {
×
265
      return null;
×
266
    }
UNCOV
267
    ClusterReplicationConfiguration res = new ClusterReplicationConfiguration();
×
UNCOV
268
    res.setClusterName(t.getClusterName());
×
UNCOV
269
    return res;
×
270
  }
271

272
  static DataBlob dataBlob(com.uber.cadence.api.v1.DataBlob t) {
UNCOV
273
    if (t == null || t == com.uber.cadence.api.v1.DataBlob.getDefaultInstance()) {
×
274
      return null;
×
275
    }
UNCOV
276
    DataBlob dataBlob = new DataBlob();
×
UNCOV
277
    dataBlob.setEncodingType(encodingType(t.getEncodingType()));
×
UNCOV
278
    dataBlob.setData(byteStringToArray(t.getData()));
×
UNCOV
279
    return dataBlob;
×
280
  }
281

282
  static long externalInitiatedId(com.uber.cadence.api.v1.ExternalExecutionInfo t) {
283
    return t.getInitiatedId();
1✔
284
  }
285

286
  static WorkflowExecution externalWorkflowExecution(
287
      com.uber.cadence.api.v1.ExternalExecutionInfo t) {
288
    if (t == null || t == com.uber.cadence.api.v1.ExternalExecutionInfo.getDefaultInstance()) {
1✔
289
      return null;
×
290
    }
291
    return workflowExecution(t.getWorkflowExecution());
1✔
292
  }
293

294
  static ResetPoints resetPoints(com.uber.cadence.api.v1.ResetPoints t) {
295
    if (t == null || t == com.uber.cadence.api.v1.ResetPoints.getDefaultInstance()) {
1✔
296
      return null;
×
297
    }
298
    ResetPoints res = new ResetPoints();
1✔
299
    res.setPoints(resetPointInfoArray(t.getPointsList()));
1✔
300
    return res;
1✔
301
  }
302

303
  static ResetPointInfo resetPointInfo(com.uber.cadence.api.v1.ResetPointInfo t) {
304
    if (t == null || t == com.uber.cadence.api.v1.ResetPointInfo.getDefaultInstance()) {
1✔
305
      return null;
×
306
    }
307
    ResetPointInfo res = new ResetPointInfo();
1✔
308
    res.setBinaryChecksum(t.getBinaryChecksum());
1✔
309
    res.setRunId(t.getRunId());
1✔
310
    res.setFirstDecisionCompletedId(t.getFirstDecisionCompletedId());
1✔
311
    res.setCreatedTimeNano(timeToUnixNano(t.getCreatedTime()));
1✔
312
    res.setExpiringTimeNano(timeToUnixNano(t.getExpiringTime()));
1✔
313
    res.setResettable(t.getResettable());
1✔
314
    return res;
1✔
315
  }
316

317
  static PollerInfo pollerInfo(com.uber.cadence.api.v1.PollerInfo t) {
UNCOV
318
    if (t == null || t == com.uber.cadence.api.v1.PollerInfo.getDefaultInstance()) {
×
319
      return null;
×
320
    }
UNCOV
321
    PollerInfo res = new PollerInfo();
×
UNCOV
322
    res.setLastAccessTime(timeToUnixNano(t.getLastAccessTime()));
×
UNCOV
323
    res.setIdentity(t.getIdentity());
×
UNCOV
324
    res.setRatePerSecond(t.getRatePerSecond());
×
UNCOV
325
    return res;
×
326
  }
327

328
  static TaskListStatus taskListStatus(com.uber.cadence.api.v1.TaskListStatus t) {
UNCOV
329
    if (t == null || t == com.uber.cadence.api.v1.TaskListStatus.getDefaultInstance()) {
×
330
      return null;
×
331
    }
UNCOV
332
    TaskListStatus res = new TaskListStatus();
×
UNCOV
333
    res.setBacklogCountHint(t.getBacklogCountHint());
×
UNCOV
334
    res.setReadLevel(t.getReadLevel());
×
UNCOV
335
    res.setAckLevel(t.getAckLevel());
×
UNCOV
336
    res.setRatePerSecond(t.getRatePerSecond());
×
UNCOV
337
    res.setTaskIDBlock(taskIdBlock(t.getTaskIdBlock()));
×
UNCOV
338
    return res;
×
339
  }
340

341
  static TaskIDBlock taskIdBlock(com.uber.cadence.api.v1.TaskIDBlock t) {
UNCOV
342
    if (t == null || t == com.uber.cadence.api.v1.TaskIDBlock.getDefaultInstance()) {
×
343
      return null;
×
344
    }
UNCOV
345
    TaskIDBlock res = new TaskIDBlock();
×
UNCOV
346
    res.setStartID(t.getStartId());
×
UNCOV
347
    res.setEndID(t.getEndId());
×
UNCOV
348
    return res;
×
349
  }
350

351
  static WorkflowExecutionConfiguration workflowExecutionConfiguration(
352
      com.uber.cadence.api.v1.WorkflowExecutionConfiguration t) {
UNCOV
353
    if (t == null
×
UNCOV
354
        || t == com.uber.cadence.api.v1.WorkflowExecutionConfiguration.getDefaultInstance()) {
×
355
      return null;
×
356
    }
UNCOV
357
    WorkflowExecutionConfiguration res = new WorkflowExecutionConfiguration();
×
UNCOV
358
    res.setTaskList(taskList(t.getTaskList()));
×
UNCOV
359
    res.setExecutionStartToCloseTimeoutSeconds(
×
UNCOV
360
        durationToSeconds(t.getExecutionStartToCloseTimeout()));
×
UNCOV
361
    res.setTaskStartToCloseTimeoutSeconds(durationToSeconds(t.getTaskStartToCloseTimeout()));
×
UNCOV
362
    return res;
×
363
  }
364

365
  static WorkflowExecutionInfo workflowExecutionInfo(
366
      com.uber.cadence.api.v1.WorkflowExecutionInfo t) {
UNCOV
367
    if (t == null || t == com.uber.cadence.api.v1.WorkflowExecutionInfo.getDefaultInstance()) {
×
368
      return null;
×
369
    }
UNCOV
370
    WorkflowExecutionInfo res = new WorkflowExecutionInfo();
×
UNCOV
371
    res.setExecution(workflowExecution(t.getWorkflowExecution()));
×
UNCOV
372
    res.setType(workflowType(t.getType()));
×
UNCOV
373
    res.setStartTime(timeToUnixNano(t.getStartTime()));
×
UNCOV
374
    res.setCloseTime(timeToUnixNano(t.getCloseTime()));
×
UNCOV
375
    res.setCloseStatus(workflowExecutionCloseStatus(t.getCloseStatus()));
×
UNCOV
376
    res.setHistoryLength(t.getHistoryLength());
×
UNCOV
377
    res.setParentDomainId(parentDomainId(t.getParentExecutionInfo()));
×
UNCOV
378
    res.setParentExecution(parentWorkflowExecution(t.getParentExecutionInfo()));
×
UNCOV
379
    res.setExecutionTime(timeToUnixNano(t.getExecutionTime()));
×
UNCOV
380
    res.setMemo(memo(t.getMemo()));
×
UNCOV
381
    res.setSearchAttributes(searchAttributes(t.getSearchAttributes()));
×
UNCOV
382
    res.setAutoResetPoints(resetPoints(t.getAutoResetPoints()));
×
UNCOV
383
    res.setTaskList(t.getTaskList());
×
UNCOV
384
    res.setIsCron(t.getIsCron());
×
UNCOV
385
    return res;
×
386
  }
387

388
  static String parentDomainId(com.uber.cadence.api.v1.ParentExecutionInfo t) {
UNCOV
389
    if (t == null || t == com.uber.cadence.api.v1.ParentExecutionInfo.getDefaultInstance()) {
×
390
      return null;
×
391
    }
UNCOV
392
    return t.getDomainId();
×
393
  }
394

395
  static String parentDomainName(com.uber.cadence.api.v1.ParentExecutionInfo t) {
396
    if (t == null || t == com.uber.cadence.api.v1.ParentExecutionInfo.getDefaultInstance()) {
1✔
397
      return null;
×
398
    }
399
    return t.getDomainName();
1✔
400
  }
401

402
  static long parentInitiatedId(com.uber.cadence.api.v1.ParentExecutionInfo t) {
403
    if (t == null || t == com.uber.cadence.api.v1.ParentExecutionInfo.getDefaultInstance()) {
1✔
404
      return -1;
×
405
    }
406
    return t.getInitiatedId();
1✔
407
  }
408

409
  static WorkflowExecution parentWorkflowExecution(com.uber.cadence.api.v1.ParentExecutionInfo t) {
410
    if (t == null || t == com.uber.cadence.api.v1.ParentExecutionInfo.getDefaultInstance()) {
1✔
411
      return null;
×
412
    }
413
    return workflowExecution(t.getWorkflowExecution());
1✔
414
  }
415

416
  static PendingActivityInfo pendingActivityInfo(com.uber.cadence.api.v1.PendingActivityInfo t) {
UNCOV
417
    if (t == null || t == com.uber.cadence.api.v1.PendingActivityInfo.getDefaultInstance()) {
×
418
      return null;
×
419
    }
UNCOV
420
    PendingActivityInfo res = new PendingActivityInfo();
×
UNCOV
421
    res.setActivityID(t.getActivityId());
×
UNCOV
422
    res.setActivityType(activityType(t.getActivityType()));
×
UNCOV
423
    res.setState(pendingActivityState(t.getState()));
×
UNCOV
424
    res.setHeartbeatDetails(payload(t.getHeartbeatDetails()));
×
UNCOV
425
    res.setLastHeartbeatTimestamp(timeToUnixNano(t.getLastHeartbeatTime()));
×
UNCOV
426
    res.setLastStartedTimestamp(timeToUnixNano(t.getLastStartedTime()));
×
UNCOV
427
    res.setAttempt(t.getAttempt());
×
UNCOV
428
    res.setMaximumAttempts(t.getMaximumAttempts());
×
UNCOV
429
    res.setScheduledTimestamp(timeToUnixNano(t.getScheduledTime()));
×
UNCOV
430
    res.setExpirationTimestamp(timeToUnixNano(t.getExpirationTime()));
×
UNCOV
431
    res.setLastFailureReason(failureReason(t.getLastFailure()));
×
UNCOV
432
    res.setLastFailureDetails(failureDetails(t.getLastFailure()));
×
UNCOV
433
    res.setLastWorkerIdentity(t.getLastWorkerIdentity());
×
UNCOV
434
    return res;
×
435
  }
436

437
  static PendingChildExecutionInfo pendingChildExecutionInfo(
438
      com.uber.cadence.api.v1.PendingChildExecutionInfo t) {
UNCOV
439
    if (t == null || t == com.uber.cadence.api.v1.PendingChildExecutionInfo.getDefaultInstance()) {
×
440
      return null;
×
441
    }
UNCOV
442
    PendingChildExecutionInfo res = new PendingChildExecutionInfo();
×
UNCOV
443
    res.setWorkflowID(workflowId(t.getWorkflowExecution()));
×
UNCOV
444
    res.setRunID(runId(t.getWorkflowExecution()));
×
UNCOV
445
    res.setWorkflowTypName(t.getWorkflowTypeName());
×
UNCOV
446
    res.setInitiatedID(t.getInitiatedId());
×
UNCOV
447
    res.setParentClosePolicy(parentClosePolicy(t.getParentClosePolicy()));
×
UNCOV
448
    return res;
×
449
  }
450

451
  static PendingDecisionInfo pendingDecisionInfo(com.uber.cadence.api.v1.PendingDecisionInfo t) {
UNCOV
452
    if (t == null || t == com.uber.cadence.api.v1.PendingDecisionInfo.getDefaultInstance()) {
×
453
      return null;
×
454
    }
UNCOV
455
    PendingDecisionInfo res = new PendingDecisionInfo();
×
UNCOV
456
    res.setState(pendingDecisionState(t.getState()));
×
UNCOV
457
    res.setScheduledTimestamp(timeToUnixNano(t.getScheduledTime()));
×
UNCOV
458
    res.setStartedTimestamp(timeToUnixNano(t.getStartedTime()));
×
UNCOV
459
    res.setAttempt(t.getAttempt());
×
UNCOV
460
    res.setOriginalScheduledTimestamp(timeToUnixNano(t.getOriginalScheduledTime()));
×
UNCOV
461
    return res;
×
462
  }
463

464
  static ActivityLocalDispatchInfo activityLocalDispatchInfo(
465
      com.uber.cadence.api.v1.ActivityLocalDispatchInfo t) {
UNCOV
466
    if (t == null || t == com.uber.cadence.api.v1.ActivityLocalDispatchInfo.getDefaultInstance()) {
×
467
      return null;
×
468
    }
UNCOV
469
    ActivityLocalDispatchInfo res = new ActivityLocalDispatchInfo();
×
UNCOV
470
    res.setActivityId(t.getActivityId());
×
UNCOV
471
    res.setScheduledTimestamp(timeToUnixNano(t.getScheduledTime()));
×
UNCOV
472
    res.setStartedTimestamp(timeToUnixNano(t.getStartedTime()));
×
UNCOV
473
    res.setScheduledTimestampOfThisAttempt(timeToUnixNano(t.getScheduledTimeOfThisAttempt()));
×
UNCOV
474
    res.setTaskToken(byteStringToArray(t.getTaskToken()));
×
UNCOV
475
    return res;
×
476
  }
477

478
  static SupportedClientVersions supportedClientVersions(
479
      com.uber.cadence.api.v1.SupportedClientVersions t) {
UNCOV
480
    if (t == null || t == com.uber.cadence.api.v1.SupportedClientVersions.getDefaultInstance()) {
×
481
      return null;
×
482
    }
UNCOV
483
    SupportedClientVersions res = new SupportedClientVersions();
×
UNCOV
484
    res.setGoSdk(t.getGoSdk());
×
UNCOV
485
    res.setJavaSdk(t.getJavaSdk());
×
UNCOV
486
    return res;
×
487
  }
488

489
  static DescribeDomainResponse describeDomainResponseDomain(com.uber.cadence.api.v1.Domain t) {
UNCOV
490
    if (t == null || t == com.uber.cadence.api.v1.Domain.getDefaultInstance()) {
×
491
      return null;
×
492
    }
UNCOV
493
    DescribeDomainResponse res = new DescribeDomainResponse();
×
UNCOV
494
    DomainInfo domainInfo = new DomainInfo();
×
UNCOV
495
    res.setDomainInfo(domainInfo);
×
496

UNCOV
497
    domainInfo.setName(t.getName());
×
UNCOV
498
    domainInfo.setStatus(domainStatus(t.getStatus()));
×
UNCOV
499
    domainInfo.setDescription(t.getDescription());
×
UNCOV
500
    domainInfo.setOwnerEmail(t.getOwnerEmail());
×
UNCOV
501
    domainInfo.setData(t.getDataMap());
×
UNCOV
502
    domainInfo.setUuid(t.getId());
×
UNCOV
503
    DomainConfiguration domainConfiguration = new DomainConfiguration();
×
504

UNCOV
505
    domainConfiguration.setWorkflowExecutionRetentionPeriodInDays(
×
UNCOV
506
        durationToDays(t.getWorkflowExecutionRetentionPeriod()));
×
UNCOV
507
    domainConfiguration.setEmitMetric(true);
×
UNCOV
508
    domainConfiguration.setBadBinaries(badBinaries(t.getBadBinaries()));
×
UNCOV
509
    domainConfiguration.setHistoryArchivalStatus(archivalStatus(t.getHistoryArchivalStatus()));
×
UNCOV
510
    domainConfiguration.setHistoryArchivalURI(t.getHistoryArchivalUri());
×
UNCOV
511
    domainConfiguration.setVisibilityArchivalStatus(
×
UNCOV
512
        archivalStatus(t.getVisibilityArchivalStatus()));
×
UNCOV
513
    domainConfiguration.setVisibilityArchivalURI(t.getVisibilityArchivalUri());
×
UNCOV
514
    DomainReplicationConfiguration domainReplicationConfiguration =
×
515
        new DomainReplicationConfiguration();
516

UNCOV
517
    domainReplicationConfiguration.setActiveClusterName(t.getActiveClusterName());
×
UNCOV
518
    domainReplicationConfiguration.setClusters(
×
UNCOV
519
        clusterReplicationConfigurationArray(t.getClustersList()));
×
UNCOV
520
    res.setFailoverVersion(t.getFailoverVersion());
×
UNCOV
521
    res.setIsGlobalDomain(t.getIsGlobalDomain());
×
522

UNCOV
523
    return res;
×
524
  }
525

526
  static TaskListPartitionMetadata taskListPartitionMetadata(
527
      com.uber.cadence.api.v1.TaskListPartitionMetadata t) {
UNCOV
528
    if (t == null || t == com.uber.cadence.api.v1.TaskListPartitionMetadata.getDefaultInstance()) {
×
UNCOV
529
      return null;
×
530
    }
UNCOV
531
    TaskListPartitionMetadata res = new TaskListPartitionMetadata();
×
UNCOV
532
    res.setKey(t.getKey());
×
533
    res.setOwnerHostName(t.getOwnerHostName());
×
UNCOV
534
    return res;
×
535
  }
536

537
  static QueryRejected queryRejected(com.uber.cadence.api.v1.QueryRejected t) {
UNCOV
538
    if (t == null || t == com.uber.cadence.api.v1.QueryRejected.getDefaultInstance()) {
×
UNCOV
539
      return null;
×
540
    }
UNCOV
541
    QueryRejected res = new QueryRejected();
×
UNCOV
542
    res.setCloseStatus(workflowExecutionCloseStatus(t.getCloseStatus()));
×
543
    return res;
×
544
  }
545

546
  static List<PollerInfo> pollerInfoArray(List<com.uber.cadence.api.v1.PollerInfo> t) {
UNCOV
547
    if (t == null) {
×
UNCOV
548
      return null;
×
549
    }
UNCOV
550
    List<PollerInfo> v = new ArrayList<>();
×
UNCOV
551
    for (int i = 0; i < t.size(); i++) {
×
552
      v.add(pollerInfo(t.get(i)));
×
553
    }
UNCOV
554
    return v;
×
555
  }
556

557
  static List<ResetPointInfo> resetPointInfoArray(List<com.uber.cadence.api.v1.ResetPointInfo> t) {
558
    if (t == null) {
1✔
UNCOV
559
      return null;
×
560
    }
561
    List<ResetPointInfo> v = new ArrayList<>();
1✔
562
    for (int i = 0; i < t.size(); i++) {
1✔
563
      v.add(resetPointInfo(t.get(i)));
1✔
564
    }
565
    return v;
1✔
566
  }
567

568
  static List<PendingActivityInfo> pendingActivityInfoArray(
569
      List<com.uber.cadence.api.v1.PendingActivityInfo> t) {
UNCOV
570
    if (t == null) {
×
UNCOV
571
      return null;
×
572
    }
UNCOV
573
    List<PendingActivityInfo> v = new ArrayList<>();
×
UNCOV
574
    for (int i = 0; i < t.size(); i++) {
×
575
      v.add(pendingActivityInfo(t.get(i)));
×
576
    }
UNCOV
577
    return v;
×
578
  }
579

580
  static List<PendingChildExecutionInfo> pendingChildExecutionInfoArray(
581
      List<com.uber.cadence.api.v1.PendingChildExecutionInfo> t) {
UNCOV
582
    if (t == null) {
×
UNCOV
583
      return null;
×
584
    }
UNCOV
585
    List<PendingChildExecutionInfo> v = new ArrayList<>();
×
UNCOV
586
    for (int i = 0; i < t.size(); i++) {
×
587
      v.add(pendingChildExecutionInfo(t.get(i)));
×
588
    }
UNCOV
589
    return v;
×
590
  }
591

592
  static Map<String, IndexedValueType> indexedValueTypeMap(
593
      Map<String, com.uber.cadence.api.v1.IndexedValueType> t) {
UNCOV
594
    if (t == null) {
×
UNCOV
595
      return null;
×
596
    }
UNCOV
597
    Map<String, IndexedValueType> v = new HashMap<>();
×
UNCOV
598
    for (String key : t.keySet()) {
×
599
      v.put(key, indexedValueType(t.get(key)));
×
UNCOV
600
    }
×
UNCOV
601
    return v;
×
602
  }
603

604
  static List<DataBlob> dataBlobArray(List<com.uber.cadence.api.v1.DataBlob> t) {
UNCOV
605
    if (t == null || t.size() == 0) {
×
UNCOV
606
      return null;
×
607
    }
UNCOV
608
    List<DataBlob> v = new ArrayList<>();
×
UNCOV
609
    for (int i = 0; i < t.size(); i++) {
×
610
      v.add(dataBlob(t.get(i)));
×
611
    }
UNCOV
612
    return v;
×
613
  }
614

615
  static List<WorkflowExecutionInfo> workflowExecutionInfoArray(
616
      List<com.uber.cadence.api.v1.WorkflowExecutionInfo> t) {
UNCOV
617
    if (t == null) {
×
UNCOV
618
      return null;
×
619
    }
UNCOV
620
    List<WorkflowExecutionInfo> v = new ArrayList<>();
×
UNCOV
621
    for (int i = 0; i < t.size(); i++) {
×
622
      v.add(workflowExecutionInfo(t.get(i)));
×
623
    }
UNCOV
624
    return v;
×
625
  }
626

627
  static List<DescribeDomainResponse> describeDomainResponseArray(
628
      List<com.uber.cadence.api.v1.Domain> t) {
UNCOV
629
    if (t == null) {
×
UNCOV
630
      return null;
×
631
    }
UNCOV
632
    List<DescribeDomainResponse> v = new ArrayList<>();
×
UNCOV
633
    for (int i = 0; i < t.size(); i++) {
×
634
      v.add(describeDomainResponseDomain(t.get(i)));
×
635
    }
UNCOV
636
    return v;
×
637
  }
638

639
  static List<TaskListPartitionMetadata> taskListPartitionMetadataArray(
640
      List<com.uber.cadence.api.v1.TaskListPartitionMetadata> t) {
UNCOV
641
    if (t == null) {
×
UNCOV
642
      return null;
×
643
    }
UNCOV
644
    List<TaskListPartitionMetadata> v = new ArrayList<>();
×
UNCOV
645
    for (int i = 0; i < t.size(); i++) {
×
646
      v.add(taskListPartitionMetadata(t.get(i)));
×
647
    }
UNCOV
648
    return v;
×
649
  }
650

651
  static Map<String, WorkflowQuery> workflowQueryMap(
652
      Map<String, com.uber.cadence.api.v1.WorkflowQuery> t) {
UNCOV
653
    if (t == null) {
×
UNCOV
654
      return null;
×
655
    }
UNCOV
656
    Map<String, WorkflowQuery> v = new HashMap<>();
×
UNCOV
657
    for (String key : t.keySet()) {
×
658
      v.put(key, workflowQuery(t.get(key)));
×
UNCOV
659
    }
×
UNCOV
660
    return v;
×
661
  }
662

663
  static Map<String, ActivityLocalDispatchInfo> activityLocalDispatchInfoMap(
664
      Map<String, com.uber.cadence.api.v1.ActivityLocalDispatchInfo> t) {
UNCOV
665
    if (t == null) {
×
UNCOV
666
      return null;
×
667
    }
UNCOV
668
    Map<String, ActivityLocalDispatchInfo> v = new HashMap<>();
×
UNCOV
669
    for (String key : t.keySet()) {
×
670
      v.put(key, activityLocalDispatchInfo(t.get(key)));
×
UNCOV
671
    }
×
UNCOV
672
    return v;
×
673
  }
674
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc