diff --git a/.gen/com/uber/cadence/entities/AccessDeniedError.java b/.gen/com/uber/cadence/entities/AccessDeniedError.java new file mode 100644 index 000000000..db59d917a --- /dev/null +++ b/.gen/com/uber/cadence/entities/AccessDeniedError.java @@ -0,0 +1,46 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Getter +@Setter +@Accessors(chain = true) +public class AccessDeniedError extends BaseError { + + public AccessDeniedError() { + super(); + } + + public AccessDeniedError(String message, Throwable cause) { + super(message, cause); + } + + public AccessDeniedError(Throwable cause) { + super(cause); + } +} diff --git a/.gen/com/uber/cadence/entities/ActivityLocalDispatchInfo.java b/.gen/com/uber/cadence/entities/ActivityLocalDispatchInfo.java new file mode 100644 index 000000000..c6d822de1 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ActivityLocalDispatchInfo.java @@ -0,0 +1,37 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ActivityLocalDispatchInfo { + private String activityId; + private long scheduledTimestamp; + private long startedTimestamp; + private long scheduledTimestampOfThisAttempt; + private byte[] taskToken; +} diff --git a/.gen/com/uber/cadence/entities/ActivityTaskCancelRequestedEventAttributes.java b/.gen/com/uber/cadence/entities/ActivityTaskCancelRequestedEventAttributes.java new file mode 100644 index 000000000..2c275c607 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ActivityTaskCancelRequestedEventAttributes.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ActivityTaskCancelRequestedEventAttributes { + private String activityId; + private long decisionTaskCompletedEventId; +} diff --git a/.gen/com/uber/cadence/entities/ActivityTaskCanceledEventAttributes.java b/.gen/com/uber/cadence/entities/ActivityTaskCanceledEventAttributes.java new file mode 100644 index 000000000..c8f2b4563 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ActivityTaskCanceledEventAttributes.java @@ -0,0 +1,37 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ActivityTaskCanceledEventAttributes { + private byte[] details; + private long latestCancelRequestedEventId; + private long scheduledEventId; + private long startedEventId; + private String identity; +} diff --git a/.gen/com/uber/cadence/entities/ActivityTaskCompletedEventAttributes.java b/.gen/com/uber/cadence/entities/ActivityTaskCompletedEventAttributes.java new file mode 100644 index 000000000..e066b8bf9 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ActivityTaskCompletedEventAttributes.java @@ -0,0 +1,36 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ActivityTaskCompletedEventAttributes { + private byte[] result; + private long scheduledEventId; + private long startedEventId; + private String identity; +} diff --git a/.gen/com/uber/cadence/entities/ActivityTaskFailedEventAttributes.java b/.gen/com/uber/cadence/entities/ActivityTaskFailedEventAttributes.java new file mode 100644 index 000000000..c2aefb07e --- /dev/null +++ b/.gen/com/uber/cadence/entities/ActivityTaskFailedEventAttributes.java @@ -0,0 +1,37 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ActivityTaskFailedEventAttributes { + private String reason; + private byte[] details; + private long scheduledEventId; + private long startedEventId; + private String identity; +} diff --git a/.gen/com/uber/cadence/entities/ActivityTaskScheduledEventAttributes.java b/.gen/com/uber/cadence/entities/ActivityTaskScheduledEventAttributes.java new file mode 100644 index 000000000..70dc7e62b --- /dev/null +++ b/.gen/com/uber/cadence/entities/ActivityTaskScheduledEventAttributes.java @@ -0,0 +1,44 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ActivityTaskScheduledEventAttributes { + private String activityId; + private ActivityType activityType; + private String domain; + private TaskList taskList; + private byte[] input; + private int scheduleToCloseTimeoutSeconds; + private int scheduleToStartTimeoutSeconds; + private int startToCloseTimeoutSeconds; + private int heartbeatTimeoutSeconds; + private long decisionTaskCompletedEventId; + private RetryPolicy retryPolicy; + private Header header; +} diff --git a/.gen/com/uber/cadence/entities/ActivityTaskStartedEventAttributes.java b/.gen/com/uber/cadence/entities/ActivityTaskStartedEventAttributes.java new file mode 100644 index 000000000..f48d172b6 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ActivityTaskStartedEventAttributes.java @@ -0,0 +1,38 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ActivityTaskStartedEventAttributes { + private long scheduledEventId; + private String identity; + private String requestId; + private int attempt; + private String lastFailureReason; + private byte[] lastFailureDetails; +} diff --git a/.gen/com/uber/cadence/entities/ActivityTaskTimedOutEventAttributes.java b/.gen/com/uber/cadence/entities/ActivityTaskTimedOutEventAttributes.java new file mode 100644 index 000000000..4469ddc46 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ActivityTaskTimedOutEventAttributes.java @@ -0,0 +1,38 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ActivityTaskTimedOutEventAttributes { + private byte[] details; + private long scheduledEventId; + private long startedEventId; + private TimeoutType timeoutType; + private String lastFailureReason; + private byte[] lastFailureDetails; +} diff --git a/.gen/com/uber/cadence/entities/ActivityType.java b/.gen/com/uber/cadence/entities/ActivityType.java new file mode 100644 index 000000000..244d059ee --- /dev/null +++ b/.gen/com/uber/cadence/entities/ActivityType.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ActivityType { + private String name; +} diff --git a/.gen/com/uber/cadence/entities/Any.java b/.gen/com/uber/cadence/entities/Any.java new file mode 100644 index 000000000..f5899ccdf --- /dev/null +++ b/.gen/com/uber/cadence/entities/Any.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class Any { + private String ValueType; + private byte[] Value; +} diff --git a/.gen/com/uber/cadence/entities/ApplyParentClosePolicyAttributes.java b/.gen/com/uber/cadence/entities/ApplyParentClosePolicyAttributes.java new file mode 100644 index 000000000..20dc1afbd --- /dev/null +++ b/.gen/com/uber/cadence/entities/ApplyParentClosePolicyAttributes.java @@ -0,0 +1,36 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ApplyParentClosePolicyAttributes { + private String childDomainID; + private String childWorkflowID; + private String childRunID; + private ParentClosePolicy parentClosePolicy; +} diff --git a/.gen/com/uber/cadence/entities/ApplyParentClosePolicyRequest.java b/.gen/com/uber/cadence/entities/ApplyParentClosePolicyRequest.java new file mode 100644 index 000000000..e0e579001 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ApplyParentClosePolicyRequest.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ApplyParentClosePolicyRequest { + private ApplyParentClosePolicyAttributes child; + private ApplyParentClosePolicyStatus status; +} diff --git a/.gen/com/uber/cadence/entities/ApplyParentClosePolicyResult.java b/.gen/com/uber/cadence/entities/ApplyParentClosePolicyResult.java new file mode 100644 index 000000000..57b7ed58f --- /dev/null +++ b/.gen/com/uber/cadence/entities/ApplyParentClosePolicyResult.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ApplyParentClosePolicyResult { + private ApplyParentClosePolicyAttributes child; + private CrossClusterTaskFailedCause failedCause; +} diff --git a/.gen/com/uber/cadence/entities/ApplyParentClosePolicyStatus.java b/.gen/com/uber/cadence/entities/ApplyParentClosePolicyStatus.java new file mode 100644 index 000000000..977e66338 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ApplyParentClosePolicyStatus.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ApplyParentClosePolicyStatus { + private boolean completed; + private CrossClusterTaskFailedCause failedCause; +} diff --git a/.gen/com/uber/cadence/entities/ArchivalStatus.java b/.gen/com/uber/cadence/entities/ArchivalStatus.java new file mode 100644 index 000000000..8a4e0e787 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ArchivalStatus.java @@ -0,0 +1,28 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum ArchivalStatus { + DISABLED, + ENABLED, +} diff --git a/.gen/com/uber/cadence/entities/AsyncWorkflowConfiguration.java b/.gen/com/uber/cadence/entities/AsyncWorkflowConfiguration.java new file mode 100644 index 000000000..85b76aedd --- /dev/null +++ b/.gen/com/uber/cadence/entities/AsyncWorkflowConfiguration.java @@ -0,0 +1,36 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class AsyncWorkflowConfiguration { + private boolean enabled; + private String predefinedQueueName; + private String queueType; + private DataBlob queueConfig; +} diff --git a/.gen/com/uber/cadence/entities/BadBinaries.java b/.gen/com/uber/cadence/entities/BadBinaries.java new file mode 100644 index 000000000..b22bcbcba --- /dev/null +++ b/.gen/com/uber/cadence/entities/BadBinaries.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class BadBinaries { + private Map binaries; +} diff --git a/.gen/com/uber/cadence/entities/BadBinaryInfo.java b/.gen/com/uber/cadence/entities/BadBinaryInfo.java new file mode 100644 index 000000000..751ce2dc7 --- /dev/null +++ b/.gen/com/uber/cadence/entities/BadBinaryInfo.java @@ -0,0 +1,35 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class BadBinaryInfo { + private String reason; + private String operator; + private long createdTimeNano; +} diff --git a/.gen/com/uber/cadence/entities/BadRequestError.java b/.gen/com/uber/cadence/entities/BadRequestError.java new file mode 100644 index 000000000..54bac97e7 --- /dev/null +++ b/.gen/com/uber/cadence/entities/BadRequestError.java @@ -0,0 +1,46 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Getter +@Setter +@Accessors(chain = true) +public class BadRequestError extends BaseError { + + public BadRequestError() { + super(); + } + + public BadRequestError(String message, Throwable cause) { + super(message, cause); + } + + public BadRequestError(Throwable cause) { + super(cause); + } +} diff --git a/.gen/com/uber/cadence/entities/BaseError.java b/.gen/com/uber/cadence/entities/BaseError.java new file mode 100644 index 000000000..8a08aece6 --- /dev/null +++ b/.gen/com/uber/cadence/entities/BaseError.java @@ -0,0 +1,41 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public class BaseError extends RuntimeException { + public BaseError() { + super(); + } + + public BaseError(String message) { + super(message); + } + + public BaseError(String message, Throwable cause) { + super(message, cause); + } + + public BaseError(Throwable cause) { + super(cause); + } +} diff --git a/.gen/com/uber/cadence/entities/CancelExternalWorkflowExecutionFailedCause.java b/.gen/com/uber/cadence/entities/CancelExternalWorkflowExecutionFailedCause.java new file mode 100644 index 000000000..5f134c88e --- /dev/null +++ b/.gen/com/uber/cadence/entities/CancelExternalWorkflowExecutionFailedCause.java @@ -0,0 +1,28 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum CancelExternalWorkflowExecutionFailedCause { + UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION, + WORKFLOW_ALREADY_COMPLETED, +} diff --git a/.gen/com/uber/cadence/entities/CancelTimerDecisionAttributes.java b/.gen/com/uber/cadence/entities/CancelTimerDecisionAttributes.java new file mode 100644 index 000000000..dd01a7278 --- /dev/null +++ b/.gen/com/uber/cadence/entities/CancelTimerDecisionAttributes.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class CancelTimerDecisionAttributes { + private String timerId; +} diff --git a/.gen/com/uber/cadence/entities/CancelTimerFailedEventAttributes.java b/.gen/com/uber/cadence/entities/CancelTimerFailedEventAttributes.java new file mode 100644 index 000000000..f8f88f3e9 --- /dev/null +++ b/.gen/com/uber/cadence/entities/CancelTimerFailedEventAttributes.java @@ -0,0 +1,36 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class CancelTimerFailedEventAttributes { + private String timerId; + private String cause; + private long decisionTaskCompletedEventId; + private String identity; +} diff --git a/.gen/com/uber/cadence/entities/CancelWorkflowExecutionDecisionAttributes.java b/.gen/com/uber/cadence/entities/CancelWorkflowExecutionDecisionAttributes.java new file mode 100644 index 000000000..482ab4b06 --- /dev/null +++ b/.gen/com/uber/cadence/entities/CancelWorkflowExecutionDecisionAttributes.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class CancelWorkflowExecutionDecisionAttributes { + private byte[] details; +} diff --git a/.gen/com/uber/cadence/entities/CancellationAlreadyRequestedError.java b/.gen/com/uber/cadence/entities/CancellationAlreadyRequestedError.java new file mode 100644 index 000000000..d94701773 --- /dev/null +++ b/.gen/com/uber/cadence/entities/CancellationAlreadyRequestedError.java @@ -0,0 +1,46 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Getter +@Setter +@Accessors(chain = true) +public class CancellationAlreadyRequestedError extends BaseError { + + public CancellationAlreadyRequestedError() { + super(); + } + + public CancellationAlreadyRequestedError(String message, Throwable cause) { + super(message, cause); + } + + public CancellationAlreadyRequestedError(Throwable cause) { + super(cause); + } +} diff --git a/.gen/com/uber/cadence/entities/ChildWorkflowExecutionCanceledEventAttributes.java b/.gen/com/uber/cadence/entities/ChildWorkflowExecutionCanceledEventAttributes.java new file mode 100644 index 000000000..d5d8d06d6 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ChildWorkflowExecutionCanceledEventAttributes.java @@ -0,0 +1,38 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ChildWorkflowExecutionCanceledEventAttributes { + private byte[] details; + private String domain; + private WorkflowExecution workflowExecution; + private WorkflowType workflowType; + private long initiatedEventId; + private long startedEventId; +} diff --git a/.gen/com/uber/cadence/entities/ChildWorkflowExecutionCompletedEventAttributes.java b/.gen/com/uber/cadence/entities/ChildWorkflowExecutionCompletedEventAttributes.java new file mode 100644 index 000000000..3446a2fb7 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ChildWorkflowExecutionCompletedEventAttributes.java @@ -0,0 +1,38 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ChildWorkflowExecutionCompletedEventAttributes { + private byte[] result; + private String domain; + private WorkflowExecution workflowExecution; + private WorkflowType workflowType; + private long initiatedEventId; + private long startedEventId; +} diff --git a/.gen/com/uber/cadence/entities/ChildWorkflowExecutionFailedCause.java b/.gen/com/uber/cadence/entities/ChildWorkflowExecutionFailedCause.java new file mode 100644 index 000000000..ba6a3a282 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ChildWorkflowExecutionFailedCause.java @@ -0,0 +1,27 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum ChildWorkflowExecutionFailedCause { + WORKFLOW_ALREADY_RUNNING, +} diff --git a/.gen/com/uber/cadence/entities/ChildWorkflowExecutionFailedEventAttributes.java b/.gen/com/uber/cadence/entities/ChildWorkflowExecutionFailedEventAttributes.java new file mode 100644 index 000000000..008287a91 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ChildWorkflowExecutionFailedEventAttributes.java @@ -0,0 +1,39 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ChildWorkflowExecutionFailedEventAttributes { + private String reason; + private byte[] details; + private String domain; + private WorkflowExecution workflowExecution; + private WorkflowType workflowType; + private long initiatedEventId; + private long startedEventId; +} diff --git a/.gen/com/uber/cadence/entities/ChildWorkflowExecutionStartedEventAttributes.java b/.gen/com/uber/cadence/entities/ChildWorkflowExecutionStartedEventAttributes.java new file mode 100644 index 000000000..daba74b42 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ChildWorkflowExecutionStartedEventAttributes.java @@ -0,0 +1,37 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ChildWorkflowExecutionStartedEventAttributes { + private String domain; + private long initiatedEventId; + private WorkflowExecution workflowExecution; + private WorkflowType workflowType; + private Header header; +} diff --git a/.gen/com/uber/cadence/entities/ChildWorkflowExecutionTerminatedEventAttributes.java b/.gen/com/uber/cadence/entities/ChildWorkflowExecutionTerminatedEventAttributes.java new file mode 100644 index 000000000..09be9bc65 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ChildWorkflowExecutionTerminatedEventAttributes.java @@ -0,0 +1,37 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ChildWorkflowExecutionTerminatedEventAttributes { + private String domain; + private WorkflowExecution workflowExecution; + private WorkflowType workflowType; + private long initiatedEventId; + private long startedEventId; +} diff --git a/.gen/com/uber/cadence/entities/ChildWorkflowExecutionTimedOutEventAttributes.java b/.gen/com/uber/cadence/entities/ChildWorkflowExecutionTimedOutEventAttributes.java new file mode 100644 index 000000000..adec27619 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ChildWorkflowExecutionTimedOutEventAttributes.java @@ -0,0 +1,38 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ChildWorkflowExecutionTimedOutEventAttributes { + private TimeoutType timeoutType; + private String domain; + private WorkflowExecution workflowExecution; + private WorkflowType workflowType; + private long initiatedEventId; + private long startedEventId; +} diff --git a/.gen/com/uber/cadence/entities/ClientVersionNotSupportedError.java b/.gen/com/uber/cadence/entities/ClientVersionNotSupportedError.java new file mode 100644 index 000000000..9570f4dc0 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ClientVersionNotSupportedError.java @@ -0,0 +1,51 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Getter +@Setter +@Accessors(chain = true) +@AllArgsConstructor +public class ClientVersionNotSupportedError extends BaseError { + private String featureVersion; + private String clientImpl; + private String supportedVersions; + + public ClientVersionNotSupportedError() { + super(); + } + + public ClientVersionNotSupportedError(String message, Throwable cause) { + super(message, cause); + } + + public ClientVersionNotSupportedError(Throwable cause) { + super(cause); + } +} diff --git a/.gen/com/uber/cadence/entities/CloseShardRequest.java b/.gen/com/uber/cadence/entities/CloseShardRequest.java new file mode 100644 index 000000000..96d20f4ae --- /dev/null +++ b/.gen/com/uber/cadence/entities/CloseShardRequest.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class CloseShardRequest { + private int shardID; +} diff --git a/.gen/com/uber/cadence/entities/ClusterInfo.java b/.gen/com/uber/cadence/entities/ClusterInfo.java new file mode 100644 index 000000000..cd4c98930 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ClusterInfo.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ClusterInfo { + private SupportedClientVersions supportedClientVersions; +} diff --git a/.gen/com/uber/cadence/entities/ClusterReplicationConfiguration.java b/.gen/com/uber/cadence/entities/ClusterReplicationConfiguration.java new file mode 100644 index 000000000..7f43f8274 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ClusterReplicationConfiguration.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ClusterReplicationConfiguration { + private String clusterName; +} diff --git a/.gen/com/uber/cadence/entities/CompleteWorkflowExecutionDecisionAttributes.java b/.gen/com/uber/cadence/entities/CompleteWorkflowExecutionDecisionAttributes.java new file mode 100644 index 000000000..5ab3e916f --- /dev/null +++ b/.gen/com/uber/cadence/entities/CompleteWorkflowExecutionDecisionAttributes.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class CompleteWorkflowExecutionDecisionAttributes { + private byte[] result; +} diff --git a/.gen/com/uber/cadence/entities/ContinueAsNewInitiator.java b/.gen/com/uber/cadence/entities/ContinueAsNewInitiator.java new file mode 100644 index 000000000..4b8977e77 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ContinueAsNewInitiator.java @@ -0,0 +1,29 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum ContinueAsNewInitiator { + Decider, + RetryPolicy, + CronSchedule, +} diff --git a/.gen/com/uber/cadence/entities/ContinueAsNewWorkflowExecutionDecisionAttributes.java b/.gen/com/uber/cadence/entities/ContinueAsNewWorkflowExecutionDecisionAttributes.java new file mode 100644 index 000000000..8c51d5ce6 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ContinueAsNewWorkflowExecutionDecisionAttributes.java @@ -0,0 +1,48 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ContinueAsNewWorkflowExecutionDecisionAttributes { + private WorkflowType workflowType; + private TaskList taskList; + private byte[] input; + private int executionStartToCloseTimeoutSeconds; + private int taskStartToCloseTimeoutSeconds; + private int backoffStartIntervalInSeconds; + private RetryPolicy retryPolicy; + private ContinueAsNewInitiator initiator; + private String failureReason; + private byte[] failureDetails; + private byte[] lastCompletionResult; + private String cronSchedule; + private Header header; + private Memo memo; + private SearchAttributes searchAttributes; + private int jitterStartSeconds; +} diff --git a/.gen/com/uber/cadence/entities/CountWorkflowExecutionsRequest.java b/.gen/com/uber/cadence/entities/CountWorkflowExecutionsRequest.java new file mode 100644 index 000000000..d5f15eac5 --- /dev/null +++ b/.gen/com/uber/cadence/entities/CountWorkflowExecutionsRequest.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class CountWorkflowExecutionsRequest { + private String domain; + private String query; +} diff --git a/.gen/com/uber/cadence/entities/CountWorkflowExecutionsResponse.java b/.gen/com/uber/cadence/entities/CountWorkflowExecutionsResponse.java new file mode 100644 index 000000000..e25a19217 --- /dev/null +++ b/.gen/com/uber/cadence/entities/CountWorkflowExecutionsResponse.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class CountWorkflowExecutionsResponse { + private long count; +} diff --git a/.gen/com/uber/cadence/entities/CrossClusterApplyParentClosePolicyRequestAttributes.java b/.gen/com/uber/cadence/entities/CrossClusterApplyParentClosePolicyRequestAttributes.java new file mode 100644 index 000000000..1f333d309 --- /dev/null +++ b/.gen/com/uber/cadence/entities/CrossClusterApplyParentClosePolicyRequestAttributes.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class CrossClusterApplyParentClosePolicyRequestAttributes { + private List children; +} diff --git a/.gen/com/uber/cadence/entities/CrossClusterApplyParentClosePolicyResponseAttributes.java b/.gen/com/uber/cadence/entities/CrossClusterApplyParentClosePolicyResponseAttributes.java new file mode 100644 index 000000000..6fdd2086c --- /dev/null +++ b/.gen/com/uber/cadence/entities/CrossClusterApplyParentClosePolicyResponseAttributes.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class CrossClusterApplyParentClosePolicyResponseAttributes { + private List childrenStatus; +} diff --git a/.gen/com/uber/cadence/entities/CrossClusterCancelExecutionRequestAttributes.java b/.gen/com/uber/cadence/entities/CrossClusterCancelExecutionRequestAttributes.java new file mode 100644 index 000000000..9e0af5e5b --- /dev/null +++ b/.gen/com/uber/cadence/entities/CrossClusterCancelExecutionRequestAttributes.java @@ -0,0 +1,38 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class CrossClusterCancelExecutionRequestAttributes { + private String targetDomainID; + private String targetWorkflowID; + private String targetRunID; + private String requestID; + private long initiatedEventID; + private boolean childWorkflowOnly; +} diff --git a/.gen/com/uber/cadence/entities/CrossClusterCancelExecutionResponseAttributes.java b/.gen/com/uber/cadence/entities/CrossClusterCancelExecutionResponseAttributes.java new file mode 100644 index 000000000..ef5a02cdf --- /dev/null +++ b/.gen/com/uber/cadence/entities/CrossClusterCancelExecutionResponseAttributes.java @@ -0,0 +1,31 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class CrossClusterCancelExecutionResponseAttributes {} diff --git a/.gen/com/uber/cadence/entities/CrossClusterRecordChildWorkflowExecutionCompleteRequestAttributes.java b/.gen/com/uber/cadence/entities/CrossClusterRecordChildWorkflowExecutionCompleteRequestAttributes.java new file mode 100644 index 000000000..686731c60 --- /dev/null +++ b/.gen/com/uber/cadence/entities/CrossClusterRecordChildWorkflowExecutionCompleteRequestAttributes.java @@ -0,0 +1,37 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class CrossClusterRecordChildWorkflowExecutionCompleteRequestAttributes { + private String targetDomainID; + private String targetWorkflowID; + private String targetRunID; + private long initiatedEventID; + private HistoryEvent completionEvent; +} diff --git a/.gen/com/uber/cadence/entities/CrossClusterRecordChildWorkflowExecutionCompleteResponseAttributes.java b/.gen/com/uber/cadence/entities/CrossClusterRecordChildWorkflowExecutionCompleteResponseAttributes.java new file mode 100644 index 000000000..f74f695ee --- /dev/null +++ b/.gen/com/uber/cadence/entities/CrossClusterRecordChildWorkflowExecutionCompleteResponseAttributes.java @@ -0,0 +1,31 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class CrossClusterRecordChildWorkflowExecutionCompleteResponseAttributes {} diff --git a/.gen/com/uber/cadence/entities/CrossClusterSignalExecutionRequestAttributes.java b/.gen/com/uber/cadence/entities/CrossClusterSignalExecutionRequestAttributes.java new file mode 100644 index 000000000..199097b12 --- /dev/null +++ b/.gen/com/uber/cadence/entities/CrossClusterSignalExecutionRequestAttributes.java @@ -0,0 +1,41 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class CrossClusterSignalExecutionRequestAttributes { + private String targetDomainID; + private String targetWorkflowID; + private String targetRunID; + private String requestID; + private long initiatedEventID; + private boolean childWorkflowOnly; + private String signalName; + private byte[] signalInput; + private byte[] control; +} diff --git a/.gen/com/uber/cadence/entities/CrossClusterSignalExecutionResponseAttributes.java b/.gen/com/uber/cadence/entities/CrossClusterSignalExecutionResponseAttributes.java new file mode 100644 index 000000000..ddc56631e --- /dev/null +++ b/.gen/com/uber/cadence/entities/CrossClusterSignalExecutionResponseAttributes.java @@ -0,0 +1,31 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class CrossClusterSignalExecutionResponseAttributes {} diff --git a/.gen/com/uber/cadence/entities/CrossClusterStartChildExecutionRequestAttributes.java b/.gen/com/uber/cadence/entities/CrossClusterStartChildExecutionRequestAttributes.java new file mode 100644 index 000000000..5de9b7f9a --- /dev/null +++ b/.gen/com/uber/cadence/entities/CrossClusterStartChildExecutionRequestAttributes.java @@ -0,0 +1,38 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class CrossClusterStartChildExecutionRequestAttributes { + private String targetDomainID; + private String requestID; + private long initiatedEventID; + private StartChildWorkflowExecutionInitiatedEventAttributes initiatedEventAttributes; + private String targetRunID; + private Map partitionConfig; +} diff --git a/.gen/com/uber/cadence/entities/CrossClusterStartChildExecutionResponseAttributes.java b/.gen/com/uber/cadence/entities/CrossClusterStartChildExecutionResponseAttributes.java new file mode 100644 index 000000000..cfc348193 --- /dev/null +++ b/.gen/com/uber/cadence/entities/CrossClusterStartChildExecutionResponseAttributes.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class CrossClusterStartChildExecutionResponseAttributes { + private String runID; +} diff --git a/.gen/com/uber/cadence/entities/CrossClusterTaskFailedCause.java b/.gen/com/uber/cadence/entities/CrossClusterTaskFailedCause.java new file mode 100644 index 000000000..b5cdf967e --- /dev/null +++ b/.gen/com/uber/cadence/entities/CrossClusterTaskFailedCause.java @@ -0,0 +1,32 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum CrossClusterTaskFailedCause { + DOMAIN_NOT_ACTIVE, + DOMAIN_NOT_EXISTS, + WORKFLOW_ALREADY_RUNNING, + WORKFLOW_NOT_EXISTS, + WORKFLOW_ALREADY_COMPLETED, + UNCATEGORIZED, +} diff --git a/.gen/com/uber/cadence/entities/CrossClusterTaskInfo.java b/.gen/com/uber/cadence/entities/CrossClusterTaskInfo.java new file mode 100644 index 000000000..37319cae4 --- /dev/null +++ b/.gen/com/uber/cadence/entities/CrossClusterTaskInfo.java @@ -0,0 +1,39 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class CrossClusterTaskInfo { + private String domainID; + private String workflowID; + private String runID; + private CrossClusterTaskType taskType; + private int taskState; + private long taskID; + private long visibilityTimestamp; +} diff --git a/.gen/com/uber/cadence/entities/CrossClusterTaskRequest.java b/.gen/com/uber/cadence/entities/CrossClusterTaskRequest.java new file mode 100644 index 000000000..bf6a2c3ad --- /dev/null +++ b/.gen/com/uber/cadence/entities/CrossClusterTaskRequest.java @@ -0,0 +1,39 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class CrossClusterTaskRequest { + private CrossClusterTaskInfo taskInfo; + private CrossClusterStartChildExecutionRequestAttributes startChildExecutionAttributes; + private CrossClusterCancelExecutionRequestAttributes cancelExecutionAttributes; + private CrossClusterSignalExecutionRequestAttributes signalExecutionAttributes; + private CrossClusterRecordChildWorkflowExecutionCompleteRequestAttributes + recordChildWorkflowExecutionCompleteAttributes; + private CrossClusterApplyParentClosePolicyRequestAttributes applyParentClosePolicyAttributes; +} diff --git a/.gen/com/uber/cadence/entities/CrossClusterTaskResponse.java b/.gen/com/uber/cadence/entities/CrossClusterTaskResponse.java new file mode 100644 index 000000000..a4f909864 --- /dev/null +++ b/.gen/com/uber/cadence/entities/CrossClusterTaskResponse.java @@ -0,0 +1,42 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class CrossClusterTaskResponse { + private long taskID; + private CrossClusterTaskType taskType; + private int taskState; + private CrossClusterTaskFailedCause failedCause; + private CrossClusterStartChildExecutionResponseAttributes startChildExecutionAttributes; + private CrossClusterCancelExecutionResponseAttributes cancelExecutionAttributes; + private CrossClusterSignalExecutionResponseAttributes signalExecutionAttributes; + private CrossClusterRecordChildWorkflowExecutionCompleteResponseAttributes + recordChildWorkflowExecutionCompleteAttributes; + private CrossClusterApplyParentClosePolicyResponseAttributes applyParentClosePolicyAttributes; +} diff --git a/.gen/com/uber/cadence/entities/CrossClusterTaskType.java b/.gen/com/uber/cadence/entities/CrossClusterTaskType.java new file mode 100644 index 000000000..40c9155ba --- /dev/null +++ b/.gen/com/uber/cadence/entities/CrossClusterTaskType.java @@ -0,0 +1,31 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum CrossClusterTaskType { + StartChildExecution, + CancelExecution, + SignalExecution, + RecordChildWorkflowExecutionComplete, + ApplyParentClosePolicy, +} diff --git a/.gen/com/uber/cadence/entities/CurrentBranchChangedError.java b/.gen/com/uber/cadence/entities/CurrentBranchChangedError.java new file mode 100644 index 000000000..951623f3e --- /dev/null +++ b/.gen/com/uber/cadence/entities/CurrentBranchChangedError.java @@ -0,0 +1,49 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Getter +@Setter +@Accessors(chain = true) +@AllArgsConstructor +public class CurrentBranchChangedError extends BaseError { + private byte[] currentBranchToken; + + public CurrentBranchChangedError() { + super(); + } + + public CurrentBranchChangedError(String message, Throwable cause) { + super(message, cause); + } + + public CurrentBranchChangedError(Throwable cause) { + super(cause); + } +} diff --git a/.gen/com/uber/cadence/entities/DataBlob.java b/.gen/com/uber/cadence/entities/DataBlob.java new file mode 100644 index 000000000..9a5ccd935 --- /dev/null +++ b/.gen/com/uber/cadence/entities/DataBlob.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class DataBlob { + private EncodingType EncodingType; + private byte[] Data; +} diff --git a/.gen/com/uber/cadence/entities/Decision.java b/.gen/com/uber/cadence/entities/Decision.java new file mode 100644 index 000000000..917010b58 --- /dev/null +++ b/.gen/com/uber/cadence/entities/Decision.java @@ -0,0 +1,51 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class Decision { + private DecisionType decisionType; + private ScheduleActivityTaskDecisionAttributes scheduleActivityTaskDecisionAttributes; + private StartTimerDecisionAttributes startTimerDecisionAttributes; + private CompleteWorkflowExecutionDecisionAttributes completeWorkflowExecutionDecisionAttributes; + private FailWorkflowExecutionDecisionAttributes failWorkflowExecutionDecisionAttributes; + private RequestCancelActivityTaskDecisionAttributes requestCancelActivityTaskDecisionAttributes; + private CancelTimerDecisionAttributes cancelTimerDecisionAttributes; + private CancelWorkflowExecutionDecisionAttributes cancelWorkflowExecutionDecisionAttributes; + private RequestCancelExternalWorkflowExecutionDecisionAttributes + requestCancelExternalWorkflowExecutionDecisionAttributes; + private RecordMarkerDecisionAttributes recordMarkerDecisionAttributes; + private ContinueAsNewWorkflowExecutionDecisionAttributes + continueAsNewWorkflowExecutionDecisionAttributes; + private StartChildWorkflowExecutionDecisionAttributes + startChildWorkflowExecutionDecisionAttributes; + private SignalExternalWorkflowExecutionDecisionAttributes + signalExternalWorkflowExecutionDecisionAttributes; + private UpsertWorkflowSearchAttributesDecisionAttributes + upsertWorkflowSearchAttributesDecisionAttributes; +} diff --git a/.gen/com/uber/cadence/entities/DecisionTaskCompletedEventAttributes.java b/.gen/com/uber/cadence/entities/DecisionTaskCompletedEventAttributes.java new file mode 100644 index 000000000..fae3e6441 --- /dev/null +++ b/.gen/com/uber/cadence/entities/DecisionTaskCompletedEventAttributes.java @@ -0,0 +1,37 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class DecisionTaskCompletedEventAttributes { + private byte[] executionContext; + private long scheduledEventId; + private long startedEventId; + private String identity; + private String binaryChecksum; +} diff --git a/.gen/com/uber/cadence/entities/DecisionTaskFailedCause.java b/.gen/com/uber/cadence/entities/DecisionTaskFailedCause.java new file mode 100644 index 000000000..8558534dd --- /dev/null +++ b/.gen/com/uber/cadence/entities/DecisionTaskFailedCause.java @@ -0,0 +1,49 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum DecisionTaskFailedCause { + UNHANDLED_DECISION, + BAD_SCHEDULE_ACTIVITY_ATTRIBUTES, + BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES, + BAD_START_TIMER_ATTRIBUTES, + BAD_CANCEL_TIMER_ATTRIBUTES, + BAD_RECORD_MARKER_ATTRIBUTES, + BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES, + BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES, + BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES, + BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES, + BAD_CONTINUE_AS_NEW_ATTRIBUTES, + START_TIMER_DUPLICATE_ID, + RESET_STICKY_TASKLIST, + WORKFLOW_WORKER_UNHANDLED_FAILURE, + BAD_SIGNAL_WORKFLOW_EXECUTION_ATTRIBUTES, + BAD_START_CHILD_EXECUTION_ATTRIBUTES, + FORCE_CLOSE_DECISION, + FAILOVER_CLOSE_DECISION, + BAD_SIGNAL_INPUT_SIZE, + RESET_WORKFLOW, + BAD_BINARY, + SCHEDULE_ACTIVITY_DUPLICATE_ID, + BAD_SEARCH_ATTRIBUTES, +} diff --git a/.gen/com/uber/cadence/entities/DecisionTaskFailedEventAttributes.java b/.gen/com/uber/cadence/entities/DecisionTaskFailedEventAttributes.java new file mode 100644 index 000000000..df540b681 --- /dev/null +++ b/.gen/com/uber/cadence/entities/DecisionTaskFailedEventAttributes.java @@ -0,0 +1,43 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class DecisionTaskFailedEventAttributes { + private long scheduledEventId; + private long startedEventId; + private DecisionTaskFailedCause cause; + private byte[] details; + private String identity; + private String reason; + private String baseRunId; + private String newRunId; + private long forkEventVersion; + private String binaryChecksum; + private String requestId; +} diff --git a/.gen/com/uber/cadence/entities/DecisionTaskScheduledEventAttributes.java b/.gen/com/uber/cadence/entities/DecisionTaskScheduledEventAttributes.java new file mode 100644 index 000000000..795566967 --- /dev/null +++ b/.gen/com/uber/cadence/entities/DecisionTaskScheduledEventAttributes.java @@ -0,0 +1,35 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class DecisionTaskScheduledEventAttributes { + private TaskList taskList; + private int startToCloseTimeoutSeconds; + private long attempt; +} diff --git a/.gen/com/uber/cadence/entities/DecisionTaskStartedEventAttributes.java b/.gen/com/uber/cadence/entities/DecisionTaskStartedEventAttributes.java new file mode 100644 index 000000000..3fa233f0d --- /dev/null +++ b/.gen/com/uber/cadence/entities/DecisionTaskStartedEventAttributes.java @@ -0,0 +1,35 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class DecisionTaskStartedEventAttributes { + private long scheduledEventId; + private String identity; + private String requestId; +} diff --git a/.gen/com/uber/cadence/entities/DecisionTaskTimedOutCause.java b/.gen/com/uber/cadence/entities/DecisionTaskTimedOutCause.java new file mode 100644 index 000000000..91303e7a1 --- /dev/null +++ b/.gen/com/uber/cadence/entities/DecisionTaskTimedOutCause.java @@ -0,0 +1,28 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum DecisionTaskTimedOutCause { + TIMEOUT, + RESET, +} diff --git a/.gen/com/uber/cadence/entities/DecisionTaskTimedOutEventAttributes.java b/.gen/com/uber/cadence/entities/DecisionTaskTimedOutEventAttributes.java new file mode 100644 index 000000000..52cd6030b --- /dev/null +++ b/.gen/com/uber/cadence/entities/DecisionTaskTimedOutEventAttributes.java @@ -0,0 +1,41 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class DecisionTaskTimedOutEventAttributes { + private long scheduledEventId; + private long startedEventId; + private TimeoutType timeoutType; + private String baseRunId; + private String newRunId; + private long forkEventVersion; + private String reason; + private DecisionTaskTimedOutCause cause; + private String requestId; +} diff --git a/.gen/com/uber/cadence/entities/DecisionType.java b/.gen/com/uber/cadence/entities/DecisionType.java new file mode 100644 index 000000000..eb7863a58 --- /dev/null +++ b/.gen/com/uber/cadence/entities/DecisionType.java @@ -0,0 +1,39 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum DecisionType { + ScheduleActivityTask, + RequestCancelActivityTask, + StartTimer, + CompleteWorkflowExecution, + FailWorkflowExecution, + CancelTimer, + CancelWorkflowExecution, + RequestCancelExternalWorkflowExecution, + RecordMarker, + ContinueAsNewWorkflowExecution, + StartChildWorkflowExecution, + SignalExternalWorkflowExecution, + UpsertWorkflowSearchAttributes, +} diff --git a/.gen/com/uber/cadence/entities/DeprecateDomainRequest.java b/.gen/com/uber/cadence/entities/DeprecateDomainRequest.java new file mode 100644 index 000000000..8ffa00b93 --- /dev/null +++ b/.gen/com/uber/cadence/entities/DeprecateDomainRequest.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class DeprecateDomainRequest { + private String name; + private String securityToken; +} diff --git a/.gen/com/uber/cadence/entities/DescribeDomainRequest.java b/.gen/com/uber/cadence/entities/DescribeDomainRequest.java new file mode 100644 index 000000000..64be75a2a --- /dev/null +++ b/.gen/com/uber/cadence/entities/DescribeDomainRequest.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class DescribeDomainRequest { + private String name; + private String uuid; +} diff --git a/.gen/com/uber/cadence/entities/DescribeDomainResponse.java b/.gen/com/uber/cadence/entities/DescribeDomainResponse.java new file mode 100644 index 000000000..4e8712bf5 --- /dev/null +++ b/.gen/com/uber/cadence/entities/DescribeDomainResponse.java @@ -0,0 +1,38 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class DescribeDomainResponse { + private DomainInfo domainInfo; + private DomainConfiguration configuration; + private DomainReplicationConfiguration replicationConfiguration; + private long failoverVersion; + private boolean isGlobalDomain; + private FailoverInfo failoverInfo; +} diff --git a/.gen/com/uber/cadence/entities/DescribeHistoryHostRequest.java b/.gen/com/uber/cadence/entities/DescribeHistoryHostRequest.java new file mode 100644 index 000000000..3326ef837 --- /dev/null +++ b/.gen/com/uber/cadence/entities/DescribeHistoryHostRequest.java @@ -0,0 +1,35 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class DescribeHistoryHostRequest { + private String hostAddress; + private int shardIdForHost; + private WorkflowExecution executionForHost; +} diff --git a/.gen/com/uber/cadence/entities/DescribeHistoryHostResponse.java b/.gen/com/uber/cadence/entities/DescribeHistoryHostResponse.java new file mode 100644 index 000000000..9cf7d68fd --- /dev/null +++ b/.gen/com/uber/cadence/entities/DescribeHistoryHostResponse.java @@ -0,0 +1,37 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class DescribeHistoryHostResponse { + private int numberOfShards; + private List shardIDs; + private DomainCacheInfo domainCache; + private String shardControllerStatus; + private String address; +} diff --git a/.gen/com/uber/cadence/entities/DescribeQueueRequest.java b/.gen/com/uber/cadence/entities/DescribeQueueRequest.java new file mode 100644 index 000000000..8f828b53e --- /dev/null +++ b/.gen/com/uber/cadence/entities/DescribeQueueRequest.java @@ -0,0 +1,35 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class DescribeQueueRequest { + private int shardID; + private String clusterName; + private int type; +} diff --git a/.gen/com/uber/cadence/entities/DescribeQueueResponse.java b/.gen/com/uber/cadence/entities/DescribeQueueResponse.java new file mode 100644 index 000000000..e5badb2dd --- /dev/null +++ b/.gen/com/uber/cadence/entities/DescribeQueueResponse.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class DescribeQueueResponse { + private List processingQueueStates; +} diff --git a/.gen/com/uber/cadence/entities/DescribeShardDistributionRequest.java b/.gen/com/uber/cadence/entities/DescribeShardDistributionRequest.java new file mode 100644 index 000000000..e7c751696 --- /dev/null +++ b/.gen/com/uber/cadence/entities/DescribeShardDistributionRequest.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class DescribeShardDistributionRequest { + private int pageSize; + private int pageID; +} diff --git a/.gen/com/uber/cadence/entities/DescribeShardDistributionResponse.java b/.gen/com/uber/cadence/entities/DescribeShardDistributionResponse.java new file mode 100644 index 000000000..25d22db1b --- /dev/null +++ b/.gen/com/uber/cadence/entities/DescribeShardDistributionResponse.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class DescribeShardDistributionResponse { + private int numberOfShards; + private Map shards; +} diff --git a/.gen/com/uber/cadence/entities/DescribeTaskListRequest.java b/.gen/com/uber/cadence/entities/DescribeTaskListRequest.java new file mode 100644 index 000000000..f7ecde624 --- /dev/null +++ b/.gen/com/uber/cadence/entities/DescribeTaskListRequest.java @@ -0,0 +1,36 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class DescribeTaskListRequest { + private String domain; + private TaskList taskList; + private TaskListType taskListType; + private boolean includeTaskListStatus; +} diff --git a/.gen/com/uber/cadence/entities/DescribeTaskListResponse.java b/.gen/com/uber/cadence/entities/DescribeTaskListResponse.java new file mode 100644 index 000000000..7f409c2e2 --- /dev/null +++ b/.gen/com/uber/cadence/entities/DescribeTaskListResponse.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class DescribeTaskListResponse { + private List pollers; + private TaskListStatus taskListStatus; +} diff --git a/.gen/com/uber/cadence/entities/DescribeWorkflowExecutionRequest.java b/.gen/com/uber/cadence/entities/DescribeWorkflowExecutionRequest.java new file mode 100644 index 000000000..d82f4406b --- /dev/null +++ b/.gen/com/uber/cadence/entities/DescribeWorkflowExecutionRequest.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class DescribeWorkflowExecutionRequest { + private String domain; + private WorkflowExecution execution; +} diff --git a/.gen/com/uber/cadence/entities/DescribeWorkflowExecutionResponse.java b/.gen/com/uber/cadence/entities/DescribeWorkflowExecutionResponse.java new file mode 100644 index 000000000..b09e0420e --- /dev/null +++ b/.gen/com/uber/cadence/entities/DescribeWorkflowExecutionResponse.java @@ -0,0 +1,37 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class DescribeWorkflowExecutionResponse { + private WorkflowExecutionConfiguration executionConfiguration; + private WorkflowExecutionInfo workflowExecutionInfo; + private List pendingActivities; + private List pendingChildren; + private PendingDecisionInfo pendingDecision; +} diff --git a/.gen/com/uber/cadence/entities/DomainAlreadyExistsError.java b/.gen/com/uber/cadence/entities/DomainAlreadyExistsError.java new file mode 100644 index 000000000..ef6587b32 --- /dev/null +++ b/.gen/com/uber/cadence/entities/DomainAlreadyExistsError.java @@ -0,0 +1,46 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Getter +@Setter +@Accessors(chain = true) +public class DomainAlreadyExistsError extends BaseError { + + public DomainAlreadyExistsError() { + super(); + } + + public DomainAlreadyExistsError(String message, Throwable cause) { + super(message, cause); + } + + public DomainAlreadyExistsError(Throwable cause) { + super(cause); + } +} diff --git a/.gen/com/uber/cadence/entities/DomainCacheInfo.java b/.gen/com/uber/cadence/entities/DomainCacheInfo.java new file mode 100644 index 000000000..0a9f4b333 --- /dev/null +++ b/.gen/com/uber/cadence/entities/DomainCacheInfo.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class DomainCacheInfo { + private long numOfItemsInCacheByID; + private long numOfItemsInCacheByName; +} diff --git a/.gen/com/uber/cadence/entities/DomainConfiguration.java b/.gen/com/uber/cadence/entities/DomainConfiguration.java new file mode 100644 index 000000000..2e26a3b4c --- /dev/null +++ b/.gen/com/uber/cadence/entities/DomainConfiguration.java @@ -0,0 +1,41 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class DomainConfiguration { + private int workflowExecutionRetentionPeriodInDays; + private boolean emitMetric; + private IsolationGroupConfiguration isolationgroups; + private BadBinaries badBinaries; + private ArchivalStatus historyArchivalStatus; + private String historyArchivalURI; + private ArchivalStatus visibilityArchivalStatus; + private String visibilityArchivalURI; + private AsyncWorkflowConfiguration AsyncWorkflowConfiguration; +} diff --git a/.gen/com/uber/cadence/entities/DomainInfo.java b/.gen/com/uber/cadence/entities/DomainInfo.java new file mode 100644 index 000000000..300cbf52d --- /dev/null +++ b/.gen/com/uber/cadence/entities/DomainInfo.java @@ -0,0 +1,38 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class DomainInfo { + private String name; + private DomainStatus status; + private String description; + private String ownerEmail; + private Map data; + private String uuid; +} diff --git a/.gen/com/uber/cadence/entities/DomainNotActiveError.java b/.gen/com/uber/cadence/entities/DomainNotActiveError.java new file mode 100644 index 000000000..ec9350760 --- /dev/null +++ b/.gen/com/uber/cadence/entities/DomainNotActiveError.java @@ -0,0 +1,51 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Getter +@Setter +@Accessors(chain = true) +@AllArgsConstructor +public class DomainNotActiveError extends BaseError { + private String domainName; + private String currentCluster; + private String activeCluster; + + public DomainNotActiveError() { + super(); + } + + public DomainNotActiveError(String message, Throwable cause) { + super(message, cause); + } + + public DomainNotActiveError(Throwable cause) { + super(cause); + } +} diff --git a/.gen/com/uber/cadence/entities/DomainReplicationConfiguration.java b/.gen/com/uber/cadence/entities/DomainReplicationConfiguration.java new file mode 100644 index 000000000..ba2415171 --- /dev/null +++ b/.gen/com/uber/cadence/entities/DomainReplicationConfiguration.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class DomainReplicationConfiguration { + private String activeClusterName; + private List clusters; +} diff --git a/.gen/com/uber/cadence/entities/DomainStatus.java b/.gen/com/uber/cadence/entities/DomainStatus.java new file mode 100644 index 000000000..87f7c10db --- /dev/null +++ b/.gen/com/uber/cadence/entities/DomainStatus.java @@ -0,0 +1,29 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum DomainStatus { + REGISTERED, + DEPRECATED, + DELETED, +} diff --git a/.gen/com/uber/cadence/entities/EncodingType.java b/.gen/com/uber/cadence/entities/EncodingType.java new file mode 100644 index 000000000..86305d62c --- /dev/null +++ b/.gen/com/uber/cadence/entities/EncodingType.java @@ -0,0 +1,28 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum EncodingType { + ThriftRW, + JSON, +} diff --git a/.gen/com/uber/cadence/entities/EntityNotExistsError.java b/.gen/com/uber/cadence/entities/EntityNotExistsError.java new file mode 100644 index 000000000..d429c7759 --- /dev/null +++ b/.gen/com/uber/cadence/entities/EntityNotExistsError.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.entities; + +import java.util.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Getter +@Setter +@Accessors(chain = true) +@AllArgsConstructor +public class EntityNotExistsError extends BaseError { + private String currentCluster; + private String activeCluster; + + public EntityNotExistsError() { + super(); + } + + public EntityNotExistsError(String message, Throwable cause) { + super(message, cause); + } + + public EntityNotExistsError(Throwable cause) { + super(cause); + } +} diff --git a/.gen/com/uber/cadence/entities/EventType.java b/.gen/com/uber/cadence/entities/EventType.java new file mode 100644 index 000000000..3c66d24ef --- /dev/null +++ b/.gen/com/uber/cadence/entities/EventType.java @@ -0,0 +1,68 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum EventType { + WorkflowExecutionStarted, + WorkflowExecutionCompleted, + WorkflowExecutionFailed, + WorkflowExecutionTimedOut, + DecisionTaskScheduled, + DecisionTaskStarted, + DecisionTaskCompleted, + DecisionTaskTimedOut, + DecisionTaskFailed, + ActivityTaskScheduled, + ActivityTaskStarted, + ActivityTaskCompleted, + ActivityTaskFailed, + ActivityTaskTimedOut, + ActivityTaskCancelRequested, + RequestCancelActivityTaskFailed, + ActivityTaskCanceled, + TimerStarted, + TimerFired, + CancelTimerFailed, + TimerCanceled, + WorkflowExecutionCancelRequested, + WorkflowExecutionCanceled, + RequestCancelExternalWorkflowExecutionInitiated, + RequestCancelExternalWorkflowExecutionFailed, + ExternalWorkflowExecutionCancelRequested, + MarkerRecorded, + WorkflowExecutionSignaled, + WorkflowExecutionTerminated, + WorkflowExecutionContinuedAsNew, + StartChildWorkflowExecutionInitiated, + StartChildWorkflowExecutionFailed, + ChildWorkflowExecutionStarted, + ChildWorkflowExecutionCompleted, + ChildWorkflowExecutionFailed, + ChildWorkflowExecutionCanceled, + ChildWorkflowExecutionTimedOut, + ChildWorkflowExecutionTerminated, + SignalExternalWorkflowExecutionInitiated, + SignalExternalWorkflowExecutionFailed, + ExternalWorkflowExecutionSignaled, + UpsertWorkflowSearchAttributes, +} diff --git a/.gen/com/uber/cadence/entities/ExternalWorkflowExecutionCancelRequestedEventAttributes.java b/.gen/com/uber/cadence/entities/ExternalWorkflowExecutionCancelRequestedEventAttributes.java new file mode 100644 index 000000000..a4c6cfde9 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ExternalWorkflowExecutionCancelRequestedEventAttributes.java @@ -0,0 +1,35 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ExternalWorkflowExecutionCancelRequestedEventAttributes { + private long initiatedEventId; + private String domain; + private WorkflowExecution workflowExecution; +} diff --git a/.gen/com/uber/cadence/entities/ExternalWorkflowExecutionSignaledEventAttributes.java b/.gen/com/uber/cadence/entities/ExternalWorkflowExecutionSignaledEventAttributes.java new file mode 100644 index 000000000..aeefed39c --- /dev/null +++ b/.gen/com/uber/cadence/entities/ExternalWorkflowExecutionSignaledEventAttributes.java @@ -0,0 +1,36 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ExternalWorkflowExecutionSignaledEventAttributes { + private long initiatedEventId; + private String domain; + private WorkflowExecution workflowExecution; + private byte[] control; +} diff --git a/.gen/com/uber/cadence/entities/FailWorkflowExecutionDecisionAttributes.java b/.gen/com/uber/cadence/entities/FailWorkflowExecutionDecisionAttributes.java new file mode 100644 index 000000000..00ab5d714 --- /dev/null +++ b/.gen/com/uber/cadence/entities/FailWorkflowExecutionDecisionAttributes.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class FailWorkflowExecutionDecisionAttributes { + private String reason; + private byte[] details; +} diff --git a/.gen/com/uber/cadence/entities/FailoverInfo.java b/.gen/com/uber/cadence/entities/FailoverInfo.java new file mode 100644 index 000000000..96c441e8c --- /dev/null +++ b/.gen/com/uber/cadence/entities/FailoverInfo.java @@ -0,0 +1,37 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class FailoverInfo { + private long failoverVersion; + private long failoverStartTimestamp; + private long failoverExpireTimestamp; + private int completedShardCount; + private List pendingShards; +} diff --git a/.gen/com/uber/cadence/entities/FeatureFlags.java b/.gen/com/uber/cadence/entities/FeatureFlags.java new file mode 100644 index 000000000..effc354da --- /dev/null +++ b/.gen/com/uber/cadence/entities/FeatureFlags.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class FeatureFlags { + private boolean WorkflowExecutionAlreadyCompletedErrorEnabled; +} diff --git a/.gen/com/uber/cadence/entities/FeatureNotEnabledError.java b/.gen/com/uber/cadence/entities/FeatureNotEnabledError.java new file mode 100644 index 000000000..6398e11e8 --- /dev/null +++ b/.gen/com/uber/cadence/entities/FeatureNotEnabledError.java @@ -0,0 +1,49 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Getter +@Setter +@Accessors(chain = true) +@AllArgsConstructor +public class FeatureNotEnabledError extends BaseError { + private String featureFlag; + + public FeatureNotEnabledError() { + super(); + } + + public FeatureNotEnabledError(String message, Throwable cause) { + super(message, cause); + } + + public FeatureNotEnabledError(Throwable cause) { + super(cause); + } +} diff --git a/.gen/com/uber/cadence/entities/GetCrossClusterTasksRequest.java b/.gen/com/uber/cadence/entities/GetCrossClusterTasksRequest.java new file mode 100644 index 000000000..409fb8c8f --- /dev/null +++ b/.gen/com/uber/cadence/entities/GetCrossClusterTasksRequest.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class GetCrossClusterTasksRequest { + private List shardIDs; + private String targetCluster; +} diff --git a/.gen/com/uber/cadence/entities/GetCrossClusterTasksResponse.java b/.gen/com/uber/cadence/entities/GetCrossClusterTasksResponse.java new file mode 100644 index 000000000..1d7fad63b --- /dev/null +++ b/.gen/com/uber/cadence/entities/GetCrossClusterTasksResponse.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class GetCrossClusterTasksResponse { + private Map> tasksByShard; + private Map failedCauseByShard; +} diff --git a/.gen/com/uber/cadence/entities/GetSearchAttributesResponse.java b/.gen/com/uber/cadence/entities/GetSearchAttributesResponse.java new file mode 100644 index 000000000..acf5db598 --- /dev/null +++ b/.gen/com/uber/cadence/entities/GetSearchAttributesResponse.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class GetSearchAttributesResponse { + private Map keys; +} diff --git a/.gen/com/uber/cadence/entities/GetTaskFailedCause.java b/.gen/com/uber/cadence/entities/GetTaskFailedCause.java new file mode 100644 index 000000000..d11510312 --- /dev/null +++ b/.gen/com/uber/cadence/entities/GetTaskFailedCause.java @@ -0,0 +1,30 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum GetTaskFailedCause { + SERVICE_BUSY, + TIMEOUT, + SHARD_OWNERSHIP_LOST, + UNCATEGORIZED, +} diff --git a/.gen/com/uber/cadence/entities/GetTaskListsByDomainRequest.java b/.gen/com/uber/cadence/entities/GetTaskListsByDomainRequest.java new file mode 100644 index 000000000..de4837eba --- /dev/null +++ b/.gen/com/uber/cadence/entities/GetTaskListsByDomainRequest.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class GetTaskListsByDomainRequest { + private String domainName; +} diff --git a/.gen/com/uber/cadence/entities/GetTaskListsByDomainResponse.java b/.gen/com/uber/cadence/entities/GetTaskListsByDomainResponse.java new file mode 100644 index 000000000..34d9d131f --- /dev/null +++ b/.gen/com/uber/cadence/entities/GetTaskListsByDomainResponse.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class GetTaskListsByDomainResponse { + private Map decisionTaskListMap; + private Map activityTaskListMap; +} diff --git a/.gen/com/uber/cadence/entities/GetWorkflowExecutionHistoryRequest.java b/.gen/com/uber/cadence/entities/GetWorkflowExecutionHistoryRequest.java new file mode 100644 index 000000000..0fa56b743 --- /dev/null +++ b/.gen/com/uber/cadence/entities/GetWorkflowExecutionHistoryRequest.java @@ -0,0 +1,39 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class GetWorkflowExecutionHistoryRequest { + private String domain; + private WorkflowExecution execution; + private int maximumPageSize; + private byte[] nextPageToken; + private boolean waitForNewEvent; + private HistoryEventFilterType HistoryEventFilterType; + private boolean skipArchival; +} diff --git a/.gen/com/uber/cadence/entities/GetWorkflowExecutionHistoryResponse.java b/.gen/com/uber/cadence/entities/GetWorkflowExecutionHistoryResponse.java new file mode 100644 index 000000000..9c47bc302 --- /dev/null +++ b/.gen/com/uber/cadence/entities/GetWorkflowExecutionHistoryResponse.java @@ -0,0 +1,36 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class GetWorkflowExecutionHistoryResponse { + private History history; + private List rawHistory; + private byte[] nextPageToken; + private boolean archived; +} diff --git a/.gen/com/uber/cadence/entities/Header.java b/.gen/com/uber/cadence/entities/Header.java new file mode 100644 index 000000000..4670d3d86 --- /dev/null +++ b/.gen/com/uber/cadence/entities/Header.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class Header { + private Map fields; +} diff --git a/.gen/com/uber/cadence/entities/History.java b/.gen/com/uber/cadence/entities/History.java new file mode 100644 index 000000000..a5328457a --- /dev/null +++ b/.gen/com/uber/cadence/entities/History.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class History { + private List events; +} diff --git a/.gen/com/uber/cadence/entities/HistoryBranch.java b/.gen/com/uber/cadence/entities/HistoryBranch.java new file mode 100644 index 000000000..7ae2bd4b2 --- /dev/null +++ b/.gen/com/uber/cadence/entities/HistoryBranch.java @@ -0,0 +1,35 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class HistoryBranch { + private String treeID; + private String branchID; + private List ancestors; +} diff --git a/.gen/com/uber/cadence/entities/HistoryBranchRange.java b/.gen/com/uber/cadence/entities/HistoryBranchRange.java new file mode 100644 index 000000000..f668f0840 --- /dev/null +++ b/.gen/com/uber/cadence/entities/HistoryBranchRange.java @@ -0,0 +1,35 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class HistoryBranchRange { + private String branchID; + private long beginNodeID; + private long endNodeID; +} diff --git a/.gen/com/uber/cadence/entities/HistoryEvent.java b/.gen/com/uber/cadence/entities/HistoryEvent.java new file mode 100644 index 000000000..3bdecaafc --- /dev/null +++ b/.gen/com/uber/cadence/entities/HistoryEvent.java @@ -0,0 +1,95 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class HistoryEvent { + private long eventId; + private long timestamp; + private EventType eventType; + private long version; + private long taskId; + private WorkflowExecutionStartedEventAttributes workflowExecutionStartedEventAttributes; + private WorkflowExecutionCompletedEventAttributes workflowExecutionCompletedEventAttributes; + private WorkflowExecutionFailedEventAttributes workflowExecutionFailedEventAttributes; + private WorkflowExecutionTimedOutEventAttributes workflowExecutionTimedOutEventAttributes; + private DecisionTaskScheduledEventAttributes decisionTaskScheduledEventAttributes; + private DecisionTaskStartedEventAttributes decisionTaskStartedEventAttributes; + private DecisionTaskCompletedEventAttributes decisionTaskCompletedEventAttributes; + private DecisionTaskTimedOutEventAttributes decisionTaskTimedOutEventAttributes; + private DecisionTaskFailedEventAttributes decisionTaskFailedEventAttributes; + private ActivityTaskScheduledEventAttributes activityTaskScheduledEventAttributes; + private ActivityTaskStartedEventAttributes activityTaskStartedEventAttributes; + private ActivityTaskCompletedEventAttributes activityTaskCompletedEventAttributes; + private ActivityTaskFailedEventAttributes activityTaskFailedEventAttributes; + private ActivityTaskTimedOutEventAttributes activityTaskTimedOutEventAttributes; + private TimerStartedEventAttributes timerStartedEventAttributes; + private TimerFiredEventAttributes timerFiredEventAttributes; + private ActivityTaskCancelRequestedEventAttributes activityTaskCancelRequestedEventAttributes; + private RequestCancelActivityTaskFailedEventAttributes + requestCancelActivityTaskFailedEventAttributes; + private ActivityTaskCanceledEventAttributes activityTaskCanceledEventAttributes; + private TimerCanceledEventAttributes timerCanceledEventAttributes; + private CancelTimerFailedEventAttributes cancelTimerFailedEventAttributes; + private MarkerRecordedEventAttributes markerRecordedEventAttributes; + private WorkflowExecutionSignaledEventAttributes workflowExecutionSignaledEventAttributes; + private WorkflowExecutionTerminatedEventAttributes workflowExecutionTerminatedEventAttributes; + private WorkflowExecutionCancelRequestedEventAttributes + workflowExecutionCancelRequestedEventAttributes; + private WorkflowExecutionCanceledEventAttributes workflowExecutionCanceledEventAttributes; + private RequestCancelExternalWorkflowExecutionInitiatedEventAttributes + requestCancelExternalWorkflowExecutionInitiatedEventAttributes; + private RequestCancelExternalWorkflowExecutionFailedEventAttributes + requestCancelExternalWorkflowExecutionFailedEventAttributes; + private ExternalWorkflowExecutionCancelRequestedEventAttributes + externalWorkflowExecutionCancelRequestedEventAttributes; + private WorkflowExecutionContinuedAsNewEventAttributes + workflowExecutionContinuedAsNewEventAttributes; + private StartChildWorkflowExecutionInitiatedEventAttributes + startChildWorkflowExecutionInitiatedEventAttributes; + private StartChildWorkflowExecutionFailedEventAttributes + startChildWorkflowExecutionFailedEventAttributes; + private ChildWorkflowExecutionStartedEventAttributes childWorkflowExecutionStartedEventAttributes; + private ChildWorkflowExecutionCompletedEventAttributes + childWorkflowExecutionCompletedEventAttributes; + private ChildWorkflowExecutionFailedEventAttributes childWorkflowExecutionFailedEventAttributes; + private ChildWorkflowExecutionCanceledEventAttributes + childWorkflowExecutionCanceledEventAttributes; + private ChildWorkflowExecutionTimedOutEventAttributes + childWorkflowExecutionTimedOutEventAttributes; + private ChildWorkflowExecutionTerminatedEventAttributes + childWorkflowExecutionTerminatedEventAttributes; + private SignalExternalWorkflowExecutionInitiatedEventAttributes + signalExternalWorkflowExecutionInitiatedEventAttributes; + private SignalExternalWorkflowExecutionFailedEventAttributes + signalExternalWorkflowExecutionFailedEventAttributes; + private ExternalWorkflowExecutionSignaledEventAttributes + externalWorkflowExecutionSignaledEventAttributes; + private UpsertWorkflowSearchAttributesEventAttributes + upsertWorkflowSearchAttributesEventAttributes; +} diff --git a/.gen/com/uber/cadence/entities/HistoryEventFilterType.java b/.gen/com/uber/cadence/entities/HistoryEventFilterType.java new file mode 100644 index 000000000..7b50cc680 --- /dev/null +++ b/.gen/com/uber/cadence/entities/HistoryEventFilterType.java @@ -0,0 +1,28 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum HistoryEventFilterType { + ALL_EVENT, + CLOSE_EVENT, +} diff --git a/.gen/com/uber/cadence/entities/IndexedValueType.java b/.gen/com/uber/cadence/entities/IndexedValueType.java new file mode 100644 index 000000000..2e0d270bb --- /dev/null +++ b/.gen/com/uber/cadence/entities/IndexedValueType.java @@ -0,0 +1,32 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum IndexedValueType { + STRING, + KEYWORD, + INT, + DOUBLE, + BOOL, + DATETIME, +} diff --git a/.gen/com/uber/cadence/entities/InternalDataInconsistencyError.java b/.gen/com/uber/cadence/entities/InternalDataInconsistencyError.java new file mode 100644 index 000000000..0944fb908 --- /dev/null +++ b/.gen/com/uber/cadence/entities/InternalDataInconsistencyError.java @@ -0,0 +1,46 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Getter +@Setter +@Accessors(chain = true) +public class InternalDataInconsistencyError extends BaseError { + + public InternalDataInconsistencyError() { + super(); + } + + public InternalDataInconsistencyError(String message, Throwable cause) { + super(message, cause); + } + + public InternalDataInconsistencyError(Throwable cause) { + super(cause); + } +} diff --git a/.gen/com/uber/cadence/entities/InternalServiceError.java b/.gen/com/uber/cadence/entities/InternalServiceError.java new file mode 100644 index 000000000..6143a9d7f --- /dev/null +++ b/.gen/com/uber/cadence/entities/InternalServiceError.java @@ -0,0 +1,46 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Getter +@Setter +@Accessors(chain = true) +public class InternalServiceError extends BaseError { + + public InternalServiceError() { + super(); + } + + public InternalServiceError(String message, Throwable cause) { + super(message, cause); + } + + public InternalServiceError(Throwable cause) { + super(cause); + } +} diff --git a/.gen/com/uber/cadence/entities/IsolationGroupConfiguration.java b/.gen/com/uber/cadence/entities/IsolationGroupConfiguration.java new file mode 100644 index 000000000..6012eb361 --- /dev/null +++ b/.gen/com/uber/cadence/entities/IsolationGroupConfiguration.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class IsolationGroupConfiguration { + private List isolationGroups; +} diff --git a/.gen/com/uber/cadence/entities/IsolationGroupPartition.java b/.gen/com/uber/cadence/entities/IsolationGroupPartition.java new file mode 100644 index 000000000..d65dc10f2 --- /dev/null +++ b/.gen/com/uber/cadence/entities/IsolationGroupPartition.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class IsolationGroupPartition { + private String name; + private IsolationGroupState state; +} diff --git a/.gen/com/uber/cadence/entities/IsolationGroupState.java b/.gen/com/uber/cadence/entities/IsolationGroupState.java new file mode 100644 index 000000000..163b39a2b --- /dev/null +++ b/.gen/com/uber/cadence/entities/IsolationGroupState.java @@ -0,0 +1,29 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum IsolationGroupState { + INVALID, + HEALTHY, + DRAINED, +} diff --git a/.gen/com/uber/cadence/entities/LimitExceededError.java b/.gen/com/uber/cadence/entities/LimitExceededError.java new file mode 100644 index 000000000..6f56b0138 --- /dev/null +++ b/.gen/com/uber/cadence/entities/LimitExceededError.java @@ -0,0 +1,46 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Getter +@Setter +@Accessors(chain = true) +public class LimitExceededError extends BaseError { + + public LimitExceededError() { + super(); + } + + public LimitExceededError(String message, Throwable cause) { + super(message, cause); + } + + public LimitExceededError(Throwable cause) { + super(cause); + } +} diff --git a/.gen/com/uber/cadence/entities/ListArchivedWorkflowExecutionsRequest.java b/.gen/com/uber/cadence/entities/ListArchivedWorkflowExecutionsRequest.java new file mode 100644 index 000000000..7c4a8e6c0 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ListArchivedWorkflowExecutionsRequest.java @@ -0,0 +1,36 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ListArchivedWorkflowExecutionsRequest { + private String domain; + private int pageSize; + private byte[] nextPageToken; + private String query; +} diff --git a/.gen/com/uber/cadence/entities/ListArchivedWorkflowExecutionsResponse.java b/.gen/com/uber/cadence/entities/ListArchivedWorkflowExecutionsResponse.java new file mode 100644 index 000000000..79223d498 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ListArchivedWorkflowExecutionsResponse.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ListArchivedWorkflowExecutionsResponse { + private List executions; + private byte[] nextPageToken; +} diff --git a/.gen/com/uber/cadence/entities/ListClosedWorkflowExecutionsRequest.java b/.gen/com/uber/cadence/entities/ListClosedWorkflowExecutionsRequest.java new file mode 100644 index 000000000..9febb3924 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ListClosedWorkflowExecutionsRequest.java @@ -0,0 +1,39 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ListClosedWorkflowExecutionsRequest { + private String domain; + private int maximumPageSize; + private byte[] nextPageToken; + private StartTimeFilter StartTimeFilter; + private WorkflowExecutionFilter executionFilter; + private WorkflowTypeFilter typeFilter; + private WorkflowExecutionCloseStatus statusFilter; +} diff --git a/.gen/com/uber/cadence/entities/ListClosedWorkflowExecutionsResponse.java b/.gen/com/uber/cadence/entities/ListClosedWorkflowExecutionsResponse.java new file mode 100644 index 000000000..68282b51b --- /dev/null +++ b/.gen/com/uber/cadence/entities/ListClosedWorkflowExecutionsResponse.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ListClosedWorkflowExecutionsResponse { + private List executions; + private byte[] nextPageToken; +} diff --git a/.gen/com/uber/cadence/entities/ListDomainsRequest.java b/.gen/com/uber/cadence/entities/ListDomainsRequest.java new file mode 100644 index 000000000..c6b501bb8 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ListDomainsRequest.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ListDomainsRequest { + private int pageSize; + private byte[] nextPageToken; +} diff --git a/.gen/com/uber/cadence/entities/ListDomainsResponse.java b/.gen/com/uber/cadence/entities/ListDomainsResponse.java new file mode 100644 index 000000000..b996e1bfd --- /dev/null +++ b/.gen/com/uber/cadence/entities/ListDomainsResponse.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ListDomainsResponse { + private List domains; + private byte[] nextPageToken; +} diff --git a/.gen/com/uber/cadence/entities/ListOpenWorkflowExecutionsRequest.java b/.gen/com/uber/cadence/entities/ListOpenWorkflowExecutionsRequest.java new file mode 100644 index 000000000..83b8b601e --- /dev/null +++ b/.gen/com/uber/cadence/entities/ListOpenWorkflowExecutionsRequest.java @@ -0,0 +1,38 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ListOpenWorkflowExecutionsRequest { + private String domain; + private int maximumPageSize; + private byte[] nextPageToken; + private StartTimeFilter StartTimeFilter; + private WorkflowExecutionFilter executionFilter; + private WorkflowTypeFilter typeFilter; +} diff --git a/.gen/com/uber/cadence/entities/ListOpenWorkflowExecutionsResponse.java b/.gen/com/uber/cadence/entities/ListOpenWorkflowExecutionsResponse.java new file mode 100644 index 000000000..02bf0b440 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ListOpenWorkflowExecutionsResponse.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ListOpenWorkflowExecutionsResponse { + private List executions; + private byte[] nextPageToken; +} diff --git a/.gen/com/uber/cadence/entities/ListTaskListPartitionsRequest.java b/.gen/com/uber/cadence/entities/ListTaskListPartitionsRequest.java new file mode 100644 index 000000000..1a093fd99 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ListTaskListPartitionsRequest.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ListTaskListPartitionsRequest { + private String domain; + private TaskList taskList; +} diff --git a/.gen/com/uber/cadence/entities/ListTaskListPartitionsResponse.java b/.gen/com/uber/cadence/entities/ListTaskListPartitionsResponse.java new file mode 100644 index 000000000..2eb347926 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ListTaskListPartitionsResponse.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ListTaskListPartitionsResponse { + private List activityTaskListPartitions; + private List decisionTaskListPartitions; +} diff --git a/.gen/com/uber/cadence/entities/ListWorkflowExecutionsRequest.java b/.gen/com/uber/cadence/entities/ListWorkflowExecutionsRequest.java new file mode 100644 index 000000000..a0f60623e --- /dev/null +++ b/.gen/com/uber/cadence/entities/ListWorkflowExecutionsRequest.java @@ -0,0 +1,36 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ListWorkflowExecutionsRequest { + private String domain; + private int pageSize; + private byte[] nextPageToken; + private String query; +} diff --git a/.gen/com/uber/cadence/entities/ListWorkflowExecutionsResponse.java b/.gen/com/uber/cadence/entities/ListWorkflowExecutionsResponse.java new file mode 100644 index 000000000..8e673fdfb --- /dev/null +++ b/.gen/com/uber/cadence/entities/ListWorkflowExecutionsResponse.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ListWorkflowExecutionsResponse { + private List executions; + private byte[] nextPageToken; +} diff --git a/.gen/com/uber/cadence/entities/MarkerRecordedEventAttributes.java b/.gen/com/uber/cadence/entities/MarkerRecordedEventAttributes.java new file mode 100644 index 000000000..eec54429a --- /dev/null +++ b/.gen/com/uber/cadence/entities/MarkerRecordedEventAttributes.java @@ -0,0 +1,36 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class MarkerRecordedEventAttributes { + private String markerName; + private byte[] details; + private long decisionTaskCompletedEventId; + private Header header; +} diff --git a/.gen/com/uber/cadence/entities/Memo.java b/.gen/com/uber/cadence/entities/Memo.java new file mode 100644 index 000000000..8d8326977 --- /dev/null +++ b/.gen/com/uber/cadence/entities/Memo.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class Memo { + private Map fields; +} diff --git a/.gen/com/uber/cadence/entities/ParentClosePolicy.java b/.gen/com/uber/cadence/entities/ParentClosePolicy.java new file mode 100644 index 000000000..ec2721669 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ParentClosePolicy.java @@ -0,0 +1,29 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum ParentClosePolicy { + ABANDON, + REQUEST_CANCEL, + TERMINATE, +} diff --git a/.gen/com/uber/cadence/entities/PendingActivityInfo.java b/.gen/com/uber/cadence/entities/PendingActivityInfo.java new file mode 100644 index 000000000..091112c0c --- /dev/null +++ b/.gen/com/uber/cadence/entities/PendingActivityInfo.java @@ -0,0 +1,46 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class PendingActivityInfo { + private String activityID; + private ActivityType activityType; + private PendingActivityState state; + private byte[] heartbeatDetails; + private long lastHeartbeatTimestamp; + private long lastStartedTimestamp; + private int attempt; + private int maximumAttempts; + private long scheduledTimestamp; + private long expirationTimestamp; + private String lastFailureReason; + private String lastWorkerIdentity; + private byte[] lastFailureDetails; + private String startedWorkerIdentity; +} diff --git a/.gen/com/uber/cadence/entities/PendingActivityState.java b/.gen/com/uber/cadence/entities/PendingActivityState.java new file mode 100644 index 000000000..414e30958 --- /dev/null +++ b/.gen/com/uber/cadence/entities/PendingActivityState.java @@ -0,0 +1,29 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum PendingActivityState { + SCHEDULED, + STARTED, + CANCEL_REQUESTED, +} diff --git a/.gen/com/uber/cadence/entities/PendingChildExecutionInfo.java b/.gen/com/uber/cadence/entities/PendingChildExecutionInfo.java new file mode 100644 index 000000000..3d3a3d34e --- /dev/null +++ b/.gen/com/uber/cadence/entities/PendingChildExecutionInfo.java @@ -0,0 +1,38 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class PendingChildExecutionInfo { + private String domain; + private String workflowID; + private String runID; + private String workflowTypName; + private long initiatedID; + private ParentClosePolicy parentClosePolicy; +} diff --git a/.gen/com/uber/cadence/entities/PendingDecisionInfo.java b/.gen/com/uber/cadence/entities/PendingDecisionInfo.java new file mode 100644 index 000000000..262a3934f --- /dev/null +++ b/.gen/com/uber/cadence/entities/PendingDecisionInfo.java @@ -0,0 +1,37 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class PendingDecisionInfo { + private PendingDecisionState state; + private long scheduledTimestamp; + private long startedTimestamp; + private long attempt; + private long originalScheduledTimestamp; +} diff --git a/.gen/com/uber/cadence/entities/PendingDecisionState.java b/.gen/com/uber/cadence/entities/PendingDecisionState.java new file mode 100644 index 000000000..e9e42c7d2 --- /dev/null +++ b/.gen/com/uber/cadence/entities/PendingDecisionState.java @@ -0,0 +1,28 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum PendingDecisionState { + SCHEDULED, + STARTED, +} diff --git a/.gen/com/uber/cadence/entities/PollForActivityTaskRequest.java b/.gen/com/uber/cadence/entities/PollForActivityTaskRequest.java new file mode 100644 index 000000000..83e0e8293 --- /dev/null +++ b/.gen/com/uber/cadence/entities/PollForActivityTaskRequest.java @@ -0,0 +1,36 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class PollForActivityTaskRequest { + private String domain; + private TaskList taskList; + private String identity; + private TaskListMetadata taskListMetadata; +} diff --git a/.gen/com/uber/cadence/entities/PollForActivityTaskResponse.java b/.gen/com/uber/cadence/entities/PollForActivityTaskResponse.java new file mode 100644 index 000000000..7d8be89ec --- /dev/null +++ b/.gen/com/uber/cadence/entities/PollForActivityTaskResponse.java @@ -0,0 +1,48 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class PollForActivityTaskResponse { + private byte[] taskToken; + private WorkflowExecution workflowExecution; + private String activityId; + private ActivityType activityType; + private byte[] input; + private long scheduledTimestamp; + private int scheduleToCloseTimeoutSeconds; + private long startedTimestamp; + private int startToCloseTimeoutSeconds; + private int heartbeatTimeoutSeconds; + private int attempt; + private long scheduledTimestampOfThisAttempt; + private byte[] heartbeatDetails; + private WorkflowType workflowType; + private String workflowDomain; + private Header header; +} diff --git a/.gen/com/uber/cadence/entities/PollForDecisionTaskRequest.java b/.gen/com/uber/cadence/entities/PollForDecisionTaskRequest.java new file mode 100644 index 000000000..40097da71 --- /dev/null +++ b/.gen/com/uber/cadence/entities/PollForDecisionTaskRequest.java @@ -0,0 +1,36 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class PollForDecisionTaskRequest { + private String domain; + private TaskList taskList; + private String identity; + private String binaryChecksum; +} diff --git a/.gen/com/uber/cadence/entities/PollForDecisionTaskResponse.java b/.gen/com/uber/cadence/entities/PollForDecisionTaskResponse.java new file mode 100644 index 000000000..116605724 --- /dev/null +++ b/.gen/com/uber/cadence/entities/PollForDecisionTaskResponse.java @@ -0,0 +1,48 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class PollForDecisionTaskResponse { + private byte[] taskToken; + private WorkflowExecution workflowExecution; + private WorkflowType workflowType; + private long previousStartedEventId; + private long startedEventId; + private long attempt; + private long backlogCountHint; + private History history; + private byte[] nextPageToken; + private WorkflowQuery query; + private TaskList WorkflowExecutionTaskList; + private long scheduledTimestamp; + private long startedTimestamp; + private Map queries; + private long nextEventId; + private long totalHistoryBytes; +} diff --git a/.gen/com/uber/cadence/entities/PollerInfo.java b/.gen/com/uber/cadence/entities/PollerInfo.java new file mode 100644 index 000000000..3f01ac551 --- /dev/null +++ b/.gen/com/uber/cadence/entities/PollerInfo.java @@ -0,0 +1,35 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class PollerInfo { + private long lastAccessTime; + private String identity; + private double ratePerSecond; +} diff --git a/.gen/com/uber/cadence/entities/QueryConsistencyLevel.java b/.gen/com/uber/cadence/entities/QueryConsistencyLevel.java new file mode 100644 index 000000000..476940010 --- /dev/null +++ b/.gen/com/uber/cadence/entities/QueryConsistencyLevel.java @@ -0,0 +1,28 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum QueryConsistencyLevel { + EVENTUAL, + STRONG, +} diff --git a/.gen/com/uber/cadence/entities/QueryFailedError.java b/.gen/com/uber/cadence/entities/QueryFailedError.java new file mode 100644 index 000000000..7ff187af1 --- /dev/null +++ b/.gen/com/uber/cadence/entities/QueryFailedError.java @@ -0,0 +1,46 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Getter +@Setter +@Accessors(chain = true) +public class QueryFailedError extends BaseError { + + public QueryFailedError() { + super(); + } + + public QueryFailedError(String message, Throwable cause) { + super(message, cause); + } + + public QueryFailedError(Throwable cause) { + super(cause); + } +} diff --git a/.gen/com/uber/cadence/entities/QueryRejectCondition.java b/.gen/com/uber/cadence/entities/QueryRejectCondition.java new file mode 100644 index 000000000..bfafe66f0 --- /dev/null +++ b/.gen/com/uber/cadence/entities/QueryRejectCondition.java @@ -0,0 +1,28 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum QueryRejectCondition { + NOT_OPEN, + NOT_COMPLETED_CLEANLY, +} diff --git a/.gen/com/uber/cadence/entities/QueryRejected.java b/.gen/com/uber/cadence/entities/QueryRejected.java new file mode 100644 index 000000000..97145a487 --- /dev/null +++ b/.gen/com/uber/cadence/entities/QueryRejected.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class QueryRejected { + private WorkflowExecutionCloseStatus closeStatus; +} diff --git a/.gen/com/uber/cadence/entities/QueryResultType.java b/.gen/com/uber/cadence/entities/QueryResultType.java new file mode 100644 index 000000000..c30b9a4c1 --- /dev/null +++ b/.gen/com/uber/cadence/entities/QueryResultType.java @@ -0,0 +1,28 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum QueryResultType { + ANSWERED, + FAILED, +} diff --git a/.gen/com/uber/cadence/entities/QueryTaskCompletedType.java b/.gen/com/uber/cadence/entities/QueryTaskCompletedType.java new file mode 100644 index 000000000..acf6b1648 --- /dev/null +++ b/.gen/com/uber/cadence/entities/QueryTaskCompletedType.java @@ -0,0 +1,28 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum QueryTaskCompletedType { + COMPLETED, + FAILED, +} diff --git a/.gen/com/uber/cadence/entities/QueryWorkflowRequest.java b/.gen/com/uber/cadence/entities/QueryWorkflowRequest.java new file mode 100644 index 000000000..239e30880 --- /dev/null +++ b/.gen/com/uber/cadence/entities/QueryWorkflowRequest.java @@ -0,0 +1,37 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class QueryWorkflowRequest { + private String domain; + private WorkflowExecution execution; + private WorkflowQuery query; + private QueryRejectCondition queryRejectCondition; + private QueryConsistencyLevel queryConsistencyLevel; +} diff --git a/.gen/com/uber/cadence/entities/QueryWorkflowResponse.java b/.gen/com/uber/cadence/entities/QueryWorkflowResponse.java new file mode 100644 index 000000000..6f58cc2ec --- /dev/null +++ b/.gen/com/uber/cadence/entities/QueryWorkflowResponse.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class QueryWorkflowResponse { + private byte[] queryResult; + private QueryRejected queryRejected; +} diff --git a/.gen/com/uber/cadence/entities/ReapplyEventsRequest.java b/.gen/com/uber/cadence/entities/ReapplyEventsRequest.java new file mode 100644 index 000000000..b9ad7c7e0 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ReapplyEventsRequest.java @@ -0,0 +1,35 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ReapplyEventsRequest { + private String domainName; + private WorkflowExecution workflowExecution; + private DataBlob events; +} diff --git a/.gen/com/uber/cadence/entities/RecordActivityTaskHeartbeatByIDRequest.java b/.gen/com/uber/cadence/entities/RecordActivityTaskHeartbeatByIDRequest.java new file mode 100644 index 000000000..aefb3eba0 --- /dev/null +++ b/.gen/com/uber/cadence/entities/RecordActivityTaskHeartbeatByIDRequest.java @@ -0,0 +1,38 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class RecordActivityTaskHeartbeatByIDRequest { + private String domain; + private String workflowID; + private String runID; + private String activityID; + private byte[] details; + private String identity; +} diff --git a/.gen/com/uber/cadence/entities/RecordActivityTaskHeartbeatRequest.java b/.gen/com/uber/cadence/entities/RecordActivityTaskHeartbeatRequest.java new file mode 100644 index 000000000..b5ca72f9b --- /dev/null +++ b/.gen/com/uber/cadence/entities/RecordActivityTaskHeartbeatRequest.java @@ -0,0 +1,35 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class RecordActivityTaskHeartbeatRequest { + private byte[] taskToken; + private byte[] details; + private String identity; +} diff --git a/.gen/com/uber/cadence/entities/RecordActivityTaskHeartbeatResponse.java b/.gen/com/uber/cadence/entities/RecordActivityTaskHeartbeatResponse.java new file mode 100644 index 000000000..d0db059b8 --- /dev/null +++ b/.gen/com/uber/cadence/entities/RecordActivityTaskHeartbeatResponse.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class RecordActivityTaskHeartbeatResponse { + private boolean cancelRequested; +} diff --git a/.gen/com/uber/cadence/entities/RecordMarkerDecisionAttributes.java b/.gen/com/uber/cadence/entities/RecordMarkerDecisionAttributes.java new file mode 100644 index 000000000..c98a9717d --- /dev/null +++ b/.gen/com/uber/cadence/entities/RecordMarkerDecisionAttributes.java @@ -0,0 +1,35 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class RecordMarkerDecisionAttributes { + private String markerName; + private byte[] details; + private Header header; +} diff --git a/.gen/com/uber/cadence/entities/RefreshWorkflowTasksRequest.java b/.gen/com/uber/cadence/entities/RefreshWorkflowTasksRequest.java new file mode 100644 index 000000000..160bf5824 --- /dev/null +++ b/.gen/com/uber/cadence/entities/RefreshWorkflowTasksRequest.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class RefreshWorkflowTasksRequest { + private String domain; + private WorkflowExecution execution; +} diff --git a/.gen/com/uber/cadence/entities/RegisterDomainRequest.java b/.gen/com/uber/cadence/entities/RegisterDomainRequest.java new file mode 100644 index 000000000..4580d24e5 --- /dev/null +++ b/.gen/com/uber/cadence/entities/RegisterDomainRequest.java @@ -0,0 +1,46 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class RegisterDomainRequest { + private String name; + private String description; + private String ownerEmail; + private int workflowExecutionRetentionPeriodInDays; + private boolean emitMetric; + private List clusters; + private String activeClusterName; + private Map data; + private String securityToken; + private boolean isGlobalDomain; + private ArchivalStatus historyArchivalStatus; + private String historyArchivalURI; + private ArchivalStatus visibilityArchivalStatus; + private String visibilityArchivalURI; +} diff --git a/.gen/com/uber/cadence/entities/RemoteSyncMatchedError.java b/.gen/com/uber/cadence/entities/RemoteSyncMatchedError.java new file mode 100644 index 000000000..146d50198 --- /dev/null +++ b/.gen/com/uber/cadence/entities/RemoteSyncMatchedError.java @@ -0,0 +1,46 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Getter +@Setter +@Accessors(chain = true) +public class RemoteSyncMatchedError extends BaseError { + + public RemoteSyncMatchedError() { + super(); + } + + public RemoteSyncMatchedError(String message, Throwable cause) { + super(message, cause); + } + + public RemoteSyncMatchedError(Throwable cause) { + super(cause); + } +} diff --git a/.gen/com/uber/cadence/entities/RemoveTaskRequest.java b/.gen/com/uber/cadence/entities/RemoveTaskRequest.java new file mode 100644 index 000000000..7464cf8ae --- /dev/null +++ b/.gen/com/uber/cadence/entities/RemoveTaskRequest.java @@ -0,0 +1,37 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class RemoveTaskRequest { + private int shardID; + private int type; + private long taskID; + private long visibilityTimestamp; + private String clusterName; +} diff --git a/.gen/com/uber/cadence/entities/RequestCancelActivityTaskDecisionAttributes.java b/.gen/com/uber/cadence/entities/RequestCancelActivityTaskDecisionAttributes.java new file mode 100644 index 000000000..434a94e31 --- /dev/null +++ b/.gen/com/uber/cadence/entities/RequestCancelActivityTaskDecisionAttributes.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class RequestCancelActivityTaskDecisionAttributes { + private String activityId; +} diff --git a/.gen/com/uber/cadence/entities/RequestCancelActivityTaskFailedEventAttributes.java b/.gen/com/uber/cadence/entities/RequestCancelActivityTaskFailedEventAttributes.java new file mode 100644 index 000000000..5ce2cc762 --- /dev/null +++ b/.gen/com/uber/cadence/entities/RequestCancelActivityTaskFailedEventAttributes.java @@ -0,0 +1,35 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class RequestCancelActivityTaskFailedEventAttributes { + private String activityId; + private String cause; + private long decisionTaskCompletedEventId; +} diff --git a/.gen/com/uber/cadence/entities/RequestCancelExternalWorkflowExecutionDecisionAttributes.java b/.gen/com/uber/cadence/entities/RequestCancelExternalWorkflowExecutionDecisionAttributes.java new file mode 100644 index 000000000..aabe737a6 --- /dev/null +++ b/.gen/com/uber/cadence/entities/RequestCancelExternalWorkflowExecutionDecisionAttributes.java @@ -0,0 +1,37 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class RequestCancelExternalWorkflowExecutionDecisionAttributes { + private String domain; + private String workflowId; + private String runId; + private byte[] control; + private boolean childWorkflowOnly; +} diff --git a/.gen/com/uber/cadence/entities/RequestCancelExternalWorkflowExecutionFailedEventAttributes.java b/.gen/com/uber/cadence/entities/RequestCancelExternalWorkflowExecutionFailedEventAttributes.java new file mode 100644 index 000000000..801705dd5 --- /dev/null +++ b/.gen/com/uber/cadence/entities/RequestCancelExternalWorkflowExecutionFailedEventAttributes.java @@ -0,0 +1,38 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class RequestCancelExternalWorkflowExecutionFailedEventAttributes { + private CancelExternalWorkflowExecutionFailedCause cause; + private long decisionTaskCompletedEventId; + private String domain; + private WorkflowExecution workflowExecution; + private long initiatedEventId; + private byte[] control; +} diff --git a/.gen/com/uber/cadence/entities/RequestCancelExternalWorkflowExecutionInitiatedEventAttributes.java b/.gen/com/uber/cadence/entities/RequestCancelExternalWorkflowExecutionInitiatedEventAttributes.java new file mode 100644 index 000000000..79c7503a6 --- /dev/null +++ b/.gen/com/uber/cadence/entities/RequestCancelExternalWorkflowExecutionInitiatedEventAttributes.java @@ -0,0 +1,37 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class RequestCancelExternalWorkflowExecutionInitiatedEventAttributes { + private long decisionTaskCompletedEventId; + private String domain; + private WorkflowExecution workflowExecution; + private byte[] control; + private boolean childWorkflowOnly; +} diff --git a/.gen/com/uber/cadence/entities/RequestCancelWorkflowExecutionRequest.java b/.gen/com/uber/cadence/entities/RequestCancelWorkflowExecutionRequest.java new file mode 100644 index 000000000..9dacbece6 --- /dev/null +++ b/.gen/com/uber/cadence/entities/RequestCancelWorkflowExecutionRequest.java @@ -0,0 +1,38 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class RequestCancelWorkflowExecutionRequest { + private String domain; + private WorkflowExecution workflowExecution; + private String identity; + private String requestId; + private String cause; + private String firstExecutionRunID; +} diff --git a/.gen/com/uber/cadence/entities/ResetPointInfo.java b/.gen/com/uber/cadence/entities/ResetPointInfo.java new file mode 100644 index 000000000..14b58f61e --- /dev/null +++ b/.gen/com/uber/cadence/entities/ResetPointInfo.java @@ -0,0 +1,38 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ResetPointInfo { + private String binaryChecksum; + private String runId; + private long firstDecisionCompletedId; + private long createdTimeNano; + private long expiringTimeNano; + private boolean resettable; +} diff --git a/.gen/com/uber/cadence/entities/ResetPoints.java b/.gen/com/uber/cadence/entities/ResetPoints.java new file mode 100644 index 000000000..27a1736fa --- /dev/null +++ b/.gen/com/uber/cadence/entities/ResetPoints.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ResetPoints { + private List points; +} diff --git a/.gen/com/uber/cadence/entities/ResetQueueRequest.java b/.gen/com/uber/cadence/entities/ResetQueueRequest.java new file mode 100644 index 000000000..68a362baf --- /dev/null +++ b/.gen/com/uber/cadence/entities/ResetQueueRequest.java @@ -0,0 +1,35 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ResetQueueRequest { + private int shardID; + private String clusterName; + private int type; +} diff --git a/.gen/com/uber/cadence/entities/ResetStickyTaskListRequest.java b/.gen/com/uber/cadence/entities/ResetStickyTaskListRequest.java new file mode 100644 index 000000000..a63fbe5e3 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ResetStickyTaskListRequest.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ResetStickyTaskListRequest { + private String domain; + private WorkflowExecution execution; +} diff --git a/.gen/com/uber/cadence/entities/ResetStickyTaskListResponse.java b/.gen/com/uber/cadence/entities/ResetStickyTaskListResponse.java new file mode 100644 index 000000000..63a5edc6b --- /dev/null +++ b/.gen/com/uber/cadence/entities/ResetStickyTaskListResponse.java @@ -0,0 +1,31 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ResetStickyTaskListResponse {} diff --git a/.gen/com/uber/cadence/entities/ResetWorkflowExecutionRequest.java b/.gen/com/uber/cadence/entities/ResetWorkflowExecutionRequest.java new file mode 100644 index 000000000..258bc5e73 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ResetWorkflowExecutionRequest.java @@ -0,0 +1,38 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ResetWorkflowExecutionRequest { + private String domain; + private WorkflowExecution workflowExecution; + private String reason; + private long decisionFinishEventId; + private String requestId; + private boolean skipSignalReapply; +} diff --git a/.gen/com/uber/cadence/entities/ResetWorkflowExecutionResponse.java b/.gen/com/uber/cadence/entities/ResetWorkflowExecutionResponse.java new file mode 100644 index 000000000..5b5a24235 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ResetWorkflowExecutionResponse.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ResetWorkflowExecutionResponse { + private String runId; +} diff --git a/.gen/com/uber/cadence/entities/RespondActivityTaskCanceledByIDRequest.java b/.gen/com/uber/cadence/entities/RespondActivityTaskCanceledByIDRequest.java new file mode 100644 index 000000000..339c8ba4e --- /dev/null +++ b/.gen/com/uber/cadence/entities/RespondActivityTaskCanceledByIDRequest.java @@ -0,0 +1,38 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class RespondActivityTaskCanceledByIDRequest { + private String domain; + private String workflowID; + private String runID; + private String activityID; + private byte[] details; + private String identity; +} diff --git a/.gen/com/uber/cadence/entities/RespondActivityTaskCanceledRequest.java b/.gen/com/uber/cadence/entities/RespondActivityTaskCanceledRequest.java new file mode 100644 index 000000000..7b55f28d3 --- /dev/null +++ b/.gen/com/uber/cadence/entities/RespondActivityTaskCanceledRequest.java @@ -0,0 +1,35 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class RespondActivityTaskCanceledRequest { + private byte[] taskToken; + private byte[] details; + private String identity; +} diff --git a/.gen/com/uber/cadence/entities/RespondActivityTaskCompletedByIDRequest.java b/.gen/com/uber/cadence/entities/RespondActivityTaskCompletedByIDRequest.java new file mode 100644 index 000000000..1fb26b920 --- /dev/null +++ b/.gen/com/uber/cadence/entities/RespondActivityTaskCompletedByIDRequest.java @@ -0,0 +1,38 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class RespondActivityTaskCompletedByIDRequest { + private String domain; + private String workflowID; + private String runID; + private String activityID; + private byte[] result; + private String identity; +} diff --git a/.gen/com/uber/cadence/entities/RespondActivityTaskCompletedRequest.java b/.gen/com/uber/cadence/entities/RespondActivityTaskCompletedRequest.java new file mode 100644 index 000000000..16f454d1e --- /dev/null +++ b/.gen/com/uber/cadence/entities/RespondActivityTaskCompletedRequest.java @@ -0,0 +1,35 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class RespondActivityTaskCompletedRequest { + private byte[] taskToken; + private byte[] result; + private String identity; +} diff --git a/.gen/com/uber/cadence/entities/RespondActivityTaskFailedByIDRequest.java b/.gen/com/uber/cadence/entities/RespondActivityTaskFailedByIDRequest.java new file mode 100644 index 000000000..8a336845d --- /dev/null +++ b/.gen/com/uber/cadence/entities/RespondActivityTaskFailedByIDRequest.java @@ -0,0 +1,39 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class RespondActivityTaskFailedByIDRequest { + private String domain; + private String workflowID; + private String runID; + private String activityID; + private String reason; + private byte[] details; + private String identity; +} diff --git a/.gen/com/uber/cadence/entities/RespondActivityTaskFailedRequest.java b/.gen/com/uber/cadence/entities/RespondActivityTaskFailedRequest.java new file mode 100644 index 000000000..5cbe4019c --- /dev/null +++ b/.gen/com/uber/cadence/entities/RespondActivityTaskFailedRequest.java @@ -0,0 +1,36 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class RespondActivityTaskFailedRequest { + private byte[] taskToken; + private String reason; + private byte[] details; + private String identity; +} diff --git a/.gen/com/uber/cadence/entities/RespondCrossClusterTasksCompletedRequest.java b/.gen/com/uber/cadence/entities/RespondCrossClusterTasksCompletedRequest.java new file mode 100644 index 000000000..8f12aef2b --- /dev/null +++ b/.gen/com/uber/cadence/entities/RespondCrossClusterTasksCompletedRequest.java @@ -0,0 +1,36 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class RespondCrossClusterTasksCompletedRequest { + private int shardID; + private String targetCluster; + private List taskResponses; + private boolean fetchNewTasks; +} diff --git a/.gen/com/uber/cadence/entities/RespondCrossClusterTasksCompletedResponse.java b/.gen/com/uber/cadence/entities/RespondCrossClusterTasksCompletedResponse.java new file mode 100644 index 000000000..5c05023bd --- /dev/null +++ b/.gen/com/uber/cadence/entities/RespondCrossClusterTasksCompletedResponse.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class RespondCrossClusterTasksCompletedResponse { + private List tasks; +} diff --git a/.gen/com/uber/cadence/entities/RespondDecisionTaskCompletedRequest.java b/.gen/com/uber/cadence/entities/RespondDecisionTaskCompletedRequest.java new file mode 100644 index 000000000..1b86d63f5 --- /dev/null +++ b/.gen/com/uber/cadence/entities/RespondDecisionTaskCompletedRequest.java @@ -0,0 +1,41 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class RespondDecisionTaskCompletedRequest { + private byte[] taskToken; + private List decisions; + private byte[] executionContext; + private String identity; + private StickyExecutionAttributes stickyAttributes; + private boolean returnNewDecisionTask; + private boolean forceCreateNewDecisionTask; + private String binaryChecksum; + private Map queryResults; +} diff --git a/.gen/com/uber/cadence/entities/RespondDecisionTaskCompletedResponse.java b/.gen/com/uber/cadence/entities/RespondDecisionTaskCompletedResponse.java new file mode 100644 index 000000000..a1173aa3f --- /dev/null +++ b/.gen/com/uber/cadence/entities/RespondDecisionTaskCompletedResponse.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class RespondDecisionTaskCompletedResponse { + private PollForDecisionTaskResponse decisionTask; + private Map activitiesToDispatchLocally; +} diff --git a/.gen/com/uber/cadence/entities/RespondDecisionTaskFailedRequest.java b/.gen/com/uber/cadence/entities/RespondDecisionTaskFailedRequest.java new file mode 100644 index 000000000..ec85b1cd5 --- /dev/null +++ b/.gen/com/uber/cadence/entities/RespondDecisionTaskFailedRequest.java @@ -0,0 +1,37 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class RespondDecisionTaskFailedRequest { + private byte[] taskToken; + private DecisionTaskFailedCause cause; + private byte[] details; + private String identity; + private String binaryChecksum; +} diff --git a/.gen/com/uber/cadence/entities/RespondQueryTaskCompletedRequest.java b/.gen/com/uber/cadence/entities/RespondQueryTaskCompletedRequest.java new file mode 100644 index 000000000..9807b2689 --- /dev/null +++ b/.gen/com/uber/cadence/entities/RespondQueryTaskCompletedRequest.java @@ -0,0 +1,37 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class RespondQueryTaskCompletedRequest { + private byte[] taskToken; + private QueryTaskCompletedType completedType; + private byte[] queryResult; + private String errorMessage; + private WorkerVersionInfo workerVersionInfo; +} diff --git a/.gen/com/uber/cadence/entities/RestartWorkflowExecutionRequest.java b/.gen/com/uber/cadence/entities/RestartWorkflowExecutionRequest.java new file mode 100644 index 000000000..5ef3a3f15 --- /dev/null +++ b/.gen/com/uber/cadence/entities/RestartWorkflowExecutionRequest.java @@ -0,0 +1,36 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class RestartWorkflowExecutionRequest { + private String domain; + private WorkflowExecution workflowExecution; + private String reason; + private String identity; +} diff --git a/.gen/com/uber/cadence/entities/RestartWorkflowExecutionResponse.java b/.gen/com/uber/cadence/entities/RestartWorkflowExecutionResponse.java new file mode 100644 index 000000000..1ce6fa5db --- /dev/null +++ b/.gen/com/uber/cadence/entities/RestartWorkflowExecutionResponse.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class RestartWorkflowExecutionResponse { + private String runId; +} diff --git a/.gen/com/uber/cadence/entities/RetryPolicy.java b/.gen/com/uber/cadence/entities/RetryPolicy.java new file mode 100644 index 000000000..bfba5bb81 --- /dev/null +++ b/.gen/com/uber/cadence/entities/RetryPolicy.java @@ -0,0 +1,38 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class RetryPolicy { + private int initialIntervalInSeconds; + private double backoffCoefficient; + private int maximumIntervalInSeconds; + private int maximumAttempts; + private List nonRetriableErrorReasons; + private int expirationIntervalInSeconds; +} diff --git a/.gen/com/uber/cadence/entities/RetryTaskV2Error.java b/.gen/com/uber/cadence/entities/RetryTaskV2Error.java new file mode 100644 index 000000000..7d3a02797 --- /dev/null +++ b/.gen/com/uber/cadence/entities/RetryTaskV2Error.java @@ -0,0 +1,55 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Getter +@Setter +@Accessors(chain = true) +@AllArgsConstructor +public class RetryTaskV2Error extends BaseError { + private String domainId; + private String workflowId; + private String runId; + private long startEventId; + private long startEventVersion; + private long endEventId; + private long endEventVersion; + + public RetryTaskV2Error() { + super(); + } + + public RetryTaskV2Error(String message, Throwable cause) { + super(message, cause); + } + + public RetryTaskV2Error(Throwable cause) { + super(cause); + } +} diff --git a/.gen/com/uber/cadence/entities/ScheduleActivityTaskDecisionAttributes.java b/.gen/com/uber/cadence/entities/ScheduleActivityTaskDecisionAttributes.java new file mode 100644 index 000000000..82791a034 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ScheduleActivityTaskDecisionAttributes.java @@ -0,0 +1,44 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class ScheduleActivityTaskDecisionAttributes { + private String activityId; + private ActivityType activityType; + private String domain; + private TaskList taskList; + private byte[] input; + private int scheduleToCloseTimeoutSeconds; + private int scheduleToStartTimeoutSeconds; + private int startToCloseTimeoutSeconds; + private int heartbeatTimeoutSeconds; + private RetryPolicy retryPolicy; + private Header header; + private boolean requestLocalDispatch; +} diff --git a/.gen/com/uber/cadence/entities/SearchAttributes.java b/.gen/com/uber/cadence/entities/SearchAttributes.java new file mode 100644 index 000000000..ab1d99134 --- /dev/null +++ b/.gen/com/uber/cadence/entities/SearchAttributes.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class SearchAttributes { + private Map indexedFields; +} diff --git a/.gen/com/uber/cadence/entities/ServiceBusyError.java b/.gen/com/uber/cadence/entities/ServiceBusyError.java new file mode 100644 index 000000000..e0a8ec430 --- /dev/null +++ b/.gen/com/uber/cadence/entities/ServiceBusyError.java @@ -0,0 +1,49 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Getter +@Setter +@Accessors(chain = true) +@AllArgsConstructor +public class ServiceBusyError extends BaseError { + private String reason; + + public ServiceBusyError() { + super(); + } + + public ServiceBusyError(String message, Throwable cause) { + super(message, cause); + } + + public ServiceBusyError(Throwable cause) { + super(cause); + } +} diff --git a/.gen/com/uber/cadence/entities/SignalExternalWorkflowExecutionDecisionAttributes.java b/.gen/com/uber/cadence/entities/SignalExternalWorkflowExecutionDecisionAttributes.java new file mode 100644 index 000000000..82634d69b --- /dev/null +++ b/.gen/com/uber/cadence/entities/SignalExternalWorkflowExecutionDecisionAttributes.java @@ -0,0 +1,38 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class SignalExternalWorkflowExecutionDecisionAttributes { + private String domain; + private WorkflowExecution execution; + private String signalName; + private byte[] input; + private byte[] control; + private boolean childWorkflowOnly; +} diff --git a/.gen/com/uber/cadence/entities/SignalExternalWorkflowExecutionFailedCause.java b/.gen/com/uber/cadence/entities/SignalExternalWorkflowExecutionFailedCause.java new file mode 100644 index 000000000..c395343f8 --- /dev/null +++ b/.gen/com/uber/cadence/entities/SignalExternalWorkflowExecutionFailedCause.java @@ -0,0 +1,28 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum SignalExternalWorkflowExecutionFailedCause { + UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION, + WORKFLOW_ALREADY_COMPLETED, +} diff --git a/.gen/com/uber/cadence/entities/SignalExternalWorkflowExecutionFailedEventAttributes.java b/.gen/com/uber/cadence/entities/SignalExternalWorkflowExecutionFailedEventAttributes.java new file mode 100644 index 000000000..c20eecef8 --- /dev/null +++ b/.gen/com/uber/cadence/entities/SignalExternalWorkflowExecutionFailedEventAttributes.java @@ -0,0 +1,38 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class SignalExternalWorkflowExecutionFailedEventAttributes { + private SignalExternalWorkflowExecutionFailedCause cause; + private long decisionTaskCompletedEventId; + private String domain; + private WorkflowExecution workflowExecution; + private long initiatedEventId; + private byte[] control; +} diff --git a/.gen/com/uber/cadence/entities/SignalExternalWorkflowExecutionInitiatedEventAttributes.java b/.gen/com/uber/cadence/entities/SignalExternalWorkflowExecutionInitiatedEventAttributes.java new file mode 100644 index 000000000..651c234b4 --- /dev/null +++ b/.gen/com/uber/cadence/entities/SignalExternalWorkflowExecutionInitiatedEventAttributes.java @@ -0,0 +1,39 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class SignalExternalWorkflowExecutionInitiatedEventAttributes { + private long decisionTaskCompletedEventId; + private String domain; + private WorkflowExecution workflowExecution; + private String signalName; + private byte[] input; + private byte[] control; + private boolean childWorkflowOnly; +} diff --git a/.gen/com/uber/cadence/entities/SignalWithStartWorkflowExecutionAsyncRequest.java b/.gen/com/uber/cadence/entities/SignalWithStartWorkflowExecutionAsyncRequest.java new file mode 100644 index 000000000..08e1b45d2 --- /dev/null +++ b/.gen/com/uber/cadence/entities/SignalWithStartWorkflowExecutionAsyncRequest.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class SignalWithStartWorkflowExecutionAsyncRequest { + private SignalWithStartWorkflowExecutionRequest request; +} diff --git a/.gen/com/uber/cadence/entities/SignalWithStartWorkflowExecutionAsyncResponse.java b/.gen/com/uber/cadence/entities/SignalWithStartWorkflowExecutionAsyncResponse.java new file mode 100644 index 000000000..15a9eda90 --- /dev/null +++ b/.gen/com/uber/cadence/entities/SignalWithStartWorkflowExecutionAsyncResponse.java @@ -0,0 +1,31 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class SignalWithStartWorkflowExecutionAsyncResponse {} diff --git a/.gen/com/uber/cadence/entities/SignalWithStartWorkflowExecutionRequest.java b/.gen/com/uber/cadence/entities/SignalWithStartWorkflowExecutionRequest.java new file mode 100644 index 000000000..70f5f413a --- /dev/null +++ b/.gen/com/uber/cadence/entities/SignalWithStartWorkflowExecutionRequest.java @@ -0,0 +1,52 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class SignalWithStartWorkflowExecutionRequest { + private String domain; + private String workflowId; + private WorkflowType workflowType; + private TaskList taskList; + private byte[] input; + private int executionStartToCloseTimeoutSeconds; + private int taskStartToCloseTimeoutSeconds; + private String identity; + private String requestId; + private WorkflowIdReusePolicy workflowIdReusePolicy; + private String signalName; + private byte[] signalInput; + private byte[] control; + private RetryPolicy retryPolicy; + private String cronSchedule; + private Memo memo; + private SearchAttributes searchAttributes; + private Header header; + private int delayStartSeconds; + private int jitterStartSeconds; +} diff --git a/.gen/com/uber/cadence/entities/SignalWorkflowExecutionRequest.java b/.gen/com/uber/cadence/entities/SignalWorkflowExecutionRequest.java new file mode 100644 index 000000000..574ff04f7 --- /dev/null +++ b/.gen/com/uber/cadence/entities/SignalWorkflowExecutionRequest.java @@ -0,0 +1,39 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class SignalWorkflowExecutionRequest { + private String domain; + private WorkflowExecution workflowExecution; + private String signalName; + private byte[] input; + private String identity; + private String requestId; + private byte[] control; +} diff --git a/.gen/com/uber/cadence/entities/StartChildWorkflowExecutionDecisionAttributes.java b/.gen/com/uber/cadence/entities/StartChildWorkflowExecutionDecisionAttributes.java new file mode 100644 index 000000000..c620aa74c --- /dev/null +++ b/.gen/com/uber/cadence/entities/StartChildWorkflowExecutionDecisionAttributes.java @@ -0,0 +1,47 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class StartChildWorkflowExecutionDecisionAttributes { + private String domain; + private String workflowId; + private WorkflowType workflowType; + private TaskList taskList; + private byte[] input; + private int executionStartToCloseTimeoutSeconds; + private int taskStartToCloseTimeoutSeconds; + private ParentClosePolicy parentClosePolicy; + private byte[] control; + private WorkflowIdReusePolicy workflowIdReusePolicy; + private RetryPolicy retryPolicy; + private String cronSchedule; + private Header header; + private Memo memo; + private SearchAttributes searchAttributes; +} diff --git a/.gen/com/uber/cadence/entities/StartChildWorkflowExecutionFailedEventAttributes.java b/.gen/com/uber/cadence/entities/StartChildWorkflowExecutionFailedEventAttributes.java new file mode 100644 index 000000000..0b9d9c550 --- /dev/null +++ b/.gen/com/uber/cadence/entities/StartChildWorkflowExecutionFailedEventAttributes.java @@ -0,0 +1,39 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class StartChildWorkflowExecutionFailedEventAttributes { + private String domain; + private String workflowId; + private WorkflowType workflowType; + private ChildWorkflowExecutionFailedCause cause; + private byte[] control; + private long initiatedEventId; + private long decisionTaskCompletedEventId; +} diff --git a/.gen/com/uber/cadence/entities/StartChildWorkflowExecutionInitiatedEventAttributes.java b/.gen/com/uber/cadence/entities/StartChildWorkflowExecutionInitiatedEventAttributes.java new file mode 100644 index 000000000..145306b09 --- /dev/null +++ b/.gen/com/uber/cadence/entities/StartChildWorkflowExecutionInitiatedEventAttributes.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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class StartChildWorkflowExecutionInitiatedEventAttributes { + private String domain; + private String workflowId; + private WorkflowType workflowType; + private TaskList taskList; + private byte[] input; + private int executionStartToCloseTimeoutSeconds; + private int taskStartToCloseTimeoutSeconds; + private ParentClosePolicy parentClosePolicy; + private byte[] control; + private long decisionTaskCompletedEventId; + private WorkflowIdReusePolicy workflowIdReusePolicy; + private RetryPolicy retryPolicy; + private String cronSchedule; + private Header header; + private Memo memo; + private SearchAttributes searchAttributes; + private int delayStartSeconds; + private int jitterStartSeconds; +} diff --git a/.gen/com/uber/cadence/entities/StartTimeFilter.java b/.gen/com/uber/cadence/entities/StartTimeFilter.java new file mode 100644 index 000000000..858a2437a --- /dev/null +++ b/.gen/com/uber/cadence/entities/StartTimeFilter.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class StartTimeFilter { + private long earliestTime; + private long latestTime; +} diff --git a/.gen/com/uber/cadence/entities/StartTimerDecisionAttributes.java b/.gen/com/uber/cadence/entities/StartTimerDecisionAttributes.java new file mode 100644 index 000000000..b807d6154 --- /dev/null +++ b/.gen/com/uber/cadence/entities/StartTimerDecisionAttributes.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class StartTimerDecisionAttributes { + private String timerId; + private long startToFireTimeoutSeconds; +} diff --git a/.gen/com/uber/cadence/entities/StartWorkflowExecutionAsyncRequest.java b/.gen/com/uber/cadence/entities/StartWorkflowExecutionAsyncRequest.java new file mode 100644 index 000000000..4acda2abe --- /dev/null +++ b/.gen/com/uber/cadence/entities/StartWorkflowExecutionAsyncRequest.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class StartWorkflowExecutionAsyncRequest { + private StartWorkflowExecutionRequest request; +} diff --git a/.gen/com/uber/cadence/entities/StartWorkflowExecutionAsyncResponse.java b/.gen/com/uber/cadence/entities/StartWorkflowExecutionAsyncResponse.java new file mode 100644 index 000000000..8eefe3042 --- /dev/null +++ b/.gen/com/uber/cadence/entities/StartWorkflowExecutionAsyncResponse.java @@ -0,0 +1,31 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class StartWorkflowExecutionAsyncResponse {} diff --git a/.gen/com/uber/cadence/entities/StartWorkflowExecutionRequest.java b/.gen/com/uber/cadence/entities/StartWorkflowExecutionRequest.java new file mode 100644 index 000000000..1a77b0d6c --- /dev/null +++ b/.gen/com/uber/cadence/entities/StartWorkflowExecutionRequest.java @@ -0,0 +1,49 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class StartWorkflowExecutionRequest { + private String domain; + private String workflowId; + private WorkflowType workflowType; + private TaskList taskList; + private byte[] input; + private int executionStartToCloseTimeoutSeconds; + private int taskStartToCloseTimeoutSeconds; + private String identity; + private String requestId; + private WorkflowIdReusePolicy workflowIdReusePolicy; + private RetryPolicy retryPolicy; + private String cronSchedule; + private Memo memo; + private SearchAttributes searchAttributes; + private Header header; + private int delayStartSeconds; + private int jitterStartSeconds; +} diff --git a/.gen/com/uber/cadence/entities/StartWorkflowExecutionResponse.java b/.gen/com/uber/cadence/entities/StartWorkflowExecutionResponse.java new file mode 100644 index 000000000..01d47cfd7 --- /dev/null +++ b/.gen/com/uber/cadence/entities/StartWorkflowExecutionResponse.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class StartWorkflowExecutionResponse { + private String runId; +} diff --git a/.gen/com/uber/cadence/entities/StickyExecutionAttributes.java b/.gen/com/uber/cadence/entities/StickyExecutionAttributes.java new file mode 100644 index 000000000..a8c1241d5 --- /dev/null +++ b/.gen/com/uber/cadence/entities/StickyExecutionAttributes.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class StickyExecutionAttributes { + private TaskList workerTaskList; + private int scheduleToStartTimeoutSeconds; +} diff --git a/.gen/com/uber/cadence/entities/StickyWorkerUnavailableError.java b/.gen/com/uber/cadence/entities/StickyWorkerUnavailableError.java new file mode 100644 index 000000000..9c711ca51 --- /dev/null +++ b/.gen/com/uber/cadence/entities/StickyWorkerUnavailableError.java @@ -0,0 +1,46 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Getter +@Setter +@Accessors(chain = true) +public class StickyWorkerUnavailableError extends BaseError { + + public StickyWorkerUnavailableError() { + super(); + } + + public StickyWorkerUnavailableError(String message, Throwable cause) { + super(message, cause); + } + + public StickyWorkerUnavailableError(Throwable cause) { + super(cause); + } +} diff --git a/.gen/com/uber/cadence/entities/SupportedClientVersions.java b/.gen/com/uber/cadence/entities/SupportedClientVersions.java new file mode 100644 index 000000000..f6f093be3 --- /dev/null +++ b/.gen/com/uber/cadence/entities/SupportedClientVersions.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class SupportedClientVersions { + private String goSdk; + private String javaSdk; +} diff --git a/.gen/com/uber/cadence/entities/TaskIDBlock.java b/.gen/com/uber/cadence/entities/TaskIDBlock.java new file mode 100644 index 000000000..7d2028c17 --- /dev/null +++ b/.gen/com/uber/cadence/entities/TaskIDBlock.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class TaskIDBlock { + private long startID; + private long endID; +} diff --git a/.gen/com/uber/cadence/entities/TaskList.java b/.gen/com/uber/cadence/entities/TaskList.java new file mode 100644 index 000000000..af1c5ae0e --- /dev/null +++ b/.gen/com/uber/cadence/entities/TaskList.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class TaskList { + private String name; + private TaskListKind kind; +} diff --git a/.gen/com/uber/cadence/entities/TaskListKind.java b/.gen/com/uber/cadence/entities/TaskListKind.java new file mode 100644 index 000000000..16384c325 --- /dev/null +++ b/.gen/com/uber/cadence/entities/TaskListKind.java @@ -0,0 +1,28 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum TaskListKind { + NORMAL, + STICKY, +} diff --git a/.gen/com/uber/cadence/entities/TaskListMetadata.java b/.gen/com/uber/cadence/entities/TaskListMetadata.java new file mode 100644 index 000000000..5bfa6a091 --- /dev/null +++ b/.gen/com/uber/cadence/entities/TaskListMetadata.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class TaskListMetadata { + private double maxTasksPerSecond; +} diff --git a/.gen/com/uber/cadence/entities/TaskListPartitionMetadata.java b/.gen/com/uber/cadence/entities/TaskListPartitionMetadata.java new file mode 100644 index 000000000..f20905ed3 --- /dev/null +++ b/.gen/com/uber/cadence/entities/TaskListPartitionMetadata.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class TaskListPartitionMetadata { + private String key; + private String ownerHostName; +} diff --git a/.gen/com/uber/cadence/entities/TaskListStatus.java b/.gen/com/uber/cadence/entities/TaskListStatus.java new file mode 100644 index 000000000..62526f570 --- /dev/null +++ b/.gen/com/uber/cadence/entities/TaskListStatus.java @@ -0,0 +1,37 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class TaskListStatus { + private long backlogCountHint; + private long readLevel; + private long ackLevel; + private double ratePerSecond; + private TaskIDBlock taskIDBlock; +} diff --git a/.gen/com/uber/cadence/entities/TaskListType.java b/.gen/com/uber/cadence/entities/TaskListType.java new file mode 100644 index 000000000..334a8dc47 --- /dev/null +++ b/.gen/com/uber/cadence/entities/TaskListType.java @@ -0,0 +1,28 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum TaskListType { + Decision, + Activity, +} diff --git a/.gen/com/uber/cadence/entities/TerminateWorkflowExecutionRequest.java b/.gen/com/uber/cadence/entities/TerminateWorkflowExecutionRequest.java new file mode 100644 index 000000000..b81aa015b --- /dev/null +++ b/.gen/com/uber/cadence/entities/TerminateWorkflowExecutionRequest.java @@ -0,0 +1,38 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class TerminateWorkflowExecutionRequest { + private String domain; + private WorkflowExecution workflowExecution; + private String reason; + private byte[] details; + private String identity; + private String firstExecutionRunID; +} diff --git a/.gen/com/uber/cadence/entities/TimeoutType.java b/.gen/com/uber/cadence/entities/TimeoutType.java new file mode 100644 index 000000000..7957a665a --- /dev/null +++ b/.gen/com/uber/cadence/entities/TimeoutType.java @@ -0,0 +1,30 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum TimeoutType { + START_TO_CLOSE, + SCHEDULE_TO_START, + SCHEDULE_TO_CLOSE, + HEARTBEAT, +} diff --git a/.gen/com/uber/cadence/entities/TimerCanceledEventAttributes.java b/.gen/com/uber/cadence/entities/TimerCanceledEventAttributes.java new file mode 100644 index 000000000..11792af39 --- /dev/null +++ b/.gen/com/uber/cadence/entities/TimerCanceledEventAttributes.java @@ -0,0 +1,36 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class TimerCanceledEventAttributes { + private String timerId; + private long startedEventId; + private long decisionTaskCompletedEventId; + private String identity; +} diff --git a/.gen/com/uber/cadence/entities/TimerFiredEventAttributes.java b/.gen/com/uber/cadence/entities/TimerFiredEventAttributes.java new file mode 100644 index 000000000..87b2161e1 --- /dev/null +++ b/.gen/com/uber/cadence/entities/TimerFiredEventAttributes.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class TimerFiredEventAttributes { + private String timerId; + private long startedEventId; +} diff --git a/.gen/com/uber/cadence/entities/TimerStartedEventAttributes.java b/.gen/com/uber/cadence/entities/TimerStartedEventAttributes.java new file mode 100644 index 000000000..d1333ec1d --- /dev/null +++ b/.gen/com/uber/cadence/entities/TimerStartedEventAttributes.java @@ -0,0 +1,35 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class TimerStartedEventAttributes { + private String timerId; + private long startToFireTimeoutSeconds; + private long decisionTaskCompletedEventId; +} diff --git a/.gen/com/uber/cadence/entities/TransientDecisionInfo.java b/.gen/com/uber/cadence/entities/TransientDecisionInfo.java new file mode 100644 index 000000000..e4eccd11b --- /dev/null +++ b/.gen/com/uber/cadence/entities/TransientDecisionInfo.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class TransientDecisionInfo { + private HistoryEvent scheduledEvent; + private HistoryEvent startedEvent; +} diff --git a/.gen/com/uber/cadence/entities/UpdateDomainInfo.java b/.gen/com/uber/cadence/entities/UpdateDomainInfo.java new file mode 100644 index 000000000..7a4757688 --- /dev/null +++ b/.gen/com/uber/cadence/entities/UpdateDomainInfo.java @@ -0,0 +1,35 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class UpdateDomainInfo { + private String description; + private String ownerEmail; + private Map data; +} diff --git a/.gen/com/uber/cadence/entities/UpdateDomainRequest.java b/.gen/com/uber/cadence/entities/UpdateDomainRequest.java new file mode 100644 index 000000000..fc7a26804 --- /dev/null +++ b/.gen/com/uber/cadence/entities/UpdateDomainRequest.java @@ -0,0 +1,39 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class UpdateDomainRequest { + private String name; + private UpdateDomainInfo updatedInfo; + private DomainConfiguration configuration; + private DomainReplicationConfiguration replicationConfiguration; + private String securityToken; + private String deleteBadBinary; + private int failoverTimeoutInSeconds; +} diff --git a/.gen/com/uber/cadence/entities/UpdateDomainResponse.java b/.gen/com/uber/cadence/entities/UpdateDomainResponse.java new file mode 100644 index 000000000..a8c386bfc --- /dev/null +++ b/.gen/com/uber/cadence/entities/UpdateDomainResponse.java @@ -0,0 +1,37 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class UpdateDomainResponse { + private DomainInfo domainInfo; + private DomainConfiguration configuration; + private DomainReplicationConfiguration replicationConfiguration; + private long failoverVersion; + private boolean isGlobalDomain; +} diff --git a/.gen/com/uber/cadence/entities/UpsertWorkflowSearchAttributesDecisionAttributes.java b/.gen/com/uber/cadence/entities/UpsertWorkflowSearchAttributesDecisionAttributes.java new file mode 100644 index 000000000..cb9af76e0 --- /dev/null +++ b/.gen/com/uber/cadence/entities/UpsertWorkflowSearchAttributesDecisionAttributes.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class UpsertWorkflowSearchAttributesDecisionAttributes { + private SearchAttributes searchAttributes; +} diff --git a/.gen/com/uber/cadence/entities/UpsertWorkflowSearchAttributesEventAttributes.java b/.gen/com/uber/cadence/entities/UpsertWorkflowSearchAttributesEventAttributes.java new file mode 100644 index 000000000..3ed2b3b96 --- /dev/null +++ b/.gen/com/uber/cadence/entities/UpsertWorkflowSearchAttributesEventAttributes.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class UpsertWorkflowSearchAttributesEventAttributes { + private long decisionTaskCompletedEventId; + private SearchAttributes searchAttributes; +} diff --git a/.gen/com/uber/cadence/entities/VersionHistories.java b/.gen/com/uber/cadence/entities/VersionHistories.java new file mode 100644 index 000000000..0cf8a7ff3 --- /dev/null +++ b/.gen/com/uber/cadence/entities/VersionHistories.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class VersionHistories { + private int currentVersionHistoryIndex; + private List histories; +} diff --git a/.gen/com/uber/cadence/entities/VersionHistory.java b/.gen/com/uber/cadence/entities/VersionHistory.java new file mode 100644 index 000000000..0c9c2ac73 --- /dev/null +++ b/.gen/com/uber/cadence/entities/VersionHistory.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class VersionHistory { + private byte[] branchToken; + private List items; +} diff --git a/.gen/com/uber/cadence/entities/VersionHistoryItem.java b/.gen/com/uber/cadence/entities/VersionHistoryItem.java new file mode 100644 index 000000000..ffb21a86c --- /dev/null +++ b/.gen/com/uber/cadence/entities/VersionHistoryItem.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class VersionHistoryItem { + private long eventID; + private long version; +} diff --git a/.gen/com/uber/cadence/entities/WorkerVersionInfo.java b/.gen/com/uber/cadence/entities/WorkerVersionInfo.java new file mode 100644 index 000000000..6038ee4e7 --- /dev/null +++ b/.gen/com/uber/cadence/entities/WorkerVersionInfo.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class WorkerVersionInfo { + private String impl; + private String featureVersion; +} diff --git a/.gen/com/uber/cadence/entities/WorkflowExecution.java b/.gen/com/uber/cadence/entities/WorkflowExecution.java new file mode 100644 index 000000000..bece219e9 --- /dev/null +++ b/.gen/com/uber/cadence/entities/WorkflowExecution.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class WorkflowExecution { + private String workflowId; + private String runId; +} diff --git a/.gen/com/uber/cadence/entities/WorkflowExecutionAlreadyCompletedError.java b/.gen/com/uber/cadence/entities/WorkflowExecutionAlreadyCompletedError.java new file mode 100644 index 000000000..e3246ccf3 --- /dev/null +++ b/.gen/com/uber/cadence/entities/WorkflowExecutionAlreadyCompletedError.java @@ -0,0 +1,46 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Getter +@Setter +@Accessors(chain = true) +public class WorkflowExecutionAlreadyCompletedError extends BaseError { + + public WorkflowExecutionAlreadyCompletedError() { + super(); + } + + public WorkflowExecutionAlreadyCompletedError(String message, Throwable cause) { + super(message, cause); + } + + public WorkflowExecutionAlreadyCompletedError(Throwable cause) { + super(cause); + } +} diff --git a/.gen/com/uber/cadence/entities/WorkflowExecutionAlreadyStartedError.java b/.gen/com/uber/cadence/entities/WorkflowExecutionAlreadyStartedError.java new file mode 100644 index 000000000..ce4b4e3d2 --- /dev/null +++ b/.gen/com/uber/cadence/entities/WorkflowExecutionAlreadyStartedError.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.entities; + +import java.util.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Getter +@Setter +@Accessors(chain = true) +@AllArgsConstructor +public class WorkflowExecutionAlreadyStartedError extends BaseError { + private String startRequestId; + private String runId; + + public WorkflowExecutionAlreadyStartedError() { + super(); + } + + public WorkflowExecutionAlreadyStartedError(String message, Throwable cause) { + super(message, cause); + } + + public WorkflowExecutionAlreadyStartedError(Throwable cause) { + super(cause); + } +} diff --git a/.gen/com/uber/cadence/entities/WorkflowExecutionCancelRequestedEventAttributes.java b/.gen/com/uber/cadence/entities/WorkflowExecutionCancelRequestedEventAttributes.java new file mode 100644 index 000000000..0829d892f --- /dev/null +++ b/.gen/com/uber/cadence/entities/WorkflowExecutionCancelRequestedEventAttributes.java @@ -0,0 +1,37 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class WorkflowExecutionCancelRequestedEventAttributes { + private String cause; + private long externalInitiatedEventId; + private WorkflowExecution externalWorkflowExecution; + private String identity; + private String requestId; +} diff --git a/.gen/com/uber/cadence/entities/WorkflowExecutionCanceledEventAttributes.java b/.gen/com/uber/cadence/entities/WorkflowExecutionCanceledEventAttributes.java new file mode 100644 index 000000000..f267e02a1 --- /dev/null +++ b/.gen/com/uber/cadence/entities/WorkflowExecutionCanceledEventAttributes.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class WorkflowExecutionCanceledEventAttributes { + private long decisionTaskCompletedEventId; + private byte[] details; +} diff --git a/.gen/com/uber/cadence/entities/WorkflowExecutionCloseStatus.java b/.gen/com/uber/cadence/entities/WorkflowExecutionCloseStatus.java new file mode 100644 index 000000000..1fc84415e --- /dev/null +++ b/.gen/com/uber/cadence/entities/WorkflowExecutionCloseStatus.java @@ -0,0 +1,32 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum WorkflowExecutionCloseStatus { + COMPLETED, + FAILED, + CANCELED, + TERMINATED, + CONTINUED_AS_NEW, + TIMED_OUT, +} diff --git a/.gen/com/uber/cadence/entities/WorkflowExecutionCompletedEventAttributes.java b/.gen/com/uber/cadence/entities/WorkflowExecutionCompletedEventAttributes.java new file mode 100644 index 000000000..9b00e5a67 --- /dev/null +++ b/.gen/com/uber/cadence/entities/WorkflowExecutionCompletedEventAttributes.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class WorkflowExecutionCompletedEventAttributes { + private byte[] result; + private long decisionTaskCompletedEventId; +} diff --git a/.gen/com/uber/cadence/entities/WorkflowExecutionConfiguration.java b/.gen/com/uber/cadence/entities/WorkflowExecutionConfiguration.java new file mode 100644 index 000000000..8fbf37fe0 --- /dev/null +++ b/.gen/com/uber/cadence/entities/WorkflowExecutionConfiguration.java @@ -0,0 +1,35 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class WorkflowExecutionConfiguration { + private TaskList taskList; + private int executionStartToCloseTimeoutSeconds; + private int taskStartToCloseTimeoutSeconds; +} diff --git a/.gen/com/uber/cadence/entities/WorkflowExecutionContinuedAsNewEventAttributes.java b/.gen/com/uber/cadence/entities/WorkflowExecutionContinuedAsNewEventAttributes.java new file mode 100644 index 000000000..8c5befd1c --- /dev/null +++ b/.gen/com/uber/cadence/entities/WorkflowExecutionContinuedAsNewEventAttributes.java @@ -0,0 +1,47 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class WorkflowExecutionContinuedAsNewEventAttributes { + private String newExecutionRunId; + private WorkflowType workflowType; + private TaskList taskList; + private byte[] input; + private int executionStartToCloseTimeoutSeconds; + private int taskStartToCloseTimeoutSeconds; + private long decisionTaskCompletedEventId; + private int backoffStartIntervalInSeconds; + private ContinueAsNewInitiator initiator; + private String failureReason; + private byte[] failureDetails; + private byte[] lastCompletionResult; + private Header header; + private Memo memo; + private SearchAttributes searchAttributes; +} diff --git a/.gen/com/uber/cadence/entities/WorkflowExecutionFailedEventAttributes.java b/.gen/com/uber/cadence/entities/WorkflowExecutionFailedEventAttributes.java new file mode 100644 index 000000000..b54988a38 --- /dev/null +++ b/.gen/com/uber/cadence/entities/WorkflowExecutionFailedEventAttributes.java @@ -0,0 +1,35 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class WorkflowExecutionFailedEventAttributes { + private String reason; + private byte[] details; + private long decisionTaskCompletedEventId; +} diff --git a/.gen/com/uber/cadence/entities/WorkflowExecutionFilter.java b/.gen/com/uber/cadence/entities/WorkflowExecutionFilter.java new file mode 100644 index 000000000..1cca49abb --- /dev/null +++ b/.gen/com/uber/cadence/entities/WorkflowExecutionFilter.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class WorkflowExecutionFilter { + private String workflowId; + private String runId; +} diff --git a/.gen/com/uber/cadence/entities/WorkflowExecutionInfo.java b/.gen/com/uber/cadence/entities/WorkflowExecutionInfo.java new file mode 100644 index 000000000..ec9206782 --- /dev/null +++ b/.gen/com/uber/cadence/entities/WorkflowExecutionInfo.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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class WorkflowExecutionInfo { + private WorkflowExecution execution; + private WorkflowType type; + private long startTime; + private long closeTime; + private WorkflowExecutionCloseStatus closeStatus; + private long historyLength; + private String parentDomainId; + private String parentDomainName; + private long parentInitatedId; + private WorkflowExecution parentExecution; + private long executionTime; + private Memo memo; + private SearchAttributes searchAttributes; + private ResetPoints autoResetPoints; + private String taskList; + private boolean isCron; + private long updateTime; + private Map partitionConfig; +} diff --git a/.gen/com/uber/cadence/entities/WorkflowExecutionSignaledEventAttributes.java b/.gen/com/uber/cadence/entities/WorkflowExecutionSignaledEventAttributes.java new file mode 100644 index 000000000..994ad2c9d --- /dev/null +++ b/.gen/com/uber/cadence/entities/WorkflowExecutionSignaledEventAttributes.java @@ -0,0 +1,36 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class WorkflowExecutionSignaledEventAttributes { + private String signalName; + private byte[] input; + private String identity; + private String requestId; +} diff --git a/.gen/com/uber/cadence/entities/WorkflowExecutionStartedEventAttributes.java b/.gen/com/uber/cadence/entities/WorkflowExecutionStartedEventAttributes.java new file mode 100644 index 000000000..4d95ded35 --- /dev/null +++ b/.gen/com/uber/cadence/entities/WorkflowExecutionStartedEventAttributes.java @@ -0,0 +1,60 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class WorkflowExecutionStartedEventAttributes { + private WorkflowType workflowType; + private String parentWorkflowDomain; + private WorkflowExecution parentWorkflowExecution; + private long parentInitiatedEventId; + private TaskList taskList; + private byte[] input; + private int executionStartToCloseTimeoutSeconds; + private int taskStartToCloseTimeoutSeconds; + private String continuedExecutionRunId; + private ContinueAsNewInitiator initiator; + private String continuedFailureReason; + private byte[] continuedFailureDetails; + private byte[] lastCompletionResult; + private String originalExecutionRunId; + private String identity; + private String firstExecutionRunId; + private long firstScheduledTimeNano; + private RetryPolicy retryPolicy; + private int attempt; + private long expirationTimestamp; + private String cronSchedule; + private int firstDecisionTaskBackoffSeconds; + private Memo memo; + private SearchAttributes searchAttributes; + private ResetPoints prevAutoResetPoints; + private Header header; + private Map partitionConfig; + private String requestId; +} diff --git a/.gen/com/uber/cadence/entities/WorkflowExecutionTerminatedEventAttributes.java b/.gen/com/uber/cadence/entities/WorkflowExecutionTerminatedEventAttributes.java new file mode 100644 index 000000000..4d582cefe --- /dev/null +++ b/.gen/com/uber/cadence/entities/WorkflowExecutionTerminatedEventAttributes.java @@ -0,0 +1,35 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class WorkflowExecutionTerminatedEventAttributes { + private String reason; + private byte[] details; + private String identity; +} diff --git a/.gen/com/uber/cadence/entities/WorkflowExecutionTimedOutEventAttributes.java b/.gen/com/uber/cadence/entities/WorkflowExecutionTimedOutEventAttributes.java new file mode 100644 index 000000000..51eef95bc --- /dev/null +++ b/.gen/com/uber/cadence/entities/WorkflowExecutionTimedOutEventAttributes.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class WorkflowExecutionTimedOutEventAttributes { + private TimeoutType timeoutType; +} diff --git a/.gen/com/uber/cadence/entities/WorkflowIdReusePolicy.java b/.gen/com/uber/cadence/entities/WorkflowIdReusePolicy.java new file mode 100644 index 000000000..239a45a94 --- /dev/null +++ b/.gen/com/uber/cadence/entities/WorkflowIdReusePolicy.java @@ -0,0 +1,30 @@ +/** + * 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.entities; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +public enum WorkflowIdReusePolicy { + AllowDuplicateFailedOnly, + AllowDuplicate, + RejectDuplicate, + TerminateIfRunning, +} diff --git a/.gen/com/uber/cadence/entities/WorkflowQuery.java b/.gen/com/uber/cadence/entities/WorkflowQuery.java new file mode 100644 index 000000000..91287e676 --- /dev/null +++ b/.gen/com/uber/cadence/entities/WorkflowQuery.java @@ -0,0 +1,34 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class WorkflowQuery { + private String queryType; + private byte[] queryArgs; +} diff --git a/.gen/com/uber/cadence/entities/WorkflowQueryResult.java b/.gen/com/uber/cadence/entities/WorkflowQueryResult.java new file mode 100644 index 000000000..d598717b8 --- /dev/null +++ b/.gen/com/uber/cadence/entities/WorkflowQueryResult.java @@ -0,0 +1,35 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class WorkflowQueryResult { + private QueryResultType resultType; + private byte[] answer; + private String errorMessage; +} diff --git a/.gen/com/uber/cadence/entities/WorkflowType.java b/.gen/com/uber/cadence/entities/WorkflowType.java new file mode 100644 index 000000000..b0f36a87b --- /dev/null +++ b/.gen/com/uber/cadence/entities/WorkflowType.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class WorkflowType { + private String name; +} diff --git a/.gen/com/uber/cadence/entities/WorkflowTypeFilter.java b/.gen/com/uber/cadence/entities/WorkflowTypeFilter.java new file mode 100644 index 000000000..509b9c523 --- /dev/null +++ b/.gen/com/uber/cadence/entities/WorkflowTypeFilter.java @@ -0,0 +1,33 @@ +/** + * 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.entities; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * DO NOT EDIT THIS FILE. + * + *

This file is generated by cadence-idl custom generator for simple java entity + * + *

If you want to change the code, please modify the generator. + * https://github.com/cadence-workflow/cadence-idl/tree/main/java/thrift/generator + */ +@Data +@Accessors(chain = true) +public class WorkflowTypeFilter { + private String name; +} diff --git a/build.gradle b/build.gradle index 22dc4466f..126679b0a 100644 --- a/build.gradle +++ b/build.gradle @@ -44,7 +44,7 @@ googleJavaFormat { exclude '**/generated-sources/*' } -tasks.googleJavaFormat.dependsOn 'license' +tasks.googleJavaFormat.dependsOn 'licenseFormat' group = 'com.uber.cadence' @@ -89,6 +89,10 @@ dependencies { compile group: 'com.google.api.grpc', name: 'proto-google-common-protos', version: '2.10.0' compile group: 'com.google.protobuf', name: 'protobuf-java-util', version: '3.21.9' compile group: 'com.google.oauth-client', name: 'google-oauth-client', version: '1.35.0' + compileOnly 'org.projectlombok:lombok:1.18.30' + annotationProcessor 'org.projectlombok:lombok:1.18.30' + testCompileOnly 'org.projectlombok:lombok:1.18.30' + testAnnotationProcessor 'org.projectlombok:lombok:1.18.30' implementation 'io.grpc:grpc-netty-shaded:1.54.2' implementation 'io.grpc:grpc-protobuf:1.54.2' @@ -126,12 +130,6 @@ task updateDlsSubmodule(type: Exec) { commandLine 'git', 'submodule', 'update' } -compileThrift { - dependsOn updateDlsSubmodule - verbose true - sourceItems "${projectDir}/src/main/idls/thrift/cadence.thrift","${projectDir}/src/main/idls/thrift/shared.thrift","${projectDir}/src/main/idls/thrift/shadower.thrift" -} - sourceSets { main { proto { @@ -139,6 +137,7 @@ sourceSets { } java { srcDir 'src/main' + srcDir 'src/gen/java' } } } diff --git a/scripts/v4_entity_generator/generator.go b/scripts/v4_entity_generator/generator.go new file mode 100644 index 000000000..d6f37373c --- /dev/null +++ b/scripts/v4_entity_generator/generator.go @@ -0,0 +1,304 @@ +package main + +import ( + "fmt" + "log" + "os" + "strings" + "sync" + "text/template" + + "go.uber.org/thriftrw/ast" + "go.uber.org/thriftrw/idl" +) + +const ( + baseExceptionClassName = "BaseError" +) + +type Field struct { + Name string + Type string +} + +type TemplateEntity struct { + PackageName string + ClassName string + Fields []Field +} + +type TemplateEnum struct { + PackageName string + ClassName string + Fields []string +} + +type TemplateException struct { + PackageName string + ClassName string + Fields []Field + BaseExceptionClassName string +} + +type TemplateBaseException struct { + PackageName string + ClassName string +} + +type Generator struct { + tmplStruct *template.Template + tmplEnum *template.Template + tmplException *template.Template + tmplBaseException *template.Template + log *log.Logger +} + +func NewGenerator() *Generator { + return &Generator{ + tmplStruct: template.Must(template.ParseFiles("./template/java_struct.tmpl")), + tmplEnum: template.Must(template.ParseFiles("./template/java_enum.tmpl")), + tmplException: template.Must(template.ParseFiles("./template/java_exception.tmpl")), + tmplBaseException: template.Must(template.ParseFiles("./template/java_base_exception.tmpl")), + log: log.New(os.Stdout, "", log.LstdFlags), + } +} + +func (g *Generator) Generate(input string, outputDir string, packageNameOverride string) error { + config := &idl.Config{} + + content, err := os.ReadFile(input) + if err != nil { + return fmt.Errorf("failed to read file: %w", err) + } + + program, err := config.Parse(content) + if err != nil { + return fmt.Errorf("failed to parse file: %w", err) + } + + packageName := packageNameOverride + if packageName == "" { + packageName, err = getPackageName(program) + if err != nil { + return fmt.Errorf("failed to get package name: %w", err) + } + } + outputDir = fmt.Sprintf("%s/%s", outputDir, strings.ReplaceAll(packageName, ".", "/")) + + err = os.MkdirAll(outputDir, 0755) + if err != nil { + return fmt.Errorf("failed to create output directory: %w", err) + } + + ast.Walk(ast.VisitorFunc(func(w ast.Walker, n ast.Node) { + var err error + switch v:=n.(type) { + case *ast.Struct: + switch v.Type { + case ast.ExceptionType: + err = g.generateException(v, outputDir, packageName) + case ast.StructType: + err = g.generateStruct(v, outputDir, packageName) + } + case *ast.Enum: + err = g.generateEnum(v, outputDir, packageName) + } + if err != nil { + g.log.Fatalf("failed to generate: %v", err) + } + }), program) + return nil +} + +func (g *Generator) generateStruct(v *ast.Struct, outputDir string, packageName string) error { + fields := make([]Field, 0) + for _, field := range v.Fields { + typeStr, err := typeMapper(field.Type, true) + if err != nil { + return fmt.Errorf("failed to map field type: %w", err) + } + + fields = append(fields, Field{ + Name: field.Name, + Type: typeStr, + }) + } + + data := TemplateEntity{ + PackageName: packageName, + ClassName: v.Name, + Fields: fields, + } + + outputFile := fmt.Sprintf("%s/%s.java", outputDir, v.Name) + f, err := os.Create(outputFile) + if err != nil { + return fmt.Errorf("failed to create file: %w", err) + } + defer f.Close() + + if err := g.tmplStruct.Execute(f, data); err != nil { + + return fmt.Errorf("failed to execute template: %w", err) + } + + return nil +} + +func (g *Generator) generateException(v *ast.Struct, outputDir string, packageName string) error { + var once sync.Once + once.Do(func(){ + err := g.generateBaseException(baseExceptionClassName, outputDir, packageName) + if err != nil { + g.log.Fatalf("failed to generate base exception: %v", err) + } + }) + + fields := make([]Field, 0) + for _, field := range v.Fields { + if field.Name == "message" { // skip on message field, it is already in the base exception + continue + } + typeStr, err := typeMapper(field.Type, true) + if err != nil { + return fmt.Errorf("failed to map field type: %w", err) + } + fields = append(fields, Field{ + Name: field.Name, + Type: typeStr, + }) + } + + data := TemplateException{ + PackageName: packageName, + ClassName: v.Name, + Fields: fields, + BaseExceptionClassName: baseExceptionClassName, + } + + outputFile := fmt.Sprintf("%s/%s.java", outputDir, v.Name) + f, err := os.Create(outputFile) + if err != nil { + return fmt.Errorf("failed to create file: %w", err) + } + defer f.Close() + + if err := g.tmplException.Execute(f, data); err != nil { + return fmt.Errorf("failed to execute template: %w", err) + } + return nil +} + +func (g *Generator) generateBaseException(className string, outputDir string, packageName string) error { + data := TemplateBaseException{ + PackageName: packageName, + ClassName: className, + } + + outputFile := fmt.Sprintf("%s/%s.java", outputDir, className) + f, err := os.Create(outputFile) + if err != nil { + return fmt.Errorf("failed to create file: %w", err) + } + defer f.Close() + + if err := g.tmplBaseException.Execute(f, data); err != nil { + return fmt.Errorf("failed to execute template: %w", err) + } + return nil +} + +func (g *Generator) generateEnum(v *ast.Enum, outputDir string, packageName string) error { + data := TemplateEnum{ + PackageName: packageName, + ClassName: v.Name, + } + for _, item := range v.Items { + data.Fields = append(data.Fields, item.Name) + } + + outputFile := fmt.Sprintf("%s/%s.java", outputDir, v.Name) + f, err := os.Create(outputFile) + if err != nil { + return fmt.Errorf("failed to create file: %w", err) + } + defer f.Close() + + if err := g.tmplEnum.Execute(f, data); err != nil { + return fmt.Errorf("failed to execute template: %w", err) + } + return nil +} + +func getPackageName(program *ast.Program) (string, error) { + for _, header := range program.Headers { + if header, ok := header.(*ast.Namespace); ok && header.Scope == "java" { + return header.Name, nil + } + } + return "", fmt.Errorf("cannot find package name in the thrift file") +} + +func typeMapper(t ast.Type, usePrimitive bool) (string, error) { + switch tt :=t.(type) { + case ast.BaseType: + return baseTypeMapper(tt, usePrimitive) + case ast.MapType: + keyType, err := typeMapper(tt.KeyType, false) + if err != nil { + return "", fmt.Errorf("failed to map key type: %w", err) + } + valueType, err := typeMapper(tt.ValueType, false) + if err != nil { + return "", fmt.Errorf("failed to map value type: %w", err) + } + return "Map<" + keyType + ", " + valueType + ">", nil + case ast.ListType: + valueType, err := typeMapper(tt.ValueType, false) + if err != nil { + return "", fmt.Errorf("failed to map value type: %w", err) + } + return "List<" + valueType + ">", nil + case ast.SetType: + valueType, err := typeMapper(tt.ValueType, false) + if err != nil { + return "", fmt.Errorf("failed to map value type: %w", err) + } + return "Set<" + valueType + ">", nil + case ast.TypeReference: + return tt.Name, nil + default: + return "", fmt.Errorf("do not support type: %v", tt) + } +} + +func baseTypeMapper(t ast.BaseType, usePrimitive bool) (string, error) { + switch t.ID { + case ast.BoolTypeID: + if usePrimitive { + return "boolean", nil + } + return "Boolean", nil + case ast.I8TypeID, ast.I16TypeID, ast.I32TypeID: + if usePrimitive { + return "int", nil + } + return "Integer", nil + case ast.I64TypeID: + if usePrimitive { + return "long", nil + } + return "Long", nil + case ast.DoubleTypeID: + if usePrimitive { + return "double", nil + } + return "Double", nil + case ast.StringTypeID: + return "String", nil + case ast.BinaryTypeID: + return "byte[]", nil + default: + return "", fmt.Errorf("unknown base type: %v", t.ID) + } +} diff --git a/scripts/v4_entity_generator/go.mod b/scripts/v4_entity_generator/go.mod new file mode 100644 index 000000000..6cc75868b --- /dev/null +++ b/scripts/v4_entity_generator/go.mod @@ -0,0 +1,5 @@ +module github.com/uber/cadence-idl/java/generator + +go 1.18 + +require go.uber.org/thriftrw v1.32.0 diff --git a/scripts/v4_entity_generator/go.sum b/scripts/v4_entity_generator/go.sum new file mode 100644 index 000000000..c69fc06fd --- /dev/null +++ b/scripts/v4_entity_generator/go.sum @@ -0,0 +1,10 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +go.uber.org/thriftrw v1.32.0 h1:/d9SS3H0V0lwm5cVcPI29V7EGDWHQQARGLYKeyhzRAM= +go.uber.org/thriftrw v1.32.0/go.mod h1:MTXuf4RAB2SbjKgyvt7PF2SnuLJ8IYajpg8yBo3rEUI= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/scripts/v4_entity_generator/main.go b/scripts/v4_entity_generator/main.go new file mode 100644 index 000000000..4ad53fc83 --- /dev/null +++ b/scripts/v4_entity_generator/main.go @@ -0,0 +1,12 @@ +package main + +import "fmt" + +func main() { + if err := NewGenerator().Generate("../../src/main/idls/thrift/shared.thrift", "../../src/gen/java", "com.uber.cadence"); err != nil { + panic(fmt.Sprintf("failed to generate: %v", err)) + } + if err := NewGenerator().Generate("../../src/main/idls/thrift/shadower.thrift", "../../src/gen/java", "com.uber.cadence.shadower"); err != nil { + panic(fmt.Sprintf("failed to generate: %v", err)) + } +} diff --git a/scripts/v4_entity_generator/template/java_base_exception.tmpl b/scripts/v4_entity_generator/template/java_base_exception.tmpl new file mode 100644 index 000000000..97c8525fb --- /dev/null +++ b/scripts/v4_entity_generator/template/java_base_exception.tmpl @@ -0,0 +1,19 @@ +package {{.PackageName}}; + +public class {{.ClassName}} extends RuntimeException { + public {{.ClassName}}() { + super(); + } + + public {{.ClassName}}(String message) { + super(message); + } + + public {{.ClassName}}(String message, Throwable cause) { + super(message, cause); + } + + public {{.ClassName}}(Throwable cause) { + super(cause); + } +} diff --git a/scripts/v4_entity_generator/template/java_enum.tmpl b/scripts/v4_entity_generator/template/java_enum.tmpl new file mode 100644 index 000000000..aae6928dc --- /dev/null +++ b/scripts/v4_entity_generator/template/java_enum.tmpl @@ -0,0 +1,7 @@ +package {{.PackageName}}; + +public enum {{.ClassName}} { + {{- range .Fields}} + {{.}}, + {{- end}} +} diff --git a/scripts/v4_entity_generator/template/java_exception.tmpl b/scripts/v4_entity_generator/template/java_exception.tmpl new file mode 100644 index 000000000..55d7f62cb --- /dev/null +++ b/scripts/v4_entity_generator/template/java_exception.tmpl @@ -0,0 +1,29 @@ +package {{.PackageName}}; + +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; +import lombok.AllArgsConstructor; +import java.util.*; + +@Getter +@Setter +@Accessors(chain = true) +{{- if .Fields}}@AllArgsConstructor{{- end}} +public class {{.ClassName}} extends {{.BaseExceptionClassName}} { + {{- range .Fields}} + private {{.Type}} {{.Name}}; + {{- end}} + + public {{.ClassName}}() { + super(); + } + + public {{.ClassName}}(String message, Throwable cause) { + super(message, cause); + } + + public {{.ClassName}}(Throwable cause) { + super(cause); + } +} diff --git a/scripts/v4_entity_generator/template/java_struct.tmpl b/scripts/v4_entity_generator/template/java_struct.tmpl new file mode 100644 index 000000000..a99a60a2f --- /dev/null +++ b/scripts/v4_entity_generator/template/java_struct.tmpl @@ -0,0 +1,13 @@ +package {{.PackageName}}; + +import lombok.Data; +import lombok.experimental.Accessors; +import java.util.*; + +@Data +@Accessors(chain = true) +public class {{.ClassName}} { + {{- range .Fields}} + private {{.Type}} {{.Name}}; + {{- end}} +} diff --git a/src/gen/java/com/uber/cadence/AccessDeniedError.java b/src/gen/java/com/uber/cadence/AccessDeniedError.java new file mode 100644 index 000000000..88ede4829 --- /dev/null +++ b/src/gen/java/com/uber/cadence/AccessDeniedError.java @@ -0,0 +1,24 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +@Getter +@Setter +@Accessors(chain = true) +public class AccessDeniedError extends BaseError { + + public AccessDeniedError() { + super(); + } + + public AccessDeniedError(String message, Throwable cause) { + super(message, cause); + } + + public AccessDeniedError(Throwable cause) { + super(cause); + } +} diff --git a/src/gen/java/com/uber/cadence/ActivityLocalDispatchInfo.java b/src/gen/java/com/uber/cadence/ActivityLocalDispatchInfo.java new file mode 100644 index 000000000..0f5fafabf --- /dev/null +++ b/src/gen/java/com/uber/cadence/ActivityLocalDispatchInfo.java @@ -0,0 +1,15 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ActivityLocalDispatchInfo { + private String activityId; + private long scheduledTimestamp; + private long startedTimestamp; + private long scheduledTimestampOfThisAttempt; + private byte[] taskToken; +} diff --git a/src/gen/java/com/uber/cadence/ActivityTaskCancelRequestedEventAttributes.java b/src/gen/java/com/uber/cadence/ActivityTaskCancelRequestedEventAttributes.java new file mode 100644 index 000000000..068ceebcd --- /dev/null +++ b/src/gen/java/com/uber/cadence/ActivityTaskCancelRequestedEventAttributes.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ActivityTaskCancelRequestedEventAttributes { + private String activityId; + private long decisionTaskCompletedEventId; +} diff --git a/src/gen/java/com/uber/cadence/ActivityTaskCanceledEventAttributes.java b/src/gen/java/com/uber/cadence/ActivityTaskCanceledEventAttributes.java new file mode 100644 index 000000000..2ba63e1b0 --- /dev/null +++ b/src/gen/java/com/uber/cadence/ActivityTaskCanceledEventAttributes.java @@ -0,0 +1,15 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ActivityTaskCanceledEventAttributes { + private byte[] details; + private long latestCancelRequestedEventId; + private long scheduledEventId; + private long startedEventId; + private String identity; +} diff --git a/src/gen/java/com/uber/cadence/ActivityTaskCompletedEventAttributes.java b/src/gen/java/com/uber/cadence/ActivityTaskCompletedEventAttributes.java new file mode 100644 index 000000000..babe3b1ec --- /dev/null +++ b/src/gen/java/com/uber/cadence/ActivityTaskCompletedEventAttributes.java @@ -0,0 +1,14 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ActivityTaskCompletedEventAttributes { + private byte[] result; + private long scheduledEventId; + private long startedEventId; + private String identity; +} diff --git a/src/gen/java/com/uber/cadence/ActivityTaskFailedEventAttributes.java b/src/gen/java/com/uber/cadence/ActivityTaskFailedEventAttributes.java new file mode 100644 index 000000000..06b296c8d --- /dev/null +++ b/src/gen/java/com/uber/cadence/ActivityTaskFailedEventAttributes.java @@ -0,0 +1,15 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ActivityTaskFailedEventAttributes { + private String reason; + private byte[] details; + private long scheduledEventId; + private long startedEventId; + private String identity; +} diff --git a/src/gen/java/com/uber/cadence/ActivityTaskScheduledEventAttributes.java b/src/gen/java/com/uber/cadence/ActivityTaskScheduledEventAttributes.java new file mode 100644 index 000000000..3a2e50e9c --- /dev/null +++ b/src/gen/java/com/uber/cadence/ActivityTaskScheduledEventAttributes.java @@ -0,0 +1,22 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ActivityTaskScheduledEventAttributes { + private String activityId; + private ActivityType activityType; + private String domain; + private TaskList taskList; + private byte[] input; + private int scheduleToCloseTimeoutSeconds; + private int scheduleToStartTimeoutSeconds; + private int startToCloseTimeoutSeconds; + private int heartbeatTimeoutSeconds; + private long decisionTaskCompletedEventId; + private RetryPolicy retryPolicy; + private Header header; +} diff --git a/src/gen/java/com/uber/cadence/ActivityTaskStartedEventAttributes.java b/src/gen/java/com/uber/cadence/ActivityTaskStartedEventAttributes.java new file mode 100644 index 000000000..e2a8e721d --- /dev/null +++ b/src/gen/java/com/uber/cadence/ActivityTaskStartedEventAttributes.java @@ -0,0 +1,16 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ActivityTaskStartedEventAttributes { + private long scheduledEventId; + private String identity; + private String requestId; + private int attempt; + private String lastFailureReason; + private byte[] lastFailureDetails; +} diff --git a/src/gen/java/com/uber/cadence/ActivityTaskTimedOutEventAttributes.java b/src/gen/java/com/uber/cadence/ActivityTaskTimedOutEventAttributes.java new file mode 100644 index 000000000..576fd1871 --- /dev/null +++ b/src/gen/java/com/uber/cadence/ActivityTaskTimedOutEventAttributes.java @@ -0,0 +1,16 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ActivityTaskTimedOutEventAttributes { + private byte[] details; + private long scheduledEventId; + private long startedEventId; + private TimeoutType timeoutType; + private String lastFailureReason; + private byte[] lastFailureDetails; +} diff --git a/src/gen/java/com/uber/cadence/ActivityType.java b/src/gen/java/com/uber/cadence/ActivityType.java new file mode 100644 index 000000000..f2b13b35f --- /dev/null +++ b/src/gen/java/com/uber/cadence/ActivityType.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ActivityType { + private String name; +} diff --git a/src/gen/java/com/uber/cadence/Any.java b/src/gen/java/com/uber/cadence/Any.java new file mode 100644 index 000000000..91c36c4bb --- /dev/null +++ b/src/gen/java/com/uber/cadence/Any.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class Any { + private String ValueType; + private byte[] Value; +} diff --git a/src/gen/java/com/uber/cadence/ApplyParentClosePolicyAttributes.java b/src/gen/java/com/uber/cadence/ApplyParentClosePolicyAttributes.java new file mode 100644 index 000000000..e5a9121a9 --- /dev/null +++ b/src/gen/java/com/uber/cadence/ApplyParentClosePolicyAttributes.java @@ -0,0 +1,14 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ApplyParentClosePolicyAttributes { + private String childDomainID; + private String childWorkflowID; + private String childRunID; + private ParentClosePolicy parentClosePolicy; +} diff --git a/src/gen/java/com/uber/cadence/ApplyParentClosePolicyRequest.java b/src/gen/java/com/uber/cadence/ApplyParentClosePolicyRequest.java new file mode 100644 index 000000000..35487b163 --- /dev/null +++ b/src/gen/java/com/uber/cadence/ApplyParentClosePolicyRequest.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ApplyParentClosePolicyRequest { + private ApplyParentClosePolicyAttributes child; + private ApplyParentClosePolicyStatus status; +} diff --git a/src/gen/java/com/uber/cadence/ApplyParentClosePolicyResult.java b/src/gen/java/com/uber/cadence/ApplyParentClosePolicyResult.java new file mode 100644 index 000000000..f1433789d --- /dev/null +++ b/src/gen/java/com/uber/cadence/ApplyParentClosePolicyResult.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ApplyParentClosePolicyResult { + private ApplyParentClosePolicyAttributes child; + private CrossClusterTaskFailedCause failedCause; +} diff --git a/src/gen/java/com/uber/cadence/ApplyParentClosePolicyStatus.java b/src/gen/java/com/uber/cadence/ApplyParentClosePolicyStatus.java new file mode 100644 index 000000000..dff46039f --- /dev/null +++ b/src/gen/java/com/uber/cadence/ApplyParentClosePolicyStatus.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ApplyParentClosePolicyStatus { + private boolean completed; + private CrossClusterTaskFailedCause failedCause; +} diff --git a/src/gen/java/com/uber/cadence/ArchivalStatus.java b/src/gen/java/com/uber/cadence/ArchivalStatus.java new file mode 100644 index 000000000..a590f87fe --- /dev/null +++ b/src/gen/java/com/uber/cadence/ArchivalStatus.java @@ -0,0 +1,6 @@ +package com.uber.cadence; + +public enum ArchivalStatus { + DISABLED, + ENABLED, +} diff --git a/src/gen/java/com/uber/cadence/AsyncWorkflowConfiguration.java b/src/gen/java/com/uber/cadence/AsyncWorkflowConfiguration.java new file mode 100644 index 000000000..16666c180 --- /dev/null +++ b/src/gen/java/com/uber/cadence/AsyncWorkflowConfiguration.java @@ -0,0 +1,14 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class AsyncWorkflowConfiguration { + private boolean enabled; + private String predefinedQueueName; + private String queueType; + private DataBlob queueConfig; +} diff --git a/src/gen/java/com/uber/cadence/BadBinaries.java b/src/gen/java/com/uber/cadence/BadBinaries.java new file mode 100644 index 000000000..490f93018 --- /dev/null +++ b/src/gen/java/com/uber/cadence/BadBinaries.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class BadBinaries { + private Map binaries; +} diff --git a/src/gen/java/com/uber/cadence/BadBinaryInfo.java b/src/gen/java/com/uber/cadence/BadBinaryInfo.java new file mode 100644 index 000000000..2fbcd37f4 --- /dev/null +++ b/src/gen/java/com/uber/cadence/BadBinaryInfo.java @@ -0,0 +1,13 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class BadBinaryInfo { + private String reason; + private String operator; + private long createdTimeNano; +} diff --git a/src/gen/java/com/uber/cadence/BadRequestError.java b/src/gen/java/com/uber/cadence/BadRequestError.java new file mode 100644 index 000000000..fdf667f15 --- /dev/null +++ b/src/gen/java/com/uber/cadence/BadRequestError.java @@ -0,0 +1,28 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +@Getter +@Setter +@Accessors(chain = true) +public class BadRequestError extends BaseError { + + public BadRequestError() { + super(); + } + + public BadRequestError(String message) { + super(message); + } + + public BadRequestError(String message, Throwable cause) { + super(message, cause); + } + + public BadRequestError(Throwable cause) { + super(cause); + } +} diff --git a/src/gen/java/com/uber/cadence/BaseError.java b/src/gen/java/com/uber/cadence/BaseError.java new file mode 100644 index 000000000..777fd73f1 --- /dev/null +++ b/src/gen/java/com/uber/cadence/BaseError.java @@ -0,0 +1,19 @@ +package com.uber.cadence; + +public class BaseError extends RuntimeException { + public BaseError() { + super(); + } + + public BaseError(String message) { + super(message); + } + + public BaseError(String message, Throwable cause) { + super(message, cause); + } + + public BaseError(Throwable cause) { + super(cause); + } +} diff --git a/src/gen/java/com/uber/cadence/CancelExternalWorkflowExecutionFailedCause.java b/src/gen/java/com/uber/cadence/CancelExternalWorkflowExecutionFailedCause.java new file mode 100644 index 000000000..434fa96f3 --- /dev/null +++ b/src/gen/java/com/uber/cadence/CancelExternalWorkflowExecutionFailedCause.java @@ -0,0 +1,6 @@ +package com.uber.cadence; + +public enum CancelExternalWorkflowExecutionFailedCause { + UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION, + WORKFLOW_ALREADY_COMPLETED, +} diff --git a/src/gen/java/com/uber/cadence/CancelTimerDecisionAttributes.java b/src/gen/java/com/uber/cadence/CancelTimerDecisionAttributes.java new file mode 100644 index 000000000..053e67d0b --- /dev/null +++ b/src/gen/java/com/uber/cadence/CancelTimerDecisionAttributes.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class CancelTimerDecisionAttributes { + private String timerId; +} diff --git a/src/gen/java/com/uber/cadence/CancelTimerFailedEventAttributes.java b/src/gen/java/com/uber/cadence/CancelTimerFailedEventAttributes.java new file mode 100644 index 000000000..3ee519098 --- /dev/null +++ b/src/gen/java/com/uber/cadence/CancelTimerFailedEventAttributes.java @@ -0,0 +1,14 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class CancelTimerFailedEventAttributes { + private String timerId; + private String cause; + private long decisionTaskCompletedEventId; + private String identity; +} diff --git a/src/gen/java/com/uber/cadence/CancelWorkflowExecutionDecisionAttributes.java b/src/gen/java/com/uber/cadence/CancelWorkflowExecutionDecisionAttributes.java new file mode 100644 index 000000000..ef40aafa8 --- /dev/null +++ b/src/gen/java/com/uber/cadence/CancelWorkflowExecutionDecisionAttributes.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class CancelWorkflowExecutionDecisionAttributes { + private byte[] details; +} diff --git a/src/gen/java/com/uber/cadence/CancellationAlreadyRequestedError.java b/src/gen/java/com/uber/cadence/CancellationAlreadyRequestedError.java new file mode 100644 index 000000000..e2fbcf75f --- /dev/null +++ b/src/gen/java/com/uber/cadence/CancellationAlreadyRequestedError.java @@ -0,0 +1,24 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +@Getter +@Setter +@Accessors(chain = true) +public class CancellationAlreadyRequestedError extends BaseError { + + public CancellationAlreadyRequestedError() { + super(); + } + + public CancellationAlreadyRequestedError(String message, Throwable cause) { + super(message, cause); + } + + public CancellationAlreadyRequestedError(Throwable cause) { + super(cause); + } +} diff --git a/src/gen/java/com/uber/cadence/ChildWorkflowExecutionCanceledEventAttributes.java b/src/gen/java/com/uber/cadence/ChildWorkflowExecutionCanceledEventAttributes.java new file mode 100644 index 000000000..f26702e9b --- /dev/null +++ b/src/gen/java/com/uber/cadence/ChildWorkflowExecutionCanceledEventAttributes.java @@ -0,0 +1,16 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ChildWorkflowExecutionCanceledEventAttributes { + private byte[] details; + private String domain; + private WorkflowExecution workflowExecution; + private WorkflowType workflowType; + private long initiatedEventId; + private long startedEventId; +} diff --git a/src/gen/java/com/uber/cadence/ChildWorkflowExecutionCompletedEventAttributes.java b/src/gen/java/com/uber/cadence/ChildWorkflowExecutionCompletedEventAttributes.java new file mode 100644 index 000000000..329dc7673 --- /dev/null +++ b/src/gen/java/com/uber/cadence/ChildWorkflowExecutionCompletedEventAttributes.java @@ -0,0 +1,16 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ChildWorkflowExecutionCompletedEventAttributes { + private byte[] result; + private String domain; + private WorkflowExecution workflowExecution; + private WorkflowType workflowType; + private long initiatedEventId; + private long startedEventId; +} diff --git a/src/gen/java/com/uber/cadence/ChildWorkflowExecutionFailedCause.java b/src/gen/java/com/uber/cadence/ChildWorkflowExecutionFailedCause.java new file mode 100644 index 000000000..f65487eab --- /dev/null +++ b/src/gen/java/com/uber/cadence/ChildWorkflowExecutionFailedCause.java @@ -0,0 +1,5 @@ +package com.uber.cadence; + +public enum ChildWorkflowExecutionFailedCause { + WORKFLOW_ALREADY_RUNNING, +} diff --git a/src/gen/java/com/uber/cadence/ChildWorkflowExecutionFailedEventAttributes.java b/src/gen/java/com/uber/cadence/ChildWorkflowExecutionFailedEventAttributes.java new file mode 100644 index 000000000..9e0b3be61 --- /dev/null +++ b/src/gen/java/com/uber/cadence/ChildWorkflowExecutionFailedEventAttributes.java @@ -0,0 +1,17 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ChildWorkflowExecutionFailedEventAttributes { + private String reason; + private byte[] details; + private String domain; + private WorkflowExecution workflowExecution; + private WorkflowType workflowType; + private long initiatedEventId; + private long startedEventId; +} diff --git a/src/gen/java/com/uber/cadence/ChildWorkflowExecutionStartedEventAttributes.java b/src/gen/java/com/uber/cadence/ChildWorkflowExecutionStartedEventAttributes.java new file mode 100644 index 000000000..960725f9a --- /dev/null +++ b/src/gen/java/com/uber/cadence/ChildWorkflowExecutionStartedEventAttributes.java @@ -0,0 +1,15 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ChildWorkflowExecutionStartedEventAttributes { + private String domain; + private long initiatedEventId; + private WorkflowExecution workflowExecution; + private WorkflowType workflowType; + private Header header; +} diff --git a/src/gen/java/com/uber/cadence/ChildWorkflowExecutionTerminatedEventAttributes.java b/src/gen/java/com/uber/cadence/ChildWorkflowExecutionTerminatedEventAttributes.java new file mode 100644 index 000000000..a62405881 --- /dev/null +++ b/src/gen/java/com/uber/cadence/ChildWorkflowExecutionTerminatedEventAttributes.java @@ -0,0 +1,15 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ChildWorkflowExecutionTerminatedEventAttributes { + private String domain; + private WorkflowExecution workflowExecution; + private WorkflowType workflowType; + private long initiatedEventId; + private long startedEventId; +} diff --git a/src/gen/java/com/uber/cadence/ChildWorkflowExecutionTimedOutEventAttributes.java b/src/gen/java/com/uber/cadence/ChildWorkflowExecutionTimedOutEventAttributes.java new file mode 100644 index 000000000..92951075f --- /dev/null +++ b/src/gen/java/com/uber/cadence/ChildWorkflowExecutionTimedOutEventAttributes.java @@ -0,0 +1,16 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ChildWorkflowExecutionTimedOutEventAttributes { + private TimeoutType timeoutType; + private String domain; + private WorkflowExecution workflowExecution; + private WorkflowType workflowType; + private long initiatedEventId; + private long startedEventId; +} diff --git a/src/gen/java/com/uber/cadence/ClientVersionNotSupportedError.java b/src/gen/java/com/uber/cadence/ClientVersionNotSupportedError.java new file mode 100644 index 000000000..b8e030e2e --- /dev/null +++ b/src/gen/java/com/uber/cadence/ClientVersionNotSupportedError.java @@ -0,0 +1,29 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +@Getter +@Setter +@Accessors(chain = true) +@AllArgsConstructor +public class ClientVersionNotSupportedError extends BaseError { + private String featureVersion; + private String clientImpl; + private String supportedVersions; + + public ClientVersionNotSupportedError() { + super(); + } + + public ClientVersionNotSupportedError(String message, Throwable cause) { + super(message, cause); + } + + public ClientVersionNotSupportedError(Throwable cause) { + super(cause); + } +} diff --git a/src/gen/java/com/uber/cadence/CloseShardRequest.java b/src/gen/java/com/uber/cadence/CloseShardRequest.java new file mode 100644 index 000000000..60ddf9ee1 --- /dev/null +++ b/src/gen/java/com/uber/cadence/CloseShardRequest.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class CloseShardRequest { + private int shardID; +} diff --git a/src/gen/java/com/uber/cadence/ClusterInfo.java b/src/gen/java/com/uber/cadence/ClusterInfo.java new file mode 100644 index 000000000..365b6f03b --- /dev/null +++ b/src/gen/java/com/uber/cadence/ClusterInfo.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ClusterInfo { + private SupportedClientVersions supportedClientVersions; +} diff --git a/src/gen/java/com/uber/cadence/ClusterReplicationConfiguration.java b/src/gen/java/com/uber/cadence/ClusterReplicationConfiguration.java new file mode 100644 index 000000000..a6bdfff7e --- /dev/null +++ b/src/gen/java/com/uber/cadence/ClusterReplicationConfiguration.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ClusterReplicationConfiguration { + private String clusterName; +} diff --git a/src/gen/java/com/uber/cadence/CompleteWorkflowExecutionDecisionAttributes.java b/src/gen/java/com/uber/cadence/CompleteWorkflowExecutionDecisionAttributes.java new file mode 100644 index 000000000..c595a10ca --- /dev/null +++ b/src/gen/java/com/uber/cadence/CompleteWorkflowExecutionDecisionAttributes.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class CompleteWorkflowExecutionDecisionAttributes { + private byte[] result; +} diff --git a/src/gen/java/com/uber/cadence/ContinueAsNewInitiator.java b/src/gen/java/com/uber/cadence/ContinueAsNewInitiator.java new file mode 100644 index 000000000..77c69287e --- /dev/null +++ b/src/gen/java/com/uber/cadence/ContinueAsNewInitiator.java @@ -0,0 +1,7 @@ +package com.uber.cadence; + +public enum ContinueAsNewInitiator { + Decider, + RetryPolicy, + CronSchedule, +} diff --git a/src/gen/java/com/uber/cadence/ContinueAsNewWorkflowExecutionDecisionAttributes.java b/src/gen/java/com/uber/cadence/ContinueAsNewWorkflowExecutionDecisionAttributes.java new file mode 100644 index 000000000..df566206e --- /dev/null +++ b/src/gen/java/com/uber/cadence/ContinueAsNewWorkflowExecutionDecisionAttributes.java @@ -0,0 +1,26 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ContinueAsNewWorkflowExecutionDecisionAttributes { + private WorkflowType workflowType; + private TaskList taskList; + private byte[] input; + private int executionStartToCloseTimeoutSeconds; + private int taskStartToCloseTimeoutSeconds; + private int backoffStartIntervalInSeconds; + private RetryPolicy retryPolicy; + private ContinueAsNewInitiator initiator; + private String failureReason; + private byte[] failureDetails; + private byte[] lastCompletionResult; + private String cronSchedule; + private Header header; + private Memo memo; + private SearchAttributes searchAttributes; + private int jitterStartSeconds; +} diff --git a/src/gen/java/com/uber/cadence/CountWorkflowExecutionsRequest.java b/src/gen/java/com/uber/cadence/CountWorkflowExecutionsRequest.java new file mode 100644 index 000000000..0add86cd8 --- /dev/null +++ b/src/gen/java/com/uber/cadence/CountWorkflowExecutionsRequest.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class CountWorkflowExecutionsRequest { + private String domain; + private String query; +} diff --git a/src/gen/java/com/uber/cadence/CountWorkflowExecutionsResponse.java b/src/gen/java/com/uber/cadence/CountWorkflowExecutionsResponse.java new file mode 100644 index 000000000..463f42f88 --- /dev/null +++ b/src/gen/java/com/uber/cadence/CountWorkflowExecutionsResponse.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class CountWorkflowExecutionsResponse { + private long count; +} diff --git a/src/gen/java/com/uber/cadence/CrossClusterApplyParentClosePolicyRequestAttributes.java b/src/gen/java/com/uber/cadence/CrossClusterApplyParentClosePolicyRequestAttributes.java new file mode 100644 index 000000000..f4263f389 --- /dev/null +++ b/src/gen/java/com/uber/cadence/CrossClusterApplyParentClosePolicyRequestAttributes.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class CrossClusterApplyParentClosePolicyRequestAttributes { + private List children; +} diff --git a/src/gen/java/com/uber/cadence/CrossClusterApplyParentClosePolicyResponseAttributes.java b/src/gen/java/com/uber/cadence/CrossClusterApplyParentClosePolicyResponseAttributes.java new file mode 100644 index 000000000..1c5275a49 --- /dev/null +++ b/src/gen/java/com/uber/cadence/CrossClusterApplyParentClosePolicyResponseAttributes.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class CrossClusterApplyParentClosePolicyResponseAttributes { + private List childrenStatus; +} diff --git a/src/gen/java/com/uber/cadence/CrossClusterCancelExecutionRequestAttributes.java b/src/gen/java/com/uber/cadence/CrossClusterCancelExecutionRequestAttributes.java new file mode 100644 index 000000000..cc5377644 --- /dev/null +++ b/src/gen/java/com/uber/cadence/CrossClusterCancelExecutionRequestAttributes.java @@ -0,0 +1,16 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class CrossClusterCancelExecutionRequestAttributes { + private String targetDomainID; + private String targetWorkflowID; + private String targetRunID; + private String requestID; + private long initiatedEventID; + private boolean childWorkflowOnly; +} diff --git a/src/gen/java/com/uber/cadence/CrossClusterCancelExecutionResponseAttributes.java b/src/gen/java/com/uber/cadence/CrossClusterCancelExecutionResponseAttributes.java new file mode 100644 index 000000000..9e2cd9684 --- /dev/null +++ b/src/gen/java/com/uber/cadence/CrossClusterCancelExecutionResponseAttributes.java @@ -0,0 +1,9 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class CrossClusterCancelExecutionResponseAttributes {} diff --git a/src/gen/java/com/uber/cadence/CrossClusterRecordChildWorkflowExecutionCompleteRequestAttributes.java b/src/gen/java/com/uber/cadence/CrossClusterRecordChildWorkflowExecutionCompleteRequestAttributes.java new file mode 100644 index 000000000..723893860 --- /dev/null +++ b/src/gen/java/com/uber/cadence/CrossClusterRecordChildWorkflowExecutionCompleteRequestAttributes.java @@ -0,0 +1,15 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class CrossClusterRecordChildWorkflowExecutionCompleteRequestAttributes { + private String targetDomainID; + private String targetWorkflowID; + private String targetRunID; + private long initiatedEventID; + private HistoryEvent completionEvent; +} diff --git a/src/gen/java/com/uber/cadence/CrossClusterRecordChildWorkflowExecutionCompleteResponseAttributes.java b/src/gen/java/com/uber/cadence/CrossClusterRecordChildWorkflowExecutionCompleteResponseAttributes.java new file mode 100644 index 000000000..80e4f1735 --- /dev/null +++ b/src/gen/java/com/uber/cadence/CrossClusterRecordChildWorkflowExecutionCompleteResponseAttributes.java @@ -0,0 +1,9 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class CrossClusterRecordChildWorkflowExecutionCompleteResponseAttributes {} diff --git a/src/gen/java/com/uber/cadence/CrossClusterSignalExecutionRequestAttributes.java b/src/gen/java/com/uber/cadence/CrossClusterSignalExecutionRequestAttributes.java new file mode 100644 index 000000000..152695b0b --- /dev/null +++ b/src/gen/java/com/uber/cadence/CrossClusterSignalExecutionRequestAttributes.java @@ -0,0 +1,19 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class CrossClusterSignalExecutionRequestAttributes { + private String targetDomainID; + private String targetWorkflowID; + private String targetRunID; + private String requestID; + private long initiatedEventID; + private boolean childWorkflowOnly; + private String signalName; + private byte[] signalInput; + private byte[] control; +} diff --git a/src/gen/java/com/uber/cadence/CrossClusterSignalExecutionResponseAttributes.java b/src/gen/java/com/uber/cadence/CrossClusterSignalExecutionResponseAttributes.java new file mode 100644 index 000000000..99ce35b7a --- /dev/null +++ b/src/gen/java/com/uber/cadence/CrossClusterSignalExecutionResponseAttributes.java @@ -0,0 +1,9 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class CrossClusterSignalExecutionResponseAttributes {} diff --git a/src/gen/java/com/uber/cadence/CrossClusterStartChildExecutionRequestAttributes.java b/src/gen/java/com/uber/cadence/CrossClusterStartChildExecutionRequestAttributes.java new file mode 100644 index 000000000..9913a741b --- /dev/null +++ b/src/gen/java/com/uber/cadence/CrossClusterStartChildExecutionRequestAttributes.java @@ -0,0 +1,16 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class CrossClusterStartChildExecutionRequestAttributes { + private String targetDomainID; + private String requestID; + private long initiatedEventID; + private StartChildWorkflowExecutionInitiatedEventAttributes initiatedEventAttributes; + private String targetRunID; + private Map partitionConfig; +} diff --git a/src/gen/java/com/uber/cadence/CrossClusterStartChildExecutionResponseAttributes.java b/src/gen/java/com/uber/cadence/CrossClusterStartChildExecutionResponseAttributes.java new file mode 100644 index 000000000..d7a0b524a --- /dev/null +++ b/src/gen/java/com/uber/cadence/CrossClusterStartChildExecutionResponseAttributes.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class CrossClusterStartChildExecutionResponseAttributes { + private String runID; +} diff --git a/src/gen/java/com/uber/cadence/CrossClusterTaskFailedCause.java b/src/gen/java/com/uber/cadence/CrossClusterTaskFailedCause.java new file mode 100644 index 000000000..6729bcb20 --- /dev/null +++ b/src/gen/java/com/uber/cadence/CrossClusterTaskFailedCause.java @@ -0,0 +1,10 @@ +package com.uber.cadence; + +public enum CrossClusterTaskFailedCause { + DOMAIN_NOT_ACTIVE, + DOMAIN_NOT_EXISTS, + WORKFLOW_ALREADY_RUNNING, + WORKFLOW_NOT_EXISTS, + WORKFLOW_ALREADY_COMPLETED, + UNCATEGORIZED, +} diff --git a/src/gen/java/com/uber/cadence/CrossClusterTaskInfo.java b/src/gen/java/com/uber/cadence/CrossClusterTaskInfo.java new file mode 100644 index 000000000..91a1ad7d2 --- /dev/null +++ b/src/gen/java/com/uber/cadence/CrossClusterTaskInfo.java @@ -0,0 +1,17 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class CrossClusterTaskInfo { + private String domainID; + private String workflowID; + private String runID; + private CrossClusterTaskType taskType; + private int taskState; + private long taskID; + private long visibilityTimestamp; +} diff --git a/src/gen/java/com/uber/cadence/CrossClusterTaskRequest.java b/src/gen/java/com/uber/cadence/CrossClusterTaskRequest.java new file mode 100644 index 000000000..4f2779e21 --- /dev/null +++ b/src/gen/java/com/uber/cadence/CrossClusterTaskRequest.java @@ -0,0 +1,17 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class CrossClusterTaskRequest { + private CrossClusterTaskInfo taskInfo; + private CrossClusterStartChildExecutionRequestAttributes startChildExecutionAttributes; + private CrossClusterCancelExecutionRequestAttributes cancelExecutionAttributes; + private CrossClusterSignalExecutionRequestAttributes signalExecutionAttributes; + private CrossClusterRecordChildWorkflowExecutionCompleteRequestAttributes + recordChildWorkflowExecutionCompleteAttributes; + private CrossClusterApplyParentClosePolicyRequestAttributes applyParentClosePolicyAttributes; +} diff --git a/src/gen/java/com/uber/cadence/CrossClusterTaskResponse.java b/src/gen/java/com/uber/cadence/CrossClusterTaskResponse.java new file mode 100644 index 000000000..6308cd9a2 --- /dev/null +++ b/src/gen/java/com/uber/cadence/CrossClusterTaskResponse.java @@ -0,0 +1,20 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class CrossClusterTaskResponse { + private long taskID; + private CrossClusterTaskType taskType; + private int taskState; + private CrossClusterTaskFailedCause failedCause; + private CrossClusterStartChildExecutionResponseAttributes startChildExecutionAttributes; + private CrossClusterCancelExecutionResponseAttributes cancelExecutionAttributes; + private CrossClusterSignalExecutionResponseAttributes signalExecutionAttributes; + private CrossClusterRecordChildWorkflowExecutionCompleteResponseAttributes + recordChildWorkflowExecutionCompleteAttributes; + private CrossClusterApplyParentClosePolicyResponseAttributes applyParentClosePolicyAttributes; +} diff --git a/src/gen/java/com/uber/cadence/CrossClusterTaskType.java b/src/gen/java/com/uber/cadence/CrossClusterTaskType.java new file mode 100644 index 000000000..3d3d899b8 --- /dev/null +++ b/src/gen/java/com/uber/cadence/CrossClusterTaskType.java @@ -0,0 +1,9 @@ +package com.uber.cadence; + +public enum CrossClusterTaskType { + StartChildExecution, + CancelExecution, + SignalExecution, + RecordChildWorkflowExecutionComplete, + ApplyParentClosePolicy, +} diff --git a/src/gen/java/com/uber/cadence/CurrentBranchChangedError.java b/src/gen/java/com/uber/cadence/CurrentBranchChangedError.java new file mode 100644 index 000000000..c37dd8210 --- /dev/null +++ b/src/gen/java/com/uber/cadence/CurrentBranchChangedError.java @@ -0,0 +1,27 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +@Getter +@Setter +@Accessors(chain = true) +@AllArgsConstructor +public class CurrentBranchChangedError extends BaseError { + private byte[] currentBranchToken; + + public CurrentBranchChangedError() { + super(); + } + + public CurrentBranchChangedError(String message, Throwable cause) { + super(message, cause); + } + + public CurrentBranchChangedError(Throwable cause) { + super(cause); + } +} diff --git a/src/gen/java/com/uber/cadence/DataBlob.java b/src/gen/java/com/uber/cadence/DataBlob.java new file mode 100644 index 000000000..aae0c8846 --- /dev/null +++ b/src/gen/java/com/uber/cadence/DataBlob.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class DataBlob { + private EncodingType EncodingType; + private byte[] Data; +} diff --git a/src/gen/java/com/uber/cadence/Decision.java b/src/gen/java/com/uber/cadence/Decision.java new file mode 100644 index 000000000..a5a7e037c --- /dev/null +++ b/src/gen/java/com/uber/cadence/Decision.java @@ -0,0 +1,29 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class Decision { + private DecisionType decisionType; + private ScheduleActivityTaskDecisionAttributes scheduleActivityTaskDecisionAttributes; + private StartTimerDecisionAttributes startTimerDecisionAttributes; + private CompleteWorkflowExecutionDecisionAttributes completeWorkflowExecutionDecisionAttributes; + private FailWorkflowExecutionDecisionAttributes failWorkflowExecutionDecisionAttributes; + private RequestCancelActivityTaskDecisionAttributes requestCancelActivityTaskDecisionAttributes; + private CancelTimerDecisionAttributes cancelTimerDecisionAttributes; + private CancelWorkflowExecutionDecisionAttributes cancelWorkflowExecutionDecisionAttributes; + private RequestCancelExternalWorkflowExecutionDecisionAttributes + requestCancelExternalWorkflowExecutionDecisionAttributes; + private RecordMarkerDecisionAttributes recordMarkerDecisionAttributes; + private ContinueAsNewWorkflowExecutionDecisionAttributes + continueAsNewWorkflowExecutionDecisionAttributes; + private StartChildWorkflowExecutionDecisionAttributes + startChildWorkflowExecutionDecisionAttributes; + private SignalExternalWorkflowExecutionDecisionAttributes + signalExternalWorkflowExecutionDecisionAttributes; + private UpsertWorkflowSearchAttributesDecisionAttributes + upsertWorkflowSearchAttributesDecisionAttributes; +} diff --git a/src/gen/java/com/uber/cadence/DecisionTaskCompletedEventAttributes.java b/src/gen/java/com/uber/cadence/DecisionTaskCompletedEventAttributes.java new file mode 100644 index 000000000..502f8f6a8 --- /dev/null +++ b/src/gen/java/com/uber/cadence/DecisionTaskCompletedEventAttributes.java @@ -0,0 +1,15 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class DecisionTaskCompletedEventAttributes { + private byte[] executionContext; + private long scheduledEventId; + private long startedEventId; + private String identity; + private String binaryChecksum; +} diff --git a/src/gen/java/com/uber/cadence/DecisionTaskFailedCause.java b/src/gen/java/com/uber/cadence/DecisionTaskFailedCause.java new file mode 100644 index 000000000..852d11681 --- /dev/null +++ b/src/gen/java/com/uber/cadence/DecisionTaskFailedCause.java @@ -0,0 +1,27 @@ +package com.uber.cadence; + +public enum DecisionTaskFailedCause { + UNHANDLED_DECISION, + BAD_SCHEDULE_ACTIVITY_ATTRIBUTES, + BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES, + BAD_START_TIMER_ATTRIBUTES, + BAD_CANCEL_TIMER_ATTRIBUTES, + BAD_RECORD_MARKER_ATTRIBUTES, + BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES, + BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES, + BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES, + BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES, + BAD_CONTINUE_AS_NEW_ATTRIBUTES, + START_TIMER_DUPLICATE_ID, + RESET_STICKY_TASKLIST, + WORKFLOW_WORKER_UNHANDLED_FAILURE, + BAD_SIGNAL_WORKFLOW_EXECUTION_ATTRIBUTES, + BAD_START_CHILD_EXECUTION_ATTRIBUTES, + FORCE_CLOSE_DECISION, + FAILOVER_CLOSE_DECISION, + BAD_SIGNAL_INPUT_SIZE, + RESET_WORKFLOW, + BAD_BINARY, + SCHEDULE_ACTIVITY_DUPLICATE_ID, + BAD_SEARCH_ATTRIBUTES, +} diff --git a/src/gen/java/com/uber/cadence/DecisionTaskFailedEventAttributes.java b/src/gen/java/com/uber/cadence/DecisionTaskFailedEventAttributes.java new file mode 100644 index 000000000..38c419af4 --- /dev/null +++ b/src/gen/java/com/uber/cadence/DecisionTaskFailedEventAttributes.java @@ -0,0 +1,21 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class DecisionTaskFailedEventAttributes { + private long scheduledEventId; + private long startedEventId; + private DecisionTaskFailedCause cause; + private byte[] details; + private String identity; + private String reason; + private String baseRunId; + private String newRunId; + private long forkEventVersion; + private String binaryChecksum; + private String requestId; +} diff --git a/src/gen/java/com/uber/cadence/DecisionTaskScheduledEventAttributes.java b/src/gen/java/com/uber/cadence/DecisionTaskScheduledEventAttributes.java new file mode 100644 index 000000000..6fc9fb267 --- /dev/null +++ b/src/gen/java/com/uber/cadence/DecisionTaskScheduledEventAttributes.java @@ -0,0 +1,13 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class DecisionTaskScheduledEventAttributes { + private TaskList taskList; + private int startToCloseTimeoutSeconds; + private long attempt; +} diff --git a/src/gen/java/com/uber/cadence/DecisionTaskStartedEventAttributes.java b/src/gen/java/com/uber/cadence/DecisionTaskStartedEventAttributes.java new file mode 100644 index 000000000..edafb5515 --- /dev/null +++ b/src/gen/java/com/uber/cadence/DecisionTaskStartedEventAttributes.java @@ -0,0 +1,13 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class DecisionTaskStartedEventAttributes { + private long scheduledEventId; + private String identity; + private String requestId; +} diff --git a/src/gen/java/com/uber/cadence/DecisionTaskTimedOutCause.java b/src/gen/java/com/uber/cadence/DecisionTaskTimedOutCause.java new file mode 100644 index 000000000..7550812b9 --- /dev/null +++ b/src/gen/java/com/uber/cadence/DecisionTaskTimedOutCause.java @@ -0,0 +1,6 @@ +package com.uber.cadence; + +public enum DecisionTaskTimedOutCause { + TIMEOUT, + RESET, +} diff --git a/src/gen/java/com/uber/cadence/DecisionTaskTimedOutEventAttributes.java b/src/gen/java/com/uber/cadence/DecisionTaskTimedOutEventAttributes.java new file mode 100644 index 000000000..86aa5efea --- /dev/null +++ b/src/gen/java/com/uber/cadence/DecisionTaskTimedOutEventAttributes.java @@ -0,0 +1,19 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class DecisionTaskTimedOutEventAttributes { + private long scheduledEventId; + private long startedEventId; + private TimeoutType timeoutType; + private String baseRunId; + private String newRunId; + private long forkEventVersion; + private String reason; + private DecisionTaskTimedOutCause cause; + private String requestId; +} diff --git a/src/gen/java/com/uber/cadence/DecisionType.java b/src/gen/java/com/uber/cadence/DecisionType.java new file mode 100644 index 000000000..de844e963 --- /dev/null +++ b/src/gen/java/com/uber/cadence/DecisionType.java @@ -0,0 +1,17 @@ +package com.uber.cadence; + +public enum DecisionType { + ScheduleActivityTask, + RequestCancelActivityTask, + StartTimer, + CompleteWorkflowExecution, + FailWorkflowExecution, + CancelTimer, + CancelWorkflowExecution, + RequestCancelExternalWorkflowExecution, + RecordMarker, + ContinueAsNewWorkflowExecution, + StartChildWorkflowExecution, + SignalExternalWorkflowExecution, + UpsertWorkflowSearchAttributes, +} diff --git a/src/gen/java/com/uber/cadence/DeprecateDomainRequest.java b/src/gen/java/com/uber/cadence/DeprecateDomainRequest.java new file mode 100644 index 000000000..98fecf32d --- /dev/null +++ b/src/gen/java/com/uber/cadence/DeprecateDomainRequest.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class DeprecateDomainRequest { + private String name; + private String securityToken; +} diff --git a/src/gen/java/com/uber/cadence/DescribeDomainRequest.java b/src/gen/java/com/uber/cadence/DescribeDomainRequest.java new file mode 100644 index 000000000..d2a2a2d17 --- /dev/null +++ b/src/gen/java/com/uber/cadence/DescribeDomainRequest.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class DescribeDomainRequest { + private String name; + private String uuid; +} diff --git a/src/gen/java/com/uber/cadence/DescribeDomainResponse.java b/src/gen/java/com/uber/cadence/DescribeDomainResponse.java new file mode 100644 index 000000000..0f2675750 --- /dev/null +++ b/src/gen/java/com/uber/cadence/DescribeDomainResponse.java @@ -0,0 +1,16 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class DescribeDomainResponse { + private DomainInfo domainInfo; + private DomainConfiguration configuration; + private DomainReplicationConfiguration replicationConfiguration; + private long failoverVersion; + private boolean isGlobalDomain; + private FailoverInfo failoverInfo; +} diff --git a/src/gen/java/com/uber/cadence/DescribeHistoryHostRequest.java b/src/gen/java/com/uber/cadence/DescribeHistoryHostRequest.java new file mode 100644 index 000000000..0f6536531 --- /dev/null +++ b/src/gen/java/com/uber/cadence/DescribeHistoryHostRequest.java @@ -0,0 +1,13 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class DescribeHistoryHostRequest { + private String hostAddress; + private int shardIdForHost; + private WorkflowExecution executionForHost; +} diff --git a/src/gen/java/com/uber/cadence/DescribeHistoryHostResponse.java b/src/gen/java/com/uber/cadence/DescribeHistoryHostResponse.java new file mode 100644 index 000000000..e7e2ec5f9 --- /dev/null +++ b/src/gen/java/com/uber/cadence/DescribeHistoryHostResponse.java @@ -0,0 +1,15 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class DescribeHistoryHostResponse { + private int numberOfShards; + private List shardIDs; + private DomainCacheInfo domainCache; + private String shardControllerStatus; + private String address; +} diff --git a/src/gen/java/com/uber/cadence/DescribeQueueRequest.java b/src/gen/java/com/uber/cadence/DescribeQueueRequest.java new file mode 100644 index 000000000..0159e3570 --- /dev/null +++ b/src/gen/java/com/uber/cadence/DescribeQueueRequest.java @@ -0,0 +1,13 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class DescribeQueueRequest { + private int shardID; + private String clusterName; + private int type; +} diff --git a/src/gen/java/com/uber/cadence/DescribeQueueResponse.java b/src/gen/java/com/uber/cadence/DescribeQueueResponse.java new file mode 100644 index 000000000..b1c543e3a --- /dev/null +++ b/src/gen/java/com/uber/cadence/DescribeQueueResponse.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class DescribeQueueResponse { + private List processingQueueStates; +} diff --git a/src/gen/java/com/uber/cadence/DescribeShardDistributionRequest.java b/src/gen/java/com/uber/cadence/DescribeShardDistributionRequest.java new file mode 100644 index 000000000..1cd96d81b --- /dev/null +++ b/src/gen/java/com/uber/cadence/DescribeShardDistributionRequest.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class DescribeShardDistributionRequest { + private int pageSize; + private int pageID; +} diff --git a/src/gen/java/com/uber/cadence/DescribeShardDistributionResponse.java b/src/gen/java/com/uber/cadence/DescribeShardDistributionResponse.java new file mode 100644 index 000000000..8e985d592 --- /dev/null +++ b/src/gen/java/com/uber/cadence/DescribeShardDistributionResponse.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class DescribeShardDistributionResponse { + private int numberOfShards; + private Map shards; +} diff --git a/src/gen/java/com/uber/cadence/DescribeTaskListRequest.java b/src/gen/java/com/uber/cadence/DescribeTaskListRequest.java new file mode 100644 index 000000000..aac3603e7 --- /dev/null +++ b/src/gen/java/com/uber/cadence/DescribeTaskListRequest.java @@ -0,0 +1,14 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class DescribeTaskListRequest { + private String domain; + private TaskList taskList; + private TaskListType taskListType; + private boolean includeTaskListStatus; +} diff --git a/src/gen/java/com/uber/cadence/DescribeTaskListResponse.java b/src/gen/java/com/uber/cadence/DescribeTaskListResponse.java new file mode 100644 index 000000000..823fcfc77 --- /dev/null +++ b/src/gen/java/com/uber/cadence/DescribeTaskListResponse.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class DescribeTaskListResponse { + private List pollers; + private TaskListStatus taskListStatus; +} diff --git a/src/gen/java/com/uber/cadence/DescribeWorkflowExecutionRequest.java b/src/gen/java/com/uber/cadence/DescribeWorkflowExecutionRequest.java new file mode 100644 index 000000000..cf554d4b4 --- /dev/null +++ b/src/gen/java/com/uber/cadence/DescribeWorkflowExecutionRequest.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class DescribeWorkflowExecutionRequest { + private String domain; + private WorkflowExecution execution; +} diff --git a/src/gen/java/com/uber/cadence/DescribeWorkflowExecutionResponse.java b/src/gen/java/com/uber/cadence/DescribeWorkflowExecutionResponse.java new file mode 100644 index 000000000..3761915fe --- /dev/null +++ b/src/gen/java/com/uber/cadence/DescribeWorkflowExecutionResponse.java @@ -0,0 +1,15 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class DescribeWorkflowExecutionResponse { + private WorkflowExecutionConfiguration executionConfiguration; + private WorkflowExecutionInfo workflowExecutionInfo; + private List pendingActivities; + private List pendingChildren; + private PendingDecisionInfo pendingDecision; +} diff --git a/src/gen/java/com/uber/cadence/DomainAlreadyExistsError.java b/src/gen/java/com/uber/cadence/DomainAlreadyExistsError.java new file mode 100644 index 000000000..7fc52f393 --- /dev/null +++ b/src/gen/java/com/uber/cadence/DomainAlreadyExistsError.java @@ -0,0 +1,24 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +@Getter +@Setter +@Accessors(chain = true) +public class DomainAlreadyExistsError extends BaseError { + + public DomainAlreadyExistsError() { + super(); + } + + public DomainAlreadyExistsError(String message, Throwable cause) { + super(message, cause); + } + + public DomainAlreadyExistsError(Throwable cause) { + super(cause); + } +} diff --git a/src/gen/java/com/uber/cadence/DomainCacheInfo.java b/src/gen/java/com/uber/cadence/DomainCacheInfo.java new file mode 100644 index 000000000..733561aa7 --- /dev/null +++ b/src/gen/java/com/uber/cadence/DomainCacheInfo.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class DomainCacheInfo { + private long numOfItemsInCacheByID; + private long numOfItemsInCacheByName; +} diff --git a/src/gen/java/com/uber/cadence/DomainConfiguration.java b/src/gen/java/com/uber/cadence/DomainConfiguration.java new file mode 100644 index 000000000..c1b875247 --- /dev/null +++ b/src/gen/java/com/uber/cadence/DomainConfiguration.java @@ -0,0 +1,19 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class DomainConfiguration { + private int workflowExecutionRetentionPeriodInDays; + private boolean emitMetric; + private IsolationGroupConfiguration isolationgroups; + private BadBinaries badBinaries; + private ArchivalStatus historyArchivalStatus; + private String historyArchivalURI; + private ArchivalStatus visibilityArchivalStatus; + private String visibilityArchivalURI; + private AsyncWorkflowConfiguration AsyncWorkflowConfiguration; +} diff --git a/src/gen/java/com/uber/cadence/DomainInfo.java b/src/gen/java/com/uber/cadence/DomainInfo.java new file mode 100644 index 000000000..4e236c771 --- /dev/null +++ b/src/gen/java/com/uber/cadence/DomainInfo.java @@ -0,0 +1,16 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class DomainInfo { + private String name; + private DomainStatus status; + private String description; + private String ownerEmail; + private Map data; + private String uuid; +} diff --git a/src/gen/java/com/uber/cadence/DomainNotActiveError.java b/src/gen/java/com/uber/cadence/DomainNotActiveError.java new file mode 100644 index 000000000..82d304350 --- /dev/null +++ b/src/gen/java/com/uber/cadence/DomainNotActiveError.java @@ -0,0 +1,29 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +@Getter +@Setter +@Accessors(chain = true) +@AllArgsConstructor +public class DomainNotActiveError extends BaseError { + private String domainName; + private String currentCluster; + private String activeCluster; + + public DomainNotActiveError() { + super(); + } + + public DomainNotActiveError(String message, Throwable cause) { + super(message, cause); + } + + public DomainNotActiveError(Throwable cause) { + super(cause); + } +} diff --git a/src/gen/java/com/uber/cadence/DomainReplicationConfiguration.java b/src/gen/java/com/uber/cadence/DomainReplicationConfiguration.java new file mode 100644 index 000000000..d4650de5c --- /dev/null +++ b/src/gen/java/com/uber/cadence/DomainReplicationConfiguration.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class DomainReplicationConfiguration { + private String activeClusterName; + private List clusters; +} diff --git a/src/gen/java/com/uber/cadence/DomainStatus.java b/src/gen/java/com/uber/cadence/DomainStatus.java new file mode 100644 index 000000000..224a4c176 --- /dev/null +++ b/src/gen/java/com/uber/cadence/DomainStatus.java @@ -0,0 +1,7 @@ +package com.uber.cadence; + +public enum DomainStatus { + REGISTERED, + DEPRECATED, + DELETED, +} diff --git a/src/gen/java/com/uber/cadence/EncodingType.java b/src/gen/java/com/uber/cadence/EncodingType.java new file mode 100644 index 000000000..3a5e57ebf --- /dev/null +++ b/src/gen/java/com/uber/cadence/EncodingType.java @@ -0,0 +1,6 @@ +package com.uber.cadence; + +public enum EncodingType { + ThriftRW, + JSON, +} diff --git a/src/gen/java/com/uber/cadence/EntityNotExistsError.java b/src/gen/java/com/uber/cadence/EntityNotExistsError.java new file mode 100644 index 000000000..ca9e0b236 --- /dev/null +++ b/src/gen/java/com/uber/cadence/EntityNotExistsError.java @@ -0,0 +1,32 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +@Getter +@Setter +@Accessors(chain = true) +@AllArgsConstructor +public class EntityNotExistsError extends BaseError { + private String currentCluster; + private String activeCluster; + + public EntityNotExistsError() { + super(); + } + + public EntityNotExistsError(String message) { + super(message); + } + + public EntityNotExistsError(String message, Throwable cause) { + super(message, cause); + } + + public EntityNotExistsError(Throwable cause) { + super(cause); + } +} diff --git a/src/gen/java/com/uber/cadence/EventType.java b/src/gen/java/com/uber/cadence/EventType.java new file mode 100644 index 000000000..1cd58f1e5 --- /dev/null +++ b/src/gen/java/com/uber/cadence/EventType.java @@ -0,0 +1,46 @@ +package com.uber.cadence; + +public enum EventType { + WorkflowExecutionStarted, + WorkflowExecutionCompleted, + WorkflowExecutionFailed, + WorkflowExecutionTimedOut, + DecisionTaskScheduled, + DecisionTaskStarted, + DecisionTaskCompleted, + DecisionTaskTimedOut, + DecisionTaskFailed, + ActivityTaskScheduled, + ActivityTaskStarted, + ActivityTaskCompleted, + ActivityTaskFailed, + ActivityTaskTimedOut, + ActivityTaskCancelRequested, + RequestCancelActivityTaskFailed, + ActivityTaskCanceled, + TimerStarted, + TimerFired, + CancelTimerFailed, + TimerCanceled, + WorkflowExecutionCancelRequested, + WorkflowExecutionCanceled, + RequestCancelExternalWorkflowExecutionInitiated, + RequestCancelExternalWorkflowExecutionFailed, + ExternalWorkflowExecutionCancelRequested, + MarkerRecorded, + WorkflowExecutionSignaled, + WorkflowExecutionTerminated, + WorkflowExecutionContinuedAsNew, + StartChildWorkflowExecutionInitiated, + StartChildWorkflowExecutionFailed, + ChildWorkflowExecutionStarted, + ChildWorkflowExecutionCompleted, + ChildWorkflowExecutionFailed, + ChildWorkflowExecutionCanceled, + ChildWorkflowExecutionTimedOut, + ChildWorkflowExecutionTerminated, + SignalExternalWorkflowExecutionInitiated, + SignalExternalWorkflowExecutionFailed, + ExternalWorkflowExecutionSignaled, + UpsertWorkflowSearchAttributes, +} diff --git a/src/gen/java/com/uber/cadence/ExternalWorkflowExecutionCancelRequestedEventAttributes.java b/src/gen/java/com/uber/cadence/ExternalWorkflowExecutionCancelRequestedEventAttributes.java new file mode 100644 index 000000000..a7ac1fb1c --- /dev/null +++ b/src/gen/java/com/uber/cadence/ExternalWorkflowExecutionCancelRequestedEventAttributes.java @@ -0,0 +1,13 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ExternalWorkflowExecutionCancelRequestedEventAttributes { + private long initiatedEventId; + private String domain; + private WorkflowExecution workflowExecution; +} diff --git a/src/gen/java/com/uber/cadence/ExternalWorkflowExecutionSignaledEventAttributes.java b/src/gen/java/com/uber/cadence/ExternalWorkflowExecutionSignaledEventAttributes.java new file mode 100644 index 000000000..bf3a32a54 --- /dev/null +++ b/src/gen/java/com/uber/cadence/ExternalWorkflowExecutionSignaledEventAttributes.java @@ -0,0 +1,14 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ExternalWorkflowExecutionSignaledEventAttributes { + private long initiatedEventId; + private String domain; + private WorkflowExecution workflowExecution; + private byte[] control; +} diff --git a/src/gen/java/com/uber/cadence/FailWorkflowExecutionDecisionAttributes.java b/src/gen/java/com/uber/cadence/FailWorkflowExecutionDecisionAttributes.java new file mode 100644 index 000000000..43376e0df --- /dev/null +++ b/src/gen/java/com/uber/cadence/FailWorkflowExecutionDecisionAttributes.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class FailWorkflowExecutionDecisionAttributes { + private String reason; + private byte[] details; +} diff --git a/src/gen/java/com/uber/cadence/FailoverInfo.java b/src/gen/java/com/uber/cadence/FailoverInfo.java new file mode 100644 index 000000000..cb1f52495 --- /dev/null +++ b/src/gen/java/com/uber/cadence/FailoverInfo.java @@ -0,0 +1,15 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class FailoverInfo { + private long failoverVersion; + private long failoverStartTimestamp; + private long failoverExpireTimestamp; + private int completedShardCount; + private List pendingShards; +} diff --git a/src/gen/java/com/uber/cadence/FeatureFlags.java b/src/gen/java/com/uber/cadence/FeatureFlags.java new file mode 100644 index 000000000..3498c1724 --- /dev/null +++ b/src/gen/java/com/uber/cadence/FeatureFlags.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class FeatureFlags { + private boolean WorkflowExecutionAlreadyCompletedErrorEnabled; +} diff --git a/src/gen/java/com/uber/cadence/FeatureNotEnabledError.java b/src/gen/java/com/uber/cadence/FeatureNotEnabledError.java new file mode 100644 index 000000000..844a6434a --- /dev/null +++ b/src/gen/java/com/uber/cadence/FeatureNotEnabledError.java @@ -0,0 +1,27 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +@Getter +@Setter +@Accessors(chain = true) +@AllArgsConstructor +public class FeatureNotEnabledError extends BaseError { + private String featureFlag; + + public FeatureNotEnabledError() { + super(); + } + + public FeatureNotEnabledError(String message, Throwable cause) { + super(message, cause); + } + + public FeatureNotEnabledError(Throwable cause) { + super(cause); + } +} diff --git a/src/gen/java/com/uber/cadence/GetCrossClusterTasksRequest.java b/src/gen/java/com/uber/cadence/GetCrossClusterTasksRequest.java new file mode 100644 index 000000000..f7662365e --- /dev/null +++ b/src/gen/java/com/uber/cadence/GetCrossClusterTasksRequest.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class GetCrossClusterTasksRequest { + private List shardIDs; + private String targetCluster; +} diff --git a/src/gen/java/com/uber/cadence/GetCrossClusterTasksResponse.java b/src/gen/java/com/uber/cadence/GetCrossClusterTasksResponse.java new file mode 100644 index 000000000..ee056bd0a --- /dev/null +++ b/src/gen/java/com/uber/cadence/GetCrossClusterTasksResponse.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class GetCrossClusterTasksResponse { + private Map> tasksByShard; + private Map failedCauseByShard; +} diff --git a/src/gen/java/com/uber/cadence/GetSearchAttributesResponse.java b/src/gen/java/com/uber/cadence/GetSearchAttributesResponse.java new file mode 100644 index 000000000..f03df08ec --- /dev/null +++ b/src/gen/java/com/uber/cadence/GetSearchAttributesResponse.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class GetSearchAttributesResponse { + private Map keys; +} diff --git a/src/gen/java/com/uber/cadence/GetTaskFailedCause.java b/src/gen/java/com/uber/cadence/GetTaskFailedCause.java new file mode 100644 index 000000000..2f0b0e038 --- /dev/null +++ b/src/gen/java/com/uber/cadence/GetTaskFailedCause.java @@ -0,0 +1,8 @@ +package com.uber.cadence; + +public enum GetTaskFailedCause { + SERVICE_BUSY, + TIMEOUT, + SHARD_OWNERSHIP_LOST, + UNCATEGORIZED, +} diff --git a/src/gen/java/com/uber/cadence/GetTaskListsByDomainRequest.java b/src/gen/java/com/uber/cadence/GetTaskListsByDomainRequest.java new file mode 100644 index 000000000..0efd92c1b --- /dev/null +++ b/src/gen/java/com/uber/cadence/GetTaskListsByDomainRequest.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class GetTaskListsByDomainRequest { + private String domainName; +} diff --git a/src/gen/java/com/uber/cadence/GetTaskListsByDomainResponse.java b/src/gen/java/com/uber/cadence/GetTaskListsByDomainResponse.java new file mode 100644 index 000000000..aaf886b6e --- /dev/null +++ b/src/gen/java/com/uber/cadence/GetTaskListsByDomainResponse.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class GetTaskListsByDomainResponse { + private Map decisionTaskListMap; + private Map activityTaskListMap; +} diff --git a/src/gen/java/com/uber/cadence/GetWorkflowExecutionHistoryRequest.java b/src/gen/java/com/uber/cadence/GetWorkflowExecutionHistoryRequest.java new file mode 100644 index 000000000..0f5f3730c --- /dev/null +++ b/src/gen/java/com/uber/cadence/GetWorkflowExecutionHistoryRequest.java @@ -0,0 +1,17 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class GetWorkflowExecutionHistoryRequest { + private String domain; + private WorkflowExecution execution; + private int maximumPageSize; + private byte[] nextPageToken; + private boolean waitForNewEvent; + private HistoryEventFilterType HistoryEventFilterType; + private boolean skipArchival; +} diff --git a/src/gen/java/com/uber/cadence/GetWorkflowExecutionHistoryResponse.java b/src/gen/java/com/uber/cadence/GetWorkflowExecutionHistoryResponse.java new file mode 100644 index 000000000..ab983713b --- /dev/null +++ b/src/gen/java/com/uber/cadence/GetWorkflowExecutionHistoryResponse.java @@ -0,0 +1,14 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class GetWorkflowExecutionHistoryResponse { + private History history; + private List rawHistory; + private byte[] nextPageToken; + private boolean archived; +} diff --git a/src/gen/java/com/uber/cadence/Header.java b/src/gen/java/com/uber/cadence/Header.java new file mode 100644 index 000000000..f7d7c9e99 --- /dev/null +++ b/src/gen/java/com/uber/cadence/Header.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class Header { + private Map fields; +} diff --git a/src/gen/java/com/uber/cadence/History.java b/src/gen/java/com/uber/cadence/History.java new file mode 100644 index 000000000..57af7fd55 --- /dev/null +++ b/src/gen/java/com/uber/cadence/History.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class History { + private List events; +} diff --git a/src/gen/java/com/uber/cadence/HistoryBranch.java b/src/gen/java/com/uber/cadence/HistoryBranch.java new file mode 100644 index 000000000..12c3ade4e --- /dev/null +++ b/src/gen/java/com/uber/cadence/HistoryBranch.java @@ -0,0 +1,13 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class HistoryBranch { + private String treeID; + private String branchID; + private List ancestors; +} diff --git a/src/gen/java/com/uber/cadence/HistoryBranchRange.java b/src/gen/java/com/uber/cadence/HistoryBranchRange.java new file mode 100644 index 000000000..2814e2d1b --- /dev/null +++ b/src/gen/java/com/uber/cadence/HistoryBranchRange.java @@ -0,0 +1,13 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class HistoryBranchRange { + private String branchID; + private long beginNodeID; + private long endNodeID; +} diff --git a/src/gen/java/com/uber/cadence/HistoryEvent.java b/src/gen/java/com/uber/cadence/HistoryEvent.java new file mode 100644 index 000000000..c41af9480 --- /dev/null +++ b/src/gen/java/com/uber/cadence/HistoryEvent.java @@ -0,0 +1,73 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class HistoryEvent { + private long eventId; + private long timestamp; + private EventType eventType; + private long version; + private long taskId; + private WorkflowExecutionStartedEventAttributes workflowExecutionStartedEventAttributes; + private WorkflowExecutionCompletedEventAttributes workflowExecutionCompletedEventAttributes; + private WorkflowExecutionFailedEventAttributes workflowExecutionFailedEventAttributes; + private WorkflowExecutionTimedOutEventAttributes workflowExecutionTimedOutEventAttributes; + private DecisionTaskScheduledEventAttributes decisionTaskScheduledEventAttributes; + private DecisionTaskStartedEventAttributes decisionTaskStartedEventAttributes; + private DecisionTaskCompletedEventAttributes decisionTaskCompletedEventAttributes; + private DecisionTaskTimedOutEventAttributes decisionTaskTimedOutEventAttributes; + private DecisionTaskFailedEventAttributes decisionTaskFailedEventAttributes; + private ActivityTaskScheduledEventAttributes activityTaskScheduledEventAttributes; + private ActivityTaskStartedEventAttributes activityTaskStartedEventAttributes; + private ActivityTaskCompletedEventAttributes activityTaskCompletedEventAttributes; + private ActivityTaskFailedEventAttributes activityTaskFailedEventAttributes; + private ActivityTaskTimedOutEventAttributes activityTaskTimedOutEventAttributes; + private TimerStartedEventAttributes timerStartedEventAttributes; + private TimerFiredEventAttributes timerFiredEventAttributes; + private ActivityTaskCancelRequestedEventAttributes activityTaskCancelRequestedEventAttributes; + private RequestCancelActivityTaskFailedEventAttributes + requestCancelActivityTaskFailedEventAttributes; + private ActivityTaskCanceledEventAttributes activityTaskCanceledEventAttributes; + private TimerCanceledEventAttributes timerCanceledEventAttributes; + private CancelTimerFailedEventAttributes cancelTimerFailedEventAttributes; + private MarkerRecordedEventAttributes markerRecordedEventAttributes; + private WorkflowExecutionSignaledEventAttributes workflowExecutionSignaledEventAttributes; + private WorkflowExecutionTerminatedEventAttributes workflowExecutionTerminatedEventAttributes; + private WorkflowExecutionCancelRequestedEventAttributes + workflowExecutionCancelRequestedEventAttributes; + private WorkflowExecutionCanceledEventAttributes workflowExecutionCanceledEventAttributes; + private RequestCancelExternalWorkflowExecutionInitiatedEventAttributes + requestCancelExternalWorkflowExecutionInitiatedEventAttributes; + private RequestCancelExternalWorkflowExecutionFailedEventAttributes + requestCancelExternalWorkflowExecutionFailedEventAttributes; + private ExternalWorkflowExecutionCancelRequestedEventAttributes + externalWorkflowExecutionCancelRequestedEventAttributes; + private WorkflowExecutionContinuedAsNewEventAttributes + workflowExecutionContinuedAsNewEventAttributes; + private StartChildWorkflowExecutionInitiatedEventAttributes + startChildWorkflowExecutionInitiatedEventAttributes; + private StartChildWorkflowExecutionFailedEventAttributes + startChildWorkflowExecutionFailedEventAttributes; + private ChildWorkflowExecutionStartedEventAttributes childWorkflowExecutionStartedEventAttributes; + private ChildWorkflowExecutionCompletedEventAttributes + childWorkflowExecutionCompletedEventAttributes; + private ChildWorkflowExecutionFailedEventAttributes childWorkflowExecutionFailedEventAttributes; + private ChildWorkflowExecutionCanceledEventAttributes + childWorkflowExecutionCanceledEventAttributes; + private ChildWorkflowExecutionTimedOutEventAttributes + childWorkflowExecutionTimedOutEventAttributes; + private ChildWorkflowExecutionTerminatedEventAttributes + childWorkflowExecutionTerminatedEventAttributes; + private SignalExternalWorkflowExecutionInitiatedEventAttributes + signalExternalWorkflowExecutionInitiatedEventAttributes; + private SignalExternalWorkflowExecutionFailedEventAttributes + signalExternalWorkflowExecutionFailedEventAttributes; + private ExternalWorkflowExecutionSignaledEventAttributes + externalWorkflowExecutionSignaledEventAttributes; + private UpsertWorkflowSearchAttributesEventAttributes + upsertWorkflowSearchAttributesEventAttributes; +} diff --git a/src/gen/java/com/uber/cadence/HistoryEventFilterType.java b/src/gen/java/com/uber/cadence/HistoryEventFilterType.java new file mode 100644 index 000000000..0a98e0cd0 --- /dev/null +++ b/src/gen/java/com/uber/cadence/HistoryEventFilterType.java @@ -0,0 +1,6 @@ +package com.uber.cadence; + +public enum HistoryEventFilterType { + ALL_EVENT, + CLOSE_EVENT, +} diff --git a/src/gen/java/com/uber/cadence/IndexedValueType.java b/src/gen/java/com/uber/cadence/IndexedValueType.java new file mode 100644 index 000000000..bbc1585f4 --- /dev/null +++ b/src/gen/java/com/uber/cadence/IndexedValueType.java @@ -0,0 +1,10 @@ +package com.uber.cadence; + +public enum IndexedValueType { + STRING, + KEYWORD, + INT, + DOUBLE, + BOOL, + DATETIME, +} diff --git a/src/gen/java/com/uber/cadence/InternalDataInconsistencyError.java b/src/gen/java/com/uber/cadence/InternalDataInconsistencyError.java new file mode 100644 index 000000000..a8fa2f3df --- /dev/null +++ b/src/gen/java/com/uber/cadence/InternalDataInconsistencyError.java @@ -0,0 +1,24 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +@Getter +@Setter +@Accessors(chain = true) +public class InternalDataInconsistencyError extends BaseError { + + public InternalDataInconsistencyError() { + super(); + } + + public InternalDataInconsistencyError(String message, Throwable cause) { + super(message, cause); + } + + public InternalDataInconsistencyError(Throwable cause) { + super(cause); + } +} diff --git a/src/gen/java/com/uber/cadence/InternalServiceError.java b/src/gen/java/com/uber/cadence/InternalServiceError.java new file mode 100644 index 000000000..9725b0401 --- /dev/null +++ b/src/gen/java/com/uber/cadence/InternalServiceError.java @@ -0,0 +1,28 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +@Getter +@Setter +@Accessors(chain = true) +public class InternalServiceError extends BaseError { + + public InternalServiceError() { + super(); + } + + public InternalServiceError(String message) { + super(message); + } + + public InternalServiceError(String message, Throwable cause) { + super(message, cause); + } + + public InternalServiceError(Throwable cause) { + super(cause); + } +} diff --git a/src/gen/java/com/uber/cadence/IsolationGroupConfiguration.java b/src/gen/java/com/uber/cadence/IsolationGroupConfiguration.java new file mode 100644 index 000000000..40bb07973 --- /dev/null +++ b/src/gen/java/com/uber/cadence/IsolationGroupConfiguration.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class IsolationGroupConfiguration { + private List isolationGroups; +} diff --git a/src/gen/java/com/uber/cadence/IsolationGroupPartition.java b/src/gen/java/com/uber/cadence/IsolationGroupPartition.java new file mode 100644 index 000000000..44cdfa9cb --- /dev/null +++ b/src/gen/java/com/uber/cadence/IsolationGroupPartition.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class IsolationGroupPartition { + private String name; + private IsolationGroupState state; +} diff --git a/src/gen/java/com/uber/cadence/IsolationGroupState.java b/src/gen/java/com/uber/cadence/IsolationGroupState.java new file mode 100644 index 000000000..bab1f7ea5 --- /dev/null +++ b/src/gen/java/com/uber/cadence/IsolationGroupState.java @@ -0,0 +1,7 @@ +package com.uber.cadence; + +public enum IsolationGroupState { + INVALID, + HEALTHY, + DRAINED, +} diff --git a/src/gen/java/com/uber/cadence/LimitExceededError.java b/src/gen/java/com/uber/cadence/LimitExceededError.java new file mode 100644 index 000000000..9b4ea6cb4 --- /dev/null +++ b/src/gen/java/com/uber/cadence/LimitExceededError.java @@ -0,0 +1,24 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +@Getter +@Setter +@Accessors(chain = true) +public class LimitExceededError extends BaseError { + + public LimitExceededError() { + super(); + } + + public LimitExceededError(String message, Throwable cause) { + super(message, cause); + } + + public LimitExceededError(Throwable cause) { + super(cause); + } +} diff --git a/src/gen/java/com/uber/cadence/ListArchivedWorkflowExecutionsRequest.java b/src/gen/java/com/uber/cadence/ListArchivedWorkflowExecutionsRequest.java new file mode 100644 index 000000000..7b493ca75 --- /dev/null +++ b/src/gen/java/com/uber/cadence/ListArchivedWorkflowExecutionsRequest.java @@ -0,0 +1,14 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ListArchivedWorkflowExecutionsRequest { + private String domain; + private int pageSize; + private byte[] nextPageToken; + private String query; +} diff --git a/src/gen/java/com/uber/cadence/ListArchivedWorkflowExecutionsResponse.java b/src/gen/java/com/uber/cadence/ListArchivedWorkflowExecutionsResponse.java new file mode 100644 index 000000000..7ccfa1075 --- /dev/null +++ b/src/gen/java/com/uber/cadence/ListArchivedWorkflowExecutionsResponse.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ListArchivedWorkflowExecutionsResponse { + private List executions; + private byte[] nextPageToken; +} diff --git a/src/gen/java/com/uber/cadence/ListClosedWorkflowExecutionsRequest.java b/src/gen/java/com/uber/cadence/ListClosedWorkflowExecutionsRequest.java new file mode 100644 index 000000000..aa0e87855 --- /dev/null +++ b/src/gen/java/com/uber/cadence/ListClosedWorkflowExecutionsRequest.java @@ -0,0 +1,17 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ListClosedWorkflowExecutionsRequest { + private String domain; + private int maximumPageSize; + private byte[] nextPageToken; + private StartTimeFilter StartTimeFilter; + private WorkflowExecutionFilter executionFilter; + private WorkflowTypeFilter typeFilter; + private WorkflowExecutionCloseStatus statusFilter; +} diff --git a/src/gen/java/com/uber/cadence/ListClosedWorkflowExecutionsResponse.java b/src/gen/java/com/uber/cadence/ListClosedWorkflowExecutionsResponse.java new file mode 100644 index 000000000..7b9aa1752 --- /dev/null +++ b/src/gen/java/com/uber/cadence/ListClosedWorkflowExecutionsResponse.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ListClosedWorkflowExecutionsResponse { + private List executions; + private byte[] nextPageToken; +} diff --git a/src/gen/java/com/uber/cadence/ListDomainsRequest.java b/src/gen/java/com/uber/cadence/ListDomainsRequest.java new file mode 100644 index 000000000..0c7730f4d --- /dev/null +++ b/src/gen/java/com/uber/cadence/ListDomainsRequest.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ListDomainsRequest { + private int pageSize; + private byte[] nextPageToken; +} diff --git a/src/gen/java/com/uber/cadence/ListDomainsResponse.java b/src/gen/java/com/uber/cadence/ListDomainsResponse.java new file mode 100644 index 000000000..399dd2401 --- /dev/null +++ b/src/gen/java/com/uber/cadence/ListDomainsResponse.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ListDomainsResponse { + private List domains; + private byte[] nextPageToken; +} diff --git a/src/gen/java/com/uber/cadence/ListOpenWorkflowExecutionsRequest.java b/src/gen/java/com/uber/cadence/ListOpenWorkflowExecutionsRequest.java new file mode 100644 index 000000000..74e264255 --- /dev/null +++ b/src/gen/java/com/uber/cadence/ListOpenWorkflowExecutionsRequest.java @@ -0,0 +1,16 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ListOpenWorkflowExecutionsRequest { + private String domain; + private int maximumPageSize; + private byte[] nextPageToken; + private StartTimeFilter StartTimeFilter; + private WorkflowExecutionFilter executionFilter; + private WorkflowTypeFilter typeFilter; +} diff --git a/src/gen/java/com/uber/cadence/ListOpenWorkflowExecutionsResponse.java b/src/gen/java/com/uber/cadence/ListOpenWorkflowExecutionsResponse.java new file mode 100644 index 000000000..4877d9f32 --- /dev/null +++ b/src/gen/java/com/uber/cadence/ListOpenWorkflowExecutionsResponse.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ListOpenWorkflowExecutionsResponse { + private List executions; + private byte[] nextPageToken; +} diff --git a/src/gen/java/com/uber/cadence/ListTaskListPartitionsRequest.java b/src/gen/java/com/uber/cadence/ListTaskListPartitionsRequest.java new file mode 100644 index 000000000..77dc5d221 --- /dev/null +++ b/src/gen/java/com/uber/cadence/ListTaskListPartitionsRequest.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ListTaskListPartitionsRequest { + private String domain; + private TaskList taskList; +} diff --git a/src/gen/java/com/uber/cadence/ListTaskListPartitionsResponse.java b/src/gen/java/com/uber/cadence/ListTaskListPartitionsResponse.java new file mode 100644 index 000000000..09cc67233 --- /dev/null +++ b/src/gen/java/com/uber/cadence/ListTaskListPartitionsResponse.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ListTaskListPartitionsResponse { + private List activityTaskListPartitions; + private List decisionTaskListPartitions; +} diff --git a/src/gen/java/com/uber/cadence/ListWorkflowExecutionsRequest.java b/src/gen/java/com/uber/cadence/ListWorkflowExecutionsRequest.java new file mode 100644 index 000000000..714847698 --- /dev/null +++ b/src/gen/java/com/uber/cadence/ListWorkflowExecutionsRequest.java @@ -0,0 +1,14 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ListWorkflowExecutionsRequest { + private String domain; + private int pageSize; + private byte[] nextPageToken; + private String query; +} diff --git a/src/gen/java/com/uber/cadence/ListWorkflowExecutionsResponse.java b/src/gen/java/com/uber/cadence/ListWorkflowExecutionsResponse.java new file mode 100644 index 000000000..ecc2eb46e --- /dev/null +++ b/src/gen/java/com/uber/cadence/ListWorkflowExecutionsResponse.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ListWorkflowExecutionsResponse { + private List executions; + private byte[] nextPageToken; +} diff --git a/src/gen/java/com/uber/cadence/MarkerRecordedEventAttributes.java b/src/gen/java/com/uber/cadence/MarkerRecordedEventAttributes.java new file mode 100644 index 000000000..02005f7f6 --- /dev/null +++ b/src/gen/java/com/uber/cadence/MarkerRecordedEventAttributes.java @@ -0,0 +1,14 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class MarkerRecordedEventAttributes { + private String markerName; + private byte[] details; + private long decisionTaskCompletedEventId; + private Header header; +} diff --git a/src/gen/java/com/uber/cadence/Memo.java b/src/gen/java/com/uber/cadence/Memo.java new file mode 100644 index 000000000..e109857cc --- /dev/null +++ b/src/gen/java/com/uber/cadence/Memo.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class Memo { + private Map fields; +} diff --git a/src/gen/java/com/uber/cadence/ParentClosePolicy.java b/src/gen/java/com/uber/cadence/ParentClosePolicy.java new file mode 100644 index 000000000..5f98519f2 --- /dev/null +++ b/src/gen/java/com/uber/cadence/ParentClosePolicy.java @@ -0,0 +1,7 @@ +package com.uber.cadence; + +public enum ParentClosePolicy { + ABANDON, + REQUEST_CANCEL, + TERMINATE, +} diff --git a/src/gen/java/com/uber/cadence/PendingActivityInfo.java b/src/gen/java/com/uber/cadence/PendingActivityInfo.java new file mode 100644 index 000000000..6630d823d --- /dev/null +++ b/src/gen/java/com/uber/cadence/PendingActivityInfo.java @@ -0,0 +1,24 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class PendingActivityInfo { + private String activityID; + private ActivityType activityType; + private PendingActivityState state; + private byte[] heartbeatDetails; + private long lastHeartbeatTimestamp; + private long lastStartedTimestamp; + private int attempt; + private int maximumAttempts; + private long scheduledTimestamp; + private long expirationTimestamp; + private String lastFailureReason; + private String lastWorkerIdentity; + private byte[] lastFailureDetails; + private String startedWorkerIdentity; +} diff --git a/src/gen/java/com/uber/cadence/PendingActivityState.java b/src/gen/java/com/uber/cadence/PendingActivityState.java new file mode 100644 index 000000000..2a0ebd2fc --- /dev/null +++ b/src/gen/java/com/uber/cadence/PendingActivityState.java @@ -0,0 +1,7 @@ +package com.uber.cadence; + +public enum PendingActivityState { + SCHEDULED, + STARTED, + CANCEL_REQUESTED, +} diff --git a/src/gen/java/com/uber/cadence/PendingChildExecutionInfo.java b/src/gen/java/com/uber/cadence/PendingChildExecutionInfo.java new file mode 100644 index 000000000..41e4db18c --- /dev/null +++ b/src/gen/java/com/uber/cadence/PendingChildExecutionInfo.java @@ -0,0 +1,16 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class PendingChildExecutionInfo { + private String domain; + private String workflowID; + private String runID; + private String workflowTypName; + private long initiatedID; + private ParentClosePolicy parentClosePolicy; +} diff --git a/src/gen/java/com/uber/cadence/PendingDecisionInfo.java b/src/gen/java/com/uber/cadence/PendingDecisionInfo.java new file mode 100644 index 000000000..51a0147ec --- /dev/null +++ b/src/gen/java/com/uber/cadence/PendingDecisionInfo.java @@ -0,0 +1,15 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class PendingDecisionInfo { + private PendingDecisionState state; + private long scheduledTimestamp; + private long startedTimestamp; + private long attempt; + private long originalScheduledTimestamp; +} diff --git a/src/gen/java/com/uber/cadence/PendingDecisionState.java b/src/gen/java/com/uber/cadence/PendingDecisionState.java new file mode 100644 index 000000000..0f21f49b7 --- /dev/null +++ b/src/gen/java/com/uber/cadence/PendingDecisionState.java @@ -0,0 +1,6 @@ +package com.uber.cadence; + +public enum PendingDecisionState { + SCHEDULED, + STARTED, +} diff --git a/src/gen/java/com/uber/cadence/PollForActivityTaskRequest.java b/src/gen/java/com/uber/cadence/PollForActivityTaskRequest.java new file mode 100644 index 000000000..55bc38424 --- /dev/null +++ b/src/gen/java/com/uber/cadence/PollForActivityTaskRequest.java @@ -0,0 +1,14 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class PollForActivityTaskRequest { + private String domain; + private TaskList taskList; + private String identity; + private TaskListMetadata taskListMetadata; +} diff --git a/src/gen/java/com/uber/cadence/PollForActivityTaskResponse.java b/src/gen/java/com/uber/cadence/PollForActivityTaskResponse.java new file mode 100644 index 000000000..6947afc6e --- /dev/null +++ b/src/gen/java/com/uber/cadence/PollForActivityTaskResponse.java @@ -0,0 +1,26 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class PollForActivityTaskResponse { + private byte[] taskToken; + private WorkflowExecution workflowExecution; + private String activityId; + private ActivityType activityType; + private byte[] input; + private long scheduledTimestamp; + private int scheduleToCloseTimeoutSeconds; + private long startedTimestamp; + private int startToCloseTimeoutSeconds; + private int heartbeatTimeoutSeconds; + private int attempt; + private long scheduledTimestampOfThisAttempt; + private byte[] heartbeatDetails; + private WorkflowType workflowType; + private String workflowDomain; + private Header header; +} diff --git a/src/gen/java/com/uber/cadence/PollForDecisionTaskRequest.java b/src/gen/java/com/uber/cadence/PollForDecisionTaskRequest.java new file mode 100644 index 000000000..e51aca829 --- /dev/null +++ b/src/gen/java/com/uber/cadence/PollForDecisionTaskRequest.java @@ -0,0 +1,14 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class PollForDecisionTaskRequest { + private String domain; + private TaskList taskList; + private String identity; + private String binaryChecksum; +} diff --git a/src/gen/java/com/uber/cadence/PollForDecisionTaskResponse.java b/src/gen/java/com/uber/cadence/PollForDecisionTaskResponse.java new file mode 100644 index 000000000..b04272694 --- /dev/null +++ b/src/gen/java/com/uber/cadence/PollForDecisionTaskResponse.java @@ -0,0 +1,26 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class PollForDecisionTaskResponse { + private byte[] taskToken; + private WorkflowExecution workflowExecution; + private WorkflowType workflowType; + private long previousStartedEventId; + private long startedEventId; + private long attempt; + private long backlogCountHint; + private History history; + private byte[] nextPageToken; + private WorkflowQuery query; + private TaskList WorkflowExecutionTaskList; + private long scheduledTimestamp; + private long startedTimestamp; + private Map queries; + private long nextEventId; + private long totalHistoryBytes; +} diff --git a/src/gen/java/com/uber/cadence/PollerInfo.java b/src/gen/java/com/uber/cadence/PollerInfo.java new file mode 100644 index 000000000..50a39d1c9 --- /dev/null +++ b/src/gen/java/com/uber/cadence/PollerInfo.java @@ -0,0 +1,13 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class PollerInfo { + private long lastAccessTime; + private String identity; + private double ratePerSecond; +} diff --git a/src/gen/java/com/uber/cadence/QueryConsistencyLevel.java b/src/gen/java/com/uber/cadence/QueryConsistencyLevel.java new file mode 100644 index 000000000..f358d6ba6 --- /dev/null +++ b/src/gen/java/com/uber/cadence/QueryConsistencyLevel.java @@ -0,0 +1,6 @@ +package com.uber.cadence; + +public enum QueryConsistencyLevel { + EVENTUAL, + STRONG, +} diff --git a/src/gen/java/com/uber/cadence/QueryFailedError.java b/src/gen/java/com/uber/cadence/QueryFailedError.java new file mode 100644 index 000000000..5140ae554 --- /dev/null +++ b/src/gen/java/com/uber/cadence/QueryFailedError.java @@ -0,0 +1,28 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +@Getter +@Setter +@Accessors(chain = true) +public class QueryFailedError extends BaseError { + + public QueryFailedError() { + super(); + } + + public QueryFailedError(String message) { + super(message); + } + + public QueryFailedError(String message, Throwable cause) { + super(message, cause); + } + + public QueryFailedError(Throwable cause) { + super(cause); + } +} diff --git a/src/gen/java/com/uber/cadence/QueryRejectCondition.java b/src/gen/java/com/uber/cadence/QueryRejectCondition.java new file mode 100644 index 000000000..451449ce5 --- /dev/null +++ b/src/gen/java/com/uber/cadence/QueryRejectCondition.java @@ -0,0 +1,6 @@ +package com.uber.cadence; + +public enum QueryRejectCondition { + NOT_OPEN, + NOT_COMPLETED_CLEANLY, +} diff --git a/src/gen/java/com/uber/cadence/QueryRejected.java b/src/gen/java/com/uber/cadence/QueryRejected.java new file mode 100644 index 000000000..209ae72aa --- /dev/null +++ b/src/gen/java/com/uber/cadence/QueryRejected.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class QueryRejected { + private WorkflowExecutionCloseStatus closeStatus; +} diff --git a/src/gen/java/com/uber/cadence/QueryResultType.java b/src/gen/java/com/uber/cadence/QueryResultType.java new file mode 100644 index 000000000..72b451d0f --- /dev/null +++ b/src/gen/java/com/uber/cadence/QueryResultType.java @@ -0,0 +1,6 @@ +package com.uber.cadence; + +public enum QueryResultType { + ANSWERED, + FAILED, +} diff --git a/src/gen/java/com/uber/cadence/QueryTaskCompletedType.java b/src/gen/java/com/uber/cadence/QueryTaskCompletedType.java new file mode 100644 index 000000000..59b5d008f --- /dev/null +++ b/src/gen/java/com/uber/cadence/QueryTaskCompletedType.java @@ -0,0 +1,6 @@ +package com.uber.cadence; + +public enum QueryTaskCompletedType { + COMPLETED, + FAILED, +} diff --git a/src/gen/java/com/uber/cadence/QueryWorkflowRequest.java b/src/gen/java/com/uber/cadence/QueryWorkflowRequest.java new file mode 100644 index 000000000..a3fd7070a --- /dev/null +++ b/src/gen/java/com/uber/cadence/QueryWorkflowRequest.java @@ -0,0 +1,15 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class QueryWorkflowRequest { + private String domain; + private WorkflowExecution execution; + private WorkflowQuery query; + private QueryRejectCondition queryRejectCondition; + private QueryConsistencyLevel queryConsistencyLevel; +} diff --git a/src/gen/java/com/uber/cadence/QueryWorkflowResponse.java b/src/gen/java/com/uber/cadence/QueryWorkflowResponse.java new file mode 100644 index 000000000..202fbf533 --- /dev/null +++ b/src/gen/java/com/uber/cadence/QueryWorkflowResponse.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class QueryWorkflowResponse { + private byte[] queryResult; + private QueryRejected queryRejected; +} diff --git a/src/gen/java/com/uber/cadence/ReapplyEventsRequest.java b/src/gen/java/com/uber/cadence/ReapplyEventsRequest.java new file mode 100644 index 000000000..a285f0946 --- /dev/null +++ b/src/gen/java/com/uber/cadence/ReapplyEventsRequest.java @@ -0,0 +1,13 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ReapplyEventsRequest { + private String domainName; + private WorkflowExecution workflowExecution; + private DataBlob events; +} diff --git a/src/gen/java/com/uber/cadence/RecordActivityTaskHeartbeatByIDRequest.java b/src/gen/java/com/uber/cadence/RecordActivityTaskHeartbeatByIDRequest.java new file mode 100644 index 000000000..6590faa99 --- /dev/null +++ b/src/gen/java/com/uber/cadence/RecordActivityTaskHeartbeatByIDRequest.java @@ -0,0 +1,16 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class RecordActivityTaskHeartbeatByIDRequest { + private String domain; + private String workflowID; + private String runID; + private String activityID; + private byte[] details; + private String identity; +} diff --git a/src/gen/java/com/uber/cadence/RecordActivityTaskHeartbeatRequest.java b/src/gen/java/com/uber/cadence/RecordActivityTaskHeartbeatRequest.java new file mode 100644 index 000000000..8b1a99ca0 --- /dev/null +++ b/src/gen/java/com/uber/cadence/RecordActivityTaskHeartbeatRequest.java @@ -0,0 +1,13 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class RecordActivityTaskHeartbeatRequest { + private byte[] taskToken; + private byte[] details; + private String identity; +} diff --git a/src/gen/java/com/uber/cadence/RecordActivityTaskHeartbeatResponse.java b/src/gen/java/com/uber/cadence/RecordActivityTaskHeartbeatResponse.java new file mode 100644 index 000000000..acc2dcbbb --- /dev/null +++ b/src/gen/java/com/uber/cadence/RecordActivityTaskHeartbeatResponse.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class RecordActivityTaskHeartbeatResponse { + private boolean cancelRequested; +} diff --git a/src/gen/java/com/uber/cadence/RecordMarkerDecisionAttributes.java b/src/gen/java/com/uber/cadence/RecordMarkerDecisionAttributes.java new file mode 100644 index 000000000..a35b74d7a --- /dev/null +++ b/src/gen/java/com/uber/cadence/RecordMarkerDecisionAttributes.java @@ -0,0 +1,13 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class RecordMarkerDecisionAttributes { + private String markerName; + private byte[] details; + private Header header; +} diff --git a/src/gen/java/com/uber/cadence/RefreshWorkflowTasksRequest.java b/src/gen/java/com/uber/cadence/RefreshWorkflowTasksRequest.java new file mode 100644 index 000000000..68ab1c045 --- /dev/null +++ b/src/gen/java/com/uber/cadence/RefreshWorkflowTasksRequest.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class RefreshWorkflowTasksRequest { + private String domain; + private WorkflowExecution execution; +} diff --git a/src/gen/java/com/uber/cadence/RegisterDomainRequest.java b/src/gen/java/com/uber/cadence/RegisterDomainRequest.java new file mode 100644 index 000000000..36d0b1093 --- /dev/null +++ b/src/gen/java/com/uber/cadence/RegisterDomainRequest.java @@ -0,0 +1,24 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class RegisterDomainRequest { + private String name; + private String description; + private String ownerEmail; + private int workflowExecutionRetentionPeriodInDays; + private boolean emitMetric; + private List clusters; + private String activeClusterName; + private Map data; + private String securityToken; + private boolean isGlobalDomain; + private ArchivalStatus historyArchivalStatus; + private String historyArchivalURI; + private ArchivalStatus visibilityArchivalStatus; + private String visibilityArchivalURI; +} diff --git a/src/gen/java/com/uber/cadence/RemoteSyncMatchedError.java b/src/gen/java/com/uber/cadence/RemoteSyncMatchedError.java new file mode 100644 index 000000000..67da8de6c --- /dev/null +++ b/src/gen/java/com/uber/cadence/RemoteSyncMatchedError.java @@ -0,0 +1,24 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +@Getter +@Setter +@Accessors(chain = true) +public class RemoteSyncMatchedError extends BaseError { + + public RemoteSyncMatchedError() { + super(); + } + + public RemoteSyncMatchedError(String message, Throwable cause) { + super(message, cause); + } + + public RemoteSyncMatchedError(Throwable cause) { + super(cause); + } +} diff --git a/src/gen/java/com/uber/cadence/RemoveTaskRequest.java b/src/gen/java/com/uber/cadence/RemoveTaskRequest.java new file mode 100644 index 000000000..797ba2a99 --- /dev/null +++ b/src/gen/java/com/uber/cadence/RemoveTaskRequest.java @@ -0,0 +1,15 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class RemoveTaskRequest { + private int shardID; + private int type; + private long taskID; + private long visibilityTimestamp; + private String clusterName; +} diff --git a/src/gen/java/com/uber/cadence/RequestCancelActivityTaskDecisionAttributes.java b/src/gen/java/com/uber/cadence/RequestCancelActivityTaskDecisionAttributes.java new file mode 100644 index 000000000..d57be8e9b --- /dev/null +++ b/src/gen/java/com/uber/cadence/RequestCancelActivityTaskDecisionAttributes.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class RequestCancelActivityTaskDecisionAttributes { + private String activityId; +} diff --git a/src/gen/java/com/uber/cadence/RequestCancelActivityTaskFailedEventAttributes.java b/src/gen/java/com/uber/cadence/RequestCancelActivityTaskFailedEventAttributes.java new file mode 100644 index 000000000..5eb765acb --- /dev/null +++ b/src/gen/java/com/uber/cadence/RequestCancelActivityTaskFailedEventAttributes.java @@ -0,0 +1,13 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class RequestCancelActivityTaskFailedEventAttributes { + private String activityId; + private String cause; + private long decisionTaskCompletedEventId; +} diff --git a/src/gen/java/com/uber/cadence/RequestCancelExternalWorkflowExecutionDecisionAttributes.java b/src/gen/java/com/uber/cadence/RequestCancelExternalWorkflowExecutionDecisionAttributes.java new file mode 100644 index 000000000..2f89cb82f --- /dev/null +++ b/src/gen/java/com/uber/cadence/RequestCancelExternalWorkflowExecutionDecisionAttributes.java @@ -0,0 +1,15 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class RequestCancelExternalWorkflowExecutionDecisionAttributes { + private String domain; + private String workflowId; + private String runId; + private byte[] control; + private boolean childWorkflowOnly; +} diff --git a/src/gen/java/com/uber/cadence/RequestCancelExternalWorkflowExecutionFailedEventAttributes.java b/src/gen/java/com/uber/cadence/RequestCancelExternalWorkflowExecutionFailedEventAttributes.java new file mode 100644 index 000000000..9395e1518 --- /dev/null +++ b/src/gen/java/com/uber/cadence/RequestCancelExternalWorkflowExecutionFailedEventAttributes.java @@ -0,0 +1,16 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class RequestCancelExternalWorkflowExecutionFailedEventAttributes { + private CancelExternalWorkflowExecutionFailedCause cause; + private long decisionTaskCompletedEventId; + private String domain; + private WorkflowExecution workflowExecution; + private long initiatedEventId; + private byte[] control; +} diff --git a/src/gen/java/com/uber/cadence/RequestCancelExternalWorkflowExecutionInitiatedEventAttributes.java b/src/gen/java/com/uber/cadence/RequestCancelExternalWorkflowExecutionInitiatedEventAttributes.java new file mode 100644 index 000000000..01be14954 --- /dev/null +++ b/src/gen/java/com/uber/cadence/RequestCancelExternalWorkflowExecutionInitiatedEventAttributes.java @@ -0,0 +1,15 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class RequestCancelExternalWorkflowExecutionInitiatedEventAttributes { + private long decisionTaskCompletedEventId; + private String domain; + private WorkflowExecution workflowExecution; + private byte[] control; + private boolean childWorkflowOnly; +} diff --git a/src/gen/java/com/uber/cadence/RequestCancelWorkflowExecutionRequest.java b/src/gen/java/com/uber/cadence/RequestCancelWorkflowExecutionRequest.java new file mode 100644 index 000000000..1301762f2 --- /dev/null +++ b/src/gen/java/com/uber/cadence/RequestCancelWorkflowExecutionRequest.java @@ -0,0 +1,16 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class RequestCancelWorkflowExecutionRequest { + private String domain; + private WorkflowExecution workflowExecution; + private String identity; + private String requestId; + private String cause; + private String firstExecutionRunID; +} diff --git a/src/gen/java/com/uber/cadence/ResetPointInfo.java b/src/gen/java/com/uber/cadence/ResetPointInfo.java new file mode 100644 index 000000000..07a1a1fd8 --- /dev/null +++ b/src/gen/java/com/uber/cadence/ResetPointInfo.java @@ -0,0 +1,16 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ResetPointInfo { + private String binaryChecksum; + private String runId; + private long firstDecisionCompletedId; + private long createdTimeNano; + private long expiringTimeNano; + private boolean resettable; +} diff --git a/src/gen/java/com/uber/cadence/ResetPoints.java b/src/gen/java/com/uber/cadence/ResetPoints.java new file mode 100644 index 000000000..e01d21b61 --- /dev/null +++ b/src/gen/java/com/uber/cadence/ResetPoints.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ResetPoints { + private List points; +} diff --git a/src/gen/java/com/uber/cadence/ResetQueueRequest.java b/src/gen/java/com/uber/cadence/ResetQueueRequest.java new file mode 100644 index 000000000..869b3acb7 --- /dev/null +++ b/src/gen/java/com/uber/cadence/ResetQueueRequest.java @@ -0,0 +1,13 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ResetQueueRequest { + private int shardID; + private String clusterName; + private int type; +} diff --git a/src/gen/java/com/uber/cadence/ResetStickyTaskListRequest.java b/src/gen/java/com/uber/cadence/ResetStickyTaskListRequest.java new file mode 100644 index 000000000..0af64412f --- /dev/null +++ b/src/gen/java/com/uber/cadence/ResetStickyTaskListRequest.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ResetStickyTaskListRequest { + private String domain; + private WorkflowExecution execution; +} diff --git a/src/gen/java/com/uber/cadence/ResetStickyTaskListResponse.java b/src/gen/java/com/uber/cadence/ResetStickyTaskListResponse.java new file mode 100644 index 000000000..82a991059 --- /dev/null +++ b/src/gen/java/com/uber/cadence/ResetStickyTaskListResponse.java @@ -0,0 +1,9 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ResetStickyTaskListResponse {} diff --git a/src/gen/java/com/uber/cadence/ResetWorkflowExecutionRequest.java b/src/gen/java/com/uber/cadence/ResetWorkflowExecutionRequest.java new file mode 100644 index 000000000..69351faa6 --- /dev/null +++ b/src/gen/java/com/uber/cadence/ResetWorkflowExecutionRequest.java @@ -0,0 +1,16 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ResetWorkflowExecutionRequest { + private String domain; + private WorkflowExecution workflowExecution; + private String reason; + private long decisionFinishEventId; + private String requestId; + private boolean skipSignalReapply; +} diff --git a/src/gen/java/com/uber/cadence/ResetWorkflowExecutionResponse.java b/src/gen/java/com/uber/cadence/ResetWorkflowExecutionResponse.java new file mode 100644 index 000000000..524a3f4c1 --- /dev/null +++ b/src/gen/java/com/uber/cadence/ResetWorkflowExecutionResponse.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ResetWorkflowExecutionResponse { + private String runId; +} diff --git a/src/gen/java/com/uber/cadence/RespondActivityTaskCanceledByIDRequest.java b/src/gen/java/com/uber/cadence/RespondActivityTaskCanceledByIDRequest.java new file mode 100644 index 000000000..d13e3a183 --- /dev/null +++ b/src/gen/java/com/uber/cadence/RespondActivityTaskCanceledByIDRequest.java @@ -0,0 +1,16 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class RespondActivityTaskCanceledByIDRequest { + private String domain; + private String workflowID; + private String runID; + private String activityID; + private byte[] details; + private String identity; +} diff --git a/src/gen/java/com/uber/cadence/RespondActivityTaskCanceledRequest.java b/src/gen/java/com/uber/cadence/RespondActivityTaskCanceledRequest.java new file mode 100644 index 000000000..cf868b19d --- /dev/null +++ b/src/gen/java/com/uber/cadence/RespondActivityTaskCanceledRequest.java @@ -0,0 +1,13 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class RespondActivityTaskCanceledRequest { + private byte[] taskToken; + private byte[] details; + private String identity; +} diff --git a/src/gen/java/com/uber/cadence/RespondActivityTaskCompletedByIDRequest.java b/src/gen/java/com/uber/cadence/RespondActivityTaskCompletedByIDRequest.java new file mode 100644 index 000000000..c6bfb8320 --- /dev/null +++ b/src/gen/java/com/uber/cadence/RespondActivityTaskCompletedByIDRequest.java @@ -0,0 +1,16 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class RespondActivityTaskCompletedByIDRequest { + private String domain; + private String workflowID; + private String runID; + private String activityID; + private byte[] result; + private String identity; +} diff --git a/src/gen/java/com/uber/cadence/RespondActivityTaskCompletedRequest.java b/src/gen/java/com/uber/cadence/RespondActivityTaskCompletedRequest.java new file mode 100644 index 000000000..d03ed99b2 --- /dev/null +++ b/src/gen/java/com/uber/cadence/RespondActivityTaskCompletedRequest.java @@ -0,0 +1,13 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class RespondActivityTaskCompletedRequest { + private byte[] taskToken; + private byte[] result; + private String identity; +} diff --git a/src/gen/java/com/uber/cadence/RespondActivityTaskFailedByIDRequest.java b/src/gen/java/com/uber/cadence/RespondActivityTaskFailedByIDRequest.java new file mode 100644 index 000000000..eff5711cb --- /dev/null +++ b/src/gen/java/com/uber/cadence/RespondActivityTaskFailedByIDRequest.java @@ -0,0 +1,17 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class RespondActivityTaskFailedByIDRequest { + private String domain; + private String workflowID; + private String runID; + private String activityID; + private String reason; + private byte[] details; + private String identity; +} diff --git a/src/gen/java/com/uber/cadence/RespondActivityTaskFailedRequest.java b/src/gen/java/com/uber/cadence/RespondActivityTaskFailedRequest.java new file mode 100644 index 000000000..f3ae7d6ba --- /dev/null +++ b/src/gen/java/com/uber/cadence/RespondActivityTaskFailedRequest.java @@ -0,0 +1,14 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class RespondActivityTaskFailedRequest { + private byte[] taskToken; + private String reason; + private byte[] details; + private String identity; +} diff --git a/src/gen/java/com/uber/cadence/RespondCrossClusterTasksCompletedRequest.java b/src/gen/java/com/uber/cadence/RespondCrossClusterTasksCompletedRequest.java new file mode 100644 index 000000000..f366f9406 --- /dev/null +++ b/src/gen/java/com/uber/cadence/RespondCrossClusterTasksCompletedRequest.java @@ -0,0 +1,14 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class RespondCrossClusterTasksCompletedRequest { + private int shardID; + private String targetCluster; + private List taskResponses; + private boolean fetchNewTasks; +} diff --git a/src/gen/java/com/uber/cadence/RespondCrossClusterTasksCompletedResponse.java b/src/gen/java/com/uber/cadence/RespondCrossClusterTasksCompletedResponse.java new file mode 100644 index 000000000..0d53f65e6 --- /dev/null +++ b/src/gen/java/com/uber/cadence/RespondCrossClusterTasksCompletedResponse.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class RespondCrossClusterTasksCompletedResponse { + private List tasks; +} diff --git a/src/gen/java/com/uber/cadence/RespondDecisionTaskCompletedRequest.java b/src/gen/java/com/uber/cadence/RespondDecisionTaskCompletedRequest.java new file mode 100644 index 000000000..523b6a162 --- /dev/null +++ b/src/gen/java/com/uber/cadence/RespondDecisionTaskCompletedRequest.java @@ -0,0 +1,19 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class RespondDecisionTaskCompletedRequest { + private byte[] taskToken; + private List decisions; + private byte[] executionContext; + private String identity; + private StickyExecutionAttributes stickyAttributes; + private boolean returnNewDecisionTask; + private boolean forceCreateNewDecisionTask; + private String binaryChecksum; + private Map queryResults; +} diff --git a/src/gen/java/com/uber/cadence/RespondDecisionTaskCompletedResponse.java b/src/gen/java/com/uber/cadence/RespondDecisionTaskCompletedResponse.java new file mode 100644 index 000000000..b787abd71 --- /dev/null +++ b/src/gen/java/com/uber/cadence/RespondDecisionTaskCompletedResponse.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class RespondDecisionTaskCompletedResponse { + private PollForDecisionTaskResponse decisionTask; + private Map activitiesToDispatchLocally; +} diff --git a/src/gen/java/com/uber/cadence/RespondDecisionTaskFailedRequest.java b/src/gen/java/com/uber/cadence/RespondDecisionTaskFailedRequest.java new file mode 100644 index 000000000..6c9cb643a --- /dev/null +++ b/src/gen/java/com/uber/cadence/RespondDecisionTaskFailedRequest.java @@ -0,0 +1,15 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class RespondDecisionTaskFailedRequest { + private byte[] taskToken; + private DecisionTaskFailedCause cause; + private byte[] details; + private String identity; + private String binaryChecksum; +} diff --git a/src/gen/java/com/uber/cadence/RespondQueryTaskCompletedRequest.java b/src/gen/java/com/uber/cadence/RespondQueryTaskCompletedRequest.java new file mode 100644 index 000000000..82c334f05 --- /dev/null +++ b/src/gen/java/com/uber/cadence/RespondQueryTaskCompletedRequest.java @@ -0,0 +1,15 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class RespondQueryTaskCompletedRequest { + private byte[] taskToken; + private QueryTaskCompletedType completedType; + private byte[] queryResult; + private String errorMessage; + private WorkerVersionInfo workerVersionInfo; +} diff --git a/src/gen/java/com/uber/cadence/RestartWorkflowExecutionRequest.java b/src/gen/java/com/uber/cadence/RestartWorkflowExecutionRequest.java new file mode 100644 index 000000000..22811127e --- /dev/null +++ b/src/gen/java/com/uber/cadence/RestartWorkflowExecutionRequest.java @@ -0,0 +1,14 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class RestartWorkflowExecutionRequest { + private String domain; + private WorkflowExecution workflowExecution; + private String reason; + private String identity; +} diff --git a/src/gen/java/com/uber/cadence/RestartWorkflowExecutionResponse.java b/src/gen/java/com/uber/cadence/RestartWorkflowExecutionResponse.java new file mode 100644 index 000000000..0cc94c67b --- /dev/null +++ b/src/gen/java/com/uber/cadence/RestartWorkflowExecutionResponse.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class RestartWorkflowExecutionResponse { + private String runId; +} diff --git a/src/gen/java/com/uber/cadence/RetryPolicy.java b/src/gen/java/com/uber/cadence/RetryPolicy.java new file mode 100644 index 000000000..6ab4fde6f --- /dev/null +++ b/src/gen/java/com/uber/cadence/RetryPolicy.java @@ -0,0 +1,16 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class RetryPolicy { + private int initialIntervalInSeconds; + private double backoffCoefficient; + private int maximumIntervalInSeconds; + private int maximumAttempts; + private List nonRetriableErrorReasons; + private int expirationIntervalInSeconds; +} diff --git a/src/gen/java/com/uber/cadence/RetryTaskV2Error.java b/src/gen/java/com/uber/cadence/RetryTaskV2Error.java new file mode 100644 index 000000000..d3e86288b --- /dev/null +++ b/src/gen/java/com/uber/cadence/RetryTaskV2Error.java @@ -0,0 +1,33 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +@Getter +@Setter +@Accessors(chain = true) +@AllArgsConstructor +public class RetryTaskV2Error extends BaseError { + private String domainId; + private String workflowId; + private String runId; + private long startEventId; + private long startEventVersion; + private long endEventId; + private long endEventVersion; + + public RetryTaskV2Error() { + super(); + } + + public RetryTaskV2Error(String message, Throwable cause) { + super(message, cause); + } + + public RetryTaskV2Error(Throwable cause) { + super(cause); + } +} diff --git a/src/gen/java/com/uber/cadence/ScheduleActivityTaskDecisionAttributes.java b/src/gen/java/com/uber/cadence/ScheduleActivityTaskDecisionAttributes.java new file mode 100644 index 000000000..c69cabbb1 --- /dev/null +++ b/src/gen/java/com/uber/cadence/ScheduleActivityTaskDecisionAttributes.java @@ -0,0 +1,22 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ScheduleActivityTaskDecisionAttributes { + private String activityId; + private ActivityType activityType; + private String domain; + private TaskList taskList; + private byte[] input; + private int scheduleToCloseTimeoutSeconds; + private int scheduleToStartTimeoutSeconds; + private int startToCloseTimeoutSeconds; + private int heartbeatTimeoutSeconds; + private RetryPolicy retryPolicy; + private Header header; + private boolean requestLocalDispatch; +} diff --git a/src/gen/java/com/uber/cadence/SearchAttributes.java b/src/gen/java/com/uber/cadence/SearchAttributes.java new file mode 100644 index 000000000..6356fc62d --- /dev/null +++ b/src/gen/java/com/uber/cadence/SearchAttributes.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class SearchAttributes { + private Map indexedFields; +} diff --git a/src/gen/java/com/uber/cadence/ServiceBusyError.java b/src/gen/java/com/uber/cadence/ServiceBusyError.java new file mode 100644 index 000000000..4002bdb3a --- /dev/null +++ b/src/gen/java/com/uber/cadence/ServiceBusyError.java @@ -0,0 +1,27 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +@Getter +@Setter +@Accessors(chain = true) +@AllArgsConstructor +public class ServiceBusyError extends BaseError { + private String reason; + + public ServiceBusyError() { + super(); + } + + public ServiceBusyError(String message, Throwable cause) { + super(message, cause); + } + + public ServiceBusyError(Throwable cause) { + super(cause); + } +} diff --git a/src/gen/java/com/uber/cadence/SignalExternalWorkflowExecutionDecisionAttributes.java b/src/gen/java/com/uber/cadence/SignalExternalWorkflowExecutionDecisionAttributes.java new file mode 100644 index 000000000..98fb1872e --- /dev/null +++ b/src/gen/java/com/uber/cadence/SignalExternalWorkflowExecutionDecisionAttributes.java @@ -0,0 +1,16 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class SignalExternalWorkflowExecutionDecisionAttributes { + private String domain; + private WorkflowExecution execution; + private String signalName; + private byte[] input; + private byte[] control; + private boolean childWorkflowOnly; +} diff --git a/src/gen/java/com/uber/cadence/SignalExternalWorkflowExecutionFailedCause.java b/src/gen/java/com/uber/cadence/SignalExternalWorkflowExecutionFailedCause.java new file mode 100644 index 000000000..e3f0f3bf0 --- /dev/null +++ b/src/gen/java/com/uber/cadence/SignalExternalWorkflowExecutionFailedCause.java @@ -0,0 +1,6 @@ +package com.uber.cadence; + +public enum SignalExternalWorkflowExecutionFailedCause { + UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION, + WORKFLOW_ALREADY_COMPLETED, +} diff --git a/src/gen/java/com/uber/cadence/SignalExternalWorkflowExecutionFailedEventAttributes.java b/src/gen/java/com/uber/cadence/SignalExternalWorkflowExecutionFailedEventAttributes.java new file mode 100644 index 000000000..40d0ec1b6 --- /dev/null +++ b/src/gen/java/com/uber/cadence/SignalExternalWorkflowExecutionFailedEventAttributes.java @@ -0,0 +1,16 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class SignalExternalWorkflowExecutionFailedEventAttributes { + private SignalExternalWorkflowExecutionFailedCause cause; + private long decisionTaskCompletedEventId; + private String domain; + private WorkflowExecution workflowExecution; + private long initiatedEventId; + private byte[] control; +} diff --git a/src/gen/java/com/uber/cadence/SignalExternalWorkflowExecutionInitiatedEventAttributes.java b/src/gen/java/com/uber/cadence/SignalExternalWorkflowExecutionInitiatedEventAttributes.java new file mode 100644 index 000000000..c9b9c8533 --- /dev/null +++ b/src/gen/java/com/uber/cadence/SignalExternalWorkflowExecutionInitiatedEventAttributes.java @@ -0,0 +1,17 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class SignalExternalWorkflowExecutionInitiatedEventAttributes { + private long decisionTaskCompletedEventId; + private String domain; + private WorkflowExecution workflowExecution; + private String signalName; + private byte[] input; + private byte[] control; + private boolean childWorkflowOnly; +} diff --git a/src/gen/java/com/uber/cadence/SignalWithStartWorkflowExecutionAsyncRequest.java b/src/gen/java/com/uber/cadence/SignalWithStartWorkflowExecutionAsyncRequest.java new file mode 100644 index 000000000..d945df3db --- /dev/null +++ b/src/gen/java/com/uber/cadence/SignalWithStartWorkflowExecutionAsyncRequest.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class SignalWithStartWorkflowExecutionAsyncRequest { + private SignalWithStartWorkflowExecutionRequest request; +} diff --git a/src/gen/java/com/uber/cadence/SignalWithStartWorkflowExecutionAsyncResponse.java b/src/gen/java/com/uber/cadence/SignalWithStartWorkflowExecutionAsyncResponse.java new file mode 100644 index 000000000..d55055256 --- /dev/null +++ b/src/gen/java/com/uber/cadence/SignalWithStartWorkflowExecutionAsyncResponse.java @@ -0,0 +1,9 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class SignalWithStartWorkflowExecutionAsyncResponse {} diff --git a/src/gen/java/com/uber/cadence/SignalWithStartWorkflowExecutionRequest.java b/src/gen/java/com/uber/cadence/SignalWithStartWorkflowExecutionRequest.java new file mode 100644 index 000000000..0a386051f --- /dev/null +++ b/src/gen/java/com/uber/cadence/SignalWithStartWorkflowExecutionRequest.java @@ -0,0 +1,30 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class SignalWithStartWorkflowExecutionRequest { + private String domain; + private String workflowId; + private WorkflowType workflowType; + private TaskList taskList; + private byte[] input; + private int executionStartToCloseTimeoutSeconds; + private int taskStartToCloseTimeoutSeconds; + private String identity; + private String requestId; + private WorkflowIdReusePolicy workflowIdReusePolicy; + private String signalName; + private byte[] signalInput; + private byte[] control; + private RetryPolicy retryPolicy; + private String cronSchedule; + private Memo memo; + private SearchAttributes searchAttributes; + private Header header; + private int delayStartSeconds; + private int jitterStartSeconds; +} diff --git a/src/gen/java/com/uber/cadence/SignalWorkflowExecutionRequest.java b/src/gen/java/com/uber/cadence/SignalWorkflowExecutionRequest.java new file mode 100644 index 000000000..135606f36 --- /dev/null +++ b/src/gen/java/com/uber/cadence/SignalWorkflowExecutionRequest.java @@ -0,0 +1,17 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class SignalWorkflowExecutionRequest { + private String domain; + private WorkflowExecution workflowExecution; + private String signalName; + private byte[] input; + private String identity; + private String requestId; + private byte[] control; +} diff --git a/src/gen/java/com/uber/cadence/StartChildWorkflowExecutionDecisionAttributes.java b/src/gen/java/com/uber/cadence/StartChildWorkflowExecutionDecisionAttributes.java new file mode 100644 index 000000000..0bc40c6f4 --- /dev/null +++ b/src/gen/java/com/uber/cadence/StartChildWorkflowExecutionDecisionAttributes.java @@ -0,0 +1,25 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class StartChildWorkflowExecutionDecisionAttributes { + private String domain; + private String workflowId; + private WorkflowType workflowType; + private TaskList taskList; + private byte[] input; + private int executionStartToCloseTimeoutSeconds; + private int taskStartToCloseTimeoutSeconds; + private ParentClosePolicy parentClosePolicy; + private byte[] control; + private WorkflowIdReusePolicy workflowIdReusePolicy; + private RetryPolicy retryPolicy; + private String cronSchedule; + private Header header; + private Memo memo; + private SearchAttributes searchAttributes; +} diff --git a/src/gen/java/com/uber/cadence/StartChildWorkflowExecutionFailedEventAttributes.java b/src/gen/java/com/uber/cadence/StartChildWorkflowExecutionFailedEventAttributes.java new file mode 100644 index 000000000..141580d52 --- /dev/null +++ b/src/gen/java/com/uber/cadence/StartChildWorkflowExecutionFailedEventAttributes.java @@ -0,0 +1,17 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class StartChildWorkflowExecutionFailedEventAttributes { + private String domain; + private String workflowId; + private WorkflowType workflowType; + private ChildWorkflowExecutionFailedCause cause; + private byte[] control; + private long initiatedEventId; + private long decisionTaskCompletedEventId; +} diff --git a/src/gen/java/com/uber/cadence/StartChildWorkflowExecutionInitiatedEventAttributes.java b/src/gen/java/com/uber/cadence/StartChildWorkflowExecutionInitiatedEventAttributes.java new file mode 100644 index 000000000..8a11d7cbd --- /dev/null +++ b/src/gen/java/com/uber/cadence/StartChildWorkflowExecutionInitiatedEventAttributes.java @@ -0,0 +1,28 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class StartChildWorkflowExecutionInitiatedEventAttributes { + private String domain; + private String workflowId; + private WorkflowType workflowType; + private TaskList taskList; + private byte[] input; + private int executionStartToCloseTimeoutSeconds; + private int taskStartToCloseTimeoutSeconds; + private ParentClosePolicy parentClosePolicy; + private byte[] control; + private long decisionTaskCompletedEventId; + private WorkflowIdReusePolicy workflowIdReusePolicy; + private RetryPolicy retryPolicy; + private String cronSchedule; + private Header header; + private Memo memo; + private SearchAttributes searchAttributes; + private int delayStartSeconds; + private int jitterStartSeconds; +} diff --git a/src/gen/java/com/uber/cadence/StartTimeFilter.java b/src/gen/java/com/uber/cadence/StartTimeFilter.java new file mode 100644 index 000000000..55fa4d4c5 --- /dev/null +++ b/src/gen/java/com/uber/cadence/StartTimeFilter.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class StartTimeFilter { + private long earliestTime; + private long latestTime; +} diff --git a/src/gen/java/com/uber/cadence/StartTimerDecisionAttributes.java b/src/gen/java/com/uber/cadence/StartTimerDecisionAttributes.java new file mode 100644 index 000000000..9589bcc5f --- /dev/null +++ b/src/gen/java/com/uber/cadence/StartTimerDecisionAttributes.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class StartTimerDecisionAttributes { + private String timerId; + private long startToFireTimeoutSeconds; +} diff --git a/src/gen/java/com/uber/cadence/StartWorkflowExecutionAsyncRequest.java b/src/gen/java/com/uber/cadence/StartWorkflowExecutionAsyncRequest.java new file mode 100644 index 000000000..fe667ab96 --- /dev/null +++ b/src/gen/java/com/uber/cadence/StartWorkflowExecutionAsyncRequest.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class StartWorkflowExecutionAsyncRequest { + private StartWorkflowExecutionRequest request; +} diff --git a/src/gen/java/com/uber/cadence/StartWorkflowExecutionAsyncResponse.java b/src/gen/java/com/uber/cadence/StartWorkflowExecutionAsyncResponse.java new file mode 100644 index 000000000..a4e21fb01 --- /dev/null +++ b/src/gen/java/com/uber/cadence/StartWorkflowExecutionAsyncResponse.java @@ -0,0 +1,9 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class StartWorkflowExecutionAsyncResponse {} diff --git a/src/gen/java/com/uber/cadence/StartWorkflowExecutionRequest.java b/src/gen/java/com/uber/cadence/StartWorkflowExecutionRequest.java new file mode 100644 index 000000000..214f8b6ae --- /dev/null +++ b/src/gen/java/com/uber/cadence/StartWorkflowExecutionRequest.java @@ -0,0 +1,27 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class StartWorkflowExecutionRequest { + private String domain; + private String workflowId; + private WorkflowType workflowType; + private TaskList taskList; + private byte[] input; + private int executionStartToCloseTimeoutSeconds; + private int taskStartToCloseTimeoutSeconds; + private String identity; + private String requestId; + private WorkflowIdReusePolicy workflowIdReusePolicy; + private RetryPolicy retryPolicy; + private String cronSchedule; + private Memo memo; + private SearchAttributes searchAttributes; + private Header header; + private int delayStartSeconds; + private int jitterStartSeconds; +} diff --git a/src/gen/java/com/uber/cadence/StartWorkflowExecutionResponse.java b/src/gen/java/com/uber/cadence/StartWorkflowExecutionResponse.java new file mode 100644 index 000000000..26e5304b5 --- /dev/null +++ b/src/gen/java/com/uber/cadence/StartWorkflowExecutionResponse.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class StartWorkflowExecutionResponse { + private String runId; +} diff --git a/src/gen/java/com/uber/cadence/StickyExecutionAttributes.java b/src/gen/java/com/uber/cadence/StickyExecutionAttributes.java new file mode 100644 index 000000000..d94c003d8 --- /dev/null +++ b/src/gen/java/com/uber/cadence/StickyExecutionAttributes.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class StickyExecutionAttributes { + private TaskList workerTaskList; + private int scheduleToStartTimeoutSeconds; +} diff --git a/src/gen/java/com/uber/cadence/StickyWorkerUnavailableError.java b/src/gen/java/com/uber/cadence/StickyWorkerUnavailableError.java new file mode 100644 index 000000000..33b026542 --- /dev/null +++ b/src/gen/java/com/uber/cadence/StickyWorkerUnavailableError.java @@ -0,0 +1,24 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +@Getter +@Setter +@Accessors(chain = true) +public class StickyWorkerUnavailableError extends BaseError { + + public StickyWorkerUnavailableError() { + super(); + } + + public StickyWorkerUnavailableError(String message, Throwable cause) { + super(message, cause); + } + + public StickyWorkerUnavailableError(Throwable cause) { + super(cause); + } +} diff --git a/src/gen/java/com/uber/cadence/SupportedClientVersions.java b/src/gen/java/com/uber/cadence/SupportedClientVersions.java new file mode 100644 index 000000000..74779dea0 --- /dev/null +++ b/src/gen/java/com/uber/cadence/SupportedClientVersions.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class SupportedClientVersions { + private String goSdk; + private String javaSdk; +} diff --git a/src/gen/java/com/uber/cadence/TaskIDBlock.java b/src/gen/java/com/uber/cadence/TaskIDBlock.java new file mode 100644 index 000000000..e1fa49b78 --- /dev/null +++ b/src/gen/java/com/uber/cadence/TaskIDBlock.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class TaskIDBlock { + private long startID; + private long endID; +} diff --git a/src/gen/java/com/uber/cadence/TaskList.java b/src/gen/java/com/uber/cadence/TaskList.java new file mode 100644 index 000000000..3bc7afe5d --- /dev/null +++ b/src/gen/java/com/uber/cadence/TaskList.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class TaskList { + private String name; + private TaskListKind kind; +} diff --git a/src/gen/java/com/uber/cadence/TaskListKind.java b/src/gen/java/com/uber/cadence/TaskListKind.java new file mode 100644 index 000000000..4b8487578 --- /dev/null +++ b/src/gen/java/com/uber/cadence/TaskListKind.java @@ -0,0 +1,6 @@ +package com.uber.cadence; + +public enum TaskListKind { + NORMAL, + STICKY, +} diff --git a/src/gen/java/com/uber/cadence/TaskListMetadata.java b/src/gen/java/com/uber/cadence/TaskListMetadata.java new file mode 100644 index 000000000..5db6305b7 --- /dev/null +++ b/src/gen/java/com/uber/cadence/TaskListMetadata.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class TaskListMetadata { + private double maxTasksPerSecond; +} diff --git a/src/gen/java/com/uber/cadence/TaskListPartitionMetadata.java b/src/gen/java/com/uber/cadence/TaskListPartitionMetadata.java new file mode 100644 index 000000000..8a2bccdcb --- /dev/null +++ b/src/gen/java/com/uber/cadence/TaskListPartitionMetadata.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class TaskListPartitionMetadata { + private String key; + private String ownerHostName; +} diff --git a/src/gen/java/com/uber/cadence/TaskListStatus.java b/src/gen/java/com/uber/cadence/TaskListStatus.java new file mode 100644 index 000000000..5926f58d8 --- /dev/null +++ b/src/gen/java/com/uber/cadence/TaskListStatus.java @@ -0,0 +1,15 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class TaskListStatus { + private long backlogCountHint; + private long readLevel; + private long ackLevel; + private double ratePerSecond; + private TaskIDBlock taskIDBlock; +} diff --git a/src/gen/java/com/uber/cadence/TaskListType.java b/src/gen/java/com/uber/cadence/TaskListType.java new file mode 100644 index 000000000..281c33ef6 --- /dev/null +++ b/src/gen/java/com/uber/cadence/TaskListType.java @@ -0,0 +1,6 @@ +package com.uber.cadence; + +public enum TaskListType { + Decision, + Activity, +} diff --git a/src/gen/java/com/uber/cadence/TerminateWorkflowExecutionRequest.java b/src/gen/java/com/uber/cadence/TerminateWorkflowExecutionRequest.java new file mode 100644 index 000000000..290ce14fe --- /dev/null +++ b/src/gen/java/com/uber/cadence/TerminateWorkflowExecutionRequest.java @@ -0,0 +1,16 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class TerminateWorkflowExecutionRequest { + private String domain; + private WorkflowExecution workflowExecution; + private String reason; + private byte[] details; + private String identity; + private String firstExecutionRunID; +} diff --git a/src/gen/java/com/uber/cadence/TimeoutType.java b/src/gen/java/com/uber/cadence/TimeoutType.java new file mode 100644 index 000000000..634d621be --- /dev/null +++ b/src/gen/java/com/uber/cadence/TimeoutType.java @@ -0,0 +1,8 @@ +package com.uber.cadence; + +public enum TimeoutType { + START_TO_CLOSE, + SCHEDULE_TO_START, + SCHEDULE_TO_CLOSE, + HEARTBEAT, +} diff --git a/src/gen/java/com/uber/cadence/TimerCanceledEventAttributes.java b/src/gen/java/com/uber/cadence/TimerCanceledEventAttributes.java new file mode 100644 index 000000000..e9f8c8f8b --- /dev/null +++ b/src/gen/java/com/uber/cadence/TimerCanceledEventAttributes.java @@ -0,0 +1,14 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class TimerCanceledEventAttributes { + private String timerId; + private long startedEventId; + private long decisionTaskCompletedEventId; + private String identity; +} diff --git a/src/gen/java/com/uber/cadence/TimerFiredEventAttributes.java b/src/gen/java/com/uber/cadence/TimerFiredEventAttributes.java new file mode 100644 index 000000000..ac611ce27 --- /dev/null +++ b/src/gen/java/com/uber/cadence/TimerFiredEventAttributes.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class TimerFiredEventAttributes { + private String timerId; + private long startedEventId; +} diff --git a/src/gen/java/com/uber/cadence/TimerStartedEventAttributes.java b/src/gen/java/com/uber/cadence/TimerStartedEventAttributes.java new file mode 100644 index 000000000..41e90e8ed --- /dev/null +++ b/src/gen/java/com/uber/cadence/TimerStartedEventAttributes.java @@ -0,0 +1,13 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class TimerStartedEventAttributes { + private String timerId; + private long startToFireTimeoutSeconds; + private long decisionTaskCompletedEventId; +} diff --git a/src/gen/java/com/uber/cadence/TransientDecisionInfo.java b/src/gen/java/com/uber/cadence/TransientDecisionInfo.java new file mode 100644 index 000000000..ba9fa5f99 --- /dev/null +++ b/src/gen/java/com/uber/cadence/TransientDecisionInfo.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class TransientDecisionInfo { + private HistoryEvent scheduledEvent; + private HistoryEvent startedEvent; +} diff --git a/src/gen/java/com/uber/cadence/UpdateDomainInfo.java b/src/gen/java/com/uber/cadence/UpdateDomainInfo.java new file mode 100644 index 000000000..805932fa7 --- /dev/null +++ b/src/gen/java/com/uber/cadence/UpdateDomainInfo.java @@ -0,0 +1,13 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class UpdateDomainInfo { + private String description; + private String ownerEmail; + private Map data; +} diff --git a/src/gen/java/com/uber/cadence/UpdateDomainRequest.java b/src/gen/java/com/uber/cadence/UpdateDomainRequest.java new file mode 100644 index 000000000..7605f5d4c --- /dev/null +++ b/src/gen/java/com/uber/cadence/UpdateDomainRequest.java @@ -0,0 +1,17 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class UpdateDomainRequest { + private String name; + private UpdateDomainInfo updatedInfo; + private DomainConfiguration configuration; + private DomainReplicationConfiguration replicationConfiguration; + private String securityToken; + private String deleteBadBinary; + private int failoverTimeoutInSeconds; +} diff --git a/src/gen/java/com/uber/cadence/UpdateDomainResponse.java b/src/gen/java/com/uber/cadence/UpdateDomainResponse.java new file mode 100644 index 000000000..af44ad460 --- /dev/null +++ b/src/gen/java/com/uber/cadence/UpdateDomainResponse.java @@ -0,0 +1,15 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class UpdateDomainResponse { + private DomainInfo domainInfo; + private DomainConfiguration configuration; + private DomainReplicationConfiguration replicationConfiguration; + private long failoverVersion; + private boolean isGlobalDomain; +} diff --git a/src/gen/java/com/uber/cadence/UpsertWorkflowSearchAttributesDecisionAttributes.java b/src/gen/java/com/uber/cadence/UpsertWorkflowSearchAttributesDecisionAttributes.java new file mode 100644 index 000000000..69111102b --- /dev/null +++ b/src/gen/java/com/uber/cadence/UpsertWorkflowSearchAttributesDecisionAttributes.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class UpsertWorkflowSearchAttributesDecisionAttributes { + private SearchAttributes searchAttributes; +} diff --git a/src/gen/java/com/uber/cadence/UpsertWorkflowSearchAttributesEventAttributes.java b/src/gen/java/com/uber/cadence/UpsertWorkflowSearchAttributesEventAttributes.java new file mode 100644 index 000000000..cce65d833 --- /dev/null +++ b/src/gen/java/com/uber/cadence/UpsertWorkflowSearchAttributesEventAttributes.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class UpsertWorkflowSearchAttributesEventAttributes { + private long decisionTaskCompletedEventId; + private SearchAttributes searchAttributes; +} diff --git a/src/gen/java/com/uber/cadence/VersionHistories.java b/src/gen/java/com/uber/cadence/VersionHistories.java new file mode 100644 index 000000000..f213a88d1 --- /dev/null +++ b/src/gen/java/com/uber/cadence/VersionHistories.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class VersionHistories { + private int currentVersionHistoryIndex; + private List histories; +} diff --git a/src/gen/java/com/uber/cadence/VersionHistory.java b/src/gen/java/com/uber/cadence/VersionHistory.java new file mode 100644 index 000000000..84612a4d3 --- /dev/null +++ b/src/gen/java/com/uber/cadence/VersionHistory.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class VersionHistory { + private byte[] branchToken; + private List items; +} diff --git a/src/gen/java/com/uber/cadence/VersionHistoryItem.java b/src/gen/java/com/uber/cadence/VersionHistoryItem.java new file mode 100644 index 000000000..c71a0bc2b --- /dev/null +++ b/src/gen/java/com/uber/cadence/VersionHistoryItem.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class VersionHistoryItem { + private long eventID; + private long version; +} diff --git a/src/gen/java/com/uber/cadence/WorkerVersionInfo.java b/src/gen/java/com/uber/cadence/WorkerVersionInfo.java new file mode 100644 index 000000000..b86c9cc3c --- /dev/null +++ b/src/gen/java/com/uber/cadence/WorkerVersionInfo.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class WorkerVersionInfo { + private String impl; + private String featureVersion; +} diff --git a/src/gen/java/com/uber/cadence/WorkflowExecution.java b/src/gen/java/com/uber/cadence/WorkflowExecution.java new file mode 100644 index 000000000..e1871e1ab --- /dev/null +++ b/src/gen/java/com/uber/cadence/WorkflowExecution.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class WorkflowExecution { + private String workflowId; + private String runId; +} diff --git a/src/gen/java/com/uber/cadence/WorkflowExecutionAlreadyCompletedError.java b/src/gen/java/com/uber/cadence/WorkflowExecutionAlreadyCompletedError.java new file mode 100644 index 000000000..3e7146ff0 --- /dev/null +++ b/src/gen/java/com/uber/cadence/WorkflowExecutionAlreadyCompletedError.java @@ -0,0 +1,28 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +@Getter +@Setter +@Accessors(chain = true) +public class WorkflowExecutionAlreadyCompletedError extends BaseError { + + public WorkflowExecutionAlreadyCompletedError() { + super(); + } + + public WorkflowExecutionAlreadyCompletedError(String message) { + super(message); + } + + public WorkflowExecutionAlreadyCompletedError(String message, Throwable cause) { + super(message, cause); + } + + public WorkflowExecutionAlreadyCompletedError(Throwable cause) { + super(cause); + } +} diff --git a/src/gen/java/com/uber/cadence/WorkflowExecutionAlreadyStartedError.java b/src/gen/java/com/uber/cadence/WorkflowExecutionAlreadyStartedError.java new file mode 100644 index 000000000..55f97bccb --- /dev/null +++ b/src/gen/java/com/uber/cadence/WorkflowExecutionAlreadyStartedError.java @@ -0,0 +1,32 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +@Getter +@Setter +@Accessors(chain = true) +@AllArgsConstructor +public class WorkflowExecutionAlreadyStartedError extends BaseError { + private String startRequestId; + private String runId; + + public WorkflowExecutionAlreadyStartedError() { + super(); + } + + public WorkflowExecutionAlreadyStartedError(String message) { + super(message); + } + + public WorkflowExecutionAlreadyStartedError(String message, Throwable cause) { + super(message, cause); + } + + public WorkflowExecutionAlreadyStartedError(Throwable cause) { + super(cause); + } +} diff --git a/src/gen/java/com/uber/cadence/WorkflowExecutionCancelRequestedEventAttributes.java b/src/gen/java/com/uber/cadence/WorkflowExecutionCancelRequestedEventAttributes.java new file mode 100644 index 000000000..9aee03cbb --- /dev/null +++ b/src/gen/java/com/uber/cadence/WorkflowExecutionCancelRequestedEventAttributes.java @@ -0,0 +1,15 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class WorkflowExecutionCancelRequestedEventAttributes { + private String cause; + private long externalInitiatedEventId; + private WorkflowExecution externalWorkflowExecution; + private String identity; + private String requestId; +} diff --git a/src/gen/java/com/uber/cadence/WorkflowExecutionCanceledEventAttributes.java b/src/gen/java/com/uber/cadence/WorkflowExecutionCanceledEventAttributes.java new file mode 100644 index 000000000..04f1453a2 --- /dev/null +++ b/src/gen/java/com/uber/cadence/WorkflowExecutionCanceledEventAttributes.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class WorkflowExecutionCanceledEventAttributes { + private long decisionTaskCompletedEventId; + private byte[] details; +} diff --git a/src/gen/java/com/uber/cadence/WorkflowExecutionCloseStatus.java b/src/gen/java/com/uber/cadence/WorkflowExecutionCloseStatus.java new file mode 100644 index 000000000..487b50fdb --- /dev/null +++ b/src/gen/java/com/uber/cadence/WorkflowExecutionCloseStatus.java @@ -0,0 +1,10 @@ +package com.uber.cadence; + +public enum WorkflowExecutionCloseStatus { + COMPLETED, + FAILED, + CANCELED, + TERMINATED, + CONTINUED_AS_NEW, + TIMED_OUT, +} diff --git a/src/gen/java/com/uber/cadence/WorkflowExecutionCompletedEventAttributes.java b/src/gen/java/com/uber/cadence/WorkflowExecutionCompletedEventAttributes.java new file mode 100644 index 000000000..1dc699ebe --- /dev/null +++ b/src/gen/java/com/uber/cadence/WorkflowExecutionCompletedEventAttributes.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class WorkflowExecutionCompletedEventAttributes { + private byte[] result; + private long decisionTaskCompletedEventId; +} diff --git a/src/gen/java/com/uber/cadence/WorkflowExecutionConfiguration.java b/src/gen/java/com/uber/cadence/WorkflowExecutionConfiguration.java new file mode 100644 index 000000000..532420450 --- /dev/null +++ b/src/gen/java/com/uber/cadence/WorkflowExecutionConfiguration.java @@ -0,0 +1,13 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class WorkflowExecutionConfiguration { + private TaskList taskList; + private int executionStartToCloseTimeoutSeconds; + private int taskStartToCloseTimeoutSeconds; +} diff --git a/src/gen/java/com/uber/cadence/WorkflowExecutionContinuedAsNewEventAttributes.java b/src/gen/java/com/uber/cadence/WorkflowExecutionContinuedAsNewEventAttributes.java new file mode 100644 index 000000000..613f0e3a8 --- /dev/null +++ b/src/gen/java/com/uber/cadence/WorkflowExecutionContinuedAsNewEventAttributes.java @@ -0,0 +1,25 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class WorkflowExecutionContinuedAsNewEventAttributes { + private String newExecutionRunId; + private WorkflowType workflowType; + private TaskList taskList; + private byte[] input; + private int executionStartToCloseTimeoutSeconds; + private int taskStartToCloseTimeoutSeconds; + private long decisionTaskCompletedEventId; + private int backoffStartIntervalInSeconds; + private ContinueAsNewInitiator initiator; + private String failureReason; + private byte[] failureDetails; + private byte[] lastCompletionResult; + private Header header; + private Memo memo; + private SearchAttributes searchAttributes; +} diff --git a/src/gen/java/com/uber/cadence/WorkflowExecutionFailedEventAttributes.java b/src/gen/java/com/uber/cadence/WorkflowExecutionFailedEventAttributes.java new file mode 100644 index 000000000..f5184103c --- /dev/null +++ b/src/gen/java/com/uber/cadence/WorkflowExecutionFailedEventAttributes.java @@ -0,0 +1,13 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class WorkflowExecutionFailedEventAttributes { + private String reason; + private byte[] details; + private long decisionTaskCompletedEventId; +} diff --git a/src/gen/java/com/uber/cadence/WorkflowExecutionFilter.java b/src/gen/java/com/uber/cadence/WorkflowExecutionFilter.java new file mode 100644 index 000000000..8f1b1592f --- /dev/null +++ b/src/gen/java/com/uber/cadence/WorkflowExecutionFilter.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class WorkflowExecutionFilter { + private String workflowId; + private String runId; +} diff --git a/src/gen/java/com/uber/cadence/WorkflowExecutionInfo.java b/src/gen/java/com/uber/cadence/WorkflowExecutionInfo.java new file mode 100644 index 000000000..a892afb59 --- /dev/null +++ b/src/gen/java/com/uber/cadence/WorkflowExecutionInfo.java @@ -0,0 +1,28 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class WorkflowExecutionInfo { + private WorkflowExecution execution; + private WorkflowType type; + private long startTime; + private long closeTime; + private WorkflowExecutionCloseStatus closeStatus; + private long historyLength; + private String parentDomainId; + private String parentDomainName; + private long parentInitatedId; + private WorkflowExecution parentExecution; + private long executionTime; + private Memo memo; + private SearchAttributes searchAttributes; + private ResetPoints autoResetPoints; + private String taskList; + private boolean isCron; + private long updateTime; + private Map partitionConfig; +} diff --git a/src/gen/java/com/uber/cadence/WorkflowExecutionSignaledEventAttributes.java b/src/gen/java/com/uber/cadence/WorkflowExecutionSignaledEventAttributes.java new file mode 100644 index 000000000..44caedff5 --- /dev/null +++ b/src/gen/java/com/uber/cadence/WorkflowExecutionSignaledEventAttributes.java @@ -0,0 +1,14 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class WorkflowExecutionSignaledEventAttributes { + private String signalName; + private byte[] input; + private String identity; + private String requestId; +} diff --git a/src/gen/java/com/uber/cadence/WorkflowExecutionStartedEventAttributes.java b/src/gen/java/com/uber/cadence/WorkflowExecutionStartedEventAttributes.java new file mode 100644 index 000000000..952bdd2e5 --- /dev/null +++ b/src/gen/java/com/uber/cadence/WorkflowExecutionStartedEventAttributes.java @@ -0,0 +1,38 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class WorkflowExecutionStartedEventAttributes { + private WorkflowType workflowType; + private String parentWorkflowDomain; + private WorkflowExecution parentWorkflowExecution; + private long parentInitiatedEventId; + private TaskList taskList; + private byte[] input; + private int executionStartToCloseTimeoutSeconds; + private int taskStartToCloseTimeoutSeconds; + private String continuedExecutionRunId; + private ContinueAsNewInitiator initiator; + private String continuedFailureReason; + private byte[] continuedFailureDetails; + private byte[] lastCompletionResult; + private String originalExecutionRunId; + private String identity; + private String firstExecutionRunId; + private long firstScheduledTimeNano; + private RetryPolicy retryPolicy; + private int attempt; + private long expirationTimestamp; + private String cronSchedule; + private int firstDecisionTaskBackoffSeconds; + private Memo memo; + private SearchAttributes searchAttributes; + private ResetPoints prevAutoResetPoints; + private Header header; + private Map partitionConfig; + private String requestId; +} diff --git a/src/gen/java/com/uber/cadence/WorkflowExecutionTerminatedEventAttributes.java b/src/gen/java/com/uber/cadence/WorkflowExecutionTerminatedEventAttributes.java new file mode 100644 index 000000000..e9c09a964 --- /dev/null +++ b/src/gen/java/com/uber/cadence/WorkflowExecutionTerminatedEventAttributes.java @@ -0,0 +1,13 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class WorkflowExecutionTerminatedEventAttributes { + private String reason; + private byte[] details; + private String identity; +} diff --git a/src/gen/java/com/uber/cadence/WorkflowExecutionTimedOutEventAttributes.java b/src/gen/java/com/uber/cadence/WorkflowExecutionTimedOutEventAttributes.java new file mode 100644 index 000000000..e4176d35c --- /dev/null +++ b/src/gen/java/com/uber/cadence/WorkflowExecutionTimedOutEventAttributes.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class WorkflowExecutionTimedOutEventAttributes { + private TimeoutType timeoutType; +} diff --git a/src/gen/java/com/uber/cadence/WorkflowIdReusePolicy.java b/src/gen/java/com/uber/cadence/WorkflowIdReusePolicy.java new file mode 100644 index 000000000..b9eb56e7c --- /dev/null +++ b/src/gen/java/com/uber/cadence/WorkflowIdReusePolicy.java @@ -0,0 +1,8 @@ +package com.uber.cadence; + +public enum WorkflowIdReusePolicy { + AllowDuplicateFailedOnly, + AllowDuplicate, + RejectDuplicate, + TerminateIfRunning, +} diff --git a/src/gen/java/com/uber/cadence/WorkflowQuery.java b/src/gen/java/com/uber/cadence/WorkflowQuery.java new file mode 100644 index 000000000..562c9f075 --- /dev/null +++ b/src/gen/java/com/uber/cadence/WorkflowQuery.java @@ -0,0 +1,12 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class WorkflowQuery { + private String queryType; + private byte[] queryArgs; +} diff --git a/src/gen/java/com/uber/cadence/WorkflowQueryResult.java b/src/gen/java/com/uber/cadence/WorkflowQueryResult.java new file mode 100644 index 000000000..9e38de5d9 --- /dev/null +++ b/src/gen/java/com/uber/cadence/WorkflowQueryResult.java @@ -0,0 +1,13 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class WorkflowQueryResult { + private QueryResultType resultType; + private byte[] answer; + private String errorMessage; +} diff --git a/src/gen/java/com/uber/cadence/WorkflowType.java b/src/gen/java/com/uber/cadence/WorkflowType.java new file mode 100644 index 000000000..ce3fd5457 --- /dev/null +++ b/src/gen/java/com/uber/cadence/WorkflowType.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class WorkflowType { + private String name; +} diff --git a/src/gen/java/com/uber/cadence/WorkflowTypeFilter.java b/src/gen/java/com/uber/cadence/WorkflowTypeFilter.java new file mode 100644 index 000000000..d1ded6343 --- /dev/null +++ b/src/gen/java/com/uber/cadence/WorkflowTypeFilter.java @@ -0,0 +1,11 @@ +package com.uber.cadence; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class WorkflowTypeFilter { + private String name; +} diff --git a/src/gen/java/com/uber/cadence/shadower/Constants.java b/src/gen/java/com/uber/cadence/shadower/Constants.java new file mode 100644 index 000000000..d3596d21c --- /dev/null +++ b/src/gen/java/com/uber/cadence/shadower/Constants.java @@ -0,0 +1,12 @@ +package com.uber.cadence.shadower; + +public class Constants { + public static final String LocalDomainName = "cadence-shadower"; + public static final String TaskList = "cadence-shadower-tl"; + public static final String WorkflowName = "cadence-shadow-workflow"; + public static final String ScanWorkflowActivityName = "scanWorkflowActivity"; + public static final String ReplayWorkflowActivityName = "replayWorkflowActivity"; + public static final String WorkflowIDSuffix = "-shadow-workflow"; + public static final String ErrNonRetryableType = + "com.uber.cadence.internal.shadowing.NonRetryableException"; +} diff --git a/src/gen/java/com/uber/cadence/shadower/ExitCondition.java b/src/gen/java/com/uber/cadence/shadower/ExitCondition.java new file mode 100644 index 000000000..6da57ee76 --- /dev/null +++ b/src/gen/java/com/uber/cadence/shadower/ExitCondition.java @@ -0,0 +1,12 @@ +package com.uber.cadence.shadower; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ExitCondition { + private int expirationIntervalInSeconds; + private int shadowCount; +} diff --git a/src/gen/java/com/uber/cadence/shadower/Mode.java b/src/gen/java/com/uber/cadence/shadower/Mode.java new file mode 100644 index 000000000..295a4301f --- /dev/null +++ b/src/gen/java/com/uber/cadence/shadower/Mode.java @@ -0,0 +1,6 @@ +package com.uber.cadence.shadower; + +public enum Mode { + Normal, + Continuous, +} diff --git a/src/gen/java/com/uber/cadence/shadower/ReplayWorkflowActivityParams.java b/src/gen/java/com/uber/cadence/shadower/ReplayWorkflowActivityParams.java new file mode 100644 index 000000000..f5c113fba --- /dev/null +++ b/src/gen/java/com/uber/cadence/shadower/ReplayWorkflowActivityParams.java @@ -0,0 +1,13 @@ +package com.uber.cadence.shadower; + +import com.uber.cadence.WorkflowExecution; +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ReplayWorkflowActivityParams { + private String domain; + private List executions; +} diff --git a/src/gen/java/com/uber/cadence/shadower/ReplayWorkflowActivityResult.java b/src/gen/java/com/uber/cadence/shadower/ReplayWorkflowActivityResult.java new file mode 100644 index 000000000..497e27075 --- /dev/null +++ b/src/gen/java/com/uber/cadence/shadower/ReplayWorkflowActivityResult.java @@ -0,0 +1,13 @@ +package com.uber.cadence.shadower; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ReplayWorkflowActivityResult { + private int succeeded; + private int skipped; + private int failed; +} diff --git a/src/gen/java/com/uber/cadence/shadower/ScanWorkflowActivityParams.java b/src/gen/java/com/uber/cadence/shadower/ScanWorkflowActivityParams.java new file mode 100644 index 000000000..cd398f05a --- /dev/null +++ b/src/gen/java/com/uber/cadence/shadower/ScanWorkflowActivityParams.java @@ -0,0 +1,15 @@ +package com.uber.cadence.shadower; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ScanWorkflowActivityParams { + private String domain; + private String workflowQuery; + private byte[] nextPageToken; + private int pageSize; + private double samplingRate; +} diff --git a/src/gen/java/com/uber/cadence/shadower/ScanWorkflowActivityResult.java b/src/gen/java/com/uber/cadence/shadower/ScanWorkflowActivityResult.java new file mode 100644 index 000000000..58ffa491a --- /dev/null +++ b/src/gen/java/com/uber/cadence/shadower/ScanWorkflowActivityResult.java @@ -0,0 +1,13 @@ +package com.uber.cadence.shadower; + +import com.uber.cadence.WorkflowExecution; +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ScanWorkflowActivityResult { + private List executions; + private byte[] nextPageToken; +} diff --git a/src/gen/java/com/uber/cadence/shadower/WorkflowParams.java b/src/gen/java/com/uber/cadence/shadower/WorkflowParams.java new file mode 100644 index 000000000..7a219ef84 --- /dev/null +++ b/src/gen/java/com/uber/cadence/shadower/WorkflowParams.java @@ -0,0 +1,19 @@ +package com.uber.cadence.shadower; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class WorkflowParams { + private String domain; + private String taskList; + private String workflowQuery; + private byte[] nextPageToken; + private double samplingRate; + private Mode shadowMode; + private ExitCondition exitCondition; + private int concurrency; + private WorkflowResult lastRunResult; +} diff --git a/src/gen/java/com/uber/cadence/shadower/WorkflowResult.java b/src/gen/java/com/uber/cadence/shadower/WorkflowResult.java new file mode 100644 index 000000000..7f79f5908 --- /dev/null +++ b/src/gen/java/com/uber/cadence/shadower/WorkflowResult.java @@ -0,0 +1,13 @@ +package com.uber.cadence.shadower; + +import java.util.*; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class WorkflowResult { + private int succeeded; + private int skipped; + private int failed; +} diff --git a/src/main/java/com/uber/cadence/client/WorkflowClient.java b/src/main/java/com/uber/cadence/client/WorkflowClient.java index dffa3c7a9..f5d7df1c2 100644 --- a/src/main/java/com/uber/cadence/client/WorkflowClient.java +++ b/src/main/java/com/uber/cadence/client/WorkflowClient.java @@ -17,6 +17,7 @@ package com.uber.cadence.client; +import com.uber.cadence.BaseError; import com.uber.cadence.RefreshWorkflowTasksRequest; import com.uber.cadence.WorkflowExecution; import com.uber.cadence.activity.Activity; @@ -35,7 +36,6 @@ import com.uber.cadence.workflow.WorkflowMethod; import java.util.Optional; import java.util.concurrent.CompletableFuture; -import org.apache.thrift.TException; /** * Client to the Cadence service used to start and query workflows by external processes. Also it @@ -260,7 +260,7 @@ WorkflowStub newUntypedWorkflowStub( * @param refreshWorkflowTasksRequest that contains WorkflowID and RunID of the started workflow. */ void refreshWorkflowTasks(RefreshWorkflowTasksRequest refreshWorkflowTasksRequest) - throws TException; + throws BaseError; /** * Executes zero argument workflow with void return type diff --git a/src/main/java/com/uber/cadence/common/WorkflowExecutionHistory.java b/src/main/java/com/uber/cadence/common/WorkflowExecutionHistory.java index 30f27b187..751f80d05 100644 --- a/src/main/java/com/uber/cadence/common/WorkflowExecutionHistory.java +++ b/src/main/java/com/uber/cadence/common/WorkflowExecutionHistory.java @@ -32,7 +32,6 @@ import com.uber.cadence.HistoryEvent; import com.uber.cadence.WorkflowExecution; import java.lang.reflect.Type; -import java.nio.ByteBuffer; import java.util.Base64; import java.util.List; @@ -47,7 +46,7 @@ public WorkflowExecutionHistory(List events) { public static WorkflowExecutionHistory fromJson(String serialized) { GsonBuilder gsonBuilder = new GsonBuilder(); - gsonBuilder.registerTypeAdapter(ByteBuffer.class, new ByteBufferJsonDeserializer()); + gsonBuilder.registerTypeAdapter(byte[].class, new ByteArrayJsonDeserializer()); Gson gson = gsonBuilder.create(); Type eventsType = new TypeToken>() {}.getType(); List events = gson.fromJson(serialized, eventsType); @@ -85,21 +84,21 @@ public List getEvents() { return events; } - private static final class ByteBufferJsonDeserializer - implements JsonDeserializer, JsonSerializer { + private static final class ByteArrayJsonDeserializer + implements JsonDeserializer, JsonSerializer { @Override - public JsonElement serialize(ByteBuffer value, Type type, JsonSerializationContext ctx) { - if (value.arrayOffset() > 0) { - throw new IllegalArgumentException("non zero value array offset: " + value.arrayOffset()); + public JsonElement serialize(byte[] value, Type type, JsonSerializationContext ctx) { + if (value.length > 0) { + throw new IllegalArgumentException("non zero value array offset: " + value.length); } - return new JsonPrimitive(Base64.getEncoder().encodeToString(value.array())); + return new JsonPrimitive(Base64.getEncoder().encodeToString(value)); } @Override - public ByteBuffer deserialize(JsonElement e, Type type, JsonDeserializationContext ctx) + public byte[] deserialize(JsonElement e, Type type, JsonDeserializationContext ctx) throws JsonParseException { - return ByteBuffer.wrap(Base64.getDecoder().decode(e.getAsString())); + return Base64.getDecoder().decode(e.getAsString()); } } } diff --git a/src/main/java/com/uber/cadence/converter/JsonDataConverter.java b/src/main/java/com/uber/cadence/converter/JsonDataConverter.java index aed0c91e5..e3d89fdcb 100644 --- a/src/main/java/com/uber/cadence/converter/JsonDataConverter.java +++ b/src/main/java/com/uber/cadence/converter/JsonDataConverter.java @@ -33,12 +33,10 @@ import java.lang.reflect.Type; import java.nio.charset.StandardCharsets; import java.util.function.Function; -import org.apache.thrift.protocol.TJSONProtocol; /** * Implements conversion through GSON JSON processor. To extend use {@link - * #JsonDataConverter(Function)} constructor. Thrift structures are converted using {@link - * TJSONProtocol}. When using thrift only one argument of a method is expected. + * #JsonDataConverter(Function)} constructor. * * @author fateev */ diff --git a/src/main/java/com/uber/cadence/internal/common/InternalUtils.java b/src/main/java/com/uber/cadence/internal/common/InternalUtils.java index 520d8efbb..51c7cfabe 100644 --- a/src/main/java/com/uber/cadence/internal/common/InternalUtils.java +++ b/src/main/java/com/uber/cadence/internal/common/InternalUtils.java @@ -18,11 +18,6 @@ package com.uber.cadence.internal.common; import com.google.common.base.Defaults; -import com.google.common.collect.Lists; -import com.uber.cadence.DataBlob; -import com.uber.cadence.History; -import com.uber.cadence.HistoryEvent; -import com.uber.cadence.HistoryEventFilterType; import com.uber.cadence.Memo; import com.uber.cadence.SearchAttributes; import com.uber.cadence.TaskList; @@ -32,16 +27,10 @@ import com.uber.cadence.internal.worker.Shutdownable; import com.uber.cadence.workflow.WorkflowMethod; import java.lang.reflect.Method; -import java.nio.ByteBuffer; -import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; -import org.apache.thrift.TDeserializer; -import org.apache.thrift.TException; -import org.apache.thrift.TSerializer; /** Utility functions shared by the implementation code. */ public final class InternalUtils { @@ -145,10 +134,10 @@ public static Object getValueOrDefault(Object value, Class valueClass) { public static Memo convertMapToMemo(Map memo) { DataConverter converter = JsonDataConverter.getInstance(); - Map mapOfByteBuffer = new HashMap<>(); + Map mapOfByteBuffer = new HashMap<>(); memo.forEach( (key, value) -> { - mapOfByteBuffer.put(key, ByteBuffer.wrap(converter.toData(value))); + mapOfByteBuffer.put(key, converter.toData(value)); }); return new Memo().setFields(mapOfByteBuffer); } @@ -156,101 +145,14 @@ public static Memo convertMapToMemo(Map memo) { public static SearchAttributes convertMapToSearchAttributes( Map searchAttributes) { DataConverter converter = JsonDataConverter.getInstance(); - Map mapOfByteBuffer = new HashMap<>(); + Map mapOfByteBuffer = new HashMap<>(); searchAttributes.forEach( (key, value) -> { - mapOfByteBuffer.put(key, ByteBuffer.wrap(converter.toData(value))); + mapOfByteBuffer.put(key, converter.toData(value)); }); return new SearchAttributes().setIndexedFields(mapOfByteBuffer); } - // This method serializes history to blob data - public static DataBlob SerializeFromHistoryToBlobData(History history) { - - // TODO: move to global dependency after https://issues.apache.org/jira/browse/THRIFT-2218 - TSerializer serializer = new TSerializer(); - DataBlob blob = new DataBlob(); - try { - blob.setData(serializer.serialize(history)); - } catch (org.apache.thrift.TException err) { - throw new RuntimeException("Serialize history to blob data failed", err); - } - - return blob; - } - - // This method deserialize the DataBlob data to the History data - public static History DeserializeFromBlobDataToHistory( - List blobData, HistoryEventFilterType historyEventFilterType) throws TException { - - // TODO: move to global dependency after https://issues.apache.org/jira/browse/THRIFT-2218 - TDeserializer deSerializer = new TDeserializer(); - List events = Lists.newArrayList(); - for (DataBlob data : blobData) { - History history = new History(); - try { - byte[] dataByte = data.getData(); - // TODO: verify the beginning index - dataByte = Arrays.copyOfRange(dataByte, 0, dataByte.length); - deSerializer.deserialize(history, dataByte); - - if (history == null || history.getEvents() == null || history.getEvents().size() == 0) { - return null; - } - } catch (org.apache.thrift.TException err) { - throw new TException("Deserialize blob data to history failed with unknown error"); - } - - events.addAll(history.getEvents()); - } - - if (events.size() > 0 && historyEventFilterType == HistoryEventFilterType.CLOSE_EVENT) { - events = events.subList(events.size() - 1, events.size()); - } - - return new History().setEvents(events); - } - - // This method serializes history event to blob data - public static List SerializeFromHistoryEventToBlobData(List events) { - - // TODO: move to global dependency after https://issues.apache.org/jira/browse/THRIFT-2218 - TSerializer serializer = new TSerializer(); - List blobs = Lists.newArrayListWithCapacity(events.size()); - for (HistoryEvent event : events) { - DataBlob blob = new DataBlob(); - try { - blob.setData(serializer.serialize(event)); - } catch (org.apache.thrift.TException err) { - throw new RuntimeException("Serialize history event to blob data failed", err); - } - blobs.add(blob); - } - return blobs; - } - - // This method serializes blob data to history event - public static List DeserializeFromBlobDataToHistoryEvents(List blobData) - throws TException { - - // TODO: move to global dependency after https://issues.apache.org/jira/browse/THRIFT-2218 - TDeserializer deSerializer = new TDeserializer(); - List events = Lists.newArrayList(); - for (DataBlob data : blobData) { - try { - HistoryEvent event = new HistoryEvent(); - byte[] dataByte = data.getData(); - // TODO: verify the beginning index - dataByte = Arrays.copyOfRange(dataByte, 0, dataByte.length); - deSerializer.deserialize(event, dataByte); - events.add(event); - } catch (org.apache.thrift.TException err) { - throw new TException("Deserialize blob data to history event failed with unknown error"); - } - } - return events; - } - /** Prohibit instantiation */ private InternalUtils() {} } diff --git a/src/main/java/com/uber/cadence/internal/common/LocalActivityMarkerData.java b/src/main/java/com/uber/cadence/internal/common/LocalActivityMarkerData.java index f2367eaba..fe2ca67a0 100644 --- a/src/main/java/com/uber/cadence/internal/common/LocalActivityMarkerData.java +++ b/src/main/java/com/uber/cadence/internal/common/LocalActivityMarkerData.java @@ -25,7 +25,6 @@ import com.uber.cadence.RespondActivityTaskFailedRequest; import com.uber.cadence.converter.DataConverter; import com.uber.m3.util.ImmutableMap; -import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.Duration; @@ -190,14 +189,13 @@ public boolean getIsCancelled() { public Header getHeader(DataConverter converter) { byte[] headerData = converter.toData(headers); Header header = new Header(); - header.setFields(ImmutableMap.of(LOCAL_ACTIVITY_HEADER_KEY, ByteBuffer.wrap(headerData))); + header.setFields(ImmutableMap.of(LOCAL_ACTIVITY_HEADER_KEY, headerData)); return header; } public static LocalActivityMarkerData fromEventAttributes( MarkerRecordedEventAttributes attributes, DataConverter converter) { - ByteBuffer byteBuffer = attributes.getHeader().getFields().get(LOCAL_ACTIVITY_HEADER_KEY); - byte[] bytes = org.apache.thrift.TBaseHelper.byteBufferToByteArray(byteBuffer); + byte[] bytes = attributes.getHeader().getFields().get(LOCAL_ACTIVITY_HEADER_KEY); LocalActivityMarkerHeader header = converter.fromData(bytes, LocalActivityMarkerHeader.class, LocalActivityMarkerHeader.class); return new LocalActivityMarkerData(header, attributes.getDetails()); diff --git a/src/main/java/com/uber/cadence/internal/common/WorkflowExecutionUtils.java b/src/main/java/com/uber/cadence/internal/common/WorkflowExecutionUtils.java index 9cff4deca..40e94cea3 100644 --- a/src/main/java/com/uber/cadence/internal/common/WorkflowExecutionUtils.java +++ b/src/main/java/com/uber/cadence/internal/common/WorkflowExecutionUtils.java @@ -26,27 +26,12 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.google.gson.JsonPrimitive; -import com.uber.cadence.ActivityType; -import com.uber.cadence.Decision; -import com.uber.cadence.DecisionType; -import com.uber.cadence.EntityNotExistsError; -import com.uber.cadence.EventType; -import com.uber.cadence.GetWorkflowExecutionHistoryRequest; -import com.uber.cadence.GetWorkflowExecutionHistoryResponse; -import com.uber.cadence.History; -import com.uber.cadence.HistoryEvent; -import com.uber.cadence.HistoryEventFilterType; -import com.uber.cadence.TaskList; -import com.uber.cadence.WorkflowExecution; -import com.uber.cadence.WorkflowExecutionCloseStatus; -import com.uber.cadence.WorkflowExecutionFailedEventAttributes; -import com.uber.cadence.WorkflowExecutionTerminatedEventAttributes; -import com.uber.cadence.WorkflowExecutionTimedOutEventAttributes; -import com.uber.cadence.WorkflowType; +import com.uber.cadence.*; import com.uber.cadence.client.WorkflowTerminatedException; import com.uber.cadence.client.WorkflowTimedOutException; import com.uber.cadence.common.RetryOptions; import com.uber.cadence.common.WorkflowExecutionHistory; +import com.uber.cadence.serviceclient.AsyncMethodCallback; import com.uber.cadence.serviceclient.IWorkflowService; import java.io.File; import java.io.IOException; @@ -63,8 +48,6 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; /** * Convenience methods to be used by unit tests and during development. @@ -200,9 +183,9 @@ private static HistoryEvent getInstanceCloseEvent( retryOptions, () -> service.GetWorkflowExecutionHistoryWithTimeout(r, unit.toMillis(timeout))); } catch (EntityNotExistsError e) { - if (e.activeCluster != null - && e.currentCluster != null - && !e.activeCluster.equals(e.currentCluster)) { + if (e.getActiveCluster() != null + && e.getCurrentCluster() != null + && !e.getActiveCluster().equals(e.getCurrentCluster())) { // Current cluster is passive cluster. Execution might not exist because of replication // lag. If we are still within timeout, wait for a little bit and retry. if (timeout != 0 @@ -220,7 +203,7 @@ private static HistoryEvent getInstanceCloseEvent( continue; } throw e; - } catch (TException e) { + } catch (BaseError e) { throw CheckedExceptionWrapper.wrap(e); } @@ -356,7 +339,7 @@ public void onError(Exception exception) { } }, unit.toMillis(timeout)); - } catch (TException e) { + } catch (BaseError e) { result.completeExceptionally(e); } return result; @@ -425,7 +408,7 @@ public static GetWorkflowExecutionHistoryResponse getHistoryPage( GetWorkflowExecutionHistoryResponse history; try { history = service.GetWorkflowExecutionHistory(getHistoryRequest); - } catch (TException e) { + } catch (BaseError e) { throw new Error(e); } if (history == null) { diff --git a/src/main/java/com/uber/cadence/internal/compatibility/Thrift2ProtoAdapter.java b/src/main/java/com/uber/cadence/internal/compatibility/Thrift2ProtoAdapter.java deleted file mode 100644 index a83561749..000000000 --- a/src/main/java/com/uber/cadence/internal/compatibility/Thrift2ProtoAdapter.java +++ /dev/null @@ -1,1306 +0,0 @@ -/* - * Modifications Copyright (c) 2017-2021 Uber Technologies Inc. - * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * 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.compatibility; - -import com.google.common.util.concurrent.FutureCallback; -import com.google.common.util.concurrent.Futures; -import com.google.common.util.concurrent.ListenableFuture; -import com.uber.cadence.BadRequestError; -import com.uber.cadence.CancellationAlreadyRequestedError; -import com.uber.cadence.ClientVersionNotSupportedError; -import com.uber.cadence.ClusterInfo; -import com.uber.cadence.CountWorkflowExecutionsRequest; -import com.uber.cadence.CountWorkflowExecutionsResponse; -import com.uber.cadence.DeprecateDomainRequest; -import com.uber.cadence.DescribeDomainRequest; -import com.uber.cadence.DescribeDomainResponse; -import com.uber.cadence.DescribeTaskListRequest; -import com.uber.cadence.DescribeTaskListResponse; -import com.uber.cadence.DescribeWorkflowExecutionRequest; -import com.uber.cadence.DescribeWorkflowExecutionResponse; -import com.uber.cadence.DomainAlreadyExistsError; -import com.uber.cadence.DomainNotActiveError; -import com.uber.cadence.EntityNotExistsError; -import com.uber.cadence.GetSearchAttributesResponse; -import com.uber.cadence.GetTaskListsByDomainRequest; -import com.uber.cadence.GetTaskListsByDomainResponse; -import com.uber.cadence.GetWorkflowExecutionHistoryRequest; -import com.uber.cadence.GetWorkflowExecutionHistoryResponse; -import com.uber.cadence.InternalServiceError; -import com.uber.cadence.LimitExceededError; -import com.uber.cadence.ListArchivedWorkflowExecutionsRequest; -import com.uber.cadence.ListArchivedWorkflowExecutionsResponse; -import com.uber.cadence.ListClosedWorkflowExecutionsRequest; -import com.uber.cadence.ListClosedWorkflowExecutionsResponse; -import com.uber.cadence.ListDomainsRequest; -import com.uber.cadence.ListDomainsResponse; -import com.uber.cadence.ListOpenWorkflowExecutionsRequest; -import com.uber.cadence.ListOpenWorkflowExecutionsResponse; -import com.uber.cadence.ListTaskListPartitionsRequest; -import com.uber.cadence.ListTaskListPartitionsResponse; -import com.uber.cadence.ListWorkflowExecutionsRequest; -import com.uber.cadence.ListWorkflowExecutionsResponse; -import com.uber.cadence.PollForActivityTaskRequest; -import com.uber.cadence.PollForActivityTaskResponse; -import com.uber.cadence.PollForDecisionTaskRequest; -import com.uber.cadence.PollForDecisionTaskResponse; -import com.uber.cadence.QueryFailedError; -import com.uber.cadence.QueryWorkflowRequest; -import com.uber.cadence.QueryWorkflowResponse; -import com.uber.cadence.RecordActivityTaskHeartbeatByIDRequest; -import com.uber.cadence.RecordActivityTaskHeartbeatRequest; -import com.uber.cadence.RecordActivityTaskHeartbeatResponse; -import com.uber.cadence.RefreshWorkflowTasksRequest; -import com.uber.cadence.RegisterDomainRequest; -import com.uber.cadence.RequestCancelWorkflowExecutionRequest; -import com.uber.cadence.ResetStickyTaskListRequest; -import com.uber.cadence.ResetStickyTaskListResponse; -import com.uber.cadence.ResetWorkflowExecutionRequest; -import com.uber.cadence.ResetWorkflowExecutionResponse; -import com.uber.cadence.RespondActivityTaskCanceledByIDRequest; -import com.uber.cadence.RespondActivityTaskCanceledRequest; -import com.uber.cadence.RespondActivityTaskCompletedByIDRequest; -import com.uber.cadence.RespondActivityTaskCompletedRequest; -import com.uber.cadence.RespondActivityTaskFailedByIDRequest; -import com.uber.cadence.RespondActivityTaskFailedRequest; -import com.uber.cadence.RespondDecisionTaskCompletedRequest; -import com.uber.cadence.RespondDecisionTaskCompletedResponse; -import com.uber.cadence.RespondDecisionTaskFailedRequest; -import com.uber.cadence.RespondQueryTaskCompletedRequest; -import com.uber.cadence.RestartWorkflowExecutionRequest; -import com.uber.cadence.RestartWorkflowExecutionResponse; -import com.uber.cadence.ServiceBusyError; -import com.uber.cadence.SignalWithStartWorkflowExecutionAsyncRequest; -import com.uber.cadence.SignalWithStartWorkflowExecutionAsyncResponse; -import com.uber.cadence.SignalWithStartWorkflowExecutionRequest; -import com.uber.cadence.SignalWorkflowExecutionRequest; -import com.uber.cadence.StartWorkflowExecutionAsyncRequest; -import com.uber.cadence.StartWorkflowExecutionAsyncResponse; -import com.uber.cadence.StartWorkflowExecutionRequest; -import com.uber.cadence.StartWorkflowExecutionResponse; -import com.uber.cadence.TerminateWorkflowExecutionRequest; -import com.uber.cadence.UpdateDomainRequest; -import com.uber.cadence.UpdateDomainResponse; -import com.uber.cadence.WorkflowExecutionAlreadyCompletedError; -import com.uber.cadence.WorkflowExecutionAlreadyStartedError; -import com.uber.cadence.api.v1.GetSearchAttributesRequest; -import com.uber.cadence.api.v1.HealthRequest; -import com.uber.cadence.api.v1.HealthResponse; -import com.uber.cadence.internal.compatibility.proto.RequestMapper; -import com.uber.cadence.internal.compatibility.proto.serviceclient.IGrpcServiceStubs; -import com.uber.cadence.internal.compatibility.thrift.ErrorMapper; -import com.uber.cadence.internal.compatibility.thrift.ResponseMapper; -import com.uber.cadence.serviceclient.ClientOptions; -import com.uber.cadence.serviceclient.IWorkflowService; -import io.grpc.Deadline; -import io.grpc.StatusRuntimeException; -import java.util.UUID; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ForkJoinPool; -import java.util.concurrent.TimeUnit; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; - -public class Thrift2ProtoAdapter implements IWorkflowService { - - IGrpcServiceStubs grpcServiceStubs; - - public Thrift2ProtoAdapter(IGrpcServiceStubs grpcServiceStubs) { - this.grpcServiceStubs = grpcServiceStubs; - } - - @Override - public ClientOptions getOptions() { - return grpcServiceStubs.getOptions(); - } - - @Override - public void RegisterDomain(RegisterDomainRequest registerRequest) - throws BadRequestError, DomainAlreadyExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { - try { - grpcServiceStubs - .domainBlockingStub() - .registerDomain(RequestMapper.registerDomainRequest(registerRequest)); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public DescribeDomainResponse DescribeDomain(DescribeDomainRequest describeRequest) - throws BadRequestError, EntityNotExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { - try { - com.uber.cadence.api.v1.DescribeDomainResponse response = - grpcServiceStubs - .domainBlockingStub() - .describeDomain(RequestMapper.describeDomainRequest(describeRequest)); - return ResponseMapper.describeDomainResponse(response); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public ListDomainsResponse ListDomains(ListDomainsRequest listRequest) - throws BadRequestError, EntityNotExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { - try { - com.uber.cadence.api.v1.ListDomainsResponse response = - grpcServiceStubs - .domainBlockingStub() - .listDomains(RequestMapper.listDomainsRequest(listRequest)); - return ResponseMapper.listDomainsResponse(response); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public UpdateDomainResponse UpdateDomain(UpdateDomainRequest updateRequest) - throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, - ClientVersionNotSupportedError, TException { - try { - com.uber.cadence.api.v1.UpdateDomainResponse response = - grpcServiceStubs - .domainBlockingStub() - .updateDomain(RequestMapper.updateDomainRequest(updateRequest)); - return ResponseMapper.updateDomainResponse(response); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public void DeprecateDomain(DeprecateDomainRequest deprecateRequest) - throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, - ClientVersionNotSupportedError, TException { - try { - grpcServiceStubs - .domainBlockingStub() - .deprecateDomain(RequestMapper.deprecateDomainRequest(deprecateRequest)); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public RestartWorkflowExecutionResponse RestartWorkflowExecution( - RestartWorkflowExecutionRequest restartRequest) - throws BadRequestError, ServiceBusyError, DomainNotActiveError, LimitExceededError, - EntityNotExistsError, ClientVersionNotSupportedError, TException { - throw new UnsupportedOperationException("unimplemented"); - } - - @Override - public StartWorkflowExecutionResponse StartWorkflowExecution( - StartWorkflowExecutionRequest startRequest) - throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError, - DomainNotActiveError, LimitExceededError, EntityNotExistsError, - ClientVersionNotSupportedError, TException { - return startWorkflowExecution(startRequest); - } - - @Override - public StartWorkflowExecutionAsyncResponse StartWorkflowExecutionAsync( - StartWorkflowExecutionAsyncRequest startRequest) - throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError, - DomainNotActiveError, LimitExceededError, EntityNotExistsError, - ClientVersionNotSupportedError, TException { - initializeStartWorkflowExecutionRequest(startRequest.getRequest()); - try { - com.uber.cadence.api.v1.StartWorkflowExecutionAsyncResponse response = - grpcServiceStubs - .workflowBlockingStub() - .startWorkflowExecutionAsync( - RequestMapper.startWorkflowExecutionAsyncRequest(startRequest)); - return ResponseMapper.startWorkflowExecutionAsyncResponse(response); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - private StartWorkflowExecutionResponse startWorkflowExecution( - StartWorkflowExecutionRequest startRequest) - throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError, - DomainNotActiveError, LimitExceededError, EntityNotExistsError, - ClientVersionNotSupportedError, TException { - initializeStartWorkflowExecutionRequest(startRequest); - try { - com.uber.cadence.api.v1.StartWorkflowExecutionResponse response = - grpcServiceStubs - .workflowBlockingStub() - .startWorkflowExecution(RequestMapper.startWorkflowExecutionRequest(startRequest)); - return ResponseMapper.startWorkflowExecutionResponse(response); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - private void initializeStartWorkflowExecutionRequest(StartWorkflowExecutionRequest request) { - if (!request.isSetRequestId()) { - request.setRequestId(UUID.randomUUID().toString()); - } - } - - @Override - public GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistory( - GetWorkflowExecutionHistoryRequest getRequest) - throws BadRequestError, EntityNotExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { - try { - com.uber.cadence.api.v1.GetWorkflowExecutionHistoryResponse response = - grpcServiceStubs - .workflowBlockingStub() - .getWorkflowExecutionHistory( - RequestMapper.getWorkflowExecutionHistoryRequest(getRequest)); - return ResponseMapper.getWorkflowExecutionHistoryResponse(response); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public PollForDecisionTaskResponse PollForDecisionTask(PollForDecisionTaskRequest pollRequest) - throws BadRequestError, ServiceBusyError, LimitExceededError, EntityNotExistsError, - DomainNotActiveError, ClientVersionNotSupportedError, TException { - try { - com.uber.cadence.api.v1.PollForDecisionTaskResponse response = - grpcServiceStubs - .workerBlockingStub() - .pollForDecisionTask(RequestMapper.pollForDecisionTaskRequest(pollRequest)); - return ResponseMapper.pollForDecisionTaskResponse(response); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public RespondDecisionTaskCompletedResponse RespondDecisionTaskCompleted( - RespondDecisionTaskCompletedRequest completeRequest) - throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, - ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, - TException { - try { - com.uber.cadence.api.v1.RespondDecisionTaskCompletedResponse response = - grpcServiceStubs - .workerBlockingStub() - .respondDecisionTaskCompleted( - RequestMapper.respondDecisionTaskCompletedRequest(completeRequest)); - return ResponseMapper.respondDecisionTaskCompletedResponse(response); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public void RespondDecisionTaskFailed(RespondDecisionTaskFailedRequest failedRequest) - throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, - ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, - TException { - try { - grpcServiceStubs - .workerBlockingStub() - .respondDecisionTaskFailed(RequestMapper.respondDecisionTaskFailedRequest(failedRequest)); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public PollForActivityTaskResponse PollForActivityTask(PollForActivityTaskRequest pollRequest) - throws BadRequestError, ServiceBusyError, LimitExceededError, EntityNotExistsError, - DomainNotActiveError, ClientVersionNotSupportedError, TException { - try { - com.uber.cadence.api.v1.PollForActivityTaskResponse response = - grpcServiceStubs - .workerBlockingStub() - .pollForActivityTask(RequestMapper.pollForActivityTaskRequest(pollRequest)); - return ResponseMapper.pollForActivityTaskResponse(response); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeat( - RecordActivityTaskHeartbeatRequest heartbeatRequest) - throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, - ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, - TException { - try { - com.uber.cadence.api.v1.RecordActivityTaskHeartbeatResponse response = - grpcServiceStubs - .workerBlockingStub() - .recordActivityTaskHeartbeat( - RequestMapper.recordActivityTaskHeartbeatRequest(heartbeatRequest)); - return ResponseMapper.recordActivityTaskHeartbeatResponse(response); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeatByID( - RecordActivityTaskHeartbeatByIDRequest heartbeatRequest) - throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, - ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, - TException { - try { - com.uber.cadence.api.v1.RecordActivityTaskHeartbeatByIDResponse response = - grpcServiceStubs - .workerBlockingStub() - .recordActivityTaskHeartbeatByID( - RequestMapper.recordActivityTaskHeartbeatByIdRequest(heartbeatRequest)); - return ResponseMapper.recordActivityTaskHeartbeatByIdResponse(response); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public void RespondActivityTaskCompleted(RespondActivityTaskCompletedRequest completeRequest) - throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, - ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, - TException { - try { - grpcServiceStubs - .workerBlockingStub() - .respondActivityTaskCompleted( - RequestMapper.respondActivityTaskCompletedRequest(completeRequest)); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public void RespondActivityTaskCompletedByID( - RespondActivityTaskCompletedByIDRequest completeRequest) - throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, - ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, - TException { - try { - grpcServiceStubs - .workerBlockingStub() - .respondActivityTaskCompletedByID( - RequestMapper.respondActivityTaskCompletedByIdRequest(completeRequest)); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public void RespondActivityTaskFailed(RespondActivityTaskFailedRequest failRequest) - throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, - ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, - TException { - try { - grpcServiceStubs - .workerBlockingStub() - .respondActivityTaskFailed(RequestMapper.respondActivityTaskFailedRequest(failRequest)); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public void RespondActivityTaskFailedByID(RespondActivityTaskFailedByIDRequest failRequest) - throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, - ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, - TException { - try { - grpcServiceStubs - .workerBlockingStub() - .respondActivityTaskFailedByID( - RequestMapper.respondActivityTaskFailedByIdRequest(failRequest)); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public void RespondActivityTaskCanceled(RespondActivityTaskCanceledRequest canceledRequest) - throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, - ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, - TException { - try { - grpcServiceStubs - .workerBlockingStub() - .respondActivityTaskCanceled( - RequestMapper.respondActivityTaskCanceledRequest(canceledRequest)); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public void RespondActivityTaskCanceledByID( - RespondActivityTaskCanceledByIDRequest canceledRequest) - throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, - ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, - TException { - try { - grpcServiceStubs - .workerBlockingStub() - .respondActivityTaskCanceledByID( - RequestMapper.respondActivityTaskCanceledByIdRequest(canceledRequest)); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public void RequestCancelWorkflowExecution(RequestCancelWorkflowExecutionRequest cancelRequest) - throws BadRequestError, EntityNotExistsError, CancellationAlreadyRequestedError, - ServiceBusyError, DomainNotActiveError, LimitExceededError, - ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, TException { - if (!cancelRequest.isSetRequestId()) { - cancelRequest.setRequestId(UUID.randomUUID().toString()); - } - try { - grpcServiceStubs - .workflowBlockingStub() - .requestCancelWorkflowExecution( - RequestMapper.requestCancelWorkflowExecutionRequest(cancelRequest)); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public void SignalWorkflowExecution(SignalWorkflowExecutionRequest signalRequest) - throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, - LimitExceededError, ClientVersionNotSupportedError, - WorkflowExecutionAlreadyCompletedError, TException { - if (!signalRequest.isSetRequestId()) { - signalRequest.setRequestId(UUID.randomUUID().toString()); - } - try { - grpcServiceStubs - .workflowBlockingStub() - .signalWorkflowExecution(RequestMapper.signalWorkflowExecutionRequest(signalRequest)); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public StartWorkflowExecutionResponse SignalWithStartWorkflowExecution( - SignalWithStartWorkflowExecutionRequest signalWithStartRequest) - throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, - LimitExceededError, WorkflowExecutionAlreadyStartedError, ClientVersionNotSupportedError, - TException { - try { - initializeSignalWithStartWorkflowExecution(signalWithStartRequest); - com.uber.cadence.api.v1.SignalWithStartWorkflowExecutionResponse response = - grpcServiceStubs - .workflowBlockingStub() - .signalWithStartWorkflowExecution( - RequestMapper.signalWithStartWorkflowExecutionRequest(signalWithStartRequest)); - return ResponseMapper.signalWithStartWorkflowExecutionResponse(response); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public SignalWithStartWorkflowExecutionAsyncResponse SignalWithStartWorkflowExecutionAsync( - SignalWithStartWorkflowExecutionAsyncRequest signalWithStartRequest) - throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError, - DomainNotActiveError, LimitExceededError, EntityNotExistsError, - ClientVersionNotSupportedError, TException { - try { - initializeSignalWithStartWorkflowExecution(signalWithStartRequest.getRequest()); - com.uber.cadence.api.v1.SignalWithStartWorkflowExecutionAsyncResponse response = - grpcServiceStubs - .workflowBlockingStub() - .signalWithStartWorkflowExecutionAsync( - RequestMapper.signalWithStartWorkflowExecutionAsyncRequest( - signalWithStartRequest)); - return ResponseMapper.signalWithStartWorkflowExecutionAsyncResponse(response); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - private void initializeSignalWithStartWorkflowExecution( - SignalWithStartWorkflowExecutionRequest request) { - if (!request.isSetRequestId()) { - request.setRequestId(UUID.randomUUID().toString()); - } - } - - @Override - public ResetWorkflowExecutionResponse ResetWorkflowExecution( - ResetWorkflowExecutionRequest resetRequest) - throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, - LimitExceededError, ClientVersionNotSupportedError, TException { - try { - if (!resetRequest.isSetRequestId()) { - resetRequest.setRequestId(UUID.randomUUID().toString()); - } - com.uber.cadence.api.v1.ResetWorkflowExecutionResponse response = - grpcServiceStubs - .workflowBlockingStub() - .resetWorkflowExecution(RequestMapper.resetWorkflowExecutionRequest(resetRequest)); - return ResponseMapper.resetWorkflowExecutionResponse(response); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public void TerminateWorkflowExecution(TerminateWorkflowExecutionRequest terminateRequest) - throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, - LimitExceededError, ClientVersionNotSupportedError, - WorkflowExecutionAlreadyCompletedError, TException { - try { - grpcServiceStubs - .workflowBlockingStub() - .terminateWorkflowExecution( - RequestMapper.terminateWorkflowExecutionRequest(terminateRequest)); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public ListOpenWorkflowExecutionsResponse ListOpenWorkflowExecutions( - ListOpenWorkflowExecutionsRequest listRequest) - throws BadRequestError, EntityNotExistsError, ServiceBusyError, LimitExceededError, - ClientVersionNotSupportedError, TException { - try { - com.uber.cadence.api.v1.ListOpenWorkflowExecutionsResponse response = - grpcServiceStubs - .visibilityBlockingStub() - .listOpenWorkflowExecutions( - RequestMapper.listOpenWorkflowExecutionsRequest(listRequest)); - return ResponseMapper.listOpenWorkflowExecutionsResponse(response); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public ListClosedWorkflowExecutionsResponse ListClosedWorkflowExecutions( - ListClosedWorkflowExecutionsRequest listRequest) - throws BadRequestError, EntityNotExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { - try { - com.uber.cadence.api.v1.ListClosedWorkflowExecutionsResponse response = - grpcServiceStubs - .visibilityBlockingStub() - .listClosedWorkflowExecutions( - RequestMapper.listClosedWorkflowExecutionsRequest(listRequest)); - return ResponseMapper.listClosedWorkflowExecutionsResponse(response); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public ListWorkflowExecutionsResponse ListWorkflowExecutions( - ListWorkflowExecutionsRequest listRequest) - throws BadRequestError, EntityNotExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { - try { - com.uber.cadence.api.v1.ListWorkflowExecutionsResponse response = - grpcServiceStubs - .visibilityBlockingStub() - .listWorkflowExecutions(RequestMapper.listWorkflowExecutionsRequest(listRequest)); - return ResponseMapper.listWorkflowExecutionsResponse(response); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public ListArchivedWorkflowExecutionsResponse ListArchivedWorkflowExecutions( - ListArchivedWorkflowExecutionsRequest listRequest) - throws BadRequestError, EntityNotExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { - try { - com.uber.cadence.api.v1.ListArchivedWorkflowExecutionsResponse response = - grpcServiceStubs - .visibilityBlockingStub() - .listArchivedWorkflowExecutions( - RequestMapper.listArchivedWorkflowExecutionsRequest(listRequest)); - return ResponseMapper.listArchivedWorkflowExecutionsResponse(response); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public ListWorkflowExecutionsResponse ScanWorkflowExecutions( - ListWorkflowExecutionsRequest listRequest) - throws BadRequestError, EntityNotExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { - try { - com.uber.cadence.api.v1.ScanWorkflowExecutionsResponse response = - grpcServiceStubs - .visibilityBlockingStub() - .scanWorkflowExecutions(RequestMapper.scanWorkflowExecutionsRequest(listRequest)); - return ResponseMapper.scanWorkflowExecutionsResponse(response); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public CountWorkflowExecutionsResponse CountWorkflowExecutions( - CountWorkflowExecutionsRequest countRequest) - throws BadRequestError, EntityNotExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { - try { - com.uber.cadence.api.v1.CountWorkflowExecutionsResponse response = - grpcServiceStubs - .visibilityBlockingStub() - .countWorkflowExecutions(RequestMapper.countWorkflowExecutionsRequest(countRequest)); - return ResponseMapper.countWorkflowExecutionsResponse(response); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public GetSearchAttributesResponse GetSearchAttributes() - throws ServiceBusyError, ClientVersionNotSupportedError, TException { - try { - com.uber.cadence.api.v1.GetSearchAttributesResponse response = - grpcServiceStubs - .visibilityBlockingStub() - .getSearchAttributes(GetSearchAttributesRequest.newBuilder().build()); - return ResponseMapper.getSearchAttributesResponse(response); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public void RespondQueryTaskCompleted(RespondQueryTaskCompletedRequest completeRequest) - throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, - DomainNotActiveError, ClientVersionNotSupportedError, TException { - try { - grpcServiceStubs - .workerBlockingStub() - .respondQueryTaskCompleted( - RequestMapper.respondQueryTaskCompletedRequest(completeRequest)); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public ResetStickyTaskListResponse ResetStickyTaskList(ResetStickyTaskListRequest resetRequest) - throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, - DomainNotActiveError, ClientVersionNotSupportedError, - WorkflowExecutionAlreadyCompletedError, TException { - try { - com.uber.cadence.api.v1.ResetStickyTaskListResponse response = - grpcServiceStubs - .workerBlockingStub() - .resetStickyTaskList(RequestMapper.resetStickyTaskListRequest(resetRequest)); - return new ResetStickyTaskListResponse(); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public QueryWorkflowResponse QueryWorkflow(QueryWorkflowRequest queryRequest) - throws BadRequestError, EntityNotExistsError, QueryFailedError, LimitExceededError, - ServiceBusyError, ClientVersionNotSupportedError, TException { - try { - com.uber.cadence.api.v1.QueryWorkflowResponse response = - grpcServiceStubs - .workflowBlockingStub() - .queryWorkflow(RequestMapper.queryWorkflowRequest(queryRequest)); - return ResponseMapper.queryWorkflowResponse(response); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public DescribeWorkflowExecutionResponse DescribeWorkflowExecution( - DescribeWorkflowExecutionRequest describeRequest) - throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, - ClientVersionNotSupportedError, TException { - try { - com.uber.cadence.api.v1.DescribeWorkflowExecutionResponse response = - grpcServiceStubs - .workflowBlockingStub() - .describeWorkflowExecution( - RequestMapper.describeWorkflowExecutionRequest(describeRequest)); - return ResponseMapper.describeWorkflowExecutionResponse(response); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public DescribeTaskListResponse DescribeTaskList(DescribeTaskListRequest request) - throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, - ClientVersionNotSupportedError, TException { - try { - com.uber.cadence.api.v1.DescribeTaskListResponse response = - grpcServiceStubs - .workflowBlockingStub() - .describeTaskList(RequestMapper.describeTaskListRequest(request)); - return ResponseMapper.describeTaskListResponse(response); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public ClusterInfo GetClusterInfo() throws InternalServiceError, ServiceBusyError, TException { - try { - com.uber.cadence.api.v1.GetClusterInfoResponse response = - grpcServiceStubs - .workflowBlockingStub() - .getClusterInfo(com.uber.cadence.api.v1.GetClusterInfoRequest.newBuilder().build()); - return ResponseMapper.getClusterInfoResponse(response); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public GetTaskListsByDomainResponse GetTaskListsByDomain(GetTaskListsByDomainRequest request) { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public ListTaskListPartitionsResponse ListTaskListPartitions( - ListTaskListPartitionsRequest request) - throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, - TException { - try { - com.uber.cadence.api.v1.ListTaskListPartitionsResponse response = - grpcServiceStubs - .workflowBlockingStub() - .listTaskListPartitions(RequestMapper.listTaskListPartitionsRequest(request)); - return ResponseMapper.listTaskListPartitionsResponse(response); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public void RefreshWorkflowTasks(RefreshWorkflowTasksRequest request) - throws BadRequestError, DomainNotActiveError, ServiceBusyError, EntityNotExistsError, - TException { - try { - grpcServiceStubs - .workflowBlockingStub() - .refreshWorkflowTasks( - com.uber.cadence.api.v1.RefreshWorkflowTasksRequest.newBuilder().build()); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public void RegisterDomain( - RegisterDomainRequest registerRequest, AsyncMethodCallback resultHandler) throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void DescribeDomain( - DescribeDomainRequest describeRequest, AsyncMethodCallback resultHandler) throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void ListDomains(ListDomainsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void UpdateDomain(UpdateDomainRequest updateRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void DeprecateDomain( - DeprecateDomainRequest deprecateRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void RestartWorkflowExecution( - RestartWorkflowExecutionRequest restartRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("unimplemented"); - } - - @Override - public void StartWorkflowExecution( - StartWorkflowExecutionRequest startRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void StartWorkflowExecutionAsync( - StartWorkflowExecutionAsyncRequest startRequest, AsyncMethodCallback resultHandler) - throws TException { - try { - initializeStartWorkflowExecutionRequest(startRequest.getRequest()); - ListenableFuture resultFuture = - grpcServiceStubs - .workflowFutureStub() - .startWorkflowExecutionAsync( - RequestMapper.startWorkflowExecutionAsyncRequest(startRequest)); - resultFuture.addListener( - () -> { - try { - com.uber.cadence.api.v1.StartWorkflowExecutionAsyncResponse response = - resultFuture.get(); - resultHandler.onComplete( - ResponseMapper.startWorkflowExecutionAsyncResponse(response)); - } catch (Exception e) { - handleAsyncException(resultHandler, e); - } - }, - ForkJoinPool.commonPool()); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public void GetWorkflowExecutionHistory( - GetWorkflowExecutionHistoryRequest getRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void PollForDecisionTask( - PollForDecisionTaskRequest pollRequest, AsyncMethodCallback resultHandler) throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void RespondDecisionTaskCompleted( - RespondDecisionTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void RespondDecisionTaskFailed( - RespondDecisionTaskFailedRequest failedRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void PollForActivityTask( - PollForActivityTaskRequest pollRequest, AsyncMethodCallback resultHandler) throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void RecordActivityTaskHeartbeat( - RecordActivityTaskHeartbeatRequest heartbeatRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void RecordActivityTaskHeartbeatByID( - RecordActivityTaskHeartbeatByIDRequest heartbeatRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void RespondActivityTaskCompleted( - RespondActivityTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void RespondActivityTaskCompletedByID( - RespondActivityTaskCompletedByIDRequest completeRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void RespondActivityTaskFailed( - RespondActivityTaskFailedRequest failRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void RespondActivityTaskFailedByID( - RespondActivityTaskFailedByIDRequest failRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void RespondActivityTaskCanceled( - RespondActivityTaskCanceledRequest canceledRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void RespondActivityTaskCanceledByID( - RespondActivityTaskCanceledByIDRequest canceledRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void RequestCancelWorkflowExecution( - RequestCancelWorkflowExecutionRequest cancelRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void SignalWorkflowExecution( - SignalWorkflowExecutionRequest signalRequest, AsyncMethodCallback resultHandler) - throws TException { - try { - if (!signalRequest.isSetRequestId()) { - signalRequest.setRequestId(UUID.randomUUID().toString()); - } - ListenableFuture resultFuture = - grpcServiceStubs - .workflowFutureStub() - .signalWorkflowExecution(RequestMapper.signalWorkflowExecutionRequest(signalRequest)); - resultFuture.addListener( - () -> { - try { - com.uber.cadence.api.v1.SignalWorkflowExecutionResponse response = resultFuture.get(); - resultHandler.onComplete(null); - } catch (Exception e) { - handleAsyncException(resultHandler, e); - } - }, - ForkJoinPool.commonPool()); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public void SignalWithStartWorkflowExecution( - SignalWithStartWorkflowExecutionRequest signalWithStartRequest, - AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void SignalWithStartWorkflowExecutionAsync( - SignalWithStartWorkflowExecutionAsyncRequest signalWithStartRequest, - AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("unimplemented"); - } - - @Override - public void ResetWorkflowExecution( - ResetWorkflowExecutionRequest resetRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void TerminateWorkflowExecution( - TerminateWorkflowExecutionRequest terminateRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void ListOpenWorkflowExecutions( - ListOpenWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void ListClosedWorkflowExecutions( - ListClosedWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void ListWorkflowExecutions( - ListWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void ListArchivedWorkflowExecutions( - ListArchivedWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void ScanWorkflowExecutions( - ListWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void CountWorkflowExecutions( - CountWorkflowExecutionsRequest countRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void GetSearchAttributes(AsyncMethodCallback resultHandler) throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void RespondQueryTaskCompleted( - RespondQueryTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void ResetStickyTaskList( - ResetStickyTaskListRequest resetRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void QueryWorkflow(QueryWorkflowRequest queryRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void DescribeWorkflowExecution( - DescribeWorkflowExecutionRequest describeRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void DescribeTaskList(DescribeTaskListRequest request, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void GetClusterInfo(AsyncMethodCallback resultHandler) throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void GetTaskListsByDomain( - GetTaskListsByDomainRequest request, AsyncMethodCallback resultHandler) throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void ListTaskListPartitions( - ListTaskListPartitionsRequest request, AsyncMethodCallback resultHandler) throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void RefreshWorkflowTasks( - RefreshWorkflowTasksRequest request, AsyncMethodCallback resultHandler) throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void close() { - grpcServiceStubs.shutdownNow(); - } - - @Override - public CompletableFuture isHealthy() { - ListenableFuture listenableFuture = - grpcServiceStubs.metaFutureStub().health(HealthRequest.newBuilder().build()); - CompletableFuture completable = - new CompletableFuture() { - @Override - public boolean cancel(boolean mayInterruptIfRunning) { - boolean result = listenableFuture.cancel(mayInterruptIfRunning); - super.cancel(mayInterruptIfRunning); - return result; - } - }; - Futures.addCallback( - listenableFuture, - new FutureCallback() { - @Override - public void onSuccess(HealthResponse result) { - completable.complete(true); - } - - @Override - public void onFailure(Throwable t) { - completable.completeExceptionally(t); - } - }, - ForkJoinPool.commonPool()); - return completable; - } - - @Override - public void StartWorkflowExecutionWithTimeout( - StartWorkflowExecutionRequest startRequest, - AsyncMethodCallback resultHandler, - Long timeoutInMillis) - throws TException { - try { - initializeStartWorkflowExecutionRequest(startRequest); - ListenableFuture resultFuture = - grpcServiceStubs - .workflowFutureStub() - .withDeadline(Deadline.after(timeoutInMillis, TimeUnit.MILLISECONDS)) - .startWorkflowExecution(RequestMapper.startWorkflowExecutionRequest(startRequest)); - resultFuture.addListener( - () -> { - try { - com.uber.cadence.api.v1.StartWorkflowExecutionResponse response = resultFuture.get(); - resultHandler.onComplete(ResponseMapper.startWorkflowExecutionResponse(response)); - } catch (Exception e) { - handleAsyncException(resultHandler, e); - } - }, - ForkJoinPool.commonPool()); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public void StartWorkflowExecutionAsyncWithTimeout( - StartWorkflowExecutionAsyncRequest startAsyncRequest, - AsyncMethodCallback resultHandler, - Long timeoutInMillis) - throws TException { - try { - initializeStartWorkflowExecutionRequest(startAsyncRequest.getRequest()); - ListenableFuture resultFuture = - grpcServiceStubs - .workflowFutureStub() - .withDeadline(Deadline.after(timeoutInMillis, TimeUnit.MILLISECONDS)) - .startWorkflowExecutionAsync( - RequestMapper.startWorkflowExecutionAsyncRequest(startAsyncRequest)); - resultFuture.addListener( - () -> { - try { - com.uber.cadence.api.v1.StartWorkflowExecutionAsyncResponse response = - resultFuture.get(); - resultHandler.onComplete( - ResponseMapper.startWorkflowExecutionAsyncResponse(response)); - } catch (Exception e) { - handleAsyncException(resultHandler, e); - } - }, - ForkJoinPool.commonPool()); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistoryWithTimeout( - GetWorkflowExecutionHistoryRequest getRequest, Long timeoutInMillis) throws TException { - try { - com.uber.cadence.api.v1.GetWorkflowExecutionHistoryResponse response = - grpcServiceStubs - .workflowBlockingStub() - .withDeadline(Deadline.after(timeoutInMillis, TimeUnit.MILLISECONDS)) - .getWorkflowExecutionHistory( - RequestMapper.getWorkflowExecutionHistoryRequest(getRequest)); - return ResponseMapper.getWorkflowExecutionHistoryResponse(response); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public void GetWorkflowExecutionHistoryWithTimeout( - GetWorkflowExecutionHistoryRequest getRequest, - AsyncMethodCallback resultHandler, - Long timeoutInMillis) - throws TException { - try { - ListenableFuture resultFuture = - grpcServiceStubs - .workflowFutureStub() - .withDeadline(Deadline.after(timeoutInMillis, TimeUnit.MILLISECONDS)) - .getWorkflowExecutionHistory( - RequestMapper.getWorkflowExecutionHistoryRequest(getRequest)); - resultFuture.addListener( - () -> { - try { - com.uber.cadence.api.v1.GetWorkflowExecutionHistoryResponse response = - resultFuture.get(); - resultHandler.onComplete( - ResponseMapper.getWorkflowExecutionHistoryResponse(response)); - } catch (Exception e) { - handleAsyncException(resultHandler, e); - } - }, - ForkJoinPool.commonPool()); - } catch (StatusRuntimeException e) { - throw ErrorMapper.Error(e); - } - } - - @Override - public void SignalWorkflowExecutionWithTimeout( - SignalWorkflowExecutionRequest signalRequest, - AsyncMethodCallback resultHandler, - Long timeoutInMillis) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - private void handleAsyncException(AsyncMethodCallback callback, Exception exception) { - if (exception instanceof ExecutionException - && exception.getCause() instanceof StatusRuntimeException) { - callback.onError(ErrorMapper.Error(((StatusRuntimeException) exception.getCause()))); - } else { - callback.onError(exception); - } - } -} diff --git a/src/main/java/com/uber/cadence/internal/compatibility/proto/DecisionMapper.java b/src/main/java/com/uber/cadence/internal/compatibility/proto/DecisionMapper.java index a3d5e5ca5..e26c75ad2 100644 --- a/src/main/java/com/uber/cadence/internal/compatibility/proto/DecisionMapper.java +++ b/src/main/java/com/uber/cadence/internal/compatibility/proto/DecisionMapper.java @@ -55,7 +55,7 @@ class DecisionMapper { static List decisionArray(List t) { if (t == null) { - return null; + return new ArrayList<>(); } List v = new ArrayList<>(); 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..5974f3258 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 @@ -417,7 +417,7 @@ public static GetWorkflowExecutionHistoryRequest getWorkflowExecutionHistoryRequ .setWorkflowExecution(workflowExecution(t.getExecution())) .setPageSize(t.getMaximumPageSize()) .setWaitForNewEvent(t.isWaitForNewEvent()) - .setHistoryEventFilterType(eventFilterType(t.HistoryEventFilterType)) + .setHistoryEventFilterType(eventFilterType(t.getHistoryEventFilterType())) .setSkipArchival(t.isSkipArchival()); if (t.getNextPageToken() != null) { builder.setNextPageToken(arrayToByteString(t.getNextPageToken())); @@ -591,11 +591,11 @@ public static DescribeDomainRequest describeDomainRequest( if (t == null) { return null; } - if (t.uuid != null) { - return DescribeDomainRequest.newBuilder().setId(t.uuid).build(); + if (t.getUuid() != null) { + return DescribeDomainRequest.newBuilder().setId(t.getUuid()).build(); } - if (t.name != null) { - return DescribeDomainRequest.newBuilder().setName(t.name).build(); + if (t.getName() != null) { + return DescribeDomainRequest.newBuilder().setName(t.getName()).build(); } throw new IllegalArgumentException("neither one of field is set for DescribeDomainRequest"); } @@ -604,7 +604,8 @@ public static ListDomainsRequest listDomainsRequest(com.uber.cadence.ListDomains if (t == null) { return null; } - ListDomainsRequest.Builder request = ListDomainsRequest.newBuilder().setPageSize(t.pageSize); + ListDomainsRequest.Builder request = + ListDomainsRequest.newBuilder().setPageSize(t.getPageSize()); if (t.getNextPageToken() != null) { request.setNextPageToken(arrayToByteString(t.getNextPageToken())); } @@ -736,7 +737,7 @@ public static RegisterDomainRequest registerDomainRequest( .setActiveClusterName(Helpers.nullToEmpty(t.getActiveClusterName())) .putAllData(Helpers.nullToEmpty(t.getData())) .setSecurityToken(Helpers.nullToEmpty(t.getSecurityToken())) - .setIsGlobalDomain(nullToEmpty(t.isIsGlobalDomain())) + .setIsGlobalDomain(nullToEmpty(t.isGlobalDomain())) .setHistoryArchivalStatus(archivalStatus(t.getHistoryArchivalStatus())) .setHistoryArchivalUri(Helpers.nullToEmpty(t.getHistoryArchivalURI())) .setVisibilityArchivalStatus(archivalStatus(t.getVisibilityArchivalStatus())) diff --git a/src/main/java/com/uber/cadence/internal/compatibility/proto/TypeMapper.java b/src/main/java/com/uber/cadence/internal/compatibility/proto/TypeMapper.java index c2d4cb03a..e664f55f0 100644 --- a/src/main/java/com/uber/cadence/internal/compatibility/proto/TypeMapper.java +++ b/src/main/java/com/uber/cadence/internal/compatibility/proto/TypeMapper.java @@ -46,7 +46,6 @@ import com.uber.cadence.api.v1.WorkflowQueryResult; import com.uber.cadence.api.v1.WorkflowType; import com.uber.cadence.api.v1.WorkflowTypeFilter; -import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -264,13 +263,13 @@ static StatusFilter statusFilter(com.uber.cadence.WorkflowExecutionCloseStatus t return StatusFilter.newBuilder().setStatus(workflowExecutionCloseStatus(t)).build(); } - static Map payloadByteBufferMap(Map t) { + static Map payloadByteBufferMap(Map t) { if (t == null) { return Collections.emptyMap(); } Map v = new HashMap<>(); for (String key : t.keySet()) { - v.put(key, payload(t.get(key).array())); + v.put(key, payload(t.get(key))); } return v; } diff --git a/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/DecisionMapper.java b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/DecisionMapper.java new file mode 100644 index 000000000..518367d37 --- /dev/null +++ b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/DecisionMapper.java @@ -0,0 +1,273 @@ +/* + * Modifications Copyright (c) 2017-2021 Uber Technologies Inc. + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * 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.compatibility.proto.mappers; + +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.continueAsNewInitiator; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.parentClosePolicy; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.workflowIdReusePolicy; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.arrayToByteString; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.longToInt; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.secondsToDuration; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.activityType; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.failure; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.header; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.memo; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.payload; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.retryPolicy; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.searchAttributes; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.taskList; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowExecution; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowRunPair; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowType; + +import com.uber.cadence.api.v1.CancelTimerDecisionAttributes; +import com.uber.cadence.api.v1.CancelWorkflowExecutionDecisionAttributes; +import com.uber.cadence.api.v1.CompleteWorkflowExecutionDecisionAttributes; +import com.uber.cadence.api.v1.ContinueAsNewWorkflowExecutionDecisionAttributes; +import com.uber.cadence.api.v1.Decision; +import com.uber.cadence.api.v1.Decision.Builder; +import com.uber.cadence.api.v1.FailWorkflowExecutionDecisionAttributes; +import com.uber.cadence.api.v1.RecordMarkerDecisionAttributes; +import com.uber.cadence.api.v1.RequestCancelActivityTaskDecisionAttributes; +import com.uber.cadence.api.v1.RequestCancelExternalWorkflowExecutionDecisionAttributes; +import com.uber.cadence.api.v1.ScheduleActivityTaskDecisionAttributes; +import com.uber.cadence.api.v1.SignalExternalWorkflowExecutionDecisionAttributes; +import com.uber.cadence.api.v1.StartChildWorkflowExecutionDecisionAttributes; +import com.uber.cadence.api.v1.StartTimerDecisionAttributes; +import com.uber.cadence.api.v1.UpsertWorkflowSearchAttributesDecisionAttributes; +import java.util.ArrayList; +import java.util.List; + +class DecisionMapper { + static List decisionArray(List t) { + if (t == null) { + return null; + } + + List v = new ArrayList<>(); + for (int i = 0; i < t.size(); i++) { + v.add(decision(t.get(i))); + } + return v; + } + + static Decision decision(com.uber.cadence.Decision d) { + if (d == null) { + return null; + } + Builder decision = Decision.newBuilder(); + switch (d.getDecisionType()) { + case ScheduleActivityTask: + { + com.uber.cadence.ScheduleActivityTaskDecisionAttributes attr = + d.getScheduleActivityTaskDecisionAttributes(); + ScheduleActivityTaskDecisionAttributes.Builder builder = + ScheduleActivityTaskDecisionAttributes.newBuilder() + .setActivityId(attr.getActivityId()) + .setActivityType(activityType(attr.getActivityType())) + .setTaskList(taskList(attr.getTaskList())) + .setInput(payload(attr.getInput())) + .setScheduleToCloseTimeout( + secondsToDuration(attr.getScheduleToCloseTimeoutSeconds())) + .setScheduleToStartTimeout( + secondsToDuration(attr.getScheduleToStartTimeoutSeconds())) + .setStartToCloseTimeout(secondsToDuration(attr.getStartToCloseTimeoutSeconds())) + .setHeartbeatTimeout(secondsToDuration(attr.getHeartbeatTimeoutSeconds())) + .setHeader(header(attr.getHeader())) + .setRequestLocalDispatch(attr.isRequestLocalDispatch()); + if (attr.getRetryPolicy() != null) { + builder.setRetryPolicy(retryPolicy(attr.getRetryPolicy())); + } + if (attr.getDomain() != null) { + builder.setDomain(attr.getDomain()); + } + decision.setScheduleActivityTaskDecisionAttributes(builder); + } + break; + case RequestCancelActivityTask: + { + com.uber.cadence.RequestCancelActivityTaskDecisionAttributes attr = + d.getRequestCancelActivityTaskDecisionAttributes(); + decision.setRequestCancelActivityTaskDecisionAttributes( + RequestCancelActivityTaskDecisionAttributes.newBuilder() + .setActivityId(attr.getActivityId())); + } + break; + case StartTimer: + { + com.uber.cadence.StartTimerDecisionAttributes attr = d.getStartTimerDecisionAttributes(); + decision.setStartTimerDecisionAttributes( + StartTimerDecisionAttributes.newBuilder() + .setTimerId(attr.getTimerId()) + .setStartToFireTimeout( + secondsToDuration(longToInt(attr.getStartToFireTimeoutSeconds())))); + } + break; + case CompleteWorkflowExecution: + { + com.uber.cadence.CompleteWorkflowExecutionDecisionAttributes attr = + d.getCompleteWorkflowExecutionDecisionAttributes(); + decision.setCompleteWorkflowExecutionDecisionAttributes( + CompleteWorkflowExecutionDecisionAttributes.newBuilder() + .setResult(payload(attr.getResult()))); + } + break; + case FailWorkflowExecution: + { + com.uber.cadence.FailWorkflowExecutionDecisionAttributes attr = + d.getFailWorkflowExecutionDecisionAttributes(); + decision.setFailWorkflowExecutionDecisionAttributes( + FailWorkflowExecutionDecisionAttributes.newBuilder() + .setFailure(failure(attr.getReason(), attr.getDetails()))); + } + break; + case CancelTimer: + { + com.uber.cadence.CancelTimerDecisionAttributes attr = + d.getCancelTimerDecisionAttributes(); + decision.setCancelTimerDecisionAttributes( + CancelTimerDecisionAttributes.newBuilder().setTimerId(attr.getTimerId())); + } + break; + case CancelWorkflowExecution: + { + com.uber.cadence.CancelWorkflowExecutionDecisionAttributes attr = + d.getCancelWorkflowExecutionDecisionAttributes(); + decision.setCancelWorkflowExecutionDecisionAttributes( + CancelWorkflowExecutionDecisionAttributes.newBuilder() + .setDetails(payload(attr.getDetails()))); + } + break; + case RequestCancelExternalWorkflowExecution: + { + com.uber.cadence.RequestCancelExternalWorkflowExecutionDecisionAttributes attr = + d.getRequestCancelExternalWorkflowExecutionDecisionAttributes(); + RequestCancelExternalWorkflowExecutionDecisionAttributes.Builder builder = + RequestCancelExternalWorkflowExecutionDecisionAttributes.newBuilder() + .setDomain(attr.getDomain()) + .setWorkflowExecution(workflowRunPair(attr.getWorkflowId(), attr.getRunId())) + .setChildWorkflowOnly(attr.isChildWorkflowOnly()); + if (attr.getControl() != null) { + builder.setControl(arrayToByteString(attr.getControl())); + } + decision.setRequestCancelExternalWorkflowExecutionDecisionAttributes(builder); + } + break; + case ContinueAsNewWorkflowExecution: + { + com.uber.cadence.ContinueAsNewWorkflowExecutionDecisionAttributes attr = + d.getContinueAsNewWorkflowExecutionDecisionAttributes(); + ContinueAsNewWorkflowExecutionDecisionAttributes.Builder builder = + ContinueAsNewWorkflowExecutionDecisionAttributes.newBuilder() + .setWorkflowType(workflowType(attr.getWorkflowType())) + .setTaskList(taskList(attr.getTaskList())) + .setInput(payload(attr.getInput())) + .setExecutionStartToCloseTimeout( + secondsToDuration(attr.getExecutionStartToCloseTimeoutSeconds())) + .setTaskStartToCloseTimeout( + secondsToDuration(attr.getTaskStartToCloseTimeoutSeconds())) + .setBackoffStartInterval( + secondsToDuration(attr.getBackoffStartIntervalInSeconds())) + .setInitiator(continueAsNewInitiator(attr.getInitiator())) + .setFailure(failure(attr.getFailureReason(), attr.getFailureDetails())) + .setLastCompletionResult(payload(attr.getLastCompletionResult())) + .setHeader(header(attr.getHeader())) + .setMemo(memo(attr.getMemo())) + .setSearchAttributes(searchAttributes(attr.getSearchAttributes())); + if (attr.getRetryPolicy() != null) { + builder.setRetryPolicy(retryPolicy(attr.getRetryPolicy())); + } + if (attr.getCronSchedule() != null) { + builder.setCronSchedule(attr.getCronSchedule()); + } + decision.setContinueAsNewWorkflowExecutionDecisionAttributes(builder); + } + break; + case StartChildWorkflowExecution: + { + com.uber.cadence.StartChildWorkflowExecutionDecisionAttributes attr = + d.getStartChildWorkflowExecutionDecisionAttributes(); + StartChildWorkflowExecutionDecisionAttributes.Builder builder = + StartChildWorkflowExecutionDecisionAttributes.newBuilder() + .setDomain(attr.getDomain()) + .setWorkflowId(attr.getWorkflowId()) + .setWorkflowType(workflowType(attr.getWorkflowType())) + .setTaskList(taskList(attr.getTaskList())) + .setInput(payload(attr.getInput())) + .setExecutionStartToCloseTimeout( + secondsToDuration(attr.getExecutionStartToCloseTimeoutSeconds())) + .setTaskStartToCloseTimeout( + secondsToDuration(attr.getTaskStartToCloseTimeoutSeconds())) + .setParentClosePolicy(parentClosePolicy(attr.getParentClosePolicy())) + .setWorkflowIdReusePolicy(workflowIdReusePolicy(attr.getWorkflowIdReusePolicy())) + .setHeader(header(attr.getHeader())) + .setMemo(memo(attr.getMemo())) + .setSearchAttributes(searchAttributes(attr.getSearchAttributes())); + if (attr.getRetryPolicy() != null) { + builder.setRetryPolicy(retryPolicy(attr.getRetryPolicy())); + } + if (attr.getControl() != null) { + builder.setControl(arrayToByteString(attr.getControl())); + } + if (attr.getCronSchedule() != null) { + builder.setCronSchedule(attr.getCronSchedule()); + } + decision.setStartChildWorkflowExecutionDecisionAttributes(builder); + } + break; + case SignalExternalWorkflowExecution: + { + com.uber.cadence.SignalExternalWorkflowExecutionDecisionAttributes attr = + d.getSignalExternalWorkflowExecutionDecisionAttributes(); + SignalExternalWorkflowExecutionDecisionAttributes.Builder builder = + SignalExternalWorkflowExecutionDecisionAttributes.newBuilder() + .setDomain(attr.getDomain()) + .setWorkflowExecution(workflowExecution(attr.getExecution())) + .setSignalName(attr.getSignalName()) + .setInput(payload(attr.getInput())) + .setChildWorkflowOnly(attr.isChildWorkflowOnly()); + if (attr.getControl() != null) { + builder.setControl(arrayToByteString(attr.getControl())); + } + decision.setSignalExternalWorkflowExecutionDecisionAttributes(builder); + } + break; + case UpsertWorkflowSearchAttributes: + { + com.uber.cadence.UpsertWorkflowSearchAttributesDecisionAttributes attr = + d.getUpsertWorkflowSearchAttributesDecisionAttributes(); + decision.setUpsertWorkflowSearchAttributesDecisionAttributes( + UpsertWorkflowSearchAttributesDecisionAttributes.newBuilder() + .setSearchAttributes(searchAttributes(attr.getSearchAttributes()))); + } + break; + case RecordMarker: + { + com.uber.cadence.RecordMarkerDecisionAttributes attr = + d.getRecordMarkerDecisionAttributes(); + decision.setRecordMarkerDecisionAttributes( + RecordMarkerDecisionAttributes.newBuilder() + .setMarkerName(attr.getMarkerName()) + .setDetails(payload(attr.getDetails())) + .setHeader(header(attr.getHeader()))); + } + break; + default: + throw new IllegalArgumentException("unknown decision type"); + } + return decision.build(); + } +} diff --git a/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/EnumMapper.java b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/EnumMapper.java new file mode 100644 index 000000000..e34de9e97 --- /dev/null +++ b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/EnumMapper.java @@ -0,0 +1,587 @@ +/* + * Modifications Copyright (c) 2017-2021 Uber Technologies Inc. + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * 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.compatibility.proto.mappers; + +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_BINARY; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_CANCEL_TIMER_ATTRIBUTES; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_CONTINUE_AS_NEW_ATTRIBUTES; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_RECORD_MARKER_ATTRIBUTES; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_SCHEDULE_ACTIVITY_ATTRIBUTES; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_SEARCH_ATTRIBUTES; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_SIGNAL_INPUT_SIZE; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_SIGNAL_WORKFLOW_EXECUTION_ATTRIBUTES; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_START_CHILD_EXECUTION_ATTRIBUTES; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_START_TIMER_ATTRIBUTES; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_FAILOVER_CLOSE_DECISION; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_FORCE_CLOSE_DECISION; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_INVALID; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_RESET_STICKY_TASK_LIST; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_RESET_WORKFLOW; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_SCHEDULE_ACTIVITY_DUPLICATE_ID; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_START_TIMER_DUPLICATE_ID; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_UNHANDLED_DECISION; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_WORKFLOW_WORKER_UNHANDLED_FAILURE; +import static com.uber.cadence.api.v1.QueryResultType.QUERY_RESULT_TYPE_ANSWERED; +import static com.uber.cadence.api.v1.QueryResultType.QUERY_RESULT_TYPE_FAILED; +import static com.uber.cadence.api.v1.QueryResultType.QUERY_RESULT_TYPE_INVALID; + +import com.uber.cadence.api.v1.*; + +public final class EnumMapper { + + private EnumMapper() {} + + public static TaskListKind taskListKind(com.uber.cadence.TaskListKind t) { + if (t == null) { + return TaskListKind.TASK_LIST_KIND_INVALID; + } + switch (t) { + case NORMAL: + return TaskListKind.TASK_LIST_KIND_NORMAL; + case STICKY: + return TaskListKind.TASK_LIST_KIND_STICKY; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static TaskListType taskListType(com.uber.cadence.TaskListType t) { + if (t == null) { + return TaskListType.TASK_LIST_TYPE_INVALID; + } + switch (t) { + case Decision: + return TaskListType.TASK_LIST_TYPE_DECISION; + case Activity: + return TaskListType.TASK_LIST_TYPE_ACTIVITY; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static EventFilterType eventFilterType(com.uber.cadence.HistoryEventFilterType t) { + if (t == null) { + return EventFilterType.EVENT_FILTER_TYPE_INVALID; + } + switch (t) { + case ALL_EVENT: + return EventFilterType.EVENT_FILTER_TYPE_ALL_EVENT; + case CLOSE_EVENT: + return EventFilterType.EVENT_FILTER_TYPE_CLOSE_EVENT; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static QueryRejectCondition queryRejectCondition(com.uber.cadence.QueryRejectCondition t) { + if (t == null) { + return QueryRejectCondition.QUERY_REJECT_CONDITION_INVALID; + } + switch (t) { + case NOT_OPEN: + return QueryRejectCondition.QUERY_REJECT_CONDITION_NOT_OPEN; + case NOT_COMPLETED_CLEANLY: + return QueryRejectCondition.QUERY_REJECT_CONDITION_NOT_COMPLETED_CLEANLY; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static QueryConsistencyLevel queryConsistencyLevel( + com.uber.cadence.QueryConsistencyLevel t) { + if (t == null) { + return QueryConsistencyLevel.QUERY_CONSISTENCY_LEVEL_INVALID; + } + switch (t) { + case EVENTUAL: + return QueryConsistencyLevel.QUERY_CONSISTENCY_LEVEL_EVENTUAL; + case STRONG: + return QueryConsistencyLevel.QUERY_CONSISTENCY_LEVEL_STRONG; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static ContinueAsNewInitiator continueAsNewInitiator( + com.uber.cadence.ContinueAsNewInitiator t) { + if (t == null) { + return ContinueAsNewInitiator.CONTINUE_AS_NEW_INITIATOR_INVALID; + } + switch (t) { + case Decider: + return ContinueAsNewInitiator.CONTINUE_AS_NEW_INITIATOR_DECIDER; + case RetryPolicy: + return ContinueAsNewInitiator.CONTINUE_AS_NEW_INITIATOR_RETRY_POLICY; + case CronSchedule: + return ContinueAsNewInitiator.CONTINUE_AS_NEW_INITIATOR_CRON_SCHEDULE; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static WorkflowIdReusePolicy workflowIdReusePolicy( + com.uber.cadence.WorkflowIdReusePolicy t) { + if (t == null) { + return WorkflowIdReusePolicy.WORKFLOW_ID_REUSE_POLICY_INVALID; + } + switch (t) { + case AllowDuplicateFailedOnly: + return WorkflowIdReusePolicy.WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY; + case AllowDuplicate: + return WorkflowIdReusePolicy.WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE; + case RejectDuplicate: + return WorkflowIdReusePolicy.WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE; + case TerminateIfRunning: + return WorkflowIdReusePolicy.WORKFLOW_ID_REUSE_POLICY_TERMINATE_IF_RUNNING; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static QueryResultType queryResultType(com.uber.cadence.QueryResultType t) { + if (t == null) { + return QUERY_RESULT_TYPE_INVALID; + } + switch (t) { + case ANSWERED: + return QUERY_RESULT_TYPE_ANSWERED; + case FAILED: + return QUERY_RESULT_TYPE_FAILED; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static ArchivalStatus archivalStatus(com.uber.cadence.ArchivalStatus t) { + if (t == null) { + return ArchivalStatus.ARCHIVAL_STATUS_INVALID; + } + switch (t) { + case DISABLED: + return ArchivalStatus.ARCHIVAL_STATUS_DISABLED; + case ENABLED: + return ArchivalStatus.ARCHIVAL_STATUS_ENABLED; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static ParentClosePolicy parentClosePolicy(com.uber.cadence.ParentClosePolicy t) { + if (t == null) { + return ParentClosePolicy.PARENT_CLOSE_POLICY_INVALID; + } + switch (t) { + case ABANDON: + return ParentClosePolicy.PARENT_CLOSE_POLICY_ABANDON; + case REQUEST_CANCEL: + return ParentClosePolicy.PARENT_CLOSE_POLICY_REQUEST_CANCEL; + case TERMINATE: + return ParentClosePolicy.PARENT_CLOSE_POLICY_TERMINATE; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static DecisionTaskFailedCause decisionTaskFailedCause( + com.uber.cadence.DecisionTaskFailedCause t) { + if (t == null) { + return DECISION_TASK_FAILED_CAUSE_INVALID; + } + switch (t) { + case UNHANDLED_DECISION: + return DECISION_TASK_FAILED_CAUSE_UNHANDLED_DECISION; + case BAD_SCHEDULE_ACTIVITY_ATTRIBUTES: + return DECISION_TASK_FAILED_CAUSE_BAD_SCHEDULE_ACTIVITY_ATTRIBUTES; + case BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES: + return DECISION_TASK_FAILED_CAUSE_BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES; + case BAD_START_TIMER_ATTRIBUTES: + return DECISION_TASK_FAILED_CAUSE_BAD_START_TIMER_ATTRIBUTES; + case BAD_CANCEL_TIMER_ATTRIBUTES: + return DECISION_TASK_FAILED_CAUSE_BAD_CANCEL_TIMER_ATTRIBUTES; + case BAD_RECORD_MARKER_ATTRIBUTES: + return DECISION_TASK_FAILED_CAUSE_BAD_RECORD_MARKER_ATTRIBUTES; + case BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES: + return DECISION_TASK_FAILED_CAUSE_BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES; + case BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES: + return DECISION_TASK_FAILED_CAUSE_BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES; + case BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES: + return DECISION_TASK_FAILED_CAUSE_BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES; + case BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES: + return DECISION_TASK_FAILED_CAUSE_BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES; + case BAD_CONTINUE_AS_NEW_ATTRIBUTES: + return DECISION_TASK_FAILED_CAUSE_BAD_CONTINUE_AS_NEW_ATTRIBUTES; + case START_TIMER_DUPLICATE_ID: + return DECISION_TASK_FAILED_CAUSE_START_TIMER_DUPLICATE_ID; + case RESET_STICKY_TASKLIST: + return DECISION_TASK_FAILED_CAUSE_RESET_STICKY_TASK_LIST; + case WORKFLOW_WORKER_UNHANDLED_FAILURE: + return DECISION_TASK_FAILED_CAUSE_WORKFLOW_WORKER_UNHANDLED_FAILURE; + case BAD_SIGNAL_WORKFLOW_EXECUTION_ATTRIBUTES: + return DECISION_TASK_FAILED_CAUSE_BAD_SIGNAL_WORKFLOW_EXECUTION_ATTRIBUTES; + case BAD_START_CHILD_EXECUTION_ATTRIBUTES: + return DECISION_TASK_FAILED_CAUSE_BAD_START_CHILD_EXECUTION_ATTRIBUTES; + case FORCE_CLOSE_DECISION: + return DECISION_TASK_FAILED_CAUSE_FORCE_CLOSE_DECISION; + case FAILOVER_CLOSE_DECISION: + return DECISION_TASK_FAILED_CAUSE_FAILOVER_CLOSE_DECISION; + case BAD_SIGNAL_INPUT_SIZE: + return DECISION_TASK_FAILED_CAUSE_BAD_SIGNAL_INPUT_SIZE; + case RESET_WORKFLOW: + return DECISION_TASK_FAILED_CAUSE_RESET_WORKFLOW; + case BAD_BINARY: + return DECISION_TASK_FAILED_CAUSE_BAD_BINARY; + case SCHEDULE_ACTIVITY_DUPLICATE_ID: + return DECISION_TASK_FAILED_CAUSE_SCHEDULE_ACTIVITY_DUPLICATE_ID; + case BAD_SEARCH_ATTRIBUTES: + return DECISION_TASK_FAILED_CAUSE_BAD_SEARCH_ATTRIBUTES; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static WorkflowExecutionCloseStatus workflowExecutionCloseStatus( + com.uber.cadence.WorkflowExecutionCloseStatus t) { + if (t == null) { + return WorkflowExecutionCloseStatus.WORKFLOW_EXECUTION_CLOSE_STATUS_INVALID; + } + switch (t) { + case COMPLETED: + return WorkflowExecutionCloseStatus.WORKFLOW_EXECUTION_CLOSE_STATUS_COMPLETED; + case FAILED: + return WorkflowExecutionCloseStatus.WORKFLOW_EXECUTION_CLOSE_STATUS_FAILED; + case CANCELED: + return WorkflowExecutionCloseStatus.WORKFLOW_EXECUTION_CLOSE_STATUS_CANCELED; + case TERMINATED: + return WorkflowExecutionCloseStatus.WORKFLOW_EXECUTION_CLOSE_STATUS_TERMINATED; + case CONTINUED_AS_NEW: + return WorkflowExecutionCloseStatus.WORKFLOW_EXECUTION_CLOSE_STATUS_CONTINUED_AS_NEW; + case TIMED_OUT: + return WorkflowExecutionCloseStatus.WORKFLOW_EXECUTION_CLOSE_STATUS_TIMED_OUT; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static QueryResultType queryTaskCompletedType(com.uber.cadence.QueryTaskCompletedType t) { + if (t == null) { + return QUERY_RESULT_TYPE_INVALID; + } + switch (t) { + case COMPLETED: + return QUERY_RESULT_TYPE_ANSWERED; + case FAILED: + return QUERY_RESULT_TYPE_FAILED; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.TaskListKind taskListKind(TaskListKind t) { + switch (t) { + case TASK_LIST_KIND_INVALID: + return null; + case TASK_LIST_KIND_NORMAL: + return com.uber.cadence.TaskListKind.NORMAL; + case TASK_LIST_KIND_STICKY: + return com.uber.cadence.TaskListKind.STICKY; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.QueryRejectCondition queryRejectCondition(QueryRejectCondition t) { + if (t == QueryRejectCondition.QUERY_REJECT_CONDITION_INVALID) { + return null; + } + switch (t) { + case QUERY_REJECT_CONDITION_NOT_OPEN: + return com.uber.cadence.QueryRejectCondition.NOT_OPEN; + case QUERY_REJECT_CONDITION_NOT_COMPLETED_CLEANLY: + return com.uber.cadence.QueryRejectCondition.NOT_COMPLETED_CLEANLY; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.ContinueAsNewInitiator continueAsNewInitiator( + ContinueAsNewInitiator t) { + switch (t) { + case CONTINUE_AS_NEW_INITIATOR_INVALID: + return null; + case CONTINUE_AS_NEW_INITIATOR_DECIDER: + return com.uber.cadence.ContinueAsNewInitiator.Decider; + case CONTINUE_AS_NEW_INITIATOR_RETRY_POLICY: + return com.uber.cadence.ContinueAsNewInitiator.RetryPolicy; + case CONTINUE_AS_NEW_INITIATOR_CRON_SCHEDULE: + return com.uber.cadence.ContinueAsNewInitiator.CronSchedule; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.WorkflowIdReusePolicy workflowIdReusePolicy( + WorkflowIdReusePolicy t) { + switch (t) { + case WORKFLOW_ID_REUSE_POLICY_INVALID: + return null; + case WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY: + return com.uber.cadence.WorkflowIdReusePolicy.AllowDuplicateFailedOnly; + case WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE: + return com.uber.cadence.WorkflowIdReusePolicy.AllowDuplicate; + case WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE: + return com.uber.cadence.WorkflowIdReusePolicy.RejectDuplicate; + case WORKFLOW_ID_REUSE_POLICY_TERMINATE_IF_RUNNING: + return com.uber.cadence.WorkflowIdReusePolicy.TerminateIfRunning; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.ArchivalStatus archivalStatus(ArchivalStatus t) { + switch (t) { + case ARCHIVAL_STATUS_INVALID: + return null; + case ARCHIVAL_STATUS_DISABLED: + return com.uber.cadence.ArchivalStatus.DISABLED; + case ARCHIVAL_STATUS_ENABLED: + return com.uber.cadence.ArchivalStatus.ENABLED; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.ParentClosePolicy parentClosePolicy(ParentClosePolicy t) { + switch (t) { + case PARENT_CLOSE_POLICY_INVALID: + return null; + case PARENT_CLOSE_POLICY_ABANDON: + return com.uber.cadence.ParentClosePolicy.ABANDON; + case PARENT_CLOSE_POLICY_REQUEST_CANCEL: + return com.uber.cadence.ParentClosePolicy.REQUEST_CANCEL; + case PARENT_CLOSE_POLICY_TERMINATE: + return com.uber.cadence.ParentClosePolicy.TERMINATE; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.DecisionTaskFailedCause decisionTaskFailedCause( + DecisionTaskFailedCause t) { + switch (t) { + case DECISION_TASK_FAILED_CAUSE_INVALID: + return null; + case DECISION_TASK_FAILED_CAUSE_UNHANDLED_DECISION: + return com.uber.cadence.DecisionTaskFailedCause.UNHANDLED_DECISION; + case DECISION_TASK_FAILED_CAUSE_BAD_SCHEDULE_ACTIVITY_ATTRIBUTES: + return com.uber.cadence.DecisionTaskFailedCause.BAD_SCHEDULE_ACTIVITY_ATTRIBUTES; + case DECISION_TASK_FAILED_CAUSE_BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES: + return com.uber.cadence.DecisionTaskFailedCause.BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES; + case DECISION_TASK_FAILED_CAUSE_BAD_START_TIMER_ATTRIBUTES: + return com.uber.cadence.DecisionTaskFailedCause.BAD_START_TIMER_ATTRIBUTES; + case DECISION_TASK_FAILED_CAUSE_BAD_CANCEL_TIMER_ATTRIBUTES: + return com.uber.cadence.DecisionTaskFailedCause.BAD_CANCEL_TIMER_ATTRIBUTES; + case DECISION_TASK_FAILED_CAUSE_BAD_RECORD_MARKER_ATTRIBUTES: + return com.uber.cadence.DecisionTaskFailedCause.BAD_RECORD_MARKER_ATTRIBUTES; + case DECISION_TASK_FAILED_CAUSE_BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES: + return com.uber.cadence.DecisionTaskFailedCause.BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES; + case DECISION_TASK_FAILED_CAUSE_BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES: + return com.uber.cadence.DecisionTaskFailedCause.BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES; + case DECISION_TASK_FAILED_CAUSE_BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES: + return com.uber.cadence.DecisionTaskFailedCause.BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES; + case DECISION_TASK_FAILED_CAUSE_BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES: + return com.uber.cadence.DecisionTaskFailedCause + .BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES; + case DECISION_TASK_FAILED_CAUSE_BAD_CONTINUE_AS_NEW_ATTRIBUTES: + return com.uber.cadence.DecisionTaskFailedCause.BAD_CONTINUE_AS_NEW_ATTRIBUTES; + case DECISION_TASK_FAILED_CAUSE_START_TIMER_DUPLICATE_ID: + return com.uber.cadence.DecisionTaskFailedCause.START_TIMER_DUPLICATE_ID; + case DECISION_TASK_FAILED_CAUSE_RESET_STICKY_TASK_LIST: + return com.uber.cadence.DecisionTaskFailedCause.RESET_STICKY_TASKLIST; + case DECISION_TASK_FAILED_CAUSE_WORKFLOW_WORKER_UNHANDLED_FAILURE: + return com.uber.cadence.DecisionTaskFailedCause.WORKFLOW_WORKER_UNHANDLED_FAILURE; + case DECISION_TASK_FAILED_CAUSE_BAD_SIGNAL_WORKFLOW_EXECUTION_ATTRIBUTES: + return com.uber.cadence.DecisionTaskFailedCause.BAD_SIGNAL_WORKFLOW_EXECUTION_ATTRIBUTES; + case DECISION_TASK_FAILED_CAUSE_BAD_START_CHILD_EXECUTION_ATTRIBUTES: + return com.uber.cadence.DecisionTaskFailedCause.BAD_START_CHILD_EXECUTION_ATTRIBUTES; + case DECISION_TASK_FAILED_CAUSE_FORCE_CLOSE_DECISION: + return com.uber.cadence.DecisionTaskFailedCause.FORCE_CLOSE_DECISION; + case DECISION_TASK_FAILED_CAUSE_FAILOVER_CLOSE_DECISION: + return com.uber.cadence.DecisionTaskFailedCause.FAILOVER_CLOSE_DECISION; + case DECISION_TASK_FAILED_CAUSE_BAD_SIGNAL_INPUT_SIZE: + return com.uber.cadence.DecisionTaskFailedCause.BAD_SIGNAL_INPUT_SIZE; + case DECISION_TASK_FAILED_CAUSE_RESET_WORKFLOW: + return com.uber.cadence.DecisionTaskFailedCause.RESET_WORKFLOW; + case DECISION_TASK_FAILED_CAUSE_BAD_BINARY: + return com.uber.cadence.DecisionTaskFailedCause.BAD_BINARY; + case DECISION_TASK_FAILED_CAUSE_SCHEDULE_ACTIVITY_DUPLICATE_ID: + return com.uber.cadence.DecisionTaskFailedCause.SCHEDULE_ACTIVITY_DUPLICATE_ID; + case DECISION_TASK_FAILED_CAUSE_BAD_SEARCH_ATTRIBUTES: + return com.uber.cadence.DecisionTaskFailedCause.BAD_SEARCH_ATTRIBUTES; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.WorkflowExecutionCloseStatus workflowExecutionCloseStatus( + WorkflowExecutionCloseStatus t) { + switch (t) { + case WORKFLOW_EXECUTION_CLOSE_STATUS_INVALID: + return null; + case WORKFLOW_EXECUTION_CLOSE_STATUS_COMPLETED: + return com.uber.cadence.WorkflowExecutionCloseStatus.COMPLETED; + case WORKFLOW_EXECUTION_CLOSE_STATUS_FAILED: + return com.uber.cadence.WorkflowExecutionCloseStatus.FAILED; + case WORKFLOW_EXECUTION_CLOSE_STATUS_CANCELED: + return com.uber.cadence.WorkflowExecutionCloseStatus.CANCELED; + case WORKFLOW_EXECUTION_CLOSE_STATUS_TERMINATED: + return com.uber.cadence.WorkflowExecutionCloseStatus.TERMINATED; + case WORKFLOW_EXECUTION_CLOSE_STATUS_CONTINUED_AS_NEW: + return com.uber.cadence.WorkflowExecutionCloseStatus.CONTINUED_AS_NEW; + case WORKFLOW_EXECUTION_CLOSE_STATUS_TIMED_OUT: + return com.uber.cadence.WorkflowExecutionCloseStatus.TIMED_OUT; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.DomainStatus domainStatus(DomainStatus t) { + switch (t) { + case DOMAIN_STATUS_INVALID: + return null; + case DOMAIN_STATUS_REGISTERED: + return com.uber.cadence.DomainStatus.REGISTERED; + case DOMAIN_STATUS_DEPRECATED: + return com.uber.cadence.DomainStatus.DEPRECATED; + case DOMAIN_STATUS_DELETED: + return com.uber.cadence.DomainStatus.DELETED; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.PendingActivityState pendingActivityState(PendingActivityState t) { + switch (t) { + case PENDING_ACTIVITY_STATE_INVALID: + return null; + case PENDING_ACTIVITY_STATE_SCHEDULED: + return com.uber.cadence.PendingActivityState.SCHEDULED; + case PENDING_ACTIVITY_STATE_STARTED: + return com.uber.cadence.PendingActivityState.STARTED; + case PENDING_ACTIVITY_STATE_CANCEL_REQUESTED: + return com.uber.cadence.PendingActivityState.CANCEL_REQUESTED; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.PendingDecisionState pendingDecisionState(PendingDecisionState t) { + switch (t) { + case PENDING_DECISION_STATE_INVALID: + return null; + case PENDING_DECISION_STATE_SCHEDULED: + return com.uber.cadence.PendingDecisionState.SCHEDULED; + case PENDING_DECISION_STATE_STARTED: + return com.uber.cadence.PendingDecisionState.STARTED; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.IndexedValueType indexedValueType(IndexedValueType t) { + switch (t) { + case INDEXED_VALUE_TYPE_INVALID: + throw new IllegalArgumentException("received IndexedValueType_INDEXED_VALUE_TYPE_INVALID"); + case INDEXED_VALUE_TYPE_STRING: + return com.uber.cadence.IndexedValueType.STRING; + case INDEXED_VALUE_TYPE_KEYWORD: + return com.uber.cadence.IndexedValueType.KEYWORD; + case INDEXED_VALUE_TYPE_INT: + return com.uber.cadence.IndexedValueType.INT; + case INDEXED_VALUE_TYPE_DOUBLE: + return com.uber.cadence.IndexedValueType.DOUBLE; + case INDEXED_VALUE_TYPE_BOOL: + return com.uber.cadence.IndexedValueType.BOOL; + case INDEXED_VALUE_TYPE_DATETIME: + return com.uber.cadence.IndexedValueType.DATETIME; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.EncodingType encodingType(EncodingType t) { + switch (t) { + case ENCODING_TYPE_INVALID: + return null; + case ENCODING_TYPE_THRIFTRW: + return com.uber.cadence.EncodingType.ThriftRW; + case ENCODING_TYPE_JSON: + return com.uber.cadence.EncodingType.JSON; + case ENCODING_TYPE_PROTO3: + throw new UnsupportedOperationException(); + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.TimeoutType timeoutType(TimeoutType t) { + switch (t) { + case TIMEOUT_TYPE_INVALID: + return null; + case TIMEOUT_TYPE_START_TO_CLOSE: + return com.uber.cadence.TimeoutType.START_TO_CLOSE; + case TIMEOUT_TYPE_SCHEDULE_TO_START: + return com.uber.cadence.TimeoutType.SCHEDULE_TO_START; + case TIMEOUT_TYPE_SCHEDULE_TO_CLOSE: + return com.uber.cadence.TimeoutType.SCHEDULE_TO_CLOSE; + case TIMEOUT_TYPE_HEARTBEAT: + return com.uber.cadence.TimeoutType.HEARTBEAT; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.DecisionTaskTimedOutCause decisionTaskTimedOutCause( + DecisionTaskTimedOutCause t) { + switch (t) { + case DECISION_TASK_TIMED_OUT_CAUSE_INVALID: + return null; + case DECISION_TASK_TIMED_OUT_CAUSE_TIMEOUT: + return com.uber.cadence.DecisionTaskTimedOutCause.TIMEOUT; + case DECISION_TASK_TIMED_OUT_CAUSE_RESET: + return com.uber.cadence.DecisionTaskTimedOutCause.RESET; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.CancelExternalWorkflowExecutionFailedCause + cancelExternalWorkflowExecutionFailedCause(CancelExternalWorkflowExecutionFailedCause t) { + switch (t) { + case CANCEL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_INVALID: + return null; + case CANCEL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION: + return com.uber.cadence.CancelExternalWorkflowExecutionFailedCause + .UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION; + case CANCEL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_WORKFLOW_ALREADY_COMPLETED: + return com.uber.cadence.CancelExternalWorkflowExecutionFailedCause + .WORKFLOW_ALREADY_COMPLETED; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.SignalExternalWorkflowExecutionFailedCause + signalExternalWorkflowExecutionFailedCause(SignalExternalWorkflowExecutionFailedCause t) { + switch (t) { + case SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_INVALID: + return null; + case SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION: + return com.uber.cadence.SignalExternalWorkflowExecutionFailedCause + .UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION; + case SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_WORKFLOW_ALREADY_COMPLETED: + return com.uber.cadence.SignalExternalWorkflowExecutionFailedCause + .WORKFLOW_ALREADY_COMPLETED; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.ChildWorkflowExecutionFailedCause + childWorkflowExecutionFailedCause(ChildWorkflowExecutionFailedCause t) { + switch (t) { + case CHILD_WORKFLOW_EXECUTION_FAILED_CAUSE_INVALID: + return null; + case CHILD_WORKFLOW_EXECUTION_FAILED_CAUSE_WORKFLOW_ALREADY_RUNNING: + return com.uber.cadence.ChildWorkflowExecutionFailedCause.WORKFLOW_ALREADY_RUNNING; + } + throw new IllegalArgumentException("unexpected enum value"); + } +} diff --git a/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/ErrorMapper.java b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/ErrorMapper.java new file mode 100644 index 000000000..12fd31fe5 --- /dev/null +++ b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/ErrorMapper.java @@ -0,0 +1,109 @@ +/* + * 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.compatibility.proto.mappers; + +import com.google.protobuf.Any; +import com.google.protobuf.InvalidProtocolBufferException; +import com.google.rpc.Status; +import com.uber.cadence.AccessDeniedError; +import com.uber.cadence.BaseError; +import com.uber.cadence.CancellationAlreadyRequestedError; +import com.uber.cadence.ClientVersionNotSupportedError; +import com.uber.cadence.DomainAlreadyExistsError; +import com.uber.cadence.DomainNotActiveError; +import com.uber.cadence.EntityNotExistsError; +import com.uber.cadence.FeatureNotEnabledError; +import com.uber.cadence.InternalDataInconsistencyError; +import com.uber.cadence.InternalServiceError; +import com.uber.cadence.LimitExceededError; +import com.uber.cadence.ServiceBusyError; +import com.uber.cadence.WorkflowExecutionAlreadyCompletedError; +import com.uber.cadence.WorkflowExecutionAlreadyStartedError; +import io.grpc.StatusRuntimeException; +import io.grpc.protobuf.StatusProto; + +public class ErrorMapper { + public static BaseError Error(StatusRuntimeException e) { + + Status status = StatusProto.fromThrowable(e); + if (status == null) { + return new BaseError("empty status", e); + } + + Any detail = Any.getDefaultInstance(); + if (status.getDetailsCount() > 0) { + detail = status.getDetails(0); + } + + try { + switch (e.getStatus().getCode()) { + case PERMISSION_DENIED: + return new AccessDeniedError(e); + case INTERNAL: + return new InternalServiceError(e); + case NOT_FOUND: + if (detail.is(com.uber.cadence.api.v1.WorkflowExecutionAlreadyCompletedError.class)) { + return new WorkflowExecutionAlreadyCompletedError(e); + } else { + return new EntityNotExistsError(e); + } + case ALREADY_EXISTS: + if (detail.is(com.uber.cadence.api.v1.CancellationAlreadyRequestedError.class)) { + return new CancellationAlreadyRequestedError(e); + } else if (detail.is(com.uber.cadence.api.v1.DomainAlreadyExistsError.class)) { + return new DomainAlreadyExistsError(e); + } else if (detail.is( + com.uber.cadence.api.v1.WorkflowExecutionAlreadyStartedError.class)) { + com.uber.cadence.api.v1.WorkflowExecutionAlreadyStartedError error = + detail.unpack(com.uber.cadence.api.v1.WorkflowExecutionAlreadyStartedError.class); + return new WorkflowExecutionAlreadyStartedError( + error.getStartRequestId(), error.getRunId()); + } + case DATA_LOSS: + return new InternalDataInconsistencyError(e); + case FAILED_PRECONDITION: + if (detail.is(com.uber.cadence.api.v1.ClientVersionNotSupportedError.class)) { + com.uber.cadence.api.v1.ClientVersionNotSupportedError error = + detail.unpack(com.uber.cadence.api.v1.ClientVersionNotSupportedError.class); + return new ClientVersionNotSupportedError( + error.getFeatureVersion(), error.getClientImpl(), error.getSupportedVersions()); + } else if (detail.is(com.uber.cadence.api.v1.FeatureNotEnabledError.class)) { + com.uber.cadence.api.v1.FeatureNotEnabledError error = + detail.unpack(com.uber.cadence.api.v1.FeatureNotEnabledError.class); + return new FeatureNotEnabledError(error.getFeatureFlag()); + } else if (detail.is(com.uber.cadence.api.v1.DomainNotActiveError.class)) { + com.uber.cadence.api.v1.DomainNotActiveError error = + detail.unpack(com.uber.cadence.api.v1.DomainNotActiveError.class); + return new DomainNotActiveError( + error.getDomain(), error.getCurrentCluster(), error.getActiveCluster()); + } + case RESOURCE_EXHAUSTED: + if (detail.is(com.uber.cadence.api.v1.LimitExceededError.class)) { + return new LimitExceededError(e); + } else { + return new ServiceBusyError(e); + } + case UNKNOWN: + default: + return new BaseError(e); + } + } catch (InvalidProtocolBufferException ex) { + return new BaseError(ex); + } + } +} diff --git a/src/main/java/com/uber/cadence/internal/compatibility/thrift/Helpers.java b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/Helpers.java similarity index 52% rename from src/main/java/com/uber/cadence/internal/compatibility/thrift/Helpers.java rename to src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/Helpers.java index a80a79c44..8128fbc66 100644 --- a/src/main/java/com/uber/cadence/internal/compatibility/thrift/Helpers.java +++ b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/Helpers.java @@ -13,17 +13,67 @@ * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ -package com.uber.cadence.internal.compatibility.thrift; +package com.uber.cadence.internal.compatibility.proto.mappers; +import com.google.common.base.MoreObjects; +import com.google.common.base.Strings; import com.google.protobuf.ByteString; +import com.google.protobuf.DoubleValue; import com.google.protobuf.Duration; +import com.google.protobuf.FieldMask; import com.google.protobuf.Int64Value; import com.google.protobuf.Timestamp; import com.google.protobuf.util.Durations; import com.google.protobuf.util.Timestamps; +import java.util.Collections; +import java.util.List; +import java.util.Map; class Helpers { + static DoubleValue fromDoubleValue(double v) { + return DoubleValue.newBuilder().setValue(v).build(); + } + + static Timestamp unixNanoToTime(long t) { + return Timestamps.fromNanos(t); + } + + static Duration secondsToDuration(int d) { + return Duration.newBuilder().setSeconds(d).build(); + } + + static int longToInt(long v) { + return (int) v; + } + + static FieldMask newFieldMask(List fields) { + return FieldMask.newBuilder().addAllPaths(fields).build(); + } + + static Duration daysToDuration(int days) { + return Durations.fromDays(days); + } + + static Map nullToEmpty(Map t) { + return MoreObjects.firstNonNull(t, Collections.emptyMap()); + } + + static String nullToEmpty(String t) { + return Strings.nullToEmpty(t); + } + + static boolean nullToEmpty(boolean t) { + return MoreObjects.firstNonNull(t, false); + } + + static ByteString arrayToByteString(byte[] t) { + if (t == null) { + return null; + } + return ByteString.copyFrom(t); + } + static long toInt64Value(Int64Value v) { return v.getValue(); } diff --git a/src/main/java/com/uber/cadence/internal/compatibility/thrift/HistoryMapper.java b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/HistoryMapper.java similarity index 71% rename from src/main/java/com/uber/cadence/internal/compatibility/thrift/HistoryMapper.java rename to src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/HistoryMapper.java index ed1b0b54d..2fef9712e 100644 --- a/src/main/java/com/uber/cadence/internal/compatibility/thrift/HistoryMapper.java +++ b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/HistoryMapper.java @@ -13,154 +13,70 @@ * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ -package com.uber.cadence.internal.compatibility.thrift; +package com.uber.cadence.internal.compatibility.proto.mappers; -import static com.uber.cadence.EventType.ActivityTaskCancelRequested; -import static com.uber.cadence.EventType.ActivityTaskCanceled; -import static com.uber.cadence.EventType.ActivityTaskCompleted; -import static com.uber.cadence.EventType.ActivityTaskFailed; -import static com.uber.cadence.EventType.ActivityTaskScheduled; -import static com.uber.cadence.EventType.ActivityTaskStarted; -import static com.uber.cadence.EventType.ActivityTaskTimedOut; -import static com.uber.cadence.EventType.CancelTimerFailed; -import static com.uber.cadence.EventType.ChildWorkflowExecutionCanceled; -import static com.uber.cadence.EventType.ChildWorkflowExecutionCompleted; -import static com.uber.cadence.EventType.ChildWorkflowExecutionFailed; -import static com.uber.cadence.EventType.ChildWorkflowExecutionStarted; -import static com.uber.cadence.EventType.ChildWorkflowExecutionTerminated; -import static com.uber.cadence.EventType.ChildWorkflowExecutionTimedOut; -import static com.uber.cadence.EventType.DecisionTaskCompleted; -import static com.uber.cadence.EventType.DecisionTaskFailed; -import static com.uber.cadence.EventType.DecisionTaskScheduled; -import static com.uber.cadence.EventType.DecisionTaskStarted; -import static com.uber.cadence.EventType.DecisionTaskTimedOut; -import static com.uber.cadence.EventType.ExternalWorkflowExecutionCancelRequested; -import static com.uber.cadence.EventType.ExternalWorkflowExecutionSignaled; -import static com.uber.cadence.EventType.MarkerRecorded; -import static com.uber.cadence.EventType.RequestCancelActivityTaskFailed; -import static com.uber.cadence.EventType.RequestCancelExternalWorkflowExecutionFailed; -import static com.uber.cadence.EventType.RequestCancelExternalWorkflowExecutionInitiated; -import static com.uber.cadence.EventType.SignalExternalWorkflowExecutionFailed; -import static com.uber.cadence.EventType.SignalExternalWorkflowExecutionInitiated; -import static com.uber.cadence.EventType.StartChildWorkflowExecutionFailed; -import static com.uber.cadence.EventType.StartChildWorkflowExecutionInitiated; -import static com.uber.cadence.EventType.TimerCanceled; -import static com.uber.cadence.EventType.TimerFired; -import static com.uber.cadence.EventType.TimerStarted; -import static com.uber.cadence.EventType.UpsertWorkflowSearchAttributes; -import static com.uber.cadence.EventType.WorkflowExecutionCancelRequested; -import static com.uber.cadence.EventType.WorkflowExecutionCanceled; -import static com.uber.cadence.EventType.WorkflowExecutionCompleted; -import static com.uber.cadence.EventType.WorkflowExecutionContinuedAsNew; -import static com.uber.cadence.EventType.WorkflowExecutionFailed; -import static com.uber.cadence.EventType.WorkflowExecutionSignaled; -import static com.uber.cadence.EventType.WorkflowExecutionStarted; -import static com.uber.cadence.EventType.WorkflowExecutionTerminated; -import static com.uber.cadence.EventType.WorkflowExecutionTimedOut; -import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.cancelExternalWorkflowExecutionFailedCause; -import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.childWorkflowExecutionFailedCause; -import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.continueAsNewInitiator; -import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.decisionTaskFailedCause; -import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.decisionTaskTimedOutCause; -import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.parentClosePolicy; -import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.signalExternalWorkflowExecutionFailedCause; -import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.timeoutType; -import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.workflowIdReusePolicy; -import static com.uber.cadence.internal.compatibility.thrift.Helpers.byteStringToArray; -import static com.uber.cadence.internal.compatibility.thrift.Helpers.durationToSeconds; -import static com.uber.cadence.internal.compatibility.thrift.Helpers.timeToUnixNano; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.activityType; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.externalInitiatedId; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.externalWorkflowExecution; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.failureDetails; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.failureReason; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.header; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.memo; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.parentDomainName; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.parentInitiatedId; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.parentWorkflowExecution; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.payload; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.resetPoints; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.retryPolicy; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.searchAttributes; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.taskList; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.workflowExecution; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.workflowType; +import static com.uber.cadence.EventType.*; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.cancelExternalWorkflowExecutionFailedCause; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.childWorkflowExecutionFailedCause; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.continueAsNewInitiator; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.decisionTaskFailedCause; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.decisionTaskTimedOutCause; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.parentClosePolicy; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.signalExternalWorkflowExecutionFailedCause; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.timeoutType; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.workflowIdReusePolicy; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.byteStringToArray; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.durationToSeconds; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.timeToUnixNano; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.activityType; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.externalInitiatedId; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.externalWorkflowExecution; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.failureDetails; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.failureReason; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.header; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.memo; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.parentDomainName; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.parentInitiatedId; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.parentWorkflowExecution; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.payload; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.resetPoints; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.retryPolicy; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.searchAttributes; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.taskList; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowExecution; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowType; -import com.uber.cadence.ActivityTaskCancelRequestedEventAttributes; -import com.uber.cadence.ActivityTaskCanceledEventAttributes; -import com.uber.cadence.ActivityTaskCompletedEventAttributes; -import com.uber.cadence.ActivityTaskFailedEventAttributes; -import com.uber.cadence.ActivityTaskScheduledEventAttributes; -import com.uber.cadence.ActivityTaskStartedEventAttributes; -import com.uber.cadence.ActivityTaskTimedOutEventAttributes; -import com.uber.cadence.CancelTimerFailedEventAttributes; -import com.uber.cadence.ChildWorkflowExecutionCanceledEventAttributes; -import com.uber.cadence.ChildWorkflowExecutionCompletedEventAttributes; -import com.uber.cadence.ChildWorkflowExecutionFailedEventAttributes; -import com.uber.cadence.ChildWorkflowExecutionStartedEventAttributes; -import com.uber.cadence.ChildWorkflowExecutionTerminatedEventAttributes; -import com.uber.cadence.ChildWorkflowExecutionTimedOutEventAttributes; -import com.uber.cadence.DecisionTaskCompletedEventAttributes; -import com.uber.cadence.DecisionTaskFailedEventAttributes; -import com.uber.cadence.DecisionTaskScheduledEventAttributes; -import com.uber.cadence.DecisionTaskStartedEventAttributes; -import com.uber.cadence.DecisionTaskTimedOutEventAttributes; -import com.uber.cadence.ExternalWorkflowExecutionCancelRequestedEventAttributes; -import com.uber.cadence.ExternalWorkflowExecutionSignaledEventAttributes; -import com.uber.cadence.History; -import com.uber.cadence.HistoryEvent; -import com.uber.cadence.MarkerRecordedEventAttributes; -import com.uber.cadence.RequestCancelActivityTaskFailedEventAttributes; -import com.uber.cadence.RequestCancelExternalWorkflowExecutionFailedEventAttributes; -import com.uber.cadence.RequestCancelExternalWorkflowExecutionInitiatedEventAttributes; -import com.uber.cadence.SignalExternalWorkflowExecutionFailedEventAttributes; -import com.uber.cadence.SignalExternalWorkflowExecutionInitiatedEventAttributes; -import com.uber.cadence.StartChildWorkflowExecutionFailedEventAttributes; -import com.uber.cadence.StartChildWorkflowExecutionInitiatedEventAttributes; -import com.uber.cadence.TimerCanceledEventAttributes; -import com.uber.cadence.TimerFiredEventAttributes; -import com.uber.cadence.TimerStartedEventAttributes; -import com.uber.cadence.UpsertWorkflowSearchAttributesEventAttributes; -import com.uber.cadence.WorkflowExecutionCancelRequestedEventAttributes; -import com.uber.cadence.WorkflowExecutionCanceledEventAttributes; -import com.uber.cadence.WorkflowExecutionCompletedEventAttributes; -import com.uber.cadence.WorkflowExecutionContinuedAsNewEventAttributes; -import com.uber.cadence.WorkflowExecutionFailedEventAttributes; -import com.uber.cadence.WorkflowExecutionSignaledEventAttributes; -import com.uber.cadence.WorkflowExecutionStartedEventAttributes; -import com.uber.cadence.WorkflowExecutionTerminatedEventAttributes; -import com.uber.cadence.WorkflowExecutionTimedOutEventAttributes; import java.util.ArrayList; import java.util.List; class HistoryMapper { - static History history(com.uber.cadence.api.v1.History t) { + static com.uber.cadence.History history(com.uber.cadence.api.v1.History t) { if (t == null || t == com.uber.cadence.api.v1.History.getDefaultInstance()) { return null; } - History history = new History(); + com.uber.cadence.History history = new com.uber.cadence.History(); history.setEvents(historyEventArray(t.getEventsList())); return history; } - static List historyEventArray(List t) { + static List historyEventArray( + List t) { if (t == null) { return null; } - List v = new ArrayList<>(); + List v = new ArrayList<>(); for (int i = 0; i < t.size(); i++) { v.add(historyEvent(t.get(i))); } return v; } - static HistoryEvent historyEvent(com.uber.cadence.api.v1.HistoryEvent e) { + static com.uber.cadence.HistoryEvent historyEvent(com.uber.cadence.api.v1.HistoryEvent e) { if (e == null || e == com.uber.cadence.api.v1.HistoryEvent.getDefaultInstance()) { return null; } - HistoryEvent event = new HistoryEvent(); + com.uber.cadence.HistoryEvent event = new com.uber.cadence.HistoryEvent(); event.setEventId(e.getEventId()); event.setTimestamp(timeToUnixNano(e.getEventTime())); event.setVersion(e.getVersion()); @@ -426,28 +342,30 @@ static HistoryEvent historyEvent(com.uber.cadence.api.v1.HistoryEvent e) { return event; } - static ActivityTaskCancelRequestedEventAttributes activityTaskCancelRequestedEventAttributes( - com.uber.cadence.api.v1.ActivityTaskCancelRequestedEventAttributes t) { + static com.uber.cadence.ActivityTaskCancelRequestedEventAttributes + activityTaskCancelRequestedEventAttributes( + com.uber.cadence.api.v1.ActivityTaskCancelRequestedEventAttributes t) { if (t == null || t == com.uber.cadence.api.v1.ActivityTaskCancelRequestedEventAttributes .getDefaultInstance()) { return null; } - ActivityTaskCancelRequestedEventAttributes res = - new ActivityTaskCancelRequestedEventAttributes(); + com.uber.cadence.ActivityTaskCancelRequestedEventAttributes res = + new com.uber.cadence.ActivityTaskCancelRequestedEventAttributes(); res.setActivityId(t.getActivityId()); res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); return res; } - static ActivityTaskCanceledEventAttributes activityTaskCanceledEventAttributes( + static com.uber.cadence.ActivityTaskCanceledEventAttributes activityTaskCanceledEventAttributes( com.uber.cadence.api.v1.ActivityTaskCanceledEventAttributes t) { if (t == null || t == com.uber.cadence.api.v1.ActivityTaskCanceledEventAttributes.getDefaultInstance()) { return null; } - ActivityTaskCanceledEventAttributes res = new ActivityTaskCanceledEventAttributes(); + com.uber.cadence.ActivityTaskCanceledEventAttributes res = + new com.uber.cadence.ActivityTaskCanceledEventAttributes(); res.setDetails(payload(t.getDetails())); res.setLatestCancelRequestedEventId(t.getLatestCancelRequestedEventId()); res.setScheduledEventId(t.getScheduledEventId()); @@ -456,13 +374,14 @@ static ActivityTaskCanceledEventAttributes activityTaskCanceledEventAttributes( return res; } - static ActivityTaskCompletedEventAttributes activityTaskCompletedEventAttributes( + static com.uber.cadence.ActivityTaskCompletedEventAttributes activityTaskCompletedEventAttributes( com.uber.cadence.api.v1.ActivityTaskCompletedEventAttributes t) { if (t == null || t == com.uber.cadence.api.v1.ActivityTaskCompletedEventAttributes.getDefaultInstance()) { return null; } - ActivityTaskCompletedEventAttributes res = new ActivityTaskCompletedEventAttributes(); + com.uber.cadence.ActivityTaskCompletedEventAttributes res = + new com.uber.cadence.ActivityTaskCompletedEventAttributes(); res.setResult(payload(t.getResult())); res.setScheduledEventId(t.getScheduledEventId()); res.setStartedEventId(t.getStartedEventId()); @@ -470,13 +389,14 @@ static ActivityTaskCompletedEventAttributes activityTaskCompletedEventAttributes return res; } - static ActivityTaskFailedEventAttributes activityTaskFailedEventAttributes( + static com.uber.cadence.ActivityTaskFailedEventAttributes activityTaskFailedEventAttributes( com.uber.cadence.api.v1.ActivityTaskFailedEventAttributes t) { if (t == null || t == com.uber.cadence.api.v1.ActivityTaskFailedEventAttributes.getDefaultInstance()) { return null; } - ActivityTaskFailedEventAttributes res = new ActivityTaskFailedEventAttributes(); + com.uber.cadence.ActivityTaskFailedEventAttributes res = + new com.uber.cadence.ActivityTaskFailedEventAttributes(); res.setReason(failureReason(t.getFailure())); res.setDetails(failureDetails(t.getFailure())); res.setScheduledEventId(t.getScheduledEventId()); @@ -485,13 +405,14 @@ static ActivityTaskFailedEventAttributes activityTaskFailedEventAttributes( return res; } - static ActivityTaskScheduledEventAttributes activityTaskScheduledEventAttributes( + static com.uber.cadence.ActivityTaskScheduledEventAttributes activityTaskScheduledEventAttributes( com.uber.cadence.api.v1.ActivityTaskScheduledEventAttributes t) { if (t == null || t == com.uber.cadence.api.v1.ActivityTaskScheduledEventAttributes.getDefaultInstance()) { return null; } - ActivityTaskScheduledEventAttributes res = new ActivityTaskScheduledEventAttributes(); + com.uber.cadence.ActivityTaskScheduledEventAttributes res = + new com.uber.cadence.ActivityTaskScheduledEventAttributes(); res.setActivityId(t.getActivityId()); res.setActivityType(activityType(t.getActivityType())); res.setDomain(t.getDomain()); @@ -507,13 +428,14 @@ static ActivityTaskScheduledEventAttributes activityTaskScheduledEventAttributes return res; } - static ActivityTaskStartedEventAttributes activityTaskStartedEventAttributes( + static com.uber.cadence.ActivityTaskStartedEventAttributes activityTaskStartedEventAttributes( com.uber.cadence.api.v1.ActivityTaskStartedEventAttributes t) { if (t == null || t == com.uber.cadence.api.v1.ActivityTaskStartedEventAttributes.getDefaultInstance()) { return null; } - ActivityTaskStartedEventAttributes res = new ActivityTaskStartedEventAttributes(); + com.uber.cadence.ActivityTaskStartedEventAttributes res = + new com.uber.cadence.ActivityTaskStartedEventAttributes(); res.setScheduledEventId(t.getScheduledEventId()); res.setIdentity(t.getIdentity()); res.setRequestId(t.getRequestId()); @@ -523,13 +445,14 @@ static ActivityTaskStartedEventAttributes activityTaskStartedEventAttributes( return res; } - static ActivityTaskTimedOutEventAttributes activityTaskTimedOutEventAttributes( + static com.uber.cadence.ActivityTaskTimedOutEventAttributes activityTaskTimedOutEventAttributes( com.uber.cadence.api.v1.ActivityTaskTimedOutEventAttributes t) { if (t == null || t == com.uber.cadence.api.v1.ActivityTaskTimedOutEventAttributes.getDefaultInstance()) { return null; } - ActivityTaskTimedOutEventAttributes res = new ActivityTaskTimedOutEventAttributes(); + com.uber.cadence.ActivityTaskTimedOutEventAttributes res = + new com.uber.cadence.ActivityTaskTimedOutEventAttributes(); res.setDetails(payload(t.getDetails())); res.setScheduledEventId(t.getScheduledEventId()); res.setStartedEventId(t.getStartedEventId()); @@ -539,13 +462,14 @@ static ActivityTaskTimedOutEventAttributes activityTaskTimedOutEventAttributes( return res; } - static CancelTimerFailedEventAttributes cancelTimerFailedEventAttributes( + static com.uber.cadence.CancelTimerFailedEventAttributes cancelTimerFailedEventAttributes( com.uber.cadence.api.v1.CancelTimerFailedEventAttributes t) { if (t == null || t == com.uber.cadence.api.v1.CancelTimerFailedEventAttributes.getDefaultInstance()) { return null; } - CancelTimerFailedEventAttributes res = new CancelTimerFailedEventAttributes(); + com.uber.cadence.CancelTimerFailedEventAttributes res = + new com.uber.cadence.CancelTimerFailedEventAttributes(); res.setTimerId(t.getTimerId()); res.setCause(t.getCause()); res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); @@ -553,7 +477,7 @@ static CancelTimerFailedEventAttributes cancelTimerFailedEventAttributes( return res; } - static ChildWorkflowExecutionCanceledEventAttributes + static com.uber.cadence.ChildWorkflowExecutionCanceledEventAttributes childWorkflowExecutionCanceledEventAttributes( com.uber.cadence.api.v1.ChildWorkflowExecutionCanceledEventAttributes t) { if (t == null @@ -562,8 +486,8 @@ static CancelTimerFailedEventAttributes cancelTimerFailedEventAttributes( .getDefaultInstance()) { return null; } - ChildWorkflowExecutionCanceledEventAttributes res = - new ChildWorkflowExecutionCanceledEventAttributes(); + com.uber.cadence.ChildWorkflowExecutionCanceledEventAttributes res = + new com.uber.cadence.ChildWorkflowExecutionCanceledEventAttributes(); res.setDomain(t.getDomain()); res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution())); res.setWorkflowType(workflowType(t.getWorkflowType())); @@ -573,7 +497,7 @@ static CancelTimerFailedEventAttributes cancelTimerFailedEventAttributes( return res; } - static ChildWorkflowExecutionCompletedEventAttributes + static com.uber.cadence.ChildWorkflowExecutionCompletedEventAttributes childWorkflowExecutionCompletedEventAttributes( com.uber.cadence.api.v1.ChildWorkflowExecutionCompletedEventAttributes t) { if (t == null @@ -582,8 +506,8 @@ static CancelTimerFailedEventAttributes cancelTimerFailedEventAttributes( .getDefaultInstance()) { return null; } - ChildWorkflowExecutionCompletedEventAttributes res = - new ChildWorkflowExecutionCompletedEventAttributes(); + com.uber.cadence.ChildWorkflowExecutionCompletedEventAttributes res = + new com.uber.cadence.ChildWorkflowExecutionCompletedEventAttributes(); res.setDomain(t.getDomain()); res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution())); res.setWorkflowType(workflowType(t.getWorkflowType())); @@ -593,16 +517,17 @@ static CancelTimerFailedEventAttributes cancelTimerFailedEventAttributes( return res; } - static ChildWorkflowExecutionFailedEventAttributes childWorkflowExecutionFailedEventAttributes( - com.uber.cadence.api.v1.ChildWorkflowExecutionFailedEventAttributes t) { + static com.uber.cadence.ChildWorkflowExecutionFailedEventAttributes + childWorkflowExecutionFailedEventAttributes( + com.uber.cadence.api.v1.ChildWorkflowExecutionFailedEventAttributes t) { if (t == null || t == com.uber.cadence.api.v1.ChildWorkflowExecutionFailedEventAttributes .getDefaultInstance()) { return null; } - ChildWorkflowExecutionFailedEventAttributes res = - new ChildWorkflowExecutionFailedEventAttributes(); + com.uber.cadence.ChildWorkflowExecutionFailedEventAttributes res = + new com.uber.cadence.ChildWorkflowExecutionFailedEventAttributes(); res.setDomain(t.getDomain()); res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution())); res.setWorkflowType(workflowType(t.getWorkflowType())); @@ -613,16 +538,17 @@ static ChildWorkflowExecutionFailedEventAttributes childWorkflowExecutionFailedE return res; } - static ChildWorkflowExecutionStartedEventAttributes childWorkflowExecutionStartedEventAttributes( - com.uber.cadence.api.v1.ChildWorkflowExecutionStartedEventAttributes t) { + static com.uber.cadence.ChildWorkflowExecutionStartedEventAttributes + childWorkflowExecutionStartedEventAttributes( + com.uber.cadence.api.v1.ChildWorkflowExecutionStartedEventAttributes t) { if (t == null || t == com.uber.cadence.api.v1.ChildWorkflowExecutionStartedEventAttributes .getDefaultInstance()) { return null; } - ChildWorkflowExecutionStartedEventAttributes res = - new ChildWorkflowExecutionStartedEventAttributes(); + com.uber.cadence.ChildWorkflowExecutionStartedEventAttributes res = + new com.uber.cadence.ChildWorkflowExecutionStartedEventAttributes(); res.setDomain(t.getDomain()); res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution())); res.setWorkflowType(workflowType(t.getWorkflowType())); @@ -631,7 +557,7 @@ static ChildWorkflowExecutionStartedEventAttributes childWorkflowExecutionStarte return res; } - static ChildWorkflowExecutionTerminatedEventAttributes + static com.uber.cadence.ChildWorkflowExecutionTerminatedEventAttributes childWorkflowExecutionTerminatedEventAttributes( com.uber.cadence.api.v1.ChildWorkflowExecutionTerminatedEventAttributes t) { if (t == null @@ -640,8 +566,8 @@ static ChildWorkflowExecutionStartedEventAttributes childWorkflowExecutionStarte .getDefaultInstance()) { return null; } - ChildWorkflowExecutionTerminatedEventAttributes res = - new ChildWorkflowExecutionTerminatedEventAttributes(); + com.uber.cadence.ChildWorkflowExecutionTerminatedEventAttributes res = + new com.uber.cadence.ChildWorkflowExecutionTerminatedEventAttributes(); res.setDomain(t.getDomain()); res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution())); res.setWorkflowType(workflowType(t.getWorkflowType())); @@ -650,7 +576,7 @@ static ChildWorkflowExecutionStartedEventAttributes childWorkflowExecutionStarte return res; } - static ChildWorkflowExecutionTimedOutEventAttributes + static com.uber.cadence.ChildWorkflowExecutionTimedOutEventAttributes childWorkflowExecutionTimedOutEventAttributes( com.uber.cadence.api.v1.ChildWorkflowExecutionTimedOutEventAttributes t) { if (t == null @@ -659,8 +585,8 @@ static ChildWorkflowExecutionStartedEventAttributes childWorkflowExecutionStarte .getDefaultInstance()) { return null; } - ChildWorkflowExecutionTimedOutEventAttributes res = - new ChildWorkflowExecutionTimedOutEventAttributes(); + com.uber.cadence.ChildWorkflowExecutionTimedOutEventAttributes res = + new com.uber.cadence.ChildWorkflowExecutionTimedOutEventAttributes(); res.setDomain(t.getDomain()); res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution())); res.setWorkflowType(workflowType(t.getWorkflowType())); @@ -670,13 +596,14 @@ static ChildWorkflowExecutionStartedEventAttributes childWorkflowExecutionStarte return res; } - static DecisionTaskFailedEventAttributes decisionTaskFailedEventAttributes( + static com.uber.cadence.DecisionTaskFailedEventAttributes decisionTaskFailedEventAttributes( com.uber.cadence.api.v1.DecisionTaskFailedEventAttributes t) { if (t == null || t == com.uber.cadence.api.v1.DecisionTaskFailedEventAttributes.getDefaultInstance()) { return null; } - DecisionTaskFailedEventAttributes res = new DecisionTaskFailedEventAttributes(); + com.uber.cadence.DecisionTaskFailedEventAttributes res = + new com.uber.cadence.DecisionTaskFailedEventAttributes(); res.setScheduledEventId(t.getScheduledEventId()); res.setStartedEventId(t.getStartedEventId()); res.setCause(decisionTaskFailedCause(t.getCause())); @@ -690,39 +617,42 @@ static DecisionTaskFailedEventAttributes decisionTaskFailedEventAttributes( return res; } - static DecisionTaskScheduledEventAttributes decisionTaskScheduledEventAttributes( + static com.uber.cadence.DecisionTaskScheduledEventAttributes decisionTaskScheduledEventAttributes( com.uber.cadence.api.v1.DecisionTaskScheduledEventAttributes t) { if (t == null || t == com.uber.cadence.api.v1.DecisionTaskScheduledEventAttributes.getDefaultInstance()) { return null; } - DecisionTaskScheduledEventAttributes res = new DecisionTaskScheduledEventAttributes(); + com.uber.cadence.DecisionTaskScheduledEventAttributes res = + new com.uber.cadence.DecisionTaskScheduledEventAttributes(); res.setTaskList(taskList(t.getTaskList())); res.setStartToCloseTimeoutSeconds(durationToSeconds(t.getStartToCloseTimeout())); res.setAttempt(t.getAttempt()); return res; } - static DecisionTaskStartedEventAttributes decisionTaskStartedEventAttributes( + static com.uber.cadence.DecisionTaskStartedEventAttributes decisionTaskStartedEventAttributes( com.uber.cadence.api.v1.DecisionTaskStartedEventAttributes t) { if (t == null || t == com.uber.cadence.api.v1.DecisionTaskStartedEventAttributes.getDefaultInstance()) { return null; } - DecisionTaskStartedEventAttributes res = new DecisionTaskStartedEventAttributes(); + com.uber.cadence.DecisionTaskStartedEventAttributes res = + new com.uber.cadence.DecisionTaskStartedEventAttributes(); res.setScheduledEventId(t.getScheduledEventId()); res.setIdentity(t.getIdentity()); res.setRequestId(t.getRequestId()); return res; } - static DecisionTaskCompletedEventAttributes decisionTaskCompletedEventAttributes( + static com.uber.cadence.DecisionTaskCompletedEventAttributes decisionTaskCompletedEventAttributes( com.uber.cadence.api.v1.DecisionTaskCompletedEventAttributes t) { if (t == null || t == com.uber.cadence.api.v1.DecisionTaskCompletedEventAttributes.getDefaultInstance()) { return null; } - DecisionTaskCompletedEventAttributes res = new DecisionTaskCompletedEventAttributes(); + com.uber.cadence.DecisionTaskCompletedEventAttributes res = + new com.uber.cadence.DecisionTaskCompletedEventAttributes(); res.setScheduledEventId(t.getScheduledEventId()); res.setStartedEventId(t.getStartedEventId()); res.setIdentity(t.getIdentity()); @@ -731,13 +661,14 @@ static DecisionTaskCompletedEventAttributes decisionTaskCompletedEventAttributes return res; } - static DecisionTaskTimedOutEventAttributes decisionTaskTimedOutEventAttributes( + static com.uber.cadence.DecisionTaskTimedOutEventAttributes decisionTaskTimedOutEventAttributes( com.uber.cadence.api.v1.DecisionTaskTimedOutEventAttributes t) { if (t == null || t == com.uber.cadence.api.v1.DecisionTaskTimedOutEventAttributes.getDefaultInstance()) { return null; } - DecisionTaskTimedOutEventAttributes res = new DecisionTaskTimedOutEventAttributes(); + com.uber.cadence.DecisionTaskTimedOutEventAttributes res = + new com.uber.cadence.DecisionTaskTimedOutEventAttributes(); res.setScheduledEventId(t.getScheduledEventId()); res.setStartedEventId(t.getStartedEventId()); res.setTimeoutType(timeoutType(t.getTimeoutType())); @@ -749,7 +680,7 @@ static DecisionTaskTimedOutEventAttributes decisionTaskTimedOutEventAttributes( return res; } - static ExternalWorkflowExecutionCancelRequestedEventAttributes + static com.uber.cadence.ExternalWorkflowExecutionCancelRequestedEventAttributes externalWorkflowExecutionCancelRequestedEventAttributes( com.uber.cadence.api.v1.ExternalWorkflowExecutionCancelRequestedEventAttributes t) { if (t == null @@ -758,15 +689,15 @@ static DecisionTaskTimedOutEventAttributes decisionTaskTimedOutEventAttributes( .getDefaultInstance()) { return null; } - ExternalWorkflowExecutionCancelRequestedEventAttributes res = - new ExternalWorkflowExecutionCancelRequestedEventAttributes(); + com.uber.cadence.ExternalWorkflowExecutionCancelRequestedEventAttributes res = + new com.uber.cadence.ExternalWorkflowExecutionCancelRequestedEventAttributes(); res.setInitiatedEventId(t.getInitiatedEventId()); res.setDomain(t.getDomain()); res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution())); return res; } - static ExternalWorkflowExecutionSignaledEventAttributes + static com.uber.cadence.ExternalWorkflowExecutionSignaledEventAttributes externalWorkflowExecutionSignaledEventAttributes( com.uber.cadence.api.v1.ExternalWorkflowExecutionSignaledEventAttributes t) { if (t == null @@ -775,8 +706,8 @@ static DecisionTaskTimedOutEventAttributes decisionTaskTimedOutEventAttributes( .getDefaultInstance()) { return null; } - ExternalWorkflowExecutionSignaledEventAttributes res = - new ExternalWorkflowExecutionSignaledEventAttributes(); + com.uber.cadence.ExternalWorkflowExecutionSignaledEventAttributes res = + new com.uber.cadence.ExternalWorkflowExecutionSignaledEventAttributes(); res.setInitiatedEventId(t.getInitiatedEventId()); res.setDomain(t.getDomain()); res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution())); @@ -784,13 +715,14 @@ static DecisionTaskTimedOutEventAttributes decisionTaskTimedOutEventAttributes( return res; } - static MarkerRecordedEventAttributes markerRecordedEventAttributes( + static com.uber.cadence.MarkerRecordedEventAttributes markerRecordedEventAttributes( com.uber.cadence.api.v1.MarkerRecordedEventAttributes t) { if (t == null || t == com.uber.cadence.api.v1.MarkerRecordedEventAttributes.getDefaultInstance()) { return null; } - MarkerRecordedEventAttributes res = new MarkerRecordedEventAttributes(); + com.uber.cadence.MarkerRecordedEventAttributes res = + new com.uber.cadence.MarkerRecordedEventAttributes(); res.setMarkerName(t.getMarkerName()); res.setDetails(payload(t.getDetails())); res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); @@ -798,7 +730,7 @@ static MarkerRecordedEventAttributes markerRecordedEventAttributes( return res; } - static RequestCancelActivityTaskFailedEventAttributes + static com.uber.cadence.RequestCancelActivityTaskFailedEventAttributes requestCancelActivityTaskFailedEventAttributes( com.uber.cadence.api.v1.RequestCancelActivityTaskFailedEventAttributes t) { if (t == null @@ -807,15 +739,15 @@ static MarkerRecordedEventAttributes markerRecordedEventAttributes( .getDefaultInstance()) { return null; } - RequestCancelActivityTaskFailedEventAttributes res = - new RequestCancelActivityTaskFailedEventAttributes(); + com.uber.cadence.RequestCancelActivityTaskFailedEventAttributes res = + new com.uber.cadence.RequestCancelActivityTaskFailedEventAttributes(); res.setActivityId(t.getActivityId()); res.setCause(t.getCause()); res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); return res; } - static RequestCancelExternalWorkflowExecutionFailedEventAttributes + static com.uber.cadence.RequestCancelExternalWorkflowExecutionFailedEventAttributes requestCancelExternalWorkflowExecutionFailedEventAttributes( com.uber.cadence.api.v1.RequestCancelExternalWorkflowExecutionFailedEventAttributes t) { if (t == null @@ -824,8 +756,8 @@ static MarkerRecordedEventAttributes markerRecordedEventAttributes( .getDefaultInstance()) { return null; } - RequestCancelExternalWorkflowExecutionFailedEventAttributes res = - new RequestCancelExternalWorkflowExecutionFailedEventAttributes(); + com.uber.cadence.RequestCancelExternalWorkflowExecutionFailedEventAttributes res = + new com.uber.cadence.RequestCancelExternalWorkflowExecutionFailedEventAttributes(); res.setCause(cancelExternalWorkflowExecutionFailedCause(t.getCause())); res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); res.setDomain(t.getDomain()); @@ -835,7 +767,7 @@ static MarkerRecordedEventAttributes markerRecordedEventAttributes( return res; } - static RequestCancelExternalWorkflowExecutionInitiatedEventAttributes + static com.uber.cadence.RequestCancelExternalWorkflowExecutionInitiatedEventAttributes requestCancelExternalWorkflowExecutionInitiatedEventAttributes( com.uber.cadence.api.v1.RequestCancelExternalWorkflowExecutionInitiatedEventAttributes t) { @@ -846,8 +778,8 @@ static MarkerRecordedEventAttributes markerRecordedEventAttributes( .getDefaultInstance()) { return null; } - RequestCancelExternalWorkflowExecutionInitiatedEventAttributes res = - new RequestCancelExternalWorkflowExecutionInitiatedEventAttributes(); + com.uber.cadence.RequestCancelExternalWorkflowExecutionInitiatedEventAttributes res = + new com.uber.cadence.RequestCancelExternalWorkflowExecutionInitiatedEventAttributes(); res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); res.setDomain(t.getDomain()); res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution())); @@ -856,7 +788,7 @@ static MarkerRecordedEventAttributes markerRecordedEventAttributes( return res; } - static SignalExternalWorkflowExecutionFailedEventAttributes + static com.uber.cadence.SignalExternalWorkflowExecutionFailedEventAttributes signalExternalWorkflowExecutionFailedEventAttributes( com.uber.cadence.api.v1.SignalExternalWorkflowExecutionFailedEventAttributes t) { if (t == null @@ -865,8 +797,8 @@ static MarkerRecordedEventAttributes markerRecordedEventAttributes( .getDefaultInstance()) { return null; } - SignalExternalWorkflowExecutionFailedEventAttributes res = - new SignalExternalWorkflowExecutionFailedEventAttributes(); + com.uber.cadence.SignalExternalWorkflowExecutionFailedEventAttributes res = + new com.uber.cadence.SignalExternalWorkflowExecutionFailedEventAttributes(); res.setCause(signalExternalWorkflowExecutionFailedCause(t.getCause())); res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); res.setDomain(t.getDomain()); @@ -876,7 +808,7 @@ static MarkerRecordedEventAttributes markerRecordedEventAttributes( return res; } - static SignalExternalWorkflowExecutionInitiatedEventAttributes + static com.uber.cadence.SignalExternalWorkflowExecutionInitiatedEventAttributes signalExternalWorkflowExecutionInitiatedEventAttributes( com.uber.cadence.api.v1.SignalExternalWorkflowExecutionInitiatedEventAttributes t) { if (t == null @@ -885,8 +817,8 @@ static MarkerRecordedEventAttributes markerRecordedEventAttributes( .getDefaultInstance()) { return null; } - SignalExternalWorkflowExecutionInitiatedEventAttributes res = - new SignalExternalWorkflowExecutionInitiatedEventAttributes(); + com.uber.cadence.SignalExternalWorkflowExecutionInitiatedEventAttributes res = + new com.uber.cadence.SignalExternalWorkflowExecutionInitiatedEventAttributes(); res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); res.setDomain(t.getDomain()); res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution())); @@ -897,7 +829,7 @@ static MarkerRecordedEventAttributes markerRecordedEventAttributes( return res; } - static StartChildWorkflowExecutionFailedEventAttributes + static com.uber.cadence.StartChildWorkflowExecutionFailedEventAttributes startChildWorkflowExecutionFailedEventAttributes( com.uber.cadence.api.v1.StartChildWorkflowExecutionFailedEventAttributes t) { if (t == null @@ -906,8 +838,8 @@ static MarkerRecordedEventAttributes markerRecordedEventAttributes( .getDefaultInstance()) { return null; } - StartChildWorkflowExecutionFailedEventAttributes res = - new StartChildWorkflowExecutionFailedEventAttributes(); + com.uber.cadence.StartChildWorkflowExecutionFailedEventAttributes res = + new com.uber.cadence.StartChildWorkflowExecutionFailedEventAttributes(); res.setDomain(t.getDomain()); res.setWorkflowId(t.getWorkflowId()); res.setWorkflowType(workflowType(t.getWorkflowType())); @@ -918,7 +850,7 @@ static MarkerRecordedEventAttributes markerRecordedEventAttributes( return res; } - static StartChildWorkflowExecutionInitiatedEventAttributes + static com.uber.cadence.StartChildWorkflowExecutionInitiatedEventAttributes startChildWorkflowExecutionInitiatedEventAttributes( com.uber.cadence.api.v1.StartChildWorkflowExecutionInitiatedEventAttributes t) { if (t == null @@ -927,8 +859,8 @@ static MarkerRecordedEventAttributes markerRecordedEventAttributes( .getDefaultInstance()) { return null; } - StartChildWorkflowExecutionInitiatedEventAttributes res = - new StartChildWorkflowExecutionInitiatedEventAttributes(); + com.uber.cadence.StartChildWorkflowExecutionInitiatedEventAttributes res = + new com.uber.cadence.StartChildWorkflowExecutionInitiatedEventAttributes(); res.setDomain(t.getDomain()); res.setWorkflowId(t.getWorkflowId()); res.setWorkflowType(workflowType(t.getWorkflowType())); @@ -950,13 +882,14 @@ static MarkerRecordedEventAttributes markerRecordedEventAttributes( return res; } - static TimerCanceledEventAttributes timerCanceledEventAttributes( + static com.uber.cadence.TimerCanceledEventAttributes timerCanceledEventAttributes( com.uber.cadence.api.v1.TimerCanceledEventAttributes t) { if (t == null || t == com.uber.cadence.api.v1.TimerCanceledEventAttributes.getDefaultInstance()) { return null; } - TimerCanceledEventAttributes res = new TimerCanceledEventAttributes(); + com.uber.cadence.TimerCanceledEventAttributes res = + new com.uber.cadence.TimerCanceledEventAttributes(); res.setTimerId(t.getTimerId()); res.setStartedEventId(t.getStartedEventId()); res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); @@ -964,31 +897,33 @@ static TimerCanceledEventAttributes timerCanceledEventAttributes( return res; } - static TimerFiredEventAttributes timerFiredEventAttributes( + static com.uber.cadence.TimerFiredEventAttributes timerFiredEventAttributes( com.uber.cadence.api.v1.TimerFiredEventAttributes t) { if (t == null || t == com.uber.cadence.api.v1.TimerFiredEventAttributes.getDefaultInstance()) { return null; } - TimerFiredEventAttributes res = new TimerFiredEventAttributes(); + com.uber.cadence.TimerFiredEventAttributes res = + new com.uber.cadence.TimerFiredEventAttributes(); res.setTimerId(t.getTimerId()); res.setStartedEventId(t.getStartedEventId()); return res; } - static TimerStartedEventAttributes timerStartedEventAttributes( + static com.uber.cadence.TimerStartedEventAttributes timerStartedEventAttributes( com.uber.cadence.api.v1.TimerStartedEventAttributes t) { if (t == null || t == com.uber.cadence.api.v1.TimerStartedEventAttributes.getDefaultInstance()) { return null; } - TimerStartedEventAttributes res = new TimerStartedEventAttributes(); + com.uber.cadence.TimerStartedEventAttributes res = + new com.uber.cadence.TimerStartedEventAttributes(); res.setTimerId(t.getTimerId()); res.setStartToFireTimeoutSeconds(durationToSeconds(t.getStartToFireTimeout())); res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); return res; } - static UpsertWorkflowSearchAttributesEventAttributes + static com.uber.cadence.UpsertWorkflowSearchAttributesEventAttributes upsertWorkflowSearchAttributesEventAttributes( com.uber.cadence.api.v1.UpsertWorkflowSearchAttributesEventAttributes t) { if (t == null @@ -997,14 +932,14 @@ static TimerStartedEventAttributes timerStartedEventAttributes( .getDefaultInstance()) { return null; } - UpsertWorkflowSearchAttributesEventAttributes res = - new UpsertWorkflowSearchAttributesEventAttributes(); + com.uber.cadence.UpsertWorkflowSearchAttributesEventAttributes res = + new com.uber.cadence.UpsertWorkflowSearchAttributesEventAttributes(); res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); res.setSearchAttributes(searchAttributes(t.getSearchAttributes())); return res; } - static WorkflowExecutionCancelRequestedEventAttributes + static com.uber.cadence.WorkflowExecutionCancelRequestedEventAttributes workflowExecutionCancelRequestedEventAttributes( com.uber.cadence.api.v1.WorkflowExecutionCancelRequestedEventAttributes t) { if (t == null @@ -1013,8 +948,8 @@ static TimerStartedEventAttributes timerStartedEventAttributes( .getDefaultInstance()) { return null; } - WorkflowExecutionCancelRequestedEventAttributes res = - new WorkflowExecutionCancelRequestedEventAttributes(); + com.uber.cadence.WorkflowExecutionCancelRequestedEventAttributes res = + new com.uber.cadence.WorkflowExecutionCancelRequestedEventAttributes(); res.setCause(t.getCause()); res.setExternalInitiatedEventId(externalInitiatedId(t.getExternalExecutionInfo())); res.setExternalWorkflowExecution(externalWorkflowExecution(t.getExternalExecutionInfo())); @@ -1022,35 +957,39 @@ static TimerStartedEventAttributes timerStartedEventAttributes( return res; } - static WorkflowExecutionCanceledEventAttributes workflowExecutionCanceledEventAttributes( - com.uber.cadence.api.v1.WorkflowExecutionCanceledEventAttributes t) { + static com.uber.cadence.WorkflowExecutionCanceledEventAttributes + workflowExecutionCanceledEventAttributes( + com.uber.cadence.api.v1.WorkflowExecutionCanceledEventAttributes t) { if (t == null || t == com.uber.cadence.api.v1.WorkflowExecutionCanceledEventAttributes .getDefaultInstance()) { return null; } - WorkflowExecutionCanceledEventAttributes res = new WorkflowExecutionCanceledEventAttributes(); + com.uber.cadence.WorkflowExecutionCanceledEventAttributes res = + new com.uber.cadence.WorkflowExecutionCanceledEventAttributes(); res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); res.setDetails(payload(t.getDetails())); return res; } - static WorkflowExecutionCompletedEventAttributes workflowExecutionCompletedEventAttributes( - com.uber.cadence.api.v1.WorkflowExecutionCompletedEventAttributes t) { + static com.uber.cadence.WorkflowExecutionCompletedEventAttributes + workflowExecutionCompletedEventAttributes( + com.uber.cadence.api.v1.WorkflowExecutionCompletedEventAttributes t) { if (t == null || t == com.uber.cadence.api.v1.WorkflowExecutionCompletedEventAttributes .getDefaultInstance()) { return null; } - WorkflowExecutionCompletedEventAttributes res = new WorkflowExecutionCompletedEventAttributes(); + com.uber.cadence.WorkflowExecutionCompletedEventAttributes res = + new com.uber.cadence.WorkflowExecutionCompletedEventAttributes(); res.setResult(payload(t.getResult())); res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); return res; } - static WorkflowExecutionContinuedAsNewEventAttributes + static com.uber.cadence.WorkflowExecutionContinuedAsNewEventAttributes workflowExecutionContinuedAsNewEventAttributes( com.uber.cadence.api.v1.WorkflowExecutionContinuedAsNewEventAttributes t) { if (t == null @@ -1059,8 +998,8 @@ static WorkflowExecutionCompletedEventAttributes workflowExecutionCompletedEvent .getDefaultInstance()) { return null; } - WorkflowExecutionContinuedAsNewEventAttributes res = - new WorkflowExecutionContinuedAsNewEventAttributes(); + com.uber.cadence.WorkflowExecutionContinuedAsNewEventAttributes res = + new com.uber.cadence.WorkflowExecutionContinuedAsNewEventAttributes(); res.setNewExecutionRunId(t.getNewExecutionRunId()); res.setWorkflowType(workflowType(t.getWorkflowType())); res.setTaskList(taskList(t.getTaskList())); @@ -1080,45 +1019,51 @@ static WorkflowExecutionCompletedEventAttributes workflowExecutionCompletedEvent return res; } - static WorkflowExecutionFailedEventAttributes workflowExecutionFailedEventAttributes( - com.uber.cadence.api.v1.WorkflowExecutionFailedEventAttributes t) { + static com.uber.cadence.WorkflowExecutionFailedEventAttributes + workflowExecutionFailedEventAttributes( + com.uber.cadence.api.v1.WorkflowExecutionFailedEventAttributes t) { if (t == null || t == com.uber.cadence.api.v1.WorkflowExecutionFailedEventAttributes .getDefaultInstance()) { return null; } - WorkflowExecutionFailedEventAttributes res = new WorkflowExecutionFailedEventAttributes(); + com.uber.cadence.WorkflowExecutionFailedEventAttributes res = + new com.uber.cadence.WorkflowExecutionFailedEventAttributes(); res.setReason(failureReason(t.getFailure())); res.setDetails(failureDetails(t.getFailure())); res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); return res; } - static WorkflowExecutionSignaledEventAttributes workflowExecutionSignaledEventAttributes( - com.uber.cadence.api.v1.WorkflowExecutionSignaledEventAttributes t) { + static com.uber.cadence.WorkflowExecutionSignaledEventAttributes + workflowExecutionSignaledEventAttributes( + com.uber.cadence.api.v1.WorkflowExecutionSignaledEventAttributes t) { if (t == null || t == com.uber.cadence.api.v1.WorkflowExecutionSignaledEventAttributes .getDefaultInstance()) { return null; } - WorkflowExecutionSignaledEventAttributes res = new WorkflowExecutionSignaledEventAttributes(); + com.uber.cadence.WorkflowExecutionSignaledEventAttributes res = + new com.uber.cadence.WorkflowExecutionSignaledEventAttributes(); res.setSignalName(t.getSignalName()); res.setInput(payload(t.getInput())); res.setIdentity(t.getIdentity()); return res; } - static WorkflowExecutionStartedEventAttributes workflowExecutionStartedEventAttributes( - com.uber.cadence.api.v1.WorkflowExecutionStartedEventAttributes t) { + static com.uber.cadence.WorkflowExecutionStartedEventAttributes + workflowExecutionStartedEventAttributes( + com.uber.cadence.api.v1.WorkflowExecutionStartedEventAttributes t) { if (t == null || t == com.uber.cadence.api.v1.WorkflowExecutionStartedEventAttributes .getDefaultInstance()) { return null; } - WorkflowExecutionStartedEventAttributes res = new WorkflowExecutionStartedEventAttributes(); + com.uber.cadence.WorkflowExecutionStartedEventAttributes res = + new com.uber.cadence.WorkflowExecutionStartedEventAttributes(); res.setWorkflowType(workflowType(t.getWorkflowType())); res.setParentWorkflowDomain(parentDomainName(t.getParentExecutionInfo())); res.setParentWorkflowExecution(parentWorkflowExecution(t.getParentExecutionInfo())); @@ -1148,31 +1093,34 @@ static WorkflowExecutionStartedEventAttributes workflowExecutionStartedEventAttr return res; } - static WorkflowExecutionTerminatedEventAttributes workflowExecutionTerminatedEventAttributes( - com.uber.cadence.api.v1.WorkflowExecutionTerminatedEventAttributes t) { + static com.uber.cadence.WorkflowExecutionTerminatedEventAttributes + workflowExecutionTerminatedEventAttributes( + com.uber.cadence.api.v1.WorkflowExecutionTerminatedEventAttributes t) { if (t == null || t == com.uber.cadence.api.v1.WorkflowExecutionTerminatedEventAttributes .getDefaultInstance()) { return null; } - WorkflowExecutionTerminatedEventAttributes res = - new WorkflowExecutionTerminatedEventAttributes(); + com.uber.cadence.WorkflowExecutionTerminatedEventAttributes res = + new com.uber.cadence.WorkflowExecutionTerminatedEventAttributes(); res.setReason(t.getReason()); res.setDetails(payload(t.getDetails())); res.setIdentity(t.getIdentity()); return res; } - static WorkflowExecutionTimedOutEventAttributes workflowExecutionTimedOutEventAttributes( - com.uber.cadence.api.v1.WorkflowExecutionTimedOutEventAttributes t) { + static com.uber.cadence.WorkflowExecutionTimedOutEventAttributes + workflowExecutionTimedOutEventAttributes( + com.uber.cadence.api.v1.WorkflowExecutionTimedOutEventAttributes t) { if (t == null || t == com.uber.cadence.api.v1.WorkflowExecutionTimedOutEventAttributes .getDefaultInstance()) { return null; } - WorkflowExecutionTimedOutEventAttributes res = new WorkflowExecutionTimedOutEventAttributes(); + com.uber.cadence.WorkflowExecutionTimedOutEventAttributes res = + new com.uber.cadence.WorkflowExecutionTimedOutEventAttributes(); res.setTimeoutType(timeoutType(t.getTimeoutType())); return res; } diff --git a/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/RequestMapper.java b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/RequestMapper.java new file mode 100644 index 000000000..0207bdb86 --- /dev/null +++ b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/RequestMapper.java @@ -0,0 +1,979 @@ +/* + * Modifications Copyright (c) 2017-2021 Uber Technologies Inc. + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * 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.compatibility.proto.mappers; + +import static com.uber.cadence.internal.compatibility.proto.mappers.DecisionMapper.decisionArray; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.archivalStatus; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.decisionTaskFailedCause; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.eventFilterType; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.queryConsistencyLevel; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.queryRejectCondition; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.queryTaskCompletedType; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.taskListType; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.workflowIdReusePolicy; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.arrayToByteString; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.daysToDuration; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.newFieldMask; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.nullToEmpty; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.secondsToDuration; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.badBinaries; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.clusterReplicationConfigurationArray; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.failure; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.header; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.memo; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.payload; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.retryPolicy; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.searchAttributes; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.startTimeFilter; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.statusFilter; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.stickyExecutionAttributes; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.taskList; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.taskListMetadata; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workerVersionInfo; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowExecution; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowExecutionFilter; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowQuery; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowQueryResultMap; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowType; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowTypeFilter; + +import com.uber.cadence.api.v1.CountWorkflowExecutionsRequest; +import com.uber.cadence.api.v1.DeprecateDomainRequest; +import com.uber.cadence.api.v1.DescribeDomainRequest; +import com.uber.cadence.api.v1.DescribeTaskListRequest; +import com.uber.cadence.api.v1.DescribeWorkflowExecutionRequest; +import com.uber.cadence.api.v1.GetTaskListsByDomainRequest; +import com.uber.cadence.api.v1.GetWorkflowExecutionHistoryRequest; +import com.uber.cadence.api.v1.ListArchivedWorkflowExecutionsRequest; +import com.uber.cadence.api.v1.ListClosedWorkflowExecutionsRequest; +import com.uber.cadence.api.v1.ListDomainsRequest; +import com.uber.cadence.api.v1.ListOpenWorkflowExecutionsRequest; +import com.uber.cadence.api.v1.ListTaskListPartitionsRequest; +import com.uber.cadence.api.v1.ListWorkflowExecutionsRequest; +import com.uber.cadence.api.v1.PollForActivityTaskRequest; +import com.uber.cadence.api.v1.PollForDecisionTaskRequest; +import com.uber.cadence.api.v1.QueryWorkflowRequest; +import com.uber.cadence.api.v1.RecordActivityTaskHeartbeatByIDRequest; +import com.uber.cadence.api.v1.RecordActivityTaskHeartbeatRequest; +import com.uber.cadence.api.v1.RefreshWorkflowTasksRequest; +import com.uber.cadence.api.v1.RegisterDomainRequest; +import com.uber.cadence.api.v1.RequestCancelWorkflowExecutionRequest; +import com.uber.cadence.api.v1.ResetStickyTaskListRequest; +import com.uber.cadence.api.v1.ResetWorkflowExecutionRequest; +import com.uber.cadence.api.v1.RespondActivityTaskCanceledByIDRequest; +import com.uber.cadence.api.v1.RespondActivityTaskCanceledRequest; +import com.uber.cadence.api.v1.RespondActivityTaskCompletedByIDRequest; +import com.uber.cadence.api.v1.RespondActivityTaskCompletedRequest; +import com.uber.cadence.api.v1.RespondActivityTaskFailedByIDRequest; +import com.uber.cadence.api.v1.RespondActivityTaskFailedRequest; +import com.uber.cadence.api.v1.RespondDecisionTaskCompletedRequest; +import com.uber.cadence.api.v1.RespondDecisionTaskFailedRequest; +import com.uber.cadence.api.v1.RespondQueryTaskCompletedRequest; +import com.uber.cadence.api.v1.RestartWorkflowExecutionRequest; +import com.uber.cadence.api.v1.ScanWorkflowExecutionsRequest; +import com.uber.cadence.api.v1.SignalWithStartWorkflowExecutionAsyncRequest; +import com.uber.cadence.api.v1.SignalWithStartWorkflowExecutionRequest; +import com.uber.cadence.api.v1.SignalWorkflowExecutionRequest; +import com.uber.cadence.api.v1.StartWorkflowExecutionAsyncRequest; +import com.uber.cadence.api.v1.StartWorkflowExecutionRequest; +import com.uber.cadence.api.v1.TerminateWorkflowExecutionRequest; +import com.uber.cadence.api.v1.UpdateDomainRequest; +import com.uber.cadence.api.v1.UpdateDomainRequest.Builder; +import com.uber.cadence.api.v1.WorkflowQueryResult; +import java.util.ArrayList; +import java.util.List; + +public class RequestMapper { + + private static final String DomainUpdateDescriptionField = "description"; + private static final String DomainUpdateOwnerEmailField = "owner_email"; + private static final String DomainUpdateDataField = "data"; + private static final String DomainUpdateRetentionPeriodField = + "workflow_execution_retention_period"; + + private static final String DomainUpdateBadBinariesField = "bad_binaries"; + private static final String DomainUpdateHistoryArchivalStatusField = "history_archival_status"; + private static final String DomainUpdateHistoryArchivalURIField = "history_archival_uri"; + private static final String DomainUpdateVisibilityArchivalStatusField = + "visibility_archival_status"; + private static final String DomainUpdateVisibilityArchivalURIField = "visibility_archival_uri"; + private static final String DomainUpdateActiveClusterNameField = "active_cluster_name"; + private static final String DomainUpdateClustersField = "clusters"; + private static final String DomainUpdateDeleteBadBinaryField = "delete_bad_binary"; + private static final String DomainUpdateFailoverTimeoutField = "failover_timeout"; + + public static CountWorkflowExecutionsRequest countWorkflowExecutionsRequest( + com.uber.cadence.CountWorkflowExecutionsRequest t) { + if (t == null) { + return null; + } + CountWorkflowExecutionsRequest.Builder request = + CountWorkflowExecutionsRequest.newBuilder().setDomain(t.getDomain()); + if (t.getQuery() != null) { + request.setQuery(t.getQuery()); + } + return request.build(); + } + + public static DescribeTaskListRequest describeTaskListRequest( + com.uber.cadence.DescribeTaskListRequest t) { + if (t == null) { + return null; + } + return DescribeTaskListRequest.newBuilder() + .setDomain(t.getDomain()) + .setTaskList(taskList(t.getTaskList())) + .setTaskListType(taskListType(t.getTaskListType())) + .setIncludeTaskListStatus(t.isIncludeTaskListStatus()) + .build(); + } + + public static ListArchivedWorkflowExecutionsRequest listArchivedWorkflowExecutionsRequest( + com.uber.cadence.ListArchivedWorkflowExecutionsRequest t) { + if (t == null) { + return null; + } + ListArchivedWorkflowExecutionsRequest.Builder request = + ListArchivedWorkflowExecutionsRequest.newBuilder() + .setDomain(t.getDomain()) + .setPageSize(t.getPageSize()); + if (t.getNextPageToken() != null) { + request.setNextPageToken(arrayToByteString(t.getNextPageToken())); + } + if (t.getQuery() != null) { + request.setQuery(t.getQuery()); + } + return request.build(); + } + + public static RequestCancelWorkflowExecutionRequest requestCancelWorkflowExecutionRequest( + com.uber.cadence.RequestCancelWorkflowExecutionRequest t) { + if (t == null) { + return null; + } + RequestCancelWorkflowExecutionRequest.Builder builder = + RequestCancelWorkflowExecutionRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowExecution(workflowExecution(t.getWorkflowExecution())) + .setRequestId(t.getRequestId()); + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + if (t.getFirstExecutionRunID() != null) { + builder.setFirstExecutionRunId(t.getFirstExecutionRunID()); + } + if (t.getCause() != null) { + builder.setCause(t.getCause()); + } + return builder.build(); + } + + public static ResetStickyTaskListRequest resetStickyTaskListRequest( + com.uber.cadence.ResetStickyTaskListRequest t) { + if (t == null) { + return null; + } + return ResetStickyTaskListRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowExecution(workflowExecution(t.getExecution())) + .build(); + } + + public static ResetWorkflowExecutionRequest resetWorkflowExecutionRequest( + com.uber.cadence.ResetWorkflowExecutionRequest t) { + if (t == null) { + return null; + } + return ResetWorkflowExecutionRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowExecution(workflowExecution(t.getWorkflowExecution())) + .setReason(t.getReason()) + .setDecisionFinishEventId(t.getDecisionFinishEventId()) + .setRequestId(t.getRequestId()) + .setSkipSignalReapply(t.isSkipSignalReapply()) + .build(); + } + + public static RespondActivityTaskCanceledByIDRequest respondActivityTaskCanceledByIdRequest( + com.uber.cadence.RespondActivityTaskCanceledByIDRequest t) { + if (t == null) { + return null; + } + RespondActivityTaskCanceledByIDRequest.Builder builder = + RespondActivityTaskCanceledByIDRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowExecution(TypeMapper.workflowRunPair(t.getWorkflowID(), t.getRunID())) + .setActivityId(t.getActivityID()) + .setDetails(payload(t.getDetails())); + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + return builder.build(); + } + + public static RespondActivityTaskCanceledRequest respondActivityTaskCanceledRequest( + com.uber.cadence.RespondActivityTaskCanceledRequest t) { + if (t == null) { + return null; + } + RespondActivityTaskCanceledRequest.Builder builder = + RespondActivityTaskCanceledRequest.newBuilder().setDetails(payload(t.getDetails())); + if (t.getTaskToken() != null) { + builder.setTaskToken(arrayToByteString(t.getTaskToken())); + } + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + return builder.build(); + } + + public static RespondActivityTaskCompletedByIDRequest respondActivityTaskCompletedByIdRequest( + com.uber.cadence.RespondActivityTaskCompletedByIDRequest t) { + if (t == null) { + return null; + } + RespondActivityTaskCompletedByIDRequest.Builder builder = + RespondActivityTaskCompletedByIDRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowExecution(TypeMapper.workflowRunPair(t.getWorkflowID(), t.getRunID())) + .setActivityId(t.getActivityID()) + .setResult(payload(t.getResult())); + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + return builder.build(); + } + + public static RespondActivityTaskCompletedRequest respondActivityTaskCompletedRequest( + com.uber.cadence.RespondActivityTaskCompletedRequest t) { + if (t == null) { + return null; + } + RespondActivityTaskCompletedRequest.Builder builder = + RespondActivityTaskCompletedRequest.newBuilder().setResult(payload(t.getResult())); + if (t.getTaskToken() != null) { + builder.setTaskToken(arrayToByteString(t.getTaskToken())); + } + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + return builder.build(); + } + + public static RespondActivityTaskFailedByIDRequest respondActivityTaskFailedByIdRequest( + com.uber.cadence.RespondActivityTaskFailedByIDRequest t) { + if (t == null) { + return null; + } + RespondActivityTaskFailedByIDRequest.Builder builder = + RespondActivityTaskFailedByIDRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowExecution(TypeMapper.workflowRunPair(t.getWorkflowID(), t.getRunID())) + .setActivityId(t.getActivityID()) + .setFailure(failure(t.getReason(), t.getDetails())); + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + return builder.build(); + } + + public static RespondActivityTaskFailedRequest respondActivityTaskFailedRequest( + com.uber.cadence.RespondActivityTaskFailedRequest t) { + if (t == null) { + return null; + } + RespondActivityTaskFailedRequest.Builder builder = + RespondActivityTaskFailedRequest.newBuilder() + .setFailure(failure(t.getReason(), t.getDetails())); + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + if (t.getTaskToken() != null) { + builder.setTaskToken(arrayToByteString(t.getTaskToken())); + } + return builder.build(); + } + + public static RespondDecisionTaskCompletedRequest respondDecisionTaskCompletedRequest( + com.uber.cadence.RespondDecisionTaskCompletedRequest t) { + if (t == null) { + return null; + } + RespondDecisionTaskCompletedRequest.Builder builder = + RespondDecisionTaskCompletedRequest.newBuilder() + .addAllDecisions(decisionArray(t.getDecisions())) + .setStickyAttributes(stickyExecutionAttributes(t.getStickyAttributes())) + .setReturnNewDecisionTask(t.isReturnNewDecisionTask()) + .setForceCreateNewDecisionTask(t.isForceCreateNewDecisionTask()) + .putAllQueryResults(workflowQueryResultMap(t.getQueryResults())); + if (t.getExecutionContext() != null) { + builder.setExecutionContext(arrayToByteString(t.getExecutionContext())); + } + if (t.getBinaryChecksum() != null) { + builder.setBinaryChecksum(t.getBinaryChecksum()); + } + if (t.getTaskToken() != null) { + builder.setTaskToken(arrayToByteString(t.getTaskToken())); + } + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + return builder.build(); + } + + public static RespondDecisionTaskFailedRequest respondDecisionTaskFailedRequest( + com.uber.cadence.RespondDecisionTaskFailedRequest t) { + if (t == null) { + return null; + } + RespondDecisionTaskFailedRequest.Builder builder = + RespondDecisionTaskFailedRequest.newBuilder() + .setCause(decisionTaskFailedCause(t.getCause())) + .setDetails(payload(t.getDetails())); + if (t.getBinaryChecksum() != null) { + builder.setBinaryChecksum(t.getBinaryChecksum()); + } + if (t.getTaskToken() != null) { + builder.setTaskToken(arrayToByteString(t.getTaskToken())); + } + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + return builder.build(); + } + + public static RespondQueryTaskCompletedRequest respondQueryTaskCompletedRequest( + com.uber.cadence.RespondQueryTaskCompletedRequest t) { + if (t == null) { + return null; + } + WorkflowQueryResult.Builder wqBuilder = + WorkflowQueryResult.newBuilder() + .setResultType(queryTaskCompletedType(t.getCompletedType())) + .setAnswer(payload(t.getQueryResult())); + if (t.getErrorMessage() != null) { + wqBuilder.setErrorMessage(t.getErrorMessage()); + } + RespondQueryTaskCompletedRequest.Builder builder = + RespondQueryTaskCompletedRequest.newBuilder() + .setResult(wqBuilder.build()) + .setWorkerVersionInfo(workerVersionInfo(t.getWorkerVersionInfo())); + if (t.getTaskToken() != null) { + builder.setTaskToken(arrayToByteString(t.getTaskToken())); + } + return builder.build(); + } + + public static ScanWorkflowExecutionsRequest scanWorkflowExecutionsRequest( + com.uber.cadence.ListWorkflowExecutionsRequest t) { + if (t == null) { + return null; + } + ScanWorkflowExecutionsRequest.Builder request = + ScanWorkflowExecutionsRequest.newBuilder() + .setDomain(t.getDomain()) + .setPageSize(t.getPageSize()); + if (t.getNextPageToken() != null) { + request.setNextPageToken(arrayToByteString(t.getNextPageToken())); + } + if (t.getQuery() != null) { + request.setQuery(t.getQuery()); + } + return request.build(); + } + + public static DescribeWorkflowExecutionRequest describeWorkflowExecutionRequest( + com.uber.cadence.DescribeWorkflowExecutionRequest t) { + if (t == null) { + return null; + } + return DescribeWorkflowExecutionRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowExecution(workflowExecution(t.getExecution())) + .build(); + } + + public static GetWorkflowExecutionHistoryRequest getWorkflowExecutionHistoryRequest( + com.uber.cadence.GetWorkflowExecutionHistoryRequest t) { + if (t == null) { + return null; + } + GetWorkflowExecutionHistoryRequest.Builder builder = + GetWorkflowExecutionHistoryRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowExecution(workflowExecution(t.getExecution())) + .setPageSize(t.getMaximumPageSize()) + .setWaitForNewEvent(t.isWaitForNewEvent()) + .setHistoryEventFilterType(eventFilterType(t.getHistoryEventFilterType())) + .setSkipArchival(t.isSkipArchival()); + if (t.getNextPageToken() != null) { + builder.setNextPageToken(arrayToByteString(t.getNextPageToken())); + } + return builder.build(); + } + + public static SignalWithStartWorkflowExecutionRequest signalWithStartWorkflowExecutionRequest( + com.uber.cadence.SignalWithStartWorkflowExecutionRequest t) { + if (t == null) { + return null; + } + StartWorkflowExecutionRequest.Builder builder = + StartWorkflowExecutionRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowId(t.getWorkflowId()) + .setWorkflowType(workflowType(t.getWorkflowType())) + .setTaskList(taskList(t.getTaskList())) + .setInput(payload(t.getInput())) + .setExecutionStartToCloseTimeout( + secondsToDuration(t.getExecutionStartToCloseTimeoutSeconds())) + .setTaskStartToCloseTimeout(secondsToDuration(t.getTaskStartToCloseTimeoutSeconds())) + .setRequestId(t.getRequestId()) + .setMemo(memo(t.getMemo())) + .setSearchAttributes(searchAttributes(t.getSearchAttributes())) + .setHeader(header(t.getHeader())); + if (t.getRetryPolicy() != null) { + builder.setRetryPolicy(retryPolicy(t.getRetryPolicy())); + } + builder.setWorkflowIdReusePolicy(workflowIdReusePolicy(t.getWorkflowIdReusePolicy())); + if (t.getWorkflowIdReusePolicy() != null) { + builder.setWorkflowIdReusePolicy(workflowIdReusePolicy(t.getWorkflowIdReusePolicy())); + } + if (t.getCronSchedule() != null) { + builder.setCronSchedule(t.getCronSchedule()); + } + if (t.getDelayStartSeconds() > 0) { + builder.setDelayStart(secondsToDuration(t.getDelayStartSeconds())); + } + builder.setJitterStart(secondsToDuration(t.getJitterStartSeconds())); + + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + SignalWithStartWorkflowExecutionRequest.Builder sb = + SignalWithStartWorkflowExecutionRequest.newBuilder() + .setStartRequest(builder.build()) + .setSignalName(t.getSignalName()) + .setSignalInput(payload(t.getSignalInput())); + if (t.getControl() != null) { + sb.setControl(arrayToByteString(t.getControl())); + } + return sb.build(); + } + + public static SignalWithStartWorkflowExecutionAsyncRequest + signalWithStartWorkflowExecutionAsyncRequest( + com.uber.cadence.SignalWithStartWorkflowExecutionAsyncRequest t) { + if (t == null) { + return null; + } + SignalWithStartWorkflowExecutionAsyncRequest.Builder builder = + SignalWithStartWorkflowExecutionAsyncRequest.newBuilder(); + if (t.getRequest() != null) { + builder.setRequest(signalWithStartWorkflowExecutionRequest(t.getRequest())); + } + return builder.build(); + } + + public static SignalWorkflowExecutionRequest signalWorkflowExecutionRequest( + com.uber.cadence.SignalWorkflowExecutionRequest t) { + if (t == null) { + return null; + } + SignalWorkflowExecutionRequest.Builder builder = + SignalWorkflowExecutionRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowExecution(workflowExecution(t.getWorkflowExecution())) + .setSignalName(t.getSignalName()) + .setSignalInput(payload(t.getInput())) + .setRequestId(t.getRequestId()); + if (t.getControl() != null) { + builder.setControl(arrayToByteString(t.getControl())); + } + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + return builder.build(); + } + + public static StartWorkflowExecutionRequest startWorkflowExecutionRequest( + com.uber.cadence.StartWorkflowExecutionRequest t) { + if (t == null) { + return null; + } + StartWorkflowExecutionRequest.Builder request = + StartWorkflowExecutionRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowId(t.getWorkflowId()) + .setWorkflowType(workflowType(t.getWorkflowType())) + .setTaskList(taskList(t.getTaskList())) + .setInput(payload(t.getInput())) + .setRequestId(t.getRequestId()) + .setExecutionStartToCloseTimeout( + secondsToDuration(t.getExecutionStartToCloseTimeoutSeconds())) + .setTaskStartToCloseTimeout(secondsToDuration(t.getTaskStartToCloseTimeoutSeconds())) + .setWorkflowIdReusePolicy(workflowIdReusePolicy(t.getWorkflowIdReusePolicy())) + .setMemo(memo(t.getMemo())) + .setSearchAttributes(searchAttributes(t.getSearchAttributes())) + .setHeader(header(t.getHeader())) + .setDelayStart(secondsToDuration(t.getDelayStartSeconds())) + .setJitterStart(secondsToDuration(t.getJitterStartSeconds())); + if (t.getRetryPolicy() != null) { + request.setRetryPolicy(retryPolicy(t.getRetryPolicy())); + } + if (t.getCronSchedule() != null) { + request.setCronSchedule(t.getCronSchedule()); + } + if (t.getIdentity() != null) { + request.setIdentity(t.getIdentity()); + } + return request.build(); + } + + public static StartWorkflowExecutionAsyncRequest startWorkflowExecutionAsyncRequest( + com.uber.cadence.StartWorkflowExecutionAsyncRequest t) { + if (t == null) { + return null; + } + StartWorkflowExecutionAsyncRequest.Builder builder = + StartWorkflowExecutionAsyncRequest.newBuilder(); + if (t.getRequest() != null) { + builder.setRequest(startWorkflowExecutionRequest(t.getRequest())); + } + return builder.build(); + } + + public static TerminateWorkflowExecutionRequest terminateWorkflowExecutionRequest( + com.uber.cadence.TerminateWorkflowExecutionRequest t) { + if (t == null) { + return null; + } + TerminateWorkflowExecutionRequest.Builder builder = + TerminateWorkflowExecutionRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowExecution(workflowExecution(t.getWorkflowExecution())) + .setReason(t.getReason()) + .setDetails(payload(t.getDetails())); + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + if (t.getFirstExecutionRunID() != null) { + builder.setFirstExecutionRunId(t.getFirstExecutionRunID()); + } + return builder.build(); + } + + public static DeprecateDomainRequest deprecateDomainRequest( + com.uber.cadence.DeprecateDomainRequest t) { + if (t == null) { + return null; + } + return DeprecateDomainRequest.newBuilder() + .setName(t.getName()) + .setSecurityToken(t.getSecurityToken()) + .build(); + } + + public static DescribeDomainRequest describeDomainRequest( + com.uber.cadence.DescribeDomainRequest t) { + if (t == null) { + return null; + } + if (t.getUuid() != null) { + return DescribeDomainRequest.newBuilder().setId(t.getUuid()).build(); + } + if (t.getName() != null) { + return DescribeDomainRequest.newBuilder().setName(t.getName()).build(); + } + throw new IllegalArgumentException("neither one of field is set for DescribeDomainRequest"); + } + + public static ListDomainsRequest listDomainsRequest(com.uber.cadence.ListDomainsRequest t) { + if (t == null) { + return null; + } + ListDomainsRequest.Builder request = + ListDomainsRequest.newBuilder().setPageSize(t.getPageSize()); + if (t.getNextPageToken() != null) { + request.setNextPageToken(arrayToByteString(t.getNextPageToken())); + } + return request.build(); + } + + public static ListTaskListPartitionsRequest listTaskListPartitionsRequest( + com.uber.cadence.ListTaskListPartitionsRequest t) { + if (t == null) { + return null; + } + return ListTaskListPartitionsRequest.newBuilder() + .setDomain(t.getDomain()) + .setTaskList(taskList(t.getTaskList())) + .build(); + } + + public static ListWorkflowExecutionsRequest listWorkflowExecutionsRequest( + com.uber.cadence.ListWorkflowExecutionsRequest t) { + if (t == null) { + return null; + } + ListWorkflowExecutionsRequest.Builder request = + ListWorkflowExecutionsRequest.newBuilder() + .setDomain(t.getDomain()) + .setPageSize(t.getPageSize()); + if (t.getNextPageToken() != null) { + request.setNextPageToken(arrayToByteString(t.getNextPageToken())); + } + if (t.getQuery() != null) { + request.setQuery(t.getQuery()); + } + return request.build(); + } + + public static PollForActivityTaskRequest pollForActivityTaskRequest( + com.uber.cadence.PollForActivityTaskRequest t) { + if (t == null) { + return null; + } + PollForActivityTaskRequest.Builder builder = + PollForActivityTaskRequest.newBuilder() + .setDomain(t.getDomain()) + .setTaskList(taskList(t.getTaskList())) + .setTaskListMetadata(taskListMetadata(t.getTaskListMetadata())); + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + return builder.build(); + } + + public static PollForDecisionTaskRequest pollForDecisionTaskRequest( + com.uber.cadence.PollForDecisionTaskRequest t) { + if (t == null) { + return null; + } + PollForDecisionTaskRequest.Builder builder = + PollForDecisionTaskRequest.newBuilder() + .setDomain(t.getDomain()) + .setTaskList(taskList(t.getTaskList())); + if (t.getBinaryChecksum() != null) { + builder.setBinaryChecksum(t.getBinaryChecksum()); + } + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + return builder.build(); + } + + public static QueryWorkflowRequest queryWorkflowRequest(com.uber.cadence.QueryWorkflowRequest t) { + if (t == null) { + return null; + } + return QueryWorkflowRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowExecution(workflowExecution(t.getExecution())) + .setQuery(workflowQuery(t.getQuery())) + .setQueryRejectCondition(queryRejectCondition(t.getQueryRejectCondition())) + .setQueryConsistencyLevel(queryConsistencyLevel(t.getQueryConsistencyLevel())) + .build(); + } + + public static RecordActivityTaskHeartbeatByIDRequest recordActivityTaskHeartbeatByIdRequest( + com.uber.cadence.RecordActivityTaskHeartbeatByIDRequest t) { + if (t == null) { + return null; + } + RecordActivityTaskHeartbeatByIDRequest.Builder builder = + RecordActivityTaskHeartbeatByIDRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowExecution(TypeMapper.workflowRunPair(t.getWorkflowID(), t.getRunID())) + .setActivityId(t.getActivityID()) + .setDetails(payload(t.getDetails())); + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + return builder.build(); + } + + public static RecordActivityTaskHeartbeatRequest recordActivityTaskHeartbeatRequest( + com.uber.cadence.RecordActivityTaskHeartbeatRequest t) { + if (t == null) { + return null; + } + RecordActivityTaskHeartbeatRequest.Builder builder = + RecordActivityTaskHeartbeatRequest.newBuilder().setDetails(payload(t.getDetails())); + if (t.getTaskToken() != null) { + builder.setTaskToken(arrayToByteString(t.getTaskToken())); + } + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + return builder.build(); + } + + public static RegisterDomainRequest registerDomainRequest( + com.uber.cadence.RegisterDomainRequest t) { + if (t == null) { + return null; + } + RegisterDomainRequest request = + RegisterDomainRequest.newBuilder() + .setName(t.getName()) + .setDescription(Helpers.nullToEmpty(t.getDescription())) + .setOwnerEmail(Helpers.nullToEmpty(t.getOwnerEmail())) + .setWorkflowExecutionRetentionPeriod( + daysToDuration(t.getWorkflowExecutionRetentionPeriodInDays())) + .addAllClusters(clusterReplicationConfigurationArray(t.getClusters())) + .setActiveClusterName(Helpers.nullToEmpty(t.getActiveClusterName())) + .putAllData(Helpers.nullToEmpty(t.getData())) + .setSecurityToken(Helpers.nullToEmpty(t.getSecurityToken())) + .setIsGlobalDomain(nullToEmpty(t.isGlobalDomain())) + .setHistoryArchivalStatus(archivalStatus(t.getHistoryArchivalStatus())) + .setHistoryArchivalUri(Helpers.nullToEmpty(t.getHistoryArchivalURI())) + .setVisibilityArchivalStatus(archivalStatus(t.getVisibilityArchivalStatus())) + .setVisibilityArchivalUri(Helpers.nullToEmpty(t.getVisibilityArchivalURI())) + .build(); + return request; + } + + public static RestartWorkflowExecutionRequest restartWorkflowExecutionRequest( + com.uber.cadence.RestartWorkflowExecutionRequest t) { + if (t == null) { + return null; + } + return RestartWorkflowExecutionRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowExecution(workflowExecution(t.getWorkflowExecution())) + .setReason(t.getReason()) + .setIdentity(t.getIdentity()) + .build(); + } + + public static UpdateDomainRequest updateDomainRequest(com.uber.cadence.UpdateDomainRequest t) { + if (t == null) { + return null; + } + Builder request = + UpdateDomainRequest.newBuilder() + .setName(t.getName()) + .setSecurityToken(t.getSecurityToken()); + + List fields = new ArrayList<>(); + com.uber.cadence.UpdateDomainInfo updatedInfo = t.getUpdatedInfo(); + if (updatedInfo != null) { + if (updatedInfo.getDescription() != null) { + request.setDescription(updatedInfo.getDescription()); + fields.add(DomainUpdateDescriptionField); + } + if (updatedInfo.getOwnerEmail() != null) { + request.setOwnerEmail(updatedInfo.getOwnerEmail()); + fields.add(DomainUpdateOwnerEmailField); + } + if (updatedInfo.getData() != null) { + updatedInfo.setData(updatedInfo.getData()); + fields.add(DomainUpdateDataField); + } + } + com.uber.cadence.DomainConfiguration configuration = t.getConfiguration(); + if (configuration != null) { + if (configuration.getWorkflowExecutionRetentionPeriodInDays() > 0) { + request.setWorkflowExecutionRetentionPeriod( + daysToDuration(configuration.getWorkflowExecutionRetentionPeriodInDays())); + fields.add(DomainUpdateRetentionPeriodField); + } + // if t.EmitMetric != null {} - DEPRECATED + if (configuration.getBadBinaries() != null) { + request.setBadBinaries(badBinaries(configuration.getBadBinaries())); + fields.add(DomainUpdateBadBinariesField); + } + if (configuration.getHistoryArchivalStatus() != null) { + request.setHistoryArchivalStatus(archivalStatus(configuration.getHistoryArchivalStatus())); + fields.add(DomainUpdateHistoryArchivalStatusField); + } + if (configuration.getHistoryArchivalURI() != null) { + request.setHistoryArchivalUri(configuration.getHistoryArchivalURI()); + fields.add(DomainUpdateHistoryArchivalURIField); + } + if (configuration.getVisibilityArchivalStatus() != null) { + request.setVisibilityArchivalStatus( + archivalStatus(configuration.getVisibilityArchivalStatus())); + fields.add(DomainUpdateVisibilityArchivalStatusField); + } + if (configuration.getVisibilityArchivalURI() != null) { + request.setVisibilityArchivalUri(configuration.getVisibilityArchivalURI()); + fields.add(DomainUpdateVisibilityArchivalURIField); + } + } + com.uber.cadence.DomainReplicationConfiguration replicationConfiguration = + t.getReplicationConfiguration(); + if (replicationConfiguration != null) { + if (replicationConfiguration.getActiveClusterName() != null) { + request.setActiveClusterName(replicationConfiguration.getActiveClusterName()); + fields.add(DomainUpdateActiveClusterNameField); + } + if (replicationConfiguration.getClusters() != null) { + request.addAllClusters( + clusterReplicationConfigurationArray(replicationConfiguration.getClusters())); + fields.add(DomainUpdateClustersField); + } + } + if (t.getDeleteBadBinary() != null) { + request.setDeleteBadBinary(t.getDeleteBadBinary()); + fields.add(DomainUpdateDeleteBadBinaryField); + } + if (t.getFailoverTimeoutInSeconds() > 0) { + request.setFailoverTimeout(secondsToDuration(t.getFailoverTimeoutInSeconds())); + fields.add(DomainUpdateFailoverTimeoutField); + } + + request.setUpdateMask(newFieldMask(fields)); + + return request.build(); + } + + public static ListClosedWorkflowExecutionsRequest listClosedWorkflowExecutionsRequest( + com.uber.cadence.ListClosedWorkflowExecutionsRequest t) { + if (t == null) { + return null; + } + ListClosedWorkflowExecutionsRequest.Builder request = + ListClosedWorkflowExecutionsRequest.newBuilder() + .setDomain(t.getDomain()) + .setPageSize(t.getMaximumPageSize()); + if (t.getExecutionFilter() != null) { + request.setExecutionFilter(workflowExecutionFilter(t.getExecutionFilter())); + } + if (t.getTypeFilter() != null) { + request.setTypeFilter(workflowTypeFilter(t.getTypeFilter())); + } + if (t.getStatusFilter() != null) { + request.setStatusFilter(statusFilter(t.getStatusFilter())); + } + if (t.getNextPageToken() != null) { + request.setNextPageToken(arrayToByteString(t.getNextPageToken())); + } + if (t.getStartTimeFilter() != null) { + request.setStartTimeFilter(startTimeFilter(t.getStartTimeFilter())); + } + return request.build(); + } + + public static ListOpenWorkflowExecutionsRequest listOpenWorkflowExecutionsRequest( + com.uber.cadence.ListOpenWorkflowExecutionsRequest t) { + if (t == null) { + return null; + } + ListOpenWorkflowExecutionsRequest.Builder request = + ListOpenWorkflowExecutionsRequest.newBuilder() + .setDomain(t.getDomain()) + .setPageSize(t.getMaximumPageSize()); + if (t.getExecutionFilter() != null) { + request.setExecutionFilter(workflowExecutionFilter(t.getExecutionFilter())); + } + if (t.getTypeFilter() != null) { + request.setTypeFilter(workflowTypeFilter(t.getTypeFilter())); + } + if (t.getNextPageToken() != null) { + request.setNextPageToken(arrayToByteString(t.getNextPageToken())); + } + if (t.getStartTimeFilter() != null) { + request.setStartTimeFilter(startTimeFilter(t.getStartTimeFilter())); + } + return request.build(); + } + + public static RespondActivityTaskFailedByIDRequest respondActivityTaskFailedByIDRequest( + com.uber.cadence.RespondActivityTaskFailedByIDRequest failRequest) { + if (failRequest == null) { + return null; + } + RespondActivityTaskFailedByIDRequest.Builder request = + RespondActivityTaskFailedByIDRequest.newBuilder() + .setDomain(failRequest.getDomain()) + .setWorkflowExecution( + TypeMapper.workflowRunPair(failRequest.getWorkflowID(), failRequest.getRunID())) + .setActivityId(failRequest.getActivityID()) + .setFailure(failure(failRequest.getReason(), failRequest.getDetails())) + .setIdentity(failRequest.getIdentity()); + return request.build(); + } + + public static RespondActivityTaskCompletedByIDRequest respondActivityTaskCompletedByIDRequest( + com.uber.cadence.RespondActivityTaskCompletedByIDRequest completeRequest) { + if (completeRequest == null) { + return null; + } + RespondActivityTaskCompletedByIDRequest.Builder request = + RespondActivityTaskCompletedByIDRequest.newBuilder() + .setDomain(completeRequest.getDomain()) + .setWorkflowExecution( + TypeMapper.workflowRunPair( + completeRequest.getWorkflowID(), completeRequest.getRunID())) + .setActivityId(completeRequest.getActivityID()) + .setResult(payload(completeRequest.getResult())) + .setIdentity(completeRequest.getIdentity()); + return request.build(); + } + + public static RecordActivityTaskHeartbeatByIDRequest recordActivityTaskHeartbeatByIDRequest( + com.uber.cadence.RecordActivityTaskHeartbeatByIDRequest heartbeatRequest) { + if (heartbeatRequest == null) { + return null; + } + RecordActivityTaskHeartbeatByIDRequest.Builder request = + RecordActivityTaskHeartbeatByIDRequest.newBuilder() + .setDomain(heartbeatRequest.getDomain()) + .setWorkflowExecution( + TypeMapper.workflowRunPair( + heartbeatRequest.getWorkflowID(), heartbeatRequest.getRunID())) + .setActivityId(heartbeatRequest.getActivityID()) + .setDetails(payload(heartbeatRequest.getDetails())) + .setIdentity(heartbeatRequest.getIdentity()); + return request.build(); + } + + public static RespondActivityTaskCanceledByIDRequest respondActivityTaskCanceledByIDRequest( + com.uber.cadence.RespondActivityTaskCanceledByIDRequest canceledRequest) { + if (canceledRequest == null) { + return null; + } + RespondActivityTaskCanceledByIDRequest.Builder request = + RespondActivityTaskCanceledByIDRequest.newBuilder() + .setDomain(canceledRequest.getDomain()) + .setWorkflowExecution( + TypeMapper.workflowRunPair( + canceledRequest.getWorkflowID(), canceledRequest.getRunID())) + .setActivityId(canceledRequest.getActivityID()) + .setDetails(payload(canceledRequest.getDetails())) + .setIdentity(canceledRequest.getIdentity()); + return request.build(); + } + + public static GetTaskListsByDomainRequest getTaskListsByDomainRequest( + com.uber.cadence.GetTaskListsByDomainRequest domainRequest) { + if (domainRequest == null) { + return null; + } + GetTaskListsByDomainRequest.Builder request = + GetTaskListsByDomainRequest.newBuilder().setDomain(domainRequest.getDomainName()); + return request.build(); + } + + public static RefreshWorkflowTasksRequest refreshWorkflowTasksRequest( + com.uber.cadence.RefreshWorkflowTasksRequest request) { + if (request == null) { + return null; + } + return RefreshWorkflowTasksRequest.newBuilder().setDomain(request.getDomain()).build(); + } +} diff --git a/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/ResponseMapper.java b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/ResponseMapper.java new file mode 100644 index 000000000..6512139c4 --- /dev/null +++ b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/ResponseMapper.java @@ -0,0 +1,517 @@ +/** + * 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.compatibility.proto.mappers; + +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.archivalStatus; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.domainStatus; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.byteStringToArray; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.durationToDays; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.durationToSeconds; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.timeToUnixNano; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.toInt64Value; +import static com.uber.cadence.internal.compatibility.proto.mappers.HistoryMapper.history; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.activityLocalDispatchInfoMap; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.activityType; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.badBinaries; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.clusterReplicationConfigurationArrayFromProto; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.dataBlobArray; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.describeDomainResponseArray; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.header; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.indexedValueTypeMap; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.payload; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.pendingActivityInfoArray; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.pendingChildExecutionInfoArray; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.pendingDecisionInfo; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.pollerInfoArray; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.queryRejected; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.supportedClientVersions; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.taskList; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.taskListPartitionMetadataArray; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.taskListStatus; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowExecution; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowExecutionConfiguration; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowExecutionInfo; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowExecutionInfoArray; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowQuery; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowQueryMap; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowType; + +import com.uber.cadence.api.v1.*; +import java.util.Map; +import java.util.stream.Collectors; + +public class ResponseMapper { + + public static com.uber.cadence.StartWorkflowExecutionResponse startWorkflowExecutionResponse( + StartWorkflowExecutionResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.StartWorkflowExecutionResponse startWorkflowExecutionResponse = + new com.uber.cadence.StartWorkflowExecutionResponse(); + startWorkflowExecutionResponse.setRunId(t.getRunId()); + return startWorkflowExecutionResponse; + } + + public static com.uber.cadence.StartWorkflowExecutionAsyncResponse + startWorkflowExecutionAsyncResponse(StartWorkflowExecutionAsyncResponse t) { + return t == null ? null : new com.uber.cadence.StartWorkflowExecutionAsyncResponse(); + } + + public static com.uber.cadence.DescribeTaskListResponse describeTaskListResponse( + DescribeTaskListResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.DescribeTaskListResponse describeTaskListResponse = + new com.uber.cadence.DescribeTaskListResponse(); + describeTaskListResponse.setPollers(pollerInfoArray(t.getPollersList())); + describeTaskListResponse.setTaskListStatus(taskListStatus(t.getTaskListStatus())); + return describeTaskListResponse; + } + + public static com.uber.cadence.RestartWorkflowExecutionResponse restartWorkflowExecutionResponse( + RestartWorkflowExecutionResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.RestartWorkflowExecutionResponse restartWorkflowExecutionResponse = + new com.uber.cadence.RestartWorkflowExecutionResponse(); + restartWorkflowExecutionResponse.setRunId(t.getRunId()); + return restartWorkflowExecutionResponse; + } + + public static com.uber.cadence.DescribeWorkflowExecutionResponse + describeWorkflowExecutionResponse(DescribeWorkflowExecutionResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.DescribeWorkflowExecutionResponse describeWorkflowExecutionResponse = + new com.uber.cadence.DescribeWorkflowExecutionResponse(); + describeWorkflowExecutionResponse.setExecutionConfiguration( + workflowExecutionConfiguration(t.getExecutionConfiguration())); + describeWorkflowExecutionResponse.setWorkflowExecutionInfo( + workflowExecutionInfo(t.getWorkflowExecutionInfo())); + describeWorkflowExecutionResponse.setPendingActivities( + pendingActivityInfoArray(t.getPendingActivitiesList())); + describeWorkflowExecutionResponse.setPendingChildren( + pendingChildExecutionInfoArray(t.getPendingChildrenList())); + describeWorkflowExecutionResponse.setPendingDecision( + pendingDecisionInfo(t.getPendingDecision())); + return describeWorkflowExecutionResponse; + } + + public static com.uber.cadence.ClusterInfo getClusterInfoResponse(GetClusterInfoResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.ClusterInfo clusterInfo = new com.uber.cadence.ClusterInfo(); + clusterInfo.setSupportedClientVersions(supportedClientVersions(t.getSupportedClientVersions())); + return clusterInfo; + } + + public static com.uber.cadence.GetSearchAttributesResponse getSearchAttributesResponse( + GetSearchAttributesResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.GetSearchAttributesResponse getSearchAttributesResponse = + new com.uber.cadence.GetSearchAttributesResponse(); + getSearchAttributesResponse.setKeys(indexedValueTypeMap(t.getKeysMap())); + return getSearchAttributesResponse; + } + + public static com.uber.cadence.GetWorkflowExecutionHistoryResponse + getWorkflowExecutionHistoryResponse(GetWorkflowExecutionHistoryResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.GetWorkflowExecutionHistoryResponse getWorkflowExecutionHistoryResponse = + new com.uber.cadence.GetWorkflowExecutionHistoryResponse(); + getWorkflowExecutionHistoryResponse.setHistory(history(t.getHistory())); + getWorkflowExecutionHistoryResponse.setRawHistory(dataBlobArray(t.getRawHistoryList())); + getWorkflowExecutionHistoryResponse.setNextPageToken(byteStringToArray(t.getNextPageToken())); + getWorkflowExecutionHistoryResponse.setArchived(t.getArchived()); + return getWorkflowExecutionHistoryResponse; + } + + public static com.uber.cadence.ListArchivedWorkflowExecutionsResponse + listArchivedWorkflowExecutionsResponse(ListArchivedWorkflowExecutionsResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.ListArchivedWorkflowExecutionsResponse res = + new com.uber.cadence.ListArchivedWorkflowExecutionsResponse(); + res.setExecutions(workflowExecutionInfoArray(t.getExecutionsList())); + res.setNextPageToken(byteStringToArray(t.getNextPageToken())); + return res; + } + + public static com.uber.cadence.ListClosedWorkflowExecutionsResponse + listClosedWorkflowExecutionsResponse(ListClosedWorkflowExecutionsResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.ListClosedWorkflowExecutionsResponse res = + new com.uber.cadence.ListClosedWorkflowExecutionsResponse(); + res.setExecutions(workflowExecutionInfoArray(t.getExecutionsList())); + res.setNextPageToken(byteStringToArray(t.getNextPageToken())); + return res; + } + + public static com.uber.cadence.ListOpenWorkflowExecutionsResponse + listOpenWorkflowExecutionsResponse(ListOpenWorkflowExecutionsResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.ListOpenWorkflowExecutionsResponse res = + new com.uber.cadence.ListOpenWorkflowExecutionsResponse(); + res.setExecutions(workflowExecutionInfoArray(t.getExecutionsList())); + res.setNextPageToken(byteStringToArray(t.getNextPageToken())); + return res; + } + + public static com.uber.cadence.ListTaskListPartitionsResponse listTaskListPartitionsResponse( + ListTaskListPartitionsResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.ListTaskListPartitionsResponse res = + new com.uber.cadence.ListTaskListPartitionsResponse(); + res.setActivityTaskListPartitions( + taskListPartitionMetadataArray(t.getActivityTaskListPartitionsList())); + res.setDecisionTaskListPartitions( + taskListPartitionMetadataArray(t.getDecisionTaskListPartitionsList())); + return res; + } + + public static com.uber.cadence.ListWorkflowExecutionsResponse listWorkflowExecutionsResponse( + ListWorkflowExecutionsResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.ListWorkflowExecutionsResponse res = + new com.uber.cadence.ListWorkflowExecutionsResponse(); + res.setExecutions(workflowExecutionInfoArray(t.getExecutionsList())); + res.setNextPageToken(byteStringToArray(t.getNextPageToken())); + return res; + } + + public static com.uber.cadence.PollForActivityTaskResponse pollForActivityTaskResponse( + PollForActivityTaskResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.PollForActivityTaskResponse res = + new com.uber.cadence.PollForActivityTaskResponse(); + res.setTaskToken(byteStringToArray(t.getTaskToken())); + res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution())); + res.setActivityId(t.getActivityId()); + res.setActivityType(activityType(t.getActivityType())); + res.setInput(payload(t.getInput())); + res.setScheduledTimestamp(timeToUnixNano(t.getScheduledTime())); + res.setStartedTimestamp(timeToUnixNano(t.getStartedTime())); + res.setScheduleToCloseTimeoutSeconds(durationToSeconds(t.getScheduleToCloseTimeout())); + res.setStartToCloseTimeoutSeconds(durationToSeconds(t.getStartToCloseTimeout())); + res.setHeartbeatTimeoutSeconds(durationToSeconds(t.getHeartbeatTimeout())); + res.setAttempt(t.getAttempt()); + res.setScheduledTimestampOfThisAttempt(timeToUnixNano(t.getScheduledTimeOfThisAttempt())); + res.setHeartbeatDetails(payload(t.getHeartbeatDetails())); + res.setWorkflowType(workflowType(t.getWorkflowType())); + res.setWorkflowDomain(t.getWorkflowDomain()); + res.setHeader(header(t.getHeader())); + return res; + } + + public static com.uber.cadence.PollForDecisionTaskResponse pollForDecisionTaskResponse( + PollForDecisionTaskResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.PollForDecisionTaskResponse res = + new com.uber.cadence.PollForDecisionTaskResponse(); + res.setTaskToken(byteStringToArray(t.getTaskToken())); + res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution())); + res.setWorkflowType(workflowType(t.getWorkflowType())); + res.setPreviousStartedEventId(toInt64Value(t.getPreviousStartedEventId())); + res.setStartedEventId(t.getStartedEventId()); + res.setAttempt(t.getAttempt()); + res.setBacklogCountHint(t.getBacklogCountHint()); + res.setHistory(history(t.getHistory())); + res.setNextPageToken(byteStringToArray(t.getNextPageToken())); + if (t.getQuery() != WorkflowQuery.getDefaultInstance()) { + res.setQuery(workflowQuery(t.getQuery())); + } + res.setWorkflowExecutionTaskList(taskList(t.getWorkflowExecutionTaskList())); + res.setScheduledTimestamp(timeToUnixNano(t.getScheduledTime())); + res.setStartedTimestamp(timeToUnixNano(t.getStartedTime())); + res.setQueries(workflowQueryMap(t.getQueriesMap())); + res.setNextEventId(t.getNextEventId()); + return res; + } + + public static com.uber.cadence.QueryWorkflowResponse queryWorkflowResponse( + QueryWorkflowResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.QueryWorkflowResponse res = new com.uber.cadence.QueryWorkflowResponse(); + res.setQueryResult(payload(t.getQueryResult())); + res.setQueryRejected(queryRejected(t.getQueryRejected())); + return res; + } + + public static com.uber.cadence.RecordActivityTaskHeartbeatResponse + recordActivityTaskHeartbeatByIdResponse(RecordActivityTaskHeartbeatByIDResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.RecordActivityTaskHeartbeatResponse res = + new com.uber.cadence.RecordActivityTaskHeartbeatResponse(); + res.setCancelRequested(t.getCancelRequested()); + return res; + } + + public static com.uber.cadence.RecordActivityTaskHeartbeatResponse + recordActivityTaskHeartbeatResponse(RecordActivityTaskHeartbeatResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.RecordActivityTaskHeartbeatResponse res = + new com.uber.cadence.RecordActivityTaskHeartbeatResponse(); + res.setCancelRequested(t.getCancelRequested()); + return res; + } + + public static com.uber.cadence.ResetWorkflowExecutionResponse resetWorkflowExecutionResponse( + ResetWorkflowExecutionResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.ResetWorkflowExecutionResponse res = + new com.uber.cadence.ResetWorkflowExecutionResponse(); + res.setRunId(t.getRunId()); + return res; + } + + public static com.uber.cadence.RespondDecisionTaskCompletedResponse + respondDecisionTaskCompletedResponse(RespondDecisionTaskCompletedResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.RespondDecisionTaskCompletedResponse res = + new com.uber.cadence.RespondDecisionTaskCompletedResponse(); + res.setDecisionTask(pollForDecisionTaskResponse(t.getDecisionTask())); + res.setActivitiesToDispatchLocally( + activityLocalDispatchInfoMap(t.getActivitiesToDispatchLocallyMap())); + return res; + } + + public static com.uber.cadence.ListWorkflowExecutionsResponse scanWorkflowExecutionsResponse( + ScanWorkflowExecutionsResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.ListWorkflowExecutionsResponse res = + new com.uber.cadence.ListWorkflowExecutionsResponse(); + res.setExecutions(workflowExecutionInfoArray(t.getExecutionsList())); + res.setNextPageToken(byteStringToArray(t.getNextPageToken())); + return res; + } + + public static com.uber.cadence.CountWorkflowExecutionsResponse countWorkflowExecutionsResponse( + CountWorkflowExecutionsResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.CountWorkflowExecutionsResponse res = + new com.uber.cadence.CountWorkflowExecutionsResponse(); + res.setCount(t.getCount()); + return res; + } + + public static com.uber.cadence.DescribeDomainResponse describeDomainResponse( + DescribeDomainResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.DescribeDomainResponse response = + new com.uber.cadence.DescribeDomainResponse(); + com.uber.cadence.DomainInfo domainInfo = new com.uber.cadence.DomainInfo(); + response.setDomainInfo(domainInfo); + + domainInfo.setName(t.getDomain().getName()); + domainInfo.setStatus(domainStatus(t.getDomain().getStatus())); + domainInfo.setDescription(t.getDomain().getDescription()); + domainInfo.setOwnerEmail(t.getDomain().getOwnerEmail()); + domainInfo.setData(t.getDomain().getDataMap()); + domainInfo.setUuid(t.getDomain().getId()); + + com.uber.cadence.DomainConfiguration domainConfiguration = + new com.uber.cadence.DomainConfiguration(); + response.setConfiguration(domainConfiguration); + + domainConfiguration.setWorkflowExecutionRetentionPeriodInDays( + durationToDays(t.getDomain().getWorkflowExecutionRetentionPeriod())); + domainConfiguration.setEmitMetric(true); + domainConfiguration.setBadBinaries(badBinaries(t.getDomain().getBadBinaries())); + domainConfiguration.setHistoryArchivalStatus( + archivalStatus(t.getDomain().getHistoryArchivalStatus())); + domainConfiguration.setHistoryArchivalURI(t.getDomain().getHistoryArchivalUri()); + domainConfiguration.setVisibilityArchivalStatus( + archivalStatus(t.getDomain().getVisibilityArchivalStatus())); + domainConfiguration.setVisibilityArchivalURI(t.getDomain().getVisibilityArchivalUri()); + + com.uber.cadence.DomainReplicationConfiguration replicationConfiguration = + new com.uber.cadence.DomainReplicationConfiguration(); + response.setReplicationConfiguration(replicationConfiguration); + + replicationConfiguration.setActiveClusterName(t.getDomain().getActiveClusterName()); + replicationConfiguration.setClusters( + clusterReplicationConfigurationArrayFromProto(t.getDomain().getClustersList())); + + response.setFailoverVersion(t.getDomain().getFailoverVersion()); + response.setGlobalDomain(t.getDomain().getIsGlobalDomain()); + return response; + } + + public static com.uber.cadence.ListDomainsResponse listDomainsResponse(ListDomainsResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.ListDomainsResponse res = new com.uber.cadence.ListDomainsResponse(); + res.setDomains(describeDomainResponseArray(t.getDomainsList())); + res.setNextPageToken(byteStringToArray(t.getNextPageToken())); + return res; + } + + public static com.uber.cadence.StartWorkflowExecutionResponse + signalWithStartWorkflowExecutionResponse(SignalWithStartWorkflowExecutionResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.StartWorkflowExecutionResponse startWorkflowExecutionResponse = + new com.uber.cadence.StartWorkflowExecutionResponse(); + startWorkflowExecutionResponse.setRunId(t.getRunId()); + return startWorkflowExecutionResponse; + } + + public static com.uber.cadence.SignalWithStartWorkflowExecutionAsyncResponse + signalWithStartWorkflowExecutionAsyncResponse( + SignalWithStartWorkflowExecutionAsyncResponse t) { + return t == null ? null : new com.uber.cadence.SignalWithStartWorkflowExecutionAsyncResponse(); + } + + public static com.uber.cadence.UpdateDomainResponse updateDomainResponse(UpdateDomainResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.UpdateDomainResponse updateDomainResponse = + new com.uber.cadence.UpdateDomainResponse(); + com.uber.cadence.DomainInfo domainInfo = new com.uber.cadence.DomainInfo(); + updateDomainResponse.setDomainInfo(domainInfo); + + domainInfo.setName(t.getDomain().getName()); + domainInfo.setStatus(domainStatus(t.getDomain().getStatus())); + domainInfo.setDescription(t.getDomain().getDescription()); + domainInfo.setOwnerEmail(t.getDomain().getOwnerEmail()); + domainInfo.setData(t.getDomain().getDataMap()); + domainInfo.setUuid(t.getDomain().getId()); + + com.uber.cadence.DomainConfiguration domainConfiguration = + new com.uber.cadence.DomainConfiguration(); + updateDomainResponse.setConfiguration(domainConfiguration); + + domainConfiguration.setWorkflowExecutionRetentionPeriodInDays( + durationToDays(t.getDomain().getWorkflowExecutionRetentionPeriod())); + domainConfiguration.setEmitMetric(true); + domainConfiguration.setBadBinaries(badBinaries(t.getDomain().getBadBinaries())); + domainConfiguration.setHistoryArchivalStatus( + archivalStatus(t.getDomain().getHistoryArchivalStatus())); + domainConfiguration.setHistoryArchivalURI(t.getDomain().getHistoryArchivalUri()); + domainConfiguration.setVisibilityArchivalStatus( + archivalStatus(t.getDomain().getVisibilityArchivalStatus())); + domainConfiguration.setVisibilityArchivalURI(t.getDomain().getVisibilityArchivalUri()); + + com.uber.cadence.DomainReplicationConfiguration domainReplicationConfiguration = + new com.uber.cadence.DomainReplicationConfiguration(); + updateDomainResponse.setReplicationConfiguration(domainReplicationConfiguration); + + domainReplicationConfiguration.setActiveClusterName(t.getDomain().getActiveClusterName()); + domainReplicationConfiguration.setClusters( + clusterReplicationConfigurationArrayFromProto(t.getDomain().getClustersList())); + updateDomainResponse.setFailoverVersion(t.getDomain().getFailoverVersion()); + updateDomainResponse.setGlobalDomain(t.getDomain().getIsGlobalDomain()); + return updateDomainResponse; + } + + public static com.uber.cadence.RecordActivityTaskHeartbeatResponse + recordActivityTaskHeartbeatResponse( + RecordActivityTaskHeartbeatByIDResponse recordActivityTaskHeartbeatByID) { + if (recordActivityTaskHeartbeatByID == null) { + return null; + } + com.uber.cadence.RecordActivityTaskHeartbeatResponse res = + new com.uber.cadence.RecordActivityTaskHeartbeatResponse(); + res.setCancelRequested(recordActivityTaskHeartbeatByID.getCancelRequested()); + return res; + } + + public static com.uber.cadence.ResetStickyTaskListResponse resetStickyTaskListResponse( + ResetStickyTaskListResponse resetStickyTaskList) { + if (resetStickyTaskList == null) { + return null; + } + com.uber.cadence.ResetStickyTaskListResponse res = + new com.uber.cadence.ResetStickyTaskListResponse(); + return res; + } + + public static com.uber.cadence.ClusterInfo clusterInfoResponse( + GetClusterInfoResponse clusterInfo) { + if (clusterInfo == null) { + return null; + } + com.uber.cadence.ClusterInfo res = new com.uber.cadence.ClusterInfo(); + res.setSupportedClientVersions( + TypeMapper.supportedClientVersions(clusterInfo.getSupportedClientVersions())); + return res; + } + + public static com.uber.cadence.GetTaskListsByDomainResponse getTaskListsByDomainResponse( + GetTaskListsByDomainResponse taskListsByDomain) { + if (taskListsByDomain == null) { + return null; + } + com.uber.cadence.GetTaskListsByDomainResponse res = + new com.uber.cadence.GetTaskListsByDomainResponse(); + + res.setActivityTaskListMap( + taskListsByDomain + .getActivityTaskListMapMap() + .entrySet() + .stream() + .collect( + Collectors.toMap(Map.Entry::getKey, e -> describeTaskListResponse(e.getValue())))); + res.setDecisionTaskListMap( + taskListsByDomain + .getDecisionTaskListMapMap() + .entrySet() + .stream() + .collect( + Collectors.toMap(Map.Entry::getKey, e -> describeTaskListResponse(e.getValue())))); + return res; + } +} diff --git a/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/TypeMapper.java b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/TypeMapper.java new file mode 100644 index 000000000..71ec27a39 --- /dev/null +++ b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/TypeMapper.java @@ -0,0 +1,917 @@ +/* + * Modifications Copyright (c) 2017-2021 Uber Technologies Inc. + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * 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.compatibility.proto.mappers; + +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.archivalStatus; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.domainStatus; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.encodingType; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.indexedValueType; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.parentClosePolicy; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.pendingActivityState; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.pendingDecisionState; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.queryResultType; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.taskListKind; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.workflowExecutionCloseStatus; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.arrayToByteString; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.byteStringToArray; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.durationToDays; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.durationToSeconds; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.fromDoubleValue; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.secondsToDuration; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.timeToUnixNano; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.unixNanoToTime; + +import com.google.common.base.Strings; +import com.uber.cadence.api.v1.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +class TypeMapper { + + static BadBinaryInfo badBinaryInfo(com.uber.cadence.BadBinaryInfo t) { + if (t == null) { + return null; + } + return BadBinaryInfo.newBuilder() + .setReason(t.getReason()) + .setOperator(t.getOperator()) + .setCreatedTime(unixNanoToTime(t.getCreatedTimeNano())) + .build(); + } + + static Payload payload(byte[] data) { + if (data == null) { + return Payload.newBuilder().build(); + } + return Payload.newBuilder().setData(arrayToByteString(data)).build(); + } + + static Failure failure(String reason, byte[] details) { + if (reason == null) { + return Failure.newBuilder().build(); + } + return Failure.newBuilder().setReason(reason).setDetails(arrayToByteString(details)).build(); + } + + static WorkflowExecution workflowExecution(com.uber.cadence.WorkflowExecution t) { + if (t == null) { + return WorkflowExecution.newBuilder().build(); + } + if (t.getWorkflowId() == null && t.getRunId() == null) { + return WorkflowExecution.newBuilder().build(); + } + WorkflowExecution.Builder builder = + WorkflowExecution.newBuilder().setWorkflowId(t.getWorkflowId()); + if (t.getRunId() != null) { + builder.setRunId(t.getRunId()); + } + return builder.build(); + } + + static WorkflowExecution workflowRunPair(String workflowId, String runId) { + if (Strings.isNullOrEmpty(workflowId) && Strings.isNullOrEmpty(runId)) { + return WorkflowExecution.newBuilder().build(); + } + return WorkflowExecution.newBuilder().setWorkflowId(workflowId).setRunId(runId).build(); + } + + static ActivityType activityType(com.uber.cadence.ActivityType t) { + if (t == null) { + return ActivityType.newBuilder().build(); + } + return ActivityType.newBuilder().setName(t.getName()).build(); + } + + static WorkflowType workflowType(com.uber.cadence.WorkflowType t) { + if (t == null) { + return WorkflowType.newBuilder().build(); + } + return WorkflowType.newBuilder().setName(t.getName()).build(); + } + + static TaskList taskList(com.uber.cadence.TaskList t) { + if (t == null) { + return TaskList.newBuilder().build(); + } + return TaskList.newBuilder().setName(t.getName()).setKind(taskListKind(t.getKind())).build(); + } + + static TaskListMetadata taskListMetadata(com.uber.cadence.TaskListMetadata t) { + if (t == null) { + return TaskListMetadata.newBuilder().build(); + } + return TaskListMetadata.newBuilder() + .setMaxTasksPerSecond(fromDoubleValue(t.getMaxTasksPerSecond())) + .build(); + } + + static RetryPolicy retryPolicy(com.uber.cadence.RetryPolicy t) { + if (t == null) { + return null; + } + RetryPolicy.Builder builder = + RetryPolicy.newBuilder() + .setInitialInterval(secondsToDuration(t.getInitialIntervalInSeconds())) + .setBackoffCoefficient(t.getBackoffCoefficient()) + .setMaximumInterval(secondsToDuration(t.getMaximumIntervalInSeconds())) + .setMaximumAttempts(t.getMaximumAttempts()) + .setExpirationInterval(secondsToDuration(t.getExpirationIntervalInSeconds())); + if (t.getNonRetriableErrorReasons() != null) { + builder.addAllNonRetryableErrorReasons(t.getNonRetriableErrorReasons()); + } + return builder.build(); + } + + static Header header(com.uber.cadence.Header t) { + if (t == null) { + return Header.newBuilder().build(); + } + return Header.newBuilder().putAllFields(payloadByteBufferMap(t.getFields())).build(); + } + + static Memo memo(com.uber.cadence.Memo t) { + if (t == null) { + return Memo.newBuilder().build(); + } + return Memo.newBuilder().putAllFields(payloadByteBufferMap(t.getFields())).build(); + } + + static SearchAttributes searchAttributes(com.uber.cadence.SearchAttributes t) { + if (t == null) { + return SearchAttributes.newBuilder().build(); + } + return SearchAttributes.newBuilder() + .putAllIndexedFields(payloadByteBufferMap(t.getIndexedFields())) + .build(); + } + + static BadBinaries badBinaries(com.uber.cadence.BadBinaries t) { + if (t == null) { + return BadBinaries.newBuilder().build(); + } + return BadBinaries.newBuilder().putAllBinaries(badBinaryInfoMap(t.getBinaries())).build(); + } + + static ClusterReplicationConfiguration clusterReplicationConfiguration( + com.uber.cadence.ClusterReplicationConfiguration t) { + if (t == null) { + return ClusterReplicationConfiguration.newBuilder().build(); + } + return ClusterReplicationConfiguration.newBuilder().setClusterName(t.getClusterName()).build(); + } + + static WorkflowQuery workflowQuery(com.uber.cadence.WorkflowQuery t) { + if (t == null) { + return null; + } + return WorkflowQuery.newBuilder() + .setQueryType(t.getQueryType()) + .setQueryArgs(payload(t.getQueryArgs())) + .build(); + } + + static WorkflowQueryResult workflowQueryResult(com.uber.cadence.WorkflowQueryResult t) { + if (t == null) { + return WorkflowQueryResult.newBuilder().build(); + } + return WorkflowQueryResult.newBuilder() + .setResultType(queryResultType(t.getResultType())) + .setAnswer(payload(t.getAnswer())) + .setErrorMessage(t.getErrorMessage()) + .build(); + } + + static StickyExecutionAttributes stickyExecutionAttributes( + com.uber.cadence.StickyExecutionAttributes t) { + if (t == null) { + return StickyExecutionAttributes.newBuilder().build(); + } + return StickyExecutionAttributes.newBuilder() + .setWorkerTaskList(taskList(t.getWorkerTaskList())) + .setScheduleToStartTimeout(secondsToDuration(t.getScheduleToStartTimeoutSeconds())) + .build(); + } + + static WorkerVersionInfo workerVersionInfo(com.uber.cadence.WorkerVersionInfo t) { + if (t == null) { + return WorkerVersionInfo.newBuilder().build(); + } + return WorkerVersionInfo.newBuilder() + .setImpl(t.getImpl()) + .setFeatureVersion(t.getFeatureVersion()) + .build(); + } + + static StartTimeFilter startTimeFilter(com.uber.cadence.StartTimeFilter t) { + if (t == null) { + return null; + } + return StartTimeFilter.newBuilder() + .setEarliestTime(unixNanoToTime(t.getEarliestTime())) + .setLatestTime(unixNanoToTime(t.getLatestTime())) + .build(); + } + + static WorkflowExecutionFilter workflowExecutionFilter( + com.uber.cadence.WorkflowExecutionFilter t) { + if (t == null) { + return WorkflowExecutionFilter.newBuilder().build(); + } + return WorkflowExecutionFilter.newBuilder() + .setWorkflowId(t.getWorkflowId()) + .setRunId(t.getRunId()) + .build(); + } + + static WorkflowTypeFilter workflowTypeFilter(com.uber.cadence.WorkflowTypeFilter t) { + if (t == null) { + return WorkflowTypeFilter.newBuilder().build(); + } + return WorkflowTypeFilter.newBuilder().setName(t.getName()).build(); + } + + static StatusFilter statusFilter(com.uber.cadence.WorkflowExecutionCloseStatus t) { + if (t == null) { + return null; + } + return StatusFilter.newBuilder().setStatus(workflowExecutionCloseStatus(t)).build(); + } + + static Map payloadByteBufferMap(Map t) { + if (t == null) { + return Collections.emptyMap(); + } + Map v = new HashMap<>(); + for (String key : t.keySet()) { + v.put(key, payload(t.get(key))); + } + return v; + } + + static Map badBinaryInfoMap( + Map t) { + if (t == null) { + return Collections.emptyMap(); + } + Map v = new HashMap<>(); + for (String key : t.keySet()) { + v.put(key, badBinaryInfo(t.get(key))); + } + return v; + } + + static List clusterReplicationConfigurationArray( + List t) { + if (t == null) { + return Collections.emptyList(); + } + List v = new ArrayList<>(); + for (int i = 0; i < t.size(); i++) { + v.add(clusterReplicationConfiguration(t.get(i))); + } + return v; + } + + static Map workflowQueryResultMap( + Map t) { + if (t == null) { + return Collections.emptyMap(); + } + Map v = new HashMap<>(); + for (String key : t.keySet()) { + v.put(key, workflowQueryResult(t.get(key))); + } + return v; + } + + static byte[] payload(Payload t) { + if (t == null || t == Payload.getDefaultInstance()) { + return null; + } + if (t.getData().isEmpty()) { + // protoPayload will not generate this case + // however, Data field will be dropped by the encoding if it's empty + // and receiver side will see null for the Data field + // since we already know p is not null, Data field must be an empty byte array + return new byte[0]; + } + return byteStringToArray(t.getData()); + } + + static String failureReason(Failure t) { + if (t == null || t == Failure.getDefaultInstance()) { + return null; + } + return t.getReason(); + } + + static byte[] failureDetails(Failure t) { + if (t == null || t == Failure.getDefaultInstance()) { + return null; + } + return byteStringToArray(t.getDetails()); + } + + static com.uber.cadence.WorkflowExecution workflowExecution(WorkflowExecution t) { + if (t == null || t == WorkflowExecution.getDefaultInstance()) { + return null; + } + com.uber.cadence.WorkflowExecution we = new com.uber.cadence.WorkflowExecution(); + we.setWorkflowId(t.getWorkflowId()); + we.setRunId(t.getRunId()); + return we; + } + + static String workflowId(WorkflowExecution t) { + if (t == null || t == WorkflowExecution.getDefaultInstance()) { + return null; + } + return t.getWorkflowId(); + } + + static String runId(WorkflowExecution t) { + if (t == null || t == WorkflowExecution.getDefaultInstance()) { + return null; + } + return t.getRunId(); + } + + static com.uber.cadence.ActivityType activityType(ActivityType t) { + if (t == null || t == ActivityType.getDefaultInstance()) { + return null; + } + com.uber.cadence.ActivityType activityType = new com.uber.cadence.ActivityType(); + activityType.setName(t.getName()); + return activityType; + } + + static com.uber.cadence.WorkflowType workflowType(WorkflowType t) { + if (t == null || t == WorkflowType.getDefaultInstance()) { + return null; + } + com.uber.cadence.WorkflowType wt = new com.uber.cadence.WorkflowType(); + wt.setName(t.getName()); + return wt; + } + + static com.uber.cadence.TaskList taskList(TaskList t) { + if (t == null || t == TaskList.getDefaultInstance()) { + return null; + } + com.uber.cadence.TaskList taskList = new com.uber.cadence.TaskList(); + taskList.setName(t.getName()); + taskList.setKind(taskListKind(t.getKind())); + return taskList; + } + + static com.uber.cadence.RetryPolicy retryPolicy(RetryPolicy t) { + if (t == null || t == RetryPolicy.getDefaultInstance()) { + return null; + } + com.uber.cadence.RetryPolicy res = new com.uber.cadence.RetryPolicy(); + res.setInitialIntervalInSeconds(durationToSeconds(t.getInitialInterval())); + res.setBackoffCoefficient(t.getBackoffCoefficient()); + res.setMaximumIntervalInSeconds(durationToSeconds(t.getMaximumInterval())); + res.setMaximumAttempts(t.getMaximumAttempts()); + res.setNonRetriableErrorReasons(t.getNonRetryableErrorReasonsList()); + res.setExpirationIntervalInSeconds(durationToSeconds(t.getExpirationInterval())); + return res; + } + + static com.uber.cadence.Header header(Header t) { + if (t == null || t == Header.getDefaultInstance()) { + return null; + } + com.uber.cadence.Header res = new com.uber.cadence.Header(); + res.setFields(payloadMap(t.getFieldsMap())); + return res; + } + + static com.uber.cadence.Memo memo(Memo t) { + if (t == null || t == Memo.getDefaultInstance()) { + return null; + } + com.uber.cadence.Memo res = new com.uber.cadence.Memo(); + res.setFields(payloadMap(t.getFieldsMap())); + return res; + } + + static com.uber.cadence.SearchAttributes searchAttributes(SearchAttributes t) { + if (t == null || t.getAllFields().size() == 0 || t == SearchAttributes.getDefaultInstance()) { + return null; + } + com.uber.cadence.SearchAttributes res = new com.uber.cadence.SearchAttributes(); + res.setIndexedFields(payloadMap(t.getIndexedFieldsMap())); + return res; + } + + static com.uber.cadence.BadBinaries badBinaries(BadBinaries t) { + if (t == null || t == BadBinaries.getDefaultInstance()) { + return null; + } + com.uber.cadence.BadBinaries badBinaries = new com.uber.cadence.BadBinaries(); + badBinaries.setBinaries(badBinaryInfoMapFromProto(t.getBinariesMap())); + return badBinaries; + } + + static com.uber.cadence.BadBinaryInfo badBinaryInfo(BadBinaryInfo t) { + if (t == null || t == BadBinaryInfo.getDefaultInstance()) { + return null; + } + com.uber.cadence.BadBinaryInfo res = new com.uber.cadence.BadBinaryInfo(); + res.setReason(t.getReason()); + res.setOperator(t.getOperator()); + res.setCreatedTimeNano(timeToUnixNano(t.getCreatedTime())); + return res; + } + + static Map badBinaryInfoMapFromProto( + Map t) { + if (t == null) { + return null; + } + Map v = new HashMap<>(); + for (String key : t.keySet()) { + v.put(key, badBinaryInfo(t.get(key))); + } + return v; + } + + static com.uber.cadence.WorkflowQuery workflowQuery(WorkflowQuery t) { + if (t == null || t == WorkflowQuery.getDefaultInstance()) { + return null; + } + com.uber.cadence.WorkflowQuery res = new com.uber.cadence.WorkflowQuery(); + res.setQueryType(t.getQueryType()); + res.setQueryArgs(payload(t.getQueryArgs())); + return res; + } + + static Map payloadMap(Map t) { + if (t == null) { + return null; + } + Map v = new HashMap<>(); + for (String key : t.keySet()) { + v.put(key, payload(t.get(key))); + } + return v; + } + + static List + clusterReplicationConfigurationArrayFromProto(List t) { + if (t == null) { + return null; + } + List v = new ArrayList<>(); + for (int i = 0; i < t.size(); i++) { + v.add(clusterReplicationConfiguration(t.get(i))); + } + return v; + } + + static com.uber.cadence.ClusterReplicationConfiguration clusterReplicationConfiguration( + ClusterReplicationConfiguration t) { + if (t == null || t == ClusterReplicationConfiguration.getDefaultInstance()) { + return null; + } + com.uber.cadence.ClusterReplicationConfiguration res = + new com.uber.cadence.ClusterReplicationConfiguration(); + res.setClusterName(t.getClusterName()); + return res; + } + + static com.uber.cadence.DataBlob dataBlob(DataBlob t) { + if (t == null || t == DataBlob.getDefaultInstance()) { + return null; + } + com.uber.cadence.DataBlob dataBlob = new com.uber.cadence.DataBlob(); + dataBlob.setEncodingType(encodingType(t.getEncodingType())); + dataBlob.setData(byteStringToArray(t.getData())); + return dataBlob; + } + + static long externalInitiatedId(ExternalExecutionInfo t) { + return t.getInitiatedId(); + } + + static com.uber.cadence.WorkflowExecution externalWorkflowExecution(ExternalExecutionInfo t) { + if (t == null || t == ExternalExecutionInfo.getDefaultInstance()) { + return null; + } + return workflowExecution(t.getWorkflowExecution()); + } + + static com.uber.cadence.ResetPoints resetPoints(ResetPoints t) { + if (t == null || t == ResetPoints.getDefaultInstance()) { + return null; + } + com.uber.cadence.ResetPoints res = new com.uber.cadence.ResetPoints(); + res.setPoints(resetPointInfoArray(t.getPointsList())); + return res; + } + + static com.uber.cadence.ResetPointInfo resetPointInfo(ResetPointInfo t) { + if (t == null || t == ResetPointInfo.getDefaultInstance()) { + return null; + } + com.uber.cadence.ResetPointInfo res = new com.uber.cadence.ResetPointInfo(); + res.setBinaryChecksum(t.getBinaryChecksum()); + res.setRunId(t.getRunId()); + res.setFirstDecisionCompletedId(t.getFirstDecisionCompletedId()); + res.setCreatedTimeNano(timeToUnixNano(t.getCreatedTime())); + res.setExpiringTimeNano(timeToUnixNano(t.getExpiringTime())); + res.setResettable(t.getResettable()); + return res; + } + + static com.uber.cadence.PollerInfo pollerInfo(PollerInfo t) { + if (t == null || t == PollerInfo.getDefaultInstance()) { + return null; + } + com.uber.cadence.PollerInfo res = new com.uber.cadence.PollerInfo(); + res.setLastAccessTime(timeToUnixNano(t.getLastAccessTime())); + res.setIdentity(t.getIdentity()); + res.setRatePerSecond(t.getRatePerSecond()); + return res; + } + + static com.uber.cadence.TaskListStatus taskListStatus(TaskListStatus t) { + if (t == null || t == TaskListStatus.getDefaultInstance()) { + return null; + } + com.uber.cadence.TaskListStatus res = new com.uber.cadence.TaskListStatus(); + res.setBacklogCountHint(t.getBacklogCountHint()); + res.setReadLevel(t.getReadLevel()); + res.setAckLevel(t.getAckLevel()); + res.setRatePerSecond(t.getRatePerSecond()); + res.setTaskIDBlock(taskIdBlock(t.getTaskIdBlock())); + return res; + } + + static com.uber.cadence.TaskIDBlock taskIdBlock(TaskIDBlock t) { + if (t == null || t == TaskIDBlock.getDefaultInstance()) { + return null; + } + com.uber.cadence.TaskIDBlock res = new com.uber.cadence.TaskIDBlock(); + res.setStartID(t.getStartId()); + res.setEndID(t.getEndId()); + return res; + } + + static com.uber.cadence.WorkflowExecutionConfiguration workflowExecutionConfiguration( + WorkflowExecutionConfiguration t) { + if (t == null || t == WorkflowExecutionConfiguration.getDefaultInstance()) { + return null; + } + com.uber.cadence.WorkflowExecutionConfiguration res = + new com.uber.cadence.WorkflowExecutionConfiguration(); + res.setTaskList(taskList(t.getTaskList())); + res.setExecutionStartToCloseTimeoutSeconds( + durationToSeconds(t.getExecutionStartToCloseTimeout())); + res.setTaskStartToCloseTimeoutSeconds(durationToSeconds(t.getTaskStartToCloseTimeout())); + return res; + } + + static com.uber.cadence.WorkflowExecutionInfo workflowExecutionInfo(WorkflowExecutionInfo t) { + if (t == null || t == WorkflowExecutionInfo.getDefaultInstance()) { + return null; + } + com.uber.cadence.WorkflowExecutionInfo res = new com.uber.cadence.WorkflowExecutionInfo(); + res.setExecution(workflowExecution(t.getWorkflowExecution())); + res.setType(workflowType(t.getType())); + res.setStartTime(timeToUnixNano(t.getStartTime())); + res.setCloseTime(timeToUnixNano(t.getCloseTime())); + res.setCloseStatus(workflowExecutionCloseStatus(t.getCloseStatus())); + res.setHistoryLength(t.getHistoryLength()); + res.setParentDomainName(parentDomainName(t.getParentExecutionInfo())); + res.setParentDomainId(parentDomainId(t.getParentExecutionInfo())); + res.setParentExecution(parentWorkflowExecution(t.getParentExecutionInfo())); + res.setExecutionTime(timeToUnixNano(t.getExecutionTime())); + res.setMemo(memo(t.getMemo())); + res.setSearchAttributes(searchAttributes(t.getSearchAttributes())); + res.setAutoResetPoints(resetPoints(t.getAutoResetPoints())); + res.setTaskList(t.getTaskList()); + res.setCron(t.getIsCron()); + return res; + } + + static String parentDomainId(ParentExecutionInfo t) { + if (t == null || t == ParentExecutionInfo.getDefaultInstance()) { + return null; + } + return t.getDomainId(); + } + + static String parentDomainName(ParentExecutionInfo t) { + if (t == null || t == ParentExecutionInfo.getDefaultInstance()) { + return null; + } + return t.getDomainName(); + } + + static long parentInitiatedId(ParentExecutionInfo t) { + if (t == null || t == ParentExecutionInfo.getDefaultInstance()) { + return -1; + } + return t.getInitiatedId(); + } + + static com.uber.cadence.WorkflowExecution parentWorkflowExecution(ParentExecutionInfo t) { + if (t == null || t == ParentExecutionInfo.getDefaultInstance()) { + return null; + } + return workflowExecution(t.getWorkflowExecution()); + } + + static com.uber.cadence.PendingActivityInfo pendingActivityInfo(PendingActivityInfo t) { + if (t == null || t == PendingActivityInfo.getDefaultInstance()) { + return null; + } + com.uber.cadence.PendingActivityInfo res = new com.uber.cadence.PendingActivityInfo(); + res.setActivityID(t.getActivityId()); + res.setActivityType(activityType(t.getActivityType())); + res.setState(pendingActivityState(t.getState())); + res.setHeartbeatDetails(payload(t.getHeartbeatDetails())); + res.setLastHeartbeatTimestamp(timeToUnixNano(t.getLastHeartbeatTime())); + res.setLastStartedTimestamp(timeToUnixNano(t.getLastStartedTime())); + res.setAttempt(t.getAttempt()); + res.setMaximumAttempts(t.getMaximumAttempts()); + res.setScheduledTimestamp(timeToUnixNano(t.getScheduledTime())); + res.setExpirationTimestamp(timeToUnixNano(t.getExpirationTime())); + res.setLastFailureReason(failureReason(t.getLastFailure())); + res.setLastFailureDetails(failureDetails(t.getLastFailure())); + res.setLastWorkerIdentity(t.getLastWorkerIdentity()); + return res; + } + + static com.uber.cadence.PendingChildExecutionInfo pendingChildExecutionInfo( + PendingChildExecutionInfo t) { + if (t == null || t == PendingChildExecutionInfo.getDefaultInstance()) { + return null; + } + com.uber.cadence.PendingChildExecutionInfo res = + new com.uber.cadence.PendingChildExecutionInfo(); + res.setWorkflowID(workflowId(t.getWorkflowExecution())); + res.setRunID(runId(t.getWorkflowExecution())); + res.setWorkflowTypName(t.getWorkflowTypeName()); + res.setInitiatedID(t.getInitiatedId()); + res.setParentClosePolicy(parentClosePolicy(t.getParentClosePolicy())); + return res; + } + + static com.uber.cadence.PendingDecisionInfo pendingDecisionInfo(PendingDecisionInfo t) { + if (t == null || t == PendingDecisionInfo.getDefaultInstance()) { + return null; + } + com.uber.cadence.PendingDecisionInfo res = new com.uber.cadence.PendingDecisionInfo(); + res.setState(pendingDecisionState(t.getState())); + res.setScheduledTimestamp(timeToUnixNano(t.getScheduledTime())); + res.setStartedTimestamp(timeToUnixNano(t.getStartedTime())); + res.setAttempt(t.getAttempt()); + res.setOriginalScheduledTimestamp(timeToUnixNano(t.getOriginalScheduledTime())); + return res; + } + + static com.uber.cadence.ActivityLocalDispatchInfo activityLocalDispatchInfo( + ActivityLocalDispatchInfo t) { + if (t == null || t == ActivityLocalDispatchInfo.getDefaultInstance()) { + return null; + } + com.uber.cadence.ActivityLocalDispatchInfo res = + new com.uber.cadence.ActivityLocalDispatchInfo(); + res.setActivityId(t.getActivityId()); + res.setScheduledTimestamp(timeToUnixNano(t.getScheduledTime())); + res.setStartedTimestamp(timeToUnixNano(t.getStartedTime())); + res.setScheduledTimestampOfThisAttempt(timeToUnixNano(t.getScheduledTimeOfThisAttempt())); + res.setTaskToken(byteStringToArray(t.getTaskToken())); + return res; + } + + static com.uber.cadence.SupportedClientVersions supportedClientVersions( + SupportedClientVersions t) { + if (t == null || t == SupportedClientVersions.getDefaultInstance()) { + return null; + } + com.uber.cadence.SupportedClientVersions res = new com.uber.cadence.SupportedClientVersions(); + res.setGoSdk(t.getGoSdk()); + res.setJavaSdk(t.getJavaSdk()); + return res; + } + + static com.uber.cadence.DescribeDomainResponse describeDomainResponseDomain(Domain t) { + if (t == null || t == Domain.getDefaultInstance()) { + return null; + } + com.uber.cadence.DescribeDomainResponse res = new com.uber.cadence.DescribeDomainResponse(); + com.uber.cadence.DomainInfo domainInfo = new com.uber.cadence.DomainInfo(); + res.setDomainInfo(domainInfo); + + domainInfo.setName(t.getName()); + domainInfo.setStatus(domainStatus(t.getStatus())); + domainInfo.setDescription(t.getDescription()); + domainInfo.setOwnerEmail(t.getOwnerEmail()); + domainInfo.setData(t.getDataMap()); + domainInfo.setUuid(t.getId()); + + com.uber.cadence.DomainConfiguration domainConfiguration = + new com.uber.cadence.DomainConfiguration(); + res.setConfiguration(domainConfiguration); + + domainConfiguration.setWorkflowExecutionRetentionPeriodInDays( + durationToDays(t.getWorkflowExecutionRetentionPeriod())); + domainConfiguration.setEmitMetric(true); + domainConfiguration.setBadBinaries(badBinaries(t.getBadBinaries())); + domainConfiguration.setHistoryArchivalStatus(archivalStatus(t.getHistoryArchivalStatus())); + domainConfiguration.setHistoryArchivalURI(t.getHistoryArchivalUri()); + domainConfiguration.setVisibilityArchivalStatus( + archivalStatus(t.getVisibilityArchivalStatus())); + domainConfiguration.setVisibilityArchivalURI(t.getVisibilityArchivalUri()); + + com.uber.cadence.DomainReplicationConfiguration domainReplicationConfiguration = + new com.uber.cadence.DomainReplicationConfiguration(); + res.setReplicationConfiguration(domainReplicationConfiguration); + + domainReplicationConfiguration.setActiveClusterName(t.getActiveClusterName()); + domainReplicationConfiguration.setClusters( + clusterReplicationConfigurationArrayFromProto(t.getClustersList())); + res.setFailoverVersion(t.getFailoverVersion()); + res.setGlobalDomain(t.getIsGlobalDomain()); + + return res; + } + + static com.uber.cadence.TaskListMetadata taskListMetadata(TaskListMetadata t) { + if (t == null) { + return null; + } + com.uber.cadence.TaskListMetadata res = new com.uber.cadence.TaskListMetadata(); + res.setMaxTasksPerSecond(t.getMaxTasksPerSecond().getValue()); + return res; + } + + static com.uber.cadence.TaskListPartitionMetadata taskListPartitionMetadata( + TaskListPartitionMetadata t) { + if (t == null || t == TaskListPartitionMetadata.getDefaultInstance()) { + return null; + } + com.uber.cadence.TaskListPartitionMetadata res = + new com.uber.cadence.TaskListPartitionMetadata(); + res.setKey(t.getKey()); + res.setOwnerHostName(t.getOwnerHostName()); + return res; + } + + static com.uber.cadence.QueryRejected queryRejected(QueryRejected t) { + if (t == null || t == QueryRejected.getDefaultInstance()) { + return null; + } + com.uber.cadence.QueryRejected res = new com.uber.cadence.QueryRejected(); + res.setCloseStatus(workflowExecutionCloseStatus(t.getCloseStatus())); + return res; + } + + static List pollerInfoArray(List t) { + if (t == null) { + return null; + } + List v = new ArrayList<>(); + for (PollerInfo pollerInfo : t) { + v.add(pollerInfo(pollerInfo)); + } + return v; + } + + static List resetPointInfoArray(List t) { + if (t == null) { + return null; + } + List v = new ArrayList<>(); + for (ResetPointInfo resetPointInfo : t) { + v.add(resetPointInfo(resetPointInfo)); + } + return v; + } + + static List pendingActivityInfoArray( + List t) { + if (t == null) { + return null; + } + List v = new ArrayList<>(); + for (PendingActivityInfo pendingActivityInfo : t) { + v.add(pendingActivityInfo(pendingActivityInfo)); + } + return v; + } + + static List pendingChildExecutionInfoArray( + List t) { + if (t == null) { + return null; + } + List v = new ArrayList<>(); + for (PendingChildExecutionInfo pendingChildExecutionInfo : t) { + v.add(pendingChildExecutionInfo(pendingChildExecutionInfo)); + } + return v; + } + + static Map indexedValueTypeMap( + Map t) { + if (t == null) { + return null; + } + Map v = new HashMap<>(); + for (String key : t.keySet()) { + v.put(key, indexedValueType(t.get(key))); + } + return v; + } + + static List dataBlobArray(List t) { + if (t == null || t.size() == 0) { + return null; + } + List v = new ArrayList<>(); + for (DataBlob dataBlob : t) { + v.add(dataBlob(dataBlob)); + } + return v; + } + + static List workflowExecutionInfoArray( + List t) { + if (t == null) { + return null; + } + List v = new ArrayList<>(); + for (WorkflowExecutionInfo workflowExecutionInfo : t) { + v.add(workflowExecutionInfo(workflowExecutionInfo)); + } + return v; + } + + static List describeDomainResponseArray(List t) { + if (t == null) { + return null; + } + List v = new ArrayList<>(); + for (Domain domain : t) { + v.add(describeDomainResponseDomain(domain)); + } + return v; + } + + static List taskListPartitionMetadataArray( + List t) { + if (t == null) { + return null; + } + List v = new ArrayList<>(); + for (TaskListPartitionMetadata taskListPartitionMetadata : t) { + v.add(taskListPartitionMetadata(taskListPartitionMetadata)); + } + return v; + } + + static Map workflowQueryMap( + Map t) { + if (t == null) { + return null; + } + Map v = new HashMap<>(); + for (String key : t.keySet()) { + v.put(key, workflowQuery(t.get(key))); + } + return v; + } + + static Map activityLocalDispatchInfoMap( + Map t) { + if (t == null) { + return null; + } + Map v = new HashMap<>(); + for (String key : t.keySet()) { + v.put(key, activityLocalDispatchInfo(t.get(key))); + } + return v; + } +} diff --git a/src/main/java/com/uber/cadence/internal/compatibility/thrift/EnumMapper.java b/src/main/java/com/uber/cadence/internal/compatibility/thrift/EnumMapper.java deleted file mode 100644 index 5feb79ed0..000000000 --- a/src/main/java/com/uber/cadence/internal/compatibility/thrift/EnumMapper.java +++ /dev/null @@ -1,346 +0,0 @@ -/* - * Modifications Copyright (c) 2017-2021 Uber Technologies Inc. - * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * 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.compatibility.thrift; - -import static com.uber.cadence.api.v1.QueryRejectCondition.QUERY_REJECT_CONDITION_INVALID; - -import com.uber.cadence.ArchivalStatus; -import com.uber.cadence.CancelExternalWorkflowExecutionFailedCause; -import com.uber.cadence.ChildWorkflowExecutionFailedCause; -import com.uber.cadence.ContinueAsNewInitiator; -import com.uber.cadence.DecisionTaskFailedCause; -import com.uber.cadence.DecisionTaskTimedOutCause; -import com.uber.cadence.DomainStatus; -import com.uber.cadence.EncodingType; -import com.uber.cadence.IndexedValueType; -import com.uber.cadence.ParentClosePolicy; -import com.uber.cadence.PendingActivityState; -import com.uber.cadence.PendingDecisionState; -import com.uber.cadence.QueryRejectCondition; -import com.uber.cadence.SignalExternalWorkflowExecutionFailedCause; -import com.uber.cadence.TaskListKind; -import com.uber.cadence.TimeoutType; -import com.uber.cadence.WorkflowExecutionCloseStatus; -import com.uber.cadence.WorkflowIdReusePolicy; - -public final class EnumMapper { - - private EnumMapper() {} - - public static TaskListKind taskListKind(com.uber.cadence.api.v1.TaskListKind t) { - switch (t) { - case TASK_LIST_KIND_INVALID: - return null; - case TASK_LIST_KIND_NORMAL: - return TaskListKind.NORMAL; - case TASK_LIST_KIND_STICKY: - return TaskListKind.STICKY; - } - throw new IllegalArgumentException("unexpected enum value"); - } - - public static QueryRejectCondition queryRejectCondition( - com.uber.cadence.api.v1.QueryRejectCondition t) { - if (t == QUERY_REJECT_CONDITION_INVALID) { - return null; - } - switch (t) { - case QUERY_REJECT_CONDITION_NOT_OPEN: - return QueryRejectCondition.NOT_OPEN; - case QUERY_REJECT_CONDITION_NOT_COMPLETED_CLEANLY: - return QueryRejectCondition.NOT_COMPLETED_CLEANLY; - } - throw new IllegalArgumentException("unexpected enum value"); - } - - public static ContinueAsNewInitiator continueAsNewInitiator( - com.uber.cadence.api.v1.ContinueAsNewInitiator t) { - switch (t) { - case CONTINUE_AS_NEW_INITIATOR_INVALID: - return null; - case CONTINUE_AS_NEW_INITIATOR_DECIDER: - return ContinueAsNewInitiator.Decider; - case CONTINUE_AS_NEW_INITIATOR_RETRY_POLICY: - return ContinueAsNewInitiator.RetryPolicy; - case CONTINUE_AS_NEW_INITIATOR_CRON_SCHEDULE: - return ContinueAsNewInitiator.CronSchedule; - } - throw new IllegalArgumentException("unexpected enum value"); - } - - public static WorkflowIdReusePolicy workflowIdReusePolicy( - com.uber.cadence.api.v1.WorkflowIdReusePolicy t) { - switch (t) { - case WORKFLOW_ID_REUSE_POLICY_INVALID: - return null; - case WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY: - return WorkflowIdReusePolicy.AllowDuplicateFailedOnly; - case WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE: - return WorkflowIdReusePolicy.AllowDuplicate; - case WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE: - return WorkflowIdReusePolicy.RejectDuplicate; - case WORKFLOW_ID_REUSE_POLICY_TERMINATE_IF_RUNNING: - return WorkflowIdReusePolicy.TerminateIfRunning; - } - throw new IllegalArgumentException("unexpected enum value"); - } - - public static ArchivalStatus archivalStatus(com.uber.cadence.api.v1.ArchivalStatus t) { - switch (t) { - case ARCHIVAL_STATUS_INVALID: - return null; - case ARCHIVAL_STATUS_DISABLED: - return ArchivalStatus.DISABLED; - case ARCHIVAL_STATUS_ENABLED: - return ArchivalStatus.ENABLED; - } - throw new IllegalArgumentException("unexpected enum value"); - } - - public static ParentClosePolicy parentClosePolicy(com.uber.cadence.api.v1.ParentClosePolicy t) { - switch (t) { - case PARENT_CLOSE_POLICY_INVALID: - return null; - case PARENT_CLOSE_POLICY_ABANDON: - return ParentClosePolicy.ABANDON; - case PARENT_CLOSE_POLICY_REQUEST_CANCEL: - return ParentClosePolicy.REQUEST_CANCEL; - case PARENT_CLOSE_POLICY_TERMINATE: - return ParentClosePolicy.TERMINATE; - } - throw new IllegalArgumentException("unexpected enum value"); - } - - public static DecisionTaskFailedCause decisionTaskFailedCause( - com.uber.cadence.api.v1.DecisionTaskFailedCause t) { - switch (t) { - case DECISION_TASK_FAILED_CAUSE_INVALID: - return null; - case DECISION_TASK_FAILED_CAUSE_UNHANDLED_DECISION: - return DecisionTaskFailedCause.UNHANDLED_DECISION; - case DECISION_TASK_FAILED_CAUSE_BAD_SCHEDULE_ACTIVITY_ATTRIBUTES: - return DecisionTaskFailedCause.BAD_SCHEDULE_ACTIVITY_ATTRIBUTES; - case DECISION_TASK_FAILED_CAUSE_BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES: - return DecisionTaskFailedCause.BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES; - case DECISION_TASK_FAILED_CAUSE_BAD_START_TIMER_ATTRIBUTES: - return DecisionTaskFailedCause.BAD_START_TIMER_ATTRIBUTES; - case DECISION_TASK_FAILED_CAUSE_BAD_CANCEL_TIMER_ATTRIBUTES: - return DecisionTaskFailedCause.BAD_CANCEL_TIMER_ATTRIBUTES; - case DECISION_TASK_FAILED_CAUSE_BAD_RECORD_MARKER_ATTRIBUTES: - return DecisionTaskFailedCause.BAD_RECORD_MARKER_ATTRIBUTES; - case DECISION_TASK_FAILED_CAUSE_BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES: - return DecisionTaskFailedCause.BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES; - case DECISION_TASK_FAILED_CAUSE_BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES: - return DecisionTaskFailedCause.BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES; - case DECISION_TASK_FAILED_CAUSE_BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES: - return DecisionTaskFailedCause.BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES; - case DECISION_TASK_FAILED_CAUSE_BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES: - return DecisionTaskFailedCause.BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES; - case DECISION_TASK_FAILED_CAUSE_BAD_CONTINUE_AS_NEW_ATTRIBUTES: - return DecisionTaskFailedCause.BAD_CONTINUE_AS_NEW_ATTRIBUTES; - case DECISION_TASK_FAILED_CAUSE_START_TIMER_DUPLICATE_ID: - return DecisionTaskFailedCause.START_TIMER_DUPLICATE_ID; - case DECISION_TASK_FAILED_CAUSE_RESET_STICKY_TASK_LIST: - return DecisionTaskFailedCause.RESET_STICKY_TASKLIST; - case DECISION_TASK_FAILED_CAUSE_WORKFLOW_WORKER_UNHANDLED_FAILURE: - return DecisionTaskFailedCause.WORKFLOW_WORKER_UNHANDLED_FAILURE; - case DECISION_TASK_FAILED_CAUSE_BAD_SIGNAL_WORKFLOW_EXECUTION_ATTRIBUTES: - return DecisionTaskFailedCause.BAD_SIGNAL_WORKFLOW_EXECUTION_ATTRIBUTES; - case DECISION_TASK_FAILED_CAUSE_BAD_START_CHILD_EXECUTION_ATTRIBUTES: - return DecisionTaskFailedCause.BAD_START_CHILD_EXECUTION_ATTRIBUTES; - case DECISION_TASK_FAILED_CAUSE_FORCE_CLOSE_DECISION: - return DecisionTaskFailedCause.FORCE_CLOSE_DECISION; - case DECISION_TASK_FAILED_CAUSE_FAILOVER_CLOSE_DECISION: - return DecisionTaskFailedCause.FAILOVER_CLOSE_DECISION; - case DECISION_TASK_FAILED_CAUSE_BAD_SIGNAL_INPUT_SIZE: - return DecisionTaskFailedCause.BAD_SIGNAL_INPUT_SIZE; - case DECISION_TASK_FAILED_CAUSE_RESET_WORKFLOW: - return DecisionTaskFailedCause.RESET_WORKFLOW; - case DECISION_TASK_FAILED_CAUSE_BAD_BINARY: - return DecisionTaskFailedCause.BAD_BINARY; - case DECISION_TASK_FAILED_CAUSE_SCHEDULE_ACTIVITY_DUPLICATE_ID: - return DecisionTaskFailedCause.SCHEDULE_ACTIVITY_DUPLICATE_ID; - case DECISION_TASK_FAILED_CAUSE_BAD_SEARCH_ATTRIBUTES: - return DecisionTaskFailedCause.BAD_SEARCH_ATTRIBUTES; - } - throw new IllegalArgumentException("unexpected enum value"); - } - - public static WorkflowExecutionCloseStatus workflowExecutionCloseStatus( - com.uber.cadence.api.v1.WorkflowExecutionCloseStatus t) { - switch (t) { - case WORKFLOW_EXECUTION_CLOSE_STATUS_INVALID: - return null; - case WORKFLOW_EXECUTION_CLOSE_STATUS_COMPLETED: - return WorkflowExecutionCloseStatus.COMPLETED; - case WORKFLOW_EXECUTION_CLOSE_STATUS_FAILED: - return WorkflowExecutionCloseStatus.FAILED; - case WORKFLOW_EXECUTION_CLOSE_STATUS_CANCELED: - return WorkflowExecutionCloseStatus.CANCELED; - case WORKFLOW_EXECUTION_CLOSE_STATUS_TERMINATED: - return WorkflowExecutionCloseStatus.TERMINATED; - case WORKFLOW_EXECUTION_CLOSE_STATUS_CONTINUED_AS_NEW: - return WorkflowExecutionCloseStatus.CONTINUED_AS_NEW; - case WORKFLOW_EXECUTION_CLOSE_STATUS_TIMED_OUT: - return WorkflowExecutionCloseStatus.TIMED_OUT; - } - throw new IllegalArgumentException("unexpected enum value"); - } - - public static DomainStatus domainStatus(com.uber.cadence.api.v1.DomainStatus t) { - switch (t) { - case DOMAIN_STATUS_INVALID: - return null; - case DOMAIN_STATUS_REGISTERED: - return DomainStatus.REGISTERED; - case DOMAIN_STATUS_DEPRECATED: - return DomainStatus.DEPRECATED; - case DOMAIN_STATUS_DELETED: - return DomainStatus.DELETED; - } - throw new IllegalArgumentException("unexpected enum value"); - } - - public static PendingActivityState pendingActivityState( - com.uber.cadence.api.v1.PendingActivityState t) { - switch (t) { - case PENDING_ACTIVITY_STATE_INVALID: - return null; - case PENDING_ACTIVITY_STATE_SCHEDULED: - return PendingActivityState.SCHEDULED; - case PENDING_ACTIVITY_STATE_STARTED: - return PendingActivityState.STARTED; - case PENDING_ACTIVITY_STATE_CANCEL_REQUESTED: - return PendingActivityState.CANCEL_REQUESTED; - } - throw new IllegalArgumentException("unexpected enum value"); - } - - public static PendingDecisionState pendingDecisionState( - com.uber.cadence.api.v1.PendingDecisionState t) { - switch (t) { - case PENDING_DECISION_STATE_INVALID: - return null; - case PENDING_DECISION_STATE_SCHEDULED: - return PendingDecisionState.SCHEDULED; - case PENDING_DECISION_STATE_STARTED: - return PendingDecisionState.STARTED; - } - throw new IllegalArgumentException("unexpected enum value"); - } - - public static IndexedValueType indexedValueType(com.uber.cadence.api.v1.IndexedValueType t) { - switch (t) { - case INDEXED_VALUE_TYPE_INVALID: - throw new IllegalArgumentException("received IndexedValueType_INDEXED_VALUE_TYPE_INVALID"); - case INDEXED_VALUE_TYPE_STRING: - return IndexedValueType.STRING; - case INDEXED_VALUE_TYPE_KEYWORD: - return IndexedValueType.KEYWORD; - case INDEXED_VALUE_TYPE_INT: - return IndexedValueType.INT; - case INDEXED_VALUE_TYPE_DOUBLE: - return IndexedValueType.DOUBLE; - case INDEXED_VALUE_TYPE_BOOL: - return IndexedValueType.BOOL; - case INDEXED_VALUE_TYPE_DATETIME: - return IndexedValueType.DATETIME; - } - throw new IllegalArgumentException("unexpected enum value"); - } - - public static EncodingType encodingType(com.uber.cadence.api.v1.EncodingType t) { - switch (t) { - case ENCODING_TYPE_INVALID: - return null; - case ENCODING_TYPE_THRIFTRW: - return EncodingType.ThriftRW; - case ENCODING_TYPE_JSON: - return EncodingType.JSON; - case ENCODING_TYPE_PROTO3: - throw new UnsupportedOperationException(); - } - throw new IllegalArgumentException("unexpected enum value"); - } - - public static TimeoutType timeoutType(com.uber.cadence.api.v1.TimeoutType t) { - switch (t) { - case TIMEOUT_TYPE_INVALID: - return null; - case TIMEOUT_TYPE_START_TO_CLOSE: - return TimeoutType.START_TO_CLOSE; - case TIMEOUT_TYPE_SCHEDULE_TO_START: - return TimeoutType.SCHEDULE_TO_START; - case TIMEOUT_TYPE_SCHEDULE_TO_CLOSE: - return TimeoutType.SCHEDULE_TO_CLOSE; - case TIMEOUT_TYPE_HEARTBEAT: - return TimeoutType.HEARTBEAT; - } - throw new IllegalArgumentException("unexpected enum value"); - } - - public static DecisionTaskTimedOutCause decisionTaskTimedOutCause( - com.uber.cadence.api.v1.DecisionTaskTimedOutCause t) { - switch (t) { - case DECISION_TASK_TIMED_OUT_CAUSE_INVALID: - return null; - case DECISION_TASK_TIMED_OUT_CAUSE_TIMEOUT: - return DecisionTaskTimedOutCause.TIMEOUT; - case DECISION_TASK_TIMED_OUT_CAUSE_RESET: - return DecisionTaskTimedOutCause.RESET; - } - throw new IllegalArgumentException("unexpected enum value"); - } - - public static CancelExternalWorkflowExecutionFailedCause - cancelExternalWorkflowExecutionFailedCause( - com.uber.cadence.api.v1.CancelExternalWorkflowExecutionFailedCause t) { - switch (t) { - case CANCEL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_INVALID: - return null; - case CANCEL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION: - return CancelExternalWorkflowExecutionFailedCause.UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION; - case CANCEL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_WORKFLOW_ALREADY_COMPLETED: - return CancelExternalWorkflowExecutionFailedCause.WORKFLOW_ALREADY_COMPLETED; - } - throw new IllegalArgumentException("unexpected enum value"); - } - - public static SignalExternalWorkflowExecutionFailedCause - signalExternalWorkflowExecutionFailedCause( - com.uber.cadence.api.v1.SignalExternalWorkflowExecutionFailedCause t) { - switch (t) { - case SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_INVALID: - return null; - case SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION: - return SignalExternalWorkflowExecutionFailedCause.UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION; - case SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_WORKFLOW_ALREADY_COMPLETED: - return SignalExternalWorkflowExecutionFailedCause.WORKFLOW_ALREADY_COMPLETED; - } - throw new IllegalArgumentException("unexpected enum value"); - } - - public static ChildWorkflowExecutionFailedCause childWorkflowExecutionFailedCause( - com.uber.cadence.api.v1.ChildWorkflowExecutionFailedCause t) { - switch (t) { - case CHILD_WORKFLOW_EXECUTION_FAILED_CAUSE_INVALID: - return null; - case CHILD_WORKFLOW_EXECUTION_FAILED_CAUSE_WORKFLOW_ALREADY_RUNNING: - return ChildWorkflowExecutionFailedCause.WORKFLOW_ALREADY_RUNNING; - } - throw new IllegalArgumentException("unexpected enum value"); - } -} diff --git a/src/main/java/com/uber/cadence/internal/compatibility/thrift/ErrorMapper.java b/src/main/java/com/uber/cadence/internal/compatibility/thrift/ErrorMapper.java deleted file mode 100644 index 366c2e6ce..000000000 --- a/src/main/java/com/uber/cadence/internal/compatibility/thrift/ErrorMapper.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Modifications Copyright (c) 2017-2021 Uber Technologies Inc. - * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * 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.compatibility.thrift; - -import com.uber.cadence.AccessDeniedError; -import com.uber.cadence.CancellationAlreadyRequestedError; -import com.uber.cadence.ClientVersionNotSupportedError; -import com.uber.cadence.DomainAlreadyExistsError; -import com.uber.cadence.DomainNotActiveError; -import com.uber.cadence.EntityNotExistsError; -import com.uber.cadence.FeatureNotEnabledError; -import com.uber.cadence.InternalDataInconsistencyError; -import com.uber.cadence.InternalServiceError; -import com.uber.cadence.LimitExceededError; -import com.uber.cadence.ServiceBusyError; -import com.uber.cadence.WorkflowExecutionAlreadyCompletedError; -import com.uber.cadence.WorkflowExecutionAlreadyStartedError; -import io.grpc.Metadata; -import io.grpc.StatusRuntimeException; -import org.apache.thrift.TException; - -public class ErrorMapper { - - public static TException Error(StatusRuntimeException ex) { - String details = getErrorDetails(ex); - switch (ex.getStatus().getCode()) { - case PERMISSION_DENIED: - return new AccessDeniedError(ex.getMessage()); - case INTERNAL: - return new InternalServiceError(ex.getMessage()); - case NOT_FOUND: - { - if ("EntityNotExistsError".equals(details) - && ex.getMessage().contains("already completed.")) { - return new WorkflowExecutionAlreadyCompletedError(ex.getMessage()); - } else { - // TODO add cluster info - return new EntityNotExistsError(ex.getMessage()); - } - } - case ALREADY_EXISTS: - { - switch (details) { - case "CancellationAlreadyRequestedError": - return new CancellationAlreadyRequestedError(ex.getMessage()); - case "DomainAlreadyExistsError": - return new DomainAlreadyExistsError(ex.getMessage()); - case "WorkflowExecutionAlreadyStartedError": - { - // TODO add started wf info - WorkflowExecutionAlreadyStartedError e = new WorkflowExecutionAlreadyStartedError(); - e.setMessage(ex.getMessage()); - return e; - } - } - } - case DATA_LOSS: - return new InternalDataInconsistencyError(ex.getMessage()); - case FAILED_PRECONDITION: - switch (details) { - // TODO add infos - case "ClientVersionNotSupportedError": - return new ClientVersionNotSupportedError(); - case "FeatureNotEnabledError": - return new FeatureNotEnabledError(); - case "DomainNotActiveError": - { - DomainNotActiveError e = new DomainNotActiveError(); - e.setMessage(ex.getMessage()); - return e; - } - } - case RESOURCE_EXHAUSTED: - switch (details) { - case "LimitExceededError": - return new LimitExceededError(ex.getMessage()); - case "ServiceBusyError": - return new ServiceBusyError(ex.getMessage()); - } - case UNKNOWN: - return new TException(ex); - default: - // If error does not match anything, return raw grpc status error - // There are some code that casts error to grpc status to check for deadline exceeded status - return new TException(ex); - } - } - - static String getErrorDetails(StatusRuntimeException ex) { - { - Metadata trailer = ex.getTrailers(); - Metadata.Key key = - Metadata.Key.of("rpc-application-error-name", Metadata.ASCII_STRING_MARSHALLER); - if (trailer != null && trailer.containsKey(key)) { - return trailer.get(key); - } else { - return ""; - } - } - } -} 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 deleted file mode 100644 index b517216bc..000000000 --- a/src/main/java/com/uber/cadence/internal/compatibility/thrift/ResponseMapper.java +++ /dev/null @@ -1,456 +0,0 @@ -/* - * Modifications Copyright (c) 2017-2021 Uber Technologies Inc. - * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * 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.compatibility.thrift; - -import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.archivalStatus; -import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.domainStatus; -import static com.uber.cadence.internal.compatibility.thrift.Helpers.byteStringToArray; -import static com.uber.cadence.internal.compatibility.thrift.Helpers.durationToDays; -import static com.uber.cadence.internal.compatibility.thrift.Helpers.durationToSeconds; -import static com.uber.cadence.internal.compatibility.thrift.Helpers.timeToUnixNano; -import static com.uber.cadence.internal.compatibility.thrift.Helpers.toInt64Value; -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.badBinaries; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.clusterReplicationConfigurationArray; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.dataBlobArray; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.describeDomainResponseArray; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.header; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.indexedValueTypeMap; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.payload; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.pendingActivityInfoArray; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.pendingChildExecutionInfoArray; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.pendingDecisionInfo; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.pollerInfoArray; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.queryRejected; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.supportedClientVersions; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.taskList; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.taskListPartitionMetadataArray; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.taskListStatus; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.workflowExecution; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.workflowExecutionConfiguration; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.workflowExecutionInfo; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.workflowExecutionInfoArray; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.workflowQuery; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.workflowQueryMap; -import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.workflowType; - -import com.uber.cadence.ClusterInfo; -import com.uber.cadence.CountWorkflowExecutionsResponse; -import com.uber.cadence.DescribeDomainResponse; -import com.uber.cadence.DescribeTaskListResponse; -import com.uber.cadence.DescribeWorkflowExecutionResponse; -import com.uber.cadence.DomainConfiguration; -import com.uber.cadence.DomainInfo; -import com.uber.cadence.DomainReplicationConfiguration; -import com.uber.cadence.GetSearchAttributesResponse; -import com.uber.cadence.GetWorkflowExecutionHistoryResponse; -import com.uber.cadence.ListArchivedWorkflowExecutionsResponse; -import com.uber.cadence.ListClosedWorkflowExecutionsResponse; -import com.uber.cadence.ListDomainsResponse; -import com.uber.cadence.ListOpenWorkflowExecutionsResponse; -import com.uber.cadence.ListTaskListPartitionsResponse; -import com.uber.cadence.ListWorkflowExecutionsResponse; -import com.uber.cadence.PollForActivityTaskResponse; -import com.uber.cadence.PollForDecisionTaskResponse; -import com.uber.cadence.QueryWorkflowResponse; -import com.uber.cadence.RecordActivityTaskHeartbeatResponse; -import com.uber.cadence.ResetWorkflowExecutionResponse; -import com.uber.cadence.RespondDecisionTaskCompletedResponse; -import com.uber.cadence.SignalWithStartWorkflowExecutionAsyncResponse; -import com.uber.cadence.StartWorkflowExecutionAsyncResponse; -import com.uber.cadence.StartWorkflowExecutionResponse; -import com.uber.cadence.UpdateDomainResponse; -import com.uber.cadence.api.v1.WorkflowQuery; - -public class ResponseMapper { - - public static StartWorkflowExecutionResponse startWorkflowExecutionResponse( - com.uber.cadence.api.v1.StartWorkflowExecutionResponse t) { - if (t == null) { - return null; - } - StartWorkflowExecutionResponse startWorkflowExecutionResponse = - new StartWorkflowExecutionResponse(); - startWorkflowExecutionResponse.setRunId(t.getRunId()); - return startWorkflowExecutionResponse; - } - - public static StartWorkflowExecutionAsyncResponse startWorkflowExecutionAsyncResponse( - com.uber.cadence.api.v1.StartWorkflowExecutionAsyncResponse t) { - return t == null ? null : new StartWorkflowExecutionAsyncResponse(); - } - - public static DescribeTaskListResponse describeTaskListResponse( - com.uber.cadence.api.v1.DescribeTaskListResponse t) { - if (t == null) { - return null; - } - DescribeTaskListResponse describeTaskListResponse = new DescribeTaskListResponse(); - describeTaskListResponse.setPollers(pollerInfoArray(t.getPollersList())); - describeTaskListResponse.setTaskListStatus(taskListStatus(t.getTaskListStatus())); - return describeTaskListResponse; - } - - public static DescribeWorkflowExecutionResponse describeWorkflowExecutionResponse( - com.uber.cadence.api.v1.DescribeWorkflowExecutionResponse t) { - if (t == null) { - return null; - } - DescribeWorkflowExecutionResponse describeWorkflowExecutionResponse = - new DescribeWorkflowExecutionResponse(); - describeWorkflowExecutionResponse.setExecutionConfiguration( - workflowExecutionConfiguration(t.getExecutionConfiguration())); - describeWorkflowExecutionResponse.setWorkflowExecutionInfo( - workflowExecutionInfo(t.getWorkflowExecutionInfo())); - describeWorkflowExecutionResponse.setPendingActivities( - pendingActivityInfoArray(t.getPendingActivitiesList())); - describeWorkflowExecutionResponse.setPendingChildren( - pendingChildExecutionInfoArray(t.getPendingChildrenList())); - describeWorkflowExecutionResponse.setPendingDecision( - pendingDecisionInfo(t.getPendingDecision())); - return describeWorkflowExecutionResponse; - } - - public static ClusterInfo getClusterInfoResponse( - com.uber.cadence.api.v1.GetClusterInfoResponse t) { - if (t == null) { - return null; - } - ClusterInfo clusterInfo = new ClusterInfo(); - clusterInfo.setSupportedClientVersions(supportedClientVersions(t.getSupportedClientVersions())); - return clusterInfo; - } - - public static GetSearchAttributesResponse getSearchAttributesResponse( - com.uber.cadence.api.v1.GetSearchAttributesResponse t) { - if (t == null) { - return null; - } - GetSearchAttributesResponse getSearchAttributesResponse = new GetSearchAttributesResponse(); - getSearchAttributesResponse.setKeys(indexedValueTypeMap(t.getKeysMap())); - return getSearchAttributesResponse; - } - - public static GetWorkflowExecutionHistoryResponse getWorkflowExecutionHistoryResponse( - com.uber.cadence.api.v1.GetWorkflowExecutionHistoryResponse t) { - if (t == null) { - return null; - } - GetWorkflowExecutionHistoryResponse getWorkflowExecutionHistoryResponse = - new GetWorkflowExecutionHistoryResponse(); - getWorkflowExecutionHistoryResponse.setHistory(history(t.getHistory())); - getWorkflowExecutionHistoryResponse.setRawHistory(dataBlobArray(t.getRawHistoryList())); - getWorkflowExecutionHistoryResponse.setNextPageToken(byteStringToArray(t.getNextPageToken())); - getWorkflowExecutionHistoryResponse.setArchived(t.getArchived()); - return getWorkflowExecutionHistoryResponse; - } - - public static ListArchivedWorkflowExecutionsResponse listArchivedWorkflowExecutionsResponse( - com.uber.cadence.api.v1.ListArchivedWorkflowExecutionsResponse t) { - if (t == null) { - return null; - } - ListArchivedWorkflowExecutionsResponse res = new ListArchivedWorkflowExecutionsResponse(); - res.setExecutions(workflowExecutionInfoArray(t.getExecutionsList())); - res.setNextPageToken(byteStringToArray(t.getNextPageToken())); - return res; - } - - public static ListClosedWorkflowExecutionsResponse listClosedWorkflowExecutionsResponse( - com.uber.cadence.api.v1.ListClosedWorkflowExecutionsResponse t) { - if (t == null) { - return null; - } - ListClosedWorkflowExecutionsResponse res = new ListClosedWorkflowExecutionsResponse(); - res.setExecutions(workflowExecutionInfoArray(t.getExecutionsList())); - res.setNextPageToken(byteStringToArray(t.getNextPageToken())); - return res; - } - - public static ListOpenWorkflowExecutionsResponse listOpenWorkflowExecutionsResponse( - com.uber.cadence.api.v1.ListOpenWorkflowExecutionsResponse t) { - if (t == null) { - return null; - } - ListOpenWorkflowExecutionsResponse res = new ListOpenWorkflowExecutionsResponse(); - res.setExecutions(workflowExecutionInfoArray(t.getExecutionsList())); - res.setNextPageToken(byteStringToArray(t.getNextPageToken())); - return res; - } - - public static ListTaskListPartitionsResponse listTaskListPartitionsResponse( - com.uber.cadence.api.v1.ListTaskListPartitionsResponse t) { - if (t == null) { - return null; - } - ListTaskListPartitionsResponse res = new ListTaskListPartitionsResponse(); - res.setActivityTaskListPartitions( - taskListPartitionMetadataArray(t.getActivityTaskListPartitionsList())); - res.setDecisionTaskListPartitions( - taskListPartitionMetadataArray(t.getDecisionTaskListPartitionsList())); - return res; - } - - public static ListWorkflowExecutionsResponse listWorkflowExecutionsResponse( - com.uber.cadence.api.v1.ListWorkflowExecutionsResponse t) { - if (t == null) { - return null; - } - ListWorkflowExecutionsResponse res = new ListWorkflowExecutionsResponse(); - res.setExecutions(workflowExecutionInfoArray(t.getExecutionsList())); - res.setNextPageToken(byteStringToArray(t.getNextPageToken())); - return res; - } - - public static PollForActivityTaskResponse pollForActivityTaskResponse( - com.uber.cadence.api.v1.PollForActivityTaskResponse t) { - if (t == null) { - return null; - } - PollForActivityTaskResponse res = new PollForActivityTaskResponse(); - res.setTaskToken(byteStringToArray(t.getTaskToken())); - res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution())); - res.setActivityId(t.getActivityId()); - res.setActivityType(activityType(t.getActivityType())); - res.setInput(payload(t.getInput())); - res.setScheduledTimestamp(timeToUnixNano(t.getScheduledTime())); - res.setStartedTimestamp(timeToUnixNano(t.getStartedTime())); - res.setScheduleToCloseTimeoutSeconds(durationToSeconds(t.getScheduleToCloseTimeout())); - res.setStartToCloseTimeoutSeconds(durationToSeconds(t.getStartToCloseTimeout())); - res.setHeartbeatTimeoutSeconds(durationToSeconds(t.getHeartbeatTimeout())); - res.setAttempt(t.getAttempt()); - res.setScheduledTimestampOfThisAttempt(timeToUnixNano(t.getScheduledTimeOfThisAttempt())); - res.setHeartbeatDetails(payload(t.getHeartbeatDetails())); - res.setWorkflowType(workflowType(t.getWorkflowType())); - res.setWorkflowDomain(t.getWorkflowDomain()); - res.setHeader(header(t.getHeader())); - return res; - } - - public static PollForDecisionTaskResponse pollForDecisionTaskResponse( - com.uber.cadence.api.v1.PollForDecisionTaskResponse t) { - if (t == null) { - return null; - } - PollForDecisionTaskResponse res = new PollForDecisionTaskResponse(); - res.setTaskToken(byteStringToArray(t.getTaskToken())); - res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution())); - res.setWorkflowType(workflowType(t.getWorkflowType())); - res.setPreviousStartedEventId(toInt64Value(t.getPreviousStartedEventId())); - res.setStartedEventId(t.getStartedEventId()); - res.setAttempt(t.getAttempt()); - res.setBacklogCountHint(t.getBacklogCountHint()); - res.setHistory(history(t.getHistory())); - res.setNextPageToken(byteStringToArray(t.getNextPageToken())); - if (t.getQuery() != WorkflowQuery.getDefaultInstance()) { - res.setQuery(workflowQuery(t.getQuery())); - } - res.setWorkflowExecutionTaskList(taskList(t.getWorkflowExecutionTaskList())); - res.setScheduledTimestamp(timeToUnixNano(t.getScheduledTime())); - res.setStartedTimestamp(timeToUnixNano(t.getStartedTime())); - res.setQueries(workflowQueryMap(t.getQueriesMap())); - res.setNextEventId(t.getNextEventId()); - return res; - } - - public static QueryWorkflowResponse queryWorkflowResponse( - com.uber.cadence.api.v1.QueryWorkflowResponse t) { - if (t == null) { - return null; - } - QueryWorkflowResponse res = new QueryWorkflowResponse(); - res.setQueryResult(payload(t.getQueryResult())); - res.setQueryRejected(queryRejected(t.getQueryRejected())); - return res; - } - - public static RecordActivityTaskHeartbeatResponse recordActivityTaskHeartbeatByIdResponse( - com.uber.cadence.api.v1.RecordActivityTaskHeartbeatByIDResponse t) { - if (t == null) { - return null; - } - RecordActivityTaskHeartbeatResponse res = new RecordActivityTaskHeartbeatResponse(); - res.setCancelRequested(t.getCancelRequested()); - return res; - } - - public static RecordActivityTaskHeartbeatResponse recordActivityTaskHeartbeatResponse( - com.uber.cadence.api.v1.RecordActivityTaskHeartbeatResponse t) { - if (t == null) { - return null; - } - RecordActivityTaskHeartbeatResponse res = new RecordActivityTaskHeartbeatResponse(); - res.setCancelRequested(t.getCancelRequested()); - return res; - } - - public static ResetWorkflowExecutionResponse resetWorkflowExecutionResponse( - com.uber.cadence.api.v1.ResetWorkflowExecutionResponse t) { - if (t == null) { - return null; - } - ResetWorkflowExecutionResponse res = new ResetWorkflowExecutionResponse(); - res.setRunId(t.getRunId()); - return res; - } - - public static RespondDecisionTaskCompletedResponse respondDecisionTaskCompletedResponse( - com.uber.cadence.api.v1.RespondDecisionTaskCompletedResponse t) { - if (t == null) { - return null; - } - RespondDecisionTaskCompletedResponse res = new RespondDecisionTaskCompletedResponse(); - res.setDecisionTask(pollForDecisionTaskResponse(t.getDecisionTask())); - res.setActivitiesToDispatchLocally( - activityLocalDispatchInfoMap(t.getActivitiesToDispatchLocallyMap())); - return res; - } - - public static ListWorkflowExecutionsResponse scanWorkflowExecutionsResponse( - com.uber.cadence.api.v1.ScanWorkflowExecutionsResponse t) { - if (t == null) { - return null; - } - ListWorkflowExecutionsResponse res = new ListWorkflowExecutionsResponse(); - res.setExecutions(workflowExecutionInfoArray(t.getExecutionsList())); - res.setNextPageToken(byteStringToArray(t.getNextPageToken())); - return res; - } - - public static CountWorkflowExecutionsResponse countWorkflowExecutionsResponse( - com.uber.cadence.api.v1.CountWorkflowExecutionsResponse t) { - if (t == null) { - return null; - } - CountWorkflowExecutionsResponse res = new CountWorkflowExecutionsResponse(); - res.setCount(t.getCount()); - return res; - } - - public static DescribeDomainResponse describeDomainResponse( - com.uber.cadence.api.v1.DescribeDomainResponse t) { - if (t == null) { - return null; - } - DescribeDomainResponse response = new DescribeDomainResponse(); - DomainInfo domainInfo = new DomainInfo(); - response.setDomainInfo(domainInfo); - - domainInfo.setName(t.getDomain().getName()); - domainInfo.setStatus(domainStatus(t.getDomain().getStatus())); - domainInfo.setDescription(t.getDomain().getDescription()); - domainInfo.setOwnerEmail(t.getDomain().getOwnerEmail()); - domainInfo.setData(t.getDomain().getDataMap()); - domainInfo.setUuid(t.getDomain().getId()); - - DomainConfiguration domainConfiguration = new DomainConfiguration(); - response.setConfiguration(domainConfiguration); - - domainConfiguration.setWorkflowExecutionRetentionPeriodInDays( - durationToDays(t.getDomain().getWorkflowExecutionRetentionPeriod())); - domainConfiguration.setEmitMetric(true); - domainConfiguration.setBadBinaries(badBinaries(t.getDomain().getBadBinaries())); - domainConfiguration.setHistoryArchivalStatus( - archivalStatus(t.getDomain().getHistoryArchivalStatus())); - domainConfiguration.setHistoryArchivalURI(t.getDomain().getHistoryArchivalUri()); - domainConfiguration.setVisibilityArchivalStatus( - archivalStatus(t.getDomain().getVisibilityArchivalStatus())); - domainConfiguration.setVisibilityArchivalURI(t.getDomain().getVisibilityArchivalUri()); - - DomainReplicationConfiguration replicationConfiguration = new DomainReplicationConfiguration(); - response.setReplicationConfiguration(replicationConfiguration); - - replicationConfiguration.setActiveClusterName(t.getDomain().getActiveClusterName()); - replicationConfiguration.setClusters( - clusterReplicationConfigurationArray(t.getDomain().getClustersList())); - - response.setFailoverVersion(t.getDomain().getFailoverVersion()); - response.setIsGlobalDomain(t.getDomain().getIsGlobalDomain()); - return response; - } - - public static ListDomainsResponse listDomainsResponse( - com.uber.cadence.api.v1.ListDomainsResponse t) { - if (t == null) { - return null; - } - ListDomainsResponse res = new ListDomainsResponse(); - res.setDomains(describeDomainResponseArray(t.getDomainsList())); - res.setNextPageToken(byteStringToArray(t.getNextPageToken())); - return res; - } - - public static StartWorkflowExecutionResponse signalWithStartWorkflowExecutionResponse( - com.uber.cadence.api.v1.SignalWithStartWorkflowExecutionResponse t) { - if (t == null) { - return null; - } - StartWorkflowExecutionResponse startWorkflowExecutionResponse = - new StartWorkflowExecutionResponse(); - startWorkflowExecutionResponse.setRunId(t.getRunId()); - return startWorkflowExecutionResponse; - } - - public static SignalWithStartWorkflowExecutionAsyncResponse - signalWithStartWorkflowExecutionAsyncResponse( - com.uber.cadence.api.v1.SignalWithStartWorkflowExecutionAsyncResponse t) { - return t == null ? null : new SignalWithStartWorkflowExecutionAsyncResponse(); - } - - public static UpdateDomainResponse updateDomainResponse( - com.uber.cadence.api.v1.UpdateDomainResponse t) { - if (t == null) { - return null; - } - UpdateDomainResponse updateDomainResponse = new UpdateDomainResponse(); - DomainInfo domainInfo = new DomainInfo(); - updateDomainResponse.setDomainInfo(domainInfo); - - domainInfo.setName(t.getDomain().getName()); - domainInfo.setStatus(domainStatus(t.getDomain().getStatus())); - domainInfo.setDescription(t.getDomain().getDescription()); - domainInfo.setOwnerEmail(t.getDomain().getOwnerEmail()); - domainInfo.setData(t.getDomain().getDataMap()); - domainInfo.setUuid(t.getDomain().getId()); - - DomainConfiguration domainConfiguration = new DomainConfiguration(); - updateDomainResponse.setConfiguration(domainConfiguration); - - domainConfiguration.setWorkflowExecutionRetentionPeriodInDays( - durationToDays(t.getDomain().getWorkflowExecutionRetentionPeriod())); - domainConfiguration.setEmitMetric(true); - domainConfiguration.setBadBinaries(badBinaries(t.getDomain().getBadBinaries())); - domainConfiguration.setHistoryArchivalStatus( - archivalStatus(t.getDomain().getHistoryArchivalStatus())); - domainConfiguration.setHistoryArchivalURI(t.getDomain().getHistoryArchivalUri()); - domainConfiguration.setVisibilityArchivalStatus( - archivalStatus(t.getDomain().getVisibilityArchivalStatus())); - domainConfiguration.setVisibilityArchivalURI(t.getDomain().getVisibilityArchivalUri()); - - DomainReplicationConfiguration domainReplicationConfiguration = - new DomainReplicationConfiguration(); - updateDomainResponse.setReplicationConfiguration(domainReplicationConfiguration); - - domainReplicationConfiguration.setActiveClusterName(t.getDomain().getActiveClusterName()); - domainReplicationConfiguration.setClusters( - clusterReplicationConfigurationArray(t.getDomain().getClustersList())); - updateDomainResponse.setFailoverVersion(t.getDomain().getFailoverVersion()); - updateDomainResponse.setIsGlobalDomain(t.getDomain().getIsGlobalDomain()); - return updateDomainResponse; - } -} 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 deleted file mode 100644 index be2d34855..000000000 --- a/src/main/java/com/uber/cadence/internal/compatibility/thrift/TypeMapper.java +++ /dev/null @@ -1,689 +0,0 @@ -/* - * Modifications Copyright (c) 2017-2021 Uber Technologies Inc. - * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * 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.compatibility.thrift; - -import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.archivalStatus; -import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.domainStatus; -import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.encodingType; -import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.indexedValueType; -import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.parentClosePolicy; -import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.pendingActivityState; -import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.pendingDecisionState; -import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.taskListKind; -import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.workflowExecutionCloseStatus; -import static com.uber.cadence.internal.compatibility.thrift.Helpers.byteStringToArray; -import static com.uber.cadence.internal.compatibility.thrift.Helpers.durationToDays; -import static com.uber.cadence.internal.compatibility.thrift.Helpers.durationToSeconds; -import static com.uber.cadence.internal.compatibility.thrift.Helpers.timeToUnixNano; - -import com.uber.cadence.ActivityLocalDispatchInfo; -import com.uber.cadence.ActivityType; -import com.uber.cadence.BadBinaries; -import com.uber.cadence.BadBinaryInfo; -import com.uber.cadence.ClusterReplicationConfiguration; -import com.uber.cadence.DataBlob; -import com.uber.cadence.DescribeDomainResponse; -import com.uber.cadence.DomainConfiguration; -import com.uber.cadence.DomainInfo; -import com.uber.cadence.DomainReplicationConfiguration; -import com.uber.cadence.Header; -import com.uber.cadence.IndexedValueType; -import com.uber.cadence.Memo; -import com.uber.cadence.PendingActivityInfo; -import com.uber.cadence.PendingChildExecutionInfo; -import com.uber.cadence.PendingDecisionInfo; -import com.uber.cadence.PollerInfo; -import com.uber.cadence.QueryRejected; -import com.uber.cadence.ResetPointInfo; -import com.uber.cadence.ResetPoints; -import com.uber.cadence.RetryPolicy; -import com.uber.cadence.SearchAttributes; -import com.uber.cadence.SupportedClientVersions; -import com.uber.cadence.TaskIDBlock; -import com.uber.cadence.TaskList; -import com.uber.cadence.TaskListMetadata; -import com.uber.cadence.TaskListPartitionMetadata; -import com.uber.cadence.TaskListStatus; -import com.uber.cadence.WorkflowExecution; -import com.uber.cadence.WorkflowExecutionConfiguration; -import com.uber.cadence.WorkflowExecutionInfo; -import com.uber.cadence.WorkflowQuery; -import com.uber.cadence.WorkflowType; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -class TypeMapper { - - static byte[] payload(com.uber.cadence.api.v1.Payload t) { - if (t == null || t == com.uber.cadence.api.v1.Payload.getDefaultInstance()) { - return null; - } - if (t.getData() == null || t.getData().size() == 0) { - // protoPayload will not generate this case - // however, Data field will be dropped by the encoding if it's empty - // and receiver side will see null for the Data field - // since we already know p is not null, Data field must be an empty byte array - return new byte[0]; - } - return byteStringToArray(t.getData()); - } - - static String failureReason(com.uber.cadence.api.v1.Failure t) { - if (t == null || t == com.uber.cadence.api.v1.Failure.getDefaultInstance()) { - return null; - } - return t.getReason(); - } - - static byte[] failureDetails(com.uber.cadence.api.v1.Failure t) { - if (t == null || t == com.uber.cadence.api.v1.Failure.getDefaultInstance()) { - return null; - } - return byteStringToArray(t.getDetails()); - } - - static WorkflowExecution workflowExecution(com.uber.cadence.api.v1.WorkflowExecution t) { - if (t == null || t == com.uber.cadence.api.v1.WorkflowExecution.getDefaultInstance()) { - return null; - } - WorkflowExecution we = new WorkflowExecution(); - we.setWorkflowId(t.getWorkflowId()); - we.setRunId(t.getRunId()); - return we; - } - - static String workflowId(com.uber.cadence.api.v1.WorkflowExecution t) { - if (t == null || t == com.uber.cadence.api.v1.WorkflowExecution.getDefaultInstance()) { - return null; - } - return t.getWorkflowId(); - } - - static String runId(com.uber.cadence.api.v1.WorkflowExecution t) { - if (t == null || t == com.uber.cadence.api.v1.WorkflowExecution.getDefaultInstance()) { - return null; - } - return t.getRunId(); - } - - static ActivityType activityType(com.uber.cadence.api.v1.ActivityType t) { - if (t == null || t == com.uber.cadence.api.v1.ActivityType.getDefaultInstance()) { - return null; - } - ActivityType activityType = new ActivityType(); - activityType.setName(t.getName()); - return activityType; - } - - static WorkflowType workflowType(com.uber.cadence.api.v1.WorkflowType t) { - if (t == null || t == com.uber.cadence.api.v1.WorkflowType.getDefaultInstance()) { - return null; - } - WorkflowType wt = new WorkflowType(); - wt.setName(t.getName()); - - return wt; - } - - static TaskList taskList(com.uber.cadence.api.v1.TaskList t) { - if (t == null || t == com.uber.cadence.api.v1.TaskList.getDefaultInstance()) { - return null; - } - TaskList taskList = new TaskList(); - taskList.setName(t.getName()); - taskList.setKind(taskListKind(t.getKind())); - return taskList; - } - - static RetryPolicy retryPolicy(com.uber.cadence.api.v1.RetryPolicy t) { - if (t == null || t == com.uber.cadence.api.v1.RetryPolicy.getDefaultInstance()) { - return null; - } - RetryPolicy res = new RetryPolicy(); - res.setInitialIntervalInSeconds(durationToSeconds(t.getInitialInterval())); - res.setBackoffCoefficient(t.getBackoffCoefficient()); - res.setMaximumIntervalInSeconds(durationToSeconds(t.getMaximumInterval())); - res.setMaximumAttempts(t.getMaximumAttempts()); - res.setNonRetriableErrorReasons(t.getNonRetryableErrorReasonsList()); - res.setExpirationIntervalInSeconds(durationToSeconds(t.getExpirationInterval())); - return res; - } - - static Header header(com.uber.cadence.api.v1.Header t) { - if (t == null || t == com.uber.cadence.api.v1.Header.getDefaultInstance()) { - return null; - } - Header res = new Header(); - res.setFields(payloadMap(t.getFieldsMap())); - return res; - } - - static Memo memo(com.uber.cadence.api.v1.Memo t) { - if (t == null || t == com.uber.cadence.api.v1.Memo.getDefaultInstance()) { - return null; - } - Memo res = new Memo(); - res.setFields(payloadMap(t.getFieldsMap())); - return res; - } - - static SearchAttributes searchAttributes(com.uber.cadence.api.v1.SearchAttributes t) { - if (t == null - || t.getAllFields().size() == 0 - || t == com.uber.cadence.api.v1.SearchAttributes.getDefaultInstance()) { - return null; - } - SearchAttributes res = new SearchAttributes(); - res.setIndexedFields(payloadMap(t.getIndexedFieldsMap())); - return res; - } - - static BadBinaries badBinaries(com.uber.cadence.api.v1.BadBinaries t) { - if (t == null || t == com.uber.cadence.api.v1.BadBinaries.getDefaultInstance()) { - return null; - } - BadBinaries badBinaries = new BadBinaries(); - badBinaries.setBinaries(badBinaryInfoMap(t.getBinariesMap())); - return badBinaries; - } - - static BadBinaryInfo badBinaryInfo(com.uber.cadence.api.v1.BadBinaryInfo t) { - if (t == null || t == com.uber.cadence.api.v1.BadBinaryInfo.getDefaultInstance()) { - return null; - } - BadBinaryInfo res = new BadBinaryInfo(); - res.setReason(t.getReason()); - res.setOperator(t.getOperator()); - res.setCreatedTimeNano(timeToUnixNano(t.getCreatedTime())); - return res; - } - - static Map badBinaryInfoMap( - Map t) { - if (t == null) { - return null; - } - Map v = new HashMap<>(); - for (String key : t.keySet()) { - v.put(key, badBinaryInfo(t.get(key))); - } - return v; - } - - static WorkflowQuery workflowQuery(com.uber.cadence.api.v1.WorkflowQuery t) { - if (t == null || t == com.uber.cadence.api.v1.WorkflowQuery.getDefaultInstance()) { - return null; - } - WorkflowQuery res = new WorkflowQuery(); - res.setQueryType(t.getQueryType()); - res.setQueryArgs(payload(t.getQueryArgs())); - return res; - } - - static Map payloadMap(Map t) { - if (t == null) { - return null; - } - Map v = new HashMap<>(); - for (String key : t.keySet()) { - v.put(key, ByteBuffer.wrap(payload(t.get(key)))); - } - return v; - } - - static List clusterReplicationConfigurationArray( - List t) { - if (t == null) { - return null; - } - List v = new ArrayList<>(); - for (int i = 0; i < t.size(); i++) { - v.add(clusterReplicationConfiguration(t.get(i))); - } - return v; - } - - static ClusterReplicationConfiguration clusterReplicationConfiguration( - com.uber.cadence.api.v1.ClusterReplicationConfiguration t) { - if (t == null - || t == com.uber.cadence.api.v1.ClusterReplicationConfiguration.getDefaultInstance()) { - return null; - } - ClusterReplicationConfiguration res = new ClusterReplicationConfiguration(); - res.setClusterName(t.getClusterName()); - return res; - } - - static DataBlob dataBlob(com.uber.cadence.api.v1.DataBlob t) { - if (t == null || t == com.uber.cadence.api.v1.DataBlob.getDefaultInstance()) { - return null; - } - DataBlob dataBlob = new DataBlob(); - dataBlob.setEncodingType(encodingType(t.getEncodingType())); - dataBlob.setData(byteStringToArray(t.getData())); - return dataBlob; - } - - static long externalInitiatedId(com.uber.cadence.api.v1.ExternalExecutionInfo t) { - return t.getInitiatedId(); - } - - static WorkflowExecution externalWorkflowExecution( - com.uber.cadence.api.v1.ExternalExecutionInfo t) { - if (t == null || t == com.uber.cadence.api.v1.ExternalExecutionInfo.getDefaultInstance()) { - return null; - } - return workflowExecution(t.getWorkflowExecution()); - } - - static ResetPoints resetPoints(com.uber.cadence.api.v1.ResetPoints t) { - if (t == null || t == com.uber.cadence.api.v1.ResetPoints.getDefaultInstance()) { - return null; - } - ResetPoints res = new ResetPoints(); - res.setPoints(resetPointInfoArray(t.getPointsList())); - return res; - } - - static ResetPointInfo resetPointInfo(com.uber.cadence.api.v1.ResetPointInfo t) { - if (t == null || t == com.uber.cadence.api.v1.ResetPointInfo.getDefaultInstance()) { - return null; - } - ResetPointInfo res = new ResetPointInfo(); - res.setBinaryChecksum(t.getBinaryChecksum()); - res.setRunId(t.getRunId()); - res.setFirstDecisionCompletedId(t.getFirstDecisionCompletedId()); - res.setCreatedTimeNano(timeToUnixNano(t.getCreatedTime())); - res.setExpiringTimeNano(timeToUnixNano(t.getExpiringTime())); - res.setResettable(t.getResettable()); - return res; - } - - static PollerInfo pollerInfo(com.uber.cadence.api.v1.PollerInfo t) { - if (t == null || t == com.uber.cadence.api.v1.PollerInfo.getDefaultInstance()) { - return null; - } - PollerInfo res = new PollerInfo(); - res.setLastAccessTime(timeToUnixNano(t.getLastAccessTime())); - res.setIdentity(t.getIdentity()); - res.setRatePerSecond(t.getRatePerSecond()); - return res; - } - - static TaskListStatus taskListStatus(com.uber.cadence.api.v1.TaskListStatus t) { - if (t == null || t == com.uber.cadence.api.v1.TaskListStatus.getDefaultInstance()) { - return null; - } - TaskListStatus res = new TaskListStatus(); - res.setBacklogCountHint(t.getBacklogCountHint()); - res.setReadLevel(t.getReadLevel()); - res.setAckLevel(t.getAckLevel()); - res.setRatePerSecond(t.getRatePerSecond()); - res.setTaskIDBlock(taskIdBlock(t.getTaskIdBlock())); - return res; - } - - static TaskIDBlock taskIdBlock(com.uber.cadence.api.v1.TaskIDBlock t) { - if (t == null || t == com.uber.cadence.api.v1.TaskIDBlock.getDefaultInstance()) { - return null; - } - TaskIDBlock res = new TaskIDBlock(); - res.setStartID(t.getStartId()); - res.setEndID(t.getEndId()); - return res; - } - - static WorkflowExecutionConfiguration workflowExecutionConfiguration( - com.uber.cadence.api.v1.WorkflowExecutionConfiguration t) { - if (t == null - || t == com.uber.cadence.api.v1.WorkflowExecutionConfiguration.getDefaultInstance()) { - return null; - } - WorkflowExecutionConfiguration res = new WorkflowExecutionConfiguration(); - res.setTaskList(taskList(t.getTaskList())); - res.setExecutionStartToCloseTimeoutSeconds( - durationToSeconds(t.getExecutionStartToCloseTimeout())); - res.setTaskStartToCloseTimeoutSeconds(durationToSeconds(t.getTaskStartToCloseTimeout())); - return res; - } - - static WorkflowExecutionInfo workflowExecutionInfo( - com.uber.cadence.api.v1.WorkflowExecutionInfo t) { - if (t == null || t == com.uber.cadence.api.v1.WorkflowExecutionInfo.getDefaultInstance()) { - return null; - } - WorkflowExecutionInfo res = new WorkflowExecutionInfo(); - res.setExecution(workflowExecution(t.getWorkflowExecution())); - res.setType(workflowType(t.getType())); - res.setStartTime(timeToUnixNano(t.getStartTime())); - res.setCloseTime(timeToUnixNano(t.getCloseTime())); - res.setCloseStatus(workflowExecutionCloseStatus(t.getCloseStatus())); - res.setHistoryLength(t.getHistoryLength()); - res.setParentDomainName(parentDomainName(t.getParentExecutionInfo())); - res.setParentDomainId(parentDomainId(t.getParentExecutionInfo())); - res.setParentExecution(parentWorkflowExecution(t.getParentExecutionInfo())); - res.setExecutionTime(timeToUnixNano(t.getExecutionTime())); - res.setMemo(memo(t.getMemo())); - res.setSearchAttributes(searchAttributes(t.getSearchAttributes())); - res.setAutoResetPoints(resetPoints(t.getAutoResetPoints())); - res.setTaskList(t.getTaskList()); - res.setIsCron(t.getIsCron()); - return res; - } - - static String parentDomainId(com.uber.cadence.api.v1.ParentExecutionInfo t) { - if (t == null || t == com.uber.cadence.api.v1.ParentExecutionInfo.getDefaultInstance()) { - return null; - } - return t.getDomainId(); - } - - static String parentDomainName(com.uber.cadence.api.v1.ParentExecutionInfo t) { - if (t == null || t == com.uber.cadence.api.v1.ParentExecutionInfo.getDefaultInstance()) { - return null; - } - return t.getDomainName(); - } - - static long parentInitiatedId(com.uber.cadence.api.v1.ParentExecutionInfo t) { - if (t == null || t == com.uber.cadence.api.v1.ParentExecutionInfo.getDefaultInstance()) { - return -1; - } - return t.getInitiatedId(); - } - - static WorkflowExecution parentWorkflowExecution(com.uber.cadence.api.v1.ParentExecutionInfo t) { - if (t == null || t == com.uber.cadence.api.v1.ParentExecutionInfo.getDefaultInstance()) { - return null; - } - return workflowExecution(t.getWorkflowExecution()); - } - - static PendingActivityInfo pendingActivityInfo(com.uber.cadence.api.v1.PendingActivityInfo t) { - if (t == null || t == com.uber.cadence.api.v1.PendingActivityInfo.getDefaultInstance()) { - return null; - } - PendingActivityInfo res = new PendingActivityInfo(); - res.setActivityID(t.getActivityId()); - res.setActivityType(activityType(t.getActivityType())); - res.setState(pendingActivityState(t.getState())); - res.setHeartbeatDetails(payload(t.getHeartbeatDetails())); - res.setLastHeartbeatTimestamp(timeToUnixNano(t.getLastHeartbeatTime())); - res.setLastStartedTimestamp(timeToUnixNano(t.getLastStartedTime())); - res.setAttempt(t.getAttempt()); - res.setMaximumAttempts(t.getMaximumAttempts()); - res.setScheduledTimestamp(timeToUnixNano(t.getScheduledTime())); - res.setExpirationTimestamp(timeToUnixNano(t.getExpirationTime())); - res.setLastFailureReason(failureReason(t.getLastFailure())); - res.setLastFailureDetails(failureDetails(t.getLastFailure())); - res.setLastWorkerIdentity(t.getLastWorkerIdentity()); - return res; - } - - static PendingChildExecutionInfo pendingChildExecutionInfo( - com.uber.cadence.api.v1.PendingChildExecutionInfo t) { - if (t == null || t == com.uber.cadence.api.v1.PendingChildExecutionInfo.getDefaultInstance()) { - return null; - } - PendingChildExecutionInfo res = new PendingChildExecutionInfo(); - res.setWorkflowID(workflowId(t.getWorkflowExecution())); - res.setRunID(runId(t.getWorkflowExecution())); - res.setWorkflowTypName(t.getWorkflowTypeName()); - res.setInitiatedID(t.getInitiatedId()); - res.setParentClosePolicy(parentClosePolicy(t.getParentClosePolicy())); - return res; - } - - static PendingDecisionInfo pendingDecisionInfo(com.uber.cadence.api.v1.PendingDecisionInfo t) { - if (t == null || t == com.uber.cadence.api.v1.PendingDecisionInfo.getDefaultInstance()) { - return null; - } - PendingDecisionInfo res = new PendingDecisionInfo(); - res.setState(pendingDecisionState(t.getState())); - res.setScheduledTimestamp(timeToUnixNano(t.getScheduledTime())); - res.setStartedTimestamp(timeToUnixNano(t.getStartedTime())); - res.setAttempt(t.getAttempt()); - res.setOriginalScheduledTimestamp(timeToUnixNano(t.getOriginalScheduledTime())); - return res; - } - - static ActivityLocalDispatchInfo activityLocalDispatchInfo( - com.uber.cadence.api.v1.ActivityLocalDispatchInfo t) { - if (t == null || t == com.uber.cadence.api.v1.ActivityLocalDispatchInfo.getDefaultInstance()) { - return null; - } - ActivityLocalDispatchInfo res = new ActivityLocalDispatchInfo(); - res.setActivityId(t.getActivityId()); - res.setScheduledTimestamp(timeToUnixNano(t.getScheduledTime())); - res.setStartedTimestamp(timeToUnixNano(t.getStartedTime())); - res.setScheduledTimestampOfThisAttempt(timeToUnixNano(t.getScheduledTimeOfThisAttempt())); - res.setTaskToken(byteStringToArray(t.getTaskToken())); - return res; - } - - static SupportedClientVersions supportedClientVersions( - com.uber.cadence.api.v1.SupportedClientVersions t) { - if (t == null || t == com.uber.cadence.api.v1.SupportedClientVersions.getDefaultInstance()) { - return null; - } - SupportedClientVersions res = new SupportedClientVersions(); - res.setGoSdk(t.getGoSdk()); - res.setJavaSdk(t.getJavaSdk()); - return res; - } - - static DescribeDomainResponse describeDomainResponseDomain(com.uber.cadence.api.v1.Domain t) { - if (t == null || t == com.uber.cadence.api.v1.Domain.getDefaultInstance()) { - return null; - } - DescribeDomainResponse res = new DescribeDomainResponse(); - DomainInfo domainInfo = new DomainInfo(); - res.setDomainInfo(domainInfo); - - domainInfo.setName(t.getName()); - domainInfo.setStatus(domainStatus(t.getStatus())); - domainInfo.setDescription(t.getDescription()); - domainInfo.setOwnerEmail(t.getOwnerEmail()); - domainInfo.setData(t.getDataMap()); - domainInfo.setUuid(t.getId()); - - DomainConfiguration domainConfiguration = new DomainConfiguration(); - res.setConfiguration(domainConfiguration); - - domainConfiguration.setWorkflowExecutionRetentionPeriodInDays( - durationToDays(t.getWorkflowExecutionRetentionPeriod())); - domainConfiguration.setEmitMetric(true); - domainConfiguration.setBadBinaries(badBinaries(t.getBadBinaries())); - domainConfiguration.setHistoryArchivalStatus(archivalStatus(t.getHistoryArchivalStatus())); - domainConfiguration.setHistoryArchivalURI(t.getHistoryArchivalUri()); - domainConfiguration.setVisibilityArchivalStatus( - archivalStatus(t.getVisibilityArchivalStatus())); - domainConfiguration.setVisibilityArchivalURI(t.getVisibilityArchivalUri()); - - DomainReplicationConfiguration domainReplicationConfiguration = - new DomainReplicationConfiguration(); - res.setReplicationConfiguration(domainReplicationConfiguration); - - domainReplicationConfiguration.setActiveClusterName(t.getActiveClusterName()); - domainReplicationConfiguration.setClusters( - clusterReplicationConfigurationArray(t.getClustersList())); - res.setFailoverVersion(t.getFailoverVersion()); - res.setIsGlobalDomain(t.getIsGlobalDomain()); - - return res; - } - - static TaskListMetadata taskListMetadata(com.uber.cadence.api.v1.TaskListMetadata t) { - if (t == null) { - return null; - } - TaskListMetadata res = new TaskListMetadata(); - res.setMaxTasksPerSecond(t.getMaxTasksPerSecond().getValue()); - return res; - } - - static TaskListPartitionMetadata taskListPartitionMetadata( - com.uber.cadence.api.v1.TaskListPartitionMetadata t) { - if (t == null || t == com.uber.cadence.api.v1.TaskListPartitionMetadata.getDefaultInstance()) { - return null; - } - TaskListPartitionMetadata res = new TaskListPartitionMetadata(); - res.setKey(t.getKey()); - res.setOwnerHostName(t.getOwnerHostName()); - return res; - } - - static QueryRejected queryRejected(com.uber.cadence.api.v1.QueryRejected t) { - if (t == null || t == com.uber.cadence.api.v1.QueryRejected.getDefaultInstance()) { - return null; - } - QueryRejected res = new QueryRejected(); - res.setCloseStatus(workflowExecutionCloseStatus(t.getCloseStatus())); - return res; - } - - static List pollerInfoArray(List t) { - if (t == null) { - return null; - } - List v = new ArrayList<>(); - for (com.uber.cadence.api.v1.PollerInfo pollerInfo : t) { - v.add(pollerInfo(pollerInfo)); - } - return v; - } - - static List resetPointInfoArray(List t) { - if (t == null) { - return null; - } - List v = new ArrayList<>(); - for (com.uber.cadence.api.v1.ResetPointInfo resetPointInfo : t) { - v.add(resetPointInfo(resetPointInfo)); - } - return v; - } - - static List pendingActivityInfoArray( - List t) { - if (t == null) { - return null; - } - List v = new ArrayList<>(); - for (com.uber.cadence.api.v1.PendingActivityInfo pendingActivityInfo : t) { - v.add(pendingActivityInfo(pendingActivityInfo)); - } - return v; - } - - static List pendingChildExecutionInfoArray( - List t) { - if (t == null) { - return null; - } - List v = new ArrayList<>(); - for (com.uber.cadence.api.v1.PendingChildExecutionInfo pendingChildExecutionInfo : t) { - v.add(pendingChildExecutionInfo(pendingChildExecutionInfo)); - } - return v; - } - - static Map indexedValueTypeMap( - Map t) { - if (t == null) { - return null; - } - Map v = new HashMap<>(); - for (String key : t.keySet()) { - v.put(key, indexedValueType(t.get(key))); - } - return v; - } - - static List dataBlobArray(List t) { - if (t == null || t.size() == 0) { - return null; - } - List v = new ArrayList<>(); - for (com.uber.cadence.api.v1.DataBlob dataBlob : t) { - v.add(dataBlob(dataBlob)); - } - return v; - } - - static List workflowExecutionInfoArray( - List t) { - if (t == null) { - return null; - } - List v = new ArrayList<>(); - for (com.uber.cadence.api.v1.WorkflowExecutionInfo workflowExecutionInfo : t) { - v.add(workflowExecutionInfo(workflowExecutionInfo)); - } - return v; - } - - static List describeDomainResponseArray( - List t) { - if (t == null) { - return null; - } - List v = new ArrayList<>(); - for (com.uber.cadence.api.v1.Domain domain : t) { - v.add(describeDomainResponseDomain(domain)); - } - return v; - } - - static List taskListPartitionMetadataArray( - List t) { - if (t == null) { - return null; - } - List v = new ArrayList<>(); - for (com.uber.cadence.api.v1.TaskListPartitionMetadata taskListPartitionMetadata : t) { - v.add(taskListPartitionMetadata(taskListPartitionMetadata)); - } - return v; - } - - static Map workflowQueryMap( - Map t) { - if (t == null) { - return null; - } - Map v = new HashMap<>(); - for (String key : t.keySet()) { - v.put(key, workflowQuery(t.get(key))); - } - return v; - } - - static Map activityLocalDispatchInfoMap( - Map t) { - if (t == null) { - return null; - } - Map v = new HashMap<>(); - for (String key : t.keySet()) { - v.put(key, activityLocalDispatchInfo(t.get(key))); - } - return v; - } -} diff --git a/src/main/java/com/uber/cadence/internal/external/GenericWorkflowClientExternalImpl.java b/src/main/java/com/uber/cadence/internal/external/GenericWorkflowClientExternalImpl.java index ef96cacda..d744c4701 100644 --- a/src/main/java/com/uber/cadence/internal/external/GenericWorkflowClientExternalImpl.java +++ b/src/main/java/com/uber/cadence/internal/external/GenericWorkflowClientExternalImpl.java @@ -18,42 +18,22 @@ package com.uber.cadence.internal.external; import com.google.common.base.Strings; -import com.uber.cadence.Header; -import com.uber.cadence.Memo; -import com.uber.cadence.QueryWorkflowRequest; -import com.uber.cadence.QueryWorkflowResponse; -import com.uber.cadence.RequestCancelWorkflowExecutionRequest; -import com.uber.cadence.RetryPolicy; -import com.uber.cadence.SearchAttributes; -import com.uber.cadence.SignalWithStartWorkflowExecutionAsyncRequest; -import com.uber.cadence.SignalWithStartWorkflowExecutionRequest; -import com.uber.cadence.SignalWorkflowExecutionRequest; -import com.uber.cadence.StartWorkflowExecutionAsyncRequest; -import com.uber.cadence.StartWorkflowExecutionAsyncResponse; -import com.uber.cadence.StartWorkflowExecutionRequest; -import com.uber.cadence.StartWorkflowExecutionResponse; -import com.uber.cadence.TaskList; -import com.uber.cadence.TerminateWorkflowExecutionRequest; -import com.uber.cadence.WorkflowExecution; -import com.uber.cadence.WorkflowExecutionAlreadyStartedError; -import com.uber.cadence.WorkflowQuery; +import com.uber.cadence.*; import com.uber.cadence.common.RetryOptions; import com.uber.cadence.internal.common.*; import com.uber.cadence.internal.metrics.MetricsTag; import com.uber.cadence.internal.metrics.MetricsType; import com.uber.cadence.internal.replay.QueryWorkflowParameters; import com.uber.cadence.internal.replay.SignalExternalWorkflowParameters; +import com.uber.cadence.serviceclient.AsyncMethodCallback; import com.uber.cadence.serviceclient.IWorkflowService; import com.uber.m3.tally.Scope; import com.uber.m3.util.ImmutableMap; -import java.nio.ByteBuffer; import java.time.Duration; import java.util.HashMap; import java.util.Map; import java.util.UUID; import java.util.concurrent.CompletableFuture; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; public final class GenericWorkflowClientExternalImpl implements GenericWorkflowClientExternal { @@ -126,7 +106,7 @@ private WorkflowExecution startWorkflowInternal(StartWorkflowExecutionParameters RpcRetryer.DEFAULT_RPC_RETRY_OPTIONS, () -> service.StartWorkflowExecution(request)); } catch (WorkflowExecutionAlreadyStartedError e) { throw e; - } catch (TException e) { + } catch (BaseError e) { throw CheckedExceptionWrapper.wrap(e); } WorkflowExecution execution = new WorkflowExecution(); @@ -172,7 +152,7 @@ public void onError(Exception exception) { } }, timeoutInMillis); - } catch (TException e) { + } catch (BaseError e) { result.completeExceptionally(e); } return result; @@ -205,7 +185,7 @@ private void enqueueWorkflowInternal(StartWorkflowExecutionParameters startParam RpcRetryer.DEFAULT_RPC_RETRY_OPTIONS, () -> service.StartWorkflowExecutionAsync(request)); } catch (WorkflowExecutionAlreadyStartedError e) { throw e; - } catch (TException e) { + } catch (BaseError e) { throw CheckedExceptionWrapper.wrap(e); } } @@ -235,7 +215,7 @@ public void onError(Exception exception) { } }, timeoutInMillis); - } catch (TException e) { + } catch (BaseError e) { result.completeExceptionally(e); } return result; @@ -290,9 +270,9 @@ private Memo toMemoThrift(Map memo) { return null; } - Map fields = new HashMap<>(); + Map fields = new HashMap<>(); for (Map.Entry item : memo.entrySet()) { - fields.put(item.getKey(), ByteBuffer.wrap(item.getValue())); + fields.put(item.getKey(), item.getValue()); } Memo memoThrift = new Memo(); memoThrift.setFields(fields); @@ -304,9 +284,9 @@ private SearchAttributes toSearchAttributesThrift(Map searchAttr return null; } - Map fields = new HashMap<>(); + Map fields = new HashMap<>(); for (Map.Entry item : searchAttributes.entrySet()) { - fields.put(item.getKey(), ByteBuffer.wrap(item.getValue())); + fields.put(item.getKey(), item.getValue()); } SearchAttributes searchAttrThrift = new SearchAttributes(); searchAttrThrift.setIndexedFields(fields); @@ -317,9 +297,9 @@ private Header toHeaderThrift(Map headers) { if (headers == null || headers.isEmpty()) { return null; } - Map fields = new HashMap<>(); + Map fields = new HashMap<>(); for (Map.Entry item : headers.entrySet()) { - fields.put(item.getKey(), ByteBuffer.wrap(item.getValue())); + fields.put(item.getKey(), item.getValue()); } Header headerThrift = new Header(); headerThrift.setFields(fields); @@ -342,7 +322,7 @@ public void signalWorkflowExecution(SignalExternalWorkflowParameters signalParam try { RpcRetryer.retry(() -> service.SignalWorkflowExecution(request)); - } catch (TException e) { + } catch (BaseError e) { throw CheckedExceptionWrapper.wrap(e); } } @@ -375,7 +355,7 @@ public void onError(Exception exception) { result.completeExceptionally(exception); } }); - } catch (TException e) { + } catch (BaseError e) { result.completeExceptionally(e); } return result; @@ -445,7 +425,7 @@ private WorkflowExecution enqueueSignalWithStartWorkflowInternal( RpcRetryer.DEFAULT_RPC_RETRY_OPTIONS, () -> service.SignalWithStartWorkflowExecutionAsync(request)); return new WorkflowExecution().setWorkflowId(request.getRequest().getWorkflowId()); - } catch (TException e) { + } catch (BaseError e) { throw CheckedExceptionWrapper.wrap(e); } } @@ -461,7 +441,7 @@ private WorkflowExecution signalWithStartWorkflowInternal( return new WorkflowExecution() .setRunId(result.getRunId()) .setWorkflowId(request.getWorkflowId()); - } catch (TException e) { + } catch (BaseError e) { throw CheckedExceptionWrapper.wrap(e); } } @@ -518,7 +498,7 @@ public void requestCancelWorkflowExecution(WorkflowExecution execution) { request.setWorkflowExecution(execution); try { RpcRetryer.retry(() -> service.RequestCancelWorkflowExecution(request)); - } catch (TException e) { + } catch (BaseError e) { throw CheckedExceptionWrapper.wrap(e); } } @@ -541,7 +521,7 @@ public QueryWorkflowResponse queryWorkflow(QueryWorkflowParameters queryParamete RpcRetryer.retryWithResult( RpcRetryer.DEFAULT_RPC_RETRY_OPTIONS, () -> service.QueryWorkflow(request)); return response; - } catch (TException e) { + } catch (BaseError e) { throw CheckedExceptionWrapper.wrap(e); } } @@ -561,7 +541,7 @@ public void terminateWorkflowExecution(TerminateWorkflowExecutionParameters term // request.setChildPolicy(terminateParameters.getChildPolicy()); try { RpcRetryer.retry(() -> service.TerminateWorkflowExecution(request)); - } catch (TException e) { + } catch (BaseError e) { throw CheckedExceptionWrapper.wrap(e); } } diff --git a/src/main/java/com/uber/cadence/internal/external/ManualActivityCompletionClientImpl.java b/src/main/java/com/uber/cadence/internal/external/ManualActivityCompletionClientImpl.java index ac2acd2bc..13ae37d07 100644 --- a/src/main/java/com/uber/cadence/internal/external/ManualActivityCompletionClientImpl.java +++ b/src/main/java/com/uber/cadence/internal/external/ManualActivityCompletionClientImpl.java @@ -17,17 +17,7 @@ package com.uber.cadence.internal.external; -import com.uber.cadence.EntityNotExistsError; -import com.uber.cadence.RecordActivityTaskHeartbeatRequest; -import com.uber.cadence.RecordActivityTaskHeartbeatResponse; -import com.uber.cadence.RespondActivityTaskCanceledByIDRequest; -import com.uber.cadence.RespondActivityTaskCanceledRequest; -import com.uber.cadence.RespondActivityTaskCompletedByIDRequest; -import com.uber.cadence.RespondActivityTaskCompletedRequest; -import com.uber.cadence.RespondActivityTaskFailedByIDRequest; -import com.uber.cadence.RespondActivityTaskFailedRequest; -import com.uber.cadence.WorkflowExecution; -import com.uber.cadence.WorkflowExecutionAlreadyCompletedError; +import com.uber.cadence.*; import com.uber.cadence.client.ActivityCancelledException; import com.uber.cadence.client.ActivityCompletionFailureException; import com.uber.cadence.client.ActivityNotExistsException; @@ -37,7 +27,6 @@ import com.uber.cadence.serviceclient.IWorkflowService; import com.uber.m3.tally.Scope; import java.util.concurrent.CancellationException; -import org.apache.thrift.TException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -102,7 +91,7 @@ public void complete(Object result) { throw new ActivityNotExistsException(e); } catch (WorkflowExecutionAlreadyCompletedError e) { throw new ActivityNotExistsException(e); - } catch (TException e) { + } catch (BaseError e) { throw new ActivityCompletionFailureException(e); } } else { @@ -124,7 +113,7 @@ public void complete(Object result) { throw new ActivityNotExistsException(e); } catch (WorkflowExecutionAlreadyCompletedError e) { throw new ActivityNotExistsException(e); - } catch (TException e) { + } catch (BaseError e) { throw new ActivityCompletionFailureException(activityId, e); } } @@ -148,7 +137,7 @@ public void fail(Throwable failure) { throw new ActivityNotExistsException(e); } catch (WorkflowExecutionAlreadyCompletedError e) { throw new ActivityNotExistsException(e); - } catch (TException e) { + } catch (BaseError e) { throw new ActivityCompletionFailureException(e); } } else { @@ -166,7 +155,7 @@ public void fail(Throwable failure) { throw new ActivityNotExistsException(e); } catch (WorkflowExecutionAlreadyCompletedError e) { throw new ActivityNotExistsException(e); - } catch (TException e) { + } catch (BaseError e) { throw new ActivityCompletionFailureException(activityId, e); } } @@ -188,7 +177,7 @@ public void recordHeartbeat(Object details) throws CancellationException { throw new ActivityNotExistsException(e); } catch (WorkflowExecutionAlreadyCompletedError e) { throw new ActivityNotExistsException(e); - } catch (TException e) { + } catch (BaseError e) { throw new ActivityCompletionFailureException(e); } } else { @@ -206,7 +195,7 @@ public void reportCancellation(Object details) { try { service.RespondActivityTaskCanceled(request); metricsScope.counter(MetricsType.ACTIVITY_TASK_CANCELED_COUNTER).inc(1); - } catch (TException e) { + } catch (BaseError e) { // There is nothing that can be done at this point. // so let's just ignore. log.info("reportCancellation", e); @@ -221,7 +210,7 @@ public void reportCancellation(Object details) { try { service.RespondActivityTaskCanceledByID(request); metricsScope.counter(MetricsType.ACTIVITY_TASK_CANCELED_BY_ID_COUNTER).inc(1); - } catch (TException e) { + } catch (BaseError e) { // There is nothing that can be done at this point. // so let's just ignore. log.info("reportCancellation", e); diff --git a/src/main/java/com/uber/cadence/internal/replay/ActivityDecisionContext.java b/src/main/java/com/uber/cadence/internal/replay/ActivityDecisionContext.java index 3f6040ac8..817f6abcb 100644 --- a/src/main/java/com/uber/cadence/internal/replay/ActivityDecisionContext.java +++ b/src/main/java/com/uber/cadence/internal/replay/ActivityDecisionContext.java @@ -28,7 +28,6 @@ import com.uber.cadence.TaskList; import com.uber.cadence.TimeoutType; import com.uber.cadence.internal.common.RetryParameters; -import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Map; import java.util.concurrent.CancellationException; @@ -205,9 +204,9 @@ private Header toHeaderThrift(Map headers) { if (headers == null || headers.isEmpty()) { return null; } - Map fields = new HashMap<>(); + Map fields = new HashMap<>(); for (Map.Entry item : headers.entrySet()) { - fields.put(item.getKey(), ByteBuffer.wrap(item.getValue())); + fields.put(item.getKey(), item.getValue()); } Header headerThrift = new Header(); headerThrift.setFields(fields); diff --git a/src/main/java/com/uber/cadence/internal/replay/MarkerHandler.java b/src/main/java/com/uber/cadence/internal/replay/MarkerHandler.java index 31821014f..6e522238b 100644 --- a/src/main/java/com/uber/cadence/internal/replay/MarkerHandler.java +++ b/src/main/java/com/uber/cadence/internal/replay/MarkerHandler.java @@ -25,7 +25,6 @@ import com.uber.cadence.internal.sync.WorkflowInternal; import com.uber.cadence.workflow.Functions.Func1; import com.uber.m3.util.ImmutableMap; -import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Map; import java.util.Optional; @@ -73,8 +72,7 @@ static MarkerInterface fromEventAttributes( if (attributes.getHeader() != null && attributes.getHeader().getFields() != null && attributes.getHeader().getFields().containsKey(MUTABLE_MARKER_HEADER_KEY)) { - ByteBuffer byteBuffer = attributes.getHeader().getFields().get(MUTABLE_MARKER_HEADER_KEY); - byte[] bytes = org.apache.thrift.TBaseHelper.byteBufferToByteArray(byteBuffer); + byte[] bytes = attributes.getHeader().getFields().get(MUTABLE_MARKER_HEADER_KEY); MarkerData.MarkerHeader header = converter.fromData(bytes, MarkerData.MarkerHeader.class, MarkerData.MarkerHeader.class); return new MarkerData(header, attributes.getDetails()); @@ -135,7 +133,7 @@ public int getAccessCount() { Header getHeader(DataConverter converter) { byte[] headerData = converter.toData(header); Header header = new Header(); - header.setFields(ImmutableMap.of(MUTABLE_MARKER_HEADER_KEY, ByteBuffer.wrap(headerData))); + header.setFields(ImmutableMap.of(MUTABLE_MARKER_HEADER_KEY, headerData)); return header; } } diff --git a/src/main/java/com/uber/cadence/internal/replay/ReplayDecider.java b/src/main/java/com/uber/cadence/internal/replay/ReplayDecider.java index 574d012c1..90500b64b 100644 --- a/src/main/java/com/uber/cadence/internal/replay/ReplayDecider.java +++ b/src/main/java/com/uber/cadence/internal/replay/ReplayDecider.java @@ -20,19 +20,7 @@ import static com.uber.cadence.worker.NonDeterministicWorkflowPolicy.FailWorkflow; import com.google.common.annotations.VisibleForTesting; -import com.uber.cadence.EventType; -import com.uber.cadence.GetWorkflowExecutionHistoryRequest; -import com.uber.cadence.GetWorkflowExecutionHistoryResponse; -import com.uber.cadence.History; -import com.uber.cadence.HistoryEvent; -import com.uber.cadence.PollForDecisionTaskResponse; -import com.uber.cadence.QueryResultType; -import com.uber.cadence.TimerFiredEventAttributes; -import com.uber.cadence.WorkflowExecutionSignaledEventAttributes; -import com.uber.cadence.WorkflowExecutionStartedEventAttributes; -import com.uber.cadence.WorkflowQuery; -import com.uber.cadence.WorkflowQueryResult; -import com.uber.cadence.WorkflowType; +import com.uber.cadence.*; import com.uber.cadence.common.RetryOptions; import com.uber.cadence.internal.common.OptionsUtils; import com.uber.cadence.internal.common.RpcRetryer; @@ -64,7 +52,6 @@ import java.util.function.BiFunction; import java.util.function.Consumer; import java.util.stream.Collectors; -import org.apache.thrift.TException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -436,7 +423,8 @@ private boolean decideImpl(PollForDecisionTaskResponse decisionTask, Functions.P + 2) // getNextDecisionEventId() skips over completed. && (decisionsHelper.getNextDecisionEventId() != 0 && historyHelper.getPreviousStartedEventId() != 0) - && (decisionTask.getHistory().getEventsSize() > 0)) { + && (decisionTask.getHistory().getEvents() != null + && decisionTask.getHistory().getEvents().size() > 0)) { throw new IllegalStateException( String.format( "ReplayDecider expects next event id at %d. History's previous started event id is %d", @@ -643,7 +631,7 @@ private Duration decisionTaskRemainingTime() { Objects.requireNonNull(decisionTaskStartToCloseTimeout); History history = task.getHistory(); - current = history.getEventsIterator(); + current = history.getEvents().iterator(); nextPageToken = task.getNextPageToken(); } @@ -698,20 +686,20 @@ public HistoryEvent next() { GetWorkflowExecutionHistoryResponse r = RpcRetryer.retryWithResult( retryOptions, () -> service.GetWorkflowExecutionHistory(request)); - current = r.getHistory().getEventsIterator(); + current = r.getHistory().getEvents().iterator(); nextPageToken = r.getNextPageToken(); metricsScope.counter(MetricsType.WORKFLOW_GET_HISTORY_SUCCEED_COUNTER).inc(1); sw.stop(); - } catch (TException e) { + } catch (BaseError e) { metricsScope.counter(MetricsType.WORKFLOW_GET_HISTORY_FAILED_COUNTER).inc(1); throw new Error(e); } if (!current.hasNext()) { log.error( "GetWorkflowExecutionHistory returns an empty history, maybe a bug in server, workflowID:{}, runID:{}, domain:{} token:{}", - request.execution.workflowId, - request.execution.runId, - request.domain, + request.getExecution().getWorkflowId(), + request.getExecution().getRunId(), + request.getDomain(), Arrays.toString(request.getNextPageToken())); throw new Error( "GetWorkflowExecutionHistory return empty history, maybe a bug in server"); diff --git a/src/main/java/com/uber/cadence/internal/replay/ReplayDecisionTaskHandler.java b/src/main/java/com/uber/cadence/internal/replay/ReplayDecisionTaskHandler.java index 2ffaaab41..784c8360a 100644 --- a/src/main/java/com/uber/cadence/internal/replay/ReplayDecisionTaskHandler.java +++ b/src/main/java/com/uber/cadence/internal/replay/ReplayDecisionTaskHandler.java @@ -119,7 +119,7 @@ public DecisionTaskHandler.Result handleDecisionTask(PollForDecisionTaskResponse private Result handleDecisionTaskImpl(PollForDecisionTaskResponse decisionTask) throws Throwable { - if (decisionTask.isSetQuery()) { + if (decisionTask.getQuery() != null) { return processQuery(decisionTask); } else { return processDecision(decisionTask); diff --git a/src/main/java/com/uber/cadence/internal/replay/WorkflowContext.java b/src/main/java/com/uber/cadence/internal/replay/WorkflowContext.java index ca7633986..7e9b0ed01 100644 --- a/src/main/java/com/uber/cadence/internal/replay/WorkflowContext.java +++ b/src/main/java/com/uber/cadence/internal/replay/WorkflowContext.java @@ -19,7 +19,6 @@ import com.uber.cadence.*; import com.uber.cadence.context.ContextPropagator; -import java.nio.ByteBuffer; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -156,7 +155,7 @@ Map getPropagatedContexts() { return new HashMap<>(); } - Map fields = headers.getFields(); + Map fields = headers.getFields(); if (fields == null) { return new HashMap<>(); } @@ -164,7 +163,7 @@ Map getPropagatedContexts() { Map headerData = new HashMap<>(); fields.forEach( (k, v) -> { - headerData.put(k, org.apache.thrift.TBaseHelper.byteBufferToByteArray(v)); + headerData.put(k, v); }); Map contextData = new HashMap<>(); @@ -182,7 +181,7 @@ void mergeSearchAttributes(SearchAttributes searchAttributes) { if (this.searchAttributes == null) { this.searchAttributes = newSearchAttributes(); } - Map current = this.searchAttributes.getIndexedFields(); + Map current = this.searchAttributes.getIndexedFields(); searchAttributes .getIndexedFields() .forEach( @@ -193,7 +192,7 @@ void mergeSearchAttributes(SearchAttributes searchAttributes) { private SearchAttributes newSearchAttributes() { SearchAttributes result = new SearchAttributes(); - result.setIndexedFields(new HashMap()); + result.setIndexedFields(new HashMap()); return result; } } diff --git a/src/main/java/com/uber/cadence/internal/replay/WorkflowDecisionContext.java b/src/main/java/com/uber/cadence/internal/replay/WorkflowDecisionContext.java index 99684822f..8cbd061c5 100644 --- a/src/main/java/com/uber/cadence/internal/replay/WorkflowDecisionContext.java +++ b/src/main/java/com/uber/cadence/internal/replay/WorkflowDecisionContext.java @@ -43,7 +43,6 @@ import com.uber.cadence.workflow.ChildWorkflowTimedOutException; import com.uber.cadence.workflow.SignalExternalWorkflowException; import com.uber.cadence.workflow.StartChildWorkflowFailedException; -import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; @@ -177,9 +176,9 @@ private Header toHeaderThrift(Map headers) { if (headers == null || headers.isEmpty()) { return null; } - Map fields = new HashMap<>(); + Map fields = new HashMap<>(); for (Map.Entry item : headers.entrySet()) { - fields.put(item.getKey(), ByteBuffer.wrap(item.getValue())); + fields.put(item.getKey(), item.getValue()); } Header headerThrift = new Header(); headerThrift.setFields(fields); @@ -230,7 +229,7 @@ void requestCancelWorkflowExecution(WorkflowExecution execution) { new RequestCancelExternalWorkflowExecutionDecisionAttributes(); String workflowId = execution.getWorkflowId(); attributes.setWorkflowId(workflowId); - if (execution.isSetRunId()) { + if (execution.getRunId() != null) { attributes.setRunId(execution.getRunId()); } decisions.requestCancelExternalWorkflowExecution(attributes); diff --git a/src/main/java/com/uber/cadence/internal/shadowing/ReplayWorkflowActivity.java b/src/main/java/com/uber/cadence/internal/shadowing/ReplayWorkflowActivity.java index b669eba66..c2642bae9 100644 --- a/src/main/java/com/uber/cadence/internal/shadowing/ReplayWorkflowActivity.java +++ b/src/main/java/com/uber/cadence/internal/shadowing/ReplayWorkflowActivity.java @@ -16,12 +16,12 @@ package com.uber.cadence.internal.shadowing; import com.uber.cadence.activity.ActivityMethod; -import com.uber.cadence.shadower.shadowerConstants; +import com.uber.cadence.shadower.Constants; import com.uber.cadence.worker.WorkflowImplementationOptions; import com.uber.cadence.workflow.Functions; public interface ReplayWorkflowActivity { - @ActivityMethod(name = shadowerConstants.ReplayWorkflowActivityName) + @ActivityMethod(name = Constants.ReplayWorkflowActivityName) ReplayWorkflowActivityResult replay(ReplayWorkflowActivityParams params) throws Exception; ReplayWorkflowActivityResult replayOneExecution(String domain, WorkflowExecution execution); diff --git a/src/main/java/com/uber/cadence/internal/shadowing/ReplayWorkflowActivityImpl.java b/src/main/java/com/uber/cadence/internal/shadowing/ReplayWorkflowActivityImpl.java index d2432889f..eae82edb0 100644 --- a/src/main/java/com/uber/cadence/internal/shadowing/ReplayWorkflowActivityImpl.java +++ b/src/main/java/com/uber/cadence/internal/shadowing/ReplayWorkflowActivityImpl.java @@ -19,12 +19,9 @@ import com.google.common.collect.Lists; import com.uber.cadence.GetWorkflowExecutionHistoryResponse; -import com.uber.cadence.History; import com.uber.cadence.HistoryEvent; -import com.uber.cadence.HistoryEventFilterType; import com.uber.cadence.activity.Activity; import com.uber.cadence.common.WorkflowExecutionHistory; -import com.uber.cadence.internal.common.InternalUtils; import com.uber.cadence.internal.common.RpcRetryer; import com.uber.cadence.internal.common.WorkflowExecutionUtils; import com.uber.cadence.internal.metrics.MetricsType; @@ -185,14 +182,10 @@ protected WorkflowExecutionHistory getFullHistory(String domain, WorkflowExecuti nextPageToken, this.serviceClient, domain, execution.toThrift())); pageToken = resp.getNextPageToken(); - // handle raw history + // TODO support raw history feature once server removes default Thrift encoding if (resp.getRawHistory() != null && resp.getRawHistory().size() > 0) { - History history = - InternalUtils.DeserializeFromBlobDataToHistory( - resp.getRawHistory(), HistoryEventFilterType.ALL_EVENT); - if (history != null && history.getEvents() != null) { - histories.addAll(history.getEvents()); - } + throw new UnsupportedOperationException( + "Raw history is not supported. Please turn off frontend.sendRawWorkflowHistory feature flag in frontend service to recover"); } else { histories.addAll(resp.getHistory().getEvents()); } diff --git a/src/main/java/com/uber/cadence/internal/shadowing/ScanWorkflowActivity.java b/src/main/java/com/uber/cadence/internal/shadowing/ScanWorkflowActivity.java index 6ded607c0..245b562c6 100644 --- a/src/main/java/com/uber/cadence/internal/shadowing/ScanWorkflowActivity.java +++ b/src/main/java/com/uber/cadence/internal/shadowing/ScanWorkflowActivity.java @@ -15,7 +15,7 @@ */ package com.uber.cadence.internal.shadowing; -import static com.uber.cadence.shadower.shadowerConstants.ScanWorkflowActivityName; +import static com.uber.cadence.shadower.Constants.ScanWorkflowActivityName; import com.uber.cadence.activity.ActivityMethod; diff --git a/src/main/java/com/uber/cadence/internal/sync/ActivityExecutionContextImpl.java b/src/main/java/com/uber/cadence/internal/sync/ActivityExecutionContextImpl.java index f71f05f0c..b139e2883 100644 --- a/src/main/java/com/uber/cadence/internal/sync/ActivityExecutionContextImpl.java +++ b/src/main/java/com/uber/cadence/internal/sync/ActivityExecutionContextImpl.java @@ -17,12 +17,7 @@ package com.uber.cadence.internal.sync; -import com.uber.cadence.BadRequestError; -import com.uber.cadence.EntityNotExistsError; -import com.uber.cadence.RecordActivityTaskHeartbeatRequest; -import com.uber.cadence.RecordActivityTaskHeartbeatResponse; -import com.uber.cadence.WorkflowExecution; -import com.uber.cadence.WorkflowExecutionAlreadyCompletedError; +import com.uber.cadence.*; import com.uber.cadence.activity.ActivityTask; import com.uber.cadence.client.ActivityCancelledException; import com.uber.cadence.client.ActivityCompletionException; @@ -38,7 +33,6 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; -import org.apache.thrift.TException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -132,7 +126,7 @@ private void doHeartBeat(Object details) { sendHeartbeatRequest(details); hasOutstandingHeartbeat = false; nextHeartbeatDelay = heartbeatIntervalMillis; - } catch (TException e) { + } catch (BaseError e) { // Not rethrowing to not fail activity implementation on intermittent connection or Cadence // errors. log.warn("Heartbeat failed.", e); @@ -162,7 +156,7 @@ private void scheduleNextHeartbeat(long delay) { TimeUnit.MILLISECONDS); } - private void sendHeartbeatRequest(Object details) throws TException { + private void sendHeartbeatRequest(Object details) throws BaseError { RecordActivityTaskHeartbeatRequest r = new RecordActivityTaskHeartbeatRequest(); r.setTaskToken(task.getTaskToken()); byte[] serialized = dataConverter.toData(details); 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..7c303d972 100644 --- a/src/main/java/com/uber/cadence/internal/sync/TestActivityEnvironmentInternal.java +++ b/src/main/java/com/uber/cadence/internal/sync/TestActivityEnvironmentInternal.java @@ -26,6 +26,7 @@ import com.uber.cadence.internal.metrics.NoopScope; import com.uber.cadence.internal.worker.ActivityTaskHandler; import com.uber.cadence.internal.worker.ActivityTaskHandler.Result; +import com.uber.cadence.serviceclient.AsyncMethodCallback; import com.uber.cadence.serviceclient.ClientOptions; import com.uber.cadence.serviceclient.IWorkflowService; import com.uber.cadence.testing.TestActivityEnvironment; @@ -51,8 +52,6 @@ import java.util.function.BiPredicate; import java.util.function.Consumer; import java.util.function.Supplier; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; public final class TestActivityEnvironmentInternal implements TestActivityEnvironment { @@ -355,7 +354,7 @@ private WorkflowServiceWrapper(IWorkflowService impl) { public RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeat( RecordActivityTaskHeartbeatRequest heartbeatRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, - WorkflowExecutionAlreadyCompletedError, TException { + WorkflowExecutionAlreadyCompletedError, BaseError { if (activityHeartbetListener != null) { Object details = testEnvironmentOptions @@ -375,14 +374,14 @@ public RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeatByID( RecordActivityTaskHeartbeatByIDRequest heartbeatRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, WorkflowExecutionAlreadyCompletedError, DomainNotActiveError, LimitExceededError, - ServiceBusyError, TException { + ServiceBusyError, BaseError { return impl.RecordActivityTaskHeartbeatByID(heartbeatRequest); } @Override public void RespondActivityTaskCompleted(RespondActivityTaskCompletedRequest completeRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, - WorkflowExecutionAlreadyCompletedError, TException { + WorkflowExecutionAlreadyCompletedError, BaseError { impl.RespondActivityTaskCompleted(completeRequest); } @@ -390,28 +389,28 @@ public void RespondActivityTaskCompleted(RespondActivityTaskCompletedRequest com public void RespondActivityTaskCompletedByID( RespondActivityTaskCompletedByIDRequest completeRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, - WorkflowExecutionAlreadyCompletedError, TException { + WorkflowExecutionAlreadyCompletedError, BaseError { impl.RespondActivityTaskCompletedByID(completeRequest); } @Override public void RespondActivityTaskFailed(RespondActivityTaskFailedRequest failRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, - WorkflowExecutionAlreadyCompletedError, TException { + WorkflowExecutionAlreadyCompletedError, BaseError { impl.RespondActivityTaskFailed(failRequest); } @Override public void RespondActivityTaskFailedByID(RespondActivityTaskFailedByIDRequest failRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, - WorkflowExecutionAlreadyCompletedError, TException { + WorkflowExecutionAlreadyCompletedError, BaseError { impl.RespondActivityTaskFailedByID(failRequest); } @Override public void RespondActivityTaskCanceled(RespondActivityTaskCanceledRequest canceledRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, - WorkflowExecutionAlreadyCompletedError, TException { + WorkflowExecutionAlreadyCompletedError, BaseError { impl.RespondActivityTaskCanceled(canceledRequest); } @@ -419,7 +418,7 @@ public void RespondActivityTaskCanceled(RespondActivityTaskCanceledRequest cance public void RespondActivityTaskCanceledByID( RespondActivityTaskCanceledByIDRequest canceledRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, - WorkflowExecutionAlreadyCompletedError, TException { + WorkflowExecutionAlreadyCompletedError, BaseError { impl.RespondActivityTaskCanceledByID(canceledRequest); } @@ -427,14 +426,14 @@ public void RespondActivityTaskCanceledByID( public void RequestCancelWorkflowExecution(RequestCancelWorkflowExecutionRequest cancelRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, CancellationAlreadyRequestedError, ServiceBusyError, - WorkflowExecutionAlreadyCompletedError, TException { + WorkflowExecutionAlreadyCompletedError, BaseError { impl.RequestCancelWorkflowExecution(cancelRequest); } @Override public void SignalWorkflowExecution(SignalWorkflowExecutionRequest signalRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, - WorkflowExecutionAlreadyCompletedError, ServiceBusyError, TException { + WorkflowExecutionAlreadyCompletedError, ServiceBusyError, BaseError { impl.SignalWorkflowExecution(signalRequest); } @@ -443,7 +442,7 @@ public StartWorkflowExecutionResponse SignalWithStartWorkflowExecution( SignalWithStartWorkflowExecutionRequest signalWithStartRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, LimitExceededError, WorkflowExecutionAlreadyStartedError, - TException { + BaseError { return impl.SignalWithStartWorkflowExecution(signalWithStartRequest); } @@ -452,7 +451,7 @@ public SignalWithStartWorkflowExecutionAsyncResponse SignalWithStartWorkflowExec SignalWithStartWorkflowExecutionAsyncRequest signalWithStartRequest) throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError, DomainNotActiveError, LimitExceededError, EntityNotExistsError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { return impl.SignalWithStartWorkflowExecutionAsync(signalWithStartRequest); } @@ -460,14 +459,14 @@ public SignalWithStartWorkflowExecutionAsyncResponse SignalWithStartWorkflowExec public ResetWorkflowExecutionResponse ResetWorkflowExecution( ResetWorkflowExecutionRequest resetRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, - DomainNotActiveError, LimitExceededError, ClientVersionNotSupportedError, TException { + DomainNotActiveError, LimitExceededError, ClientVersionNotSupportedError, BaseError { return impl.ResetWorkflowExecution(resetRequest); } @Override public void TerminateWorkflowExecution(TerminateWorkflowExecutionRequest terminateRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, - WorkflowExecutionAlreadyCompletedError, ServiceBusyError, TException { + WorkflowExecutionAlreadyCompletedError, ServiceBusyError, BaseError { impl.TerminateWorkflowExecution(terminateRequest); } @@ -475,7 +474,7 @@ public void TerminateWorkflowExecution(TerminateWorkflowExecutionRequest termina public ListOpenWorkflowExecutionsResponse ListOpenWorkflowExecutions( ListOpenWorkflowExecutionsRequest listRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, - TException { + BaseError { return impl.ListOpenWorkflowExecutions(listRequest); } @@ -483,7 +482,7 @@ public ListOpenWorkflowExecutionsResponse ListOpenWorkflowExecutions( public ListClosedWorkflowExecutionsResponse ListClosedWorkflowExecutions( ListClosedWorkflowExecutionsRequest listRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, - TException { + BaseError { return impl.ListClosedWorkflowExecutions(listRequest); } @@ -491,7 +490,7 @@ public ListClosedWorkflowExecutionsResponse ListClosedWorkflowExecutions( public ListWorkflowExecutionsResponse ListWorkflowExecutions( ListWorkflowExecutionsRequest listRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { return impl.ListWorkflowExecutions(listRequest); } @@ -499,7 +498,7 @@ public ListWorkflowExecutionsResponse ListWorkflowExecutions( public ListArchivedWorkflowExecutionsResponse ListArchivedWorkflowExecutions( ListArchivedWorkflowExecutionsRequest listRequest) throws BadRequestError, EntityNotExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { return impl.ListArchivedWorkflowExecutions(listRequest); } @@ -507,7 +506,7 @@ public ListArchivedWorkflowExecutionsResponse ListArchivedWorkflowExecutions( public ListWorkflowExecutionsResponse ScanWorkflowExecutions( ListWorkflowExecutionsRequest listRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { return impl.ScanWorkflowExecutions(listRequest); } @@ -515,52 +514,52 @@ public ListWorkflowExecutionsResponse ScanWorkflowExecutions( public CountWorkflowExecutionsResponse CountWorkflowExecutions( CountWorkflowExecutionsRequest countRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { return impl.CountWorkflowExecutions(countRequest); } @Override public GetSearchAttributesResponse GetSearchAttributes() - throws InternalServiceError, ServiceBusyError, ClientVersionNotSupportedError, TException { + throws InternalServiceError, ServiceBusyError, ClientVersionNotSupportedError, BaseError { return impl.GetSearchAttributes(); } @Override public void RespondQueryTaskCompleted(RespondQueryTaskCompletedRequest completeRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, - WorkflowExecutionAlreadyCompletedError, TException { + WorkflowExecutionAlreadyCompletedError, BaseError { impl.RespondQueryTaskCompleted(completeRequest); } @Override public ResetStickyTaskListResponse ResetStickyTaskList(ResetStickyTaskListRequest resetRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, LimitExceededError, - ServiceBusyError, DomainNotActiveError, TException { + ServiceBusyError, DomainNotActiveError, BaseError { return impl.ResetStickyTaskList(resetRequest); } @Override public QueryWorkflowResponse QueryWorkflow(QueryWorkflowRequest queryRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, QueryFailedError, - TException { + BaseError { return impl.QueryWorkflow(queryRequest); } @Override public DescribeWorkflowExecutionResponse DescribeWorkflowExecution( DescribeWorkflowExecutionRequest describeRequest) - throws BadRequestError, InternalServiceError, EntityNotExistsError, TException { + throws BadRequestError, InternalServiceError, EntityNotExistsError, BaseError { return impl.DescribeWorkflowExecution(describeRequest); } @Override public DescribeTaskListResponse DescribeTaskList(DescribeTaskListRequest request) - throws BadRequestError, InternalServiceError, EntityNotExistsError, TException { + throws BadRequestError, InternalServiceError, EntityNotExistsError, BaseError { return impl.DescribeTaskList(request); } @Override - public ClusterInfo GetClusterInfo() throws InternalServiceError, ServiceBusyError, TException { + public ClusterInfo GetClusterInfo() throws InternalServiceError, ServiceBusyError, BaseError { return impl.GetClusterInfo(); } @@ -568,74 +567,72 @@ public ClusterInfo GetClusterInfo() throws InternalServiceError, ServiceBusyErro public ListTaskListPartitionsResponse ListTaskListPartitions( ListTaskListPartitionsRequest request) throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, - TException { + BaseError { return impl.ListTaskListPartitions(request); } @Override public void RefreshWorkflowTasks(RefreshWorkflowTasksRequest request) throws BadRequestError, DomainNotActiveError, ServiceBusyError, EntityNotExistsError, - TException { + BaseError { impl.RefreshWorkflowTasks(request); } @Override public void RegisterDomain( - RegisterDomainRequest registerRequest, AsyncMethodCallback resultHandler) - throws TException { + RegisterDomainRequest registerRequest, AsyncMethodCallback resultHandler) throws BaseError { impl.RegisterDomain(registerRequest, resultHandler); } @Override public void DescribeDomain( - DescribeDomainRequest describeRequest, AsyncMethodCallback resultHandler) - throws TException { + DescribeDomainRequest describeRequest, AsyncMethodCallback resultHandler) throws BaseError { impl.DescribeDomain(describeRequest, resultHandler); } @Override public void ListDomains(ListDomainsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.ListDomains(listRequest, resultHandler); } @Override public void UpdateDomain(UpdateDomainRequest updateRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.UpdateDomain(updateRequest, resultHandler); } @Override public void DeprecateDomain( DeprecateDomainRequest deprecateRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.DeprecateDomain(deprecateRequest, resultHandler); } @Override public void RestartWorkflowExecution( RestartWorkflowExecutionRequest restartRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.RestartWorkflowExecution(restartRequest, resultHandler); } @Override public void GetTaskListsByDomain( - GetTaskListsByDomainRequest request, AsyncMethodCallback resultHandler) throws TException { + GetTaskListsByDomainRequest request, AsyncMethodCallback resultHandler) throws BaseError { impl.GetTaskListsByDomain(request, resultHandler); } @Override public void StartWorkflowExecution( StartWorkflowExecutionRequest startRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.StartWorkflowExecution(startRequest, resultHandler); } @Override public void StartWorkflowExecutionAsync( StartWorkflowExecutionAsyncRequest startRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.StartWorkflowExecutionAsync(startRequest, resultHandler); } @@ -644,7 +641,7 @@ public void StartWorkflowExecutionWithTimeout( StartWorkflowExecutionRequest startRequest, AsyncMethodCallback resultHandler, Long timeoutInMillis) - throws TException { + throws BaseError { impl.StartWorkflowExecutionWithTimeout(startRequest, resultHandler, timeoutInMillis); } @@ -653,7 +650,7 @@ public void StartWorkflowExecutionAsyncWithTimeout( StartWorkflowExecutionAsyncRequest startAsyncRequest, AsyncMethodCallback resultHandler, Long timeoutInMillis) - throws TException { + throws BaseError { impl.StartWorkflowExecutionAsyncWithTimeout( startAsyncRequest, resultHandler, timeoutInMillis); } @@ -661,7 +658,7 @@ public void StartWorkflowExecutionAsyncWithTimeout( @Override public void GetWorkflowExecutionHistory( GetWorkflowExecutionHistoryRequest getRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.GetWorkflowExecutionHistory(getRequest, resultHandler); } @@ -670,105 +667,105 @@ public void GetWorkflowExecutionHistoryWithTimeout( GetWorkflowExecutionHistoryRequest getRequest, AsyncMethodCallback resultHandler, Long timeoutInMillis) - throws TException { + throws BaseError { impl.GetWorkflowExecutionHistoryWithTimeout(getRequest, resultHandler, timeoutInMillis); } @Override public void PollForDecisionTask( PollForDecisionTaskRequest pollRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.PollForDecisionTask(pollRequest, resultHandler); } @Override public void RespondDecisionTaskCompleted( RespondDecisionTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.RespondDecisionTaskCompleted(completeRequest, resultHandler); } @Override public void RespondDecisionTaskFailed( RespondDecisionTaskFailedRequest failedRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.RespondDecisionTaskFailed(failedRequest, resultHandler); } @Override public void PollForActivityTask( PollForActivityTaskRequest pollRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.PollForActivityTask(pollRequest, resultHandler); } @Override public void RecordActivityTaskHeartbeat( RecordActivityTaskHeartbeatRequest heartbeatRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.RecordActivityTaskHeartbeat(heartbeatRequest, resultHandler); } @Override public void RecordActivityTaskHeartbeatByID( RecordActivityTaskHeartbeatByIDRequest heartbeatRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.RecordActivityTaskHeartbeatByID(heartbeatRequest, resultHandler); } @Override public void RespondActivityTaskCompleted( RespondActivityTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.RespondActivityTaskCompleted(completeRequest, resultHandler); } @Override public void RespondActivityTaskCompletedByID( RespondActivityTaskCompletedByIDRequest completeRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.RespondActivityTaskCompletedByID(completeRequest, resultHandler); } @Override public void RespondActivityTaskFailed( RespondActivityTaskFailedRequest failRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.RespondActivityTaskFailed(failRequest, resultHandler); } @Override public void RespondActivityTaskFailedByID( RespondActivityTaskFailedByIDRequest failRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.RespondActivityTaskFailedByID(failRequest, resultHandler); } @Override public void RespondActivityTaskCanceled( RespondActivityTaskCanceledRequest canceledRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.RespondActivityTaskCanceled(canceledRequest, resultHandler); } @Override public void RespondActivityTaskCanceledByID( RespondActivityTaskCanceledByIDRequest canceledRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.RespondActivityTaskCanceledByID(canceledRequest, resultHandler); } @Override public void RequestCancelWorkflowExecution( RequestCancelWorkflowExecutionRequest cancelRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.RequestCancelWorkflowExecution(cancelRequest, resultHandler); } @Override public void SignalWorkflowExecution( SignalWorkflowExecutionRequest signalRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.SignalWorkflowExecution(signalRequest, resultHandler); } @@ -777,7 +774,7 @@ public void SignalWorkflowExecutionWithTimeout( SignalWorkflowExecutionRequest signalRequest, AsyncMethodCallback resultHandler, Long timeoutInMillis) - throws TException { + throws BaseError { impl.SignalWorkflowExecutionWithTimeout(signalRequest, resultHandler, timeoutInMillis); } @@ -785,7 +782,7 @@ public void SignalWorkflowExecutionWithTimeout( public void SignalWithStartWorkflowExecution( SignalWithStartWorkflowExecutionRequest signalWithStartRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.SignalWithStartWorkflowExecution(signalWithStartRequest, resultHandler); } @@ -793,151 +790,150 @@ public void SignalWithStartWorkflowExecution( public void SignalWithStartWorkflowExecutionAsync( SignalWithStartWorkflowExecutionAsyncRequest signalWithStartRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.SignalWithStartWorkflowExecutionAsync(signalWithStartRequest, resultHandler); } @Override public void ResetWorkflowExecution( ResetWorkflowExecutionRequest resetRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.ResetWorkflowExecution(resetRequest, resultHandler); } @Override public void TerminateWorkflowExecution( TerminateWorkflowExecutionRequest terminateRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.TerminateWorkflowExecution(terminateRequest, resultHandler); } @Override public void ListOpenWorkflowExecutions( ListOpenWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.ListOpenWorkflowExecutions(listRequest, resultHandler); } @Override public void ListClosedWorkflowExecutions( ListClosedWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.ListClosedWorkflowExecutions(listRequest, resultHandler); } @Override public void ListWorkflowExecutions( ListWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.ListWorkflowExecutions(listRequest, resultHandler); } @Override public void ListArchivedWorkflowExecutions( ListArchivedWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.ListArchivedWorkflowExecutions(listRequest, resultHandler); } @Override public void ScanWorkflowExecutions( ListWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.ScanWorkflowExecutions(listRequest, resultHandler); } @Override public void CountWorkflowExecutions( CountWorkflowExecutionsRequest countRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.CountWorkflowExecutions(countRequest, resultHandler); } @Override - public void GetSearchAttributes(AsyncMethodCallback resultHandler) throws TException { + public void GetSearchAttributes(AsyncMethodCallback resultHandler) throws BaseError { impl.GetSearchAttributes(resultHandler); } @Override public void RespondQueryTaskCompleted( RespondQueryTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.RespondQueryTaskCompleted(completeRequest, resultHandler); } @Override public void ResetStickyTaskList( ResetStickyTaskListRequest resetRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.ResetStickyTaskList(resetRequest, resultHandler); } @Override public void QueryWorkflow(QueryWorkflowRequest queryRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.QueryWorkflow(queryRequest, resultHandler); } @Override public void DescribeWorkflowExecution( DescribeWorkflowExecutionRequest describeRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.DescribeWorkflowExecution(describeRequest, resultHandler); } @Override public void DescribeTaskList(DescribeTaskListRequest request, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.DescribeTaskList(request, resultHandler); } @Override - public void GetClusterInfo(AsyncMethodCallback resultHandler) throws TException { + public void GetClusterInfo(AsyncMethodCallback resultHandler) throws BaseError { impl.GetClusterInfo(resultHandler); } @Override public void ListTaskListPartitions( - ListTaskListPartitionsRequest request, AsyncMethodCallback resultHandler) - throws TException { + ListTaskListPartitionsRequest request, AsyncMethodCallback resultHandler) throws BaseError { impl.ListTaskListPartitions(request, resultHandler); } @Override public void RefreshWorkflowTasks( - RefreshWorkflowTasksRequest request, AsyncMethodCallback resultHandler) throws TException { + RefreshWorkflowTasksRequest request, AsyncMethodCallback resultHandler) throws BaseError { impl.RefreshWorkflowTasks(request, resultHandler); } @Override public void RegisterDomain(RegisterDomainRequest registerRequest) - throws BadRequestError, InternalServiceError, DomainAlreadyExistsError, TException { + throws BadRequestError, InternalServiceError, DomainAlreadyExistsError, BaseError { impl.RegisterDomain(registerRequest); } @Override public DescribeDomainResponse DescribeDomain(DescribeDomainRequest describeRequest) - throws BadRequestError, InternalServiceError, EntityNotExistsError, TException { + throws BadRequestError, InternalServiceError, EntityNotExistsError, BaseError { return impl.DescribeDomain(describeRequest); } @Override public ListDomainsResponse ListDomains(ListDomainsRequest listRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, - TException { + BaseError { return impl.ListDomains(listRequest); } @Override public UpdateDomainResponse UpdateDomain(UpdateDomainRequest updateRequest) - throws BadRequestError, InternalServiceError, EntityNotExistsError, TException { + throws BadRequestError, InternalServiceError, EntityNotExistsError, BaseError { return impl.UpdateDomain(updateRequest); } @Override public void DeprecateDomain(DeprecateDomainRequest deprecateRequest) throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { impl.DeprecateDomain(deprecateRequest); } @@ -945,14 +941,14 @@ public void DeprecateDomain(DeprecateDomainRequest deprecateRequest) public RestartWorkflowExecutionResponse RestartWorkflowExecution( RestartWorkflowExecutionRequest restartRequest) throws BadRequestError, ServiceBusyError, DomainNotActiveError, LimitExceededError, - EntityNotExistsError, ClientVersionNotSupportedError, TException { + EntityNotExistsError, ClientVersionNotSupportedError, BaseError { return impl.RestartWorkflowExecution(restartRequest); } @Override public GetTaskListsByDomainResponse GetTaskListsByDomain(GetTaskListsByDomainRequest request) throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { return impl.GetTaskListsByDomain(request); } @@ -960,7 +956,7 @@ public GetTaskListsByDomainResponse GetTaskListsByDomain(GetTaskListsByDomainReq public StartWorkflowExecutionResponse StartWorkflowExecution( StartWorkflowExecutionRequest startRequest) throws BadRequestError, InternalServiceError, WorkflowExecutionAlreadyStartedError, - ServiceBusyError, TException { + ServiceBusyError, BaseError { return impl.StartWorkflowExecution(startRequest); } @@ -969,7 +965,7 @@ public StartWorkflowExecutionAsyncResponse StartWorkflowExecutionAsync( StartWorkflowExecutionAsyncRequest startRequest) throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError, DomainNotActiveError, LimitExceededError, EntityNotExistsError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { return impl.StartWorkflowExecutionAsync(startRequest); } @@ -977,7 +973,7 @@ public StartWorkflowExecutionAsyncResponse StartWorkflowExecutionAsync( public GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistory( GetWorkflowExecutionHistoryRequest getRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, - TException { + BaseError { return impl.GetWorkflowExecutionHistory(getRequest); } @@ -985,13 +981,13 @@ public GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistory( public GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistoryWithTimeout( GetWorkflowExecutionHistoryRequest getRequest, Long timeoutInMillis) throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, - TException { + BaseError { return impl.GetWorkflowExecutionHistoryWithTimeout(getRequest, timeoutInMillis); } @Override public PollForDecisionTaskResponse PollForDecisionTask(PollForDecisionTaskRequest pollRequest) - throws BadRequestError, InternalServiceError, ServiceBusyError, TException { + throws BadRequestError, InternalServiceError, ServiceBusyError, BaseError { return impl.PollForDecisionTask(pollRequest); } @@ -999,20 +995,20 @@ public PollForDecisionTaskResponse PollForDecisionTask(PollForDecisionTaskReques public RespondDecisionTaskCompletedResponse RespondDecisionTaskCompleted( RespondDecisionTaskCompletedRequest completeRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, - WorkflowExecutionAlreadyCompletedError, TException { + WorkflowExecutionAlreadyCompletedError, BaseError { return impl.RespondDecisionTaskCompleted(completeRequest); } @Override public void RespondDecisionTaskFailed(RespondDecisionTaskFailedRequest failedRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, - WorkflowExecutionAlreadyCompletedError, TException { + WorkflowExecutionAlreadyCompletedError, BaseError { impl.RespondDecisionTaskFailed(failedRequest); } @Override public PollForActivityTaskResponse PollForActivityTask(PollForActivityTaskRequest pollRequest) - throws BadRequestError, InternalServiceError, ServiceBusyError, TException { + throws BadRequestError, InternalServiceError, ServiceBusyError, BaseError { return impl.PollForActivityTask(pollRequest); } 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..308b62e36 100644 --- a/src/main/java/com/uber/cadence/internal/sync/TestWorkflowEnvironmentInternal.java +++ b/src/main/java/com/uber/cadence/internal/sync/TestWorkflowEnvironmentInternal.java @@ -17,85 +17,7 @@ package com.uber.cadence.internal.sync; -import com.uber.cadence.BadRequestError; -import com.uber.cadence.ClientVersionNotSupportedError; -import com.uber.cadence.ClusterInfo; -import com.uber.cadence.CountWorkflowExecutionsRequest; -import com.uber.cadence.CountWorkflowExecutionsResponse; -import com.uber.cadence.DeprecateDomainRequest; -import com.uber.cadence.DescribeDomainRequest; -import com.uber.cadence.DescribeDomainResponse; -import com.uber.cadence.DescribeTaskListRequest; -import com.uber.cadence.DescribeTaskListResponse; -import com.uber.cadence.DescribeWorkflowExecutionRequest; -import com.uber.cadence.DescribeWorkflowExecutionResponse; -import com.uber.cadence.DomainAlreadyExistsError; -import com.uber.cadence.DomainNotActiveError; -import com.uber.cadence.EntityNotExistsError; -import com.uber.cadence.GetSearchAttributesResponse; -import com.uber.cadence.GetTaskListsByDomainRequest; -import com.uber.cadence.GetTaskListsByDomainResponse; -import com.uber.cadence.GetWorkflowExecutionHistoryRequest; -import com.uber.cadence.GetWorkflowExecutionHistoryResponse; -import com.uber.cadence.InternalServiceError; -import com.uber.cadence.LimitExceededError; -import com.uber.cadence.ListArchivedWorkflowExecutionsRequest; -import com.uber.cadence.ListArchivedWorkflowExecutionsResponse; -import com.uber.cadence.ListClosedWorkflowExecutionsRequest; -import com.uber.cadence.ListClosedWorkflowExecutionsResponse; -import com.uber.cadence.ListDomainsRequest; -import com.uber.cadence.ListDomainsResponse; -import com.uber.cadence.ListOpenWorkflowExecutionsRequest; -import com.uber.cadence.ListOpenWorkflowExecutionsResponse; -import com.uber.cadence.ListTaskListPartitionsRequest; -import com.uber.cadence.ListTaskListPartitionsResponse; -import com.uber.cadence.ListWorkflowExecutionsRequest; -import com.uber.cadence.ListWorkflowExecutionsResponse; -import com.uber.cadence.PollForActivityTaskRequest; -import com.uber.cadence.PollForActivityTaskResponse; -import com.uber.cadence.PollForDecisionTaskRequest; -import com.uber.cadence.PollForDecisionTaskResponse; -import com.uber.cadence.QueryFailedError; -import com.uber.cadence.QueryRejectCondition; -import com.uber.cadence.QueryWorkflowRequest; -import com.uber.cadence.QueryWorkflowResponse; -import com.uber.cadence.RecordActivityTaskHeartbeatByIDRequest; -import com.uber.cadence.RecordActivityTaskHeartbeatRequest; -import com.uber.cadence.RecordActivityTaskHeartbeatResponse; -import com.uber.cadence.RefreshWorkflowTasksRequest; -import com.uber.cadence.RegisterDomainRequest; -import com.uber.cadence.RequestCancelWorkflowExecutionRequest; -import com.uber.cadence.ResetStickyTaskListRequest; -import com.uber.cadence.ResetStickyTaskListResponse; -import com.uber.cadence.ResetWorkflowExecutionRequest; -import com.uber.cadence.ResetWorkflowExecutionResponse; -import com.uber.cadence.RespondActivityTaskCanceledByIDRequest; -import com.uber.cadence.RespondActivityTaskCanceledRequest; -import com.uber.cadence.RespondActivityTaskCompletedByIDRequest; -import com.uber.cadence.RespondActivityTaskCompletedRequest; -import com.uber.cadence.RespondActivityTaskFailedByIDRequest; -import com.uber.cadence.RespondActivityTaskFailedRequest; -import com.uber.cadence.RespondDecisionTaskCompletedRequest; -import com.uber.cadence.RespondDecisionTaskCompletedResponse; -import com.uber.cadence.RespondDecisionTaskFailedRequest; -import com.uber.cadence.RespondQueryTaskCompletedRequest; -import com.uber.cadence.RestartWorkflowExecutionRequest; -import com.uber.cadence.RestartWorkflowExecutionResponse; -import com.uber.cadence.ServiceBusyError; -import com.uber.cadence.SignalWithStartWorkflowExecutionAsyncRequest; -import com.uber.cadence.SignalWithStartWorkflowExecutionAsyncResponse; -import com.uber.cadence.SignalWithStartWorkflowExecutionRequest; -import com.uber.cadence.SignalWorkflowExecutionRequest; -import com.uber.cadence.StartWorkflowExecutionAsyncRequest; -import com.uber.cadence.StartWorkflowExecutionAsyncResponse; -import com.uber.cadence.StartWorkflowExecutionRequest; -import com.uber.cadence.StartWorkflowExecutionResponse; -import com.uber.cadence.TerminateWorkflowExecutionRequest; -import com.uber.cadence.UpdateDomainRequest; -import com.uber.cadence.UpdateDomainResponse; -import com.uber.cadence.WorkflowExecution; -import com.uber.cadence.WorkflowExecutionAlreadyCompletedError; -import com.uber.cadence.WorkflowExecutionAlreadyStartedError; +import com.uber.cadence.*; import com.uber.cadence.client.ActivityCompletionClient; import com.uber.cadence.client.QueryOptions; import com.uber.cadence.client.WorkflowClient; @@ -104,6 +26,7 @@ import com.uber.cadence.client.WorkflowOptions; import com.uber.cadence.client.WorkflowStub; import com.uber.cadence.internal.testservice.TestWorkflowService; +import com.uber.cadence.serviceclient.AsyncMethodCallback; import com.uber.cadence.serviceclient.ClientOptions; import com.uber.cadence.serviceclient.IWorkflowService; import com.uber.cadence.testing.TestEnvironmentOptions; @@ -119,8 +42,6 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.function.Function; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; public final class TestWorkflowEnvironmentInternal implements TestWorkflowEnvironment { @@ -286,67 +207,67 @@ public ClientOptions getOptions() { @Override public RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeat( - RecordActivityTaskHeartbeatRequest heartbeatRequest) throws TException { + RecordActivityTaskHeartbeatRequest heartbeatRequest) throws BaseError { return impl.RecordActivityTaskHeartbeat(heartbeatRequest); } @Override public RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeatByID( - RecordActivityTaskHeartbeatByIDRequest heartbeatRequest) throws TException { + RecordActivityTaskHeartbeatByIDRequest heartbeatRequest) throws BaseError { return impl.RecordActivityTaskHeartbeatByID(heartbeatRequest); } @Override public void RespondActivityTaskCompleted(RespondActivityTaskCompletedRequest completeRequest) - throws TException { + throws BaseError { impl.RespondActivityTaskCompleted(completeRequest); } @Override public void RespondActivityTaskCompletedByID( - RespondActivityTaskCompletedByIDRequest completeRequest) throws TException { + RespondActivityTaskCompletedByIDRequest completeRequest) throws BaseError { impl.RespondActivityTaskCompletedByID(completeRequest); } @Override public void RespondActivityTaskFailed(RespondActivityTaskFailedRequest failRequest) - throws TException { + throws BaseError { impl.RespondActivityTaskFailed(failRequest); } @Override public void RespondActivityTaskFailedByID(RespondActivityTaskFailedByIDRequest failRequest) - throws TException { + throws BaseError { impl.RespondActivityTaskFailedByID(failRequest); } @Override public void RespondActivityTaskCanceled(RespondActivityTaskCanceledRequest canceledRequest) - throws TException { + throws BaseError { impl.RespondActivityTaskCanceled(canceledRequest); } @Override public void RespondActivityTaskCanceledByID( - RespondActivityTaskCanceledByIDRequest canceledRequest) throws TException { + RespondActivityTaskCanceledByIDRequest canceledRequest) throws BaseError { impl.RespondActivityTaskCanceledByID(canceledRequest); } @Override public void RequestCancelWorkflowExecution(RequestCancelWorkflowExecutionRequest cancelRequest) - throws TException { + throws BaseError { impl.RequestCancelWorkflowExecution(cancelRequest); } @Override public void SignalWorkflowExecution(SignalWorkflowExecutionRequest signalRequest) - throws TException { + throws BaseError { impl.SignalWorkflowExecution(signalRequest); } @Override public StartWorkflowExecutionResponse SignalWithStartWorkflowExecution( - SignalWithStartWorkflowExecutionRequest signalWithStartRequest) throws TException { + SignalWithStartWorkflowExecutionRequest signalWithStartRequest) throws BaseError { return impl.SignalWithStartWorkflowExecution(signalWithStartRequest); } @@ -355,170 +276,167 @@ public SignalWithStartWorkflowExecutionAsyncResponse SignalWithStartWorkflowExec SignalWithStartWorkflowExecutionAsyncRequest signalWithStartRequest) throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError, DomainNotActiveError, LimitExceededError, EntityNotExistsError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { return impl.SignalWithStartWorkflowExecutionAsync(signalWithStartRequest); } @Override public ResetWorkflowExecutionResponse ResetWorkflowExecution( - ResetWorkflowExecutionRequest resetRequest) throws TException { + ResetWorkflowExecutionRequest resetRequest) throws BaseError { return impl.ResetWorkflowExecution(resetRequest); } @Override public void TerminateWorkflowExecution(TerminateWorkflowExecutionRequest terminateRequest) - throws TException { + throws BaseError { impl.TerminateWorkflowExecution(terminateRequest); } @Override public ListOpenWorkflowExecutionsResponse ListOpenWorkflowExecutions( - ListOpenWorkflowExecutionsRequest listRequest) throws TException { + ListOpenWorkflowExecutionsRequest listRequest) throws BaseError { return impl.ListOpenWorkflowExecutions(listRequest); } @Override public ListClosedWorkflowExecutionsResponse ListClosedWorkflowExecutions( - ListClosedWorkflowExecutionsRequest listRequest) throws TException { + ListClosedWorkflowExecutionsRequest listRequest) throws BaseError { return impl.ListClosedWorkflowExecutions(listRequest); } @Override public ListWorkflowExecutionsResponse ListWorkflowExecutions( - ListWorkflowExecutionsRequest listRequest) throws TException { + ListWorkflowExecutionsRequest listRequest) throws BaseError { return impl.ListWorkflowExecutions(listRequest); } @Override public ListArchivedWorkflowExecutionsResponse ListArchivedWorkflowExecutions( - ListArchivedWorkflowExecutionsRequest listRequest) throws TException { + ListArchivedWorkflowExecutionsRequest listRequest) throws BaseError { return impl.ListArchivedWorkflowExecutions(listRequest); } @Override public ListWorkflowExecutionsResponse ScanWorkflowExecutions( - ListWorkflowExecutionsRequest listRequest) throws TException { + ListWorkflowExecutionsRequest listRequest) throws BaseError { return impl.ScanWorkflowExecutions(listRequest); } @Override public CountWorkflowExecutionsResponse CountWorkflowExecutions( - CountWorkflowExecutionsRequest countRequest) throws TException { + CountWorkflowExecutionsRequest countRequest) throws BaseError { return impl.CountWorkflowExecutions(countRequest); } @Override - public GetSearchAttributesResponse GetSearchAttributes() throws TException { + public GetSearchAttributesResponse GetSearchAttributes() throws BaseError { return impl.GetSearchAttributes(); } @Override public void RespondQueryTaskCompleted(RespondQueryTaskCompletedRequest completeRequest) - throws TException { + throws BaseError { impl.RespondQueryTaskCompleted(completeRequest); } @Override public ResetStickyTaskListResponse ResetStickyTaskList(ResetStickyTaskListRequest resetRequest) - throws TException { + throws BaseError { return impl.ResetStickyTaskList(resetRequest); } @Override public QueryWorkflowResponse QueryWorkflow(QueryWorkflowRequest queryRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, QueryFailedError, - TException { + BaseError { return impl.QueryWorkflow(queryRequest); } @Override public DescribeWorkflowExecutionResponse DescribeWorkflowExecution( - DescribeWorkflowExecutionRequest describeRequest) throws TException { + DescribeWorkflowExecutionRequest describeRequest) throws BaseError { return impl.DescribeWorkflowExecution(describeRequest); } @Override public DescribeTaskListResponse DescribeTaskList(DescribeTaskListRequest request) - throws TException { + throws BaseError { return impl.DescribeTaskList(request); } @Override - public ClusterInfo GetClusterInfo() throws InternalServiceError, ServiceBusyError, TException { + public ClusterInfo GetClusterInfo() throws InternalServiceError, ServiceBusyError, BaseError { return impl.GetClusterInfo(); } @Override public ListTaskListPartitionsResponse ListTaskListPartitions( - ListTaskListPartitionsRequest request) throws TException { + ListTaskListPartitionsRequest request) throws BaseError { return impl.ListTaskListPartitions(request); } @Override public void RefreshWorkflowTasks(RefreshWorkflowTasksRequest request) throws BadRequestError, DomainNotActiveError, ServiceBusyError, EntityNotExistsError, - TException { + BaseError { impl.RefreshWorkflowTasks(request); } @Override public void RegisterDomain( - RegisterDomainRequest registerRequest, AsyncMethodCallback resultHandler) - throws TException { + RegisterDomainRequest registerRequest, AsyncMethodCallback resultHandler) throws BaseError { impl.RegisterDomain(registerRequest, resultHandler); } @Override public void DescribeDomain( - DescribeDomainRequest describeRequest, AsyncMethodCallback resultHandler) - throws TException { + DescribeDomainRequest describeRequest, AsyncMethodCallback resultHandler) throws BaseError { impl.DescribeDomain(describeRequest, resultHandler); } @Override public void ListDomains(ListDomainsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.ListDomains(listRequest, resultHandler); } @Override public void UpdateDomain(UpdateDomainRequest updateRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.UpdateDomain(updateRequest, resultHandler); } @Override public void DeprecateDomain( DeprecateDomainRequest deprecateRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.DeprecateDomain(deprecateRequest, resultHandler); } @Override public void RestartWorkflowExecution( RestartWorkflowExecutionRequest restartRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.RestartWorkflowExecution(restartRequest, resultHandler); } @Override public void GetTaskListsByDomain( - GetTaskListsByDomainRequest request, AsyncMethodCallback resultHandler) - throws org.apache.thrift.TException { + GetTaskListsByDomainRequest request, AsyncMethodCallback resultHandler) throws BaseError { impl.GetTaskListsByDomain(request, resultHandler); } @Override public void StartWorkflowExecution( StartWorkflowExecutionRequest startRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.StartWorkflowExecution(startRequest, resultHandler); } @Override public void StartWorkflowExecutionAsync( StartWorkflowExecutionAsyncRequest startRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.StartWorkflowExecutionAsync(startRequest, resultHandler); } @@ -527,7 +445,7 @@ public void StartWorkflowExecutionWithTimeout( StartWorkflowExecutionRequest startRequest, AsyncMethodCallback resultHandler, Long timeoutInMillis) - throws TException { + throws BaseError { impl.StartWorkflowExecutionWithTimeout(startRequest, resultHandler, timeoutInMillis); } @@ -536,7 +454,7 @@ public void StartWorkflowExecutionAsyncWithTimeout( StartWorkflowExecutionAsyncRequest startAsyncRequest, AsyncMethodCallback resultHandler, Long timeoutInMillis) - throws TException { + throws BaseError { impl.StartWorkflowExecutionAsyncWithTimeout( startAsyncRequest, resultHandler, timeoutInMillis); } @@ -544,7 +462,7 @@ public void StartWorkflowExecutionAsyncWithTimeout( @Override public void GetWorkflowExecutionHistory( GetWorkflowExecutionHistoryRequest getRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.GetWorkflowExecutionHistory(getRequest, resultHandler); } @@ -553,7 +471,7 @@ public void GetWorkflowExecutionHistoryWithTimeout( GetWorkflowExecutionHistoryRequest getRequest, AsyncMethodCallback resultHandler, Long timeoutInMillis) - throws TException { + throws BaseError { impl.GetWorkflowExecutionHistoryWithTimeout(getRequest, resultHandler, timeoutInMillis); } @@ -565,98 +483,98 @@ public CompletableFuture isHealthy() { @Override public void PollForDecisionTask( PollForDecisionTaskRequest pollRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.PollForDecisionTask(pollRequest, resultHandler); } @Override public void RespondDecisionTaskCompleted( RespondDecisionTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.RespondDecisionTaskCompleted(completeRequest, resultHandler); } @Override public void RespondDecisionTaskFailed( RespondDecisionTaskFailedRequest failedRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.RespondDecisionTaskFailed(failedRequest, resultHandler); } @Override public void PollForActivityTask( PollForActivityTaskRequest pollRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.PollForActivityTask(pollRequest, resultHandler); } @Override public void RecordActivityTaskHeartbeat( RecordActivityTaskHeartbeatRequest heartbeatRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.RecordActivityTaskHeartbeat(heartbeatRequest, resultHandler); } @Override public void RecordActivityTaskHeartbeatByID( RecordActivityTaskHeartbeatByIDRequest heartbeatRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.RecordActivityTaskHeartbeatByID(heartbeatRequest, resultHandler); } @Override public void RespondActivityTaskCompleted( RespondActivityTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.RespondActivityTaskCompleted(completeRequest, resultHandler); } @Override public void RespondActivityTaskCompletedByID( RespondActivityTaskCompletedByIDRequest completeRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.RespondActivityTaskCompletedByID(completeRequest, resultHandler); } @Override public void RespondActivityTaskFailed( RespondActivityTaskFailedRequest failRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.RespondActivityTaskFailed(failRequest, resultHandler); } @Override public void RespondActivityTaskFailedByID( RespondActivityTaskFailedByIDRequest failRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.RespondActivityTaskFailedByID(failRequest, resultHandler); } @Override public void RespondActivityTaskCanceled( RespondActivityTaskCanceledRequest canceledRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.RespondActivityTaskCanceled(canceledRequest, resultHandler); } @Override public void RespondActivityTaskCanceledByID( RespondActivityTaskCanceledByIDRequest canceledRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.RespondActivityTaskCanceledByID(canceledRequest, resultHandler); } @Override public void RequestCancelWorkflowExecution( RequestCancelWorkflowExecutionRequest cancelRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.RequestCancelWorkflowExecution(cancelRequest, resultHandler); } @Override public void SignalWorkflowExecution( SignalWorkflowExecutionRequest signalRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.SignalWorkflowExecution(signalRequest, resultHandler); } @@ -665,7 +583,7 @@ public void SignalWorkflowExecutionWithTimeout( SignalWorkflowExecutionRequest signalRequest, AsyncMethodCallback resultHandler, Long timeoutInMillis) - throws TException { + throws BaseError { impl.SignalWorkflowExecutionWithTimeout(signalRequest, resultHandler, timeoutInMillis); } @@ -673,7 +591,7 @@ public void SignalWorkflowExecutionWithTimeout( public void SignalWithStartWorkflowExecution( SignalWithStartWorkflowExecutionRequest signalWithStartRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.SignalWithStartWorkflowExecution(signalWithStartRequest, resultHandler); } @@ -681,150 +599,149 @@ public void SignalWithStartWorkflowExecution( public void SignalWithStartWorkflowExecutionAsync( SignalWithStartWorkflowExecutionAsyncRequest signalWithStartRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.SignalWithStartWorkflowExecutionAsync(signalWithStartRequest, resultHandler); } @Override public void ResetWorkflowExecution( ResetWorkflowExecutionRequest resetRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.ResetWorkflowExecution(resetRequest, resultHandler); } @Override public void TerminateWorkflowExecution( TerminateWorkflowExecutionRequest terminateRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.TerminateWorkflowExecution(terminateRequest, resultHandler); } @Override public void ListOpenWorkflowExecutions( ListOpenWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.ListOpenWorkflowExecutions(listRequest, resultHandler); } @Override public void ListClosedWorkflowExecutions( ListClosedWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.ListClosedWorkflowExecutions(listRequest, resultHandler); } @Override public void ListWorkflowExecutions( ListWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.ListWorkflowExecutions(listRequest, resultHandler); } @Override public void ListArchivedWorkflowExecutions( ListArchivedWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.ListArchivedWorkflowExecutions(listRequest, resultHandler); } @Override public void ScanWorkflowExecutions( ListWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.ScanWorkflowExecutions(listRequest, resultHandler); } @Override public void CountWorkflowExecutions( CountWorkflowExecutionsRequest countRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.CountWorkflowExecutions(countRequest, resultHandler); } @Override - public void GetSearchAttributes(AsyncMethodCallback resultHandler) throws TException { + public void GetSearchAttributes(AsyncMethodCallback resultHandler) throws BaseError { impl.GetSearchAttributes(resultHandler); } @Override public void RespondQueryTaskCompleted( RespondQueryTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.RespondQueryTaskCompleted(completeRequest, resultHandler); } @Override public void ResetStickyTaskList( ResetStickyTaskListRequest resetRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.ResetStickyTaskList(resetRequest, resultHandler); } @Override public void QueryWorkflow(QueryWorkflowRequest queryRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.QueryWorkflow(queryRequest, resultHandler); } @Override public void DescribeWorkflowExecution( DescribeWorkflowExecutionRequest describeRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.DescribeWorkflowExecution(describeRequest, resultHandler); } @Override public void DescribeTaskList(DescribeTaskListRequest request, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { impl.DescribeTaskList(request, resultHandler); } @Override - public void GetClusterInfo(AsyncMethodCallback resultHandler) throws TException { + public void GetClusterInfo(AsyncMethodCallback resultHandler) throws BaseError { impl.GetClusterInfo(resultHandler); } @Override public void ListTaskListPartitions( - ListTaskListPartitionsRequest request, AsyncMethodCallback resultHandler) - throws TException { + ListTaskListPartitionsRequest request, AsyncMethodCallback resultHandler) throws BaseError { impl.ListTaskListPartitions(request, resultHandler); } @Override public void RefreshWorkflowTasks( - RefreshWorkflowTasksRequest request, AsyncMethodCallback resultHandler) throws TException { + RefreshWorkflowTasksRequest request, AsyncMethodCallback resultHandler) throws BaseError { impl.RefreshWorkflowTasks(request, resultHandler); } @Override public void RegisterDomain(RegisterDomainRequest registerRequest) - throws BadRequestError, InternalServiceError, DomainAlreadyExistsError, TException { + throws BadRequestError, InternalServiceError, DomainAlreadyExistsError, BaseError { impl.RegisterDomain(registerRequest); } @Override public DescribeDomainResponse DescribeDomain(DescribeDomainRequest describeRequest) - throws BadRequestError, InternalServiceError, EntityNotExistsError, TException { + throws BadRequestError, InternalServiceError, EntityNotExistsError, BaseError { return impl.DescribeDomain(describeRequest); } @Override public ListDomainsResponse ListDomains(ListDomainsRequest listRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, - TException { + BaseError { return impl.ListDomains(listRequest); } @Override public UpdateDomainResponse UpdateDomain(UpdateDomainRequest updateRequest) - throws BadRequestError, InternalServiceError, EntityNotExistsError, TException { + throws BadRequestError, InternalServiceError, EntityNotExistsError, BaseError { return impl.UpdateDomain(updateRequest); } @Override public void DeprecateDomain(DeprecateDomainRequest deprecateRequest) - throws BadRequestError, InternalServiceError, EntityNotExistsError, TException { + throws BadRequestError, InternalServiceError, EntityNotExistsError, BaseError { impl.DeprecateDomain(deprecateRequest); } @@ -832,14 +749,14 @@ public void DeprecateDomain(DeprecateDomainRequest deprecateRequest) public RestartWorkflowExecutionResponse RestartWorkflowExecution( RestartWorkflowExecutionRequest restartRequest) throws BadRequestError, ServiceBusyError, DomainNotActiveError, LimitExceededError, - EntityNotExistsError, ClientVersionNotSupportedError, TException { + EntityNotExistsError, ClientVersionNotSupportedError, BaseError { return impl.RestartWorkflowExecution(restartRequest); } @Override public GetTaskListsByDomainResponse GetTaskListsByDomain(GetTaskListsByDomainRequest request) throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { return impl.GetTaskListsByDomain(request); } @@ -847,7 +764,7 @@ public GetTaskListsByDomainResponse GetTaskListsByDomain(GetTaskListsByDomainReq public StartWorkflowExecutionResponse StartWorkflowExecution( StartWorkflowExecutionRequest startRequest) throws BadRequestError, InternalServiceError, WorkflowExecutionAlreadyStartedError, - ServiceBusyError, TException { + ServiceBusyError, BaseError { return impl.StartWorkflowExecution(startRequest); } @@ -856,7 +773,7 @@ public StartWorkflowExecutionAsyncResponse StartWorkflowExecutionAsync( StartWorkflowExecutionAsyncRequest startRequest) throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError, DomainNotActiveError, LimitExceededError, EntityNotExistsError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { return impl.StartWorkflowExecutionAsync(startRequest); } @@ -864,7 +781,7 @@ public StartWorkflowExecutionAsyncResponse StartWorkflowExecutionAsync( public GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistory( GetWorkflowExecutionHistoryRequest getRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, - TException { + BaseError { return impl.GetWorkflowExecutionHistory(getRequest); } @@ -872,13 +789,13 @@ public GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistory( public GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistoryWithTimeout( GetWorkflowExecutionHistoryRequest getRequest, Long timeoutInMillis) throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, - TException { + BaseError { return impl.GetWorkflowExecutionHistoryWithTimeout(getRequest, timeoutInMillis); } @Override public PollForDecisionTaskResponse PollForDecisionTask(PollForDecisionTaskRequest pollRequest) - throws BadRequestError, InternalServiceError, ServiceBusyError, TException { + throws BadRequestError, InternalServiceError, ServiceBusyError, BaseError { return impl.PollForDecisionTask(pollRequest); } @@ -886,20 +803,20 @@ public PollForDecisionTaskResponse PollForDecisionTask(PollForDecisionTaskReques public RespondDecisionTaskCompletedResponse RespondDecisionTaskCompleted( RespondDecisionTaskCompletedRequest completeRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, - WorkflowExecutionAlreadyCompletedError, TException { + WorkflowExecutionAlreadyCompletedError, BaseError { return impl.RespondDecisionTaskCompleted(completeRequest); } @Override public void RespondDecisionTaskFailed(RespondDecisionTaskFailedRequest failedRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, - WorkflowExecutionAlreadyCompletedError, TException { + WorkflowExecutionAlreadyCompletedError, BaseError { impl.RespondDecisionTaskFailed(failedRequest); } @Override public PollForActivityTaskResponse PollForActivityTask(PollForActivityTaskRequest pollRequest) - throws BadRequestError, InternalServiceError, ServiceBusyError, TException { + throws BadRequestError, InternalServiceError, ServiceBusyError, BaseError { return impl.PollForActivityTask(pollRequest); } diff --git a/src/main/java/com/uber/cadence/internal/sync/WorkflowClientInternal.java b/src/main/java/com/uber/cadence/internal/sync/WorkflowClientInternal.java index 4ae73d944..f4a716226 100644 --- a/src/main/java/com/uber/cadence/internal/sync/WorkflowClientInternal.java +++ b/src/main/java/com/uber/cadence/internal/sync/WorkflowClientInternal.java @@ -19,6 +19,7 @@ import com.google.common.base.Strings; import com.google.common.reflect.TypeToken; +import com.uber.cadence.BaseError; import com.uber.cadence.RefreshWorkflowTasksRequest; import com.uber.cadence.WorkflowExecution; import com.uber.cadence.client.ActivityCompletionClient; @@ -46,7 +47,6 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; -import org.apache.thrift.TException; public final class WorkflowClientInternal implements WorkflowClient { @@ -220,7 +220,7 @@ public WorkflowExecution enqueueSignalWithStart(BatchRequest signalWithStartBatc @Override public void refreshWorkflowTasks(RefreshWorkflowTasksRequest refreshWorkflowTasksRequest) - throws TException { + throws BaseError { workflowService.RefreshWorkflowTasks(refreshWorkflowTasksRequest); } diff --git a/src/main/java/com/uber/cadence/internal/sync/WorkflowStubImpl.java b/src/main/java/com/uber/cadence/internal/sync/WorkflowStubImpl.java index 23d270615..ede342105 100644 --- a/src/main/java/com/uber/cadence/internal/sync/WorkflowStubImpl.java +++ b/src/main/java/com/uber/cadence/internal/sync/WorkflowStubImpl.java @@ -555,7 +555,7 @@ public R queryWithOptions( throw e; } - if (result.queryRejected == null) { + if (result.getQueryRejected() == null) { return dataConverter.fromData(result.getQueryResult(), resultClass, resultType); } else { throw new WorkflowQueryRejectedException( diff --git a/src/main/java/com/uber/cadence/internal/testservice/StateMachines.java b/src/main/java/com/uber/cadence/internal/testservice/StateMachines.java index d0667112d..df3847448 100644 --- a/src/main/java/com/uber/cadence/internal/testservice/StateMachines.java +++ b/src/main/java/com/uber/cadence/internal/testservice/StateMachines.java @@ -360,7 +360,7 @@ private static void startChildWorkflowFailed( a.setInitiatedEventId(data.initiatedEventId); a.setWorkflowType(data.initiatedEvent.getWorkflowType()); a.setWorkflowId(data.initiatedEvent.getWorkflowId()); - if (data.initiatedEvent.isSetDomain()) { + if (data.initiatedEvent.getDomain() != null) { a.setDomain(data.initiatedEvent.getDomain()); } HistoryEvent event = @@ -410,8 +410,8 @@ private static void childWorkflowFailed( a.setStartedEventId(data.startedEventId); a.setWorkflowExecution(data.execution); a.setWorkflowType(data.initiatedEvent.getWorkflowType()); - if (data.initiatedEvent.domain != null) { - a.setDomain(data.initiatedEvent.domain); + if (data.initiatedEvent.getDomain() != null) { + a.setDomain(data.initiatedEvent.getDomain()); } HistoryEvent event = new HistoryEvent() @@ -477,7 +477,7 @@ private static void initiateChildWorkflow( .setRetryPolicy(d.getRetryPolicy()) .setCronSchedule(d.getCronSchedule()) .setHeader(d.getHeader()); - if (d.isSetInput()) { + if (d.getInput() != null) { startChild.setInput(d.getInput()); } addStartChildTask(ctx, data, initiatedEventId, startChild); @@ -520,26 +520,26 @@ private static void startWorkflow( RequestContext ctx, WorkflowData data, StartWorkflowExecutionRequest request, long notUsed) throws BadRequestError { WorkflowExecutionStartedEventAttributes a = new WorkflowExecutionStartedEventAttributes(); - if (request.isSetIdentity()) { + if (request.getIdentity() != null) { a.setIdentity(request.getIdentity()); } - if (!request.isSetTaskStartToCloseTimeoutSeconds()) { + if (request.getTaskStartToCloseTimeoutSeconds() == 0) { throw new BadRequestError("missing taskStartToCloseTimeoutSeconds"); } a.setTaskStartToCloseTimeoutSeconds(request.getTaskStartToCloseTimeoutSeconds()); - if (!request.isSetWorkflowType()) { + if (request.getWorkflowType() == null) { throw new BadRequestError("missing workflowType"); } a.setWorkflowType(request.getWorkflowType()); - if (!request.isSetTaskList()) { + if (request.getTaskList() == null) { throw new BadRequestError("missing taskList"); } a.setTaskList(request.getTaskList()); - if (!request.isSetExecutionStartToCloseTimeoutSeconds()) { + if (request.getExecutionStartToCloseTimeoutSeconds() == 0) { throw new BadRequestError("missing executionStartToCloseTimeoutSeconds"); } a.setExecutionStartToCloseTimeoutSeconds(request.getExecutionStartToCloseTimeoutSeconds()); - if (request.isSetInput()) { + if (request.getInput() != null) { a.setInput(request.getInput()); } if (data.retryState.isPresent()) { @@ -592,22 +592,22 @@ private static void continueAsNewWorkflow( WorkflowExecutionContinuedAsNewEventAttributes a = new WorkflowExecutionContinuedAsNewEventAttributes(); a.setInput(d.getInput()); - if (d.isSetExecutionStartToCloseTimeoutSeconds()) { + if (d.getExecutionStartToCloseTimeoutSeconds() > 0) { a.setExecutionStartToCloseTimeoutSeconds(d.getExecutionStartToCloseTimeoutSeconds()); } else { a.setExecutionStartToCloseTimeoutSeconds(sr.getExecutionStartToCloseTimeoutSeconds()); } - if (d.isSetTaskList()) { + if (d.getTaskList() != null) { a.setTaskList(d.getTaskList()); } else { a.setTaskList(sr.getTaskList()); } - if (d.isSetWorkflowType()) { + if (d.getWorkflowType() != null) { a.setWorkflowType(d.getWorkflowType()); } else { a.setWorkflowType(sr.getWorkflowType()); } - if (d.isSetTaskStartToCloseTimeoutSeconds()) { + if (d.getTaskStartToCloseTimeoutSeconds() > 0) { a.setTaskStartToCloseTimeoutSeconds(d.getTaskStartToCloseTimeoutSeconds()); } else { a.setTaskStartToCloseTimeoutSeconds(sr.getTaskStartToCloseTimeoutSeconds()); @@ -735,7 +735,7 @@ private static void scheduleActivityTask( PollForActivityTaskResponse taskResponse = new PollForActivityTaskResponse() .setWorkflowDomain(ctx.getDomain()) - .setWorkflowType(data.startWorkflowExecutionRequest.workflowType) + .setWorkflowType(data.startWorkflowExecutionRequest.getWorkflowType()) .setActivityType(d.getActivityType()) .setWorkflowExecution(ctx.getExecution()) .setActivityId(d.getActivityId()) @@ -1155,16 +1155,16 @@ private static void initiateExternalSignal( SignalExternalWorkflowExecutionInitiatedEventAttributes a = new SignalExternalWorkflowExecutionInitiatedEventAttributes(); a.setDecisionTaskCompletedEventId(decisionTaskCompletedEventId); - if (d.isSetControl()) { + if (d.getControl() != null) { a.setControl(d.getControl()); } - if (d.isSetInput()) { + if (d.getInput() != null) { a.setInput(d.getInput()); } - if (d.isSetDomain()) { + if (d.getDomain() != null) { a.setDomain(d.getDomain()); } - if (d.isSetChildWorkflowOnly()) { + if (d.isChildWorkflowOnly()) { a.setChildWorkflowOnly(d.isChildWorkflowOnly()); } a.setSignalName(d.getSignalName()); @@ -1205,7 +1205,9 @@ private static void completeExternalSignal( RequestContext ctx, SignalExternalData data, String runId, long notUsed) { SignalExternalWorkflowExecutionInitiatedEventAttributes initiatedEvent = data.initiatedEvent; WorkflowExecution signaledExecution = - initiatedEvent.getWorkflowExecution().deepCopy().setRunId(runId); + new WorkflowExecution() + .setWorkflowId(initiatedEvent.getWorkflowExecution().getWorkflowId()) + .setRunId(runId); ExternalWorkflowExecutionSignaledEventAttributes a = new ExternalWorkflowExecutionSignaledEventAttributes() .setInitiatedEventId(data.initiatedEventId) diff --git a/src/main/java/com/uber/cadence/internal/testservice/TestWorkflowMutableState.java b/src/main/java/com/uber/cadence/internal/testservice/TestWorkflowMutableState.java index f662ebedd..b9268204c 100644 --- a/src/main/java/com/uber/cadence/internal/testservice/TestWorkflowMutableState.java +++ b/src/main/java/com/uber/cadence/internal/testservice/TestWorkflowMutableState.java @@ -17,42 +17,9 @@ package com.uber.cadence.internal.testservice; -import com.uber.cadence.BadRequestError; -import com.uber.cadence.ChildWorkflowExecutionCanceledEventAttributes; -import com.uber.cadence.ChildWorkflowExecutionCompletedEventAttributes; -import com.uber.cadence.ChildWorkflowExecutionFailedEventAttributes; -import com.uber.cadence.ChildWorkflowExecutionStartedEventAttributes; -import com.uber.cadence.ChildWorkflowExecutionTimedOutEventAttributes; -import com.uber.cadence.EntityNotExistsError; -import com.uber.cadence.InternalServiceError; -import com.uber.cadence.PollForActivityTaskRequest; -import com.uber.cadence.PollForActivityTaskResponse; -import com.uber.cadence.PollForDecisionTaskRequest; -import com.uber.cadence.PollForDecisionTaskResponse; -import com.uber.cadence.QueryWorkflowRequest; -import com.uber.cadence.QueryWorkflowResponse; -import com.uber.cadence.RecordActivityTaskHeartbeatResponse; -import com.uber.cadence.RequestCancelWorkflowExecutionRequest; -import com.uber.cadence.RespondActivityTaskCanceledByIDRequest; -import com.uber.cadence.RespondActivityTaskCanceledRequest; -import com.uber.cadence.RespondActivityTaskCompletedByIDRequest; -import com.uber.cadence.RespondActivityTaskCompletedRequest; -import com.uber.cadence.RespondActivityTaskFailedByIDRequest; -import com.uber.cadence.RespondActivityTaskFailedRequest; -import com.uber.cadence.RespondDecisionTaskCompletedRequest; -import com.uber.cadence.RespondDecisionTaskFailedRequest; -import com.uber.cadence.RespondQueryTaskCompletedRequest; -import com.uber.cadence.SignalExternalWorkflowExecutionDecisionAttributes; -import com.uber.cadence.SignalExternalWorkflowExecutionFailedCause; -import com.uber.cadence.SignalWorkflowExecutionRequest; -import com.uber.cadence.StartChildWorkflowExecutionFailedEventAttributes; -import com.uber.cadence.StartWorkflowExecutionRequest; -import com.uber.cadence.StickyExecutionAttributes; -import com.uber.cadence.WorkflowExecutionAlreadyCompletedError; -import com.uber.cadence.WorkflowExecutionCloseStatus; +import com.uber.cadence.*; import com.uber.cadence.internal.testservice.TestWorkflowMutableStateImpl.QueryId; import java.util.Optional; -import org.apache.thrift.TException; interface TestWorkflowMutableState { @@ -156,7 +123,7 @@ void cancelActivityTaskById(String id, RespondActivityTaskCanceledByIDRequest ca throws EntityNotExistsError, InternalServiceError, WorkflowExecutionAlreadyCompletedError, BadRequestError; - QueryWorkflowResponse query(QueryWorkflowRequest queryRequest) throws TException; + QueryWorkflowResponse query(QueryWorkflowRequest queryRequest) throws BaseError; void completeQuery(QueryId queryId, RespondQueryTaskCompletedRequest completeRequest) throws EntityNotExistsError; diff --git a/src/main/java/com/uber/cadence/internal/testservice/TestWorkflowMutableStateImpl.java b/src/main/java/com/uber/cadence/internal/testservice/TestWorkflowMutableStateImpl.java index 79ac3dd26..482095acb 100644 --- a/src/main/java/com/uber/cadence/internal/testservice/TestWorkflowMutableStateImpl.java +++ b/src/main/java/com/uber/cadence/internal/testservice/TestWorkflowMutableStateImpl.java @@ -27,72 +27,7 @@ import com.cronutils.parser.CronParser; import com.google.common.base.Strings; import com.google.common.base.Throwables; -import com.uber.cadence.ActivityTaskScheduledEventAttributes; -import com.uber.cadence.BadRequestError; -import com.uber.cadence.CancelTimerDecisionAttributes; -import com.uber.cadence.CancelTimerFailedEventAttributes; -import com.uber.cadence.CancelWorkflowExecutionDecisionAttributes; -import com.uber.cadence.ChildWorkflowExecutionCanceledEventAttributes; -import com.uber.cadence.ChildWorkflowExecutionCompletedEventAttributes; -import com.uber.cadence.ChildWorkflowExecutionFailedEventAttributes; -import com.uber.cadence.ChildWorkflowExecutionStartedEventAttributes; -import com.uber.cadence.ChildWorkflowExecutionTimedOutEventAttributes; -import com.uber.cadence.CompleteWorkflowExecutionDecisionAttributes; -import com.uber.cadence.ContinueAsNewWorkflowExecutionDecisionAttributes; -import com.uber.cadence.Decision; -import com.uber.cadence.DecisionTaskFailedCause; -import com.uber.cadence.EntityNotExistsError; -import com.uber.cadence.EventType; -import com.uber.cadence.FailWorkflowExecutionDecisionAttributes; -import com.uber.cadence.HistoryEvent; -import com.uber.cadence.InternalServiceError; -import com.uber.cadence.MarkerRecordedEventAttributes; -import com.uber.cadence.PollForActivityTaskRequest; -import com.uber.cadence.PollForActivityTaskResponse; -import com.uber.cadence.PollForDecisionTaskRequest; -import com.uber.cadence.PollForDecisionTaskResponse; -import com.uber.cadence.QueryConsistencyLevel; -import com.uber.cadence.QueryFailedError; -import com.uber.cadence.QueryRejectCondition; -import com.uber.cadence.QueryRejected; -import com.uber.cadence.QueryResultType; -import com.uber.cadence.QueryTaskCompletedType; -import com.uber.cadence.QueryWorkflowRequest; -import com.uber.cadence.QueryWorkflowResponse; -import com.uber.cadence.RecordActivityTaskHeartbeatResponse; -import com.uber.cadence.RecordMarkerDecisionAttributes; -import com.uber.cadence.RequestCancelActivityTaskDecisionAttributes; -import com.uber.cadence.RequestCancelActivityTaskFailedEventAttributes; -import com.uber.cadence.RequestCancelExternalWorkflowExecutionDecisionAttributes; -import com.uber.cadence.RequestCancelWorkflowExecutionRequest; -import com.uber.cadence.RespondActivityTaskCanceledByIDRequest; -import com.uber.cadence.RespondActivityTaskCanceledRequest; -import com.uber.cadence.RespondActivityTaskCompletedByIDRequest; -import com.uber.cadence.RespondActivityTaskCompletedRequest; -import com.uber.cadence.RespondActivityTaskFailedByIDRequest; -import com.uber.cadence.RespondActivityTaskFailedRequest; -import com.uber.cadence.RespondDecisionTaskCompletedRequest; -import com.uber.cadence.RespondDecisionTaskFailedRequest; -import com.uber.cadence.RespondQueryTaskCompletedRequest; -import com.uber.cadence.ScheduleActivityTaskDecisionAttributes; -import com.uber.cadence.SignalExternalWorkflowExecutionDecisionAttributes; -import com.uber.cadence.SignalExternalWorkflowExecutionFailedCause; -import com.uber.cadence.SignalWorkflowExecutionRequest; -import com.uber.cadence.StartChildWorkflowExecutionDecisionAttributes; -import com.uber.cadence.StartChildWorkflowExecutionFailedEventAttributes; -import com.uber.cadence.StartTimerDecisionAttributes; -import com.uber.cadence.StartWorkflowExecutionRequest; -import com.uber.cadence.StickyExecutionAttributes; -import com.uber.cadence.TimeoutType; -import com.uber.cadence.UpsertWorkflowSearchAttributesDecisionAttributes; -import com.uber.cadence.UpsertWorkflowSearchAttributesEventAttributes; -import com.uber.cadence.WorkflowExecution; -import com.uber.cadence.WorkflowExecutionAlreadyCompletedError; -import com.uber.cadence.WorkflowExecutionCloseStatus; -import com.uber.cadence.WorkflowExecutionContinuedAsNewEventAttributes; -import com.uber.cadence.WorkflowExecutionSignaledEventAttributes; -import com.uber.cadence.WorkflowQuery; -import com.uber.cadence.WorkflowQueryResult; +import com.uber.cadence.*; import com.uber.cadence.internal.common.WorkflowExecutionUtils; import com.uber.cadence.internal.testservice.StateMachines.Action; import com.uber.cadence.internal.testservice.StateMachines.ActivityTaskData; @@ -128,7 +63,6 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import java.util.function.LongSupplier; -import org.apache.thrift.TException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -331,7 +265,7 @@ public void completeDecisionTask(int historySize, RespondDecisionTaskCompletedRe List decisions = request.getDecisions(); completeDecisionUpdate( ctx -> { - if (request.getQueryResultsSize() > 0) { + if (request.getQueryResults() != null && request.getQueryResults().size() > 0) { request .getQueryResults() .forEach( @@ -403,8 +337,7 @@ private void completeQuery(String queryId, WorkflowQueryResult queryResult) { if (queryResult.getResultType() == QueryResultType.ANSWERED) { future.complete(new QueryWorkflowResponse().setQueryResult(queryResult.getAnswer())); } else { - future.completeExceptionally( - new QueryFailedError().setMessage(queryResult.getErrorMessage())); + future.completeExceptionally(new QueryFailedError(queryResult.getErrorMessage())); } } @@ -487,7 +420,7 @@ private void processRequestCancelExternalWorkflowExecution( RequestCancelWorkflowExecutionRequest request = new RequestCancelWorkflowExecutionRequest(); WorkflowExecution workflowExecution = new WorkflowExecution(); - workflowExecution.setWorkflowId(attr.workflowId); + workflowExecution.setWorkflowId(attr.getWorkflowId()); request.setWorkflowExecution(workflowExecution); request.setDomain(ctx.getDomain()); try { @@ -501,7 +434,7 @@ private void processRequestCancelExternalWorkflowExecution( private void processRecordMarker( RequestContext ctx, RecordMarkerDecisionAttributes attr, long decisionTaskCompletedId) throws BadRequestError { - if (!attr.isSetMarkerName()) { + if (attr.getMarkerName() == null) { throw new BadRequestError("marker name is required"); } @@ -1484,7 +1417,7 @@ public void requestCancelWorkflowExecution(RequestCancelWorkflowExecutionRequest } @Override - public QueryWorkflowResponse query(QueryWorkflowRequest queryRequest) throws TException { + public QueryWorkflowResponse query(QueryWorkflowRequest queryRequest) throws BaseError { QueryId queryId = new QueryId(executionId); Optional optCloseStatus = getCloseStatus(); @@ -1530,8 +1463,8 @@ public QueryWorkflowResponse query(QueryWorkflowRequest queryRequest) throws TEx return new QueryWorkflowResponse(); } catch (ExecutionException e) { Throwable cause = e.getCause(); - if (cause instanceof TException) { - throw (TException) cause; + if (cause instanceof BaseError) { + throw (BaseError) cause; } throw new InternalServiceError(Throwables.getStackTraceAsString(cause)); } @@ -1556,7 +1489,7 @@ public void completeQuery(QueryId queryId, RespondQueryTaskCompletedRequest comp new TaskListId(startRequest.getDomain(), startRequest.getTaskList().getName()); store.sendQueryTask(executionId, taskListId, task); } else { - QueryFailedError error = new QueryFailedError().setMessage(completeRequest.getErrorMessage()); + QueryFailedError error = new QueryFailedError(completeRequest.getErrorMessage()); result.completeExceptionally(error); } } 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..398dc9080 100644 --- a/src/main/java/com/uber/cadence/internal/testservice/TestWorkflowService.java +++ b/src/main/java/com/uber/cadence/internal/testservice/TestWorkflowService.java @@ -18,6 +18,7 @@ package com.uber.cadence.internal.testservice; import com.uber.cadence.BadRequestError; +import com.uber.cadence.BaseError; import com.uber.cadence.ClientVersionNotSupportedError; import com.uber.cadence.ClusterInfo; import com.uber.cadence.CountWorkflowExecutionsRequest; @@ -105,6 +106,7 @@ import com.uber.cadence.WorkflowIdReusePolicy; import com.uber.cadence.internal.testservice.TestWorkflowMutableStateImpl.QueryId; import com.uber.cadence.internal.testservice.TestWorkflowStore.WorkflowState; +import com.uber.cadence.serviceclient.AsyncMethodCallback; import com.uber.cadence.serviceclient.ClientOptions; import com.uber.cadence.serviceclient.IWorkflowService; import java.time.Duration; @@ -119,8 +121,6 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -196,32 +196,32 @@ private TestWorkflowMutableState getMutableState(WorkflowId workflowId, boolean @Override public void RegisterDomain(RegisterDomainRequest registerRequest) - throws BadRequestError, InternalServiceError, DomainAlreadyExistsError, TException { + throws BadRequestError, InternalServiceError, DomainAlreadyExistsError, BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public DescribeDomainResponse DescribeDomain(DescribeDomainRequest describeRequest) - throws BadRequestError, InternalServiceError, EntityNotExistsError, TException { + throws BadRequestError, InternalServiceError, EntityNotExistsError, BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public ListDomainsResponse ListDomains(ListDomainsRequest listRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, - TException { + BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public UpdateDomainResponse UpdateDomain(UpdateDomainRequest updateRequest) - throws BadRequestError, InternalServiceError, EntityNotExistsError, TException { + throws BadRequestError, InternalServiceError, EntityNotExistsError, BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void DeprecateDomain(DeprecateDomainRequest deprecateRequest) - throws BadRequestError, InternalServiceError, EntityNotExistsError, TException { + throws BadRequestError, InternalServiceError, EntityNotExistsError, BaseError { throw new UnsupportedOperationException("not implemented"); } @@ -229,20 +229,20 @@ public void DeprecateDomain(DeprecateDomainRequest deprecateRequest) public RestartWorkflowExecutionResponse RestartWorkflowExecution( RestartWorkflowExecutionRequest restartRequest) throws BadRequestError, ServiceBusyError, DomainNotActiveError, LimitExceededError, - EntityNotExistsError, ClientVersionNotSupportedError, TException { + EntityNotExistsError, ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public GetTaskListsByDomainResponse GetTaskListsByDomain(GetTaskListsByDomainRequest request) throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public StartWorkflowExecutionResponse StartWorkflowExecution( - StartWorkflowExecutionRequest startRequest) throws TException { + StartWorkflowExecutionRequest startRequest) throws BaseError { return startWorkflowExecutionImpl( startRequest, 0, Optional.empty(), OptionalLong.empty(), Optional.empty()); } @@ -252,7 +252,7 @@ public StartWorkflowExecutionAsyncResponse StartWorkflowExecutionAsync( StartWorkflowExecutionAsyncRequest startRequest) throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError, DomainNotActiveError, LimitExceededError, EntityNotExistsError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { // Just run it StartWorkflowExecution(startRequest.getRequest()); return new StartWorkflowExecutionAsyncResponse(); @@ -275,7 +275,7 @@ StartWorkflowExecutionResponse startWorkflowExecutionImpl( if (existing != null) { Optional statusOptional = existing.getCloseStatus(); WorkflowIdReusePolicy policy = - startRequest.isSetWorkflowIdReusePolicy() + startRequest.getWorkflowIdReusePolicy() != null ? startRequest.getWorkflowIdReusePolicy() : WorkflowIdReusePolicy.AllowDuplicateFailedOnly; if (!statusOptional.isPresent() || policy == WorkflowIdReusePolicy.RejectDuplicate) { @@ -318,11 +318,11 @@ private Optional newRetryStateLocked(RetryPolicy retryPolicy) throws private StartWorkflowExecutionResponse throwDuplicatedWorkflow( StartWorkflowExecutionRequest startRequest, TestWorkflowMutableState existing) throws WorkflowExecutionAlreadyStartedError { - WorkflowExecutionAlreadyStartedError error = new WorkflowExecutionAlreadyStartedError(); WorkflowExecution execution = existing.getExecutionId().getExecution(); - error.setMessage( - String.format( - "WorkflowId: %s, " + "RunId: %s", execution.getWorkflowId(), execution.getRunId())); + WorkflowExecutionAlreadyStartedError error = + new WorkflowExecutionAlreadyStartedError( + String.format( + "WorkflowId: %s, " + "RunId: %s", execution.getWorkflowId(), execution.getRunId())); error.setRunId(execution.getRunId()); error.setStartRequestId(startRequest.getRequestId()); throw error; @@ -363,7 +363,7 @@ private StartWorkflowExecutionResponse startWorkflowExecutionNoRunningCheckLocke public GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistory( GetWorkflowExecutionHistoryRequest getRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, - TException { + BaseError { ExecutionId executionId = new ExecutionId(getRequest.getDomain(), getRequest.getExecution()); TestWorkflowMutableState mutableState = getMutableState(executionId); @@ -374,14 +374,14 @@ public GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistory( public GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistoryWithTimeout( GetWorkflowExecutionHistoryRequest getRequest, Long timeoutInMillis) throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, - TException { + BaseError { return GetWorkflowExecutionHistory(getRequest); } @Override public PollForDecisionTaskResponse PollForDecisionTask(PollForDecisionTaskRequest pollRequest) - throws BadRequestError, InternalServiceError, ServiceBusyError, TException { + throws BadRequestError, InternalServiceError, ServiceBusyError, BaseError { PollForDecisionTaskResponse task; try { task = store.pollForDecisionTask(pollRequest); @@ -395,7 +395,7 @@ public PollForDecisionTaskResponse PollForDecisionTask(PollForDecisionTaskReques // The task always has the original tasklist is was created on as part of the response. This // may different // then the task list it was scheduled on as in the case of sticky execution. - task.setWorkflowExecutionTaskList(mutableState.getStartRequest().taskList); + task.setWorkflowExecutionTaskList(mutableState.getStartRequest().getTaskList()); return task; } catch (EntityNotExistsError e) { if (log.isDebugEnabled()) { @@ -403,14 +403,14 @@ public PollForDecisionTaskResponse PollForDecisionTask(PollForDecisionTaskReques } // skip the task } - task.setWorkflowExecutionTaskList(mutableState.getStartRequest().taskList); + task.setWorkflowExecutionTaskList(mutableState.getStartRequest().getTaskList()); return task; } @Override public RespondDecisionTaskCompletedResponse RespondDecisionTaskCompleted( RespondDecisionTaskCompletedRequest request) - throws BadRequestError, InternalServiceError, EntityNotExistsError, TException { + throws BadRequestError, InternalServiceError, EntityNotExistsError, BaseError { DecisionTaskToken taskToken = DecisionTaskToken.fromBytes(request.getTaskToken()); TestWorkflowMutableState mutableState = getMutableState(taskToken.getExecutionId()); mutableState.completeDecisionTask(taskToken.getHistorySize(), request); @@ -419,7 +419,7 @@ public RespondDecisionTaskCompletedResponse RespondDecisionTaskCompleted( @Override public void RespondDecisionTaskFailed(RespondDecisionTaskFailedRequest failedRequest) - throws BadRequestError, InternalServiceError, EntityNotExistsError, TException { + throws BadRequestError, InternalServiceError, EntityNotExistsError, BaseError { DecisionTaskToken taskToken = DecisionTaskToken.fromBytes(failedRequest.getTaskToken()); TestWorkflowMutableState mutableState = getMutableState(taskToken.getExecutionId()); mutableState.failDecisionTask(failedRequest); @@ -427,7 +427,7 @@ public void RespondDecisionTaskFailed(RespondDecisionTaskFailedRequest failedReq @Override public PollForActivityTaskResponse PollForActivityTask(PollForActivityTaskRequest pollRequest) - throws BadRequestError, InternalServiceError, ServiceBusyError, TException { + throws BadRequestError, InternalServiceError, ServiceBusyError, BaseError { PollForActivityTaskResponse task; while (true) { try { @@ -452,7 +452,7 @@ public PollForActivityTaskResponse PollForActivityTask(PollForActivityTaskReques @Override public RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeat( RecordActivityTaskHeartbeatRequest heartbeatRequest) - throws BadRequestError, InternalServiceError, EntityNotExistsError, TException { + throws BadRequestError, InternalServiceError, EntityNotExistsError, BaseError { ActivityId activityId = ActivityId.fromBytes(heartbeatRequest.getTaskToken()); TestWorkflowMutableState mutableState = getMutableState(activityId.getExecutionId()); return mutableState.heartbeatActivityTask(activityId.getId(), heartbeatRequest.getDetails()); @@ -462,7 +462,7 @@ public RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeat( public RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeatByID( RecordActivityTaskHeartbeatByIDRequest heartbeatRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, DomainNotActiveError, - LimitExceededError, ServiceBusyError, TException { + LimitExceededError, ServiceBusyError, BaseError { ExecutionId execution = new ExecutionId( heartbeatRequest.getDomain(), @@ -475,7 +475,7 @@ public RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeatByID( @Override public void RespondActivityTaskCompleted(RespondActivityTaskCompletedRequest completeRequest) - throws BadRequestError, InternalServiceError, EntityNotExistsError, TException { + throws BadRequestError, InternalServiceError, EntityNotExistsError, BaseError { ActivityId activityId = ActivityId.fromBytes(completeRequest.getTaskToken()); TestWorkflowMutableState mutableState = getMutableState(activityId.getExecutionId()); mutableState.completeActivityTask(activityId.getId(), completeRequest); @@ -484,7 +484,7 @@ public void RespondActivityTaskCompleted(RespondActivityTaskCompletedRequest com @Override public void RespondActivityTaskCompletedByID( RespondActivityTaskCompletedByIDRequest completeRequest) - throws BadRequestError, InternalServiceError, EntityNotExistsError, TException { + throws BadRequestError, InternalServiceError, EntityNotExistsError, BaseError { ActivityId activityId = new ActivityId( completeRequest.getDomain(), @@ -497,7 +497,7 @@ public void RespondActivityTaskCompletedByID( @Override public void RespondActivityTaskFailed(RespondActivityTaskFailedRequest failRequest) - throws BadRequestError, InternalServiceError, EntityNotExistsError, TException { + throws BadRequestError, InternalServiceError, EntityNotExistsError, BaseError { ActivityId activityId = ActivityId.fromBytes(failRequest.getTaskToken()); TestWorkflowMutableState mutableState = getMutableState(activityId.getExecutionId()); mutableState.failActivityTask(activityId.getId(), failRequest); @@ -505,7 +505,7 @@ public void RespondActivityTaskFailed(RespondActivityTaskFailedRequest failReque @Override public void RespondActivityTaskFailedByID(RespondActivityTaskFailedByIDRequest failRequest) - throws BadRequestError, InternalServiceError, EntityNotExistsError, TException { + throws BadRequestError, InternalServiceError, EntityNotExistsError, BaseError { ActivityId activityId = new ActivityId( failRequest.getDomain(), @@ -518,7 +518,7 @@ public void RespondActivityTaskFailedByID(RespondActivityTaskFailedByIDRequest f @Override public void RespondActivityTaskCanceled(RespondActivityTaskCanceledRequest canceledRequest) - throws BadRequestError, InternalServiceError, EntityNotExistsError, TException { + throws BadRequestError, InternalServiceError, EntityNotExistsError, BaseError { ActivityId activityId = ActivityId.fromBytes(canceledRequest.getTaskToken()); TestWorkflowMutableState mutableState = getMutableState(activityId.getExecutionId()); mutableState.cancelActivityTask(activityId.getId(), canceledRequest); @@ -527,7 +527,7 @@ public void RespondActivityTaskCanceled(RespondActivityTaskCanceledRequest cance @Override public void RespondActivityTaskCanceledByID( RespondActivityTaskCanceledByIDRequest canceledRequest) - throws BadRequestError, InternalServiceError, EntityNotExistsError, TException { + throws BadRequestError, InternalServiceError, EntityNotExistsError, BaseError { ActivityId activityId = new ActivityId( canceledRequest.getDomain(), @@ -540,7 +540,7 @@ public void RespondActivityTaskCanceledByID( @Override public void RequestCancelWorkflowExecution(RequestCancelWorkflowExecutionRequest cancelRequest) - throws TException { + throws BaseError { ExecutionId executionId = new ExecutionId(cancelRequest.getDomain(), cancelRequest.getWorkflowExecution()); TestWorkflowMutableState mutableState = getMutableState(executionId); @@ -549,7 +549,7 @@ public void RequestCancelWorkflowExecution(RequestCancelWorkflowExecutionRequest @Override public void SignalWorkflowExecution(SignalWorkflowExecutionRequest signalRequest) - throws TException { + throws BaseError { ExecutionId executionId = new ExecutionId(signalRequest.getDomain(), signalRequest.getWorkflowExecution()); TestWorkflowMutableState mutableState = getMutableState(executionId); @@ -561,7 +561,7 @@ public StartWorkflowExecutionResponse SignalWithStartWorkflowExecution( SignalWithStartWorkflowExecutionRequest r) throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, LimitExceededError, WorkflowExecutionAlreadyStartedError, - TException { + BaseError { ExecutionId executionId = new ExecutionId(r.getDomain(), r.getWorkflowId(), null); TestWorkflowMutableState mutableState = getMutableState(executionId, false); SignalWorkflowExecutionRequest signalRequest = @@ -601,7 +601,7 @@ public SignalWithStartWorkflowExecutionAsyncResponse SignalWithStartWorkflowExec SignalWithStartWorkflowExecutionAsyncRequest signalWithStartRequest) throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError, DomainNotActiveError, LimitExceededError, EntityNotExistsError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { SignalWithStartWorkflowExecution(signalWithStartRequest.getRequest()); return new SignalWithStartWorkflowExecutionAsyncResponse(); } @@ -611,7 +611,7 @@ public SignalWithStartWorkflowExecutionAsyncResponse SignalWithStartWorkflowExec public ResetWorkflowExecutionResponse ResetWorkflowExecution( ResetWorkflowExecutionRequest resetRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, - DomainNotActiveError, LimitExceededError, ClientVersionNotSupportedError, TException { + DomainNotActiveError, LimitExceededError, ClientVersionNotSupportedError, BaseError { return null; } @@ -637,7 +637,7 @@ public void signalExternalWorkflowExecution( @Override public void TerminateWorkflowExecution(TerminateWorkflowExecutionRequest terminateRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, - TException { + BaseError { throw new UnsupportedOperationException("not implemented"); } @@ -667,7 +667,7 @@ public String continueAsNew( .setIdentity(identity) .setRetryPolicy(previousRunStartRequest.getRetryPolicy()) .setCronSchedule(previousRunStartRequest.getCronSchedule()); - if (a.isSetInput()) { + if (a.getInput() != null) { startRequest.setInput(a.getInput()); } lock.lock(); @@ -693,11 +693,11 @@ public String continueAsNew( public ListOpenWorkflowExecutionsResponse ListOpenWorkflowExecutions( ListOpenWorkflowExecutionsRequest listRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, - TException { + BaseError { Optional workflowIdFilter; WorkflowExecutionFilter executionFilter = listRequest.getExecutionFilter(); if (executionFilter != null - && executionFilter.isSetWorkflowId() + && executionFilter.getWorkflowId() != null && !executionFilter.getWorkflowId().isEmpty()) { workflowIdFilter = Optional.of(executionFilter.getWorkflowId()); } else { @@ -711,11 +711,11 @@ public ListOpenWorkflowExecutionsResponse ListOpenWorkflowExecutions( public ListClosedWorkflowExecutionsResponse ListClosedWorkflowExecutions( ListClosedWorkflowExecutionsRequest listRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, - TException { + BaseError { Optional workflowIdFilter; WorkflowExecutionFilter executionFilter = listRequest.getExecutionFilter(); if (executionFilter != null - && executionFilter.isSetWorkflowId() + && executionFilter.getWorkflowId() != null && !executionFilter.getWorkflowId().isEmpty()) { workflowIdFilter = Optional.of(executionFilter.getWorkflowId()); } else { @@ -730,7 +730,7 @@ public ListClosedWorkflowExecutionsResponse ListClosedWorkflowExecutions( public ListWorkflowExecutionsResponse ListWorkflowExecutions( ListWorkflowExecutionsRequest listRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("not implemented"); } @@ -738,7 +738,7 @@ public ListWorkflowExecutionsResponse ListWorkflowExecutions( public ListArchivedWorkflowExecutionsResponse ListArchivedWorkflowExecutions( ListArchivedWorkflowExecutionsRequest listRequest) throws BadRequestError, EntityNotExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("not implemented"); } @@ -746,7 +746,7 @@ public ListArchivedWorkflowExecutionsResponse ListArchivedWorkflowExecutions( public ListWorkflowExecutionsResponse ScanWorkflowExecutions( ListWorkflowExecutionsRequest listRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("not implemented"); } @@ -754,19 +754,19 @@ public ListWorkflowExecutionsResponse ScanWorkflowExecutions( public CountWorkflowExecutionsResponse CountWorkflowExecutions( CountWorkflowExecutionsRequest countRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public GetSearchAttributesResponse GetSearchAttributes() - throws InternalServiceError, ServiceBusyError, ClientVersionNotSupportedError, TException { + throws InternalServiceError, ServiceBusyError, ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void RespondQueryTaskCompleted(RespondQueryTaskCompletedRequest completeRequest) - throws BadRequestError, InternalServiceError, EntityNotExistsError, TException { + throws BadRequestError, InternalServiceError, EntityNotExistsError, BaseError { QueryId queryId = QueryId.fromBytes(completeRequest.getTaskToken()); TestWorkflowMutableState mutableState = getMutableState(queryId.getExecutionId()); mutableState.completeQuery(queryId, completeRequest); @@ -775,14 +775,14 @@ public void RespondQueryTaskCompleted(RespondQueryTaskCompletedRequest completeR @Override public ResetStickyTaskListResponse ResetStickyTaskList(ResetStickyTaskListRequest resetRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, LimitExceededError, - ServiceBusyError, DomainNotActiveError, TException { + ServiceBusyError, DomainNotActiveError, BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public QueryWorkflowResponse QueryWorkflow(QueryWorkflowRequest queryRequest) throws BadRequestError, InternalServiceError, EntityNotExistsError, QueryFailedError, - TException { + BaseError { ExecutionId executionId = new ExecutionId(queryRequest.getDomain(), queryRequest.getExecution()); TestWorkflowMutableState mutableState = getMutableState(executionId); @@ -792,18 +792,18 @@ public QueryWorkflowResponse QueryWorkflow(QueryWorkflowRequest queryRequest) @Override public DescribeWorkflowExecutionResponse DescribeWorkflowExecution( DescribeWorkflowExecutionRequest describeRequest) - throws BadRequestError, InternalServiceError, EntityNotExistsError, TException { + throws BadRequestError, InternalServiceError, EntityNotExistsError, BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public DescribeTaskListResponse DescribeTaskList(DescribeTaskListRequest request) - throws BadRequestError, InternalServiceError, EntityNotExistsError, TException { + throws BadRequestError, InternalServiceError, EntityNotExistsError, BaseError { throw new UnsupportedOperationException("not implemented"); } @Override - public ClusterInfo GetClusterInfo() throws InternalServiceError, ServiceBusyError, TException { + public ClusterInfo GetClusterInfo() throws InternalServiceError, ServiceBusyError, BaseError { throw new UnsupportedOperationException("not implemented"); } @@ -811,66 +811,64 @@ public ClusterInfo GetClusterInfo() throws InternalServiceError, ServiceBusyErro public ListTaskListPartitionsResponse ListTaskListPartitions( ListTaskListPartitionsRequest request) throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, - TException { + BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void RefreshWorkflowTasks(RefreshWorkflowTasksRequest request) throws BadRequestError, DomainNotActiveError, ServiceBusyError, EntityNotExistsError, - TException { + BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void RegisterDomain( - RegisterDomainRequest registerRequest, AsyncMethodCallback resultHandler) throws TException { + RegisterDomainRequest registerRequest, AsyncMethodCallback resultHandler) throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void DescribeDomain( - DescribeDomainRequest describeRequest, AsyncMethodCallback resultHandler) throws TException { + DescribeDomainRequest describeRequest, AsyncMethodCallback resultHandler) throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void ListDomains(ListDomainsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void UpdateDomain(UpdateDomainRequest updateRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void DeprecateDomain( - DeprecateDomainRequest deprecateRequest, AsyncMethodCallback resultHandler) - throws TException { + DeprecateDomainRequest deprecateRequest, AsyncMethodCallback resultHandler) throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void RestartWorkflowExecution( RestartWorkflowExecutionRequest restartRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void GetTaskListsByDomain( - GetTaskListsByDomainRequest request, AsyncMethodCallback resultHandler) - throws org.apache.thrift.TException { + GetTaskListsByDomainRequest request, AsyncMethodCallback resultHandler) throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void StartWorkflowExecution( StartWorkflowExecutionRequest startRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { StartWorkflowExecutionWithTimeout(startRequest, resultHandler, null); } @@ -879,13 +877,13 @@ public void StartWorkflowExecutionWithTimeout( StartWorkflowExecutionRequest startRequest, AsyncMethodCallback resultHandler, Long timeoutInMillis) - throws TException { + throws BaseError { forkJoinPool.execute( () -> { try { StartWorkflowExecutionResponse result = StartWorkflowExecution(startRequest); resultHandler.onComplete(result); - } catch (TException e) { + } catch (BaseError e) { resultHandler.onError(e); } }); @@ -894,7 +892,7 @@ public void StartWorkflowExecutionWithTimeout( @Override public void StartWorkflowExecutionAsync( StartWorkflowExecutionAsyncRequest startRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { StartWorkflowExecutionAsyncWithTimeout(startRequest, resultHandler, null); } @@ -903,7 +901,7 @@ public void StartWorkflowExecutionAsyncWithTimeout( StartWorkflowExecutionAsyncRequest startAsyncRequest, AsyncMethodCallback resultHandler, Long timeoutInMillis) - throws TException { + throws BaseError { // Treat it like a synchronous call but ignore the result StartWorkflowExecutionWithTimeout( startAsyncRequest.getRequest(), @@ -926,13 +924,13 @@ public void onError(Exception exception) { @Override public void GetWorkflowExecutionHistory( GetWorkflowExecutionHistoryRequest getRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { forkJoinPool.execute( () -> { try { GetWorkflowExecutionHistoryResponse result = GetWorkflowExecutionHistory(getRequest); resultHandler.onComplete(result); - } catch (TException e) { + } catch (BaseError e) { resultHandler.onError(e); } }); @@ -944,7 +942,7 @@ public void GetWorkflowExecutionHistoryWithTimeout( GetWorkflowExecutionHistoryRequest getRequest, AsyncMethodCallback resultHandler, Long timeoutInMillis) - throws TException { + throws BaseError { GetWorkflowExecutionHistory(getRequest, resultHandler); } @@ -957,97 +955,97 @@ public CompletableFuture isHealthy() { @Override public void PollForDecisionTask( - PollForDecisionTaskRequest pollRequest, AsyncMethodCallback resultHandler) throws TException { + PollForDecisionTaskRequest pollRequest, AsyncMethodCallback resultHandler) throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void RespondDecisionTaskCompleted( RespondDecisionTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void RespondDecisionTaskFailed( RespondDecisionTaskFailedRequest failedRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void PollForActivityTask( - PollForActivityTaskRequest pollRequest, AsyncMethodCallback resultHandler) throws TException { + PollForActivityTaskRequest pollRequest, AsyncMethodCallback resultHandler) throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void RecordActivityTaskHeartbeat( RecordActivityTaskHeartbeatRequest heartbeatRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void RecordActivityTaskHeartbeatByID( RecordActivityTaskHeartbeatByIDRequest heartbeatRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void RespondActivityTaskCompleted( RespondActivityTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void RespondActivityTaskCompletedByID( RespondActivityTaskCompletedByIDRequest completeRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void RespondActivityTaskFailed( RespondActivityTaskFailedRequest failRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void RespondActivityTaskFailedByID( RespondActivityTaskFailedByIDRequest failRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void RespondActivityTaskCanceled( RespondActivityTaskCanceledRequest canceledRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void RespondActivityTaskCanceledByID( RespondActivityTaskCanceledByIDRequest canceledRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void RequestCancelWorkflowExecution( RequestCancelWorkflowExecutionRequest cancelRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void SignalWorkflowExecution( SignalWorkflowExecutionRequest signalRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { SignalWorkflowExecutionWithTimeout(signalRequest, resultHandler, null); } @@ -1056,13 +1054,13 @@ public void SignalWorkflowExecutionWithTimeout( SignalWorkflowExecutionRequest signalRequest, AsyncMethodCallback resultHandler, Long timeoutInMillis) - throws TException { + throws BaseError { forkJoinPool.execute( () -> { try { SignalWorkflowExecution(signalRequest); resultHandler.onComplete(null); - } catch (TException e) { + } catch (BaseError e) { resultHandler.onError(e); } }); @@ -1072,7 +1070,7 @@ public void SignalWorkflowExecutionWithTimeout( public void SignalWithStartWorkflowExecution( SignalWithStartWorkflowExecutionRequest signalWithStartRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("not implemented"); } @@ -1080,116 +1078,115 @@ public void SignalWithStartWorkflowExecution( public void SignalWithStartWorkflowExecutionAsync( SignalWithStartWorkflowExecutionAsyncRequest signalWithStartRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void ResetWorkflowExecution( ResetWorkflowExecutionRequest resetRequest, AsyncMethodCallback resultHandler) - throws TException {} + throws BaseError {} @Override public void TerminateWorkflowExecution( TerminateWorkflowExecutionRequest terminateRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void ListOpenWorkflowExecutions( ListOpenWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void ListClosedWorkflowExecutions( ListClosedWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void ListWorkflowExecutions( ListWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void ListArchivedWorkflowExecutions( ListArchivedWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void ScanWorkflowExecutions( ListWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void CountWorkflowExecutions( CountWorkflowExecutionsRequest countRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override - public void GetSearchAttributes(AsyncMethodCallback resultHandler) throws TException { + public void GetSearchAttributes(AsyncMethodCallback resultHandler) throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void RespondQueryTaskCompleted( RespondQueryTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void ResetStickyTaskList( - ResetStickyTaskListRequest resetRequest, AsyncMethodCallback resultHandler) - throws TException { + ResetStickyTaskListRequest resetRequest, AsyncMethodCallback resultHandler) throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void QueryWorkflow(QueryWorkflowRequest queryRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void DescribeWorkflowExecution( DescribeWorkflowExecutionRequest describeRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void DescribeTaskList(DescribeTaskListRequest request, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override - public void GetClusterInfo(AsyncMethodCallback resultHandler) throws TException { + public void GetClusterInfo(AsyncMethodCallback resultHandler) throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void ListTaskListPartitions( - ListTaskListPartitionsRequest request, AsyncMethodCallback resultHandler) throws TException { + ListTaskListPartitionsRequest request, AsyncMethodCallback resultHandler) throws BaseError { throw new UnsupportedOperationException("not implemented"); } @Override public void RefreshWorkflowTasks( - RefreshWorkflowTasksRequest request, AsyncMethodCallback resultHandler) throws TException { + RefreshWorkflowTasksRequest request, AsyncMethodCallback resultHandler) throws BaseError { throw new UnsupportedOperationException("not implemented"); } diff --git a/src/main/java/com/uber/cadence/internal/testservice/TestWorkflowStoreImpl.java b/src/main/java/com/uber/cadence/internal/testservice/TestWorkflowStoreImpl.java index 5759f4562..5ebfaa976 100644 --- a/src/main/java/com/uber/cadence/internal/testservice/TestWorkflowStoreImpl.java +++ b/src/main/java/com/uber/cadence/internal/testservice/TestWorkflowStoreImpl.java @@ -18,7 +18,6 @@ package com.uber.cadence.internal.testservice; import com.uber.cadence.BadRequestError; -import com.uber.cadence.DataBlob; import com.uber.cadence.EntityNotExistsError; import com.uber.cadence.EventType; import com.uber.cadence.GetWorkflowExecutionHistoryRequest; @@ -34,7 +33,6 @@ import com.uber.cadence.StickyExecutionAttributes; import com.uber.cadence.WorkflowExecution; import com.uber.cadence.WorkflowExecutionInfo; -import com.uber.cadence.internal.common.InternalUtils; import com.uber.cadence.internal.common.WorkflowExecutionUtils; import com.uber.cadence.internal.testservice.RequestContext.Timer; import java.time.Duration; @@ -90,7 +88,7 @@ void addAllLocked(List events, long timeInNanos) throws EntityNotE } event.setEventId(history.size() + 1L); // It can be set in StateMachines.startActivityTask - if (!event.isSetTimestamp()) { + if (event.getTimestamp() == 0) { event.setTimestamp(timeInNanos); } history.add(event); @@ -348,12 +346,10 @@ public GetWorkflowExecutionHistoryResponse getWorkflowExecutionHistory( if (!getRequest.isWaitForNewEvent() && getRequest.getHistoryEventFilterType() != HistoryEventFilterType.CLOSE_EVENT) { List events = history.getEventsLocked(); - List blobs = InternalUtils.SerializeFromHistoryEventToBlobData(events); // Copy the list as it is mutable. Individual events assumed immutable. ArrayList eventsCopy = new ArrayList<>(events); return new GetWorkflowExecutionHistoryResponse() - .setHistory(new History().setEvents(eventsCopy)) - .setRawHistory(blobs); + .setHistory(new History().setEvents(eventsCopy)); } expectedNextEventId = history.getNextEventIdLocked(); } finally { @@ -361,11 +357,9 @@ public GetWorkflowExecutionHistoryResponse getWorkflowExecutionHistory( } List events = history.waitForNewEvents(expectedNextEventId, getRequest.getHistoryEventFilterType()); - List blobs = InternalUtils.SerializeFromHistoryEventToBlobData(events); GetWorkflowExecutionHistoryResponse result = new GetWorkflowExecutionHistoryResponse(); if (events != null) { result.setHistory(new History().setEvents(events)); - result.setRawHistory(blobs); } return result; } @@ -427,11 +421,14 @@ public List listWorkflows( .setExecution(executionId.getExecution()) .setHistoryLength(history.size()) .setStartTime(history.get(0).getTimestamp()) - .setIsCron( - history - .get(0) - .getWorkflowExecutionStartedEventAttributes() - .isSetCronSchedule()) + .setCron( + history.get(0).getWorkflowExecutionStartedEventAttributes().getCronSchedule() + != null + && !history + .get(0) + .getWorkflowExecutionStartedEventAttributes() + .getCronSchedule() + .isEmpty()) .setType( history .get(0) @@ -453,11 +450,14 @@ public List listWorkflows( .setExecution(executionId.getExecution()) .setHistoryLength(history.size()) .setStartTime(history.get(0).getTimestamp()) - .setIsCron( - history - .get(0) - .getWorkflowExecutionStartedEventAttributes() - .isSetCronSchedule()) + .setCron( + history.get(0).getWorkflowExecutionStartedEventAttributes().getCronSchedule() + != null + && !history + .get(0) + .getWorkflowExecutionStartedEventAttributes() + .getCronSchedule() + .isEmpty()) .setType( history.get(0).getWorkflowExecutionStartedEventAttributes().getWorkflowType()) .setCloseStatus( diff --git a/src/main/java/com/uber/cadence/internal/tracing/TracingPropagator.java b/src/main/java/com/uber/cadence/internal/tracing/TracingPropagator.java index e13e65f41..d3800f995 100644 --- a/src/main/java/com/uber/cadence/internal/tracing/TracingPropagator.java +++ b/src/main/java/com/uber/cadence/internal/tracing/TracingPropagator.java @@ -30,7 +30,6 @@ import io.opentracing.noop.NoopSpan; import io.opentracing.propagation.*; import io.opentracing.propagation.Format; -import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Map; import java.util.stream.Collectors; @@ -83,15 +82,19 @@ public Span spanForExecuteActivity(PollForActivityTaskResponse task) { .addReference( References.FOLLOWS_FROM, parent != NoopSpan.INSTANCE.context() ? parent : null) .withTag( - TAG_WORKFLOW_TYPE, task.isSetWorkflowType() ? task.getWorkflowType().getName() : "null") + TAG_WORKFLOW_TYPE, + task.getWorkflowType() != null ? task.getWorkflowType().getName() : "null") .withTag( TAG_WORKFLOW_ID, - task.isSetWorkflowExecution() ? task.getWorkflowExecution().getWorkflowId() : "null") + task.getWorkflowExecution() != null + ? task.getWorkflowExecution().getWorkflowId() + : "null") .withTag( TAG_WORKFLOW_RUN_ID, - task.isSetWorkflowExecution() ? task.getWorkflowExecution().getRunId() : "null") + task.getWorkflowExecution() != null ? task.getWorkflowExecution().getRunId() : "null") .withTag( - TAG_ACTIVITY_TYPE, task.isSetActivityType() ? task.getActivityType().getName() : "null") + TAG_ACTIVITY_TYPE, + task.getActivityType() != null ? task.getActivityType().getName() : "null") .start(); } @@ -123,7 +126,7 @@ public void inject(Header header) { Map context = getCurrentContext(); context.forEach( (k, v) -> { - header.putToFields(k, ByteBuffer.wrap(v.getBytes())); + header.getFields().put(k, v.getBytes()); }); } @@ -160,9 +163,7 @@ private SpanContext extract(Header header) { Collectors.toMap( Map.Entry::getKey, e -> { - byte[] bytes = new byte[e.getValue().remaining()]; - e.getValue().duplicate().get(bytes); - return new String(bytes); + return new String(e.getValue()); })))); } } diff --git a/src/main/java/com/uber/cadence/internal/worker/ActivityPollTask.java b/src/main/java/com/uber/cadence/internal/worker/ActivityPollTask.java index 533ec9607..51720a27f 100644 --- a/src/main/java/com/uber/cadence/internal/worker/ActivityPollTask.java +++ b/src/main/java/com/uber/cadence/internal/worker/ActivityPollTask.java @@ -21,17 +21,11 @@ import static com.uber.cadence.internal.metrics.MetricsTagValue.SERVICE_BUSY; import com.google.common.collect.ImmutableMap; -import com.uber.cadence.InternalServiceError; -import com.uber.cadence.PollForActivityTaskRequest; -import com.uber.cadence.PollForActivityTaskResponse; -import com.uber.cadence.ServiceBusyError; -import com.uber.cadence.TaskList; -import com.uber.cadence.TaskListMetadata; +import com.uber.cadence.*; import com.uber.cadence.internal.metrics.MetricsTag; import com.uber.cadence.internal.metrics.MetricsType; import com.uber.cadence.serviceclient.IWorkflowService; import com.uber.m3.tally.Stopwatch; -import org.apache.thrift.TException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -51,7 +45,7 @@ public ActivityPollTask( } @Override - protected PollForActivityTaskResponse pollTask() throws TException { + protected PollForActivityTaskResponse pollTask() throws BaseError { options.getMetricsScope().counter(MetricsType.ACTIVITY_POLL_COUNTER).inc(1); Stopwatch sw = options.getMetricsScope().timer(MetricsType.ACTIVITY_POLL_LATENCY).start(); PollForActivityTaskRequest pollRequest = new PollForActivityTaskRequest(); @@ -85,7 +79,7 @@ protected PollForActivityTaskResponse pollTask() throws TException { .counter(MetricsType.ACTIVITY_POLL_TRANSIENT_FAILED_COUNTER) .inc(1); throw e; - } catch (TException e) { + } catch (BaseError e) { options.getMetricsScope().counter(MetricsType.ACTIVITY_POLL_FAILED_COUNTER).inc(1); throw e; } diff --git a/src/main/java/com/uber/cadence/internal/worker/ActivityPollTaskBase.java b/src/main/java/com/uber/cadence/internal/worker/ActivityPollTaskBase.java index 78b3d2817..6c7d9b679 100644 --- a/src/main/java/com/uber/cadence/internal/worker/ActivityPollTaskBase.java +++ b/src/main/java/com/uber/cadence/internal/worker/ActivityPollTaskBase.java @@ -17,13 +17,13 @@ package com.uber.cadence.internal.worker; +import com.uber.cadence.BaseError; import com.uber.cadence.PollForActivityTaskResponse; import com.uber.cadence.internal.metrics.MetricsTag; import com.uber.cadence.internal.metrics.MetricsType; import com.uber.m3.tally.Scope; import com.uber.m3.util.Duration; import com.uber.m3.util.ImmutableMap; -import org.apache.thrift.TException; abstract class ActivityPollTaskBase implements Poller.PollTask { @@ -33,7 +33,7 @@ public ActivityPollTaskBase(SingleWorkerOptions options) { this.options = options; } - public PollForActivityTaskResponse poll() throws TException { + public PollForActivityTaskResponse poll() throws BaseError { PollForActivityTaskResponse result = pollTask(); if (result == null || result.getTaskToken() == null) { @@ -58,5 +58,5 @@ public PollForActivityTaskResponse poll() throws TException { return result; } - protected abstract PollForActivityTaskResponse pollTask() throws TException; + protected abstract PollForActivityTaskResponse pollTask() throws BaseError; } diff --git a/src/main/java/com/uber/cadence/internal/worker/ActivityWorker.java b/src/main/java/com/uber/cadence/internal/worker/ActivityWorker.java index 9e83156d5..f363524f5 100644 --- a/src/main/java/com/uber/cadence/internal/worker/ActivityWorker.java +++ b/src/main/java/com/uber/cadence/internal/worker/ActivityWorker.java @@ -17,12 +17,7 @@ package com.uber.cadence.internal.worker; -import com.uber.cadence.Header; -import com.uber.cadence.PollForActivityTaskResponse; -import com.uber.cadence.RespondActivityTaskCanceledRequest; -import com.uber.cadence.RespondActivityTaskCompletedRequest; -import com.uber.cadence.RespondActivityTaskFailedRequest; -import com.uber.cadence.WorkflowExecution; +import com.uber.cadence.*; import com.uber.cadence.context.ContextPropagator; import com.uber.cadence.internal.common.RpcRetryer; import com.uber.cadence.internal.logging.LoggerTag; @@ -44,7 +39,6 @@ import java.util.Objects; import java.util.concurrent.CancellationException; import java.util.concurrent.TimeUnit; -import org.apache.thrift.TException; import org.slf4j.MDC; public class ActivityWorker extends SuspendableWorkerBase { @@ -194,7 +188,7 @@ void propagateContext(PollForActivityTaskResponse response) { .getFields() .forEach( (k, v) -> { - headerData.put(k, org.apache.thrift.TBaseHelper.byteBufferToByteArray(v)); + headerData.put(k, v); }); for (ContextPropagator propagator : options.getContextPropagators()) { @@ -225,7 +219,7 @@ public Throwable wrapFailure(PollForActivityTaskResponse task, Throwable failure private void sendReply( PollForActivityTaskResponse task, ActivityTaskHandler.Result response, Scope metricsScope) - throws TException { + throws BaseError { RespondActivityTaskCompletedRequest taskCompleted = response.getTaskCompleted(); if (taskCompleted != null) { taskCompleted.setTaskToken(task.getTaskToken()); diff --git a/src/main/java/com/uber/cadence/internal/worker/LocalActivityPollTask.java b/src/main/java/com/uber/cadence/internal/worker/LocalActivityPollTask.java index 144bff29a..26ae813b4 100644 --- a/src/main/java/com/uber/cadence/internal/worker/LocalActivityPollTask.java +++ b/src/main/java/com/uber/cadence/internal/worker/LocalActivityPollTask.java @@ -17,12 +17,12 @@ package com.uber.cadence.internal.worker; +import com.uber.cadence.BaseError; import java.time.Duration; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; import java.util.concurrent.TimeUnit; import java.util.function.BiFunction; -import org.apache.thrift.TException; final class LocalActivityPollTask implements Poller.PollTask, @@ -32,7 +32,7 @@ final class LocalActivityPollTask new ArrayBlockingQueue<>(QUEUE_SIZE); @Override - public LocalActivityWorker.Task poll() throws TException { + public LocalActivityWorker.Task poll() throws BaseError { try { return pendingTasks.take(); } catch (InterruptedException e) { diff --git a/src/main/java/com/uber/cadence/internal/worker/LocallyDispatchedActivityPollTask.java b/src/main/java/com/uber/cadence/internal/worker/LocallyDispatchedActivityPollTask.java index cc57f3f19..9901ff485 100644 --- a/src/main/java/com/uber/cadence/internal/worker/LocallyDispatchedActivityPollTask.java +++ b/src/main/java/com/uber/cadence/internal/worker/LocallyDispatchedActivityPollTask.java @@ -17,12 +17,12 @@ package com.uber.cadence.internal.worker; +import com.uber.cadence.BaseError; import com.uber.cadence.PollForActivityTaskResponse; import com.uber.cadence.internal.metrics.MetricsType; import com.uber.cadence.internal.worker.LocallyDispatchedActivityWorker.Task; import java.util.concurrent.SynchronousQueue; import java.util.function.Function; -import org.apache.thrift.TException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -38,7 +38,7 @@ public LocallyDispatchedActivityPollTask(SingleWorkerOptions options) { } @Override - protected PollForActivityTaskResponse pollTask() throws TException { + protected PollForActivityTaskResponse pollTask() throws BaseError { Task task; try { task = pendingTasks.take(); @@ -61,22 +61,23 @@ protected PollForActivityTaskResponse pollTask() throws TException { .getMetricsScope() .counter(MetricsType.LOCALLY_DISPATCHED_ACTIVITY_POLL_SUCCEED_COUNTER) .inc(1); - PollForActivityTaskResponse result = new PollForActivityTaskResponse(); - result.activityId = task.activityId; - result.activityType = task.activityType; - result.header = task.header; - result.input = task.input; - result.workflowExecution = task.workflowExecution; - result.scheduledTimestampOfThisAttempt = task.scheduledTimestampOfThisAttempt; - result.scheduledTimestamp = task.scheduledTimestamp; - result.scheduleToCloseTimeoutSeconds = task.scheduleToCloseTimeoutSeconds; - result.startedTimestamp = task.startedTimestamp; - result.startToCloseTimeoutSeconds = task.startToCloseTimeoutSeconds; - result.heartbeatTimeoutSeconds = task.heartbeatTimeoutSeconds; - result.taskToken = task.taskToken; - result.workflowType = task.workflowType; - result.workflowDomain = task.workflowDomain; - result.attempt = 0; + PollForActivityTaskResponse result = + new PollForActivityTaskResponse() + .setActivityId(task.activityId) + .setActivityType(task.activityType) + .setHeader(task.header) + .setInput(task.input.array()) + .setWorkflowExecution(task.workflowExecution) + .setScheduledTimestampOfThisAttempt(task.scheduledTimestampOfThisAttempt) + .setScheduledTimestamp(task.scheduledTimestamp) + .setScheduleToCloseTimeoutSeconds(task.scheduleToCloseTimeoutSeconds) + .setStartedTimestamp(task.startedTimestamp) + .setStartToCloseTimeoutSeconds(task.startToCloseTimeoutSeconds) + .setHeartbeatTimeoutSeconds(task.heartbeatTimeoutSeconds) + .setTaskToken(task.taskToken.array()) + .setWorkflowType(task.workflowType) + .setWorkflowDomain(task.workflowDomain) + .setAttempt(0); return result; } diff --git a/src/main/java/com/uber/cadence/internal/worker/PollDecisionTaskDispatcher.java b/src/main/java/com/uber/cadence/internal/worker/PollDecisionTaskDispatcher.java index 38c94e225..258385876 100644 --- a/src/main/java/com/uber/cadence/internal/worker/PollDecisionTaskDispatcher.java +++ b/src/main/java/com/uber/cadence/internal/worker/PollDecisionTaskDispatcher.java @@ -65,7 +65,7 @@ public void process(PollForDecisionTaskResponse t) { subscribers.get(taskListName).accept(t); } else { RespondDecisionTaskFailedRequest request = new RespondDecisionTaskFailedRequest(); - request.setTaskToken(t.taskToken); + request.setTaskToken(t.getTaskToken()); request.setCause(DecisionTaskFailedCause.RESET_STICKY_TASKLIST); String message = String.format( diff --git a/src/main/java/com/uber/cadence/internal/worker/Poller.java b/src/main/java/com/uber/cadence/internal/worker/Poller.java index 5a81abcb5..95ad8bbb6 100644 --- a/src/main/java/com/uber/cadence/internal/worker/Poller.java +++ b/src/main/java/com/uber/cadence/internal/worker/Poller.java @@ -17,6 +17,7 @@ package com.uber.cadence.internal.worker; +import com.uber.cadence.BaseError; import com.uber.cadence.internal.common.BackoffThrottler; import com.uber.cadence.internal.common.InternalUtils; import com.uber.cadence.internal.metrics.MetricsType; @@ -30,7 +31,6 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; -import org.apache.thrift.TException; import org.apache.thrift.transport.TTransportException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -38,7 +38,7 @@ public final class Poller implements SuspendableWorker { public interface PollTask { - TT poll() throws TException; + TT poll() throws BaseError; } interface ThrowingRunnable { diff --git a/src/main/java/com/uber/cadence/internal/worker/TaskListKind.java b/src/main/java/com/uber/cadence/internal/worker/TaskListKind.java deleted file mode 100644 index 7a157d148..000000000 --- a/src/main/java/com/uber/cadence/internal/worker/TaskListKind.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.worker; - -public enum TaskListKind { - TASK_LIST_KIND_NORMAL(0), - TASK_LIST_KIND_STICKY(1); - - private final int value; - - TaskListKind(int value) { - this.value = value; - } - - public com.uber.cadence.TaskListKind toThrift() { - return com.uber.cadence.TaskListKind.findByValue(this.value); - } -} diff --git a/src/main/java/com/uber/cadence/internal/worker/WorkflowPollTask.java b/src/main/java/com/uber/cadence/internal/worker/WorkflowPollTask.java index 1d379237b..b6b54cb76 100644 --- a/src/main/java/com/uber/cadence/internal/worker/WorkflowPollTask.java +++ b/src/main/java/com/uber/cadence/internal/worker/WorkflowPollTask.java @@ -20,11 +20,7 @@ import static com.uber.cadence.internal.metrics.MetricsTagValue.INTERNAL_SERVICE_ERROR; import static com.uber.cadence.internal.metrics.MetricsTagValue.SERVICE_BUSY; -import com.uber.cadence.InternalServiceError; -import com.uber.cadence.PollForDecisionTaskRequest; -import com.uber.cadence.PollForDecisionTaskResponse; -import com.uber.cadence.ServiceBusyError; -import com.uber.cadence.TaskList; +import com.uber.cadence.*; import com.uber.cadence.common.BinaryChecksum; import com.uber.cadence.internal.metrics.MetricsTag; import com.uber.cadence.internal.metrics.MetricsType; @@ -34,7 +30,6 @@ import com.uber.m3.util.Duration; import com.uber.m3.util.ImmutableMap; import java.util.Objects; -import org.apache.thrift.TException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -64,7 +59,7 @@ final class WorkflowPollTask implements Poller.PollTask respNew != null // execution already in new || respOld == null // execution not exist in new and not exist in old - || (respOld.isSetWorkflowExecutionInfo() - && respOld - .getWorkflowExecutionInfo() - .isSetCloseStatus()) // execution not exist in new and execution is + || (respOld.getWorkflowExecutionInfo() != null + && respOld.getWorkflowExecutionInfo().getCloseStatus() + != null) // execution not exist in new and execution is // closed in old ) .get(); } catch (CompletionException e) { - throw e.getCause() instanceof TException - ? (TException) e.getCause() - : new TException("unknown error: " + e.getMessage()); + throw e.getCause() instanceof BaseError + ? (BaseError) e.getCause() + : new BaseError("unknown error: " + e.getMessage()); } catch (Exception e) { - throw new TException("Unknown error: " + e.getMessage()); + throw new BaseError("Unknown error: " + e.getMessage()); } } diff --git a/src/main/java/com/uber/cadence/migration/MigrationInterceptor.java b/src/main/java/com/uber/cadence/migration/MigrationInterceptor.java index fc0c0f922..abb94093c 100644 --- a/src/main/java/com/uber/cadence/migration/MigrationInterceptor.java +++ b/src/main/java/com/uber/cadence/migration/MigrationInterceptor.java @@ -101,7 +101,8 @@ public byte[] executeWorkflow( new StartWorkflowExecutionRequest() .setDomain(domainNew) .setWorkflowId(workflowInfo.getWorkflowId()) - .setTaskList(new TaskList().setName(startedEventAttributes.taskList.getName())) + .setTaskList( + new TaskList().setName(startedEventAttributes.getTaskList().getName())) .setInput(input.getInput()) .setWorkflowType(new WorkflowType().setName(input.getWorkflowType().getName())) .setWorkflowIdReusePolicy(WorkflowIdReusePolicy.TerminateIfRunning) @@ -174,7 +175,8 @@ public void continueAsNew( new StartWorkflowExecutionRequest() .setDomain(domainNew) .setWorkflowId(workflowInfo.getWorkflowId()) - .setTaskList(new TaskList().setName(startedEventAttributes.taskList.getName())) + .setTaskList( + new TaskList().setName(startedEventAttributes.getTaskList().getName())) .setInput(workflowInfo.getDataConverter().toData(args)) .setWorkflowType( new WorkflowType() @@ -203,12 +205,12 @@ public void continueAsNew( } private boolean isChildWorkflow(WorkflowExecutionStartedEventAttributes startedEventAttributes) { - return startedEventAttributes.isSetParentWorkflowExecution() - && !startedEventAttributes.getParentWorkflowExecution().isSetWorkflowId(); + return startedEventAttributes.getParentWorkflowExecution() != null + && startedEventAttributes.getParentWorkflowExecution().getWorkflowId() != null; } private boolean isCronSchedule(WorkflowExecutionStartedEventAttributes startedEventAttributes) { - return !Strings.isNullOrEmpty(startedEventAttributes.cronSchedule); + return !Strings.isNullOrEmpty(startedEventAttributes.getCronSchedule()); } private void cancelCurrentWorkflow() { diff --git a/src/main/java/com/uber/cadence/serviceclient/AsyncMethodCallback.java b/src/main/java/com/uber/cadence/serviceclient/AsyncMethodCallback.java new file mode 100644 index 000000000..3f2031cf5 --- /dev/null +++ b/src/main/java/com/uber/cadence/serviceclient/AsyncMethodCallback.java @@ -0,0 +1,33 @@ +/** + * 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; + +public interface AsyncMethodCallback { + /** + * Called when the remote service has completed processing the request and the response has been + * fully received. + * + * @param response + */ + public void onComplete(T response); + + /** + * Called when there is an unexpected expection. Exception is wrapped in {@link + * com.uber.cadence.BaseError}. + * + * @param exception + */ + public void onError(Exception exception); +} diff --git a/src/main/java/com/uber/cadence/serviceclient/IWorkflowService.java b/src/main/java/com/uber/cadence/serviceclient/IWorkflowService.java index ae3a54e26..43e6c5ef7 100644 --- a/src/main/java/com/uber/cadence/serviceclient/IWorkflowService.java +++ b/src/main/java/com/uber/cadence/serviceclient/IWorkflowService.java @@ -17,16 +17,8 @@ package com.uber.cadence.serviceclient; -import com.uber.cadence.GetWorkflowExecutionHistoryRequest; -import com.uber.cadence.GetWorkflowExecutionHistoryResponse; -import com.uber.cadence.SignalWorkflowExecutionRequest; -import com.uber.cadence.StartWorkflowExecutionAsyncRequest; -import com.uber.cadence.StartWorkflowExecutionRequest; -import com.uber.cadence.WorkflowService.AsyncIface; -import com.uber.cadence.WorkflowService.Iface; +import com.uber.cadence.*; import java.util.concurrent.CompletableFuture; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; public interface IWorkflowService extends Iface, AsyncIface { void close(); @@ -40,13 +32,13 @@ public interface IWorkflowService extends Iface, AsyncIface { * @param startRequest * @param resultHandler * @param timeoutInMillis - * @throws TException + * @throws BaseError */ void StartWorkflowExecutionWithTimeout( StartWorkflowExecutionRequest startRequest, - AsyncMethodCallback resultHandler, + AsyncMethodCallback resultHandler, Long timeoutInMillis) - throws TException; + throws BaseError; /** * StartWorkflowExecutionAsyncWithTimeout start workflow same as StartWorkflowExecutionAsync but @@ -55,13 +47,13 @@ void StartWorkflowExecutionWithTimeout( * @param startAsyncRequest * @param resultHandler * @param timeoutInMillis - * @throws TException + * @throws BaseError */ void StartWorkflowExecutionAsyncWithTimeout( StartWorkflowExecutionAsyncRequest startAsyncRequest, - AsyncMethodCallback resultHandler, + AsyncMethodCallback resultHandler, Long timeoutInMillis) - throws TException; + throws BaseError; /** * GetWorkflowExecutionHistoryWithTimeout get workflow history same as GetWorkflowExecutionHistory @@ -70,10 +62,10 @@ void StartWorkflowExecutionAsyncWithTimeout( * @param getRequest * @param timeoutInMillis * @return GetWorkflowExecutionHistoryResponse - * @throws TException + * @throws BaseError */ GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistoryWithTimeout( - GetWorkflowExecutionHistoryRequest getRequest, Long timeoutInMillis) throws TException; + GetWorkflowExecutionHistoryRequest getRequest, Long timeoutInMillis) throws BaseError; /** * GetWorkflowExecutionHistoryWithTimeout get workflow history asynchronously same as @@ -82,13 +74,13 @@ GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistoryWithTimeout( * @param getRequest * @param resultHandler * @param timeoutInMillis - * @throws org.apache.thrift.TException + * @throws BaseError */ void GetWorkflowExecutionHistoryWithTimeout( GetWorkflowExecutionHistoryRequest getRequest, - AsyncMethodCallback resultHandler, + AsyncMethodCallback resultHandler, Long timeoutInMillis) - throws TException; + throws BaseError; /** * SignalWorkflowExecutionWithTimeout signal workflow same as SignalWorkflowExecution but with @@ -97,13 +89,13 @@ void GetWorkflowExecutionHistoryWithTimeout( * @param signalRequest * @param resultHandler * @param timeoutInMillis - * @throws TException + * @throws BaseError */ void SignalWorkflowExecutionWithTimeout( SignalWorkflowExecutionRequest signalRequest, - AsyncMethodCallback resultHandler, + AsyncMethodCallback resultHandler, Long timeoutInMillis) - throws TException; + throws BaseError; /** * Checks if we have a valid connection to the Cadence cluster, and potentially resets the peer @@ -111,3 +103,709 @@ void SignalWorkflowExecutionWithTimeout( */ CompletableFuture isHealthy(); } + +interface Iface { + + /** + * RegisterDomain creates a new domain which can be used as a container for all resources. Domain + * is a top level entity within Cadence, used as a container for all resources like workflow + * executions, tasklists, etc. Domain acts as a sandbox and provides isolation for all resources + * within the domain. All resources belongs to exactly one domain. + * + * @param registerRequest + */ + void RegisterDomain(RegisterDomainRequest registerRequest) + throws BadRequestError, DomainAlreadyExistsError, ServiceBusyError, + ClientVersionNotSupportedError, BaseError; + + /** + * DescribeDomain returns the information and configuration for a registered domain. + * + * @param describeRequest + */ + DescribeDomainResponse DescribeDomain(DescribeDomainRequest describeRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, BaseError; + + /** + * ListDomains returns the information and configuration for all domains. + * + * @param listRequest + */ + ListDomainsResponse ListDomains(ListDomainsRequest listRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, BaseError; + + /** + * UpdateDomain is used to update the information and configuration for a registered domain. + * + * @param updateRequest + */ + UpdateDomainResponse UpdateDomain(UpdateDomainRequest updateRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, + ClientVersionNotSupportedError, BaseError; + + /** + * DeprecateDomain us used to update status of a registered domain to DEPRECATED. Once the domain + * is deprecated it cannot be used to start new workflow executions. Existing workflow executions + * will continue to run on deprecated domains. + * + * @param deprecateRequest + */ + void DeprecateDomain(DeprecateDomainRequest deprecateRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, + ClientVersionNotSupportedError, BaseError; + + /** + * RestartWorkflowExecution restarts a previous workflow If the workflow is currently running it + * will terminate and restart + * + * @param restartRequest + */ + RestartWorkflowExecutionResponse RestartWorkflowExecution( + RestartWorkflowExecutionRequest restartRequest) + throws BadRequestError, ServiceBusyError, DomainNotActiveError, LimitExceededError, + EntityNotExistsError, ClientVersionNotSupportedError, BaseError; + + /** + * StartWorkflowExecution starts a new long running workflow instance. It will create the instance + * with 'WorkflowExecutionStarted' event in history and also schedule the first DecisionTask for + * the worker to make the first decision for this instance. It will return + * 'WorkflowExecutionAlreadyStartedError', if an instance already exists with same workflowId. + * + * @param startRequest + */ + StartWorkflowExecutionResponse StartWorkflowExecution(StartWorkflowExecutionRequest startRequest) + throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError, + DomainNotActiveError, LimitExceededError, EntityNotExistsError, + ClientVersionNotSupportedError, BaseError; + + /** + * StartWorkflowExecutionAsync starts a new long running workflow instance asynchronously. It will + * push a StartWorkflowExecutionRequest to a queue and immediately return a response. The request + * will be processed by a separate consumer eventually. + * + * @param startRequest + */ + StartWorkflowExecutionAsyncResponse StartWorkflowExecutionAsync( + StartWorkflowExecutionAsyncRequest startRequest) + throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError, + DomainNotActiveError, LimitExceededError, EntityNotExistsError, + ClientVersionNotSupportedError, BaseError; + + /** + * Returns the history of specified workflow execution. It fails with 'EntityNotExistError' if + * speficied workflow execution in unknown to the service. + * + * @param getRequest + */ + GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistory( + GetWorkflowExecutionHistoryRequest getRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, BaseError; + + /** + * PollForDecisionTask is called by application worker to process DecisionTask from a specific + * taskList. A DecisionTask is dispatched to callers for active workflow executions, with pending + * decisions. Application is then expected to call 'RespondDecisionTaskCompleted' API when it is + * done processing the DecisionTask. It will also create a 'DecisionTaskStarted' event in the + * history for that session before handing off DecisionTask to application worker. + * + * @param pollRequest + */ + PollForDecisionTaskResponse PollForDecisionTask(PollForDecisionTaskRequest pollRequest) + throws BadRequestError, ServiceBusyError, LimitExceededError, EntityNotExistsError, + DomainNotActiveError, ClientVersionNotSupportedError, BaseError; + + /** + * RespondDecisionTaskCompleted is called by application worker to complete a DecisionTask handed + * as a result of 'PollForDecisionTask' API call. Completing a DecisionTask will result in new + * events for the workflow execution and potentially new ActivityTask being created for + * corresponding decisions. It will also create a DecisionTaskCompleted event in the history for + * that session. Use the 'taskToken' provided as response of PollForDecisionTask API call for + * completing the DecisionTask. The response could contain a new decision task if there is one or + * if the request asking for one. + * + * @param completeRequest + */ + RespondDecisionTaskCompletedResponse RespondDecisionTaskCompleted( + RespondDecisionTaskCompletedRequest completeRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + BaseError; + + /** + * RespondDecisionTaskFailed is called by application worker to indicate failure. This results in + * DecisionTaskFailedEvent written to the history and a new DecisionTask created. This API can be + * used by client to either clear sticky tasklist or report any panics during DecisionTask + * processing. Cadence will only append first DecisionTaskFailed event to the history of workflow + * execution for consecutive failures. + * + * @param failedRequest + */ + void RespondDecisionTaskFailed(RespondDecisionTaskFailedRequest failedRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + BaseError; + + /** + * PollForActivityTask is called by application worker to process ActivityTask from a specific + * taskList. ActivityTask is dispatched to callers whenever a ScheduleTask decision is made for a + * workflow execution. Application is expected to call 'RespondActivityTaskCompleted' or + * 'RespondActivityTaskFailed' once it is done processing the task. Application also needs to call + * 'RecordActivityTaskHeartbeat' API within 'heartbeatTimeoutSeconds' interval to prevent the task + * from getting timed out. An event 'ActivityTaskStarted' event is also written to workflow + * execution history before the ActivityTask is dispatched to application worker. + * + * @param pollRequest + */ + PollForActivityTaskResponse PollForActivityTask(PollForActivityTaskRequest pollRequest) + throws BadRequestError, ServiceBusyError, LimitExceededError, EntityNotExistsError, + DomainNotActiveError, ClientVersionNotSupportedError, BaseError; + + /** + * RecordActivityTaskHeartbeat is called by application worker while it is processing an + * ActivityTask. If worker fails to heartbeat within 'heartbeatTimeoutSeconds' interval for the + * ActivityTask, then it will be marked as timedout and 'ActivityTaskTimedOut' event will be + * written to the workflow history. Calling 'RecordActivityTaskHeartbeat' will fail with + * 'EntityNotExistsError' in such situations. Use the 'taskToken' provided as response of + * PollForActivityTask API call for heartbeating. + * + * @param heartbeatRequest + */ + RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeat( + RecordActivityTaskHeartbeatRequest heartbeatRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + BaseError; + + /** + * RecordActivityTaskHeartbeatByID is called by application worker while it is processing an + * ActivityTask. If worker fails to heartbeat within 'heartbeatTimeoutSeconds' interval for the + * ActivityTask, then it will be marked as timedout and 'ActivityTaskTimedOut' event will be + * written to the workflow history. Calling 'RecordActivityTaskHeartbeatByID' will fail with + * 'EntityNotExistsError' in such situations. Instead of using 'taskToken' like in + * RecordActivityTaskHeartbeat, use Domain, WorkflowID and ActivityID + * + * @param heartbeatRequest + */ + RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeatByID( + RecordActivityTaskHeartbeatByIDRequest heartbeatRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + BaseError; + + /** + * RespondActivityTaskCompleted is called by application worker when it is done processing an + * ActivityTask. It will result in a new 'ActivityTaskCompleted' event being written to the + * workflow history and a new DecisionTask created for the workflow so new decisions could be + * made. Use the 'taskToken' provided as response of PollForActivityTask API call for completion. + * It fails with 'EntityNotExistsError' if the taskToken is not valid anymore due to activity + * timeout. + * + * @param completeRequest + */ + void RespondActivityTaskCompleted(RespondActivityTaskCompletedRequest completeRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + BaseError; + + /** + * RespondActivityTaskCompletedByID is called by application worker when it is done processing an + * ActivityTask. It will result in a new 'ActivityTaskCompleted' event being written to the + * workflow history and a new DecisionTask created for the workflow so new decisions could be + * made. Similar to RespondActivityTaskCompleted but use Domain, WorkflowID and ActivityID instead + * of 'taskToken' for completion. It fails with 'EntityNotExistsError' if the these IDs are not + * valid anymore due to activity timeout. + * + * @param completeRequest + */ + void RespondActivityTaskCompletedByID(RespondActivityTaskCompletedByIDRequest completeRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + BaseError; + + /** + * RespondActivityTaskFailed is called by application worker when it is done processing an + * ActivityTask. It will result in a new 'ActivityTaskFailed' event being written to the workflow + * history and a new DecisionTask created for the workflow instance so new decisions could be + * made. Use the 'taskToken' provided as response of PollForActivityTask API call for completion. + * It fails with 'EntityNotExistsError' if the taskToken is not valid anymore due to activity + * timeout. + * + * @param failRequest + */ + void RespondActivityTaskFailed(RespondActivityTaskFailedRequest failRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + BaseError; + + /** + * RespondActivityTaskFailedByID is called by application worker when it is done processing an + * ActivityTask. It will result in a new 'ActivityTaskFailed' event being written to the workflow + * history and a new DecisionTask created for the workflow instance so new decisions could be + * made. Similar to RespondActivityTaskFailed but use Domain, WorkflowID and ActivityID instead of + * 'taskToken' for completion. It fails with 'EntityNotExistsError' if the these IDs are not valid + * anymore due to activity timeout. + * + * @param failRequest + */ + void RespondActivityTaskFailedByID(RespondActivityTaskFailedByIDRequest failRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + BaseError; + + /** + * RespondActivityTaskCanceled is called by application worker when it is successfully canceled an + * ActivityTask. It will result in a new 'ActivityTaskCanceled' event being written to the + * workflow history and a new DecisionTask created for the workflow instance so new decisions + * could be made. Use the 'taskToken' provided as response of PollForActivityTask API call for + * completion. It fails with 'EntityNotExistsError' if the taskToken is not valid anymore due to + * activity timeout. + * + * @param canceledRequest + */ + void RespondActivityTaskCanceled(RespondActivityTaskCanceledRequest canceledRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + BaseError; + + /** + * RespondActivityTaskCanceledByID is called by application worker when it is successfully + * canceled an ActivityTask. It will result in a new 'ActivityTaskCanceled' event being written to + * the workflow history and a new DecisionTask created for the workflow instance so new decisions + * could be made. Similar to RespondActivityTaskCanceled but use Domain, WorkflowID and ActivityID + * instead of 'taskToken' for completion. It fails with 'EntityNotExistsError' if the these IDs + * are not valid anymore due to activity timeout. + * + * @param canceledRequest + */ + void RespondActivityTaskCanceledByID(RespondActivityTaskCanceledByIDRequest canceledRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + BaseError; + + /** + * RequestCancelWorkflowExecution is called by application worker when it wants to request + * cancellation of a workflow instance. It will result in a new 'WorkflowExecutionCancelRequested' + * event being written to the workflow history and a new DecisionTask created for the workflow + * instance so new decisions could be made. It fails with 'EntityNotExistsError' if the workflow + * is not valid anymore due to completion or doesn't exist. + * + * @param cancelRequest + */ + void RequestCancelWorkflowExecution(RequestCancelWorkflowExecutionRequest cancelRequest) + throws BadRequestError, EntityNotExistsError, CancellationAlreadyRequestedError, + ServiceBusyError, DomainNotActiveError, LimitExceededError, + ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, BaseError; + + /** + * SignalWorkflowExecution is used to send a signal event to running workflow execution. This + * results in WorkflowExecutionSignaled event recorded in the history and a decision task being + * created for the execution. + * + * @param signalRequest + */ + void SignalWorkflowExecution(SignalWorkflowExecutionRequest signalRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, + LimitExceededError, ClientVersionNotSupportedError, + WorkflowExecutionAlreadyCompletedError, BaseError; + + /** + * SignalWithStartWorkflowExecution is used to ensure sending signal to a workflow. If the + * workflow is running, this results in WorkflowExecutionSignaled event being recorded in the + * history and a decision task being created for the execution. If the workflow is not running or + * not found, this results in WorkflowExecutionStarted and WorkflowExecutionSignaled events being + * recorded in history, and a decision task being created for the execution + * + * @param signalWithStartRequest + */ + StartWorkflowExecutionResponse SignalWithStartWorkflowExecution( + SignalWithStartWorkflowExecutionRequest signalWithStartRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, + LimitExceededError, WorkflowExecutionAlreadyStartedError, ClientVersionNotSupportedError, + BaseError; + + /** + * SignalWithStartWorkflowExecutionAsync is used to ensure sending signal to a workflow + * asynchronously. It will push a SignalWithStartWorkflowExecutionRequest to a queue and + * immediately return a response. The request will be processed by a separate consumer eventually. + * + * @param signalWithStartRequest + */ + SignalWithStartWorkflowExecutionAsyncResponse SignalWithStartWorkflowExecutionAsync( + SignalWithStartWorkflowExecutionAsyncRequest signalWithStartRequest) + throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError, + DomainNotActiveError, LimitExceededError, EntityNotExistsError, + ClientVersionNotSupportedError, BaseError; + + /** + * ResetWorkflowExecution reset an existing workflow execution to DecisionTaskCompleted + * event(exclusive). And it will immediately terminating the current execution instance. + * + * @param resetRequest + */ + ResetWorkflowExecutionResponse ResetWorkflowExecution(ResetWorkflowExecutionRequest resetRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, + LimitExceededError, ClientVersionNotSupportedError, BaseError; + + /** + * TerminateWorkflowExecution terminates an existing workflow execution by recording + * WorkflowExecutionTerminated event in the history and immediately terminating the execution + * instance. + * + * @param terminateRequest + */ + void TerminateWorkflowExecution(TerminateWorkflowExecutionRequest terminateRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, + LimitExceededError, ClientVersionNotSupportedError, + WorkflowExecutionAlreadyCompletedError, BaseError; + + /** + * ListOpenWorkflowExecutions is a visibility API to list the open executions in a specific + * domain. + * + * @param listRequest + */ + ListOpenWorkflowExecutionsResponse ListOpenWorkflowExecutions( + ListOpenWorkflowExecutionsRequest listRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, LimitExceededError, + ClientVersionNotSupportedError, BaseError; + + /** + * ListClosedWorkflowExecutions is a visibility API to list the closed executions in a specific + * domain. + * + * @param listRequest + */ + ListClosedWorkflowExecutionsResponse ListClosedWorkflowExecutions( + ListClosedWorkflowExecutionsRequest listRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, BaseError; + + /** + * ListWorkflowExecutions is a visibility API to list workflow executions in a specific domain. + * + * @param listRequest + */ + ListWorkflowExecutionsResponse ListWorkflowExecutions(ListWorkflowExecutionsRequest listRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, BaseError; + + /** + * ListArchivedWorkflowExecutions is a visibility API to list archived workflow executions in a + * specific domain. + * + * @param listRequest + */ + ListArchivedWorkflowExecutionsResponse ListArchivedWorkflowExecutions( + ListArchivedWorkflowExecutionsRequest listRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, BaseError; + + /** + * ScanWorkflowExecutions is a visibility API to list large amount of workflow executions in a + * specific domain without order. + * + * @param listRequest + */ + ListWorkflowExecutionsResponse ScanWorkflowExecutions(ListWorkflowExecutionsRequest listRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, BaseError; + + /** + * CountWorkflowExecutions is a visibility API to count of workflow executions in a specific + * domain. + * + * @param countRequest + */ + CountWorkflowExecutionsResponse CountWorkflowExecutions( + CountWorkflowExecutionsRequest countRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, BaseError; + + /** + * GetSearchAttributes is a visibility API to get all legal keys that could be used in list APIs + */ + GetSearchAttributesResponse GetSearchAttributes() + throws ServiceBusyError, ClientVersionNotSupportedError, BaseError; + + /** + * RespondQueryTaskCompleted is called by application worker to complete a QueryTask (which is a + * DecisionTask for query) as a result of 'PollForDecisionTask' API call. Completing a QueryTask + * will unblock the client call to 'QueryWorkflow' API and return the query result to client as a + * response to 'QueryWorkflow' API call. + * + * @param completeRequest + */ + void RespondQueryTaskCompleted(RespondQueryTaskCompletedRequest completeRequest) + throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, + DomainNotActiveError, ClientVersionNotSupportedError, BaseError; + + /** + * Reset the sticky tasklist related information in mutable state of a given workflow. Things + * cleared are: 1. StickyTaskList 2. StickyScheduleToStartTimeout 3. ClientLibraryVersion 4. + * ClientFeatureVersion 5. ClientImpl + * + * @param resetRequest + */ + ResetStickyTaskListResponse ResetStickyTaskList(ResetStickyTaskListRequest resetRequest) + throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, + DomainNotActiveError, ClientVersionNotSupportedError, + WorkflowExecutionAlreadyCompletedError, BaseError; + + /** + * QueryWorkflow returns query result for a specified workflow execution + * + * @param queryRequest + */ + QueryWorkflowResponse QueryWorkflow(QueryWorkflowRequest queryRequest) + throws BadRequestError, EntityNotExistsError, QueryFailedError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, BaseError; + + /** + * DescribeWorkflowExecution returns information about the specified workflow execution. + * + * @param describeRequest + */ + DescribeWorkflowExecutionResponse DescribeWorkflowExecution( + DescribeWorkflowExecutionRequest describeRequest) + throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, + ClientVersionNotSupportedError, BaseError; + + /** + * DescribeTaskList returns information about the target tasklist, right now this API returns the + * pollers which polled this tasklist in last few minutes. + * + * @param request + */ + DescribeTaskListResponse DescribeTaskList(DescribeTaskListRequest request) + throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, + ClientVersionNotSupportedError, BaseError; + + /** GetClusterInfo returns information about cadence cluster */ + ClusterInfo GetClusterInfo() throws InternalServiceError, ServiceBusyError, BaseError; + + /** + * GetTaskListsByDomain returns the list of all the task lists for a domainName. + * + * @param request + */ + GetTaskListsByDomainResponse GetTaskListsByDomain(GetTaskListsByDomainRequest request) + throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, + ClientVersionNotSupportedError, BaseError; + + /** + * ReapplyEvents applies stale events to the current workflow and current run + * + * @param request + */ + ListTaskListPartitionsResponse ListTaskListPartitions(ListTaskListPartitionsRequest request) + throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, BaseError; + + /** + * RefreshWorkflowTasks refreshes all tasks of a workflow + * + * @param request + */ + void RefreshWorkflowTasks(RefreshWorkflowTasksRequest request) + throws BadRequestError, DomainNotActiveError, ServiceBusyError, EntityNotExistsError, + BaseError; +} + +interface AsyncIface { + + void RegisterDomain( + RegisterDomainRequest registerRequest, AsyncMethodCallback resultHandler) + throws BaseError; + + void DescribeDomain( + DescribeDomainRequest describeRequest, + AsyncMethodCallback resultHandler) + throws BaseError; + + void ListDomains( + ListDomainsRequest listRequest, AsyncMethodCallback resultHandler) + throws BaseError; + + void UpdateDomain( + UpdateDomainRequest updateRequest, AsyncMethodCallback resultHandler) + throws BaseError; + + void DeprecateDomain( + DeprecateDomainRequest deprecateRequest, AsyncMethodCallback resultHandler) + throws BaseError; + + void RestartWorkflowExecution( + RestartWorkflowExecutionRequest restartRequest, + AsyncMethodCallback resultHandler) + throws BaseError; + + void StartWorkflowExecution( + StartWorkflowExecutionRequest startRequest, + AsyncMethodCallback resultHandler) + throws BaseError; + + void StartWorkflowExecutionAsync( + StartWorkflowExecutionAsyncRequest startRequest, + AsyncMethodCallback resultHandler) + throws BaseError; + + void GetWorkflowExecutionHistory( + GetWorkflowExecutionHistoryRequest getRequest, + AsyncMethodCallback resultHandler) + throws BaseError; + + void PollForDecisionTask( + PollForDecisionTaskRequest pollRequest, + AsyncMethodCallback resultHandler) + throws BaseError; + + void RespondDecisionTaskCompleted( + RespondDecisionTaskCompletedRequest completeRequest, + AsyncMethodCallback resultHandler) + throws BaseError; + + void RespondDecisionTaskFailed( + RespondDecisionTaskFailedRequest failedRequest, AsyncMethodCallback resultHandler) + throws BaseError; + + void PollForActivityTask( + PollForActivityTaskRequest pollRequest, + AsyncMethodCallback resultHandler) + throws BaseError; + + void RecordActivityTaskHeartbeat( + RecordActivityTaskHeartbeatRequest heartbeatRequest, + AsyncMethodCallback resultHandler) + throws BaseError; + + void RecordActivityTaskHeartbeatByID( + RecordActivityTaskHeartbeatByIDRequest heartbeatRequest, + AsyncMethodCallback resultHandler) + throws BaseError; + + void RespondActivityTaskCompleted( + RespondActivityTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler) + throws BaseError; + + void RespondActivityTaskCompletedByID( + RespondActivityTaskCompletedByIDRequest completeRequest, + AsyncMethodCallback resultHandler) + throws BaseError; + + void RespondActivityTaskFailed( + RespondActivityTaskFailedRequest failRequest, AsyncMethodCallback resultHandler) + throws BaseError; + + void RespondActivityTaskFailedByID( + RespondActivityTaskFailedByIDRequest failRequest, AsyncMethodCallback resultHandler) + throws BaseError; + + void RespondActivityTaskCanceled( + RespondActivityTaskCanceledRequest canceledRequest, AsyncMethodCallback resultHandler) + throws BaseError; + + void RespondActivityTaskCanceledByID( + RespondActivityTaskCanceledByIDRequest canceledRequest, + AsyncMethodCallback resultHandler) + throws BaseError; + + void RequestCancelWorkflowExecution( + RequestCancelWorkflowExecutionRequest cancelRequest, AsyncMethodCallback resultHandler) + throws BaseError; + + void SignalWorkflowExecution( + SignalWorkflowExecutionRequest signalRequest, AsyncMethodCallback resultHandler) + throws BaseError; + + void SignalWithStartWorkflowExecution( + SignalWithStartWorkflowExecutionRequest signalWithStartRequest, + AsyncMethodCallback resultHandler) + throws BaseError; + + void SignalWithStartWorkflowExecutionAsync( + SignalWithStartWorkflowExecutionAsyncRequest signalWithStartRequest, + AsyncMethodCallback resultHandler) + throws BaseError; + + void ResetWorkflowExecution( + ResetWorkflowExecutionRequest resetRequest, + AsyncMethodCallback resultHandler) + throws BaseError; + + void TerminateWorkflowExecution( + TerminateWorkflowExecutionRequest terminateRequest, AsyncMethodCallback resultHandler) + throws BaseError; + + void ListOpenWorkflowExecutions( + ListOpenWorkflowExecutionsRequest listRequest, + AsyncMethodCallback resultHandler) + throws BaseError; + + void ListClosedWorkflowExecutions( + ListClosedWorkflowExecutionsRequest listRequest, + AsyncMethodCallback resultHandler) + throws BaseError; + + void ListWorkflowExecutions( + ListWorkflowExecutionsRequest listRequest, + AsyncMethodCallback resultHandler) + throws BaseError; + + void ListArchivedWorkflowExecutions( + ListArchivedWorkflowExecutionsRequest listRequest, + AsyncMethodCallback resultHandler) + throws BaseError; + + void ScanWorkflowExecutions( + ListWorkflowExecutionsRequest listRequest, + AsyncMethodCallback resultHandler) + throws BaseError; + + void CountWorkflowExecutions( + CountWorkflowExecutionsRequest countRequest, + AsyncMethodCallback resultHandler) + throws BaseError; + + void GetSearchAttributes(AsyncMethodCallback resultHandler) + throws BaseError; + + void RespondQueryTaskCompleted( + RespondQueryTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler) + throws BaseError; + + void ResetStickyTaskList( + ResetStickyTaskListRequest resetRequest, + AsyncMethodCallback resultHandler) + throws BaseError; + + void QueryWorkflow( + QueryWorkflowRequest queryRequest, AsyncMethodCallback resultHandler) + throws BaseError; + + void DescribeWorkflowExecution( + DescribeWorkflowExecutionRequest describeRequest, + AsyncMethodCallback resultHandler) + throws BaseError; + + void DescribeTaskList( + DescribeTaskListRequest request, AsyncMethodCallback resultHandler) + throws BaseError; + + void GetClusterInfo(AsyncMethodCallback resultHandler) throws BaseError; + + void GetTaskListsByDomain( + GetTaskListsByDomainRequest request, + AsyncMethodCallback resultHandler) + throws BaseError; + + void ListTaskListPartitions( + ListTaskListPartitionsRequest request, + AsyncMethodCallback resultHandler) + throws BaseError; + + void RefreshWorkflowTasks( + RefreshWorkflowTasksRequest request, AsyncMethodCallback resultHandler) + throws BaseError; +} diff --git a/src/main/java/com/uber/cadence/serviceclient/IWorkflowServiceBase.java b/src/main/java/com/uber/cadence/serviceclient/IWorkflowServiceBase.java index db00bb728..7dda7a723 100644 --- a/src/main/java/com/uber/cadence/serviceclient/IWorkflowServiceBase.java +++ b/src/main/java/com/uber/cadence/serviceclient/IWorkflowServiceBase.java @@ -19,8 +19,6 @@ import com.uber.cadence.*; import java.util.concurrent.CompletableFuture; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; public class IWorkflowServiceBase implements IWorkflowService { @@ -32,35 +30,35 @@ public ClientOptions getOptions() { @Override public void RegisterDomain(RegisterDomainRequest registerRequest) throws BadRequestError, DomainAlreadyExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public DescribeDomainResponse DescribeDomain(DescribeDomainRequest describeRequest) throws BadRequestError, EntityNotExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public ListDomainsResponse ListDomains(ListDomainsRequest listRequest) throws BadRequestError, EntityNotExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public UpdateDomainResponse UpdateDomain(UpdateDomainRequest updateRequest) throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void DeprecateDomain(DeprecateDomainRequest deprecateRequest) throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -68,7 +66,7 @@ public void DeprecateDomain(DeprecateDomainRequest deprecateRequest) public RestartWorkflowExecutionResponse RestartWorkflowExecution( RestartWorkflowExecutionRequest restartRequest) throws BadRequestError, ServiceBusyError, DomainNotActiveError, LimitExceededError, - EntityNotExistsError, ClientVersionNotSupportedError, TException { + EntityNotExistsError, ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -77,7 +75,7 @@ public StartWorkflowExecutionResponse StartWorkflowExecution( StartWorkflowExecutionRequest startRequest) throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError, DomainNotActiveError, LimitExceededError, EntityNotExistsError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -86,7 +84,7 @@ public StartWorkflowExecutionAsyncResponse StartWorkflowExecutionAsync( StartWorkflowExecutionAsyncRequest startRequest) throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError, DomainNotActiveError, LimitExceededError, EntityNotExistsError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -94,14 +92,14 @@ public StartWorkflowExecutionAsyncResponse StartWorkflowExecutionAsync( public GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistory( GetWorkflowExecutionHistoryRequest getRequest) throws BadRequestError, EntityNotExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public PollForDecisionTaskResponse PollForDecisionTask(PollForDecisionTaskRequest pollRequest) throws BadRequestError, ServiceBusyError, LimitExceededError, EntityNotExistsError, - DomainNotActiveError, ClientVersionNotSupportedError, TException { + DomainNotActiveError, ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -110,7 +108,7 @@ public RespondDecisionTaskCompletedResponse RespondDecisionTaskCompleted( RespondDecisionTaskCompletedRequest completeRequest) throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, - TException { + BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -118,14 +116,14 @@ public RespondDecisionTaskCompletedResponse RespondDecisionTaskCompleted( public void RespondDecisionTaskFailed(RespondDecisionTaskFailedRequest failedRequest) throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, - TException { + BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public PollForActivityTaskResponse PollForActivityTask(PollForActivityTaskRequest pollRequest) throws BadRequestError, ServiceBusyError, LimitExceededError, EntityNotExistsError, - DomainNotActiveError, ClientVersionNotSupportedError, TException { + DomainNotActiveError, ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -134,7 +132,7 @@ public RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeat( RecordActivityTaskHeartbeatRequest heartbeatRequest) throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, - TException { + BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -143,7 +141,7 @@ public RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeatByID( RecordActivityTaskHeartbeatByIDRequest heartbeatRequest) throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, - TException { + BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -151,7 +149,7 @@ public RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeatByID( public void RespondActivityTaskCompleted(RespondActivityTaskCompletedRequest completeRequest) throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, - TException { + BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -160,7 +158,7 @@ public void RespondActivityTaskCompletedByID( RespondActivityTaskCompletedByIDRequest completeRequest) throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, - TException { + BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -168,7 +166,7 @@ public void RespondActivityTaskCompletedByID( public void RespondActivityTaskFailed(RespondActivityTaskFailedRequest failRequest) throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, - TException { + BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -176,7 +174,7 @@ public void RespondActivityTaskFailed(RespondActivityTaskFailedRequest failReque public void RespondActivityTaskFailedByID(RespondActivityTaskFailedByIDRequest failRequest) throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, - TException { + BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -184,7 +182,7 @@ public void RespondActivityTaskFailedByID(RespondActivityTaskFailedByIDRequest f public void RespondActivityTaskCanceled(RespondActivityTaskCanceledRequest canceledRequest) throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, - TException { + BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -193,7 +191,7 @@ public void RespondActivityTaskCanceledByID( RespondActivityTaskCanceledByIDRequest canceledRequest) throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, - TException { + BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -201,7 +199,7 @@ public void RespondActivityTaskCanceledByID( public void RequestCancelWorkflowExecution(RequestCancelWorkflowExecutionRequest cancelRequest) throws BadRequestError, EntityNotExistsError, CancellationAlreadyRequestedError, ServiceBusyError, DomainNotActiveError, LimitExceededError, - ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, TException { + ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -209,7 +207,7 @@ public void RequestCancelWorkflowExecution(RequestCancelWorkflowExecutionRequest public void SignalWorkflowExecution(SignalWorkflowExecutionRequest signalRequest) throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, LimitExceededError, ClientVersionNotSupportedError, - WorkflowExecutionAlreadyCompletedError, TException { + WorkflowExecutionAlreadyCompletedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -218,7 +216,7 @@ public StartWorkflowExecutionResponse SignalWithStartWorkflowExecution( SignalWithStartWorkflowExecutionRequest signalWithStartRequest) throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, LimitExceededError, WorkflowExecutionAlreadyStartedError, ClientVersionNotSupportedError, - TException { + BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -227,7 +225,7 @@ public SignalWithStartWorkflowExecutionAsyncResponse SignalWithStartWorkflowExec SignalWithStartWorkflowExecutionAsyncRequest signalWithStartRequest) throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError, DomainNotActiveError, LimitExceededError, EntityNotExistsError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -235,7 +233,7 @@ public SignalWithStartWorkflowExecutionAsyncResponse SignalWithStartWorkflowExec public ResetWorkflowExecutionResponse ResetWorkflowExecution( ResetWorkflowExecutionRequest resetRequest) throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, - LimitExceededError, ClientVersionNotSupportedError, TException { + LimitExceededError, ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -243,7 +241,7 @@ public ResetWorkflowExecutionResponse ResetWorkflowExecution( public void TerminateWorkflowExecution(TerminateWorkflowExecutionRequest terminateRequest) throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, LimitExceededError, ClientVersionNotSupportedError, - WorkflowExecutionAlreadyCompletedError, TException { + WorkflowExecutionAlreadyCompletedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -251,7 +249,7 @@ public void TerminateWorkflowExecution(TerminateWorkflowExecutionRequest termina public ListOpenWorkflowExecutionsResponse ListOpenWorkflowExecutions( ListOpenWorkflowExecutionsRequest listRequest) throws BadRequestError, EntityNotExistsError, ServiceBusyError, LimitExceededError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -259,7 +257,7 @@ public ListOpenWorkflowExecutionsResponse ListOpenWorkflowExecutions( public ListClosedWorkflowExecutionsResponse ListClosedWorkflowExecutions( ListClosedWorkflowExecutionsRequest listRequest) throws BadRequestError, EntityNotExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -267,7 +265,7 @@ public ListClosedWorkflowExecutionsResponse ListClosedWorkflowExecutions( public ListWorkflowExecutionsResponse ListWorkflowExecutions( ListWorkflowExecutionsRequest listRequest) throws BadRequestError, EntityNotExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -275,7 +273,7 @@ public ListWorkflowExecutionsResponse ListWorkflowExecutions( public ListArchivedWorkflowExecutionsResponse ListArchivedWorkflowExecutions( ListArchivedWorkflowExecutionsRequest listRequest) throws BadRequestError, EntityNotExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -283,7 +281,7 @@ public ListArchivedWorkflowExecutionsResponse ListArchivedWorkflowExecutions( public ListWorkflowExecutionsResponse ScanWorkflowExecutions( ListWorkflowExecutionsRequest listRequest) throws BadRequestError, EntityNotExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -291,20 +289,20 @@ public ListWorkflowExecutionsResponse ScanWorkflowExecutions( public CountWorkflowExecutionsResponse CountWorkflowExecutions( CountWorkflowExecutionsRequest countRequest) throws BadRequestError, EntityNotExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public GetSearchAttributesResponse GetSearchAttributes() - throws ServiceBusyError, ClientVersionNotSupportedError, TException { + throws ServiceBusyError, ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void RespondQueryTaskCompleted(RespondQueryTaskCompletedRequest completeRequest) throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, - DomainNotActiveError, ClientVersionNotSupportedError, TException { + DomainNotActiveError, ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -312,14 +310,14 @@ public void RespondQueryTaskCompleted(RespondQueryTaskCompletedRequest completeR public ResetStickyTaskListResponse ResetStickyTaskList(ResetStickyTaskListRequest resetRequest) throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, DomainNotActiveError, ClientVersionNotSupportedError, - WorkflowExecutionAlreadyCompletedError, TException { + WorkflowExecutionAlreadyCompletedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public QueryWorkflowResponse QueryWorkflow(QueryWorkflowRequest queryRequest) throws BadRequestError, EntityNotExistsError, QueryFailedError, LimitExceededError, - ServiceBusyError, ClientVersionNotSupportedError, TException { + ServiceBusyError, ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -327,26 +325,26 @@ public QueryWorkflowResponse QueryWorkflow(QueryWorkflowRequest queryRequest) public DescribeWorkflowExecutionResponse DescribeWorkflowExecution( DescribeWorkflowExecutionRequest describeRequest) throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public DescribeTaskListResponse DescribeTaskList(DescribeTaskListRequest request) throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override - public ClusterInfo GetClusterInfo() throws InternalServiceError, ServiceBusyError, TException { + public ClusterInfo GetClusterInfo() throws InternalServiceError, ServiceBusyError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public GetTaskListsByDomainResponse GetTaskListsByDomain(GetTaskListsByDomainRequest request) throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, - ClientVersionNotSupportedError, TException { + ClientVersionNotSupportedError, BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -354,169 +352,168 @@ public GetTaskListsByDomainResponse GetTaskListsByDomain(GetTaskListsByDomainReq public ListTaskListPartitionsResponse ListTaskListPartitions( ListTaskListPartitionsRequest request) throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, - TException { + BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void RefreshWorkflowTasks(RefreshWorkflowTasksRequest request) throws BadRequestError, DomainNotActiveError, ServiceBusyError, EntityNotExistsError, - TException { + BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void RegisterDomain( - RegisterDomainRequest registerRequest, AsyncMethodCallback resultHandler) throws TException { + RegisterDomainRequest registerRequest, AsyncMethodCallback resultHandler) throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void DescribeDomain( - DescribeDomainRequest describeRequest, AsyncMethodCallback resultHandler) throws TException { + DescribeDomainRequest describeRequest, AsyncMethodCallback resultHandler) throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void ListDomains(ListDomainsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void UpdateDomain(UpdateDomainRequest updateRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void DeprecateDomain( - DeprecateDomainRequest deprecateRequest, AsyncMethodCallback resultHandler) - throws TException { + DeprecateDomainRequest deprecateRequest, AsyncMethodCallback resultHandler) throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void RestartWorkflowExecution( RestartWorkflowExecutionRequest restartRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void StartWorkflowExecution( StartWorkflowExecutionRequest startRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void StartWorkflowExecutionAsync( StartWorkflowExecutionAsyncRequest startRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void GetWorkflowExecutionHistory( GetWorkflowExecutionHistoryRequest getRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void PollForDecisionTask( - PollForDecisionTaskRequest pollRequest, AsyncMethodCallback resultHandler) throws TException { + PollForDecisionTaskRequest pollRequest, AsyncMethodCallback resultHandler) throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void RespondDecisionTaskCompleted( RespondDecisionTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void RespondDecisionTaskFailed( RespondDecisionTaskFailedRequest failedRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void PollForActivityTask( - PollForActivityTaskRequest pollRequest, AsyncMethodCallback resultHandler) throws TException { + PollForActivityTaskRequest pollRequest, AsyncMethodCallback resultHandler) throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void RecordActivityTaskHeartbeat( RecordActivityTaskHeartbeatRequest heartbeatRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void RecordActivityTaskHeartbeatByID( RecordActivityTaskHeartbeatByIDRequest heartbeatRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void RespondActivityTaskCompleted( RespondActivityTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void RespondActivityTaskCompletedByID( RespondActivityTaskCompletedByIDRequest completeRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void RespondActivityTaskFailed( RespondActivityTaskFailedRequest failRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void RespondActivityTaskFailedByID( RespondActivityTaskFailedByIDRequest failRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void RespondActivityTaskCanceled( RespondActivityTaskCanceledRequest canceledRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void RespondActivityTaskCanceledByID( RespondActivityTaskCanceledByIDRequest canceledRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void RequestCancelWorkflowExecution( RequestCancelWorkflowExecutionRequest cancelRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void SignalWorkflowExecution( SignalWorkflowExecutionRequest signalRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -524,7 +521,7 @@ public void SignalWorkflowExecution( public void SignalWithStartWorkflowExecution( SignalWithStartWorkflowExecutionRequest signalWithStartRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -532,124 +529,123 @@ public void SignalWithStartWorkflowExecution( public void SignalWithStartWorkflowExecutionAsync( SignalWithStartWorkflowExecutionAsyncRequest signalWithStartRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void ResetWorkflowExecution( ResetWorkflowExecutionRequest resetRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void TerminateWorkflowExecution( TerminateWorkflowExecutionRequest terminateRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void ListOpenWorkflowExecutions( ListOpenWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void ListClosedWorkflowExecutions( ListClosedWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void ListWorkflowExecutions( ListWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void ListArchivedWorkflowExecutions( ListArchivedWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void ScanWorkflowExecutions( ListWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void CountWorkflowExecutions( CountWorkflowExecutionsRequest countRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override - public void GetSearchAttributes(AsyncMethodCallback resultHandler) throws TException { + public void GetSearchAttributes(AsyncMethodCallback resultHandler) throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void RespondQueryTaskCompleted( RespondQueryTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void ResetStickyTaskList( - ResetStickyTaskListRequest resetRequest, AsyncMethodCallback resultHandler) - throws TException { + ResetStickyTaskListRequest resetRequest, AsyncMethodCallback resultHandler) throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void QueryWorkflow(QueryWorkflowRequest queryRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void DescribeWorkflowExecution( DescribeWorkflowExecutionRequest describeRequest, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void DescribeTaskList(DescribeTaskListRequest request, AsyncMethodCallback resultHandler) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override - public void GetClusterInfo(AsyncMethodCallback resultHandler) throws TException { + public void GetClusterInfo(AsyncMethodCallback resultHandler) throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void GetTaskListsByDomain( - GetTaskListsByDomainRequest request, AsyncMethodCallback resultHandler) throws TException { + GetTaskListsByDomainRequest request, AsyncMethodCallback resultHandler) throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void ListTaskListPartitions( - ListTaskListPartitionsRequest request, AsyncMethodCallback resultHandler) throws TException { + ListTaskListPartitionsRequest request, AsyncMethodCallback resultHandler) throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public void RefreshWorkflowTasks( - RefreshWorkflowTasksRequest request, AsyncMethodCallback resultHandler) throws TException { + RefreshWorkflowTasksRequest request, AsyncMethodCallback resultHandler) throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -663,7 +659,7 @@ public void StartWorkflowExecutionWithTimeout( StartWorkflowExecutionRequest startRequest, AsyncMethodCallback resultHandler, Long timeoutInMillis) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -672,13 +668,13 @@ public void StartWorkflowExecutionAsyncWithTimeout( StartWorkflowExecutionAsyncRequest startAsyncRequest, AsyncMethodCallback resultHandler, Long timeoutInMillis) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @Override public GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistoryWithTimeout( - GetWorkflowExecutionHistoryRequest getRequest, Long timeoutInMillis) throws TException { + GetWorkflowExecutionHistoryRequest getRequest, Long timeoutInMillis) throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -687,7 +683,7 @@ public void GetWorkflowExecutionHistoryWithTimeout( GetWorkflowExecutionHistoryRequest getRequest, AsyncMethodCallback resultHandler, Long timeoutInMillis) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } @@ -696,7 +692,7 @@ public void SignalWorkflowExecutionWithTimeout( SignalWorkflowExecutionRequest signalRequest, AsyncMethodCallback resultHandler, Long timeoutInMillis) - throws TException { + throws BaseError { throw new UnsupportedOperationException("unimplemented"); } diff --git a/src/main/java/com/uber/cadence/serviceclient/WorkflowServiceGrpc.java b/src/main/java/com/uber/cadence/serviceclient/WorkflowServiceGrpc.java new file mode 100644 index 000000000..7bdd63177 --- /dev/null +++ b/src/main/java/com/uber/cadence/serviceclient/WorkflowServiceGrpc.java @@ -0,0 +1,1393 @@ +/* + * 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 com.google.common.util.concurrent.FutureCallback; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.MoreExecutors; +import com.uber.cadence.*; +import com.uber.cadence.BadRequestError; +import com.uber.cadence.BaseError; +import com.uber.cadence.CancellationAlreadyRequestedError; +import com.uber.cadence.ClientVersionNotSupportedError; +import com.uber.cadence.DomainAlreadyExistsError; +import com.uber.cadence.DomainNotActiveError; +import com.uber.cadence.EntityNotExistsError; +import com.uber.cadence.InternalServiceError; +import com.uber.cadence.LimitExceededError; +import com.uber.cadence.QueryFailedError; +import com.uber.cadence.ServiceBusyError; +import com.uber.cadence.WorkflowExecutionAlreadyCompletedError; +import com.uber.cadence.WorkflowExecutionAlreadyStartedError; +import com.uber.cadence.internal.compatibility.proto.mappers.*; +import com.uber.cadence.internal.compatibility.proto.serviceclient.IGrpcServiceStubs; +import io.grpc.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executor; +import java.util.concurrent.TimeUnit; +import java.util.function.Function; + +public class WorkflowServiceGrpc implements IWorkflowService { + + private final IGrpcServiceStubs grpcServiceStubs; + private final Executor executor = MoreExecutors.directExecutor(); + + public WorkflowServiceGrpc(ClientOptions options) { + this.grpcServiceStubs = IGrpcServiceStubs.newInstance(options); + } + + @Override + public void close() { + grpcServiceStubs.shutdown(); + } + + @Override + public ClientOptions getOptions() { + return grpcServiceStubs.getOptions(); + } + + @Override + public CompletableFuture isHealthy() { + CompletableFuture completableFuture = new CompletableFuture<>(); + Futures.addCallback( + grpcServiceStubs + .metaFutureStub() + .health(com.uber.cadence.api.v1.HealthRequest.getDefaultInstance()), + new FutureCallback() { + @Override + public void onSuccess(com.uber.cadence.api.v1.HealthResponse response) { + completableFuture.complete(response.getOk()); + } + + @Override + public void onFailure(Throwable throwable) { + completableFuture.completeExceptionally(toServiceClientException(throwable)); + } + }, + executor); + return completableFuture; + } + + @Override + public void StartWorkflowExecutionWithTimeout( + StartWorkflowExecutionRequest startRequest, + AsyncMethodCallback resultHandler, + Long timeoutInMillis) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .withDeadlineAfter(timeoutInMillis, TimeUnit.MILLISECONDS) + .startWorkflowExecution(RequestMapper.startWorkflowExecutionRequest(startRequest)), + toFutureCallback(resultHandler, ResponseMapper::startWorkflowExecutionResponse), + executor); + } + + @Override + public void StartWorkflowExecutionAsyncWithTimeout( + StartWorkflowExecutionAsyncRequest startAsyncRequest, + AsyncMethodCallback resultHandler, + Long timeoutInMillis) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .withDeadlineAfter(timeoutInMillis, TimeUnit.MILLISECONDS) + .startWorkflowExecutionAsync( + RequestMapper.startWorkflowExecutionAsyncRequest(startAsyncRequest)), + toFutureCallback(resultHandler, ResponseMapper::startWorkflowExecutionAsyncResponse), + executor); + } + + @Override + public GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistoryWithTimeout( + GetWorkflowExecutionHistoryRequest getRequest, Long timeoutInMillis) throws BaseError { + try { + return ResponseMapper.getWorkflowExecutionHistoryResponse( + grpcServiceStubs + .workflowBlockingStub() + .withDeadlineAfter(timeoutInMillis, TimeUnit.MILLISECONDS) + .getWorkflowExecutionHistory( + RequestMapper.getWorkflowExecutionHistoryRequest(getRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void GetWorkflowExecutionHistoryWithTimeout( + GetWorkflowExecutionHistoryRequest getRequest, + AsyncMethodCallback resultHandler, + Long timeoutInMillis) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .withDeadlineAfter(timeoutInMillis, TimeUnit.MILLISECONDS) + .getWorkflowExecutionHistory( + RequestMapper.getWorkflowExecutionHistoryRequest(getRequest)), + toFutureCallback(resultHandler, ResponseMapper::getWorkflowExecutionHistoryResponse), + executor); + } + + @Override + public void SignalWorkflowExecutionWithTimeout( + SignalWorkflowExecutionRequest signalRequest, + AsyncMethodCallback resultHandler, + Long timeoutInMillis) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .withDeadlineAfter(timeoutInMillis, TimeUnit.MILLISECONDS) + .signalWorkflowExecution(RequestMapper.signalWorkflowExecutionRequest(signalRequest)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + @Override + public void RegisterDomain(RegisterDomainRequest registerRequest) + throws BadRequestError, DomainAlreadyExistsError, ServiceBusyError, + ClientVersionNotSupportedError, BaseError { + try { + grpcServiceStubs + .domainBlockingStub() + .registerDomain(RequestMapper.registerDomainRequest(registerRequest)); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public DescribeDomainResponse DescribeDomain(DescribeDomainRequest describeRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, BaseError { + try { + return ResponseMapper.describeDomainResponse( + grpcServiceStubs + .domainBlockingStub() + .describeDomain(RequestMapper.describeDomainRequest(describeRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public ListDomainsResponse ListDomains(ListDomainsRequest listRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, BaseError { + try { + return ResponseMapper.listDomainsResponse( + grpcServiceStubs + .domainBlockingStub() + .listDomains(RequestMapper.listDomainsRequest(listRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public UpdateDomainResponse UpdateDomain(UpdateDomainRequest updateRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, + ClientVersionNotSupportedError, BaseError { + try { + return ResponseMapper.updateDomainResponse( + grpcServiceStubs + .domainBlockingStub() + .updateDomain(RequestMapper.updateDomainRequest(updateRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void DeprecateDomain(DeprecateDomainRequest deprecateRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, + ClientVersionNotSupportedError, BaseError { + try { + grpcServiceStubs + .domainBlockingStub() + .deprecateDomain(RequestMapper.deprecateDomainRequest(deprecateRequest)); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public RestartWorkflowExecutionResponse RestartWorkflowExecution( + RestartWorkflowExecutionRequest restartRequest) + throws BadRequestError, ServiceBusyError, DomainNotActiveError, LimitExceededError, + EntityNotExistsError, ClientVersionNotSupportedError, BaseError { + try { + return ResponseMapper.restartWorkflowExecutionResponse( + grpcServiceStubs + .workflowBlockingStub() + .restartWorkflowExecution( + RequestMapper.restartWorkflowExecutionRequest(restartRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public StartWorkflowExecutionResponse StartWorkflowExecution( + StartWorkflowExecutionRequest startRequest) + throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError, + DomainNotActiveError, LimitExceededError, EntityNotExistsError, + ClientVersionNotSupportedError, BaseError { + try { + return ResponseMapper.startWorkflowExecutionResponse( + grpcServiceStubs + .workflowBlockingStub() + .startWorkflowExecution(RequestMapper.startWorkflowExecutionRequest(startRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public StartWorkflowExecutionAsyncResponse StartWorkflowExecutionAsync( + StartWorkflowExecutionAsyncRequest startRequest) + throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError, + DomainNotActiveError, LimitExceededError, EntityNotExistsError, + ClientVersionNotSupportedError, BaseError { + try { + return ResponseMapper.startWorkflowExecutionAsyncResponse( + grpcServiceStubs + .workflowBlockingStub() + .startWorkflowExecutionAsync( + RequestMapper.startWorkflowExecutionAsyncRequest(startRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistory( + GetWorkflowExecutionHistoryRequest getRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, BaseError { + try { + return ResponseMapper.getWorkflowExecutionHistoryResponse( + grpcServiceStubs + .workflowBlockingStub() + .getWorkflowExecutionHistory( + RequestMapper.getWorkflowExecutionHistoryRequest(getRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public PollForDecisionTaskResponse PollForDecisionTask(PollForDecisionTaskRequest pollRequest) + throws BadRequestError, ServiceBusyError, LimitExceededError, EntityNotExistsError, + DomainNotActiveError, ClientVersionNotSupportedError, BaseError { + try { + return ResponseMapper.pollForDecisionTaskResponse( + grpcServiceStubs + .workerBlockingStub() + .pollForDecisionTask(RequestMapper.pollForDecisionTaskRequest(pollRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public RespondDecisionTaskCompletedResponse RespondDecisionTaskCompleted( + RespondDecisionTaskCompletedRequest completeRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + BaseError { + try { + return ResponseMapper.respondDecisionTaskCompletedResponse( + grpcServiceStubs + .workerBlockingStub() + .respondDecisionTaskCompleted( + RequestMapper.respondDecisionTaskCompletedRequest(completeRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void RespondDecisionTaskFailed(RespondDecisionTaskFailedRequest failedRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + BaseError { + try { + grpcServiceStubs + .workerBlockingStub() + .respondDecisionTaskFailed(RequestMapper.respondDecisionTaskFailedRequest(failedRequest)); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public PollForActivityTaskResponse PollForActivityTask(PollForActivityTaskRequest pollRequest) + throws BadRequestError, ServiceBusyError, LimitExceededError, EntityNotExistsError, + DomainNotActiveError, ClientVersionNotSupportedError, BaseError { + try { + return ResponseMapper.pollForActivityTaskResponse( + grpcServiceStubs + .workerBlockingStub() + .pollForActivityTask(RequestMapper.pollForActivityTaskRequest(pollRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeat( + RecordActivityTaskHeartbeatRequest heartbeatRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + BaseError { + try { + return ResponseMapper.recordActivityTaskHeartbeatResponse( + grpcServiceStubs + .workerBlockingStub() + .recordActivityTaskHeartbeat( + RequestMapper.recordActivityTaskHeartbeatRequest(heartbeatRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeatByID( + RecordActivityTaskHeartbeatByIDRequest heartbeatRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + BaseError { + try { + return ResponseMapper.recordActivityTaskHeartbeatResponse( + grpcServiceStubs + .workerBlockingStub() + .recordActivityTaskHeartbeatByID( + RequestMapper.recordActivityTaskHeartbeatByIDRequest(heartbeatRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void RespondActivityTaskCompleted(RespondActivityTaskCompletedRequest completeRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + BaseError { + try { + grpcServiceStubs + .workerBlockingStub() + .respondActivityTaskCompleted( + RequestMapper.respondActivityTaskCompletedRequest(completeRequest)); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void RespondActivityTaskCompletedByID( + RespondActivityTaskCompletedByIDRequest completeRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + BaseError { + try { + grpcServiceStubs + .workerBlockingStub() + .respondActivityTaskCompletedByID( + RequestMapper.respondActivityTaskCompletedByIDRequest(completeRequest)); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void RespondActivityTaskFailed(RespondActivityTaskFailedRequest failRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + BaseError { + try { + grpcServiceStubs + .workerBlockingStub() + .respondActivityTaskFailed(RequestMapper.respondActivityTaskFailedRequest(failRequest)); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void RespondActivityTaskFailedByID(RespondActivityTaskFailedByIDRequest failRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + BaseError { + try { + grpcServiceStubs + .workerBlockingStub() + .respondActivityTaskFailedByID( + RequestMapper.respondActivityTaskFailedByIDRequest(failRequest)); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void RespondActivityTaskCanceled(RespondActivityTaskCanceledRequest canceledRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + BaseError { + try { + grpcServiceStubs + .workerBlockingStub() + .respondActivityTaskCanceled( + RequestMapper.respondActivityTaskCanceledRequest(canceledRequest)); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void RespondActivityTaskCanceledByID( + RespondActivityTaskCanceledByIDRequest canceledRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + BaseError { + try { + grpcServiceStubs + .workerBlockingStub() + .respondActivityTaskCanceledByID( + RequestMapper.respondActivityTaskCanceledByIDRequest(canceledRequest)); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void RequestCancelWorkflowExecution(RequestCancelWorkflowExecutionRequest cancelRequest) + throws BadRequestError, EntityNotExistsError, CancellationAlreadyRequestedError, + ServiceBusyError, DomainNotActiveError, LimitExceededError, + ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, BaseError { + try { + grpcServiceStubs + .workflowBlockingStub() + .requestCancelWorkflowExecution( + RequestMapper.requestCancelWorkflowExecutionRequest(cancelRequest)); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void SignalWorkflowExecution(SignalWorkflowExecutionRequest signalRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, + LimitExceededError, ClientVersionNotSupportedError, + WorkflowExecutionAlreadyCompletedError, BaseError { + try { + grpcServiceStubs + .workflowBlockingStub() + .signalWorkflowExecution(RequestMapper.signalWorkflowExecutionRequest(signalRequest)); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public StartWorkflowExecutionResponse SignalWithStartWorkflowExecution( + SignalWithStartWorkflowExecutionRequest signalWithStartRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, + LimitExceededError, WorkflowExecutionAlreadyStartedError, ClientVersionNotSupportedError, + BaseError { + try { + return ResponseMapper.signalWithStartWorkflowExecutionResponse( + grpcServiceStubs + .workflowBlockingStub() + .signalWithStartWorkflowExecution( + RequestMapper.signalWithStartWorkflowExecutionRequest(signalWithStartRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public SignalWithStartWorkflowExecutionAsyncResponse SignalWithStartWorkflowExecutionAsync( + SignalWithStartWorkflowExecutionAsyncRequest signalWithStartRequest) + throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError, + DomainNotActiveError, LimitExceededError, EntityNotExistsError, + ClientVersionNotSupportedError, BaseError { + try { + return ResponseMapper.signalWithStartWorkflowExecutionAsyncResponse( + grpcServiceStubs + .workflowBlockingStub() + .signalWithStartWorkflowExecutionAsync( + RequestMapper.signalWithStartWorkflowExecutionAsyncRequest( + signalWithStartRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public ResetWorkflowExecutionResponse ResetWorkflowExecution( + ResetWorkflowExecutionRequest resetRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, + LimitExceededError, ClientVersionNotSupportedError, BaseError { + try { + return ResponseMapper.resetWorkflowExecutionResponse( + grpcServiceStubs + .workflowBlockingStub() + .resetWorkflowExecution(RequestMapper.resetWorkflowExecutionRequest(resetRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void TerminateWorkflowExecution(TerminateWorkflowExecutionRequest terminateRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, + LimitExceededError, ClientVersionNotSupportedError, + WorkflowExecutionAlreadyCompletedError, BaseError { + try { + grpcServiceStubs + .workflowBlockingStub() + .terminateWorkflowExecution( + RequestMapper.terminateWorkflowExecutionRequest(terminateRequest)); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public ListOpenWorkflowExecutionsResponse ListOpenWorkflowExecutions( + ListOpenWorkflowExecutionsRequest listRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, LimitExceededError, + ClientVersionNotSupportedError, BaseError { + try { + return ResponseMapper.listOpenWorkflowExecutionsResponse( + grpcServiceStubs + .visibilityBlockingStub() + .listOpenWorkflowExecutions( + RequestMapper.listOpenWorkflowExecutionsRequest(listRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public ListClosedWorkflowExecutionsResponse ListClosedWorkflowExecutions( + ListClosedWorkflowExecutionsRequest listRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, BaseError { + try { + return ResponseMapper.listClosedWorkflowExecutionsResponse( + grpcServiceStubs + .visibilityBlockingStub() + .listClosedWorkflowExecutions( + RequestMapper.listClosedWorkflowExecutionsRequest(listRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public ListWorkflowExecutionsResponse ListWorkflowExecutions( + ListWorkflowExecutionsRequest listRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, BaseError { + try { + return ResponseMapper.listWorkflowExecutionsResponse( + grpcServiceStubs + .visibilityBlockingStub() + .listWorkflowExecutions(RequestMapper.listWorkflowExecutionsRequest(listRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public ListArchivedWorkflowExecutionsResponse ListArchivedWorkflowExecutions( + ListArchivedWorkflowExecutionsRequest listRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, BaseError { + try { + return ResponseMapper.listArchivedWorkflowExecutionsResponse( + grpcServiceStubs + .visibilityBlockingStub() + .listArchivedWorkflowExecutions( + RequestMapper.listArchivedWorkflowExecutionsRequest(listRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public ListWorkflowExecutionsResponse ScanWorkflowExecutions( + ListWorkflowExecutionsRequest listRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, BaseError { + try { + return ResponseMapper.scanWorkflowExecutionsResponse( + grpcServiceStubs + .visibilityBlockingStub() + .scanWorkflowExecutions(RequestMapper.scanWorkflowExecutionsRequest(listRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public CountWorkflowExecutionsResponse CountWorkflowExecutions( + CountWorkflowExecutionsRequest countRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, BaseError { + try { + return ResponseMapper.countWorkflowExecutionsResponse( + grpcServiceStubs + .visibilityBlockingStub() + .countWorkflowExecutions(RequestMapper.countWorkflowExecutionsRequest(countRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public GetSearchAttributesResponse GetSearchAttributes() + throws ServiceBusyError, ClientVersionNotSupportedError, BaseError { + try { + return ResponseMapper.getSearchAttributesResponse( + grpcServiceStubs + .visibilityBlockingStub() + .getSearchAttributes( + com.uber.cadence.api.v1.GetSearchAttributesRequest.newBuilder().build())); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void RespondQueryTaskCompleted(RespondQueryTaskCompletedRequest completeRequest) + throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, + DomainNotActiveError, ClientVersionNotSupportedError, BaseError { + try { + grpcServiceStubs + .workerBlockingStub() + .respondQueryTaskCompleted( + RequestMapper.respondQueryTaskCompletedRequest(completeRequest)); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public ResetStickyTaskListResponse ResetStickyTaskList(ResetStickyTaskListRequest resetRequest) + throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, + DomainNotActiveError, ClientVersionNotSupportedError, + WorkflowExecutionAlreadyCompletedError, BaseError { + try { + return ResponseMapper.resetStickyTaskListResponse( + grpcServiceStubs + .workerBlockingStub() + .resetStickyTaskList(RequestMapper.resetStickyTaskListRequest(resetRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public QueryWorkflowResponse QueryWorkflow(QueryWorkflowRequest queryRequest) + throws BadRequestError, EntityNotExistsError, QueryFailedError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, BaseError { + try { + return ResponseMapper.queryWorkflowResponse( + grpcServiceStubs + .workflowBlockingStub() + .queryWorkflow(RequestMapper.queryWorkflowRequest(queryRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public DescribeWorkflowExecutionResponse DescribeWorkflowExecution( + DescribeWorkflowExecutionRequest describeRequest) + throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, + ClientVersionNotSupportedError, BaseError { + try { + return ResponseMapper.describeWorkflowExecutionResponse( + grpcServiceStubs + .workflowBlockingStub() + .describeWorkflowExecution( + RequestMapper.describeWorkflowExecutionRequest(describeRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public DescribeTaskListResponse DescribeTaskList(DescribeTaskListRequest request) + throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, + ClientVersionNotSupportedError, BaseError { + try { + return ResponseMapper.describeTaskListResponse( + grpcServiceStubs + .workflowBlockingStub() + .describeTaskList(RequestMapper.describeTaskListRequest(request))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public ClusterInfo GetClusterInfo() throws InternalServiceError, ServiceBusyError, BaseError { + try { + return ResponseMapper.clusterInfoResponse( + grpcServiceStubs + .workflowBlockingStub() + .getClusterInfo(com.uber.cadence.api.v1.GetClusterInfoRequest.getDefaultInstance())); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public GetTaskListsByDomainResponse GetTaskListsByDomain(GetTaskListsByDomainRequest request) + throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, + ClientVersionNotSupportedError, BaseError { + try { + return ResponseMapper.getTaskListsByDomainResponse( + grpcServiceStubs + .workflowBlockingStub() + .getTaskListsByDomain(RequestMapper.getTaskListsByDomainRequest(request))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public ListTaskListPartitionsResponse ListTaskListPartitions( + ListTaskListPartitionsRequest request) + throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, + BaseError { + try { + return ResponseMapper.listTaskListPartitionsResponse( + grpcServiceStubs + .workflowBlockingStub() + .listTaskListPartitions(RequestMapper.listTaskListPartitionsRequest(request))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void RefreshWorkflowTasks(RefreshWorkflowTasksRequest request) + throws BadRequestError, DomainNotActiveError, ServiceBusyError, EntityNotExistsError, + BaseError { + try { + grpcServiceStubs + .workflowBlockingStub() + .refreshWorkflowTasks(RequestMapper.refreshWorkflowTasksRequest(request)); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void RegisterDomain( + RegisterDomainRequest registerRequest, AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .domainFutureStub() + .registerDomain(RequestMapper.registerDomainRequest(registerRequest)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + @Override + public void DescribeDomain( + DescribeDomainRequest describeRequest, + AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .domainFutureStub() + .describeDomain(RequestMapper.describeDomainRequest(describeRequest)), + toFutureCallback(resultHandler, ResponseMapper::describeDomainResponse), + executor); + } + + @Override + public void ListDomains( + ListDomainsRequest listRequest, AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .domainFutureStub() + .listDomains(RequestMapper.listDomainsRequest(listRequest)), + toFutureCallback(resultHandler, ResponseMapper::listDomainsResponse), + executor); + } + + @Override + public void UpdateDomain( + UpdateDomainRequest updateRequest, AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .domainFutureStub() + .updateDomain(RequestMapper.updateDomainRequest(updateRequest)), + toFutureCallback(resultHandler, ResponseMapper::updateDomainResponse), + executor); + } + + @Override + public void DeprecateDomain( + DeprecateDomainRequest deprecateRequest, AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .domainFutureStub() + .deprecateDomain(RequestMapper.deprecateDomainRequest(deprecateRequest)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + @Override + public void RestartWorkflowExecution( + RestartWorkflowExecutionRequest restartRequest, + AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .restartWorkflowExecution( + RequestMapper.restartWorkflowExecutionRequest(restartRequest)), + toFutureCallback(resultHandler, ResponseMapper::restartWorkflowExecutionResponse), + executor); + } + + @Override + public void StartWorkflowExecution( + StartWorkflowExecutionRequest startRequest, + AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .startWorkflowExecution(RequestMapper.startWorkflowExecutionRequest(startRequest)), + toFutureCallback(resultHandler, ResponseMapper::startWorkflowExecutionResponse), + executor); + } + + @Override + public void StartWorkflowExecutionAsync( + StartWorkflowExecutionAsyncRequest startRequest, + AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .startWorkflowExecutionAsync( + RequestMapper.startWorkflowExecutionAsyncRequest(startRequest)), + toFutureCallback(resultHandler, ResponseMapper::startWorkflowExecutionAsyncResponse), + executor); + } + + @Override + public void GetWorkflowExecutionHistory( + GetWorkflowExecutionHistoryRequest getRequest, + AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .getWorkflowExecutionHistory( + RequestMapper.getWorkflowExecutionHistoryRequest(getRequest)), + toFutureCallback(resultHandler, ResponseMapper::getWorkflowExecutionHistoryResponse), + executor); + } + + @Override + public void PollForDecisionTask( + PollForDecisionTaskRequest pollRequest, + AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workerFutureStub() + .pollForDecisionTask(RequestMapper.pollForDecisionTaskRequest(pollRequest)), + toFutureCallback(resultHandler, ResponseMapper::pollForDecisionTaskResponse), + executor); + } + + @Override + public void RespondDecisionTaskCompleted( + RespondDecisionTaskCompletedRequest completeRequest, + AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workerFutureStub() + .respondDecisionTaskCompleted( + RequestMapper.respondDecisionTaskCompletedRequest(completeRequest)), + toFutureCallback(resultHandler, ResponseMapper::respondDecisionTaskCompletedResponse), + executor); + } + + @Override + public void RespondDecisionTaskFailed( + RespondDecisionTaskFailedRequest failedRequest, AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workerFutureStub() + .respondDecisionTaskFailed( + RequestMapper.respondDecisionTaskFailedRequest(failedRequest)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + @Override + public void PollForActivityTask( + PollForActivityTaskRequest pollRequest, + AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workerFutureStub() + .pollForActivityTask(RequestMapper.pollForActivityTaskRequest(pollRequest)), + toFutureCallback(resultHandler, ResponseMapper::pollForActivityTaskResponse), + executor); + } + + @Override + public void RecordActivityTaskHeartbeat( + RecordActivityTaskHeartbeatRequest heartbeatRequest, + AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workerFutureStub() + .recordActivityTaskHeartbeat( + RequestMapper.recordActivityTaskHeartbeatRequest(heartbeatRequest)), + toFutureCallback(resultHandler, ResponseMapper::recordActivityTaskHeartbeatResponse), + executor); + } + + @Override + public void RecordActivityTaskHeartbeatByID( + RecordActivityTaskHeartbeatByIDRequest heartbeatRequest, + AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workerFutureStub() + .recordActivityTaskHeartbeatByID( + RequestMapper.recordActivityTaskHeartbeatByIDRequest(heartbeatRequest)), + toFutureCallback(resultHandler, ResponseMapper::recordActivityTaskHeartbeatResponse), + executor); + } + + @Override + public void RespondActivityTaskCompleted( + RespondActivityTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workerFutureStub() + .respondActivityTaskCompleted( + RequestMapper.respondActivityTaskCompletedRequest(completeRequest)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + @Override + public void RespondActivityTaskCompletedByID( + RespondActivityTaskCompletedByIDRequest completeRequest, + AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workerFutureStub() + .respondActivityTaskCompletedByID( + RequestMapper.respondActivityTaskCompletedByIDRequest(completeRequest)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + @Override + public void RespondActivityTaskFailed( + RespondActivityTaskFailedRequest failRequest, AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workerFutureStub() + .respondActivityTaskFailed(RequestMapper.respondActivityTaskFailedRequest(failRequest)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + @Override + public void RespondActivityTaskFailedByID( + RespondActivityTaskFailedByIDRequest failRequest, AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workerFutureStub() + .respondActivityTaskFailedByID( + RequestMapper.respondActivityTaskFailedByIDRequest(failRequest)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + @Override + public void RespondActivityTaskCanceled( + RespondActivityTaskCanceledRequest canceledRequest, AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workerFutureStub() + .respondActivityTaskCanceled( + RequestMapper.respondActivityTaskCanceledRequest(canceledRequest)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + @Override + public void RespondActivityTaskCanceledByID( + RespondActivityTaskCanceledByIDRequest canceledRequest, + AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workerFutureStub() + .respondActivityTaskCanceledByID( + RequestMapper.respondActivityTaskCanceledByIDRequest(canceledRequest)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + @Override + public void RequestCancelWorkflowExecution( + RequestCancelWorkflowExecutionRequest cancelRequest, AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .requestCancelWorkflowExecution( + RequestMapper.requestCancelWorkflowExecutionRequest(cancelRequest)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + @Override + public void SignalWorkflowExecution( + SignalWorkflowExecutionRequest signalRequest, AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .signalWorkflowExecution(RequestMapper.signalWorkflowExecutionRequest(signalRequest)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + @Override + public void SignalWithStartWorkflowExecution( + SignalWithStartWorkflowExecutionRequest signalWithStartRequest, + AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .signalWithStartWorkflowExecution( + RequestMapper.signalWithStartWorkflowExecutionRequest(signalWithStartRequest)), + toFutureCallback(resultHandler, ResponseMapper::signalWithStartWorkflowExecutionResponse), + executor); + } + + @Override + public void SignalWithStartWorkflowExecutionAsync( + SignalWithStartWorkflowExecutionAsyncRequest signalWithStartRequest, + AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .signalWithStartWorkflowExecutionAsync( + RequestMapper.signalWithStartWorkflowExecutionAsyncRequest(signalWithStartRequest)), + toFutureCallback( + resultHandler, ResponseMapper::signalWithStartWorkflowExecutionAsyncResponse), + executor); + } + + @Override + public void ResetWorkflowExecution( + ResetWorkflowExecutionRequest resetRequest, + AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .resetWorkflowExecution(RequestMapper.resetWorkflowExecutionRequest(resetRequest)), + toFutureCallback(resultHandler, ResponseMapper::resetWorkflowExecutionResponse), + executor); + } + + @Override + public void TerminateWorkflowExecution( + TerminateWorkflowExecutionRequest terminateRequest, AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .terminateWorkflowExecution( + RequestMapper.terminateWorkflowExecutionRequest(terminateRequest)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + @Override + public void ListOpenWorkflowExecutions( + ListOpenWorkflowExecutionsRequest listRequest, + AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .visibilityFutureStub() + .listOpenWorkflowExecutions( + RequestMapper.listOpenWorkflowExecutionsRequest(listRequest)), + toFutureCallback(resultHandler, ResponseMapper::listOpenWorkflowExecutionsResponse), + executor); + } + + @Override + public void ListClosedWorkflowExecutions( + ListClosedWorkflowExecutionsRequest listRequest, + AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .visibilityFutureStub() + .listClosedWorkflowExecutions( + RequestMapper.listClosedWorkflowExecutionsRequest(listRequest)), + toFutureCallback(resultHandler, ResponseMapper::listClosedWorkflowExecutionsResponse), + executor); + } + + @Override + public void ListWorkflowExecutions( + ListWorkflowExecutionsRequest listRequest, + AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .visibilityFutureStub() + .listWorkflowExecutions(RequestMapper.listWorkflowExecutionsRequest(listRequest)), + toFutureCallback(resultHandler, ResponseMapper::listWorkflowExecutionsResponse), + executor); + } + + @Override + public void ListArchivedWorkflowExecutions( + ListArchivedWorkflowExecutionsRequest listRequest, + AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .visibilityFutureStub() + .listArchivedWorkflowExecutions( + RequestMapper.listArchivedWorkflowExecutionsRequest(listRequest)), + toFutureCallback(resultHandler, ResponseMapper::listArchivedWorkflowExecutionsResponse), + executor); + } + + @Override + public void ScanWorkflowExecutions( + ListWorkflowExecutionsRequest listRequest, + AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .visibilityFutureStub() + .scanWorkflowExecutions(RequestMapper.scanWorkflowExecutionsRequest(listRequest)), + toFutureCallback(resultHandler, ResponseMapper::scanWorkflowExecutionsResponse), + executor); + } + + @Override + public void CountWorkflowExecutions( + CountWorkflowExecutionsRequest countRequest, + AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .visibilityFutureStub() + .countWorkflowExecutions(RequestMapper.countWorkflowExecutionsRequest(countRequest)), + toFutureCallback(resultHandler, ResponseMapper::countWorkflowExecutionsResponse), + executor); + } + + @Override + public void GetSearchAttributes(AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .visibilityFutureStub() + .getSearchAttributes( + com.uber.cadence.api.v1.GetSearchAttributesRequest.getDefaultInstance()), + toFutureCallback(resultHandler, ResponseMapper::getSearchAttributesResponse), + executor); + } + + @Override + public void RespondQueryTaskCompleted( + RespondQueryTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workerFutureStub() + .respondQueryTaskCompleted( + RequestMapper.respondQueryTaskCompletedRequest(completeRequest)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + @Override + public void ResetStickyTaskList( + ResetStickyTaskListRequest resetRequest, + AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workerFutureStub() + .resetStickyTaskList(RequestMapper.resetStickyTaskListRequest(resetRequest)), + toFutureCallback(resultHandler, ResponseMapper::resetStickyTaskListResponse), + executor); + } + + @Override + public void QueryWorkflow( + QueryWorkflowRequest queryRequest, AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .queryWorkflow(RequestMapper.queryWorkflowRequest(queryRequest)), + toFutureCallback(resultHandler, ResponseMapper::queryWorkflowResponse), + executor); + } + + @Override + public void DescribeWorkflowExecution( + DescribeWorkflowExecutionRequest describeRequest, + AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .describeWorkflowExecution( + RequestMapper.describeWorkflowExecutionRequest(describeRequest)), + toFutureCallback(resultHandler, ResponseMapper::describeWorkflowExecutionResponse), + executor); + } + + @Override + public void DescribeTaskList( + DescribeTaskListRequest request, AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .describeTaskList(RequestMapper.describeTaskListRequest(request)), + toFutureCallback(resultHandler, ResponseMapper::describeTaskListResponse), + executor); + } + + @Override + public void GetClusterInfo(AsyncMethodCallback resultHandler) throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .getClusterInfo(com.uber.cadence.api.v1.GetClusterInfoRequest.getDefaultInstance()), + toFutureCallback(resultHandler, ResponseMapper::getClusterInfoResponse), + executor); + } + + @Override + public void GetTaskListsByDomain( + GetTaskListsByDomainRequest request, + AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .getTaskListsByDomain(RequestMapper.getTaskListsByDomainRequest(request)), + toFutureCallback(resultHandler, ResponseMapper::getTaskListsByDomainResponse), + executor); + } + + @Override + public void ListTaskListPartitions( + ListTaskListPartitionsRequest request, + AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .listTaskListPartitions(RequestMapper.listTaskListPartitionsRequest(request)), + toFutureCallback(resultHandler, ResponseMapper::listTaskListPartitionsResponse), + executor); + } + + @Override + public void RefreshWorkflowTasks( + RefreshWorkflowTasksRequest request, AsyncMethodCallback resultHandler) + throws BaseError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .refreshWorkflowTasks(RequestMapper.refreshWorkflowTasksRequest(request)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + private BaseError toServiceClientException(Throwable t) { + if (t instanceof BaseError) { + return (BaseError) t; + } else if (t instanceof StatusRuntimeException) { + return ErrorMapper.Error((StatusRuntimeException) t); + } else { + return new BaseError(t); + } + } + + private FutureCallback toFutureCallback( + AsyncMethodCallback resultHandler, Function mapper) { + return new FutureCallback() { + @Override + public void onSuccess(R t) { + resultHandler.onComplete(mapper.apply(t)); + } + + @Override + public void onFailure(Throwable throwable) { + resultHandler.onError(toServiceClientException(throwable)); + } + }; + } +} diff --git a/src/main/java/com/uber/cadence/serviceclient/WorkflowServiceTChannel.java b/src/main/java/com/uber/cadence/serviceclient/WorkflowServiceTChannel.java deleted file mode 100644 index 2878e6fac..000000000 --- a/src/main/java/com/uber/cadence/serviceclient/WorkflowServiceTChannel.java +++ /dev/null @@ -1,2972 +0,0 @@ -/* - * 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 com.uber.cadence.internal.metrics.MetricsTagValue.REQUEST_TYPE_LONG_POLL; -import static com.uber.cadence.internal.metrics.MetricsTagValue.REQUEST_TYPE_NORMAL; - -import com.google.common.base.Strings; -import com.google.common.collect.ImmutableMap; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.uber.cadence.*; -import com.uber.cadence.WorkflowService.GetWorkflowExecutionHistory_result; -import com.uber.cadence.internal.Version; -import com.uber.cadence.internal.common.CheckedExceptionWrapper; -import com.uber.cadence.internal.common.InternalUtils; -import com.uber.cadence.internal.metrics.MetricsTag; -import com.uber.cadence.internal.metrics.MetricsType; -import com.uber.cadence.internal.metrics.ServiceMethod; -import com.uber.cadence.internal.tracing.TracingPropagator; -import com.uber.m3.tally.Scope; -import com.uber.m3.tally.Stopwatch; -import com.uber.tchannel.api.ResponseCode; -import com.uber.tchannel.api.SubChannel; -import com.uber.tchannel.api.TChannel; -import com.uber.tchannel.api.TFuture; -import com.uber.tchannel.api.errors.TChannelError; -import com.uber.tchannel.errors.ErrorType; -import com.uber.tchannel.messages.ThriftRequest; -import com.uber.tchannel.messages.ThriftResponse; -import com.uber.tchannel.messages.generated.Meta; -import io.opentelemetry.api.GlobalOpenTelemetry; -import io.opentelemetry.context.Context; -import io.opentelemetry.context.propagation.TextMapPropagator; -import io.opentelemetry.context.propagation.TextMapSetter; -import io.opentracing.Span; -import io.opentracing.Tracer; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.net.UnknownHostException; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.transport.TTransportException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class WorkflowServiceTChannel implements IWorkflowService { - private static final Logger log = LoggerFactory.getLogger(WorkflowServiceTChannel.class); - - private static final String INTERFACE_NAME = "WorkflowService"; - - private final ClientOptions options; - private final Map thriftHeaders; - private final TChannel tChannel; - private final TracingPropagator tracingPropagator; - private final Tracer tracer; - private final SubChannel subChannel; - - /** - * Creates Cadence client that connects to the specified host and port using specified options. - * - * @param options configuration options like rpc timeouts. - */ - public WorkflowServiceTChannel(ClientOptions options) { - this.options = options; - this.thriftHeaders = getThriftHeaders(options); - this.tChannel = new TChannel.Builder(options.getClientAppName()).build(); - this.tracingPropagator = new TracingPropagator(options.getTracer()); - this.tracer = options.getTracer(); - - InetAddress address; - try { - address = InetAddress.getByName(options.getHost()); - } catch (UnknownHostException e) { - tChannel.shutdown(); - throw new RuntimeException("Unable to get name of host " + options.getHost(), e); - } - - ArrayList peers = new ArrayList<>(); - peers.add(new InetSocketAddress(address, options.getPort())); - this.subChannel = tChannel.makeSubChannel(options.getServiceName()).setPeers(peers); - log.info( - "Initialized TChannel for service " - + this.subChannel.getServiceName() - + ", LibraryVersion: " - + Version.LIBRARY_VERSION - + ", FeatureVersion: " - + Version.FEATURE_VERSION); - } - - public void resetSubchannelPeers() throws UnknownHostException { - InetAddress address = InetAddress.getByName(options.getHost()); - ArrayList peers = new ArrayList<>(); - peers.add(new InetSocketAddress(address, options.getPort())); - this.subChannel.setPeers(peers); - } - - /** - * Creates Cadence client with specified sub channel and options. - * - * @param subChannel sub channel for communicating with cadence frontend service. - * @param options configuration options like rpc timeouts. - */ - public WorkflowServiceTChannel(SubChannel subChannel, ClientOptions options) { - this.options = options; - this.thriftHeaders = getThriftHeaders(options); - this.tChannel = null; - this.subChannel = subChannel; - this.tracingPropagator = new TracingPropagator(options.getTracer()); - this.tracer = options.getTracer(); - } - - private static Map getThriftHeaders(ClientOptions options) { - String envUserName = System.getProperty("user.name"); - String envHostname; - try { - envHostname = InetAddress.getLocalHost().getHostName(); - } catch (UnknownHostException e) { - envHostname = "localhost"; - } - - ImmutableMap.Builder builder = - ImmutableMap.builder() - .put("user-name", envUserName) - .put("host-name", envHostname) - .put("cadence-client-library-version", Version.LIBRARY_VERSION) - .put("cadence-client-feature-version", Version.FEATURE_VERSION) - .put("cadence-client-name", "uber-java"); - - if (options.getHeaders() != null) { - for (Map.Entry entry : options.getHeaders().entrySet()) { - builder.put(entry.getKey(), entry.getValue()); - } - } - - if (options.getFeatureFlags() != null) { - GsonBuilder gsonBuilder = new GsonBuilder(); - Gson gson = gsonBuilder.create(); - String serialized = gson.toJson(options.getFeatureFlags()); - builder.put("cadence-client-feature-flags", serialized); - } - - if (!Strings.isNullOrEmpty(options.getIsolationGroup())) { - builder.put("cadence-client-isolation-group", options.getIsolationGroup()); - } - - return builder.build(); - } - - /** Returns the endpoint in the format service::method" */ - private static String getEndpoint(String service, String method) { - return String.format("%s::%s", service, method); - } - - private ThriftRequest buildThriftRequest(String apiName, T body) { - return buildThriftRequest(apiName, body, null); - } - - @Override - public ClientOptions getOptions() { - return options; - } - - /** - * Checks if we have a valid connection to the Cadence cluster, and potentially resets the peer - * list - */ - @Override - public CompletableFuture isHealthy() { - final ThriftRequest req = - new ThriftRequest.Builder(options.getServiceName(), "Meta::health") - .setBody(new Meta.health_args()) - .build(); - final CompletableFuture result = new CompletableFuture<>(); - try { - - final TFuture> future = this.subChannel.send(req); - future.addCallback( - response -> { - req.releaseQuietly(); - if (response.isError()) { - try { - this.resetSubchannelPeers(); - } catch (final Exception inner_e) { - } - result.completeExceptionally(new TException("Rpc error:" + response.getError())); - } else { - result.complete(response.getBody(Meta.health_result.class).getSuccess().isOk()); - } - try { - response.release(); - } catch (final Exception e) { - // ignore - } - }); - } catch (final TChannelError e) { - req.releaseQuietly(); - try { - this.resetSubchannelPeers(); - } catch (final Exception inner_e) { - } - result.complete(Boolean.FALSE); - } - return result; - } - - protected ThriftRequest buildThriftRequest( - String apiName, T body, Long rpcTimeoutOverride) { - String endpoint = getEndpoint(INTERFACE_NAME, apiName); - ThriftRequest.Builder builder = - new ThriftRequest.Builder<>(options.getServiceName(), endpoint); - // Create a mutable hashmap for headers, as tchannel.tracing.PrefixedHeadersCarrier assumes - // that it can call put directly to add new stuffs (e.g. traces). - final HashMap headers = new HashMap<>(thriftHeaders); - TextMapPropagator textMapPropagator = - GlobalOpenTelemetry.getPropagators().getTextMapPropagator(); - - String tracingHeadersPrefix = "$tracing$"; - TextMapSetter> setter = - (carrier, key, value) -> { - if (carrier != null) { - carrier.put(tracingHeadersPrefix + key, value); - } - }; - - textMapPropagator.inject(Context.current(), headers, setter); - - if (this.options.getAuthProvider() != null) { - headers.put( - "cadence-authorization", - new String(options.getAuthProvider().getAuthToken(), StandardCharsets.UTF_8)); - } - builder.setHeaders(headers); - - if (rpcTimeoutOverride != null) { - builder.setTimeout(rpcTimeoutOverride); - } else { - builder.setTimeout(this.options.getRpcTimeoutMillis()); - } - for (Map.Entry header : this.options.getTransportHeaders().entrySet()) { - builder.setTransportHeader(header.getKey(), header.getValue()); - } - builder.setBody(body); - return builder.build(); - } - - private ThriftResponse doRemoteCall(ThriftRequest request) throws TException { - ThriftResponse response = null; - try { - TFuture> future = subChannel.send(request); - response = future.get(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new TException(e); - } catch (ExecutionException e) { - throw new TException(e); - } catch (TChannelError e) { - throw new TException("Rpc error", e); - } - this.throwOnRpcError(response); - return response; - } - - private CompletableFuture> doRemoteCallAsync(ThriftRequest request) { - final CompletableFuture> result = new CompletableFuture<>(); - TFuture> future = null; - try { - future = subChannel.send(request); - } catch (TChannelError tChannelError) { - result.completeExceptionally(new TException(tChannelError)); - } - future.addCallback( - response -> { - if (response.isError()) { - result.completeExceptionally(new TException("Rpc error:" + response.getError())); - } else { - result.complete(response); - } - }); - return result; - } - - private void throwOnRpcError(ThriftResponse response) throws TException { - if (response.isError()) { - if (response.getError().getErrorType() == ErrorType.Timeout) { - throw new TTransportException( - TTransportException.TIMED_OUT, response.getError().getMessage()); - } else { - throw new TException("Rpc error:" + response.getError()); - } - } - } - - @Override - public void close() { - if (tChannel != null) { - tChannel.shutdown(); - } - } - - interface RemoteCall { - T apply() throws TException; - } - - private T measureRemoteCall(String scopeName, RemoteCall call) throws TException { - return measureRemoteCallWithTags(scopeName, call, null); - } - - private T measureRemoteCallWithTags( - String scopeName, RemoteCall call, Map tags) throws TException { - Scope scope = options.getMetricsScope().subScope(scopeName); - if (tags != null) { - scope = scope.tagged(tags); - } - scope.counter(MetricsType.CADENCE_REQUEST).inc(1); - Stopwatch sw = scope.timer(MetricsType.CADENCE_LATENCY).start(); - - Span span = tracingPropagator.spanByServiceMethod(scopeName); - try (io.opentracing.Scope tracingScope = tracer.activateSpan(span)) { - T resp = call.apply(); - sw.stop(); - return resp; - } catch (EntityNotExistsError - | WorkflowExecutionAlreadyCompletedError - | BadRequestError - | DomainAlreadyExistsError - | WorkflowExecutionAlreadyStartedError - | QueryFailedError e) { - sw.stop(); - scope.counter(MetricsType.CADENCE_INVALID_REQUEST).inc(1); - throw e; - } catch (TException e) { - sw.stop(); - scope.counter(MetricsType.CADENCE_ERROR).inc(1); - throw e; - } finally { - span.finish(); - } - } - - interface RemoteProc { - void apply() throws TException; - } - - private void measureRemoteProc(String scopeName, RemoteProc proc) throws TException { - measureRemoteCall( - scopeName, - () -> { - proc.apply(); - return null; - }); - } - - @Override - public void RegisterDomain(RegisterDomainRequest request) throws TException { - measureRemoteProc(ServiceMethod.REGISTER_DOMAIN, () -> registerDomain(request)); - } - - private void registerDomain(RegisterDomainRequest registerRequest) throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "RegisterDomain", new WorkflowService.RegisterDomain_args(registerRequest)); - response = doRemoteCall(request); - WorkflowService.RegisterDomain_result result = - response.getBody(WorkflowService.RegisterDomain_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return; - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetDomainExistsError()) { - throw result.getDomainExistsError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - throw new TException("RegisterDomain failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public DescribeDomainResponse DescribeDomain(DescribeDomainRequest describeRequest) - throws TException { - return measureRemoteCall(ServiceMethod.DESCRIBE_DOMAIN, () -> describeDomain(describeRequest)); - } - - private DescribeDomainResponse describeDomain(DescribeDomainRequest describeRequest) - throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "DescribeDomain", new WorkflowService.DescribeDomain_args(describeRequest)); - response = doRemoteCall(request); - WorkflowService.DescribeDomain_result result = - response.getBody(WorkflowService.DescribeDomain_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return result.getSuccess(); - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - throw new TException("DescribeDomain failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public ListDomainsResponse ListDomains(ListDomainsRequest listRequest) - throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, - TException { - return measureRemoteCall(ServiceMethod.LIST_DOMAINS, () -> listDomains(listRequest)); - } - - private ListDomainsResponse listDomains(ListDomainsRequest describeRequest) throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest("ListDomains", new WorkflowService.ListDomains_args(describeRequest)); - response = doRemoteCall(request); - WorkflowService.ListDomains_result result = - response.getBody(WorkflowService.ListDomains_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return result.getSuccess(); - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - throw new TException("ListDomains failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public UpdateDomainResponse UpdateDomain(UpdateDomainRequest updateRequest) throws TException { - return measureRemoteCall(ServiceMethod.UPDATE_DOMAIN, () -> updateDomain(updateRequest)); - } - - private UpdateDomainResponse updateDomain(UpdateDomainRequest updateRequest) throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest("UpdateDomain", new WorkflowService.UpdateDomain_args(updateRequest)); - response = doRemoteCall(request); - WorkflowService.UpdateDomain_result result = - response.getBody(WorkflowService.UpdateDomain_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return result.getSuccess(); - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetDomainNotActiveError()) { - throw result.getDomainNotActiveError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("UpdateDomain failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public void DeprecateDomain(DeprecateDomainRequest deprecateRequest) throws TException { - measureRemoteProc(ServiceMethod.DEPRECATE_DOMAIN, () -> deprecateDomain(deprecateRequest)); - } - - @Override - public RestartWorkflowExecutionResponse RestartWorkflowExecution( - RestartWorkflowExecutionRequest restartRequest) - throws BadRequestError, ServiceBusyError, DomainNotActiveError, LimitExceededError, - EntityNotExistsError, ClientVersionNotSupportedError, TException { - throw new UnsupportedOperationException("unimplemented"); - } - - private void deprecateDomain(DeprecateDomainRequest deprecateRequest) throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "DeprecateDomain", new WorkflowService.DeprecateDomain_args(deprecateRequest)); - response = doRemoteCall(request); - WorkflowService.DeprecateDomain_result result = - response.getBody(WorkflowService.DeprecateDomain_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return; - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetDomainNotActiveError()) { - throw result.getDomainNotActiveError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("DeprecateDomain failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public GetTaskListsByDomainResponse GetTaskListsByDomain( - GetTaskListsByDomainRequest getTaskListsByDomainRequest) throws TException { - return measureRemoteCall( - ServiceMethod.GET_TASK_LISTS_BY_DOMAIN, - () -> getTaskListsByDomain(getTaskListsByDomainRequest)); - } - - private GetTaskListsByDomainResponse getTaskListsByDomain( - GetTaskListsByDomainRequest getTaskListsByDomainRequest) throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "GetTaskListsByDomain", - new WorkflowService.GetTaskListsByDomain_args(getTaskListsByDomainRequest)); - response = doRemoteCall(request); - WorkflowService.GetTaskListsByDomain_result result = - response.getBody(WorkflowService.GetTaskListsByDomain_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return result.getSuccess(); - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetLimitExceededError()) { - throw result.getLimitExceededError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("GetTaskListsByDomain failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public StartWorkflowExecutionResponse StartWorkflowExecution( - StartWorkflowExecutionRequest request) throws TException { - return measureRemoteCall( - ServiceMethod.START_WORKFLOW_EXECUTION, () -> startWorkflowExecution(request)); - } - - private StartWorkflowExecutionResponse startWorkflowExecution( - StartWorkflowExecutionRequest startRequest) throws TException { - ThriftResponse response = null; - try { - initializeStartWorkflowRequest(startRequest); - - ThriftRequest request = - buildThriftRequest( - "StartWorkflowExecution", - new WorkflowService.StartWorkflowExecution_args(startRequest)); - - response = doRemoteCall(request); - WorkflowService.StartWorkflowExecution_result result = - response.getBody(WorkflowService.StartWorkflowExecution_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return result.getSuccess(); - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetSessionAlreadyExistError()) { - throw result.getSessionAlreadyExistError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetDomainNotActiveError()) { - throw result.getDomainNotActiveError(); - } - if (result.isSetLimitExceededError()) { - throw result.getLimitExceededError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("StartWorkflowExecution failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public StartWorkflowExecutionAsyncResponse StartWorkflowExecutionAsync( - StartWorkflowExecutionAsyncRequest startAsyncRequest) throws TException { - return measureRemoteCall( - ServiceMethod.START_WORKFLOW_EXECUTION_ASYNC, - () -> startWorkflowExecutionAsync(startAsyncRequest)); - } - - private StartWorkflowExecutionAsyncResponse startWorkflowExecutionAsync( - StartWorkflowExecutionAsyncRequest startAsyncRequest) throws TException { - ThriftResponse response = null; - try { - initializeStartWorkflowRequest(startAsyncRequest.getRequest()); - - ThriftRequest request = - buildThriftRequest( - "StartWorkflowExecutionAsync", - new WorkflowService.StartWorkflowExecutionAsync_args(startAsyncRequest)); - - response = doRemoteCall(request); - WorkflowService.StartWorkflowExecutionAsync_result result = - response.getBody(WorkflowService.StartWorkflowExecutionAsync_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return result.getSuccess(); - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetSessionAlreadyExistError()) { - throw result.getSessionAlreadyExistError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetDomainNotActiveError()) { - throw result.getDomainNotActiveError(); - } - if (result.isSetLimitExceededError()) { - throw result.getLimitExceededError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("StartWorkflowExecution failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - private void initializeStartWorkflowRequest(StartWorkflowExecutionRequest startRequest) { - if (!startRequest.isSetRequestId()) { - startRequest.setRequestId(UUID.randomUUID().toString()); - } - // Write span context to header - if (!startRequest.isSetHeader()) { - startRequest.setHeader(new Header()); - } - tracingPropagator.inject(startRequest.getHeader()); - } - - @Override - public GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistoryWithTimeout( - GetWorkflowExecutionHistoryRequest request, Long timeoutInMillis) throws TException { - Map tags = - ImmutableMap.of( - MetricsTag.REQUEST_TYPE, - request.isWaitForNewEvent() ? REQUEST_TYPE_LONG_POLL : REQUEST_TYPE_NORMAL); - return measureRemoteCallWithTags( - ServiceMethod.GET_WORKFLOW_EXECUTION_HISTORY, - () -> getWorkflowExecutionHistory(request, timeoutInMillis), - tags); - } - - @Override - public GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistory( - GetWorkflowExecutionHistoryRequest request) throws TException { - Map tags = - ImmutableMap.of( - MetricsTag.REQUEST_TYPE, - request.isWaitForNewEvent() ? REQUEST_TYPE_LONG_POLL : REQUEST_TYPE_NORMAL); - return measureRemoteCallWithTags( - ServiceMethod.GET_WORKFLOW_EXECUTION_HISTORY, - () -> getWorkflowExecutionHistory(request, null), - tags); - } - - private GetWorkflowExecutionHistoryResponse getWorkflowExecutionHistory( - GetWorkflowExecutionHistoryRequest getRequest, Long timeoutInMillis) throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildGetWorkflowExecutionHistoryThriftRequest(getRequest, timeoutInMillis); - response = doRemoteCall(request); - WorkflowService.GetWorkflowExecutionHistory_result result = - response.getBody(WorkflowService.GetWorkflowExecutionHistory_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - GetWorkflowExecutionHistoryResponse res = result.getSuccess(); - if (res.getRawHistory() != null) { - History history = - InternalUtils.DeserializeFromBlobDataToHistory( - res.getRawHistory(), getRequest.getHistoryEventFilterType()); - res.setHistory(history); - } - return res; - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("GetWorkflowExecutionHistory failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - private ThriftRequest - buildGetWorkflowExecutionHistoryThriftRequest( - GetWorkflowExecutionHistoryRequest getRequest, Long timeoutInMillis) { - - if (getRequest.isWaitForNewEvent()) { - timeoutInMillis = - validateAndUpdateTimeout(timeoutInMillis, options.getRpcLongPollTimeoutMillis()); - } else { - timeoutInMillis = validateAndUpdateTimeout(timeoutInMillis, options.getRpcTimeoutMillis()); - } - - return buildThriftRequest( - "GetWorkflowExecutionHistory", - new WorkflowService.GetWorkflowExecutionHistory_args(getRequest), - timeoutInMillis); - } - - @Override - public PollForDecisionTaskResponse PollForDecisionTask(PollForDecisionTaskRequest request) - throws TException { - return measureRemoteCall( - ServiceMethod.POLL_FOR_DECISION_TASK, () -> pollForDecisionTask(request)); - } - - private PollForDecisionTaskResponse pollForDecisionTask(PollForDecisionTaskRequest pollRequest) - throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "PollForDecisionTask", - new WorkflowService.PollForDecisionTask_args(pollRequest), - options.getRpcLongPollTimeoutMillis()); - response = doRemoteCall(request); - WorkflowService.PollForDecisionTask_result result = - response.getBody(WorkflowService.PollForDecisionTask_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return result.getSuccess(); - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetDomainNotActiveError()) { - throw result.getDomainNotActiveError(); - } - if (result.isSetLimitExceededError()) { - throw result.getLimitExceededError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("PollForDecisionTask failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public RespondDecisionTaskCompletedResponse RespondDecisionTaskCompleted( - RespondDecisionTaskCompletedRequest completedRequest) throws TException { - return measureRemoteCall( - ServiceMethod.RESPOND_DECISION_TASK_COMPLETED, - () -> respondDecisionTaskCompleted(completedRequest)); - } - - private RespondDecisionTaskCompletedResponse respondDecisionTaskCompleted( - RespondDecisionTaskCompletedRequest completedRequest) throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "RespondDecisionTaskCompleted", - new WorkflowService.RespondDecisionTaskCompleted_args(completedRequest)); - response = doRemoteCall(request); - WorkflowService.RespondDecisionTaskCompleted_result result = - response.getBody(WorkflowService.RespondDecisionTaskCompleted_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return result.getSuccess(); - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetDomainNotActiveError()) { - throw result.getDomainNotActiveError(); - } - if (result.isSetLimitExceededError()) { - throw result.getLimitExceededError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetWorkflowExecutionAlreadyCompletedError()) { - throw result.getWorkflowExecutionAlreadyCompletedError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("RespondDecisionTaskCompleted failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public void RespondDecisionTaskFailed(RespondDecisionTaskFailedRequest request) - throws TException { - measureRemoteProc( - ServiceMethod.RESPOND_DECISION_TASK_FAILED, () -> respondDecisionTaskFailed(request)); - } - - private void respondDecisionTaskFailed(RespondDecisionTaskFailedRequest failedRequest) - throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "RespondDecisionTaskFailed", - new WorkflowService.RespondDecisionTaskFailed_args(failedRequest)); - response = doRemoteCall(request); - WorkflowService.RespondDecisionTaskFailed_result result = - response.getBody(WorkflowService.RespondDecisionTaskFailed_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return; - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetWorkflowExecutionAlreadyCompletedError()) { - throw result.getWorkflowExecutionAlreadyCompletedError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetDomainNotActiveError()) { - throw result.getDomainNotActiveError(); - } - if (result.isSetLimitExceededError()) { - throw result.getLimitExceededError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("RespondDecisionTaskFailed failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public PollForActivityTaskResponse PollForActivityTask(PollForActivityTaskRequest request) - throws TException { - return measureRemoteCall( - ServiceMethod.POLL_FOR_ACTIVITY_TASK, () -> pollForActivityTask(request)); - } - - private PollForActivityTaskResponse pollForActivityTask(PollForActivityTaskRequest pollRequest) - throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "PollForActivityTask", - new WorkflowService.PollForActivityTask_args(pollRequest), - options.getRpcLongPollTimeoutMillis()); - response = doRemoteCall(request); - WorkflowService.PollForActivityTask_result result = - response.getBody(WorkflowService.PollForActivityTask_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return result.getSuccess(); - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetDomainNotActiveError()) { - throw result.getDomainNotActiveError(); - } - if (result.isSetLimitExceededError()) { - throw result.getLimitExceededError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("PollForActivityTask failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeat( - RecordActivityTaskHeartbeatRequest request) throws TException { - return measureRemoteCall( - ServiceMethod.RECORD_ACTIVITY_TASK_HEARTBEAT, () -> recordActivityTaskHeartbeat(request)); - } - - private RecordActivityTaskHeartbeatResponse recordActivityTaskHeartbeat( - RecordActivityTaskHeartbeatRequest heartbeatRequest) throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "RecordActivityTaskHeartbeat", - new WorkflowService.RecordActivityTaskHeartbeat_args(heartbeatRequest)); - response = doRemoteCall(request); - WorkflowService.RecordActivityTaskHeartbeat_result result = - response.getBody(WorkflowService.RecordActivityTaskHeartbeat_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return result.getSuccess(); - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetWorkflowExecutionAlreadyCompletedError()) { - throw result.getWorkflowExecutionAlreadyCompletedError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetDomainNotActiveError()) { - throw result.getDomainNotActiveError(); - } - if (result.isSetLimitExceededError()) { - throw result.getLimitExceededError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("RecordActivityTaskHeartbeat failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeatByID( - RecordActivityTaskHeartbeatByIDRequest heartbeatRequest) - throws BadRequestError, InternalServiceError, EntityNotExistsError, DomainNotActiveError, - WorkflowExecutionAlreadyCompletedError, LimitExceededError, ServiceBusyError, TException { - return measureRemoteCall( - ServiceMethod.RECORD_ACTIVITY_TASK_HEARTBEAT_BY_ID, - () -> recordActivityTaskHeartbeatByID(heartbeatRequest)); - } - - private RecordActivityTaskHeartbeatResponse recordActivityTaskHeartbeatByID( - RecordActivityTaskHeartbeatByIDRequest heartbeatRequest) throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "RecordActivityTaskHeartbeatByID", - new WorkflowService.RecordActivityTaskHeartbeatByID_args(heartbeatRequest)); - response = doRemoteCall(request); - WorkflowService.RecordActivityTaskHeartbeatByID_result result = - response.getBody(WorkflowService.RecordActivityTaskHeartbeatByID_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return result.getSuccess(); - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetWorkflowExecutionAlreadyCompletedError()) { - throw result.getWorkflowExecutionAlreadyCompletedError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetDomainNotActiveError()) { - throw result.getDomainNotActiveError(); - } - if (result.isSetLimitExceededError()) { - throw result.getLimitExceededError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("RecordActivityTaskHeartbeatByID failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public void RespondActivityTaskCompleted(RespondActivityTaskCompletedRequest request) - throws TException { - measureRemoteProc( - ServiceMethod.RESPOND_ACTIVITY_TASK_COMPLETED, () -> respondActivityTaskCompleted(request)); - } - - private void respondActivityTaskCompleted(RespondActivityTaskCompletedRequest completeRequest) - throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "RespondActivityTaskCompleted", - new WorkflowService.RespondActivityTaskCompleted_args(completeRequest)); - response = doRemoteCall(request); - WorkflowService.RespondActivityTaskCompleted_result result = - response.getBody(WorkflowService.RespondActivityTaskCompleted_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return; - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetWorkflowExecutionAlreadyCompletedError()) { - throw result.getWorkflowExecutionAlreadyCompletedError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetDomainNotActiveError()) { - throw result.getDomainNotActiveError(); - } - if (result.isSetLimitExceededError()) { - throw result.getLimitExceededError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("RespondActivityTaskCompleted failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public void RespondActivityTaskCompletedByID(RespondActivityTaskCompletedByIDRequest request) - throws TException { - measureRemoteProc( - ServiceMethod.RESPOND_ACTIVITY_TASK_COMPLETED_BY_ID, - () -> respondActivityTaskCompletedByID(request)); - } - - private void respondActivityTaskCompletedByID( - RespondActivityTaskCompletedByIDRequest completeRequest) throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "RespondActivityTaskCompletedByID", - new WorkflowService.RespondActivityTaskCompletedByID_args(completeRequest)); - response = doRemoteCall(request); - WorkflowService.RespondActivityTaskCompletedByID_result result = - response.getBody(WorkflowService.RespondActivityTaskCompletedByID_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return; - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetWorkflowExecutionAlreadyCompletedError()) { - throw result.getWorkflowExecutionAlreadyCompletedError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetDomainNotActiveError()) { - throw result.getDomainNotActiveError(); - } - if (result.isSetLimitExceededError()) { - throw result.getLimitExceededError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("RespondActivityTaskCompletedByID failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public void RespondActivityTaskFailed(RespondActivityTaskFailedRequest request) - throws TException { - measureRemoteProc( - ServiceMethod.RESPOND_ACTIVITY_TASK_FAILED, () -> respondActivityTaskFailed(request)); - } - - private void respondActivityTaskFailed(RespondActivityTaskFailedRequest failRequest) - throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "RespondActivityTaskFailed", - new WorkflowService.RespondActivityTaskFailed_args(failRequest)); - response = doRemoteCall(request); - WorkflowService.RespondActivityTaskFailed_result result = - response.getBody(WorkflowService.RespondActivityTaskFailed_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return; - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetWorkflowExecutionAlreadyCompletedError()) { - throw result.getWorkflowExecutionAlreadyCompletedError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetDomainNotActiveError()) { - throw result.getDomainNotActiveError(); - } - if (result.isSetLimitExceededError()) { - throw result.getLimitExceededError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("RespondActivityTaskFailed failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public void RespondActivityTaskFailedByID(RespondActivityTaskFailedByIDRequest request) - throws TException { - measureRemoteProc( - ServiceMethod.RESPOND_ACTIVITY_TASK_FAILED_BY_ID, - () -> respondActivityTaskFailedByID(request)); - } - - private void respondActivityTaskFailedByID(RespondActivityTaskFailedByIDRequest failRequest) - throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "RespondActivityTaskFailedByID", - new WorkflowService.RespondActivityTaskFailedByID_args(failRequest)); - response = doRemoteCall(request); - WorkflowService.RespondActivityTaskFailedByID_result result = - response.getBody(WorkflowService.RespondActivityTaskFailedByID_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return; - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetWorkflowExecutionAlreadyCompletedError()) { - throw result.getWorkflowExecutionAlreadyCompletedError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetDomainNotActiveError()) { - throw result.getDomainNotActiveError(); - } - if (result.isSetLimitExceededError()) { - throw result.getLimitExceededError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("RespondActivityTaskFailedByID failedByID with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public void RespondActivityTaskCanceled(RespondActivityTaskCanceledRequest request) - throws TException { - measureRemoteProc( - ServiceMethod.RESPOND_ACTIVITY_TASK_CANCELED, () -> respondActivityTaskCanceled(request)); - } - - private void respondActivityTaskCanceled(RespondActivityTaskCanceledRequest canceledRequest) - throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "RespondActivityTaskCanceled", - new WorkflowService.RespondActivityTaskCanceled_args(canceledRequest)); - response = doRemoteCall(request); - WorkflowService.RespondActivityTaskCanceled_result result = - response.getBody(WorkflowService.RespondActivityTaskCanceled_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return; - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetWorkflowExecutionAlreadyCompletedError()) { - throw result.getWorkflowExecutionAlreadyCompletedError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetDomainNotActiveError()) { - throw result.getDomainNotActiveError(); - } - if (result.isSetLimitExceededError()) { - throw result.getLimitExceededError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("RespondActivityTaskCanceled failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public void RespondActivityTaskCanceledByID(RespondActivityTaskCanceledByIDRequest request) - throws TException { - measureRemoteProc( - ServiceMethod.RESPOND_ACTIVITY_TASK_CANCELED_BY_ID, - () -> respondActivityTaskCanceledByID(request)); - } - - private void respondActivityTaskCanceledByID( - RespondActivityTaskCanceledByIDRequest canceledByIDRequest) throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "RespondActivityTaskCanceledByID", - new WorkflowService.RespondActivityTaskCanceledByID_args(canceledByIDRequest)); - response = doRemoteCall(request); - WorkflowService.RespondActivityTaskCanceledByID_result result = - response.getBody(WorkflowService.RespondActivityTaskCanceledByID_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return; - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetWorkflowExecutionAlreadyCompletedError()) { - throw result.getWorkflowExecutionAlreadyCompletedError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetDomainNotActiveError()) { - throw result.getDomainNotActiveError(); - } - if (result.isSetLimitExceededError()) { - throw result.getLimitExceededError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("RespondActivityTaskCanceledByID failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public void RequestCancelWorkflowExecution(RequestCancelWorkflowExecutionRequest request) - throws TException { - measureRemoteProc( - ServiceMethod.REQUEST_CANCEL_WORKFLOW_EXECUTION, - () -> requestCancelWorkflowExecution(request)); - } - - private void requestCancelWorkflowExecution(RequestCancelWorkflowExecutionRequest cancelRequest) - throws TException { - if (!cancelRequest.isSetRequestId()) { - cancelRequest.setRequestId(UUID.randomUUID().toString()); - } - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "RequestCancelWorkflowExecution", - new WorkflowService.RequestCancelWorkflowExecution_args(cancelRequest)); - response = doRemoteCall(request); - WorkflowService.RequestCancelWorkflowExecution_result result = - response.getBody(WorkflowService.RequestCancelWorkflowExecution_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return; - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetWorkflowExecutionAlreadyCompletedError()) { - throw result.getWorkflowExecutionAlreadyCompletedError(); - } - if (result.isSetCancellationAlreadyRequestedError()) { - throw result.getCancellationAlreadyRequestedError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetDomainNotActiveError()) { - throw result.getDomainNotActiveError(); - } - if (result.isSetLimitExceededError()) { - throw result.getLimitExceededError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("RequestCancelWorkflowExecution failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public void SignalWorkflowExecution(SignalWorkflowExecutionRequest request) throws TException { - measureRemoteProc( - ServiceMethod.SIGNAL_WORKFLOW_EXECUTION, () -> signalWorkflowExecution(request)); - } - - private void signalWorkflowExecution(SignalWorkflowExecutionRequest signalRequest) - throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "SignalWorkflowExecution", - new WorkflowService.SignalWorkflowExecution_args(signalRequest)); - response = doRemoteCall(request); - WorkflowService.SignalWorkflowExecution_result result = - response.getBody(WorkflowService.SignalWorkflowExecution_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return; - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetWorkflowExecutionAlreadyCompletedError()) { - throw result.getWorkflowExecutionAlreadyCompletedError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetDomainNotActiveError()) { - throw result.getDomainNotActiveError(); - } - if (result.isSetLimitExceededError()) { - throw result.getLimitExceededError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("SignalWorkflowExecution failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public StartWorkflowExecutionResponse SignalWithStartWorkflowExecution( - SignalWithStartWorkflowExecutionRequest signalWithStartRequest) throws TException { - return measureRemoteCall( - ServiceMethod.SIGNAL_WITH_START_WORKFLOW_EXECUTION, - () -> signalWithStartWorkflowExecution(signalWithStartRequest)); - } - - @Override - public SignalWithStartWorkflowExecutionAsyncResponse SignalWithStartWorkflowExecutionAsync( - SignalWithStartWorkflowExecutionAsyncRequest signalWithStartRequest) throws TException { - return measureRemoteCall( - ServiceMethod.SIGNAL_WITH_START_WORKFLOW_EXECUTION_ASYNC, - () -> signalWithStartWorkflowExecutionAsync(signalWithStartRequest)); - } - - private SignalWithStartWorkflowExecutionAsyncResponse signalWithStartWorkflowExecutionAsync( - SignalWithStartWorkflowExecutionAsyncRequest signalWithStartRequest) throws TException { - ThriftResponse response = null; - try { - initializeSignalWithStartWorkflowRequest(signalWithStartRequest.getRequest()); - - ThriftRequest request = - buildThriftRequest( - "SignalWithStartWorkflowExecutionAsync", - new WorkflowService.SignalWithStartWorkflowExecutionAsync_args( - signalWithStartRequest)); - - response = doRemoteCall(request); - WorkflowService.SignalWithStartWorkflowExecutionAsync_result result = - response.getBody(WorkflowService.SignalWithStartWorkflowExecutionAsync_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return result.getSuccess(); - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetDomainNotActiveError()) { - throw result.getDomainNotActiveError(); - } - if (result.isSetLimitExceededError()) { - throw result.getLimitExceededError(); - } - if (result.isSetDomainNotActiveError()) { - throw result.getDomainNotActiveError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException( - "SignalWithStartWorkflowExecutionAsync failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public ResetWorkflowExecutionResponse ResetWorkflowExecution( - ResetWorkflowExecutionRequest resetRequest) - throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, - DomainNotActiveError, LimitExceededError, ClientVersionNotSupportedError, TException { - return measureRemoteCall( - ServiceMethod.RESET_WORKFLOW_EXECUTION, () -> resetWorkflowExecution(resetRequest)); - } - - private ResetWorkflowExecutionResponse resetWorkflowExecution( - ResetWorkflowExecutionRequest resetRequest) throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "ResetWorkflowExecution", - new WorkflowService.ResetWorkflowExecution_args(resetRequest)); - response = doRemoteCall(request); - WorkflowService.ResetWorkflowExecution_result result = - response.getBody(WorkflowService.ResetWorkflowExecution_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return result.getSuccess(); - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetDomainNotActiveError()) { - throw result.getDomainNotActiveError(); - } - if (result.isSetLimitExceededError()) { - throw result.getLimitExceededError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("ResetWorkflowExecution failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - private StartWorkflowExecutionResponse signalWithStartWorkflowExecution( - SignalWithStartWorkflowExecutionRequest signalWithStartRequest) throws TException { - ThriftResponse response = null; - try { - initializeSignalWithStartWorkflowRequest(signalWithStartRequest); - - ThriftRequest request = - buildThriftRequest( - "SignalWithStartWorkflowExecution", - new WorkflowService.SignalWithStartWorkflowExecution_args(signalWithStartRequest)); - - response = doRemoteCall(request); - WorkflowService.SignalWithStartWorkflowExecution_result result = - response.getBody(WorkflowService.SignalWithStartWorkflowExecution_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return result.getSuccess(); - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetDomainNotActiveError()) { - throw result.getDomainNotActiveError(); - } - if (result.isSetLimitExceededError()) { - throw result.getLimitExceededError(); - } - if (result.isSetDomainNotActiveError()) { - throw result.getDomainNotActiveError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("SignalWithStartWorkflowExecution failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - private void initializeSignalWithStartWorkflowRequest( - SignalWithStartWorkflowExecutionRequest request) { - if (!request.isSetRequestId()) { - request.setRequestId(UUID.randomUUID().toString()); - } - // Write span context to header - if (!request.isSetHeader()) { - request.setHeader(new Header()); - } - tracingPropagator.inject(request.getHeader()); - } - - @Override - public void TerminateWorkflowExecution(TerminateWorkflowExecutionRequest request) - throws TException { - measureRemoteProc( - ServiceMethod.TERMINATE_WORKFLOW_EXECUTION, () -> terminateWorkflowExecution(request)); - } - - private void terminateWorkflowExecution(TerminateWorkflowExecutionRequest terminateRequest) - throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "TerminateWorkflowExecution", - new WorkflowService.TerminateWorkflowExecution_args(terminateRequest)); - response = doRemoteCall(request); - WorkflowService.TerminateWorkflowExecution_result result = - response.getBody(WorkflowService.TerminateWorkflowExecution_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return; - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetWorkflowExecutionAlreadyCompletedError()) { - throw result.getWorkflowExecutionAlreadyCompletedError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetDomainNotActiveError()) { - throw result.getDomainNotActiveError(); - } - if (result.isSetLimitExceededError()) { - throw result.getLimitExceededError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("TerminateWorkflowExecution failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public ListOpenWorkflowExecutionsResponse ListOpenWorkflowExecutions( - ListOpenWorkflowExecutionsRequest request) throws TException { - return measureRemoteCall( - ServiceMethod.LIST_OPEN_WORKFLOW_EXECUTIONS, () -> listOpenWorkflowExecutions(request)); - } - - private ListOpenWorkflowExecutionsResponse listOpenWorkflowExecutions( - ListOpenWorkflowExecutionsRequest listRequest) throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "ListOpenWorkflowExecutions", - new WorkflowService.ListOpenWorkflowExecutions_args(listRequest)); - response = doRemoteCall(request); - WorkflowService.ListOpenWorkflowExecutions_result result = - response.getBody(WorkflowService.ListOpenWorkflowExecutions_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return result.getSuccess(); - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetLimitExceededError()) { - throw result.getLimitExceededError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("ListOpenWorkflowExecutions failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public ListClosedWorkflowExecutionsResponse ListClosedWorkflowExecutions( - ListClosedWorkflowExecutionsRequest request) throws TException { - return measureRemoteCall( - ServiceMethod.LIST_CLOSED_WORKFLOW_EXECUTIONS, () -> listClosedWorkflowExecutions(request)); - } - - private ListClosedWorkflowExecutionsResponse listClosedWorkflowExecutions( - ListClosedWorkflowExecutionsRequest listRequest) throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "ListClosedWorkflowExecutions", - new WorkflowService.ListClosedWorkflowExecutions_args(listRequest)); - response = doRemoteCall(request); - WorkflowService.ListClosedWorkflowExecutions_result result = - response.getBody(WorkflowService.ListClosedWorkflowExecutions_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return result.getSuccess(); - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("ListClosedWorkflowExecutions failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public ListWorkflowExecutionsResponse ListWorkflowExecutions( - ListWorkflowExecutionsRequest request) - throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { - return measureRemoteCall( - ServiceMethod.LIST_WORKFLOW_EXECUTIONS, () -> listWorkflowExecutions(request)); - } - - private ListWorkflowExecutionsResponse listWorkflowExecutions( - ListWorkflowExecutionsRequest listRequest) throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "ListWorkflowExecutions", - new WorkflowService.ListWorkflowExecutions_args(listRequest)); - response = doRemoteCall(request); - WorkflowService.ListWorkflowExecutions_result result = - response.getBody(WorkflowService.ListWorkflowExecutions_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return result.getSuccess(); - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("ListWorkflowExecutions failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public ListArchivedWorkflowExecutionsResponse ListArchivedWorkflowExecutions( - ListArchivedWorkflowExecutionsRequest listRequest) - throws BadRequestError, EntityNotExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { - return measureRemoteCall( - ServiceMethod.LIST_ARCHIVED_WORKFLOW_EXECUTIONS, - () -> listArchivedWorkflowExecutions(listRequest)); - } - - private ListArchivedWorkflowExecutionsResponse listArchivedWorkflowExecutions( - ListArchivedWorkflowExecutionsRequest listRequest) throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "ListArchivedWorkflowExecutions", - new WorkflowService.ListArchivedWorkflowExecutions_args(listRequest), - options.getRpcListArchivedWorkflowTimeoutMillis()); - response = doRemoteCall(request); - WorkflowService.ListArchivedWorkflowExecutions_result result = - response.getBody(WorkflowService.ListArchivedWorkflowExecutions_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return result.getSuccess(); - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("ListArchivedWorkflowExecutions failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public ListWorkflowExecutionsResponse ScanWorkflowExecutions( - ListWorkflowExecutionsRequest request) - throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { - return measureRemoteCall( - ServiceMethod.SCAN_WORKFLOW_EXECUTIONS, () -> scanWorkflowExecutions(request)); - } - - private ListWorkflowExecutionsResponse scanWorkflowExecutions( - ListWorkflowExecutionsRequest listRequest) throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "ScanWorkflowExecutions", - new WorkflowService.ScanWorkflowExecutions_args(listRequest)); - response = doRemoteCall(request); - WorkflowService.ScanWorkflowExecutions_result result = - response.getBody(WorkflowService.ScanWorkflowExecutions_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return result.getSuccess(); - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("ScanWorkflowExecutions failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public CountWorkflowExecutionsResponse CountWorkflowExecutions( - CountWorkflowExecutionsRequest countRequest) - throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError, - ClientVersionNotSupportedError, TException { - return measureRemoteCall( - ServiceMethod.COUNT_WORKFLOW_EXECUTIONS, () -> countWorkflowExecutions(countRequest)); - } - - private CountWorkflowExecutionsResponse countWorkflowExecutions( - CountWorkflowExecutionsRequest countRequest) throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "CountWorkflowExecutions", - new WorkflowService.CountWorkflowExecutions_args(countRequest)); - response = doRemoteCall(request); - WorkflowService.CountWorkflowExecutions_result result = - response.getBody(WorkflowService.CountWorkflowExecutions_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return result.getSuccess(); - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("CountWorkflowExecutions failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public GetSearchAttributesResponse GetSearchAttributes() - throws InternalServiceError, ServiceBusyError, ClientVersionNotSupportedError, TException { - return measureRemoteCall(ServiceMethod.GET_SEARCH_ATTRIBUTES, () -> getSearchAttributes()); - } - - private GetSearchAttributesResponse getSearchAttributes() throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest("GetSearchAttributes", new WorkflowService.GetSearchAttributes_args()); - response = doRemoteCall(request); - WorkflowService.GetSearchAttributes_result result = - response.getBody(WorkflowService.GetSearchAttributes_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return result.getSuccess(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("GetSearchAttributes failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public void RespondQueryTaskCompleted(RespondQueryTaskCompletedRequest request) - throws TException { - measureRemoteProc( - ServiceMethod.RESPOND_QUERY_TASK_COMPLETED, () -> respondQueryTaskCompleted(request)); - } - - private void respondQueryTaskCompleted(RespondQueryTaskCompletedRequest completeRequest) - throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "RespondQueryTaskCompleted", - new WorkflowService.RespondQueryTaskCompleted_args(completeRequest)); - response = doRemoteCall(request); - WorkflowService.RespondQueryTaskCompleted_result result = - response.getBody(WorkflowService.RespondQueryTaskCompleted_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return; - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetDomainNotActiveError()) { - throw result.getDomainNotActiveError(); - } - if (result.isSetLimitExceededError()) { - throw result.getLimitExceededError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("RespondQueryTaskCompleted failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public QueryWorkflowResponse QueryWorkflow(QueryWorkflowRequest request) throws TException { - return measureRemoteCall(ServiceMethod.QUERY_WORKFLOW, () -> queryWorkflow(request)); - } - - private QueryWorkflowResponse queryWorkflow(QueryWorkflowRequest queryRequest) throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "QueryWorkflow", - new WorkflowService.QueryWorkflow_args(queryRequest), - options.getRpcQueryTimeoutMillis()); - response = doRemoteCall(request); - WorkflowService.QueryWorkflow_result result = - response.getBody(WorkflowService.QueryWorkflow_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return result.getSuccess(); - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetQueryFailedError()) { - throw result.getQueryFailedError(); - } - if (result.isSetLimitExceededError()) { - throw result.getLimitExceededError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("QueryWorkflow failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public ResetStickyTaskListResponse ResetStickyTaskList(ResetStickyTaskListRequest resetRequest) - throws BadRequestError, InternalServiceError, EntityNotExistsError, LimitExceededError, - WorkflowExecutionAlreadyCompletedError, ServiceBusyError, DomainNotActiveError, - TException { - return measureRemoteCall( - ServiceMethod.RESET_STICKY_TASK_LIST, () -> resetStickyTaskList(resetRequest)); - } - - private ResetStickyTaskListResponse resetStickyTaskList(ResetStickyTaskListRequest queryRequest) - throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "ResetStickyTaskList", - new WorkflowService.ResetStickyTaskList_args(queryRequest), - options.getRpcQueryTimeoutMillis()); - response = doRemoteCall(request); - WorkflowService.ResetStickyTaskList_result result = - response.getBody(WorkflowService.ResetStickyTaskList_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return result.getSuccess(); - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetWorkflowExecutionAlreadyCompletedError()) { - throw result.getWorkflowExecutionAlreadyCompletedError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetDomainNotActiveError()) { - throw result.getDomainNotActiveError(); - } - if (result.isSetLimitExceededError()) { - throw result.getLimitExceededError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("ResetStickyTaskList failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public DescribeWorkflowExecutionResponse DescribeWorkflowExecution( - DescribeWorkflowExecutionRequest request) throws TException { - return measureRemoteCall( - ServiceMethod.DESCRIBE_WORKFLOW_EXECUTION, () -> describeWorkflowExecution(request)); - } - - private DescribeWorkflowExecutionResponse describeWorkflowExecution( - DescribeWorkflowExecutionRequest describeRequest) throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "DescribeWorkflowExecution", - new WorkflowService.DescribeWorkflowExecution_args(describeRequest)); - response = doRemoteCall(request); - WorkflowService.DescribeWorkflowExecution_result result = - response.getBody(WorkflowService.DescribeWorkflowExecution_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return result.getSuccess(); - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetLimitExceededError()) { - throw result.getLimitExceededError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("DescribeWorkflowExecution failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public DescribeTaskListResponse DescribeTaskList(DescribeTaskListRequest request) - throws TException { - return measureRemoteCall(ServiceMethod.DESCRIBE_TASK_LIST, () -> describeTaskList(request)); - } - - private DescribeTaskListResponse describeTaskList(DescribeTaskListRequest describeRequest) - throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "DescribeTaskList", new WorkflowService.DescribeTaskList_args(describeRequest)); - response = doRemoteCall(request); - WorkflowService.DescribeTaskList_result result = - response.getBody(WorkflowService.DescribeTaskList_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return result.getSuccess(); - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetLimitExceededError()) { - throw result.getLimitExceededError(); - } - if (result.isSetClientVersionNotSupportedError()) { - throw result.getClientVersionNotSupportedError(); - } - throw new TException("DescribeTaskList failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public ClusterInfo GetClusterInfo() throws InternalServiceError, ServiceBusyError, TException { - return measureRemoteCall(ServiceMethod.GET_CLUSTER_INFO, () -> getClusterInfo()); - } - - private ClusterInfo getClusterInfo() throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest("GetClusterInfo", new WorkflowService.GetClusterInfo_args()); - response = doRemoteCall(request); - WorkflowService.GetClusterInfo_result result = - response.getBody(WorkflowService.GetClusterInfo_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return result.getSuccess(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetInternalServiceError()) { - throw result.getInternalServiceError(); - } - throw new TException("GetClusterInfo failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public ListTaskListPartitionsResponse ListTaskListPartitions( - ListTaskListPartitionsRequest request) - throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, - TException { - return measureRemoteCall( - ServiceMethod.LIST_TASK_LIST_PARTITIONS, () -> listTaskListPartitions(request)); - } - - @Override - public void RefreshWorkflowTasks(RefreshWorkflowTasksRequest refreshWorkflowTasks) - throws BadRequestError, DomainNotActiveError, ServiceBusyError, EntityNotExistsError, - TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "RefreshWorkflowTasks", - new WorkflowService.RefreshWorkflowTasks_args(refreshWorkflowTasks)); - response = doRemoteCall(request); - WorkflowService.RefreshWorkflowTasks_result result = - response.getBody(WorkflowService.RefreshWorkflowTasks_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return; - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetDomainNotActiveError()) { - throw result.getDomainNotActiveError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - throw new TException("RefreshWorkflowTasks failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - private ListTaskListPartitionsResponse listTaskListPartitions( - ListTaskListPartitionsRequest listRequest) throws TException { - ThriftResponse response = null; - try { - ThriftRequest request = - buildThriftRequest( - "ListTaskListPartitions", - new WorkflowService.ListTaskListPartitions_args(listRequest)); - response = doRemoteCall(request); - WorkflowService.ListTaskListPartitions_result result = - response.getBody(WorkflowService.ListTaskListPartitions_result.class); - if (response.getResponseCode() == ResponseCode.OK) { - return result.getSuccess(); - } - if (result.isSetBadRequestError()) { - throw result.getBadRequestError(); - } - if (result.isSetEntityNotExistError()) { - throw result.getEntityNotExistError(); - } - if (result.isSetServiceBusyError()) { - throw result.getServiceBusyError(); - } - if (result.isSetLimitExceededError()) { - throw result.getLimitExceededError(); - } - throw new TException("ListTaskListPartitions failed with unknown error:" + result); - } finally { - if (response != null) { - response.release(); - } - } - } - - @Override - public void StartWorkflowExecution( - StartWorkflowExecutionRequest startRequest, AsyncMethodCallback resultHandler) { - startWorkflowExecution(startRequest, resultHandler, null); - } - - @Override - public void StartWorkflowExecutionWithTimeout( - StartWorkflowExecutionRequest startRequest, - AsyncMethodCallback resultHandler, - Long timeoutInMillis) { - startWorkflowExecution(startRequest, resultHandler, timeoutInMillis); - } - - private void startWorkflowExecution( - StartWorkflowExecutionRequest startRequest, - AsyncMethodCallback resultHandler, - Long timeoutInMillis) { - initializeStartWorkflowRequest(startRequest); - timeoutInMillis = validateAndUpdateTimeout(timeoutInMillis, options.getRpcTimeoutMillis()); - ThriftRequest request = - buildThriftRequest( - "StartWorkflowExecution", - new WorkflowService.StartWorkflowExecution_args(startRequest), - timeoutInMillis); - - CompletableFuture> response = - doRemoteCallAsync(request); - response - .whenComplete( - (r, e) -> { - try { - if (e != null) { - resultHandler.onError(CheckedExceptionWrapper.wrap(e)); - return; - } - WorkflowService.StartWorkflowExecution_result result = - r.getBody(WorkflowService.StartWorkflowExecution_result.class); - if (r.getResponseCode() == ResponseCode.OK) { - resultHandler.onComplete(result.getSuccess()); - return; - } - if (result.isSetBadRequestError()) { - resultHandler.onError(result.getBadRequestError()); - return; - } - if (result.isSetSessionAlreadyExistError()) { - resultHandler.onError(result.getSessionAlreadyExistError()); - return; - } - if (result.isSetServiceBusyError()) { - resultHandler.onError(result.getServiceBusyError()); - return; - } - if (result.isSetDomainNotActiveError()) { - resultHandler.onError(result.getDomainNotActiveError()); - return; - } - if (result.isSetLimitExceededError()) { - resultHandler.onError(result.getLimitExceededError()); - return; - } - if (result.isSetEntityNotExistError()) { - resultHandler.onError(result.getEntityNotExistError()); - return; - } - if (result.isSetClientVersionNotSupportedError()) { - resultHandler.onError(result.getClientVersionNotSupportedError()); - } - resultHandler.onError( - new TException("StartWorkflowExecution failed with unknown error:" + result)); - } finally { - if (r != null) { - r.release(); - } - } - }) - .exceptionally( - (e) -> { - log.error("Unexpected error in StartWorkflowExecution", e); - return null; - }); - } - - @Override - public void StartWorkflowExecutionAsync( - StartWorkflowExecutionAsyncRequest startRequest, AsyncMethodCallback resultHandler) - throws TException { - startWorkflowExecutionAsync(startRequest, resultHandler, null); - } - - @Override - public void StartWorkflowExecutionAsyncWithTimeout( - StartWorkflowExecutionAsyncRequest startAsyncRequest, - AsyncMethodCallback resultHandler, - Long timeoutInMillis) - throws TException { - startWorkflowExecutionAsync(startAsyncRequest, resultHandler, timeoutInMillis); - } - - private void startWorkflowExecutionAsync( - StartWorkflowExecutionAsyncRequest startAsyncRequest, - AsyncMethodCallback resultHandler, - Long timeoutInMillis) - throws TException { - initializeStartWorkflowRequest(startAsyncRequest.getRequest()); - timeoutInMillis = validateAndUpdateTimeout(timeoutInMillis, options.getRpcTimeoutMillis()); - ThriftRequest request = - buildThriftRequest( - "StartWorkflowExecutionAsync", - new WorkflowService.StartWorkflowExecutionAsync_args(startAsyncRequest), - timeoutInMillis); - - CompletableFuture> response = - doRemoteCallAsync(request); - response - .whenComplete( - (r, e) -> { - try { - if (e != null) { - resultHandler.onError(CheckedExceptionWrapper.wrap(e)); - return; - } - WorkflowService.StartWorkflowExecutionAsync_result result = - r.getBody(WorkflowService.StartWorkflowExecutionAsync_result.class); - if (r.getResponseCode() == ResponseCode.OK) { - resultHandler.onComplete(result.getSuccess()); - return; - } - if (result.isSetBadRequestError()) { - resultHandler.onError(result.getBadRequestError()); - return; - } - if (result.isSetSessionAlreadyExistError()) { - resultHandler.onError(result.getSessionAlreadyExistError()); - return; - } - if (result.isSetServiceBusyError()) { - resultHandler.onError(result.getServiceBusyError()); - return; - } - if (result.isSetDomainNotActiveError()) { - resultHandler.onError(result.getDomainNotActiveError()); - return; - } - if (result.isSetLimitExceededError()) { - resultHandler.onError(result.getLimitExceededError()); - return; - } - if (result.isSetEntityNotExistError()) { - resultHandler.onError(result.getEntityNotExistError()); - return; - } - if (result.isSetClientVersionNotSupportedError()) { - resultHandler.onError(result.getClientVersionNotSupportedError()); - } - resultHandler.onError( - new TException( - "StartWorkflowExecutionAsync failed with unknown error:" + result)); - } finally { - if (r != null) { - r.release(); - } - } - }) - .exceptionally( - (e) -> { - log.error("Unexpected error in StartWorkflowExecutionAsync", e); - return null; - }); - } - - private Long validateAndUpdateTimeout(Long timeoutInMillis, Long defaultTimeoutInMillis) { - if (timeoutInMillis == null || timeoutInMillis <= 0 || timeoutInMillis == Long.MAX_VALUE) { - timeoutInMillis = defaultTimeoutInMillis; - } else { - timeoutInMillis = Math.min(timeoutInMillis, defaultTimeoutInMillis); - } - return timeoutInMillis; - } - - @SuppressWarnings({"unchecked", "FutureReturnValueIgnored"}) - @Override - public void GetWorkflowExecutionHistoryWithTimeout( - GetWorkflowExecutionHistoryRequest getRequest, - AsyncMethodCallback resultHandler, - Long timeoutInMillis) { - - getWorkflowExecutionHistory(getRequest, resultHandler, timeoutInMillis); - } - - @SuppressWarnings({"unchecked", "FutureReturnValueIgnored"}) - @Override - public void GetWorkflowExecutionHistory( - GetWorkflowExecutionHistoryRequest getRequest, AsyncMethodCallback resultHandler) { - - getWorkflowExecutionHistory(getRequest, resultHandler, null); - } - - private void getWorkflowExecutionHistory( - GetWorkflowExecutionHistoryRequest getRequest, - AsyncMethodCallback resultHandler, - Long timeoutInMillis) { - - ThriftRequest request = - buildGetWorkflowExecutionHistoryThriftRequest(getRequest, timeoutInMillis); - - CompletableFuture> response = - doRemoteCallAsync(request); - response - .whenComplete( - (r, e) -> { - try { - if (e != null) { - resultHandler.onError(CheckedExceptionWrapper.wrap(e)); - return; - } - WorkflowService.GetWorkflowExecutionHistory_result result = - r.getBody(WorkflowService.GetWorkflowExecutionHistory_result.class); - - if (r.getResponseCode() == ResponseCode.OK) { - GetWorkflowExecutionHistoryResponse res = result.getSuccess(); - if (res.getRawHistory() != null) { - History history = - InternalUtils.DeserializeFromBlobDataToHistory( - res.getRawHistory(), getRequest.getHistoryEventFilterType()); - res.setHistory(history); - } - resultHandler.onComplete(res); - return; - } - if (result.isSetBadRequestError()) { - resultHandler.onError(result.getBadRequestError()); - return; - } - if (result.isSetEntityNotExistError()) { - resultHandler.onError(result.getEntityNotExistError()); - return; - } - if (result.isSetServiceBusyError()) { - resultHandler.onError(result.getServiceBusyError()); - return; - } - resultHandler.onError( - new TException( - "GetWorkflowExecutionHistory failed with unknown " + "error:" + result)); - } catch (TException tException) { - resultHandler.onError(tException); - } finally { - if (r != null) { - r.release(); - } - } - }) - .exceptionally( - (e) -> { - log.error("Unexpected error in GetWorkflowExecutionHistory", e); - return null; - }); - } - - @Override - public void PollForDecisionTask( - PollForDecisionTaskRequest pollRequest, AsyncMethodCallback resultHandler) throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void RespondDecisionTaskCompleted( - RespondDecisionTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void RespondDecisionTaskFailed( - RespondDecisionTaskFailedRequest failedRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void PollForActivityTask( - PollForActivityTaskRequest pollRequest, AsyncMethodCallback resultHandler) throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void RecordActivityTaskHeartbeat( - RecordActivityTaskHeartbeatRequest heartbeatRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void RecordActivityTaskHeartbeatByID( - RecordActivityTaskHeartbeatByIDRequest heartbeatRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void RespondActivityTaskCompleted( - RespondActivityTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void RespondActivityTaskCompletedByID( - RespondActivityTaskCompletedByIDRequest completeRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void RespondActivityTaskFailed( - RespondActivityTaskFailedRequest failRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void RespondActivityTaskFailedByID( - RespondActivityTaskFailedByIDRequest failRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void RespondActivityTaskCanceled( - RespondActivityTaskCanceledRequest canceledRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void RespondActivityTaskCanceledByID( - RespondActivityTaskCanceledByIDRequest canceledRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void RequestCancelWorkflowExecution( - RequestCancelWorkflowExecutionRequest cancelRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void SignalWorkflowExecution( - SignalWorkflowExecutionRequest signalRequest, AsyncMethodCallback resultHandler) { - signalWorkflowExecution(signalRequest, resultHandler, null); - } - - @Override - public void SignalWorkflowExecutionWithTimeout( - SignalWorkflowExecutionRequest signalRequest, - AsyncMethodCallback resultHandler, - Long timeoutInMillis) { - signalWorkflowExecution(signalRequest, resultHandler, timeoutInMillis); - } - - private void signalWorkflowExecution( - SignalWorkflowExecutionRequest signalRequest, - AsyncMethodCallback resultHandler, - Long timeoutInMillis) { - - timeoutInMillis = validateAndUpdateTimeout(timeoutInMillis, options.getRpcTimeoutMillis()); - ThriftRequest request = - buildThriftRequest( - "SignalWorkflowExecution", - new WorkflowService.SignalWorkflowExecution_args(signalRequest), - timeoutInMillis); - CompletableFuture> response = - doRemoteCallAsync(request); - response - .whenComplete( - (r, e) -> { - try { - if (e != null) { - resultHandler.onError(CheckedExceptionWrapper.wrap(e)); - return; - } - WorkflowService.SignalWorkflowExecution_result result = - r.getBody(WorkflowService.SignalWorkflowExecution_result.class); - if (r.getResponseCode() == ResponseCode.OK) { - resultHandler.onComplete(null); - return; - } - if (result.isSetBadRequestError()) { - resultHandler.onError(result.getBadRequestError()); - return; - } - if (result.isSetEntityNotExistError()) { - resultHandler.onError(result.getEntityNotExistError()); - return; - } - if (result.isSetWorkflowExecutionAlreadyCompletedError()) { - resultHandler.onError(result.getWorkflowExecutionAlreadyCompletedError()); - return; - } - if (result.isSetServiceBusyError()) { - resultHandler.onError(result.getServiceBusyError()); - return; - } - if (result.isSetDomainNotActiveError()) { - resultHandler.onError(result.getDomainNotActiveError()); - return; - } - if (result.isSetLimitExceededError()) { - resultHandler.onError(result.getLimitExceededError()); - return; - } - if (result.isSetClientVersionNotSupportedError()) { - resultHandler.onError(result.getClientVersionNotSupportedError()); - return; - } - resultHandler.onError( - new TException("SignalWorkflowExecution failed with unknown error:" + result)); - } finally { - if (r != null) { - r.release(); - } - } - }) - .exceptionally( - (e) -> { - log.error("Unexpected error in SignalWorkflowExecution", e); - return null; - }); - } - - @Override - public void SignalWithStartWorkflowExecution( - SignalWithStartWorkflowExecutionRequest signalWithStartRequest, - AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void SignalWithStartWorkflowExecutionAsync( - SignalWithStartWorkflowExecutionAsyncRequest signalWithStartRequest, - AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("unimplemented"); - } - - @Override - public void ResetWorkflowExecution( - ResetWorkflowExecutionRequest resetRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void TerminateWorkflowExecution( - TerminateWorkflowExecutionRequest terminateRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void ListOpenWorkflowExecutions( - ListOpenWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void ListClosedWorkflowExecutions( - ListClosedWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void ListWorkflowExecutions( - ListWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void ListArchivedWorkflowExecutions( - ListArchivedWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void ScanWorkflowExecutions( - ListWorkflowExecutionsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void CountWorkflowExecutions( - CountWorkflowExecutionsRequest countRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void GetSearchAttributes(AsyncMethodCallback resultHandler) throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void RespondQueryTaskCompleted( - RespondQueryTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void ResetStickyTaskList( - ResetStickyTaskListRequest resetRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void QueryWorkflow(QueryWorkflowRequest queryRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void DescribeWorkflowExecution( - DescribeWorkflowExecutionRequest describeRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void DescribeTaskList(DescribeTaskListRequest request, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void GetClusterInfo(AsyncMethodCallback resultHandler) throws TException {} - - @Override - public void ListTaskListPartitions( - ListTaskListPartitionsRequest request, AsyncMethodCallback resultHandler) throws TException {} - - @Override - public void RefreshWorkflowTasks( - RefreshWorkflowTasksRequest request, AsyncMethodCallback resultHandler) throws TException {} - - @Override - public void RegisterDomain( - RegisterDomainRequest registerRequest, AsyncMethodCallback resultHandler) throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void DescribeDomain( - DescribeDomainRequest describeRequest, AsyncMethodCallback resultHandler) throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void ListDomains(ListDomainsRequest listRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void UpdateDomain(UpdateDomainRequest updateRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void DeprecateDomain( - DeprecateDomainRequest deprecateRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("not implemented"); - } - - @Override - public void RestartWorkflowExecution( - RestartWorkflowExecutionRequest restartRequest, AsyncMethodCallback resultHandler) - throws TException { - throw new UnsupportedOperationException("unimplemented"); - } - - @Override - public void GetTaskListsByDomain( - GetTaskListsByDomainRequest request, AsyncMethodCallback resultHandler) - throws org.apache.thrift.TException { - throw new UnsupportedOperationException("not implemented"); - } -} diff --git a/src/main/java/com/uber/cadence/worker/ShadowingWorker.java b/src/main/java/com/uber/cadence/worker/ShadowingWorker.java index 892128d70..8ad31815e 100644 --- a/src/main/java/com/uber/cadence/worker/ShadowingWorker.java +++ b/src/main/java/com/uber/cadence/worker/ShadowingWorker.java @@ -23,6 +23,8 @@ import com.uber.cadence.WorkflowIdReusePolicy; import com.uber.cadence.WorkflowType; import com.uber.cadence.client.WorkflowClient; +import com.uber.cadence.converter.DataConverter; +import com.uber.cadence.converter.JsonDataConverter; import com.uber.cadence.internal.common.InternalUtils; import com.uber.cadence.internal.common.RpcRetryer; import com.uber.cadence.internal.metrics.MetricsTag; @@ -34,8 +36,8 @@ import com.uber.cadence.internal.worker.SingleWorkerOptions; import com.uber.cadence.internal.worker.Suspendable; import com.uber.cadence.serviceclient.IWorkflowService; +import com.uber.cadence.shadower.Constants; import com.uber.cadence.shadower.WorkflowParams; -import com.uber.cadence.shadower.shadowerConstants; import com.uber.cadence.testing.TestEnvironmentOptions; import com.uber.cadence.workflow.Functions; import com.uber.m3.tally.Scope; @@ -44,8 +46,6 @@ import java.util.UUID; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import org.apache.thrift.TSerializer; -import org.apache.thrift.protocol.TSimpleJSONProtocol; public final class ShadowingWorker implements Suspendable { @@ -117,7 +117,7 @@ public ShadowingWorker( .build(); activityWorker = new SyncActivityWorker( - client.getService(), shadowerConstants.LocalDomainName, this.taskList, activityOptions); + client.getService(), Constants.LocalDomainName, this.taskList, activityOptions); activityWorker.setActivitiesImplementation(scanActivity, replayActivity); } @@ -183,7 +183,7 @@ public void addWorkflowImplementationFactory( } protected void startShadowingWorkflow() throws Exception { - TSerializer serializer = new TSerializer(new TSimpleJSONProtocol.Factory()); + DataConverter dataConverter = JsonDataConverter.getInstance(); WorkflowParams params = new WorkflowParams() .setDomain(shadowingOptions.getDomain()) @@ -195,11 +195,11 @@ protected void startShadowingWorkflow() throws Exception { .setWorkflowQuery(shadowingOptions.getWorkflowQuery()); StartWorkflowExecutionRequest request = new StartWorkflowExecutionRequest() - .setDomain(shadowerConstants.LocalDomainName) - .setWorkflowId(shadowingOptions.getDomain() + shadowerConstants.WorkflowIDSuffix) - .setTaskList(new TaskList().setName(shadowerConstants.TaskList)) - .setInput(serializer.serialize(params)) - .setWorkflowType(new WorkflowType().setName(shadowerConstants.WorkflowName)) + .setDomain(Constants.LocalDomainName) + .setWorkflowId(shadowingOptions.getDomain() + Constants.WorkflowIDSuffix) + .setTaskList(new TaskList().setName(Constants.TaskList)) + .setInput(dataConverter.toData(params)) + .setWorkflowType(new WorkflowType().setName(Constants.WorkflowName)) .setWorkflowIdReusePolicy(WorkflowIdReusePolicy.AllowDuplicate) .setRequestId(UUID.randomUUID().toString()) .setExecutionStartToCloseTimeoutSeconds(864000) diff --git a/src/main/java/com/uber/cadence/worker/WorkerFactory.java b/src/main/java/com/uber/cadence/worker/WorkerFactory.java index fc19dcb34..19e716082 100644 --- a/src/main/java/com/uber/cadence/worker/WorkerFactory.java +++ b/src/main/java/com/uber/cadence/worker/WorkerFactory.java @@ -22,6 +22,7 @@ import com.google.common.base.Preconditions; import com.google.common.base.Strings; import com.uber.cadence.PollForDecisionTaskResponse; +import com.uber.cadence.TaskListKind; import com.uber.cadence.client.WorkflowClient; import com.uber.cadence.converter.DataConverter; import com.uber.cadence.converter.JsonDataConverter; @@ -134,7 +135,7 @@ public WorkerFactory(WorkflowClient workflowClient, WorkerFactoryOptions factory workflowClient.getService(), workflowClient.getOptions().getDomain(), getStickyTaskListName(), - TaskListKind.TASK_LIST_KIND_STICKY, + TaskListKind.STICKY, stickyScope, workflowClient.getOptions().getIdentity()) .get(), diff --git a/src/main/java/com/uber/cadence/workflow/WorkflowInterceptor.java b/src/main/java/com/uber/cadence/workflow/WorkflowInterceptor.java index c744ae88f..f721323cd 100644 --- a/src/main/java/com/uber/cadence/workflow/WorkflowInterceptor.java +++ b/src/main/java/com/uber/cadence/workflow/WorkflowInterceptor.java @@ -41,7 +41,7 @@ public final class WorkflowExecuteInput { public WorkflowExecuteInput(WorkflowExecutionStartedEventAttributes workflowEventStart) { this.workflowEventStart = workflowEventStart; - this.workflowType = workflowEventStart.workflowType; + this.workflowType = workflowEventStart.getWorkflowType(); this.input = workflowEventStart.getInput(); } diff --git a/src/main/java/com/uber/cadence/workflow/WorkflowUtils.java b/src/main/java/com/uber/cadence/workflow/WorkflowUtils.java index e723eb3ab..705881ed9 100644 --- a/src/main/java/com/uber/cadence/workflow/WorkflowUtils.java +++ b/src/main/java/com/uber/cadence/workflow/WorkflowUtils.java @@ -21,7 +21,7 @@ import com.uber.cadence.SearchAttributes; import com.uber.cadence.converter.DataConverter; import com.uber.cadence.converter.JsonDataConverter; -import java.nio.ByteBuffer; +import java.util.Arrays; public class WorkflowUtils { private static final DataConverter jsonConverter = JsonDataConverter.getInstance(); @@ -35,9 +35,7 @@ public static T getValueFromSearchAttributes( } private static byte[] getValueBytes(SearchAttributes searchAttributes, String key) { - ByteBuffer byteBuffer = searchAttributes.getIndexedFields().get(key).duplicate(); - final byte[] valueBytes = new byte[byteBuffer.remaining()]; - byteBuffer.get(valueBytes); - return valueBytes; + byte[] original = searchAttributes.getIndexedFields().get(key); + return Arrays.copyOf(original, original.length); } } diff --git a/src/test/java/com/uber/cadence/FakeWorkflowServiceRule.java b/src/test/java/com/uber/cadence/FakeWorkflowServiceRule.java deleted file mode 100644 index d9d74ba4c..000000000 --- a/src/test/java/com/uber/cadence/FakeWorkflowServiceRule.java +++ /dev/null @@ -1,137 +0,0 @@ -package com.uber.cadence; - -import com.uber.cadence.serviceclient.ClientOptions; -import com.uber.cadence.serviceclient.IWorkflowService; -import com.uber.cadence.serviceclient.WorkflowServiceTChannel; -import com.uber.tchannel.api.ResponseCode; -import com.uber.tchannel.api.TChannel; -import com.uber.tchannel.api.handlers.ThriftRequestHandler; -import com.uber.tchannel.messages.ThriftRequest; -import com.uber.tchannel.messages.ThriftResponse; -import io.opentracing.mock.MockTracer; -import java.util.Map; -import java.util.Queue; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentLinkedQueue; -import org.junit.rules.ExternalResource; - -/** - * FakeWorkflowServiceRule a local TChannel service which can be stubbed with fixed responses and - * captures the requests made to it. This allows testing throw the entire TChannel stack, - * particularly with TChannel being difficult to mock. - */ -public class FakeWorkflowServiceRule extends ExternalResource { - - private final Map stubbedEndpoints = new ConcurrentHashMap<>(); - private final MockTracer tracer = new MockTracer(); - private TChannel tChannel; - private IWorkflowService clientConn; - - @Override - protected void before() throws Throwable { - tChannel = new TChannel.Builder("cadence-frontend").build(); - tChannel.setDefaultUserHandler( - new ThriftRequestHandler() { - @Override - public ThriftResponse handleImpl(ThriftRequest request) { - StubbedEndpoint endpoint = stubbedEndpoints.get(request.getEndpoint()); - if (endpoint == null) { - throw new IllegalStateException( - "Endpoint " + request.getEndpoint() + " was not stubbed"); - } - @SuppressWarnings("rawtypes") - StubbedResponse stub = endpoint.getNext(); - if (stub == null) { - throw new IllegalStateException( - "Exhausted all invocations of " + request.getEndpoint()); - } - //noinspection unchecked - stub.future.complete(request.getBody(stub.requestType)); - return new ThriftResponse.Builder<>(request) - .setBody(stub.body) - .setResponseCode(stub.code) - .build(); - } - }); - tChannel.listen(); - clientConn = - new WorkflowServiceTChannel( - ClientOptions.newBuilder() - .setTracer(tracer) - .setHost(tChannel.getListeningHost()) - .setPort(tChannel.getListeningPort()) - .build()); - } - - @Override - protected void after() { - stubbedEndpoints.clear(); - if (clientConn != null) { - clientConn.close(); - } - if (tChannel != null) { - tChannel.shutdown(); - tChannel = null; - } - } - - public void resetStubs() { - tracer.reset(); - stubbedEndpoints.clear(); - } - - public IWorkflowService getClient() { - return clientConn; - } - - public MockTracer getTracer() { - return tracer; - } - - public CompletableFuture stubSuccess( - String endpoint, Class requestType, Object response) { - return stubEndpoint(endpoint, requestType, ResponseCode.OK, response); - } - - public CompletableFuture stubError( - String endpoint, Class requestType, Object response) { - return stubEndpoint(endpoint, requestType, ResponseCode.Error, response); - } - - public CompletableFuture stubEndpoint( - String endpoint, Class requestType, ResponseCode code, Object response) { - CompletableFuture future = new CompletableFuture<>(); - StubbedEndpoint endpointStub = - stubbedEndpoints.computeIfAbsent(endpoint, id -> new StubbedEndpoint()); - endpointStub.addStub(new StubbedResponse<>(response, code, future, requestType)); - return future; - } - - private static class StubbedEndpoint { - private final Queue> responses = new ConcurrentLinkedQueue<>(); - - public void addStub(StubbedResponse response) { - responses.add(response); - } - - public StubbedResponse getNext() { - return responses.poll(); - } - } - - private static class StubbedResponse { - private final Object body; - private final ResponseCode code; - private final CompletableFuture future; - private final Class requestType; - - private StubbedResponse( - Object body, ResponseCode code, CompletableFuture future, Class requestType) { - this.body = body; - this.code = code; - this.future = future; - this.requestType = requestType; - } - } -} diff --git a/src/test/java/com/uber/cadence/RegisterTestDomain.java b/src/test/java/com/uber/cadence/RegisterTestDomain.java index 44a38a195..28b08e057 100644 --- a/src/test/java/com/uber/cadence/RegisterTestDomain.java +++ b/src/test/java/com/uber/cadence/RegisterTestDomain.java @@ -5,7 +5,6 @@ import com.uber.cadence.serviceclient.IWorkflowService; import com.uber.cadence.testUtils.TestEnvironment; -import org.apache.thrift.TException; /** Waits for local service to become available and registers UnitTest domain. */ public class RegisterTestDomain { @@ -32,7 +31,7 @@ private static void registerDomain(IWorkflowService service, String domain) break; } catch (DomainAlreadyExistsError e) { break; - } catch (TException e) { + } catch (BaseError e) { String message = e.getMessage(); if (message != null && !message.contains("Failed to connect to the host") diff --git a/src/test/java/com/uber/cadence/internal/common/InternalUtilsTest.java b/src/test/java/com/uber/cadence/internal/common/InternalUtilsTest.java index 23ecb652c..eb6250adf 100644 --- a/src/test/java/com/uber/cadence/internal/common/InternalUtilsTest.java +++ b/src/test/java/com/uber/cadence/internal/common/InternalUtilsTest.java @@ -17,23 +17,14 @@ package com.uber.cadence.internal.common; -import static com.uber.cadence.EventType.WorkflowExecutionStarted; import static junit.framework.TestCase.assertEquals; -import static org.junit.Assert.assertNotNull; -import com.google.common.collect.Lists; -import com.googlecode.junittoolbox.MultithreadingTester; -import com.googlecode.junittoolbox.RunnableAssert; import com.uber.cadence.*; import com.uber.cadence.converter.DataConverterException; import com.uber.cadence.workflow.WorkflowUtils; import java.io.FileOutputStream; -import java.time.LocalDateTime; -import java.time.ZoneOffset; import java.util.HashMap; -import java.util.List; import java.util.Map; -import junit.framework.TestCase; import org.junit.Test; public class InternalUtilsTest { @@ -56,101 +47,4 @@ public void testConvertMapToSearchAttributesException() throws Throwable { attr.put("InvalidValue", new FileOutputStream("dummy")); InternalUtils.convertMapToSearchAttributes(attr); } - - @Test - public void testSerialization_History() { - - RunnableAssert r = - new RunnableAssert("history_serialization") { - @Override - public void run() { - HistoryEvent event = - new HistoryEvent() - .setEventId(1) - .setVersion(1) - .setEventType(WorkflowExecutionStarted) - .setTimestamp(LocalDateTime.now().toEpochSecond(ZoneOffset.UTC)) - .setWorkflowExecutionStartedEventAttributes( - new WorkflowExecutionStartedEventAttributes() - .setAttempt(1) - .setFirstExecutionRunId("test")); - - List historyEvents = Lists.newArrayList(event); - History history = new History().setEvents(historyEvents); - DataBlob blob = InternalUtils.SerializeFromHistoryToBlobData(history); - assertNotNull(blob); - - try { - History result = - InternalUtils.DeserializeFromBlobDataToHistory( - Lists.newArrayList(blob), HistoryEventFilterType.ALL_EVENT); - assertNotNull(result); - assertEquals(1, result.events.size()); - assertEquals(event.getEventId(), result.events.get(0).getEventId()); - assertEquals(event.getVersion(), result.events.get(0).getVersion()); - assertEquals(event.getEventType(), result.events.get(0).getEventType()); - assertEquals(event.getTimestamp(), result.events.get(0).getTimestamp()); - assertEquals( - event.getWorkflowExecutionStartedEventAttributes(), - result.events.get(0).getWorkflowExecutionStartedEventAttributes()); - } catch (Exception e) { - TestCase.fail("Received unexpected error during deserialization"); - } - } - }; - - try { - new MultithreadingTester().add(r).numThreads(50).numRoundsPerThread(10).run(); - } catch (Exception e) { - TestCase.fail("Received unexpected error during concurrent deserialization"); - } - } - - @Test - public void testSerialization_HistoryEvent() { - - RunnableAssert r = - new RunnableAssert("history_event_serialization") { - @Override - public void run() { - HistoryEvent event = - new HistoryEvent() - .setEventId(1) - .setVersion(1) - .setEventType(WorkflowExecutionStarted) - .setTimestamp(LocalDateTime.now().toEpochSecond(ZoneOffset.UTC)) - .setWorkflowExecutionStartedEventAttributes( - new WorkflowExecutionStartedEventAttributes() - .setAttempt(1) - .setFirstExecutionRunId("test")); - - List historyEvents = Lists.newArrayList(event); - List blobList = - InternalUtils.SerializeFromHistoryEventToBlobData(historyEvents); - assertEquals(1, blobList.size()); - - try { - List result = - InternalUtils.DeserializeFromBlobDataToHistoryEvents(blobList); - assertNotNull(result); - assertEquals(1, result.size()); - assertEquals(event.getEventId(), result.get(0).getEventId()); - assertEquals(event.getVersion(), result.get(0).getVersion()); - assertEquals(event.getEventType(), result.get(0).getEventType()); - assertEquals(event.getTimestamp(), result.get(0).getTimestamp()); - assertEquals( - event.getWorkflowExecutionStartedEventAttributes(), - result.get(0).getWorkflowExecutionStartedEventAttributes()); - } catch (Exception e) { - TestCase.fail("Received unexpected error during deserialization"); - } - } - }; - - try { - new MultithreadingTester().add(r).numThreads(50).numRoundsPerThread(10).run(); - } catch (Exception e) { - TestCase.fail("Received unexpected error during concurrent deserialization"); - } - } } diff --git a/src/test/java/com/uber/cadence/internal/common/StartWorkflowExecutionParametersTest.java b/src/test/java/com/uber/cadence/internal/common/StartWorkflowExecutionParametersTest.java index fd675f850..5952ec9ea 100644 --- a/src/test/java/com/uber/cadence/internal/common/StartWorkflowExecutionParametersTest.java +++ b/src/test/java/com/uber/cadence/internal/common/StartWorkflowExecutionParametersTest.java @@ -56,7 +56,7 @@ public void setUp() { public void testToString() { String expectedString = "StartWorkflowExecutionParameters{workflowId='workflow123', " - + "workflowType=WorkflowType(name:sampleWorkflow), taskList='taskList1', " + + "workflowType=WorkflowType(name=sampleWorkflow), taskList='taskList1', " + "input=[1, 2, 3], executionStartToCloseTimeoutSeconds=60, " + "taskStartToCloseTimeoutSeconds=30, workflowIdReusePolicy=null, " + "retryParameters=RetryParameters{initialIntervalInSeconds=0, " diff --git a/src/test/java/com/uber/cadence/internal/common/WorkflowExecutionUtilsTest.java b/src/test/java/com/uber/cadence/internal/common/WorkflowExecutionUtilsTest.java index 8d0e50969..a4a263e7d 100644 --- a/src/test/java/com/uber/cadence/internal/common/WorkflowExecutionUtilsTest.java +++ b/src/test/java/com/uber/cadence/internal/common/WorkflowExecutionUtilsTest.java @@ -21,13 +21,12 @@ import com.uber.cadence.*; import com.uber.cadence.client.WorkflowTerminatedException; import com.uber.cadence.client.WorkflowTimedOutException; -import com.uber.cadence.internal.compatibility.ThriftObjects; +import com.uber.cadence.internal.compatibility.ClientObjects; import com.uber.cadence.serviceclient.IWorkflowService; import java.util.*; import java.util.concurrent.CancellationException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -import org.apache.thrift.TException; import org.junit.Before; import org.junit.Test; @@ -42,8 +41,7 @@ public class WorkflowExecutionUtilsTest { + " ActivityType = activityName;\n" + " Domain = domain;\n" + " Header = {\n" - + " Fields = { key1=value1, key2=value2 };\n" - + " FieldsSize = 2\n" + + " Fields = { key1=value1, key2=value2 }\n" + " };\n" + " HeartbeatTimeoutSeconds = 4;\n" + " Input = input;\n" @@ -408,7 +406,7 @@ public void testGetHistoryPage_HistoryIsNull() throws Exception { @Test public void testGetHistoryPage_ExceptionWhileRetrievingExecutionHistory() throws Exception { final String errMessage = "thrift comm exception"; - when(mockService.GetWorkflowExecutionHistory(any())).thenThrow(new TException(errMessage)); + when(mockService.GetWorkflowExecutionHistory(any())).thenThrow(new BaseError(errMessage)); Error exception = assertThrows( @@ -433,8 +431,8 @@ public void testPrettyPrintDecisions() throws Exception { new Header() .setFields( ImmutableMap.of( - "key1", ThriftObjects.utf8("value1"), - "key2", ThriftObjects.utf8("value2"))); + "key1", ClientObjects.utf8("value1"), + "key2", ClientObjects.utf8("value2"))); final Decision decisionScheduleActivity = new Decision() @@ -444,7 +442,7 @@ public void testPrettyPrintDecisions() throws Exception { .setActivityId("activityId") .setActivityType(activityType) .setTaskList(taskList) - .setInput(ThriftObjects.utf8("input")) + .setInput(ClientObjects.utf8("input")) .setScheduleToCloseTimeoutSeconds(1) .setScheduleToStartTimeoutSeconds(2) .setStartToCloseTimeoutSeconds(3) @@ -460,7 +458,7 @@ public void testPrettyPrintDecisions() throws Exception { new FailWorkflowExecutionDecisionAttributes() .setReason("failure reason") .setDetails( - ThriftObjects.utf8( + ClientObjects.utf8( "{\"error\":\"panic\", \"stackTrace\":\"fn()\\nmain()\"}"))); ArrayList decisions = diff --git a/src/test/java/com/uber/cadence/internal/compatibility/ThriftObjects.java b/src/test/java/com/uber/cadence/internal/compatibility/ClientObjects.java similarity index 95% rename from src/test/java/com/uber/cadence/internal/compatibility/ThriftObjects.java rename to src/test/java/com/uber/cadence/internal/compatibility/ClientObjects.java index 7737f01bb..f812b282d 100644 --- a/src/test/java/com/uber/cadence/internal/compatibility/ThriftObjects.java +++ b/src/test/java/com/uber/cadence/internal/compatibility/ClientObjects.java @@ -17,25 +17,22 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.uber.cadence.*; -import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.Collections; import java.util.Map; import java.util.stream.Collectors; -public final class ThriftObjects { - public static final WorkflowType WORKFLOW_TYPE = - new com.uber.cadence.WorkflowType().setName("workflowType"); +public class ClientObjects { + + public static final WorkflowType WORKFLOW_TYPE = new WorkflowType().setName("workflowType"); public static final ActivityType ACTIVITY_TYPE = new ActivityType().setName("activityName"); public static final TaskList TASK_LIST = - new com.uber.cadence.TaskList() - .setName("taskList") - .setKind(com.uber.cadence.TaskListKind.NORMAL); + new TaskList().setName("taskList").setKind(TaskListKind.NORMAL); public static final TaskListMetadata TASK_LIST_METADATA = new TaskListMetadata().setMaxTasksPerSecond(10); public static final RetryPolicy RETRY_POLICY = - new com.uber.cadence.RetryPolicy() + new RetryPolicy() .setInitialIntervalInSeconds(11) .setBackoffCoefficient(0.5) .setMaximumIntervalInSeconds(12) @@ -59,11 +56,13 @@ public final class ThriftObjects { .setWorkerTaskList(TASK_LIST) .setScheduleToStartTimeoutSeconds(1); public static final WorkflowQuery WORKFLOW_QUERY = - new WorkflowQuery().setQueryType("queryType").setQueryArgs(utf8("queryArgs")); + new WorkflowQuery() + .setQueryType("queryType") + .setQueryArgs("queryArgs".getBytes(StandardCharsets.UTF_8)); public static final WorkflowQueryResult WORKFLOW_QUERY_RESULT = new WorkflowQueryResult() .setResultType(QueryResultType.ANSWERED) - .setAnswer(utf8("answer")) + .setAnswer("answer".getBytes(StandardCharsets.UTF_8)) .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"))); @@ -113,7 +112,7 @@ public final class ThriftObjects { .setSearchAttributes(SEARCH_ATTRIBUTES) .setAutoResetPoints(RESET_POINTS) .setTaskList(TASK_LIST.getName()) - .setIsCron(true); + .setCron(true); public static final PendingActivityInfo PENDING_ACTIVITY_INFO = new PendingActivityInfo() .setActivityID("activityId") @@ -180,7 +179,16 @@ public final class ThriftObjects { .setHistoryArchivalURI("historyArchivalUri") .setVisibilityArchivalStatus(ArchivalStatus.DISABLED) .setVisibilityArchivalURI("visibilityArchivalUri") - .setEmitMetric(true); + .setEmitMetric(true) + .setAsyncWorkflowConfiguration(new AsyncWorkflowConfiguration().setEnabled(true)) + .setIsolationgroups( + new IsolationGroupConfiguration() + .setIsolationGroups( + ImmutableList.of( + new IsolationGroupPartition() + .setName("partitionName") + .setState(IsolationGroupState.HEALTHY)))); + public static final StartTimeFilter START_TIME_FILTER = new StartTimeFilter().setEarliestTime(2).setLatestTime(3); public static final WorkflowExecutionFilter WORKFLOW_EXECUTION_FILTER = @@ -425,7 +433,7 @@ public final class ThriftObjects { .setScheduleToStartTimeoutSeconds(2) .setStartToCloseTimeoutSeconds(3) .setHeartbeatTimeoutSeconds(4) - .setDecisionTaskCompletedEventId(5) + .setDecisionTaskCompletedEventId((5)) .setRetryPolicy(RETRY_POLICY) .setHeader(HEADER); @@ -775,7 +783,7 @@ public final class ThriftObjects { .setDetails(utf8("details")) .setIdentity("identity"); public static final RespondActivityTaskCanceledRequest RESPOND_ACTIVITY_TASK_CANCELED_REQUEST = - new com.uber.cadence.RespondActivityTaskCanceledRequest() + new RespondActivityTaskCanceledRequest() .setTaskToken(utf8("taskToken")) .setDetails(utf8("details")) .setIdentity("identity"); @@ -855,8 +863,8 @@ public final class ThriftObjects { .setSkipArchival(true) .setNextPageToken(utf8("nextPageToken")); - public static final com.uber.cadence.StartWorkflowExecutionRequest START_WORKFLOW_EXECUTION = - new com.uber.cadence.StartWorkflowExecutionRequest() + public static final StartWorkflowExecutionRequest START_WORKFLOW_EXECUTION = + new StartWorkflowExecutionRequest() .setDomain("domain") .setWorkflowId(WORKFLOW_ID) .setWorkflowType(WORKFLOW_TYPE) @@ -866,7 +874,7 @@ public final class ThriftObjects { .setTaskStartToCloseTimeoutSeconds(2) .setIdentity("identity") .setRequestId("requestId") - .setWorkflowIdReusePolicy(com.uber.cadence.WorkflowIdReusePolicy.AllowDuplicate) + .setWorkflowIdReusePolicy(WorkflowIdReusePolicy.AllowDuplicate) .setRetryPolicy(RETRY_POLICY) .setCronSchedule("cronSchedule") .setMemo(MEMO) @@ -874,29 +882,28 @@ public final class ThriftObjects { .setHeader(HEADER) .setJitterStartSeconds(0) .setDelayStartSeconds(3); - public static final com.uber.cadence.SignalWithStartWorkflowExecutionRequest - SIGNAL_WITH_START_WORKFLOW_EXECUTION = - new SignalWithStartWorkflowExecutionRequest() - .setDomain("domain") - .setWorkflowId(WORKFLOW_ID) - .setWorkflowType(WORKFLOW_TYPE) - .setTaskList(TASK_LIST) - .setInput("input".getBytes(StandardCharsets.UTF_8)) - .setExecutionStartToCloseTimeoutSeconds(1) - .setTaskStartToCloseTimeoutSeconds(2) - .setIdentity("identity") - .setRequestId("requestId") - .setWorkflowIdReusePolicy(com.uber.cadence.WorkflowIdReusePolicy.AllowDuplicate) - .setSignalName("signalName") - .setSignalInput("signalInput".getBytes(StandardCharsets.UTF_8)) - .setControl("control".getBytes(StandardCharsets.UTF_8)) - .setRetryPolicy(RETRY_POLICY) - .setCronSchedule("cronSchedule") - .setMemo(MEMO) - .setSearchAttributes(SEARCH_ATTRIBUTES) - .setHeader(HEADER) - .setDelayStartSeconds(3) - .setJitterStartSeconds(0); + public static final SignalWithStartWorkflowExecutionRequest SIGNAL_WITH_START_WORKFLOW_EXECUTION = + new SignalWithStartWorkflowExecutionRequest() + .setDomain("domain") + .setWorkflowId(WORKFLOW_ID) + .setWorkflowType(WORKFLOW_TYPE) + .setTaskList(TASK_LIST) + .setInput("input".getBytes(StandardCharsets.UTF_8)) + .setExecutionStartToCloseTimeoutSeconds(1) + .setTaskStartToCloseTimeoutSeconds(2) + .setIdentity("identity") + .setRequestId("requestId") + .setWorkflowIdReusePolicy(WorkflowIdReusePolicy.AllowDuplicate) + .setSignalName("signalName") + .setSignalInput("signalInput".getBytes(StandardCharsets.UTF_8)) + .setControl("control".getBytes(StandardCharsets.UTF_8)) + .setRetryPolicy(RETRY_POLICY) + .setCronSchedule("cronSchedule") + .setMemo(MEMO) + .setSearchAttributes(SEARCH_ATTRIBUTES) + .setHeader(HEADER) + .setDelayStartSeconds(3) + .setJitterStartSeconds(0); public static final StartWorkflowExecutionAsyncRequest START_WORKFLOW_EXECUTION_ASYNC_REQUEST = new StartWorkflowExecutionAsyncRequest().setRequest(START_WORKFLOW_EXECUTION); @@ -994,7 +1001,7 @@ public final class ThriftObjects { .setActiveClusterName("activeCluster") .setData(DATA) .setSecurityToken("securityToken") - .setIsGlobalDomain(true) + .setGlobalDomain(true) .setHistoryArchivalStatus(ArchivalStatus.ENABLED) .setHistoryArchivalURI("historyArchivalUri") .setVisibilityArchivalStatus(ArchivalStatus.DISABLED) @@ -1146,7 +1153,7 @@ public final class ThriftObjects { .setConfiguration(DOMAIN_CONFIGURATION) .setReplicationConfiguration(DOMAIN_REPLICATION_CONFIGURATION) .setFailoverVersion(1) - .setIsGlobalDomain(true); + .setGlobalDomain(true); public static final ListDomainsResponse LIST_DOMAINS_RESPONSE = new ListDomainsResponse() .setDomains(ImmutableList.of(DESCRIBE_DOMAIN_RESPONSE)) @@ -1160,12 +1167,12 @@ public final class ThriftObjects { .setConfiguration(DOMAIN_CONFIGURATION) .setReplicationConfiguration(DOMAIN_REPLICATION_CONFIGURATION) .setFailoverVersion(1) - .setIsGlobalDomain(true); + .setGlobalDomain(true); - private ThriftObjects() {} + private ClientObjects() {} - public static ByteBuffer utf8(String value) { - return ByteBuffer.wrap(utf8Bytes(value)); + public static byte[] utf8(String value) { + return utf8Bytes(value); } public static byte[] utf8Bytes(String value) { diff --git a/src/test/java/com/uber/cadence/internal/compatibility/EnumMapperTest.java b/src/test/java/com/uber/cadence/internal/compatibility/EnumMapperTest.java deleted file mode 100644 index 18040bee2..000000000 --- a/src/test/java/com/uber/cadence/internal/compatibility/EnumMapperTest.java +++ /dev/null @@ -1,379 +0,0 @@ -/** - * 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.compatibility; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThrows; -import static org.junit.Assert.assertTrue; - -import com.google.common.base.CaseFormat; -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.uber.cadence.*; -import com.uber.cadence.api.v1.EventFilterType; -import com.uber.cadence.internal.compatibility.proto.EnumMapper; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.function.Function; -import org.apache.thrift.TEnum; -import org.junit.Test; - -public class EnumMapperTest { - - @Test - public void testTaskListKind() { - assertAllValuesRoundTrip( - TaskListKind.class, - com.uber.cadence.api.v1.TaskListKind.TASK_LIST_KIND_INVALID, - EnumMapper::taskListKind, - com.uber.cadence.internal.compatibility.thrift.EnumMapper::taskListKind); - } - - @Test - public void testQueryRejectionCondition() { - assertAllValuesRoundTrip( - QueryRejectCondition.class, - com.uber.cadence.api.v1.QueryRejectCondition.QUERY_REJECT_CONDITION_INVALID, - EnumMapper::queryRejectCondition, - com.uber.cadence.internal.compatibility.thrift.EnumMapper::queryRejectCondition); - } - - @Test - public void testContinueAsNewInitiator() { - assertAllValuesRoundTrip( - ContinueAsNewInitiator.class, - com.uber.cadence.api.v1.ContinueAsNewInitiator.CONTINUE_AS_NEW_INITIATOR_INVALID, - EnumMapper::continueAsNewInitiator, - com.uber.cadence.internal.compatibility.thrift.EnumMapper::continueAsNewInitiator); - } - - @Test - public void testWorkflowIdReusePolicy() { - assertAllValuesRoundTrip( - WorkflowIdReusePolicy.class, - com.uber.cadence.api.v1.WorkflowIdReusePolicy.WORKFLOW_ID_REUSE_POLICY_INVALID, - EnumMapper::workflowIdReusePolicy, - com.uber.cadence.internal.compatibility.thrift.EnumMapper::workflowIdReusePolicy); - } - - @Test - public void testArchivalStatus() { - assertAllValuesRoundTrip( - ArchivalStatus.class, - com.uber.cadence.api.v1.ArchivalStatus.ARCHIVAL_STATUS_INVALID, - EnumMapper::archivalStatus, - com.uber.cadence.internal.compatibility.thrift.EnumMapper::archivalStatus); - } - - @Test - public void testParentClosePolicy() { - assertAllValuesRoundTrip( - ParentClosePolicy.class, - com.uber.cadence.api.v1.ParentClosePolicy.PARENT_CLOSE_POLICY_INVALID, - EnumMapper::parentClosePolicy, - com.uber.cadence.internal.compatibility.thrift.EnumMapper::parentClosePolicy); - } - - @Test - public void testDecisionTaskFailedCause() { - assertAllValuesRoundTrip( - DecisionTaskFailedCause.class, - com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_INVALID, - EnumMapper::decisionTaskFailedCause, - com.uber.cadence.internal.compatibility.thrift.EnumMapper::decisionTaskFailedCause); - } - - @Test - public void testWorkflowExecutionCloseStatus() { - assertAllValuesRoundTrip( - WorkflowExecutionCloseStatus.class, - com.uber.cadence.api.v1.WorkflowExecutionCloseStatus - .WORKFLOW_EXECUTION_CLOSE_STATUS_INVALID, - EnumMapper::workflowExecutionCloseStatus, - com.uber.cadence.internal.compatibility.thrift.EnumMapper::workflowExecutionCloseStatus); - } - - @Test - public void testTaskListType() { - assertMapping( - thriftToProtoIdentical( - TaskListType.class, - com.uber.cadence.api.v1.TaskListType.class, - com.uber.cadence.api.v1.TaskListType.TASK_LIST_TYPE_INVALID), - EnumMapper::taskListType); - } - - @Test - public void testEventFilterType() { - assertMapping( - thriftToProtoIdentical( - HistoryEventFilterType.class, - EventFilterType.class, - EventFilterType.EVENT_FILTER_TYPE_INVALID), - EnumMapper::eventFilterType); - } - - @Test - public void testQueryConsistencyLevel() { - assertMapping( - thriftToProtoIdentical( - QueryConsistencyLevel.class, - com.uber.cadence.api.v1.QueryConsistencyLevel.class, - com.uber.cadence.api.v1.QueryConsistencyLevel.QUERY_CONSISTENCY_LEVEL_INVALID), - EnumMapper::queryConsistencyLevel); - } - - @Test - public void testQueryResultType() { - assertMapping( - thriftToProtoIdentical( - QueryResultType.class, - com.uber.cadence.api.v1.QueryResultType.class, - com.uber.cadence.api.v1.QueryResultType.QUERY_RESULT_TYPE_INVALID), - EnumMapper::queryResultType); - } - - @Test - public void testQueryTaskCompletedType() { - Map mapping = - ImmutableMap.of( - QueryTaskCompletedType.COMPLETED, - com.uber.cadence.api.v1.QueryResultType.QUERY_RESULT_TYPE_ANSWERED, - QueryTaskCompletedType.FAILED, - com.uber.cadence.api.v1.QueryResultType.QUERY_RESULT_TYPE_FAILED); - assertAllValuesPresent(QueryTaskCompletedType.class, mapping); - assertMapping(mapping, EnumMapper::queryTaskCompletedType); - // ImmutableMap doesn't accept null - assertEquals( - com.uber.cadence.api.v1.QueryResultType.QUERY_RESULT_TYPE_INVALID, - EnumMapper.queryTaskCompletedType(null)); - } - - @Test - public void testDomainStatus() { - assertMapping( - protoToThriftIdentical( - com.uber.cadence.api.v1.DomainStatus.class, - DomainStatus.class, - com.uber.cadence.api.v1.DomainStatus.DOMAIN_STATUS_INVALID), - com.uber.cadence.internal.compatibility.thrift.EnumMapper::domainStatus); - } - - @Test - public void testPendingActivityState() { - assertMapping( - protoToThriftIdentical( - com.uber.cadence.api.v1.PendingActivityState.class, - PendingActivityState.class, - com.uber.cadence.api.v1.PendingActivityState.PENDING_ACTIVITY_STATE_INVALID), - com.uber.cadence.internal.compatibility.thrift.EnumMapper::pendingActivityState); - } - - @Test - public void testPendingDecisionState() { - assertMapping( - protoToThriftIdentical( - com.uber.cadence.api.v1.PendingDecisionState.class, - PendingDecisionState.class, - com.uber.cadence.api.v1.PendingDecisionState.PENDING_DECISION_STATE_INVALID), - com.uber.cadence.internal.compatibility.thrift.EnumMapper::pendingDecisionState); - } - - @Test - public void testIndexedValueType() { - Map mapping = - protoToThriftIdentical( - com.uber.cadence.api.v1.IndexedValueType.class, - IndexedValueType.class, - com.uber.cadence.api.v1.IndexedValueType.INDEXED_VALUE_TYPE_INVALID); - // This mapper uniquely throws when encountering this value - mapping.remove(com.uber.cadence.api.v1.IndexedValueType.INDEXED_VALUE_TYPE_INVALID); - assertMapping( - mapping, com.uber.cadence.internal.compatibility.thrift.EnumMapper::indexedValueType); - assertThrows( - IllegalArgumentException.class, - () -> - com.uber.cadence.internal.compatibility.thrift.EnumMapper.indexedValueType( - com.uber.cadence.api.v1.IndexedValueType.INDEXED_VALUE_TYPE_INVALID)); - } - - @Test - public void testEncodingType() { - Map mapping = - ImmutableMap.of( - com.uber.cadence.api.v1.EncodingType.ENCODING_TYPE_THRIFTRW, - EncodingType.ThriftRW, - com.uber.cadence.api.v1.EncodingType.ENCODING_TYPE_JSON, - EncodingType.JSON); - - assertAllValuesPresent( - com.uber.cadence.api.v1.EncodingType.class, - mapping, - com.uber.cadence.api.v1.EncodingType.ENCODING_TYPE_INVALID, - com.uber.cadence.api.v1.EncodingType.ENCODING_TYPE_PROTO3, - com.uber.cadence.api.v1.EncodingType.UNRECOGNIZED); - - assertMapping(mapping, com.uber.cadence.internal.compatibility.thrift.EnumMapper::encodingType); - // ImmutableMap doesn't accept null - assertNull( - com.uber.cadence.internal.compatibility.thrift.EnumMapper.encodingType( - com.uber.cadence.api.v1.EncodingType.ENCODING_TYPE_INVALID)); - // No thrift equivalent - assertThrows( - UnsupportedOperationException.class, - () -> - com.uber.cadence.internal.compatibility.thrift.EnumMapper.encodingType( - com.uber.cadence.api.v1.EncodingType.ENCODING_TYPE_PROTO3)); - } - - @Test - public void testTimeoutType() { - assertMapping( - protoToThriftIdentical( - com.uber.cadence.api.v1.TimeoutType.class, - TimeoutType.class, - com.uber.cadence.api.v1.TimeoutType.TIMEOUT_TYPE_INVALID), - com.uber.cadence.internal.compatibility.thrift.EnumMapper::timeoutType); - } - - @Test - public void testDecisionTaskTimedOutCause() { - assertMapping( - protoToThriftIdentical( - com.uber.cadence.api.v1.DecisionTaskTimedOutCause.class, - DecisionTaskTimedOutCause.class, - com.uber.cadence.api.v1.DecisionTaskTimedOutCause - .DECISION_TASK_TIMED_OUT_CAUSE_INVALID), - com.uber.cadence.internal.compatibility.thrift.EnumMapper::decisionTaskTimedOutCause); - } - - @Test - public void testCancelExternalWorkflowExecutionFailedCause() { - assertMapping( - protoToThriftIdentical( - com.uber.cadence.api.v1.CancelExternalWorkflowExecutionFailedCause.class, - CancelExternalWorkflowExecutionFailedCause.class, - com.uber.cadence.api.v1.CancelExternalWorkflowExecutionFailedCause - .CANCEL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_INVALID), - com.uber.cadence.internal.compatibility.thrift.EnumMapper - ::cancelExternalWorkflowExecutionFailedCause); - } - - @Test - public void testSignalExternalWorkflowExecutionFailedCause() { - - assertMapping( - protoToThriftIdentical( - com.uber.cadence.api.v1.SignalExternalWorkflowExecutionFailedCause.class, - SignalExternalWorkflowExecutionFailedCause.class, - com.uber.cadence.api.v1.SignalExternalWorkflowExecutionFailedCause - .SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_INVALID), - com.uber.cadence.internal.compatibility.thrift.EnumMapper - ::signalExternalWorkflowExecutionFailedCause); - } - - @Test - public void testchildWorkflowExecutionFailedCause() { - assertMapping( - protoToThriftIdentical( - com.uber.cadence.api.v1.ChildWorkflowExecutionFailedCause.class, - ChildWorkflowExecutionFailedCause.class, - com.uber.cadence.api.v1.ChildWorkflowExecutionFailedCause - .CHILD_WORKFLOW_EXECUTION_FAILED_CAUSE_INVALID), - com.uber.cadence.internal.compatibility.thrift.EnumMapper - ::childWorkflowExecutionFailedCause); - } - - private static , T extends Enum> void assertAllValuesRoundTrip( - Class fromType, T invalidType, Function to, Function inverse) { - F[] values = fromType.getEnumConstants(); - for (F fromValue : values) { - F result = inverse.apply(to.apply(fromValue)); - assertEquals("Round tripping " + fromValue.toString(), fromValue, result); - } - assertEquals("null -> invalid", invalidType, to.apply(null)); - assertNull("invalid -> null", inverse.apply(invalidType)); - } - - private static > void assertAllValuesPresent( - Class type, Map mapping, E... except) { - Set exclusions = ImmutableSet.copyOf(except); - for (E value : type.getEnumConstants()) { - if (!exclusions.contains(value)) { - assertTrue("Missing mapping for " + value, mapping.containsKey(value)); - } - } - } - - private static , T extends Enum> void assertMapping( - Map mapping, Function mapper) { - for (Map.Entry entry : mapping.entrySet()) { - F from = entry.getKey(); - T actual = mapper.apply(from); - T expected = entry.getValue(); - assertEquals("Mapping " + from, expected, actual); - } - } - - private static , T extends Enum & TEnum> Map protoToThriftIdentical( - Class from, Class to, F invalid) { - // There are more clever and succinct ways to do this but most Map types don't accept null as a - // key - Map result = new HashMap<>(); - Map inverse = thriftToProtoIdentical(to, from, invalid); - for (Map.Entry entry : inverse.entrySet()) { - result.put(entry.getValue(), entry.getKey()); - } - return result; - } - - private static & TEnum, T extends Enum> Map thriftToProtoIdentical( - Class from, Class to, T invalid) { - Map toByName = - Arrays.stream(to.getEnumConstants()) - .collect(ImmutableMap.toImmutableMap(Enum::name, x -> x)); - Map cases = new HashMap<>(); - for (F fromValue : from.getEnumConstants()) { - String protoName = getProtoNameFor(to, fromValue); - T expected = toByName.get(protoName); - Preconditions.checkState( - expected != null, - "Failed to find an equivalent for %s in %s with name %s", - fromValue, - to, - protoName); - cases.put(fromValue, expected); - } - cases.put(null, invalid); - return cases; - } - - private static String getProtoNameFor(Class protoType, Enum value) { - // TaskListType.Decision -> TASK_LIST_TYPE_DECISION - // EventFilterType.ALL_EVENT -> EVENT_FILTER_TYPE_ALL_EVENT - String typePart = - CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, protoType.getSimpleName()); - String valuePart = value.name(); - // Some Thrift enums use UPPER_CAMEL, some use UPPER_UNDERSCORE - if (!value.name().toUpperCase().equals(value.name())) { - valuePart = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, valuePart); - } - return typePart + "_" + valuePart; - } -} diff --git a/src/test/java/com/uber/cadence/internal/compatibility/MapperTestUtil.java b/src/test/java/com/uber/cadence/internal/compatibility/MapperTestUtil.java index 96e3df2ad..242bea453 100644 --- a/src/test/java/com/uber/cadence/internal/compatibility/MapperTestUtil.java +++ b/src/test/java/com/uber/cadence/internal/compatibility/MapperTestUtil.java @@ -18,9 +18,9 @@ package com.uber.cadence.internal.compatibility; import com.google.common.collect.ImmutableSet; -import java.util.Arrays; -import java.util.Collections; -import java.util.Set; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.stream.Collectors; import org.apache.thrift.TBase; import org.apache.thrift.TFieldIdEnum; @@ -46,6 +46,29 @@ void assertNoMissingFields(M message, Class fields) { getUnsetFields(message, fields)); } + public static void assertNoMissingFields(Object message) { + Set nullFields = getMissingFields(message.toString()); + + Assert.assertEquals("All fields expected to be set in the text", new HashSet<>(), nullFields); + } + + public static void assertMissingFields(Object message, Set values) { + Set nullFields = getMissingFields(message.toString()); + Assert.assertEquals("Expected missing fields but get different", values, nullFields); + } + + private static Set getMissingFields(String text) { + Set nullFields = new HashSet<>(); + // Regex to find fieldName=null + Pattern pattern = Pattern.compile("(\\w+)=null"); + Matcher matcher = pattern.matcher(text); + + while (matcher.find()) { + nullFields.add(matcher.group(1)); // group(1) captures the field name + } + return nullFields; + } + public static & TFieldIdEnum, M extends TBase> void assertMissingFields( M message, String... values) { assertMissingFields(message, findFieldsEnum(message), ImmutableSet.copyOf(values)); diff --git a/src/test/java/com/uber/cadence/internal/compatibility/Thrift2ProtoAdapterTest.java b/src/test/java/com/uber/cadence/internal/compatibility/Thrift2ProtoAdapterTest.java deleted file mode 100644 index a8e17d9ec..000000000 --- a/src/test/java/com/uber/cadence/internal/compatibility/Thrift2ProtoAdapterTest.java +++ /dev/null @@ -1,1082 +0,0 @@ -/* - * 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.compatibility; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThrows; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import ch.qos.logback.classic.Level; -import ch.qos.logback.classic.Logger; -import com.uber.cadence.AccessDeniedError; -import com.uber.cadence.RefreshWorkflowTasksRequest; -import com.uber.cadence.SignalWithStartWorkflowExecutionAsyncRequest; -import com.uber.cadence.SignalWithStartWorkflowExecutionAsyncResponse; -import com.uber.cadence.SignalWithStartWorkflowExecutionRequest; -import com.uber.cadence.StartWorkflowExecutionAsyncRequest; -import com.uber.cadence.StartWorkflowExecutionAsyncResponse; -import com.uber.cadence.StartWorkflowExecutionRequest; -import com.uber.cadence.StartWorkflowExecutionResponse; -import com.uber.cadence.WorkflowService; -import com.uber.cadence.api.v1.DomainAPIGrpc; -import com.uber.cadence.api.v1.Header; -import com.uber.cadence.api.v1.HealthResponse; -import com.uber.cadence.api.v1.MetaAPIGrpc; -import com.uber.cadence.api.v1.VisibilityAPIGrpc; -import com.uber.cadence.api.v1.WorkerAPIGrpc; -import com.uber.cadence.api.v1.WorkflowAPIGrpc; -import com.uber.cadence.internal.compatibility.proto.RequestMapper; -import com.uber.cadence.internal.compatibility.proto.serviceclient.IGrpcServiceStubs; -import com.uber.cadence.internal.compatibility.thrift.ResponseMapper; -import com.uber.cadence.serviceclient.ClientOptions; -import com.uber.cadence.serviceclient.IWorkflowService; -import io.grpc.ManagedChannel; -import io.grpc.Metadata; -import io.grpc.MethodDescriptor; -import io.grpc.Server; -import io.grpc.ServerCall; -import io.grpc.ServerCallHandler; -import io.grpc.ServerInterceptor; -import io.grpc.ServerInterceptors; -import io.grpc.ServerServiceDefinition; -import io.grpc.ServiceDescriptor; -import io.grpc.Status; -import io.grpc.StatusRuntimeException; -import io.grpc.inprocess.InProcessChannelBuilder; -import io.grpc.inprocess.InProcessServerBuilder; -import io.grpc.stub.ServerCalls; -import io.grpc.stub.StreamObserver; -import io.grpc.testing.GrpcCleanupRule; -import io.opentracing.mock.MockSpan; -import io.opentracing.mock.MockTracer; -import java.io.IOException; -import java.util.Map; -import java.util.Queue; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CompletionException; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentLinkedQueue; -import org.apache.commons.io.Charsets; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.slf4j.LoggerFactory; - -public class Thrift2ProtoAdapterTest { - private static final Metadata.Key AUTHORIZATION_HEADER_KEY = - Metadata.Key.of("cadence-authorization", Metadata.ASCII_STRING_MARSHALLER); - private static final StatusRuntimeException GRPC_ACCESS_DENIED = - new StatusRuntimeException(Status.PERMISSION_DENIED); - - @Rule public GrpcCleanupRule grpcCleanup = new GrpcCleanupRule(); - private final MockTracer tracer = new MockTracer(); - private final FakeGrpcServer stubs = new FakeGrpcServer(); - private IWorkflowService client; - private IWorkflowService tracingClient; - - @Before - public void setup() { - grpcCleanup.register( - stubs.createServer( - DomainAPIGrpc.getServiceDescriptor(), - VisibilityAPIGrpc.getServiceDescriptor(), - WorkflowAPIGrpc.getServiceDescriptor(), - WorkerAPIGrpc.getServiceDescriptor(), - MetaAPIGrpc.getServiceDescriptor())); - ManagedChannel clientChannel = grpcCleanup.register(stubs.createClient()); - Logger logger = - (Logger) - LoggerFactory.getLogger( - "com.uber.cadence.internal.compatibility.proto.serviceclient.GrpcServiceStubs"); - logger.setLevel(Level.TRACE); - client = - new Thrift2ProtoAdapter( - IGrpcServiceStubs.newInstance( - ClientOptions.newBuilder() - .setAuthorizationProvider("foo"::getBytes) - .setGRPCChannel(clientChannel) - .build())); - tracingClient = - new Thrift2ProtoAdapter( - IGrpcServiceStubs.newInstance( - ClientOptions.newBuilder() - .setAuthorizationProvider("foo"::getBytes) - .setTracer(tracer) - .setGRPCChannel(clientChannel) - .build())); - } - - @Test - public void testStartWorkflowExecution() throws Exception { - CompletableFuture protoRequest = - stub( - WorkflowAPIGrpc.getStartWorkflowExecutionMethod(), - ProtoObjects.START_WORKFLOW_EXECUTION_RESPONSE); - StartWorkflowExecutionRequest request = ThriftObjects.START_WORKFLOW_EXECUTION.deepCopy(); - // Test that a request ID will be set. - request.unsetRequestId(); - - StartWorkflowExecutionResponse response = client.StartWorkflowExecution(request); - - assertEquals( - ResponseMapper.startWorkflowExecutionResponse( - ProtoObjects.START_WORKFLOW_EXECUTION_RESPONSE), - response); - - assertNotNull(request.getRequestId()); - assertEquals(RequestMapper.startWorkflowExecutionRequest(request), protoRequest.join()); - } - - @Test - public void testStartWorkflowExecution_tracing() throws Exception { - CompletableFuture protoRequest = - stub( - WorkflowAPIGrpc.getStartWorkflowExecutionMethod(), - ProtoObjects.START_WORKFLOW_EXECUTION_RESPONSE); - StartWorkflowExecutionRequest request = ThriftObjects.START_WORKFLOW_EXECUTION.deepCopy(); - - tracingClient.StartWorkflowExecution(request); - - assertTracingHeaders(protoRequest.join().getHeader()); - } - - @Test - public void testStartWorkflowExecution_error() { - stubWithAccessDenied(WorkflowAPIGrpc.getStartWorkflowExecutionMethod()); - - assertThrows( - AccessDeniedError.class, - () -> client.StartWorkflowExecution(ThriftObjects.START_WORKFLOW_EXECUTION)); - } - - @Test - public void testStartWorkflowExecutionAsync() throws Exception { - CompletableFuture protoRequest = - stub( - WorkflowAPIGrpc.getStartWorkflowExecutionAsyncMethod(), - ProtoObjects.START_WORKFLOW_EXECUTION_ASYNC_RESPONSE); - StartWorkflowExecutionAsyncRequest request = - ThriftObjects.START_WORKFLOW_EXECUTION_ASYNC_REQUEST.deepCopy(); - // Test that a request ID will be set. - request.getRequest().unsetRequestId(); - - StartWorkflowExecutionAsyncResponse response = client.StartWorkflowExecutionAsync(request); - - assertEquals( - ResponseMapper.startWorkflowExecutionAsyncResponse( - ProtoObjects.START_WORKFLOW_EXECUTION_ASYNC_RESPONSE), - response); - - assertNotNull(request.getRequest().getRequestId()); - assertEquals(RequestMapper.startWorkflowExecutionAsyncRequest(request), protoRequest.join()); - } - - @Test - public void testStartWorkflowExecutionAsync_tracing() throws Exception { - CompletableFuture protoRequest = - stub( - WorkflowAPIGrpc.getStartWorkflowExecutionAsyncMethod(), - ProtoObjects.START_WORKFLOW_EXECUTION_ASYNC_RESPONSE); - StartWorkflowExecutionAsyncRequest request = - ThriftObjects.START_WORKFLOW_EXECUTION_ASYNC_REQUEST.deepCopy(); - - tracingClient.StartWorkflowExecutionAsync(request); - - assertTracingHeaders(protoRequest.join().getRequest().getHeader()); - } - - @Test - public void testStartWorkflowExecutionAsync_error() { - stubWithAccessDenied(WorkflowAPIGrpc.getStartWorkflowExecutionAsyncMethod()); - - assertThrows( - AccessDeniedError.class, - () -> - client.StartWorkflowExecutionAsync( - ThriftObjects.START_WORKFLOW_EXECUTION_ASYNC_REQUEST)); - } - - @Test - public void testSignalWithStartWorkflowExecution() throws Exception { - CompletableFuture - protoRequest = - stub( - WorkflowAPIGrpc.getSignalWithStartWorkflowExecutionMethod(), - ProtoObjects.SIGNAL_WITH_START_WORKFLOW_EXECUTION_RESPONSE); - SignalWithStartWorkflowExecutionRequest request = - ThriftObjects.SIGNAL_WITH_START_WORKFLOW_EXECUTION.deepCopy(); - // Test that a request ID will be set. - request.unsetRequestId(); - - StartWorkflowExecutionResponse response = client.SignalWithStartWorkflowExecution(request); - - assertEquals( - ResponseMapper.signalWithStartWorkflowExecutionResponse( - ProtoObjects.SIGNAL_WITH_START_WORKFLOW_EXECUTION_RESPONSE), - response); - - assertNotNull(request.getRequestId()); - assertEquals( - RequestMapper.signalWithStartWorkflowExecutionRequest(request), protoRequest.join()); - } - - @Test - public void testSignalWithStartWorkflowExecution_tracing() throws Exception { - CompletableFuture - protoRequest = - stub( - WorkflowAPIGrpc.getSignalWithStartWorkflowExecutionMethod(), - ProtoObjects.SIGNAL_WITH_START_WORKFLOW_EXECUTION_RESPONSE); - SignalWithStartWorkflowExecutionRequest request = - ThriftObjects.SIGNAL_WITH_START_WORKFLOW_EXECUTION.deepCopy(); - - tracingClient.SignalWithStartWorkflowExecution(request); - - assertTracingHeaders(protoRequest.join().getStartRequest().getHeader()); - } - - @Test - public void testSignalWithStartWorkflowExecution_error() { - stubWithAccessDenied(WorkflowAPIGrpc.getSignalWithStartWorkflowExecutionMethod()); - - assertThrows( - AccessDeniedError.class, - () -> - client.SignalWithStartWorkflowExecution( - ThriftObjects.SIGNAL_WITH_START_WORKFLOW_EXECUTION)); - } - - @Test - public void testSignalWithStartWorkflowAsyncExecution() throws Exception { - CompletableFuture - protoRequest = - stub( - WorkflowAPIGrpc.getSignalWithStartWorkflowExecutionAsyncMethod(), - ProtoObjects.SIGNAL_WITH_START_WORKFLOW_EXECUTION_ASYNC_RESPONSE); - SignalWithStartWorkflowExecutionAsyncRequest request = - ThriftObjects.SIGNAL_WITH_START_WORKFLOW_EXECUTION_ASYNC_REQUEST.deepCopy(); - // Test that a request ID will be set. - request.getRequest().unsetRequestId(); - - SignalWithStartWorkflowExecutionAsyncResponse response = - client.SignalWithStartWorkflowExecutionAsync(request); - - assertEquals( - ResponseMapper.signalWithStartWorkflowExecutionAsyncResponse( - ProtoObjects.SIGNAL_WITH_START_WORKFLOW_EXECUTION_ASYNC_RESPONSE), - response); - - assertNotNull(request.getRequest().getRequestId()); - assertEquals( - RequestMapper.signalWithStartWorkflowExecutionAsyncRequest(request), protoRequest.join()); - } - - @Test - public void testSignalWithStartWorkflowAsyncExecution_tracing() throws Exception { - CompletableFuture - protoRequest = - stub( - WorkflowAPIGrpc.getSignalWithStartWorkflowExecutionAsyncMethod(), - ProtoObjects.SIGNAL_WITH_START_WORKFLOW_EXECUTION_ASYNC_RESPONSE); - SignalWithStartWorkflowExecutionAsyncRequest request = - ThriftObjects.SIGNAL_WITH_START_WORKFLOW_EXECUTION_ASYNC_REQUEST.deepCopy(); - - tracingClient.SignalWithStartWorkflowExecutionAsync(request); - - assertTracingHeaders(protoRequest.join().getRequest().getStartRequest().getHeader()); - } - - @Test - public void testSignalWithStartWorkflowAsyncExecution_error() { - stubWithAccessDenied(WorkflowAPIGrpc.getSignalWithStartWorkflowExecutionAsyncMethod()); - - assertThrows( - AccessDeniedError.class, - () -> - client.SignalWithStartWorkflowExecutionAsync( - ThriftObjects.SIGNAL_WITH_START_WORKFLOW_EXECUTION_ASYNC_REQUEST)); - } - - @Test - public void testCountWorkflowExecutions() throws Exception { - testHelper( - VisibilityAPIGrpc.getCountWorkflowExecutionsMethod(), - ProtoObjects.COUNT_WORKFLOW_EXECUTIONS_REQUEST, - ProtoObjects.COUNT_WORKFLOW_EXECUTIONS_RESPONSE, - IWorkflowService::CountWorkflowExecutions, - ThriftObjects.COUNT_WORKFLOW_EXECUTIONS_REQUEST, - ThriftObjects.COUNT_WORKFLOW_EXECUTIONS_RESPONSE); - } - - @Test - public void testListWorkflowExecutions() throws Exception { - testHelper( - VisibilityAPIGrpc.getListWorkflowExecutionsMethod(), - ProtoObjects.LIST_WORKFLOW_EXECUTIONS_REQUEST, - ProtoObjects.LIST_WORKFLOW_EXECUTIONS_RESPONSE, - IWorkflowService::ListWorkflowExecutions, - ThriftObjects.LIST_WORKFLOW_EXECUTIONS_REQUEST, - ThriftObjects.LIST_WORKFLOW_EXECUTIONS_RESPONSE); - } - - @Test - public void testListOpenWorkflowExecutions() throws Exception { - testHelper( - VisibilityAPIGrpc.getListOpenWorkflowExecutionsMethod(), - ProtoObjects.LIST_OPEN_WORKFLOW_EXECUTIONS_REQUEST, - ProtoObjects.LIST_OPEN_WORKFLOW_EXECUTIONS_RESPONSE, - IWorkflowService::ListOpenWorkflowExecutions, - ThriftObjects.LIST_OPEN_WORKFLOW_EXECUTIONS_REQUEST, - ThriftObjects.LIST_OPEN_WORKFLOW_EXECUTIONS_RESPONSE); - } - - @Test - public void testListClosedWorkflowExecutions() throws Exception { - testHelper( - VisibilityAPIGrpc.getListClosedWorkflowExecutionsMethod(), - ProtoObjects.LIST_CLOSED_WORKFLOW_EXECUTIONS_REQUEST, - ProtoObjects.LIST_CLOSED_WORKFLOW_EXECUTIONS_RESPONSE, - IWorkflowService::ListClosedWorkflowExecutions, - ThriftObjects.LIST_CLOSED_WORKFLOW_EXECUTIONS_REQUEST, - ThriftObjects.LIST_CLOSED_WORKFLOW_EXECUTIONS_RESPONSE); - } - - @Test - public void testListArchivedWorkflowExecutions() throws Exception { - testHelper( - VisibilityAPIGrpc.getListArchivedWorkflowExecutionsMethod(), - ProtoObjects.LIST_ARCHIVED_WORKFLOW_EXECUTIONS_REQUEST, - ProtoObjects.LIST_ARCHIVED_WORKFLOW_EXECUTIONS_RESPONSE, - IWorkflowService::ListArchivedWorkflowExecutions, - ThriftObjects.LIST_ARCHIVED_WORKFLOW_EXECUTIONS_REQUEST, - ThriftObjects.LIST_ARCHIVED_WORKFLOW_EXECUTIONS_RESPONSE); - } - - @Test - public void testScanWorkflowExecutions() throws Exception { - testHelper( - VisibilityAPIGrpc.getScanWorkflowExecutionsMethod(), - ProtoObjects.SCAN_WORKFLOW_EXECUTIONS_REQUEST, - ProtoObjects.SCAN_WORKFLOW_EXECUTIONS_RESPONSE, - IWorkflowService::ScanWorkflowExecutions, - ThriftObjects.LIST_WORKFLOW_EXECUTIONS_REQUEST, - ThriftObjects.LIST_WORKFLOW_EXECUTIONS_RESPONSE); - } - - @Test - public void testGetSearchAttributes() throws Exception { - testHelper( - VisibilityAPIGrpc.getGetSearchAttributesMethod(), - ProtoObjects.GET_SEARCH_ATTRIBUTES_REQUEST, - ProtoObjects.GET_SEARCH_ATTRIBUTES_RESPONSE, - WorkflowService.Iface::GetSearchAttributes, - ThriftObjects.GET_SEARCH_ATTRIBUTES_RESPONSE); - } - - @Test - public void testRegisterDomain() throws Exception { - testHelper( - DomainAPIGrpc.getRegisterDomainMethod(), - ProtoObjects.REGISTER_DOMAIN_REQUEST, - ProtoObjects.REGISTER_DOMAIN_RESPONSE, - IWorkflowService::RegisterDomain, - ThriftObjects.REGISTER_DOMAIN_REQUEST); - } - - @Test - public void testDescribeDomain() throws Exception { - testHelper( - DomainAPIGrpc.getDescribeDomainMethod(), - ProtoObjects.DESCRIBE_DOMAIN_BY_ID_REQUEST, - ProtoObjects.DESCRIBE_DOMAIN_RESPONSE, - IWorkflowService::DescribeDomain, - ThriftObjects.DESCRIBE_DOMAIN_BY_ID_REQUEST, - ThriftObjects.DESCRIBE_DOMAIN_RESPONSE); - } - - @Test - public void testListDomains() throws Exception { - testHelper( - DomainAPIGrpc.getListDomainsMethod(), - ProtoObjects.LIST_DOMAINS_REQUEST, - ProtoObjects.LIST_DOMAINS_RESPONSE, - IWorkflowService::ListDomains, - ThriftObjects.LIST_DOMAINS_REQUEST, - ThriftObjects.LIST_DOMAINS_RESPONSE); - } - - @Test - public void testUpdateDomain() throws Exception { - testHelper( - DomainAPIGrpc.getUpdateDomainMethod(), - ProtoObjects.UPDATE_DOMAIN_REQUEST, - ProtoObjects.UPDATE_DOMAIN_RESPONSE, - IWorkflowService::UpdateDomain, - ThriftObjects.UPDATE_DOMAIN_REQUEST, - ThriftObjects.UPDATE_DOMAIN_RESPONSE); - } - - @Test - public void testDeprecateDomain() throws Exception { - testHelper( - DomainAPIGrpc.getDeprecateDomainMethod(), - ProtoObjects.DEPRECATE_DOMAIN_REQUEST, - ProtoObjects.DEPRECATE_DOMAIN_RESPONSE, - IWorkflowService::DeprecateDomain, - ThriftObjects.DEPRECATE_DOMAIN_REQUEST); - } - - @Test - public void testSignalWorkflowExecution() throws Exception { - testHelper( - WorkflowAPIGrpc.getSignalWorkflowExecutionMethod(), - ProtoObjects.SIGNAL_WORKFLOW_EXECUTION_REQUEST, - ProtoObjects.SIGNAL_WORKFLOW_EXECUTION_RESPONSE, - IWorkflowService::SignalWorkflowExecution, - ThriftObjects.SIGNAL_WORKFLOW_EXECUTION_REQUEST); - } - - @Test - public void testResetWorkflowExecution() throws Exception { - testHelper( - WorkflowAPIGrpc.getResetWorkflowExecutionMethod(), - ProtoObjects.RESET_WORKFLOW_EXECUTION_REQUEST, - ProtoObjects.RESET_WORKFLOW_EXECUTION_RESPONSE, - IWorkflowService::ResetWorkflowExecution, - ThriftObjects.RESET_WORKFLOW_EXECUTION_REQUEST, - ThriftObjects.RESET_WORKFLOW_EXECUTION_RESPONSE); - } - - @Test - public void testRequestCancelWorkflowExecution() throws Exception { - testHelper( - WorkflowAPIGrpc.getRequestCancelWorkflowExecutionMethod(), - ProtoObjects.REQUEST_CANCEL_WORKFLOW_EXECUTION_REQUEST, - ProtoObjects.REQUEST_CANCEL_WORKFLOW_EXECUTION_RESPONSE, - IWorkflowService::RequestCancelWorkflowExecution, - ThriftObjects.REQUEST_CANCEL_WORKFLOW_EXECUTION_REQUEST); - } - - @Test - public void testTerminateWorkflowExecution() throws Exception { - testHelper( - WorkflowAPIGrpc.getTerminateWorkflowExecutionMethod(), - ProtoObjects.TERMINATE_WORKFLOW_EXECUTION_REQUEST, - ProtoObjects.TERMINATE_WORKFLOW_EXECUTION_RESPONSE, - IWorkflowService::TerminateWorkflowExecution, - ThriftObjects.TERMINATE_WORKFLOW_EXECUTION_REQUEST); - } - - @Test - public void testDescribeWorkflowExecution() throws Exception { - testHelper( - WorkflowAPIGrpc.getDescribeWorkflowExecutionMethod(), - ProtoObjects.DESCRIBE_WORKFLOW_EXECUTION_REQUEST, - ProtoObjects.DESCRIBE_WORKFLOW_EXECUTION_RESPONSE, - IWorkflowService::DescribeWorkflowExecution, - ThriftObjects.DESCRIBE_WORKFLOW_EXECUTION_REQUEST, - ThriftObjects.DESCRIBE_WORKFLOW_EXECUTION_RESPONSE); - } - - @Test - public void testQueryWorkflow() throws Exception { - testHelper( - WorkflowAPIGrpc.getQueryWorkflowMethod(), - ProtoObjects.QUERY_WORKFLOW_REQUEST, - ProtoObjects.QUERY_WORKFLOW_RESPONSE, - IWorkflowService::QueryWorkflow, - ThriftObjects.QUERY_WORKFLOW_REQUEST, - ThriftObjects.QUERY_WORKFLOW_RESPONSE); - } - - @Test - public void testDescribeTaskList() throws Exception { - testHelper( - WorkflowAPIGrpc.getDescribeTaskListMethod(), - ProtoObjects.DESCRIBE_TASK_LIST_REQUEST, - ProtoObjects.DESCRIBE_TASK_LIST_RESPONSE, - IWorkflowService::DescribeTaskList, - ThriftObjects.DESCRIBE_TASK_LIST_REQUEST, - ThriftObjects.DESCRIBE_TASK_LIST_RESPONSE); - } - - @Test - public void testListTaskListPartitions() throws Exception { - testHelper( - WorkflowAPIGrpc.getListTaskListPartitionsMethod(), - ProtoObjects.LIST_TASK_LIST_PARTITIONS_REQUEST, - ProtoObjects.LIST_TASK_LIST_PARTITIONS_RESPONSE, - IWorkflowService::ListTaskListPartitions, - ThriftObjects.LIST_TASK_LIST_PARTITIONS_REQUEST, - ThriftObjects.LIST_TASK_LIST_PARTITIONS_RESPONSE); - } - - @Test - public void testGetClusterInfo() throws Exception { - testHelper( - WorkflowAPIGrpc.getGetClusterInfoMethod(), - ProtoObjects.GET_CLUSTER_INFO_REQUEST, - ProtoObjects.GET_CLUSTER_INFO_RESPONSE, - WorkflowService.Iface::GetClusterInfo, - ThriftObjects.CLUSTER_INFO); - } - - @Test - public void testGetWorkflowExecutionHistory() throws Exception { - testHelper( - WorkflowAPIGrpc.getGetWorkflowExecutionHistoryMethod(), - ProtoObjects.GET_WORKFLOW_EXECUTION_HISTORY_REQUEST, - ProtoObjects.GET_WORKFLOW_EXECUTION_HISTORY_RESPONSE, - IWorkflowService::GetWorkflowExecutionHistory, - ThriftObjects.GET_WORKFLOW_EXECUTION_HISTORY_REQUEST, - ThriftObjects.GET_WORKFLOW_EXECUTION_HISTORY_RESPONSE); - } - - @Test - public void testRefreshWorkflowTasks() throws Exception { - testHelper( - WorkflowAPIGrpc.getRefreshWorkflowTasksMethod(), - ProtoObjects.REFRESH_WORKFLOW_TASKS_REQUEST, - ProtoObjects.REFRESH_WORKFLOW_TASKS_RESPONSE, - IWorkflowService::RefreshWorkflowTasks, - new RefreshWorkflowTasksRequest()); - } - - @Test - public void testPollForDecisionTask() throws Exception { - testHelper( - WorkerAPIGrpc.getPollForDecisionTaskMethod(), - ProtoObjects.POLL_FOR_DECISION_TASK_REQUEST, - ProtoObjects.POLL_FOR_DECISION_TASK_RESPONSE, - IWorkflowService::PollForDecisionTask, - ThriftObjects.POLL_FOR_DECISION_TASK_REQUEST, - ThriftObjects.POLL_FOR_DECISION_TASK_RESPONSE); - } - - @Test - public void testRespondDecisionTaskCompleted() throws Exception { - testHelper( - WorkerAPIGrpc.getRespondDecisionTaskCompletedMethod(), - ProtoObjects.RESPOND_DECISION_TASK_COMPLETED_REQUEST, - ProtoObjects.RESPOND_DECISION_TASK_COMPLETED_RESPONSE, - IWorkflowService::RespondDecisionTaskCompleted, - ThriftObjects.RESPOND_DECISION_TASK_COMPLETED_REQUEST, - ThriftObjects.RESPOND_DECISION_TASK_COMPLETED_RESPONSE); - } - - @Test - public void testRespondDecisionTaskFailed() throws Exception { - testHelper( - WorkerAPIGrpc.getRespondDecisionTaskFailedMethod(), - ProtoObjects.RESPOND_DECISION_TASK_FAILED_REQUEST, - ProtoObjects.RESPOND_DECISION_TASK_FAILED_RESPONSE, - IWorkflowService::RespondDecisionTaskFailed, - ThriftObjects.RESPOND_DECISION_TASK_FAILED_REQUEST); - } - - @Test - public void testPollForActivityTask() throws Exception { - testHelper( - WorkerAPIGrpc.getPollForActivityTaskMethod(), - ProtoObjects.POLL_FOR_ACTIVITY_TASK_REQUEST, - ProtoObjects.POLL_FOR_ACTIVITY_TASK_RESPONSE, - IWorkflowService::PollForActivityTask, - ThriftObjects.POLL_FOR_ACTIVITY_TASK_REQUEST, - ThriftObjects.POLL_FOR_ACTIVITY_TASK_RESPONSE); - } - - @Test - public void testRespondActivityTaskCompleted() throws Exception { - testHelper( - WorkerAPIGrpc.getRespondActivityTaskCompletedMethod(), - ProtoObjects.RESPOND_ACTIVITY_TASK_COMPLETED_REQUEST, - ProtoObjects.RESPOND_ACTIVITY_TASK_COMPLETED_RESPONSE, - IWorkflowService::RespondActivityTaskCompleted, - ThriftObjects.RESPOND_ACTIVITY_TASK_COMPLETED_REQUEST); - } - - @Test - public void testRespondActivityTaskCompletedById() throws Exception { - testHelper( - WorkerAPIGrpc.getRespondActivityTaskCompletedByIDMethod(), - ProtoObjects.RESPOND_ACTIVITY_TASK_COMPLETED_BY_ID_REQUEST, - ProtoObjects.RESPOND_ACTIVITY_TASK_COMPLETED_BY_ID_RESPONSE, - IWorkflowService::RespondActivityTaskCompletedByID, - ThriftObjects.RESPOND_ACTIVITY_TASK_COMPLETED_BY_ID_REQUEST); - } - - @Test - public void testRespondActivityTaskFailed() throws Exception { - testHelper( - WorkerAPIGrpc.getRespondActivityTaskFailedMethod(), - ProtoObjects.RESPOND_ACTIVITY_TASK_FAILED_REQUEST, - ProtoObjects.RESPOND_ACTIVITY_TASK_FAILED_RESPONSE, - IWorkflowService::RespondActivityTaskFailed, - ThriftObjects.RESPOND_ACTIVITY_TASK_FAILED_REQUEST); - } - - @Test - public void testRespondActivityTaskFailedById() throws Exception { - testHelper( - WorkerAPIGrpc.getRespondActivityTaskFailedByIDMethod(), - ProtoObjects.RESPOND_ACTIVITY_TASK_FAILED_BY_ID_REQUEST, - ProtoObjects.RESPOND_ACTIVITY_TASK_FAILED_BY_ID_RESPONSE, - IWorkflowService::RespondActivityTaskFailedByID, - ThriftObjects.RESPOND_ACTIVITY_TASK_FAILED_BY_ID_REQUEST); - } - - @Test - public void testRespondActivityTaskCanceled() throws Exception { - testHelper( - WorkerAPIGrpc.getRespondActivityTaskCanceledMethod(), - ProtoObjects.RESPOND_ACTIVITY_TASK_CANCELED_REQUEST, - ProtoObjects.RESPOND_ACTIVITY_TASK_CANCELED_RESPONSE, - IWorkflowService::RespondActivityTaskCanceled, - ThriftObjects.RESPOND_ACTIVITY_TASK_CANCELED_REQUEST); - } - - @Test - public void testRespondActivityTaskCanceledById() throws Exception { - testHelper( - WorkerAPIGrpc.getRespondActivityTaskCanceledByIDMethod(), - ProtoObjects.RESPOND_ACTIVITY_TASK_CANCELED_BY_ID_REQUEST, - ProtoObjects.RESPOND_ACTIVITY_TASK_CANCELED_BY_ID_RESPONSE, - IWorkflowService::RespondActivityTaskCanceledByID, - ThriftObjects.RESPOND_ACTIVITY_TASK_CANCELED_BY_ID_REQUEST); - } - - @Test - public void testRecordActivityTaskHeartbeat() throws Exception { - testHelper( - WorkerAPIGrpc.getRecordActivityTaskHeartbeatMethod(), - ProtoObjects.RECORD_ACTIVITY_TASK_HEARTBEAT_REQUEST, - ProtoObjects.RECORD_ACTIVITY_TASK_HEARTBEAT_RESPONSE, - IWorkflowService::RecordActivityTaskHeartbeat, - ThriftObjects.RECORD_ACTIVITY_TASK_HEARTBEAT_REQUEST, - ThriftObjects.RECORD_ACTIVITY_TASK_HEARTBEAT_RESPONSE); - } - - @Test - public void testRecordActivityTaskHeartbeatById() throws Exception { - testHelper( - WorkerAPIGrpc.getRecordActivityTaskHeartbeatByIDMethod(), - ProtoObjects.RECORD_ACTIVITY_TASK_HEARTBEAT_BY_ID_REQUEST, - ProtoObjects.RECORD_ACTIVITY_TASK_HEARTBEAT_BY_ID_RESPONSE, - IWorkflowService::RecordActivityTaskHeartbeatByID, - ThriftObjects.RECORD_ACTIVITY_TASK_HEARTBEAT_BY_ID_REQUEST, - ThriftObjects.RECORD_ACTIVITY_TASK_HEARTBEAT_RESPONSE); - } - - @Test - public void testRespondQueryTaskCompleted() throws Exception { - testHelper( - WorkerAPIGrpc.getRespondQueryTaskCompletedMethod(), - ProtoObjects.RESPOND_QUERY_TASK_COMPLETED_REQUEST, - ProtoObjects.RESPOND_QUERY_TASK_COMPLETED_RESPONSE, - IWorkflowService::RespondQueryTaskCompleted, - ThriftObjects.RESPOND_QUERY_TASK_COMPLETED_REQUEST); - } - - @Test - public void testResetStickyTaskList() throws Exception { - testHelper( - WorkerAPIGrpc.getResetStickyTaskListMethod(), - ProtoObjects.RESET_STICKY_TASK_LIST_REQUEST, - ProtoObjects.RESET_STICKY_TASK_LIST_RESPONSE, - IWorkflowService::ResetStickyTaskList, - ThriftObjects.RESET_STICKY_TASK_LIST_REQUEST); - } - - @Test - public void testAsyncSignalWorkflowExecution() throws Exception { - testHelperAsync( - WorkflowAPIGrpc.getSignalWorkflowExecutionMethod(), - ProtoObjects.SIGNAL_WORKFLOW_EXECUTION_REQUEST, - ProtoObjects.SIGNAL_WORKFLOW_EXECUTION_RESPONSE, - IWorkflowService::SignalWorkflowExecution, - ThriftObjects.SIGNAL_WORKFLOW_EXECUTION_REQUEST, - null); - } - - @Test - public void testAsyncStartWorkflowExecutionAsync() throws Exception { - testHelperAsync( - WorkflowAPIGrpc.getStartWorkflowExecutionAsyncMethod(), - ProtoObjects.START_WORKFLOW_EXECUTION_ASYNC_REQUEST, - ProtoObjects.START_WORKFLOW_EXECUTION_ASYNC_RESPONSE, - IWorkflowService::StartWorkflowExecutionAsync, - ThriftObjects.START_WORKFLOW_EXECUTION_ASYNC_REQUEST, - ThriftObjects.START_WORKFLOW_EXECUTION_ASYNC_RESPONSE); - } - - @Test - public void testStartWorkflowExecutionWithTimeout() throws Exception { - testHelperAsync( - WorkflowAPIGrpc.getStartWorkflowExecutionMethod(), - ProtoObjects.START_WORKFLOW_EXECUTION, - ProtoObjects.START_WORKFLOW_EXECUTION_RESPONSE, - (service, request, handler) -> - service.StartWorkflowExecutionWithTimeout(request, handler, 1000L), - ThriftObjects.START_WORKFLOW_EXECUTION, - ThriftObjects.START_WORKFLOW_EXECUTION_RESPONSE); - } - - @Test - public void testStartWorkflowExecutionAsyncWithTimeout() throws Exception { - testHelperAsync( - WorkflowAPIGrpc.getStartWorkflowExecutionAsyncMethod(), - ProtoObjects.START_WORKFLOW_EXECUTION_ASYNC_REQUEST, - ProtoObjects.START_WORKFLOW_EXECUTION_ASYNC_RESPONSE, - (service, request, handler) -> - service.StartWorkflowExecutionAsyncWithTimeout(request, handler, 1000L), - ThriftObjects.START_WORKFLOW_EXECUTION_ASYNC_REQUEST, - ThriftObjects.START_WORKFLOW_EXECUTION_ASYNC_RESPONSE); - } - - @Test - public void testGetWorkflowExecutionHistoryWithTimeout() throws Exception { - testHelper( - WorkflowAPIGrpc.getGetWorkflowExecutionHistoryMethod(), - ProtoObjects.GET_WORKFLOW_EXECUTION_HISTORY_REQUEST, - ProtoObjects.GET_WORKFLOW_EXECUTION_HISTORY_RESPONSE, - (service, request) -> service.GetWorkflowExecutionHistoryWithTimeout(request, 1000L), - ThriftObjects.GET_WORKFLOW_EXECUTION_HISTORY_REQUEST, - ThriftObjects.GET_WORKFLOW_EXECUTION_HISTORY_RESPONSE); - } - - @Test - public void testAsyncGetWorkflowExecutionHistoryWithTimeout() throws Exception { - testHelperAsync( - WorkflowAPIGrpc.getGetWorkflowExecutionHistoryMethod(), - ProtoObjects.GET_WORKFLOW_EXECUTION_HISTORY_REQUEST, - ProtoObjects.GET_WORKFLOW_EXECUTION_HISTORY_RESPONSE, - (service, request, handler) -> - service.GetWorkflowExecutionHistoryWithTimeout(request, handler, 1000L), - ThriftObjects.GET_WORKFLOW_EXECUTION_HISTORY_REQUEST, - ThriftObjects.GET_WORKFLOW_EXECUTION_HISTORY_RESPONSE); - } - - @Test - public void testIsHealthy() throws Exception { - stubs.stubResponse( - MetaAPIGrpc.getHealthMethod(), HealthResponse.newBuilder().setOk(true).build()); - - assertTrue(client.isHealthy().join()); - } - - @Test - public void testAsyncUnsupported() { - assertUnsupported(WorkflowService.Iface::RestartWorkflowExecution); - assertUnsupported(WorkflowService.Iface::GetTaskListsByDomain); - assertAsyncUnsupported(WorkflowService.AsyncIface::RegisterDomain); - assertAsyncUnsupported(WorkflowService.AsyncIface::DescribeDomain); - assertAsyncUnsupported(WorkflowService.AsyncIface::ListDomains); - assertAsyncUnsupported(WorkflowService.AsyncIface::UpdateDomain); - assertAsyncUnsupported(WorkflowService.AsyncIface::DeprecateDomain); - assertAsyncUnsupported(WorkflowService.AsyncIface::RestartWorkflowExecution); - assertAsyncUnsupported(WorkflowService.AsyncIface::StartWorkflowExecution); - assertAsyncUnsupported(WorkflowService.AsyncIface::GetWorkflowExecutionHistory); - assertAsyncUnsupported(WorkflowService.AsyncIface::PollForDecisionTask); - assertAsyncUnsupported(WorkflowService.AsyncIface::RespondDecisionTaskCompleted); - assertAsyncUnsupported(WorkflowService.AsyncIface::RespondDecisionTaskFailed); - assertAsyncUnsupported(WorkflowService.AsyncIface::PollForActivityTask); - assertAsyncUnsupported(WorkflowService.AsyncIface::RecordActivityTaskHeartbeat); - assertAsyncUnsupported(WorkflowService.AsyncIface::RecordActivityTaskHeartbeatByID); - assertAsyncUnsupported(WorkflowService.AsyncIface::RespondActivityTaskCompleted); - assertAsyncUnsupported(WorkflowService.AsyncIface::RespondActivityTaskCompletedByID); - assertAsyncUnsupported(WorkflowService.AsyncIface::RespondActivityTaskFailed); - assertAsyncUnsupported(WorkflowService.AsyncIface::RespondActivityTaskFailedByID); - assertAsyncUnsupported(WorkflowService.AsyncIface::RespondActivityTaskCanceled); - assertAsyncUnsupported(WorkflowService.AsyncIface::RespondActivityTaskCanceledByID); - assertAsyncUnsupported(WorkflowService.AsyncIface::RequestCancelWorkflowExecution); - assertAsyncUnsupported(WorkflowService.AsyncIface::SignalWithStartWorkflowExecution); - assertAsyncUnsupported(WorkflowService.AsyncIface::SignalWithStartWorkflowExecutionAsync); - assertAsyncUnsupported(WorkflowService.AsyncIface::ResetWorkflowExecution); - assertAsyncUnsupported(WorkflowService.AsyncIface::TerminateWorkflowExecution); - assertAsyncUnsupported(WorkflowService.AsyncIface::ListOpenWorkflowExecutions); - assertAsyncUnsupported(WorkflowService.AsyncIface::ListClosedWorkflowExecutions); - assertAsyncUnsupported(WorkflowService.AsyncIface::ListWorkflowExecutions); - assertAsyncUnsupported(WorkflowService.AsyncIface::ListArchivedWorkflowExecutions); - assertAsyncUnsupported(WorkflowService.AsyncIface::ScanWorkflowExecutions); - assertAsyncUnsupported(WorkflowService.AsyncIface::CountWorkflowExecutions); - assertAsyncUnsupported(WorkflowService.AsyncIface::RespondQueryTaskCompleted); - assertAsyncUnsupported(WorkflowService.AsyncIface::ResetStickyTaskList); - assertAsyncUnsupported(WorkflowService.AsyncIface::QueryWorkflow); - assertAsyncUnsupported(WorkflowService.AsyncIface::DescribeWorkflowExecution); - assertAsyncUnsupported(WorkflowService.AsyncIface::DescribeTaskList); - assertAsyncUnsupported(WorkflowService.AsyncIface::GetTaskListsByDomain); - assertAsyncUnsupported(WorkflowService.AsyncIface::ListTaskListPartitions); - assertAsyncUnsupported(WorkflowService.AsyncIface::RefreshWorkflowTasks); - } - - private void assertUnsupported(ThriftFunc func) { - assertThrows(UnsupportedOperationException.class, () -> func.call(client, null)); - } - - private void assertAsyncUnsupported(ThriftAsyncFunc func) { - assertThrows(UnsupportedOperationException.class, () -> func.call(client, null, null)); - } - - private void testHelperAsync( - MethodDescriptor method, - PREQ protoRequest, - PRES protoResponse, - ThriftAsyncFunc clientMethod, - TREQ thriftRequest, - TRES thriftResponse) - throws Exception { - CompletableFuture protoRequestFuture = stub(method, protoResponse); - ThriftResponseCallback actualResponse = new ThriftResponseCallback<>(); - - clientMethod.call(client, thriftRequest, actualResponse); - - assertEquals( - "request for " + method.getFullMethodName(), protoRequest, protoRequestFuture.join()); - assertEquals( - "response from " + method.getFullMethodName(), thriftResponse, actualResponse.get()); - - stubWithAccessDenied(method); - ThriftResponseCallback errorResponse = new ThriftResponseCallback<>(); - clientMethod.call(client, thriftRequest, errorResponse); - try { - errorResponse.get(); - fail("expected exception"); - } catch (CompletionException ex) { - assertEquals(AccessDeniedError.class, ex.getCause().getClass()); - } - } - - private void testHelper( - MethodDescriptor method, - PREQ protoRequest, - PRES protoResponse, - ThriftFunc clientMethod, - TREQ thriftRequest, - TRES thriftResponse) - throws Exception { - CompletableFuture protoRequestFuture = stub(method, protoResponse); - - TRES actualResponse = clientMethod.call(client, thriftRequest); - - assertEquals( - "request for " + method.getFullMethodName(), protoRequest, protoRequestFuture.join()); - assertEquals("response from " + method.getFullMethodName(), thriftResponse, actualResponse); - - stubWithAccessDenied(method); - assertThrows(AccessDeniedError.class, () -> clientMethod.call(client, thriftRequest)); - } - - private void testHelper( - MethodDescriptor method, - PREQ protoRequest, - PRES protoResponse, - ThriftCallable clientMethod, - TREQ thriftRequest) - throws Exception { - CompletableFuture protoRequestFuture = stub(method, protoResponse); - - clientMethod.call(client, thriftRequest); - - assertEquals( - "request for " + method.getFullMethodName(), protoRequest, protoRequestFuture.join()); - - stubWithAccessDenied(method); - assertThrows(AccessDeniedError.class, () -> clientMethod.call(client, thriftRequest)); - } - - private void testHelper( - MethodDescriptor method, - PREQ protoRequest, - PRES protoResponse, - ThriftProvider clientMethod, - TRES thriftResponse) - throws Exception { - CompletableFuture protoRequestFuture = stub(method, protoResponse); - - TRES actualResponse = clientMethod.call(client); - - assertEquals( - "request for " + method.getFullMethodName(), protoRequest, protoRequestFuture.join()); - assertEquals("response from " + method.getFullMethodName(), thriftResponse, actualResponse); - - stubWithAccessDenied(method); - assertThrows(AccessDeniedError.class, () -> clientMethod.call(client)); - } - - private void assertTracingHeaders(Header header) { - assertEquals(1, tracer.finishedSpans().size()); - MockSpan mockSpan = tracer.finishedSpans().get(0); - assertEquals( - mockSpan.context().toTraceId(), - Charsets.UTF_8 - .decode(header.getFieldsMap().get("traceid").getData().asReadOnlyByteBuffer()) - .toString()); - assertEquals( - mockSpan.context().toSpanId(), - Charsets.UTF_8 - .decode(header.getFieldsMap().get("spanid").getData().asReadOnlyByteBuffer()) - .toString()); - } - - private CompletableFuture stub(MethodDescriptor method, RES result) { - return stubs.stubResponse(method, result); - } - - private CompletableFuture stubWithAccessDenied( - MethodDescriptor method) { - return stubs.stubError(method, GRPC_ACCESS_DENIED); - } - - private interface ThriftProvider { - RES call(IWorkflowService service) throws TException; - } - - private interface ThriftCallable { - void call(IWorkflowService service, REQ req) throws TException; - } - - private interface ThriftFunc { - RES call(IWorkflowService service, REQ req) throws TException; - } - - private interface ThriftAsyncFunc { - void call(IWorkflowService service, REQ req, AsyncMethodCallback callback) - throws TException; - } - - private interface StubbedBehavior { - void run(REQ request, StreamObserver response); - } - - private static class FakeGrpcServer { - private final Map>> stubs = new ConcurrentHashMap<>(); - - public CompletableFuture stubResponse( - MethodDescriptor method, RES response) { - CompletableFuture requestFuture = new CompletableFuture<>(); - stub( - method, - (req, stream) -> { - stream.onNext(response); - stream.onCompleted(); - requestFuture.complete(req); - }); - return requestFuture; - } - - public CompletableFuture stubError( - MethodDescriptor method, StatusRuntimeException exception) { - CompletableFuture requestFuture = new CompletableFuture<>(); - stub( - method, - (req, stream) -> { - stream.onError(exception); - requestFuture.complete(req); - }); - return requestFuture; - } - - public void stub( - MethodDescriptor method, StubbedBehavior handler) { - stubs - .computeIfAbsent(method.getFullMethodName(), (key) -> new ConcurrentLinkedQueue<>()) - .add(handler); - } - - public Server createServer(ServiceDescriptor... descriptors) { - try { - InProcessServerBuilder serverBuilder = - InProcessServerBuilder.forName("test").directExecutor(); - for (ServiceDescriptor descriptor : descriptors) { - ServerServiceDefinition.Builder serviceDefinition = - ServerServiceDefinition.builder(descriptor.getName()); - for (MethodDescriptor method : descriptor.getMethods()) { - serviceDefinition.addMethod( - method, - ServerCalls.asyncUnaryCall( - (request, responseObserver) -> - handleRequest(method, request, responseObserver))); - } - serverBuilder.addService( - ServerInterceptors.intercept( - serviceDefinition.build(), new AuthHeaderValidatingInterceptor())); - } - return serverBuilder.build().start(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ManagedChannel createClient() { - return InProcessChannelBuilder.forName("test").directExecutor().build(); - } - - public void resetStubs() { - stubs.clear(); - } - - private void handleRequest( - MethodDescriptor method, Object request, StreamObserver response) { - Queue> queue = stubs.get(method.getFullMethodName()); - if (queue == null) { - throw new IllegalStateException("No behavior stubbed for " + method.getFullMethodName()); - } - StubbedBehavior behavior = queue.poll(); - if (behavior == null) { - throw new IllegalStateException( - "No remaining calls stubbed for " + method.getFullMethodName()); - } - //noinspection unchecked,rawtypes - ((StubbedBehavior) behavior).run(request, response); - } - } - - private static class AuthHeaderValidatingInterceptor implements ServerInterceptor { - - @Override - public ServerCall.Listener interceptCall( - ServerCall call, Metadata headers, ServerCallHandler next) { - if (!headers.containsKey(AUTHORIZATION_HEADER_KEY)) { - call.close(Status.INVALID_ARGUMENT, new Metadata()); - } - return next.startCall(call, headers); - } - } - - private static class ThriftResponseCallback implements AsyncMethodCallback { - private final CompletableFuture future = new CompletableFuture<>(); - - @Override - public void onComplete(T response) { - future.complete(response); - } - - @Override - public void onError(Exception exception) { - future.completeExceptionally(exception); - } - - public T get() { - return future.join(); - } - } -} diff --git a/src/test/java/com/uber/cadence/internal/compatibility/proto/DecisionMapperTest.java b/src/test/java/com/uber/cadence/internal/compatibility/proto/mappers/DecisionMapperTest.java similarity index 64% rename from src/test/java/com/uber/cadence/internal/compatibility/proto/DecisionMapperTest.java rename to src/test/java/com/uber/cadence/internal/compatibility/proto/mappers/DecisionMapperTest.java index f12ad2d53..e8ab4806d 100644 --- a/src/test/java/com/uber/cadence/internal/compatibility/proto/DecisionMapperTest.java +++ b/src/test/java/com/uber/cadence/internal/compatibility/proto/mappers/DecisionMapperTest.java @@ -12,17 +12,16 @@ * 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.proto; +package com.uber.cadence.internal.compatibility.proto.mappers; -import static com.uber.cadence.internal.compatibility.MapperTestUtil.assertMissingFields; import static com.uber.cadence.internal.compatibility.MapperTestUtil.assertNoMissingFields; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Sets; import com.uber.cadence.Decision; import com.uber.cadence.DecisionType; +import com.uber.cadence.internal.compatibility.ClientObjects; import com.uber.cadence.internal.compatibility.ProtoObjects; -import com.uber.cadence.internal.compatibility.ThriftObjects; import java.util.Collections; import java.util.EnumSet; import java.util.Map; @@ -35,36 +34,36 @@ public class DecisionMapperTest { private static final Map DECISIONS = ImmutableMap.builder() .put( - ThriftObjects.DECISION_SCHEDULE_ACTIVITY_TASK, + ClientObjects.DECISION_SCHEDULE_ACTIVITY_TASK, ProtoObjects.DECISION_SCHEDULE_ACTIVITY_TASK) .put( - ThriftObjects.DECISION_REQUEST_CANCEL_ACTIVITY_TASK, + ClientObjects.DECISION_REQUEST_CANCEL_ACTIVITY_TASK, ProtoObjects.DECISION_REQUEST_CANCEL_ACTIVITY_TASK) - .put(ThriftObjects.DECISION_START_TIMER, ProtoObjects.DECISION_START_TIMER) + .put(ClientObjects.DECISION_START_TIMER, ProtoObjects.DECISION_START_TIMER) .put( - ThriftObjects.DECISION_COMPLETE_WORKFLOW_EXECUTION, + ClientObjects.DECISION_COMPLETE_WORKFLOW_EXECUTION, ProtoObjects.DECISION_COMPLETE_WORKFLOW_EXECUTION) .put( - ThriftObjects.DECISION_FAIL_WORKFLOW_EXECUTION, + ClientObjects.DECISION_FAIL_WORKFLOW_EXECUTION, ProtoObjects.DECISION_FAIL_WORKFLOW_EXECUTION) - .put(ThriftObjects.DECISION_CANCEL_TIMER, ProtoObjects.DECISION_CANCEL_TIMER) - .put(ThriftObjects.DECISION_CANCEL_WORKFLOW, ProtoObjects.DECISION_CANCEL_WORKFLOW) + .put(ClientObjects.DECISION_CANCEL_TIMER, ProtoObjects.DECISION_CANCEL_TIMER) + .put(ClientObjects.DECISION_CANCEL_WORKFLOW, ProtoObjects.DECISION_CANCEL_WORKFLOW) .put( - ThriftObjects.DECISION_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION, + ClientObjects.DECISION_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION, ProtoObjects.DECISION_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION) .put( - ThriftObjects.DECISION_CONTINUE_AS_NEW_WORKFLOW_EXECUTION, + ClientObjects.DECISION_CONTINUE_AS_NEW_WORKFLOW_EXECUTION, ProtoObjects.DECISION_CONTINUE_AS_NEW_WORKFLOW_EXECUTION) .put( - ThriftObjects.DECISION_START_CHILD_WORKFLOW_EXECUTION, + ClientObjects.DECISION_START_CHILD_WORKFLOW_EXECUTION, ProtoObjects.DECISION_START_CHILD_WORKFLOW_EXECUTION) .put( - ThriftObjects.DECISION_SIGNAL_EXTERNAL_WORKFLOW_EXECUTION, + ClientObjects.DECISION_SIGNAL_EXTERNAL_WORKFLOW_EXECUTION, ProtoObjects.DECISION_SIGNAL_EXTERNAL_WORKFLOW_EXECUTION) .put( - ThriftObjects.DECISION_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES, + ClientObjects.DECISION_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES, ProtoObjects.DECISION_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES) - .put(ThriftObjects.DECISION_RECORD_MARKER, ProtoObjects.DECISION_RECORD_MARKER) + .put(ClientObjects.DECISION_RECORD_MARKER, ProtoObjects.DECISION_RECORD_MARKER) .build(); @Test @@ -95,46 +94,46 @@ public void testAllAttributesSet() { // If IDL changes add a new field to decision attributes, this should fail for (Map.Entry entry : DECISIONS.entrySet()) { Decision decision = entry.getKey(); - switch (decision.decisionType) { + switch (decision.getDecisionType()) { case ScheduleActivityTask: - assertNoMissingFields(decision.scheduleActivityTaskDecisionAttributes); + assertNoMissingFields(decision.getScheduleActivityTaskDecisionAttributes()); break; case RequestCancelActivityTask: - assertNoMissingFields(decision.requestCancelActivityTaskDecisionAttributes); + assertNoMissingFields(decision.getRequestCancelActivityTaskDecisionAttributes()); break; case StartTimer: - assertNoMissingFields(decision.startTimerDecisionAttributes); + assertNoMissingFields(decision.getStartTimerDecisionAttributes()); break; case CompleteWorkflowExecution: - assertNoMissingFields(decision.completeWorkflowExecutionDecisionAttributes); + assertNoMissingFields(decision.getCompleteWorkflowExecutionDecisionAttributes()); break; case FailWorkflowExecution: - assertNoMissingFields(decision.failWorkflowExecutionDecisionAttributes); + assertNoMissingFields(decision.getFailWorkflowExecutionDecisionAttributes()); break; case CancelTimer: - assertNoMissingFields(decision.cancelTimerDecisionAttributes); + assertNoMissingFields(decision.getCancelTimerDecisionAttributes()); break; case CancelWorkflowExecution: - assertNoMissingFields(decision.cancelWorkflowExecutionDecisionAttributes); + assertNoMissingFields(decision.getCancelWorkflowExecutionDecisionAttributes()); break; case RequestCancelExternalWorkflowExecution: - assertNoMissingFields(decision.requestCancelExternalWorkflowExecutionDecisionAttributes); + assertNoMissingFields( + decision.getRequestCancelExternalWorkflowExecutionDecisionAttributes()); break; case RecordMarker: - assertNoMissingFields(decision.recordMarkerDecisionAttributes); + assertNoMissingFields(decision.getRecordMarkerDecisionAttributes()); break; case ContinueAsNewWorkflowExecution: - assertMissingFields( - decision.continueAsNewWorkflowExecutionDecisionAttributes, "jitterStartSeconds"); + assertNoMissingFields(decision.getContinueAsNewWorkflowExecutionDecisionAttributes()); break; case StartChildWorkflowExecution: - assertNoMissingFields(decision.startChildWorkflowExecutionDecisionAttributes); + assertNoMissingFields(decision.getStartChildWorkflowExecutionDecisionAttributes()); break; case SignalExternalWorkflowExecution: - assertNoMissingFields(decision.signalExternalWorkflowExecutionDecisionAttributes); + assertNoMissingFields(decision.getSignalExternalWorkflowExecutionDecisionAttributes()); break; case UpsertWorkflowSearchAttributes: - assertNoMissingFields(decision.upsertWorkflowSearchAttributesDecisionAttributes); + assertNoMissingFields(decision.getUpsertWorkflowSearchAttributesDecisionAttributes()); break; } } diff --git a/src/test/java/com/uber/cadence/internal/compatibility/proto/mappers/ErrorMapperTest.java b/src/test/java/com/uber/cadence/internal/compatibility/proto/mappers/ErrorMapperTest.java new file mode 100644 index 000000000..ea2b6b1a7 --- /dev/null +++ b/src/test/java/com/uber/cadence/internal/compatibility/proto/mappers/ErrorMapperTest.java @@ -0,0 +1,138 @@ +/* + * 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.compatibility.proto.mappers; + +import static org.junit.Assert.assertEquals; + +import com.google.protobuf.Any; +import com.google.protobuf.Message; +import com.uber.cadence.api.v1.*; +import io.grpc.Status; +import io.grpc.StatusRuntimeException; +import io.grpc.protobuf.StatusProto; +import java.util.Arrays; +import java.util.Collection; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +@RunWith(Parameterized.class) +public class ErrorMapperTest { + + @Parameterized.Parameter(0) + public Status status; + + @Parameterized.Parameter(1) + public Message detail; + + @Parameterized.Parameter(2) + public Class expectedException; + + @Parameterized.Parameters + public static Collection data() { + Object[][] data = + new Object[][] { + {Status.PERMISSION_DENIED, null, com.uber.cadence.AccessDeniedError.class}, + {Status.INTERNAL, null, com.uber.cadence.InternalServiceError.class}, + {Status.NOT_FOUND, null, com.uber.cadence.EntityNotExistsError.class}, + { + Status.ALREADY_EXISTS, + DomainAlreadyExistsError.getDefaultInstance(), + com.uber.cadence.DomainAlreadyExistsError.class + }, + { + Status.FAILED_PRECONDITION, + FeatureNotEnabledError.getDefaultInstance(), + com.uber.cadence.FeatureNotEnabledError.class + }, + { + Status.RESOURCE_EXHAUSTED, + LimitExceededError.getDefaultInstance(), + com.uber.cadence.LimitExceededError.class + }, + {Status.UNKNOWN, null, com.uber.cadence.BaseError.class}, + { + Status.NOT_FOUND, + WorkflowExecutionAlreadyCompletedError.getDefaultInstance(), + com.uber.cadence.WorkflowExecutionAlreadyCompletedError.class + }, + { + Status.ALREADY_EXISTS, + WorkflowExecutionAlreadyStartedError.getDefaultInstance(), + com.uber.cadence.WorkflowExecutionAlreadyStartedError.class + }, + { + Status.FAILED_PRECONDITION, + DomainNotActiveError.getDefaultInstance(), + com.uber.cadence.DomainNotActiveError.class + }, + { + Status.FAILED_PRECONDITION, + ClientVersionNotSupportedError.getDefaultInstance(), + com.uber.cadence.ClientVersionNotSupportedError.class + }, + { + Status.FAILED_PRECONDITION, + FeatureNotEnabledError.getDefaultInstance(), + com.uber.cadence.FeatureNotEnabledError.class + }, + { + Status.FAILED_PRECONDITION, + DomainNotActiveError.getDefaultInstance(), + com.uber.cadence.DomainNotActiveError.class + }, + { + Status.FAILED_PRECONDITION, + ClientVersionNotSupportedError.getDefaultInstance(), + com.uber.cadence.ClientVersionNotSupportedError.class + }, + { + Status.FAILED_PRECONDITION, + FeatureNotEnabledError.getDefaultInstance(), + com.uber.cadence.FeatureNotEnabledError.class + }, + { + Status.RESOURCE_EXHAUSTED, + LimitExceededError.getDefaultInstance(), + com.uber.cadence.LimitExceededError.class + }, + {Status.DATA_LOSS, null, com.uber.cadence.InternalDataInconsistencyError.class}, + { + Status.RESOURCE_EXHAUSTED, + ServiceBusyError.getDefaultInstance(), + com.uber.cadence.ServiceBusyError.class + }, + {Status.INTERNAL, null, com.uber.cadence.InternalServiceError.class} + }; + return Arrays.asList(data); + } + + @Test + public void testErrorMapper() { + com.google.rpc.Status.Builder builder = + com.google.rpc.Status.newBuilder().setCode(status.getCode().value()); + + if (detail != null) { + builder.addDetails(Any.pack(detail)); + } + + StatusRuntimeException ex = StatusProto.toStatusRuntimeException(builder.build()); + com.uber.cadence.BaseError result = ErrorMapper.Error(ex); + assertEquals(expectedException, result.getClass()); + } +} diff --git a/src/test/java/com/uber/cadence/internal/compatibility/proto/RequestMapperTest.java b/src/test/java/com/uber/cadence/internal/compatibility/proto/mappers/RequestMapperTest.java similarity index 68% rename from src/test/java/com/uber/cadence/internal/compatibility/proto/RequestMapperTest.java rename to src/test/java/com/uber/cadence/internal/compatibility/proto/mappers/RequestMapperTest.java index ace637b69..6b617cb57 100644 --- a/src/test/java/com/uber/cadence/internal/compatibility/proto/RequestMapperTest.java +++ b/src/test/java/com/uber/cadence/internal/compatibility/proto/mappers/RequestMapperTest.java @@ -15,7 +15,7 @@ * permissions and limitations under the License. */ -package com.uber.cadence.internal.compatibility.proto; +package com.uber.cadence.internal.compatibility.proto.mappers; import static com.uber.cadence.internal.compatibility.MapperTestUtil.assertMissingFields; import static com.uber.cadence.internal.compatibility.MapperTestUtil.assertNoMissingFields; @@ -24,20 +24,17 @@ import com.google.common.collect.ImmutableSet; import com.google.protobuf.Message; +import com.uber.cadence.internal.compatibility.ClientObjects; import com.uber.cadence.internal.compatibility.ProtoObjects; -import com.uber.cadence.internal.compatibility.ThriftObjects; import java.util.Arrays; import java.util.Set; import java.util.function.Function; -import org.apache.thrift.TBase; -import org.apache.thrift.TFieldIdEnum; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @RunWith(Parameterized.class) -public class RequestMapperTest< - F extends Enum & TFieldIdEnum, T extends TBase, P extends Message> { +public class RequestMapperTest { @Parameterized.Parameter(0) public String testName; @@ -81,173 +78,190 @@ public void testHandlesNull() { public static Iterable cases() { return Arrays.asList( testCase( - ThriftObjects.COUNT_WORKFLOW_EXECUTIONS_REQUEST, + ClientObjects.COUNT_WORKFLOW_EXECUTIONS_REQUEST, ProtoObjects.COUNT_WORKFLOW_EXECUTIONS_REQUEST, RequestMapper::countWorkflowExecutionsRequest), testCase( - ThriftObjects.DESCRIBE_TASK_LIST_REQUEST, + ClientObjects.DESCRIBE_TASK_LIST_REQUEST, ProtoObjects.DESCRIBE_TASK_LIST_REQUEST, RequestMapper::describeTaskListRequest), testCase( - ThriftObjects.LIST_ARCHIVED_WORKFLOW_EXECUTIONS_REQUEST, + ClientObjects.LIST_ARCHIVED_WORKFLOW_EXECUTIONS_REQUEST, ProtoObjects.LIST_ARCHIVED_WORKFLOW_EXECUTIONS_REQUEST, RequestMapper::listArchivedWorkflowExecutionsRequest), testCase( - ThriftObjects.REQUEST_CANCEL_WORKFLOW_EXECUTION_REQUEST, + ClientObjects.REQUEST_CANCEL_WORKFLOW_EXECUTION_REQUEST, ProtoObjects.REQUEST_CANCEL_WORKFLOW_EXECUTION_REQUEST, RequestMapper::requestCancelWorkflowExecutionRequest, "firstExecutionRunID", // optional field "cause"), // optional field testCase( - ThriftObjects.REQUEST_CANCEL_WORKFLOW_EXECUTION_REQUEST_FULL, + ClientObjects.REQUEST_CANCEL_WORKFLOW_EXECUTION_REQUEST_FULL, ProtoObjects.REQUEST_CANCEL_WORKFLOW_EXECUTION_REQUEST_FULL, RequestMapper::requestCancelWorkflowExecutionRequest), testCase( - ThriftObjects.RESET_STICKY_TASK_LIST_REQUEST, + ClientObjects.RESET_STICKY_TASK_LIST_REQUEST, ProtoObjects.RESET_STICKY_TASK_LIST_REQUEST, RequestMapper::resetStickyTaskListRequest), testCase( - ThriftObjects.RESET_WORKFLOW_EXECUTION_REQUEST, + ClientObjects.RESET_WORKFLOW_EXECUTION_REQUEST, ProtoObjects.RESET_WORKFLOW_EXECUTION_REQUEST, RequestMapper::resetWorkflowExecutionRequest), testCase( - ThriftObjects.RESPOND_ACTIVITY_TASK_CANCELED_BY_ID_REQUEST, + ClientObjects.RESPOND_ACTIVITY_TASK_CANCELED_BY_ID_REQUEST, ProtoObjects.RESPOND_ACTIVITY_TASK_CANCELED_BY_ID_REQUEST, RequestMapper::respondActivityTaskCanceledByIdRequest), testCase( - ThriftObjects.RESPOND_ACTIVITY_TASK_CANCELED_REQUEST, + ClientObjects.RESPOND_ACTIVITY_TASK_CANCELED_REQUEST, ProtoObjects.RESPOND_ACTIVITY_TASK_CANCELED_REQUEST, RequestMapper::respondActivityTaskCanceledRequest), testCase( - ThriftObjects.RESPOND_ACTIVITY_TASK_COMPLETED_BY_ID_REQUEST, + ClientObjects.RESPOND_ACTIVITY_TASK_COMPLETED_BY_ID_REQUEST, ProtoObjects.RESPOND_ACTIVITY_TASK_COMPLETED_BY_ID_REQUEST, RequestMapper::respondActivityTaskCompletedByIdRequest), testCase( - ThriftObjects.RESPOND_ACTIVITY_TASK_COMPLETED_REQUEST, + ClientObjects.RESPOND_ACTIVITY_TASK_COMPLETED_REQUEST, ProtoObjects.RESPOND_ACTIVITY_TASK_COMPLETED_REQUEST, RequestMapper::respondActivityTaskCompletedRequest), testCase( - ThriftObjects.RESPOND_ACTIVITY_TASK_FAILED_BY_ID_REQUEST, + ClientObjects.RESPOND_ACTIVITY_TASK_FAILED_BY_ID_REQUEST, ProtoObjects.RESPOND_ACTIVITY_TASK_FAILED_BY_ID_REQUEST, RequestMapper::respondActivityTaskFailedByIdRequest), testCase( - ThriftObjects.RESPOND_ACTIVITY_TASK_FAILED_REQUEST, + ClientObjects.RESPOND_ACTIVITY_TASK_FAILED_REQUEST, ProtoObjects.RESPOND_ACTIVITY_TASK_FAILED_REQUEST, RequestMapper::respondActivityTaskFailedRequest), testCase( - ThriftObjects.RESPOND_DECISION_TASK_COMPLETED_REQUEST, + ClientObjects.RESPOND_DECISION_TASK_COMPLETED_REQUEST, ProtoObjects.RESPOND_DECISION_TASK_COMPLETED_REQUEST, - RequestMapper::respondDecisionTaskCompletedRequest), - testCase( - ThriftObjects.RESPOND_DECISION_TASK_FAILED_REQUEST, + RequestMapper::respondDecisionTaskCompletedRequest, + "scheduleActivityTaskDecisionAttributes", // all other types are missing as expected + "requestCancelActivityTaskDecisionAttributes", + "startTimerDecisionAttributes", + "failWorkflowExecutionDecisionAttributes", + "cancelTimerDecisionAttributes", + "cancelWorkflowExecutionDecisionAttributes", + "requestCancelExternalWorkflowExecutionDecisionAttributes", + "recordMarkerDecisionAttributes", + "continueAsNewWorkflowExecutionDecisionAttributes", + "startChildWorkflowExecutionDecisionAttributes", + "signalExternalWorkflowExecutionDecisionAttributes", + "upsertWorkflowSearchAttributesDecisionAttributes"), + testCase( + ClientObjects.RESPOND_DECISION_TASK_FAILED_REQUEST, ProtoObjects.RESPOND_DECISION_TASK_FAILED_REQUEST, RequestMapper::respondDecisionTaskFailedRequest), testCase( - ThriftObjects.RESPOND_QUERY_TASK_COMPLETED_REQUEST, + ClientObjects.RESPOND_QUERY_TASK_COMPLETED_REQUEST, ProtoObjects.RESPOND_QUERY_TASK_COMPLETED_REQUEST, RequestMapper::respondQueryTaskCompletedRequest), testCase( - ThriftObjects.LIST_WORKFLOW_EXECUTIONS_REQUEST, + ClientObjects.LIST_WORKFLOW_EXECUTIONS_REQUEST, ProtoObjects.SCAN_WORKFLOW_EXECUTIONS_REQUEST, RequestMapper::scanWorkflowExecutionsRequest), testCase( - ThriftObjects.DESCRIBE_WORKFLOW_EXECUTION_REQUEST, + ClientObjects.DESCRIBE_WORKFLOW_EXECUTION_REQUEST, ProtoObjects.DESCRIBE_WORKFLOW_EXECUTION_REQUEST, RequestMapper::describeWorkflowExecutionRequest), testCase( - ThriftObjects.GET_WORKFLOW_EXECUTION_HISTORY_REQUEST, + ClientObjects.GET_WORKFLOW_EXECUTION_HISTORY_REQUEST, ProtoObjects.GET_WORKFLOW_EXECUTION_HISTORY_REQUEST, RequestMapper::getWorkflowExecutionHistoryRequest), testCase( - ThriftObjects.START_WORKFLOW_EXECUTION, + ClientObjects.START_WORKFLOW_EXECUTION, ProtoObjects.START_WORKFLOW_EXECUTION, RequestMapper::startWorkflowExecutionRequest), testCase( - ThriftObjects.SIGNAL_WITH_START_WORKFLOW_EXECUTION, + ClientObjects.SIGNAL_WITH_START_WORKFLOW_EXECUTION, ProtoObjects.SIGNAL_WITH_START_WORKFLOW_EXECUTION, RequestMapper::signalWithStartWorkflowExecutionRequest), testCase( - ThriftObjects.START_WORKFLOW_EXECUTION_ASYNC_REQUEST, + ClientObjects.START_WORKFLOW_EXECUTION_ASYNC_REQUEST, ProtoObjects.START_WORKFLOW_EXECUTION_ASYNC_REQUEST, RequestMapper::startWorkflowExecutionAsyncRequest), testCase( - ThriftObjects.SIGNAL_WITH_START_WORKFLOW_EXECUTION_ASYNC_REQUEST, + ClientObjects.SIGNAL_WITH_START_WORKFLOW_EXECUTION_ASYNC_REQUEST, ProtoObjects.SIGNAL_WITH_START_WORKFLOW_EXECUTION_ASYNC_REQUEST, RequestMapper::signalWithStartWorkflowExecutionAsyncRequest), testCase( - ThriftObjects.SIGNAL_WORKFLOW_EXECUTION_REQUEST, + ClientObjects.SIGNAL_WORKFLOW_EXECUTION_REQUEST, ProtoObjects.SIGNAL_WORKFLOW_EXECUTION_REQUEST, RequestMapper::signalWorkflowExecutionRequest), testCase( - ThriftObjects.TERMINATE_WORKFLOW_EXECUTION_REQUEST, + ClientObjects.TERMINATE_WORKFLOW_EXECUTION_REQUEST, ProtoObjects.TERMINATE_WORKFLOW_EXECUTION_REQUEST, RequestMapper::terminateWorkflowExecutionRequest, "firstExecutionRunID"), // optional field testCase( - ThriftObjects.TERMINATE_WORKFLOW_EXECUTION_REQUEST_FULL, + ClientObjects.TERMINATE_WORKFLOW_EXECUTION_REQUEST_FULL, ProtoObjects.TERMINATE_WORKFLOW_EXECUTION_REQUEST_FULL, RequestMapper::terminateWorkflowExecutionRequest), testCase( - ThriftObjects.DEPRECATE_DOMAIN_REQUEST, + ClientObjects.DEPRECATE_DOMAIN_REQUEST, ProtoObjects.DEPRECATE_DOMAIN_REQUEST, RequestMapper::deprecateDomainRequest), testCase( - ThriftObjects.DESCRIBE_DOMAIN_BY_ID_REQUEST, + ClientObjects.DESCRIBE_DOMAIN_BY_ID_REQUEST, ProtoObjects.DESCRIBE_DOMAIN_BY_ID_REQUEST, RequestMapper::describeDomainRequest, "name"), // Not needed for query by ID testCase( - ThriftObjects.DESCRIBE_DOMAIN_BY_NAME_REQUEST, + ClientObjects.DESCRIBE_DOMAIN_BY_NAME_REQUEST, ProtoObjects.DESCRIBE_DOMAIN_BY_NAME_REQUEST, RequestMapper::describeDomainRequest, "uuid"), // Not needed for query by name testCase( - ThriftObjects.LIST_DOMAINS_REQUEST, + ClientObjects.LIST_DOMAINS_REQUEST, ProtoObjects.LIST_DOMAINS_REQUEST, RequestMapper::listDomainsRequest), testCase( - ThriftObjects.LIST_TASK_LIST_PARTITIONS_REQUEST, + ClientObjects.LIST_TASK_LIST_PARTITIONS_REQUEST, ProtoObjects.LIST_TASK_LIST_PARTITIONS_REQUEST, RequestMapper::listTaskListPartitionsRequest), testCase( - ThriftObjects.POLL_FOR_ACTIVITY_TASK_REQUEST, + ClientObjects.POLL_FOR_ACTIVITY_TASK_REQUEST, ProtoObjects.POLL_FOR_ACTIVITY_TASK_REQUEST, RequestMapper::pollForActivityTaskRequest), testCase( - ThriftObjects.POLL_FOR_DECISION_TASK_REQUEST, + ClientObjects.POLL_FOR_DECISION_TASK_REQUEST, ProtoObjects.POLL_FOR_DECISION_TASK_REQUEST, RequestMapper::pollForDecisionTaskRequest), testCase( - ThriftObjects.QUERY_WORKFLOW_REQUEST, + ClientObjects.QUERY_WORKFLOW_REQUEST, ProtoObjects.QUERY_WORKFLOW_REQUEST, RequestMapper::queryWorkflowRequest), testCase( - ThriftObjects.RECORD_ACTIVITY_TASK_HEARTBEAT_BY_ID_REQUEST, + ClientObjects.RECORD_ACTIVITY_TASK_HEARTBEAT_BY_ID_REQUEST, ProtoObjects.RECORD_ACTIVITY_TASK_HEARTBEAT_BY_ID_REQUEST, RequestMapper::recordActivityTaskHeartbeatByIdRequest), testCase( - ThriftObjects.RECORD_ACTIVITY_TASK_HEARTBEAT_REQUEST, + ClientObjects.RECORD_ACTIVITY_TASK_HEARTBEAT_REQUEST, ProtoObjects.RECORD_ACTIVITY_TASK_HEARTBEAT_REQUEST, RequestMapper::recordActivityTaskHeartbeatRequest), testCase( - ThriftObjects.REGISTER_DOMAIN_REQUEST, + ClientObjects.REGISTER_DOMAIN_REQUEST, ProtoObjects.REGISTER_DOMAIN_REQUEST, - RequestMapper::registerDomainRequest, - "emitMetric"), // Thrift has this field but proto doens't have it + RequestMapper + ::registerDomainRequest), // Thrift has this field but proto doens't have it testCase( - ThriftObjects.UPDATE_DOMAIN_REQUEST, + ClientObjects.UPDATE_DOMAIN_REQUEST, + // Data and replicationConfiguration are copied incorrectly due to a bug :( ProtoObjects.UPDATE_DOMAIN_REQUEST, - RequestMapper::updateDomainRequest), + RequestMapper::updateDomainRequest, + // TODO new fields that are not yet supported + "queueConfig", + "predefinedQueueName", + "queueType"), testCase( - ThriftObjects.LIST_CLOSED_WORKFLOW_EXECUTIONS_REQUEST, + ClientObjects.LIST_CLOSED_WORKFLOW_EXECUTIONS_REQUEST, ProtoObjects.LIST_CLOSED_WORKFLOW_EXECUTIONS_REQUEST, RequestMapper::listClosedWorkflowExecutionsRequest), testCase( - ThriftObjects.LIST_OPEN_WORKFLOW_EXECUTIONS_REQUEST, + ClientObjects.LIST_OPEN_WORKFLOW_EXECUTIONS_REQUEST, ProtoObjects.LIST_OPEN_WORKFLOW_EXECUTIONS_REQUEST, RequestMapper::listOpenWorkflowExecutionsRequest), testCase( - ThriftObjects.LIST_WORKFLOW_EXECUTIONS_REQUEST, + ClientObjects.LIST_WORKFLOW_EXECUTIONS_REQUEST, ProtoObjects.LIST_WORKFLOW_EXECUTIONS_REQUEST, RequestMapper::listWorkflowExecutionsRequest)); } diff --git a/src/test/java/com/uber/cadence/internal/compatibility/proto/TypeMapperTest.java b/src/test/java/com/uber/cadence/internal/compatibility/proto/mappers/TypeMapperTest.java similarity index 74% rename from src/test/java/com/uber/cadence/internal/compatibility/proto/TypeMapperTest.java rename to src/test/java/com/uber/cadence/internal/compatibility/proto/mappers/TypeMapperTest.java index 9b0bc1440..010e996af 100644 --- a/src/test/java/com/uber/cadence/internal/compatibility/proto/TypeMapperTest.java +++ b/src/test/java/com/uber/cadence/internal/compatibility/proto/mappers/TypeMapperTest.java @@ -14,18 +14,16 @@ * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ -package com.uber.cadence.internal.compatibility.proto; +package com.uber.cadence.internal.compatibility.proto.mappers; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.protobuf.Message; import com.uber.cadence.WorkflowExecutionCloseStatus; +import com.uber.cadence.internal.compatibility.ClientObjects; import com.uber.cadence.internal.compatibility.ProtoObjects; -import com.uber.cadence.internal.compatibility.ThriftObjects; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -81,52 +79,52 @@ public void testHandlesNull() { public static Iterable cases() { return Arrays.asList( testCase( - ThriftObjects.BAD_BINARY_INFO, ProtoObjects.BAD_BINARY_INFO, TypeMapper::badBinaryInfo), + ClientObjects.BAD_BINARY_INFO, ProtoObjects.BAD_BINARY_INFO, TypeMapper::badBinaryInfo), testCase( - ThriftObjects.utf8Bytes("data"), ProtoObjects.payload("data"), TypeMapper::payload), - testCase(ThriftObjects.ACTIVITY_TYPE, ProtoObjects.ACTIVITY_TYPE, TypeMapper::activityType), - testCase(ThriftObjects.WORKFLOW_TYPE, ProtoObjects.WORKFLOW_TYPE, TypeMapper::workflowType), - testCase(ThriftObjects.TASK_LIST, ProtoObjects.TASK_LIST, TypeMapper::taskList), + ClientObjects.utf8Bytes("data"), ProtoObjects.payload("data"), TypeMapper::payload), + testCase(ClientObjects.ACTIVITY_TYPE, ProtoObjects.ACTIVITY_TYPE, TypeMapper::activityType), + testCase(ClientObjects.WORKFLOW_TYPE, ProtoObjects.WORKFLOW_TYPE, TypeMapper::workflowType), + testCase(ClientObjects.TASK_LIST, ProtoObjects.TASK_LIST, TypeMapper::taskList), testCase( - ThriftObjects.TASK_LIST_METADATA, + ClientObjects.TASK_LIST_METADATA, ProtoObjects.TASK_LIST_METADATA, TypeMapper::taskListMetadata), - testCase(ThriftObjects.RETRY_POLICY, ProtoObjects.RETRY_POLICY, TypeMapper::retryPolicy), - testCase(ThriftObjects.HEADER, ProtoObjects.HEADER, TypeMapper::header), - testCase(ThriftObjects.MEMO, ProtoObjects.MEMO, TypeMapper::memo), + testCase(ClientObjects.RETRY_POLICY, ProtoObjects.RETRY_POLICY, TypeMapper::retryPolicy), + testCase(ClientObjects.HEADER, ProtoObjects.HEADER, TypeMapper::header), + testCase(ClientObjects.MEMO, ProtoObjects.MEMO, TypeMapper::memo), testCase( - ThriftObjects.SEARCH_ATTRIBUTES, + ClientObjects.SEARCH_ATTRIBUTES, ProtoObjects.SEARCH_ATTRIBUTES, TypeMapper::searchAttributes), - testCase(ThriftObjects.BAD_BINARIES, ProtoObjects.BAD_BINARIES, TypeMapper::badBinaries), + testCase(ClientObjects.BAD_BINARIES, ProtoObjects.BAD_BINARIES, TypeMapper::badBinaries), testCase( - ThriftObjects.CLUSTER_REPLICATION_CONFIGURATION, + ClientObjects.CLUSTER_REPLICATION_CONFIGURATION, ProtoObjects.CLUSTER_REPLICATION_CONFIGURATION, TypeMapper::clusterReplicationConfiguration), testCase( - ThriftObjects.WORKFLOW_QUERY, ProtoObjects.WORKFLOW_QUERY, TypeMapper::workflowQuery), + ClientObjects.WORKFLOW_QUERY, ProtoObjects.WORKFLOW_QUERY, TypeMapper::workflowQuery), testCase( - ThriftObjects.WORKFLOW_QUERY_RESULT, + ClientObjects.WORKFLOW_QUERY_RESULT, ProtoObjects.WORKFLOW_QUERY_RESULT, TypeMapper::workflowQueryResult), testCase( - ThriftObjects.STICKY_EXECUTION_ATTRIBUTES, + ClientObjects.STICKY_EXECUTION_ATTRIBUTES, ProtoObjects.STICKY_EXECUTION_ATTRIBUTES, TypeMapper::stickyExecutionAttributes), testCase( - ThriftObjects.WORKER_VERSION_INFO, + ClientObjects.WORKER_VERSION_INFO, ProtoObjects.WORKER_VERSION_INFO, TypeMapper::workerVersionInfo), testCase( - ThriftObjects.START_TIME_FILTER, + ClientObjects.START_TIME_FILTER, ProtoObjects.START_TIME_FILTER, TypeMapper::startTimeFilter), testCase( - ThriftObjects.WORKFLOW_EXECUTION_FILTER, + ClientObjects.WORKFLOW_EXECUTION_FILTER, ProtoObjects.WORKFLOW_EXECUTION_FILTER, TypeMapper::workflowExecutionFilter), testCase( - ThriftObjects.WORKFLOW_TYPE_FILTER, + ClientObjects.WORKFLOW_TYPE_FILTER, ProtoObjects.WORKFLOW_TYPE_FILTER, TypeMapper::workflowTypeFilter), testCase( @@ -134,19 +132,19 @@ public static Iterable cases() { ProtoObjects.STATUS_FILTER, TypeMapper::statusFilter), testCase( - ImmutableMap.of("key", ThriftObjects.utf8("data")), + ImmutableMap.of("key", ClientObjects.utf8("data")), ImmutableMap.of("key", ProtoObjects.payload("data")), TypeMapper::payloadByteBufferMap), testCase( - ImmutableMap.of("key", ThriftObjects.BAD_BINARY_INFO), + ImmutableMap.of("key", ClientObjects.BAD_BINARY_INFO), ImmutableMap.of("key", ProtoObjects.BAD_BINARY_INFO), TypeMapper::badBinaryInfoMap), testCase( - ImmutableList.of(ThriftObjects.CLUSTER_REPLICATION_CONFIGURATION), + ImmutableList.of(ClientObjects.CLUSTER_REPLICATION_CONFIGURATION), ImmutableList.of(ProtoObjects.CLUSTER_REPLICATION_CONFIGURATION), TypeMapper::clusterReplicationConfigurationArray), testCase( - ImmutableMap.of("key", ThriftObjects.WORKFLOW_QUERY_RESULT), + ImmutableMap.of("key", ClientObjects.WORKFLOW_QUERY_RESULT), ImmutableMap.of("key", ProtoObjects.WORKFLOW_QUERY_RESULT), TypeMapper::workflowQueryResultMap)); } diff --git a/src/test/java/com/uber/cadence/internal/compatibility/thrift/ErrorMapperTest.java b/src/test/java/com/uber/cadence/internal/compatibility/thrift/ErrorMapperTest.java deleted file mode 100644 index 810f1166c..000000000 --- a/src/test/java/com/uber/cadence/internal/compatibility/thrift/ErrorMapperTest.java +++ /dev/null @@ -1,187 +0,0 @@ -/** - * 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.compatibility.thrift; - -import static org.junit.Assert.assertTrue; - -import com.uber.cadence.AccessDeniedError; -import com.uber.cadence.CancellationAlreadyRequestedError; -import com.uber.cadence.ClientVersionNotSupportedError; -import com.uber.cadence.DomainAlreadyExistsError; -import com.uber.cadence.DomainNotActiveError; -import com.uber.cadence.EntityNotExistsError; -import com.uber.cadence.FeatureNotEnabledError; -import com.uber.cadence.InternalServiceError; -import com.uber.cadence.LimitExceededError; -import com.uber.cadence.ServiceBusyError; -import com.uber.cadence.WorkflowExecutionAlreadyCompletedError; -import com.uber.cadence.WorkflowExecutionAlreadyStartedError; -import io.grpc.Metadata; -import io.grpc.Status; -import io.grpc.StatusRuntimeException; -import org.apache.thrift.TException; -import org.junit.Test; - -public class ErrorMapperTest { - - @Test - public void testPermissionDeniedError() { - StatusRuntimeException ex = - new StatusRuntimeException(Status.PERMISSION_DENIED.withDescription("Access denied")); - TException result = ErrorMapper.Error(ex); - assertTrue(result instanceof AccessDeniedError); - } - - @Test - public void testInternalServiceError() { - StatusRuntimeException ex = - new StatusRuntimeException(Status.INTERNAL.withDescription("Internal error")); - TException result = ErrorMapper.Error(ex); - assertTrue(result instanceof InternalServiceError); - } - - @Test - public void testWorkflowExecutionAlreadyCompletedError() { - Metadata metadata = new Metadata(); - metadata.put( - Metadata.Key.of("rpc-application-error-name", Metadata.ASCII_STRING_MARSHALLER), - "EntityNotExistsError"); - StatusRuntimeException ex = - new StatusRuntimeException( - Status.NOT_FOUND.withDescription("already completed."), metadata); - TException result = ErrorMapper.Error(ex); - assertTrue(result instanceof WorkflowExecutionAlreadyCompletedError); - } - - @Test - public void testEntityNotExistsError() { - StatusRuntimeException ex = - new StatusRuntimeException(Status.NOT_FOUND.withDescription("Entity not found")); - TException result = ErrorMapper.Error(ex); - assertTrue(result instanceof EntityNotExistsError); - } - - @Test - public void testCancellationAlreadyRequestedError() { - Metadata metadata = new Metadata(); - metadata.put( - Metadata.Key.of("rpc-application-error-name", Metadata.ASCII_STRING_MARSHALLER), - "CancellationAlreadyRequestedError"); - StatusRuntimeException ex = - new StatusRuntimeException( - Status.ALREADY_EXISTS.withDescription("Cancellation already requested"), metadata); - TException result = ErrorMapper.Error(ex); - assertTrue(result instanceof CancellationAlreadyRequestedError); - } - - @Test - public void testDomainAlreadyExistsError() { - Metadata metadata = new Metadata(); - metadata.put( - Metadata.Key.of("rpc-application-error-name", Metadata.ASCII_STRING_MARSHALLER), - "DomainAlreadyExistsError"); - StatusRuntimeException ex = - new StatusRuntimeException( - Status.ALREADY_EXISTS.withDescription("Domain already exists"), metadata); - TException result = ErrorMapper.Error(ex); - assertTrue(result instanceof DomainAlreadyExistsError); - } - - @Test - public void testWorkflowExecutionAlreadyStartedError() { - Metadata metadata = new Metadata(); - metadata.put( - Metadata.Key.of("rpc-application-error-name", Metadata.ASCII_STRING_MARSHALLER), - "WorkflowExecutionAlreadyStartedError"); - StatusRuntimeException ex = - new StatusRuntimeException( - Status.ALREADY_EXISTS.withDescription("Workflow already started"), metadata); - TException result = ErrorMapper.Error(ex); - assertTrue(result instanceof WorkflowExecutionAlreadyStartedError); - } - - @Test - public void testClientVersionNotSupportedError() { - Metadata metadata = new Metadata(); - metadata.put( - Metadata.Key.of("rpc-application-error-name", Metadata.ASCII_STRING_MARSHALLER), - "ClientVersionNotSupportedError"); - StatusRuntimeException ex = - new StatusRuntimeException( - Status.FAILED_PRECONDITION.withDescription("Client version not supported"), metadata); - TException result = ErrorMapper.Error(ex); - assertTrue(result instanceof ClientVersionNotSupportedError); - } - - @Test - public void testFeatureNotEnabledError() { - Metadata metadata = new Metadata(); - metadata.put( - Metadata.Key.of("rpc-application-error-name", Metadata.ASCII_STRING_MARSHALLER), - "FeatureNotEnabledError"); - StatusRuntimeException ex = - new StatusRuntimeException( - Status.FAILED_PRECONDITION.withDescription("Feature not enabled"), metadata); - TException result = ErrorMapper.Error(ex); - assertTrue(result instanceof FeatureNotEnabledError); - } - - @Test - public void testDomainNotActiveError() { - Metadata metadata = new Metadata(); - metadata.put( - Metadata.Key.of("rpc-application-error-name", Metadata.ASCII_STRING_MARSHALLER), - "DomainNotActiveError"); - StatusRuntimeException ex = - new StatusRuntimeException( - Status.FAILED_PRECONDITION.withDescription("Domain not active"), metadata); - TException result = ErrorMapper.Error(ex); - assertTrue(result instanceof DomainNotActiveError); - } - - @Test - public void testLimitExceededError() { - Metadata metadata = new Metadata(); - metadata.put( - Metadata.Key.of("rpc-application-error-name", Metadata.ASCII_STRING_MARSHALLER), - "LimitExceededError"); - StatusRuntimeException ex = - new StatusRuntimeException( - Status.RESOURCE_EXHAUSTED.withDescription("Limit exceeded"), metadata); - TException result = ErrorMapper.Error(ex); - assertTrue(result instanceof LimitExceededError); - } - - @Test - public void testServiceBusyError() { - Metadata metadata = new Metadata(); - metadata.put( - Metadata.Key.of("rpc-application-error-name", Metadata.ASCII_STRING_MARSHALLER), - "ServiceBusyError"); - StatusRuntimeException ex = - new StatusRuntimeException( - Status.RESOURCE_EXHAUSTED.withDescription("Service busy"), metadata); - TException result = ErrorMapper.Error(ex); - assertTrue(result instanceof ServiceBusyError); - } - - @Test - public void testUnknownError() { - StatusRuntimeException ex = - new StatusRuntimeException(Status.UNKNOWN.withDescription("Unknown error")); - TException result = ErrorMapper.Error(ex); - assertTrue(result instanceof TException); - } -} 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 deleted file mode 100644 index 37fb3caf1..000000000 --- a/src/test/java/com/uber/cadence/internal/compatibility/thrift/HistoryMapperEventTest.java +++ /dev/null @@ -1,339 +0,0 @@ -/** - * 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.compatibility.thrift; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableSet; -import com.google.protobuf.Message; -import com.google.protobuf.Timestamp; -import com.uber.cadence.EventType; -import com.uber.cadence.HistoryEvent; -import com.uber.cadence.internal.compatibility.MapperTestUtil; -import com.uber.cadence.internal.compatibility.ProtoObjects; -import com.uber.cadence.internal.compatibility.ThriftObjects; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import org.apache.thrift.TBase; -import org.apache.thrift.TFieldIdEnum; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - -@RunWith(Parameterized.class) -public class HistoryMapperEventTest< - F extends Message, E extends Enum & TFieldIdEnum, T extends TBase> { - private static final Map, Method> ATTRIBUTE_CONVERTERS = - indexSingleParameterMethods(HistoryMapper.class, Message.class); - private static final long EVENT_ID = 1; - private static final int TIMESTAMP_NANOS = 100; - private static final Timestamp TIMESTAMP = - Timestamp.newBuilder().setNanos(TIMESTAMP_NANOS).build(); - private static final long VERSION = 2; - private static final long TASK_ID = 3; - - @Parameterized.Parameter public EventType eventType; - - @Parameterized.Parameter(1) - public F from; - - @Parameterized.Parameter(2) - public T to; - - @Parameterized.Parameter(3) - public Set missingFields; - - @Test - public void testHistoryEvent() { - HistoryEvent thriftEvent = createThriftHistoryEvent(); - assertEquals(thriftEvent, HistoryMapper.historyEvent(createProtoHistoryEvent())); - } - - @Test - public void testConverter() { - assertEquals(to, convertToThrift(from)); - } - - @Test - public void testConverterWithNull() { - assertNull("Passing null should return null", convertToThrift(null)); - } - - @Test - public void testAllFieldsPresent() { - if (missingFields.isEmpty()) { - MapperTestUtil.assertNoMissingFields(to); - } else { - MapperTestUtil.assertMissingFields(to, missingFields); - } - } - - private com.uber.cadence.api.v1.HistoryEvent createProtoHistoryEvent() { - com.uber.cadence.api.v1.HistoryEvent.Builder eventBuilder = - com.uber.cadence.api.v1.HistoryEvent.newBuilder() - .setEventId(EVENT_ID) - .setEventTime(TIMESTAMP) - .setVersion(VERSION) - .setTaskId(TASK_ID); - // Apply the attributes - callSetter(eventBuilder, from); - return eventBuilder.build(); - } - - private HistoryEvent createThriftHistoryEvent() { - HistoryEvent event = - new HistoryEvent() - .setEventId(EVENT_ID) - .setEventType(eventType) - .setTimestamp(TIMESTAMP_NANOS) - .setVersion(VERSION) - .setTaskId(TASK_ID); - // Apply the attributes - callSetter(event, to); - return event; - } - - private Object convertToThrift(F proto) { - Method converter = ATTRIBUTE_CONVERTERS.get(from.getClass()); - Preconditions.checkState( - converter != null, "failed to find converter for %s", from.getClass().getSimpleName()); - try { - return converter.invoke(null, proto); - } catch (IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException(e); - } - } - - private static void callSetter(Object target, Object toSet) { - for (Method method : target.getClass().getDeclaredMethods()) { - Class[] params = method.getParameterTypes(); - if (method.getName().startsWith("set") - && params.length == 1 - && toSet.getClass().isAssignableFrom(params[0])) { - try { - method.invoke(target, toSet); - } catch (IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException(e); - } - } - } - } - - // Index all the functions in HistoryMapper by parameter type so we can find them dynamically - private static Map, Method> indexSingleParameterMethods( - Class target, Class parameterType) { - Map, Method> byParameterType = new HashMap<>(); - for (Method method : target.getDeclaredMethods()) { - Class[] params = method.getParameterTypes(); - if (params.length == 1 && parameterType.isAssignableFrom(params[0])) { - Class protoType = (Class) params[0]; - byParameterType.put(protoType, method); - } - } - return byParameterType; - } - - @Parameterized.Parameters(name = "{0}") - public static Object[][] cases() { - return new Object[][] { - testCase( - EventType.WorkflowExecutionStarted, - ProtoObjects.WORKFLOW_EXECUTION_STARTED_EVENT_ATTRIBUTES, - ThriftObjects.WORKFLOW_EXECUTION_STARTED_EVENT_ATTRIBUTES, - "firstScheduledTimeNano", - "partitionConfig", - "requestId"), - testCase( - EventType.WorkflowExecutionCompleted, - ProtoObjects.WORKFLOW_EXECUTION_COMPLETED_EVENT_ATTRIBUTES, - ThriftObjects.WORKFLOW_EXECUTION_COMPLETED_EVENT_ATTRIBUTES), - testCase( - EventType.WorkflowExecutionFailed, - ProtoObjects.WORKFLOW_EXECUTION_FAILED_EVENT_ATTRIBUTES, - ThriftObjects.WORKFLOW_EXECUTION_FAILED_EVENT_ATTRIBUTES), - testCase( - EventType.WorkflowExecutionTimedOut, - ProtoObjects.WORKFLOW_EXECUTION_TIMED_OUT_EVENT_ATTRIBUTES, - ThriftObjects.WORKFLOW_EXECUTION_TIMED_OUT_EVENT_ATTRIBUTES), - testCase( - EventType.DecisionTaskScheduled, - ProtoObjects.DECISION_TASK_SCHEDULED_EVENT_ATTRIBUTES, - ThriftObjects.DECISION_TASK_SCHEDULED_EVENT_ATTRIBUTES), - testCase( - EventType.DecisionTaskStarted, - ProtoObjects.DECISION_TASK_STARTED_EVENT_ATTRIBUTES, - ThriftObjects.DECISION_TASK_STARTED_EVENT_ATTRIBUTES), - testCase( - EventType.DecisionTaskCompleted, - ProtoObjects.DECISION_TASK_COMPLETED_EVENT_ATTRIBUTES, - ThriftObjects.DECISION_TASK_COMPLETED_EVENT_ATTRIBUTES), - testCase( - EventType.DecisionTaskTimedOut, - ProtoObjects.DECISION_TASK_TIMED_OUT_EVENT_ATTRIBUTES, - ThriftObjects.DECISION_TASK_TIMED_OUT_EVENT_ATTRIBUTES, - "requestId"), - testCase( - EventType.DecisionTaskFailed, - ProtoObjects.DECISION_TASK_FAILED_EVENT_ATTRIBUTES, - ThriftObjects.DECISION_TASK_FAILED_EVENT_ATTRIBUTES, - "requestId"), - testCase( - EventType.ActivityTaskScheduled, - ProtoObjects.ACTIVITY_TASK_SCHEDULED_EVENT_ATTRIBUTES, - ThriftObjects.ACTIVITY_TASK_SCHEDULED_EVENT_ATTRIBUTES), - testCase( - EventType.ActivityTaskStarted, - ProtoObjects.ACTIVITY_TASK_STARTED_EVENT_ATTRIBUTES, - ThriftObjects.ACTIVITY_TASK_STARTED_EVENT_ATTRIBUTES), - testCase( - EventType.ActivityTaskCompleted, - ProtoObjects.ACTIVITY_TASK_COMPLETED_EVENT_ATTRIBUTES, - ThriftObjects.ACTIVITY_TASK_COMPLETED_EVENT_ATTRIBUTES), - testCase( - EventType.ActivityTaskFailed, - ProtoObjects.ACTIVITY_TASK_FAILED_EVENT_ATTRIBUTES, - ThriftObjects.ACTIVITY_TASK_FAILED_EVENT_ATTRIBUTES), - testCase( - EventType.ActivityTaskTimedOut, - ProtoObjects.ACTIVITY_TASK_TIMED_OUT_EVENT_ATTRIBUTES, - ThriftObjects.ACTIVITY_TASK_TIMED_OUT_EVENT_ATTRIBUTES), - testCase( - EventType.ActivityTaskCancelRequested, - ProtoObjects.ACTIVITY_TASK_CANCEL_REQUESTED_EVENT_ATTRIBUTES, - ThriftObjects.ACTIVITY_TASK_CANCEL_REQUESTED_EVENT_ATTRIBUTES), - testCase( - EventType.RequestCancelActivityTaskFailed, - ProtoObjects.REQUEST_CANCEL_ACTIVITY_TASK_FAILED_EVENT_ATTRIBUTES, - ThriftObjects.REQUEST_CANCEL_ACTIVITY_TASK_FAILED_EVENT_ATTRIBUTES), - testCase( - EventType.ActivityTaskCanceled, - ProtoObjects.ACTIVITY_TASK_CANCELED_EVENT_ATTRIBUTES, - ThriftObjects.ACTIVITY_TASK_CANCELED_EVENT_ATTRIBUTES), - testCase( - EventType.TimerStarted, - ProtoObjects.TIMER_STARTED_EVENT_ATTRIBUTES, - ThriftObjects.TIMER_STARTED_EVENT_ATTRIBUTES), - testCase( - EventType.TimerFired, - ProtoObjects.TIMER_FIRED_EVENT_ATTRIBUTES, - ThriftObjects.TIMER_FIRED_EVENT_ATTRIBUTES), - testCase( - EventType.CancelTimerFailed, - ProtoObjects.CANCEL_TIMER_FAILED_EVENT_ATTRIBUTES, - ThriftObjects.CANCEL_TIMER_FAILED_EVENT_ATTRIBUTES), - testCase( - EventType.TimerCanceled, - ProtoObjects.TIMER_CANCELED_EVENT_ATTRIBUTES, - ThriftObjects.TIMER_CANCELED_EVENT_ATTRIBUTES), - testCase( - EventType.WorkflowExecutionCancelRequested, - ProtoObjects.WORKFLOW_EXECUTION_CANCEL_REQUESTED_EVENT_ATTRIBUTES, - ThriftObjects.WORKFLOW_EXECUTION_CANCEL_REQUESTED_EVENT_ATTRIBUTES, - "requestId"), - testCase( - EventType.WorkflowExecutionCanceled, - ProtoObjects.WORKFLOW_EXECUTION_CANCELED_EVENT_ATTRIBUTES, - ThriftObjects.WORKFLOW_EXECUTION_CANCELED_EVENT_ATTRIBUTES), - testCase( - EventType.RequestCancelExternalWorkflowExecutionInitiated, - ProtoObjects.REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_INITIATED_EVENT_ATTRIBUTES, - ThriftObjects.REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_INITIATED_EVENT_ATTRIBUTES), - testCase( - EventType.RequestCancelExternalWorkflowExecutionFailed, - ProtoObjects.REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_EVENT_ATTRIBUTES, - ThriftObjects.REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_EVENT_ATTRIBUTES), - testCase( - EventType.ExternalWorkflowExecutionCancelRequested, - ProtoObjects.EXTERNAL_WORKFLOW_EXECUTION_CANCEL_REQUESTED_EVENT_ATTRIBUTES, - ThriftObjects.EXTERNAL_WORKFLOW_EXECUTION_CANCEL_REQUESTED_EVENT_ATTRIBUTES), - testCase( - EventType.MarkerRecorded, - ProtoObjects.MARKER_RECORDED_EVENT_ATTRIBUTES, - ThriftObjects.MARKER_RECORDED_EVENT_ATTRIBUTES), - testCase( - EventType.WorkflowExecutionSignaled, - ProtoObjects.WORKFLOW_EXECUTION_SIGNALED_EVENT_ATTRIBUTES, - ThriftObjects.WORKFLOW_EXECUTION_SIGNALED_EVENT_ATTRIBUTES, - "requestId"), - testCase( - EventType.WorkflowExecutionTerminated, - ProtoObjects.WORKFLOW_EXECUTION_TERMINATED_EVENT_ATTRIBUTES, - ThriftObjects.WORKFLOW_EXECUTION_TERMINATED_EVENT_ATTRIBUTES), - testCase( - EventType.WorkflowExecutionContinuedAsNew, - ProtoObjects.WORKFLOW_EXECUTION_CONTINUED_AS_NEW_EVENT_ATTRIBUTES, - ThriftObjects.WORKFLOW_EXECUTION_CONTINUED_AS_NEW_EVENT_ATTRIBUTES), - testCase( - EventType.StartChildWorkflowExecutionInitiated, - ProtoObjects.START_CHILD_WORKFLOW_EXECUTION_INITIATED_EVENT_ATTRIBUTES, - ThriftObjects.START_CHILD_WORKFLOW_EXECUTION_INITIATED_EVENT_ATTRIBUTES, - "jitterStartSeconds"), - testCase( - EventType.StartChildWorkflowExecutionFailed, - ProtoObjects.START_CHILD_WORKFLOW_EXECUTION_FAILED_EVENT_ATTRIBUTES, - ThriftObjects.START_CHILD_WORKFLOW_EXECUTION_FAILED_EVENT_ATTRIBUTES), - testCase( - EventType.ChildWorkflowExecutionStarted, - ProtoObjects.CHILD_WORKFLOW_EXECUTION_STARTED_EVENT_ATTRIBUTES, - ThriftObjects.CHILD_WORKFLOW_EXECUTION_STARTED_EVENT_ATTRIBUTES), - testCase( - EventType.ChildWorkflowExecutionCompleted, - ProtoObjects.CHILD_WORKFLOW_EXECUTION_COMPLETED_EVENT_ATTRIBUTES, - ThriftObjects.CHILD_WORKFLOW_EXECUTION_COMPLETED_EVENT_ATTRIBUTES), - testCase( - EventType.ChildWorkflowExecutionFailed, - ProtoObjects.CHILD_WORKFLOW_EXECUTION_FAILED_EVENT_ATTRIBUTES, - ThriftObjects.CHILD_WORKFLOW_EXECUTION_FAILED_EVENT_ATTRIBUTES), - testCase( - EventType.ChildWorkflowExecutionCanceled, - ProtoObjects.CHILD_WORKFLOW_EXECUTION_CANCELED_EVENT_ATTRIBUTES, - ThriftObjects.CHILD_WORKFLOW_EXECUTION_CANCELED_EVENT_ATTRIBUTES), - testCase( - EventType.ChildWorkflowExecutionTimedOut, - ProtoObjects.CHILD_WORKFLOW_EXECUTION_TIMED_OUT_EVENT_ATTRIBUTES, - ThriftObjects.CHILD_WORKFLOW_EXECUTION_TIMED_OUT_EVENT_ATTRIBUTES), - testCase( - EventType.ChildWorkflowExecutionTerminated, - ProtoObjects.CHILD_WORKFLOW_EXECUTION_TERMINATED_EVENT_ATTRIBUTES, - ThriftObjects.CHILD_WORKFLOW_EXECUTION_TERMINATED_EVENT_ATTRIBUTES), - testCase( - EventType.SignalExternalWorkflowExecutionInitiated, - ProtoObjects.SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_INITIATED_EVENT_ATTRIBUTES, - ThriftObjects.SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_INITIATED_EVENT_ATTRIBUTES), - testCase( - EventType.SignalExternalWorkflowExecutionFailed, - ProtoObjects.SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_EVENT_ATTRIBUTES, - ThriftObjects.SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_EVENT_ATTRIBUTES), - testCase( - EventType.ExternalWorkflowExecutionSignaled, - ProtoObjects.EXTERNAL_WORKFLOW_EXECUTION_SIGNALED_EVENT_ATTRIBUTES, - ThriftObjects.EXTERNAL_WORKFLOW_EXECUTION_SIGNALED_EVENT_ATTRIBUTES), - testCase( - EventType.UpsertWorkflowSearchAttributes, - ProtoObjects.UPSERT_WORKFLOW_SEARCH_ATTRIBUTES_EVENT_ATTRIBUTES, - ThriftObjects.UPSERT_WORKFLOW_SEARCH_ATTRIBUTES_EVENT_ATTRIBUTES), - }; - } - - private static Object[] testCase( - EventType type, Message proto, TBase thrift, String... expectedMissingFields) { - return new Object[] {type, proto, thrift, ImmutableSet.copyOf(expectedMissingFields)}; - } -} diff --git a/src/test/java/com/uber/cadence/internal/compatibility/thrift/ResponseMapperTest.java b/src/test/java/com/uber/cadence/internal/compatibility/thrift/ResponseMapperTest.java deleted file mode 100644 index cf2380b14..000000000 --- a/src/test/java/com/uber/cadence/internal/compatibility/thrift/ResponseMapperTest.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * 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.compatibility.thrift; - -import static com.uber.cadence.internal.compatibility.MapperTestUtil.assertMissingFields; -import static com.uber.cadence.internal.compatibility.MapperTestUtil.assertNoMissingFields; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import com.google.common.collect.ImmutableSet; -import com.google.protobuf.Message; -import com.uber.cadence.internal.compatibility.ProtoObjects; -import com.uber.cadence.internal.compatibility.ThriftObjects; -import java.util.Arrays; -import java.util.Set; -import java.util.function.Function; -import org.apache.thrift.TBase; -import org.apache.thrift.TFieldIdEnum; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - -@RunWith(Parameterized.class) -public class ResponseMapperTest< - F extends Enum & TFieldIdEnum, T extends TBase, P extends Message> { - - @Parameterized.Parameter(0) - public String testName; - - @Parameterized.Parameter(1) - public P from; - - @Parameterized.Parameter(2) - public T to; - - @Parameterized.Parameter(3) - public Function via; - - @Parameterized.Parameter(4) - public Set missingFields; - - @Test - public void testFieldsPresent() { - // If IDL is updated, this will fail. Update the mapper or add it to the test - if (missingFields.isEmpty()) { - assertNoMissingFields(to); - } else { - assertMissingFields(to, missingFields); - } - } - - @Test - public void testMapper() { - T actual = via.apply(from); - assertEquals(to, actual); - } - - @Test - public void testHandlesNull() { - T actual = via.apply(null); - - assertNull("Mapper functions should accept null, returning null", actual); - } - - @Parameterized.Parameters(name = "{0}") - public static Iterable cases() { - return Arrays.asList( - testCase( - ProtoObjects.START_WORKFLOW_EXECUTION_RESPONSE, - ThriftObjects.START_WORKFLOW_EXECUTION_RESPONSE, - ResponseMapper::startWorkflowExecutionResponse), - testCase( - ProtoObjects.START_WORKFLOW_EXECUTION_ASYNC_RESPONSE, - ThriftObjects.START_WORKFLOW_EXECUTION_ASYNC_RESPONSE, - ResponseMapper::startWorkflowExecutionAsyncResponse), - testCase( - ProtoObjects.DESCRIBE_TASK_LIST_RESPONSE, - ThriftObjects.DESCRIBE_TASK_LIST_RESPONSE, - ResponseMapper::describeTaskListResponse), - testCase( - ProtoObjects.DESCRIBE_WORKFLOW_EXECUTION_RESPONSE, - ThriftObjects.DESCRIBE_WORKFLOW_EXECUTION_RESPONSE, - ResponseMapper::describeWorkflowExecutionResponse), - testCase( - ProtoObjects.GET_SEARCH_ATTRIBUTES_RESPONSE, - ThriftObjects.GET_SEARCH_ATTRIBUTES_RESPONSE, - ResponseMapper::getSearchAttributesResponse), - testCase( - ProtoObjects.GET_WORKFLOW_EXECUTION_HISTORY_RESPONSE, - ThriftObjects.GET_WORKFLOW_EXECUTION_HISTORY_RESPONSE, - ResponseMapper::getWorkflowExecutionHistoryResponse), - testCase( - ProtoObjects.LIST_ARCHIVED_WORKFLOW_EXECUTIONS_RESPONSE, - ThriftObjects.LIST_ARCHIVED_WORKFLOW_EXECUTIONS_RESPONSE, - ResponseMapper::listArchivedWorkflowExecutionsResponse), - testCase( - ProtoObjects.LIST_CLOSED_WORKFLOW_EXECUTIONS_RESPONSE, - ThriftObjects.LIST_CLOSED_WORKFLOW_EXECUTIONS_RESPONSE, - ResponseMapper::listClosedWorkflowExecutionsResponse), - testCase( - ProtoObjects.LIST_TASK_LIST_PARTITIONS_RESPONSE, - ThriftObjects.LIST_TASK_LIST_PARTITIONS_RESPONSE, - ResponseMapper::listTaskListPartitionsResponse), - testCase( - ProtoObjects.LIST_WORKFLOW_EXECUTIONS_RESPONSE, - ThriftObjects.LIST_WORKFLOW_EXECUTIONS_RESPONSE, - ResponseMapper::listWorkflowExecutionsResponse), - testCase( - ProtoObjects.POLL_FOR_ACTIVITY_TASK_RESPONSE, - ThriftObjects.POLL_FOR_ACTIVITY_TASK_RESPONSE, - ResponseMapper::pollForActivityTaskResponse), - testCase( - ProtoObjects.POLL_FOR_DECISION_TASK_RESPONSE, - ThriftObjects.POLL_FOR_DECISION_TASK_RESPONSE, - ResponseMapper::pollForDecisionTaskResponse, - "totalHistoryBytes"), - testCase( - ProtoObjects.QUERY_WORKFLOW_RESPONSE, - ThriftObjects.QUERY_WORKFLOW_RESPONSE, - ResponseMapper::queryWorkflowResponse), - testCase( - ProtoObjects.RECORD_ACTIVITY_TASK_HEARTBEAT_RESPONSE, - ThriftObjects.RECORD_ACTIVITY_TASK_HEARTBEAT_RESPONSE, - ResponseMapper::recordActivityTaskHeartbeatResponse), - testCase( - ProtoObjects.RESET_WORKFLOW_EXECUTION_RESPONSE, - ThriftObjects.RESET_WORKFLOW_EXECUTION_RESPONSE, - ResponseMapper::resetWorkflowExecutionResponse), - testCase( - ProtoObjects.RESPOND_DECISION_TASK_COMPLETED_RESPONSE, - ThriftObjects.RESPOND_DECISION_TASK_COMPLETED_RESPONSE, - ResponseMapper::respondDecisionTaskCompletedResponse), - testCase( - ProtoObjects.COUNT_WORKFLOW_EXECUTIONS_RESPONSE, - ThriftObjects.COUNT_WORKFLOW_EXECUTIONS_RESPONSE, - ResponseMapper::countWorkflowExecutionsResponse), - testCase( - ProtoObjects.DESCRIBE_DOMAIN_RESPONSE, - ThriftObjects.DESCRIBE_DOMAIN_RESPONSE, - ResponseMapper::describeDomainResponse, - "failoverInfo"), - testCase( - ProtoObjects.LIST_DOMAINS_RESPONSE, - ThriftObjects.LIST_DOMAINS_RESPONSE, - ResponseMapper::listDomainsResponse), - testCase( - ProtoObjects.SIGNAL_WITH_START_WORKFLOW_EXECUTION_ASYNC_RESPONSE, - ThriftObjects.SIGNAL_WITH_START_WORKFLOW_EXECUTION_ASYNC_RESPONSE, - ResponseMapper::signalWithStartWorkflowExecutionAsyncResponse), - testCase( - ProtoObjects.UPDATE_DOMAIN_RESPONSE, - ThriftObjects.UPDATE_DOMAIN_RESPONSE, - ResponseMapper::updateDomainResponse), - testCase( - ProtoObjects.LIST_OPEN_WORKFLOW_EXECUTIONS_RESPONSE, - ThriftObjects.LIST_OPEN_WORKFLOW_EXECUTIONS_RESPONSE, - ResponseMapper::listOpenWorkflowExecutionsResponse), - // Proto has more types than thrift because it doesn't reuse response types across methods - testCase( - ProtoObjects.SCAN_WORKFLOW_EXECUTIONS_RESPONSE, - ThriftObjects.LIST_WORKFLOW_EXECUTIONS_RESPONSE, - ResponseMapper::scanWorkflowExecutionsResponse), - testCase( - ProtoObjects.RECORD_ACTIVITY_TASK_HEARTBEAT_BY_ID_RESPONSE, - ThriftObjects.RECORD_ACTIVITY_TASK_HEARTBEAT_RESPONSE, - ResponseMapper::recordActivityTaskHeartbeatByIdResponse), - testCase( - ProtoObjects.GET_CLUSTER_INFO_RESPONSE, - ThriftObjects.CLUSTER_INFO, - ResponseMapper::getClusterInfoResponse), - testCase( - ProtoObjects.SIGNAL_WITH_START_WORKFLOW_EXECUTION_RESPONSE, - ThriftObjects.START_WORKFLOW_EXECUTION_RESPONSE, - ResponseMapper::signalWithStartWorkflowExecutionResponse)); - } - - private static Object[] testCase( - P from, T to, Function via, String... missingFields) { - return new Object[] { - from.getClass().getSimpleName(), from, to, via, ImmutableSet.copyOf(missingFields) - }; - } -} diff --git a/src/test/java/com/uber/cadence/internal/compatibility/thrift/TypeMapperTest.java b/src/test/java/com/uber/cadence/internal/compatibility/thrift/TypeMapperTest.java deleted file mode 100644 index 8b27ecda9..000000000 --- a/src/test/java/com/uber/cadence/internal/compatibility/thrift/TypeMapperTest.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * 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.compatibility.thrift; - -import static com.uber.cadence.internal.compatibility.thrift.Helpers.byteStringToArray; -import static org.junit.Assert.*; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.uber.cadence.internal.compatibility.ProtoObjects; -import com.uber.cadence.internal.compatibility.ThriftObjects; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - -@RunWith(Parameterized.class) -public class TypeMapperTest { - - @Parameterized.Parameter(0) - public String testName; - - @Parameterized.Parameter(1) - public T from; - - @Parameterized.Parameter(2) - public P to; - - @Parameterized.Parameter(3) - public Function via; - - @Test - public void testMapper() { - P actual = via.apply(from); - if (actual instanceof byte[] && to instanceof byte[]) { - // Handle the byte[] comparison - assertArrayEquals((byte[]) to, (byte[]) actual); - } else { - // Handle all other types - assertEquals(to, actual); - } - } - - @Test - public void testHandlesNull() { - P actual = via.apply(null); - - if (actual instanceof List) { - assertTrue( - "Mapper functions returning a list should return an empty list", - ((List) actual).isEmpty()); - } else if (actual instanceof Map) { - assertTrue( - "Mapper functions returning a map should return an empty map", - ((Map) actual).isEmpty()); - } else if (actual instanceof Long) { - assertEquals("For long we expect -1", -1L, actual); - } else { - assertNull("Mapper functions should accept null, returning null", actual); - } - } - - @Parameterized.Parameters(name = "{0}") - public static Iterable cases() { - return Arrays.asList( - testCase( - ProtoObjects.BAD_BINARY_INFO, ThriftObjects.BAD_BINARY_INFO, TypeMapper::badBinaryInfo), - testCase(ProtoObjects.FAILURE, "reason", TypeMapper::failureReason), - testCase(ProtoObjects.DATA_BLOB, ThriftObjects.DATA_BLOB, TypeMapper::dataBlob), - testCase( - ProtoObjects.EXTERNAL_WORKFLOW_EXECUTION_INFO, - ThriftObjects.EXTERNAL_WORKFLOW_EXECUTION, - TypeMapper::externalWorkflowExecution), - testCase( - ProtoObjects.FAILURE, - byteStringToArray(ProtoObjects.FAILURE.getDetails()), - TypeMapper::failureDetails), - testCase(ProtoObjects.ACTIVITY_TYPE, ThriftObjects.ACTIVITY_TYPE, TypeMapper::activityType), - testCase(ProtoObjects.WORKFLOW_TYPE, ThriftObjects.WORKFLOW_TYPE, TypeMapper::workflowType), - testCase(ProtoObjects.RESET_POINTS, ThriftObjects.RESET_POINTS, TypeMapper::resetPoints), - testCase( - ProtoObjects.RESET_POINT_INFO, - ThriftObjects.RESET_POINT_INFO, - TypeMapper::resetPointInfo), - testCase(ProtoObjects.POLLER_INFO, ThriftObjects.POLLER_INFO, TypeMapper::pollerInfo), - testCase( - Collections.singletonList(ProtoObjects.POLLER_INFO), - Collections.singletonList(ThriftObjects.POLLER_INFO), - TypeMapper::pollerInfoArray), - testCase( - ProtoObjects.SUPPORTED_CLIENT_VERSIONS, - ThriftObjects.SUPPORTED_CLIENT_VERSIONS, - TypeMapper::supportedClientVersions), - testCase( - ProtoObjects.TASK_LIST_STATUS, - ThriftObjects.TASK_LIST_STATUS, - TypeMapper::taskListStatus), - testCase( - ProtoObjects.WORKFLOW_EXECUTION, - ThriftObjects.WORKFLOW_EXECUTION, - TypeMapper::workflowExecution), - testCase(ProtoObjects.WORKFLOW_EXECUTION, "workflowId", TypeMapper::workflowId), - testCase(ProtoObjects.WORKFLOW_EXECUTION, "runId", TypeMapper::runId), - testCase( - ProtoObjects.WORKFLOW_EXECUTION_INFO, - ThriftObjects.WORKFLOW_EXECUTION_INFO, - TypeMapper::workflowExecutionInfo), - testCase( - Collections.singletonList(ProtoObjects.WORKFLOW_EXECUTION_INFO), - Collections.singletonList(ThriftObjects.WORKFLOW_EXECUTION_INFO), - TypeMapper::workflowExecutionInfoArray), - testCase( - ProtoObjects.INDEXED_VALUES, - ThriftObjects.INDEXED_VALUES, - TypeMapper::indexedValueTypeMap), - testCase( - ProtoObjects.WORKFLOW_EXECUTION_INFO.getParentExecutionInfo(), - "parentDomainId", - TypeMapper::parentDomainId), - testCase( - ProtoObjects.WORKFLOW_EXECUTION_INFO.getParentExecutionInfo(), - "parentDomainName", - TypeMapper::parentDomainName), - testCase( - ProtoObjects.WORKFLOW_EXECUTION_INFO.getParentExecutionInfo(), - 1L, - TypeMapper::parentInitiatedId), - testCase( - ProtoObjects.WORKFLOW_EXECUTION_INFO.getParentExecutionInfo(), - ThriftObjects.PARENT_WORKFLOW_EXECUTION, - TypeMapper::parentWorkflowExecution), - testCase( - Collections.singletonList(ProtoObjects.PENDING_CHILD_EXECUTION_INFO), - Collections.singletonList(ThriftObjects.PENDING_CHILD_EXECUTION_INFO), - TypeMapper::pendingChildExecutionInfoArray), - testCase( - Collections.singletonList(ProtoObjects.PENDING_ACTIVITY_INFO), - Collections.singletonList(ThriftObjects.PENDING_ACTIVITY_INFO), - TypeMapper::pendingActivityInfoArray), - testCase( - Collections.singletonList(ProtoObjects.RESET_POINT_INFO), - Collections.singletonList(ThriftObjects.RESET_POINT_INFO), - TypeMapper::resetPointInfoArray), - testCase(ProtoObjects.TASK_LIST, ThriftObjects.TASK_LIST, TypeMapper::taskList), - testCase( - ProtoObjects.TASK_LIST_METADATA, - ThriftObjects.TASK_LIST_METADATA, - TypeMapper::taskListMetadata), - testCase(ProtoObjects.RETRY_POLICY, ThriftObjects.RETRY_POLICY, TypeMapper::retryPolicy), - testCase(ProtoObjects.HEADER, ThriftObjects.HEADER, TypeMapper::header), - testCase(ProtoObjects.MEMO, ThriftObjects.MEMO, TypeMapper::memo), - testCase( - ProtoObjects.SEARCH_ATTRIBUTES, - ThriftObjects.SEARCH_ATTRIBUTES, - TypeMapper::searchAttributes), - testCase(ProtoObjects.BAD_BINARIES, ThriftObjects.BAD_BINARIES, TypeMapper::badBinaries), - testCase( - ProtoObjects.CLUSTER_REPLICATION_CONFIGURATION, - ThriftObjects.CLUSTER_REPLICATION_CONFIGURATION, - TypeMapper::clusterReplicationConfiguration), - testCase( - ProtoObjects.WORKFLOW_QUERY, ThriftObjects.WORKFLOW_QUERY, TypeMapper::workflowQuery), - testCase( - ImmutableMap.of("key", ProtoObjects.BAD_BINARY_INFO), - ImmutableMap.of("key", ThriftObjects.BAD_BINARY_INFO), - TypeMapper::badBinaryInfoMap), - testCase( - ImmutableList.of(ProtoObjects.CLUSTER_REPLICATION_CONFIGURATION), - ImmutableList.of(ThriftObjects.CLUSTER_REPLICATION_CONFIGURATION), - TypeMapper::clusterReplicationConfigurationArray), - testCase( - ImmutableMap.of("key", ProtoObjects.WORKFLOW_QUERY), - ImmutableMap.of("key", ThriftObjects.WORKFLOW_QUERY), - TypeMapper::workflowQueryMap), - testCase( - ImmutableMap.of("key", ProtoObjects.ACTIVITY_LOCAL_DISPATCH_INFO), - ImmutableMap.of("key", ThriftObjects.ACTIVITY_LOCAL_DISPATCH_INFO), - TypeMapper::activityLocalDispatchInfoMap), - testCase( - Collections.singletonList(ProtoObjects.DATA_BLOB), - Collections.singletonList(ThriftObjects.DATA_BLOB), - TypeMapper::dataBlobArray), - testCase( - ProtoObjects.DOMAIN, - ThriftObjects.DESCRIBE_DOMAIN_RESPONSE, - TypeMapper::describeDomainResponseDomain), - testCase( - Collections.singletonList(ProtoObjects.DOMAIN), - Collections.singletonList(ThriftObjects.DESCRIBE_DOMAIN_RESPONSE), - TypeMapper::describeDomainResponseArray), - testCase( - Collections.singletonList(ProtoObjects.TASK_LIST_PARTITION_METADATA), - Collections.singletonList(ThriftObjects.TASK_LIST_PARTITION_METADATA), - TypeMapper::taskListPartitionMetadataArray)); - } - - private static Object[] testCase(T from, P to, Function via) { - return new Object[] {from.getClass().getSimpleName(), from, to, via}; - } -} diff --git a/src/test/java/com/uber/cadence/internal/replay/ExecuteActivityParametersTest.java b/src/test/java/com/uber/cadence/internal/replay/ExecuteActivityParametersTest.java index c273d14dd..2b3e9bcc6 100644 --- a/src/test/java/com/uber/cadence/internal/replay/ExecuteActivityParametersTest.java +++ b/src/test/java/com/uber/cadence/internal/replay/ExecuteActivityParametersTest.java @@ -158,7 +158,7 @@ public void testToString() { parameters.setActivityType(activityType); parameters.setInput(new byte[] {10, 20}); String expectedString = - "ExecuteActivityParameters{activityId='toStringTest', activityType=ActivityType(), heartbeatTimeoutSeconds=0, input=[10, 20], scheduleToCloseTimeoutSeconds=0, scheduleToStartTimeoutSeconds=0, startToCloseTimeoutSeconds=0, taskList='null', retryParameters=null, context='null}"; + "ExecuteActivityParameters{activityId='toStringTest', activityType=ActivityType(name=null), heartbeatTimeoutSeconds=0, input=[10, 20], scheduleToCloseTimeoutSeconds=0, scheduleToStartTimeoutSeconds=0, startToCloseTimeoutSeconds=0, taskList='null', retryParameters=null, context='null}"; assertEquals(expectedString, parameters.toString()); } diff --git a/src/test/java/com/uber/cadence/internal/replay/ReplaceDeciderDecisionTaskWithHistoryIteratorTest.java b/src/test/java/com/uber/cadence/internal/replay/ReplaceDeciderDecisionTaskWithHistoryIteratorTest.java index 133251be7..f6ff6523a 100644 --- a/src/test/java/com/uber/cadence/internal/replay/ReplaceDeciderDecisionTaskWithHistoryIteratorTest.java +++ b/src/test/java/com/uber/cadence/internal/replay/ReplaceDeciderDecisionTaskWithHistoryIteratorTest.java @@ -29,7 +29,6 @@ import java.lang.reflect.Method; import java.time.Duration; import java.util.*; -import org.apache.thrift.TException; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; @@ -114,7 +113,7 @@ public void setUp() { @Test public void testGetHistoryWithSinglePageOfEvents() - throws TException, NoSuchMethodException, InvocationTargetException, IllegalAccessException { + throws BaseError, NoSuchMethodException, InvocationTargetException, IllegalAccessException { // Arrange List events = Arrays.asList(createMockHistoryEvent(2), createMockHistoryEvent(3)); History mockHistory = new History().setEvents(events); @@ -142,7 +141,7 @@ public void testGetHistoryWithSinglePageOfEvents() @Test public void testGetHistoryWithMultiplePages() - throws TException, NoSuchMethodException, InvocationTargetException, IllegalAccessException { + throws BaseError, NoSuchMethodException, InvocationTargetException, IllegalAccessException { // First page events List firstPageEvents = Arrays.asList(createMockHistoryEvent(1), createMockHistoryEvent(2)); @@ -192,14 +191,14 @@ public void testGetHistoryWithMultiplePages() @Test(expected = Error.class) public void testGetHistoryFailure() - throws InvocationTargetException, IllegalAccessException, NoSuchMethodException, TException { + throws InvocationTargetException, IllegalAccessException, NoSuchMethodException, BaseError { when(mockService.GetWorkflowExecutionHistory( new GetWorkflowExecutionHistoryRequest() .setDomain(DOMAIN) .setNextPageToken(START_PAGE_TOKEN.getBytes()) .setExecution(WORKFLOW_EXECUTION) .setMaximumPageSize(MAXIMUM_PAGE_SIZE))) - .thenThrow(new TException()); + .thenThrow(new BaseError()); // Act & Assert Method wrapperMethod = iterator.getClass().getMethod("getHistory"); @@ -213,7 +212,7 @@ public void testGetHistoryFailure() @Test(expected = Error.class) public void testEmptyHistory() - throws InvocationTargetException, IllegalAccessException, NoSuchMethodException, TException { + throws InvocationTargetException, IllegalAccessException, NoSuchMethodException, BaseError { when(mockService.GetWorkflowExecutionHistory( new GetWorkflowExecutionHistoryRequest() .setDomain(DOMAIN) diff --git a/src/test/java/com/uber/cadence/internal/replay/ReplayDeciderCacheTests.java b/src/test/java/com/uber/cadence/internal/replay/ReplayDeciderCacheTests.java index 564ad78ea..3e4ee3f4e 100644 --- a/src/test/java/com/uber/cadence/internal/replay/ReplayDeciderCacheTests.java +++ b/src/test/java/com/uber/cadence/internal/replay/ReplayDeciderCacheTests.java @@ -201,7 +201,7 @@ public void evictAnyWillInvalidateAnEntryRandomlyFromTheCache() throws Exception assertEquals(3, replayDeciderCache.size()); - replayDeciderCache.evictAnyNotInProcessing(decisionTask3.workflowExecution.runId); + replayDeciderCache.evictAnyNotInProcessing(decisionTask3.getWorkflowExecution().getRunId()); // Assert assertEquals(2, replayDeciderCache.size()); @@ -226,7 +226,7 @@ public void evictAnyWillNotInvalidateItself() throws Exception { assertEquals(1, replayDeciderCache.size()); - replayDeciderCache.evictAnyNotInProcessing(decisionTask1.workflowExecution.runId); + replayDeciderCache.evictAnyNotInProcessing(decisionTask1.getWorkflowExecution().getRunId()); // Assert assertEquals(1, replayDeciderCache.size()); diff --git a/src/test/java/com/uber/cadence/internal/replay/ReplayDeciderTaskHandlerTests.java b/src/test/java/com/uber/cadence/internal/replay/ReplayDeciderTaskHandlerTests.java index 186141c0a..b51838304 100644 --- a/src/test/java/com/uber/cadence/internal/replay/ReplayDeciderTaskHandlerTests.java +++ b/src/test/java/com/uber/cadence/internal/replay/ReplayDeciderTaskHandlerTests.java @@ -87,7 +87,7 @@ public void ifStickyExecutionAttributesAreSetThenWorkflowsAreCached() throws Thr assertEquals(1, cache.size()); assertNotNull(result.getTaskCompleted()); StickyExecutionAttributes attributes = result.getTaskCompleted().getStickyAttributes(); - assertEquals("sticky", attributes.getWorkerTaskList().name); + assertEquals("sticky", attributes.getWorkerTaskList().getName()); assertEquals(5, attributes.getScheduleToStartTimeoutSeconds()); } diff --git a/src/test/java/com/uber/cadence/internal/replay/WorkflowContextTest.java b/src/test/java/com/uber/cadence/internal/replay/WorkflowContextTest.java index 4eb81b3ac..811ece727 100644 --- a/src/test/java/com/uber/cadence/internal/replay/WorkflowContextTest.java +++ b/src/test/java/com/uber/cadence/internal/replay/WorkflowContextTest.java @@ -24,7 +24,6 @@ import com.uber.cadence.converter.DataConverter; import com.uber.cadence.converter.JsonDataConverter; import com.uber.cadence.workflow.WorkflowUtils; -import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Map; import org.junit.Test; @@ -38,8 +37,8 @@ public void TestMergeSearchAttributes() { WorkflowContext workflowContext = new WorkflowContext("domain", null, startAttr, null); DataConverter converter = JsonDataConverter.getInstance(); - Map indexedFields = new HashMap<>(); - indexedFields.put("CustomKeywordField", ByteBuffer.wrap(converter.toData("key"))); + Map indexedFields = new HashMap<>(); + indexedFields.put("CustomKeywordField", converter.toData("key")); SearchAttributes searchAttributes = new SearchAttributes(); searchAttributes.setIndexedFields(indexedFields); diff --git a/src/test/java/com/uber/cadence/internal/shadowing/NonRetryableExceptionTest.java b/src/test/java/com/uber/cadence/internal/shadowing/NonRetryableExceptionTest.java index 175774112..6148bea0f 100644 --- a/src/test/java/com/uber/cadence/internal/shadowing/NonRetryableExceptionTest.java +++ b/src/test/java/com/uber/cadence/internal/shadowing/NonRetryableExceptionTest.java @@ -15,7 +15,7 @@ */ package com.uber.cadence.internal.shadowing; -import static com.uber.cadence.shadower.shadowerConstants.ErrNonRetryableType; +import static com.uber.cadence.shadower.Constants.ErrNonRetryableType; import static org.junit.Assert.assertEquals; import org.junit.Test; diff --git a/src/test/java/com/uber/cadence/internal/shadowing/ReplayWorkflowActivityTest.java b/src/test/java/com/uber/cadence/internal/shadowing/ReplayWorkflowActivityTest.java index 4e1df82c3..ed17dc8fd 100644 --- a/src/test/java/com/uber/cadence/internal/shadowing/ReplayWorkflowActivityTest.java +++ b/src/test/java/com/uber/cadence/internal/shadowing/ReplayWorkflowActivityTest.java @@ -20,9 +20,7 @@ import static com.uber.cadence.EventType.DecisionTaskStarted; import static com.uber.cadence.EventType.TimerStarted; import static com.uber.cadence.EventType.WorkflowExecutionStarted; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -42,7 +40,6 @@ import com.uber.cadence.WorkflowType; import com.uber.cadence.common.WorkflowExecutionHistory; import com.uber.cadence.converter.JsonDataConverter; -import com.uber.cadence.internal.common.InternalUtils; import com.uber.cadence.internal.testing.WorkflowTestingTest; import com.uber.cadence.serviceclient.IWorkflowService; import com.uber.cadence.testing.TestActivityEnvironment; @@ -144,15 +141,22 @@ public void testGetFullHistory_DecodedHistory_ExpectedSuccessResponse() throws E } @Test - public void testGetFullHistory_RawHistory_ExpectedSuccessResponse() throws Exception { + public void testGetFullHistory_RawHistory_NotSupportedError() throws Exception { History history = new History().setEvents(Lists.newArrayList(historyEvents.get(0))); - DataBlob blob = InternalUtils.SerializeFromHistoryToBlobData(history); + DataBlob blob = new DataBlob().setData(new byte[] {1, 2, 3}); GetWorkflowExecutionHistoryResponse response = new GetWorkflowExecutionHistoryResponse().setRawHistory(Lists.newArrayList(blob)); when(mockServiceClient.GetWorkflowExecutionHistory(any())).thenReturn(response); - WorkflowExecutionHistory result = activity.getFullHistory(domain, execution); - assertEquals(1, result.getEvents().size()); + try { + WorkflowExecutionHistory result = activity.getFullHistory(domain, execution); + } catch (Exception e) { + assertEquals( + "Raw history is not supported. Please turn off frontend.sendRawWorkflowHistory feature flag in frontend service to recover", + e.getMessage()); + return; + } + fail("Expected exception not thrown"); } @Test(expected = Error.class) diff --git a/src/test/java/com/uber/cadence/internal/sync/SyncDecisionContextTest.java b/src/test/java/com/uber/cadence/internal/sync/SyncDecisionContextTest.java index be41e13ab..cc1c48ebd 100644 --- a/src/test/java/com/uber/cadence/internal/sync/SyncDecisionContextTest.java +++ b/src/test/java/com/uber/cadence/internal/sync/SyncDecisionContextTest.java @@ -17,6 +17,7 @@ package com.uber.cadence.internal.sync; +import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -25,6 +26,7 @@ import com.uber.cadence.converter.JsonDataConverter; import com.uber.cadence.internal.common.InternalUtils; import com.uber.cadence.internal.replay.DecisionContext; +import java.util.Arrays; import java.util.HashMap; import java.util.Map; import org.junit.Before; @@ -48,7 +50,13 @@ public void testUpsertSearchAttributes() throws Throwable { SearchAttributes serializedAttr = InternalUtils.convertMapToSearchAttributes(attr); context.upsertSearchAttributes(attr); - verify(mockDecisionContext, times(1)).upsertSearchAttributes(serializedAttr); + verify(mockDecisionContext, times(1)) + .upsertSearchAttributes( + argThat( + s -> + Arrays.equals( + s.getIndexedFields().get("CustomKeywordField"), + serializedAttr.getIndexedFields().get("CustomKeywordField")))); } @Test(expected = IllegalArgumentException.class) diff --git a/src/test/java/com/uber/cadence/internal/sync/TestWorkflowEnvironmentInternalTest.java b/src/test/java/com/uber/cadence/internal/sync/TestWorkflowEnvironmentInternalTest.java index 5aab59220..78cad1f47 100644 --- a/src/test/java/com/uber/cadence/internal/sync/TestWorkflowEnvironmentInternalTest.java +++ b/src/test/java/com/uber/cadence/internal/sync/TestWorkflowEnvironmentInternalTest.java @@ -23,10 +23,10 @@ Modifications copyright (C) 2017 Uber Technologies, Inc. import com.uber.cadence.*; import com.uber.cadence.internal.testservice.TestWorkflowService; +import com.uber.cadence.serviceclient.AsyncMethodCallback; import java.lang.reflect.Field; import java.util.Arrays; import java.util.concurrent.CompletableFuture; -import org.apache.thrift.async.AsyncMethodCallback; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/src/test/java/com/uber/cadence/internal/sync/WorkflowClientInternalTest.java b/src/test/java/com/uber/cadence/internal/sync/WorkflowClientInternalTest.java deleted file mode 100644 index 84facee0c..000000000 --- a/src/test/java/com/uber/cadence/internal/sync/WorkflowClientInternalTest.java +++ /dev/null @@ -1,538 +0,0 @@ -/* - * 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.sync; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import com.uber.cadence.FakeWorkflowServiceRule; -import com.uber.cadence.ServiceBusyError; -import com.uber.cadence.SignalWithStartWorkflowExecutionAsyncResponse; -import com.uber.cadence.SignalWithStartWorkflowExecutionRequest; -import com.uber.cadence.StartWorkflowExecutionAsyncRequest; -import com.uber.cadence.StartWorkflowExecutionAsyncResponse; -import com.uber.cadence.StartWorkflowExecutionResponse; -import com.uber.cadence.WorkflowExecution; -import com.uber.cadence.WorkflowService; -import com.uber.cadence.WorkflowType; -import com.uber.cadence.client.BatchRequest; -import com.uber.cadence.client.WorkflowClient; -import com.uber.cadence.client.WorkflowClientOptions; -import com.uber.cadence.client.WorkflowOptions; -import com.uber.cadence.client.WorkflowStub; -import com.uber.cadence.workflow.SignalMethod; -import com.uber.cadence.workflow.WorkflowMethod; -import io.opentracing.mock.MockSpan; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.Duration; -import java.util.Optional; -import java.util.concurrent.CompletableFuture; -import org.apache.commons.io.Charsets; -import org.junit.Before; -import org.junit.ClassRule; -import org.junit.Test; - -public class WorkflowClientInternalTest { - - @ClassRule public static FakeWorkflowServiceRule fakeService = new FakeWorkflowServiceRule(); - - private WorkflowClient client; - - @Before - public void setup() throws Exception { - fakeService.resetStubs(); - client = - WorkflowClient.newInstance( - fakeService.getClient(), - WorkflowClientOptions.newBuilder().setDomain("domain").build()); - } - - @Test - public void testEnqueueStart() throws Exception { - CompletableFuture requestFuture = - fakeService.stubSuccess( - "WorkflowService::StartWorkflowExecutionAsync", - WorkflowService.StartWorkflowExecutionAsync_args.class, - new WorkflowService.StartWorkflowExecutionAsync_result() - .setSuccess(new StartWorkflowExecutionAsyncResponse())); - - WorkflowStub stub = - client.newUntypedWorkflowStub( - "type", - new WorkflowOptions.Builder() - .setExecutionStartToCloseTimeout(Duration.ofSeconds(1)) - .setTaskStartToCloseTimeout(Duration.ofSeconds(2)) - .setWorkflowId("workflowId") - .setTaskList("taskList") - .build()); - stub.enqueueStart("input"); - - StartWorkflowExecutionAsyncRequest request = requestFuture.getNow(null).getStartRequest(); - assertEquals(new WorkflowType().setName("type"), request.getRequest().getWorkflowType()); - assertEquals("workflowId", request.getRequest().getWorkflowId()); - assertEquals(1, request.getRequest().getExecutionStartToCloseTimeoutSeconds()); - assertEquals(2, request.getRequest().getTaskStartToCloseTimeoutSeconds()); - assertEquals("domain", request.getRequest().getDomain()); - assertEquals("taskList", request.getRequest().getTaskList().getName()); - assertEquals("\"input\"", StandardCharsets.UTF_8.decode(request.request.input).toString()); - assertNotNull(request.getRequest().getRequestId()); - } - - @Test - public void testEnqueueStart_includesTracing() { - CompletableFuture requestFuture = - fakeService.stubSuccess( - "WorkflowService::StartWorkflowExecutionAsync", - WorkflowService.StartWorkflowExecutionAsync_args.class, - new WorkflowService.StartWorkflowExecutionAsync_result() - .setSuccess(new StartWorkflowExecutionAsyncResponse())); - - WorkflowStub stub = - client.newUntypedWorkflowStub( - "type", - new WorkflowOptions.Builder() - .setExecutionStartToCloseTimeout(Duration.ofSeconds(1)) - .setTaskStartToCloseTimeout(Duration.ofSeconds(2)) - .setWorkflowId("workflowId") - .setTaskList("taskList") - .build()); - stub.enqueueStart("input"); - - StartWorkflowExecutionAsyncRequest request = requestFuture.getNow(null).getStartRequest(); - assertEquals(1, fakeService.getTracer().finishedSpans().size()); - MockSpan mockSpan = fakeService.getTracer().finishedSpans().get(0); - assertEquals( - mockSpan.context().toTraceId(), - Charsets.UTF_8 - .decode(request.getRequest().getHeader().getFields().get("traceid")) - .toString()); - assertEquals( - mockSpan.context().toSpanId(), - Charsets.UTF_8 - .decode(request.getRequest().getHeader().getFields().get("spanid")) - .toString()); - } - - interface TestWorkflow { - @WorkflowMethod( - taskList = "taskList", - executionStartToCloseTimeoutSeconds = 1, - taskStartToCloseTimeoutSeconds = 2 - ) - void test(String input); - } - - @Test - public void testEnqueueStart_stronglyTyped() throws Exception { - CompletableFuture requestFuture = - fakeService.stubSuccess( - "WorkflowService::StartWorkflowExecutionAsync", - WorkflowService.StartWorkflowExecutionAsync_args.class, - new WorkflowService.StartWorkflowExecutionAsync_result() - .setSuccess(new StartWorkflowExecutionAsyncResponse())); - - TestWorkflow stub = - client.newWorkflowStub( - TestWorkflow.class, - new WorkflowOptions.Builder() - .setExecutionStartToCloseTimeout(Duration.ofSeconds(1)) - .setTaskStartToCloseTimeout(Duration.ofSeconds(2)) - .setWorkflowId("workflowId") - .setTaskList("taskList") - .build()); - - WorkflowExecution execution = WorkflowClient.enqueueStart(stub::test, "input"); - - assertEquals(new WorkflowExecution().setWorkflowId("workflowId"), execution); - StartWorkflowExecutionAsyncRequest request = requestFuture.getNow(null).getStartRequest(); - assertEquals( - new WorkflowType().setName("TestWorkflow::test"), request.getRequest().getWorkflowType()); - assertEquals("workflowId", request.getRequest().getWorkflowId()); - assertEquals(1, request.getRequest().getExecutionStartToCloseTimeoutSeconds()); - assertEquals(2, request.getRequest().getTaskStartToCloseTimeoutSeconds()); - assertEquals("domain", request.getRequest().getDomain()); - assertEquals("taskList", request.getRequest().getTaskList().getName()); - assertEquals("\"input\"", StandardCharsets.UTF_8.decode(request.request.input).toString()); - assertNotNull(request.getRequest().getRequestId()); - } - - @Test - public void testEnqueueStartAsync() { - CompletableFuture requestFuture = - fakeService.stubSuccess( - "WorkflowService::StartWorkflowExecutionAsync", - WorkflowService.StartWorkflowExecutionAsync_args.class, - new WorkflowService.StartWorkflowExecutionAsync_result() - .setSuccess(new StartWorkflowExecutionAsyncResponse())); - - WorkflowStub stub = - client.newUntypedWorkflowStub( - "type", - new WorkflowOptions.Builder() - .setExecutionStartToCloseTimeout(Duration.ofSeconds(1)) - .setTaskStartToCloseTimeout(Duration.ofSeconds(2)) - .setWorkflowId("workflowId") - .setTaskList("taskList") - .build()); - stub.enqueueStartAsync("input").join(); - - StartWorkflowExecutionAsyncRequest request = requestFuture.getNow(null).getStartRequest(); - assertEquals(new WorkflowType().setName("type"), request.getRequest().getWorkflowType()); - assertEquals("workflowId", request.getRequest().getWorkflowId()); - assertEquals(1, request.getRequest().getExecutionStartToCloseTimeoutSeconds()); - assertEquals(2, request.getRequest().getTaskStartToCloseTimeoutSeconds()); - assertEquals("domain", request.getRequest().getDomain()); - assertEquals("taskList", request.getRequest().getTaskList().getName()); - assertEquals("\"input\"", StandardCharsets.UTF_8.decode(request.request.input).toString()); - assertNotNull(request.getRequest().getRequestId()); - } - - @Test - public void testEnqueueSignalWithStart() { - CompletableFuture requestFuture = - fakeService.stubSuccess( - "WorkflowService::SignalWithStartWorkflowExecutionAsync", - WorkflowService.SignalWithStartWorkflowExecutionAsync_args.class, - new WorkflowService.SignalWithStartWorkflowExecutionAsync_result() - .setSuccess(new SignalWithStartWorkflowExecutionAsyncResponse())); - - WorkflowStub stub = - client.newUntypedWorkflowStub( - "type", - new WorkflowOptions.Builder() - .setExecutionStartToCloseTimeout(Duration.ofSeconds(1)) - .setTaskStartToCloseTimeout(Duration.ofSeconds(2)) - .setWorkflowId("workflowId") - .setTaskList("taskList") - .build()); - WorkflowExecution execution = - stub.enqueueSignalWithStart( - "signalName", new Object[] {"signalValue"}, new Object[] {"startValue"}); - - assertEquals(new WorkflowExecution().setWorkflowId("workflowId"), execution); - - SignalWithStartWorkflowExecutionRequest request = - requestFuture.getNow(null).getSignalWithStartRequest().getRequest(); - assertEquals(new WorkflowType().setName("type"), request.getWorkflowType()); - assertEquals("workflowId", request.getWorkflowId()); - assertEquals(1, request.getExecutionStartToCloseTimeoutSeconds()); - assertEquals(2, request.getTaskStartToCloseTimeoutSeconds()); - assertEquals("domain", request.getDomain()); - assertEquals("taskList", request.getTaskList().getName()); - assertEquals( - "\"startValue\"", - StandardCharsets.UTF_8.decode(ByteBuffer.wrap(request.getInput())).toString()); - assertEquals("signalName", request.getSignalName()); - assertEquals( - "\"signalValue\"", - StandardCharsets.UTF_8.decode(ByteBuffer.wrap(request.getSignalInput())).toString()); - assertNotNull(request.getRequestId()); - } - - @Test - public void testEnqueueSignalWithStart_includesTracing() { - CompletableFuture requestFuture = - fakeService.stubSuccess( - "WorkflowService::SignalWithStartWorkflowExecutionAsync", - WorkflowService.SignalWithStartWorkflowExecutionAsync_args.class, - new WorkflowService.SignalWithStartWorkflowExecutionAsync_result() - .setSuccess(new SignalWithStartWorkflowExecutionAsyncResponse())); - - WorkflowStub stub = - client.newUntypedWorkflowStub( - "type", - new WorkflowOptions.Builder() - .setExecutionStartToCloseTimeout(Duration.ofSeconds(1)) - .setTaskStartToCloseTimeout(Duration.ofSeconds(2)) - .setWorkflowId("workflowId") - .setTaskList("taskList") - .build()); - stub.enqueueSignalWithStart( - "signalName", new Object[] {"signalValue"}, new Object[] {"startValue"}); - - SignalWithStartWorkflowExecutionRequest request = - requestFuture.getNow(null).getSignalWithStartRequest().getRequest(); - assertEquals(1, fakeService.getTracer().finishedSpans().size()); - MockSpan mockSpan = fakeService.getTracer().finishedSpans().get(0); - assertEquals( - mockSpan.context().toTraceId(), - Charsets.UTF_8.decode(request.getHeader().getFields().get("traceid")).toString()); - assertEquals( - mockSpan.context().toSpanId(), - Charsets.UTF_8.decode(request.getHeader().getFields().get("spanid")).toString()); - } - - interface TestSignalWorkflow { - @WorkflowMethod( - taskList = "taskList", - executionStartToCloseTimeoutSeconds = 1, - taskStartToCloseTimeoutSeconds = 2 - ) - void test(String input); - - @SignalMethod - void signal(String input); - } - - @Test - public void testEnqueueSignalWithStart_stronglyTyped() { - CompletableFuture requestFuture = - fakeService.stubSuccess( - "WorkflowService::SignalWithStartWorkflowExecutionAsync", - WorkflowService.SignalWithStartWorkflowExecutionAsync_args.class, - new WorkflowService.SignalWithStartWorkflowExecutionAsync_result() - .setSuccess(new SignalWithStartWorkflowExecutionAsyncResponse())); - - TestSignalWorkflow stub = - client.newWorkflowStub( - TestSignalWorkflow.class, - new WorkflowOptions.Builder() - .setExecutionStartToCloseTimeout(Duration.ofSeconds(1)) - .setTaskStartToCloseTimeout(Duration.ofSeconds(2)) - .setWorkflowId("workflowId") - .setTaskList("taskList") - .build()); - - BatchRequest batch = client.newSignalWithStartRequest(); - batch.add(stub::test, "startValue"); - batch.add(stub::signal, "signalValue"); - WorkflowExecution execution = client.enqueueSignalWithStart(batch); - - assertEquals(new WorkflowExecution().setWorkflowId("workflowId"), execution); - - SignalWithStartWorkflowExecutionRequest request = - requestFuture.getNow(null).getSignalWithStartRequest().getRequest(); - assertEquals(new WorkflowType().setName("TestSignalWorkflow::test"), request.getWorkflowType()); - assertEquals("workflowId", request.getWorkflowId()); - assertEquals(1, request.getExecutionStartToCloseTimeoutSeconds()); - assertEquals(2, request.getTaskStartToCloseTimeoutSeconds()); - assertEquals("domain", request.getDomain()); - assertEquals("taskList", request.getTaskList().getName()); - assertEquals( - "\"startValue\"", - StandardCharsets.UTF_8.decode(ByteBuffer.wrap(request.getInput())).toString()); - assertEquals("TestSignalWorkflow::signal", request.getSignalName()); - assertEquals( - "\"signalValue\"", - StandardCharsets.UTF_8.decode(ByteBuffer.wrap(request.getSignalInput())).toString()); - assertNotNull(request.getRequestId()); - } - - @Test - public void testEnqueueSignalWithStart_usesConsistentRequestId() { - CompletableFuture firstAttempt = - fakeService.stubError( - "WorkflowService::SignalWithStartWorkflowExecutionAsync", - WorkflowService.SignalWithStartWorkflowExecutionAsync_args.class, - new WorkflowService.SignalWithStartWorkflowExecutionAsync_result() - .setServiceBusyError(new ServiceBusyError("try again later"))); - CompletableFuture secondAttempt = - fakeService.stubSuccess( - "WorkflowService::SignalWithStartWorkflowExecutionAsync", - WorkflowService.SignalWithStartWorkflowExecutionAsync_args.class, - new WorkflowService.SignalWithStartWorkflowExecutionAsync_result() - .setSuccess(new SignalWithStartWorkflowExecutionAsyncResponse())); - - TestSignalWorkflow stub = - client.newWorkflowStub( - TestSignalWorkflow.class, - new WorkflowOptions.Builder() - .setExecutionStartToCloseTimeout(Duration.ofSeconds(1)) - .setTaskStartToCloseTimeout(Duration.ofSeconds(2)) - .setWorkflowId("workflowId") - .setTaskList("taskList") - .build()); - - BatchRequest batch = client.newSignalWithStartRequest(); - batch.add(stub::test, "startValue"); - batch.add(stub::signal, "signalValue"); - client.enqueueSignalWithStart(batch); - - assertTrue("first request was not made", firstAttempt.isDone()); - assertTrue("second request was not made", secondAttempt.isDone()); - String firstRequestId = - firstAttempt.getNow(null).getSignalWithStartRequest().getRequest().getRequestId(); - String secondRequestId = - secondAttempt.getNow(null).getSignalWithStartRequest().getRequest().getRequestId(); - assertNotNull("first request must have a request id", firstRequestId); - assertEquals(firstRequestId, secondRequestId); - } - - @Test - public void testEnqueueStart_usesConsistentRequestId() { - CompletableFuture firstAttempt = - fakeService.stubError( - "WorkflowService::StartWorkflowExecutionAsync", - WorkflowService.StartWorkflowExecutionAsync_args.class, - new WorkflowService.StartWorkflowExecutionAsync_result() - .setServiceBusyError(new ServiceBusyError("try again later"))); - CompletableFuture secondAttempt = - fakeService.stubSuccess( - "WorkflowService::StartWorkflowExecutionAsync", - WorkflowService.StartWorkflowExecutionAsync_args.class, - new WorkflowService.StartWorkflowExecutionAsync_result() - .setSuccess(new StartWorkflowExecutionAsyncResponse())); - - TestWorkflow stub = - client.newWorkflowStub( - TestWorkflow.class, - new WorkflowOptions.Builder() - .setExecutionStartToCloseTimeout(Duration.ofSeconds(1)) - .setTaskStartToCloseTimeout(Duration.ofSeconds(2)) - .setWorkflowId("workflowId") - .setTaskList("taskList") - .build()); - - WorkflowClient.enqueueStart(stub::test, "input"); - - assertTrue("first request was not made", firstAttempt.isDone()); - assertTrue("second request was not made", secondAttempt.isDone()); - String firstRequestId = firstAttempt.getNow(null).getStartRequest().getRequest().getRequestId(); - String secondRequestId = - secondAttempt.getNow(null).getStartRequest().getRequest().getRequestId(); - assertNotNull("first request must have a request id", firstRequestId); - assertEquals(firstRequestId, secondRequestId); - } - - @Test - public void testStartWorkflow_usesConsistentRequestId() { - CompletableFuture firstAttempt = - fakeService.stubError( - "WorkflowService::StartWorkflowExecution", - WorkflowService.StartWorkflowExecution_args.class, - new WorkflowService.StartWorkflowExecution_result() - .setServiceBusyError(new ServiceBusyError("try again later"))); - CompletableFuture secondAttempt = - fakeService.stubSuccess( - "WorkflowService::StartWorkflowExecution", - WorkflowService.StartWorkflowExecution_args.class, - new WorkflowService.StartWorkflowExecution_result() - .setSuccess(new StartWorkflowExecutionResponse().setRunId("foo"))); - - TestWorkflow stub = - client.newWorkflowStub( - TestWorkflow.class, - new WorkflowOptions.Builder() - .setExecutionStartToCloseTimeout(Duration.ofSeconds(1)) - .setTaskStartToCloseTimeout(Duration.ofSeconds(2)) - .setWorkflowId("workflowId") - .setTaskList("taskList") - .build()); - - WorkflowClient.start(stub::test, "input"); - - assertTrue("first request was not made", firstAttempt.isDone()); - assertTrue("second request was not made", secondAttempt.isDone()); - String firstRequestId = firstAttempt.getNow(null).getStartRequest().requestId; - String secondRequestId = secondAttempt.getNow(null).getStartRequest().requestId; - assertNotNull("first request must have a request id", firstRequestId); - assertEquals(firstRequestId, secondRequestId); - } - - @Test - public void testSignalWithStartWorkflow_usesConsistentRequestId() { - CompletableFuture firstAttempt = - fakeService.stubError( - "WorkflowService::SignalWithStartWorkflowExecution", - WorkflowService.SignalWithStartWorkflowExecution_args.class, - new WorkflowService.SignalWithStartWorkflowExecution_result() - .setServiceBusyError(new ServiceBusyError("try again later"))); - CompletableFuture secondAttempt = - fakeService.stubSuccess( - "WorkflowService::SignalWithStartWorkflowExecution", - WorkflowService.SignalWithStartWorkflowExecution_args.class, - new WorkflowService.SignalWithStartWorkflowExecution_result() - .setSuccess(new StartWorkflowExecutionResponse().setRunId("foo"))); - - TestSignalWorkflow stub = - client.newWorkflowStub( - TestSignalWorkflow.class, - new WorkflowOptions.Builder() - .setExecutionStartToCloseTimeout(Duration.ofSeconds(1)) - .setTaskStartToCloseTimeout(Duration.ofSeconds(2)) - .setWorkflowId("workflowId") - .setTaskList("taskList") - .build()); - - BatchRequest batch = client.newSignalWithStartRequest(); - batch.add(stub::test, "startValue"); - batch.add(stub::signal, "signalValue"); - client.signalWithStart(batch); - - assertTrue("first request was not made", firstAttempt.isDone()); - assertTrue("second request was not made", secondAttempt.isDone()); - String firstRequestId = firstAttempt.getNow(null).getSignalWithStartRequest().requestId; - String secondRequestId = secondAttempt.getNow(null).getSignalWithStartRequest().requestId; - assertNotNull("first request must have a request id", firstRequestId); - assertEquals(firstRequestId, secondRequestId); - } - - @Test - public void testSignalWorkflow_usesConsistentRequestId() { - CompletableFuture firstAttempt = - fakeService.stubError( - "WorkflowService::SignalWorkflowExecution", - WorkflowService.SignalWorkflowExecution_args.class, - new WorkflowService.SignalWorkflowExecution_result() - .setServiceBusyError(new ServiceBusyError("try again later"))); - CompletableFuture secondAttempt = - fakeService.stubSuccess( - "WorkflowService::SignalWorkflowExecution", - WorkflowService.SignalWorkflowExecution_args.class, - new WorkflowService.SignalWorkflowExecution_result()); - - TestSignalWorkflow stub = client.newWorkflowStub(TestSignalWorkflow.class, "workflowId"); - - stub.signal("signalValue"); - - assertTrue("first request was not made", firstAttempt.isDone()); - assertTrue("second request was not made", secondAttempt.isDone()); - String firstRequestId = firstAttempt.getNow(null).getSignalRequest().getRequestId(); - String secondRequestId = secondAttempt.getNow(null).getSignalRequest().getRequestId(); - assertNotNull("first request must have a request id", firstRequestId); - assertEquals(firstRequestId, secondRequestId); - } - - @Test - public void testCancel_usesConsistentRequestId() { - CompletableFuture firstAttempt = - fakeService.stubError( - "WorkflowService::RequestCancelWorkflowExecution", - WorkflowService.RequestCancelWorkflowExecution_args.class, - new WorkflowService.RequestCancelWorkflowExecution_result() - .setServiceBusyError(new ServiceBusyError("try again later"))); - CompletableFuture secondAttempt = - fakeService.stubSuccess( - "WorkflowService::RequestCancelWorkflowExecution", - WorkflowService.RequestCancelWorkflowExecution_args.class, - new WorkflowService.RequestCancelWorkflowExecution_result()); - - WorkflowStub stub = - client.newUntypedWorkflowStub("workflowId", Optional.empty(), Optional.empty()); - stub.cancel(); - - assertTrue("first request was not made", firstAttempt.isDone()); - assertTrue("second request was not made", secondAttempt.isDone()); - String firstRequestId = firstAttempt.getNow(null).getCancelRequest().getRequestId(); - String secondRequestId = secondAttempt.getNow(null).getCancelRequest().getRequestId(); - assertNotNull("first request must have a request id", firstRequestId); - assertEquals(firstRequestId, secondRequestId); - } -} diff --git a/src/test/java/com/uber/cadence/internal/testing/ActivityTestingTest.java b/src/test/java/com/uber/cadence/internal/testing/ActivityTestingTest.java index 9275c6891..53a58a1bc 100644 --- a/src/test/java/com/uber/cadence/internal/testing/ActivityTestingTest.java +++ b/src/test/java/com/uber/cadence/internal/testing/ActivityTestingTest.java @@ -24,6 +24,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import com.uber.cadence.BaseError; import com.uber.cadence.RecordActivityTaskHeartbeatResponse; import com.uber.cadence.activity.Activity; import com.uber.cadence.activity.ActivityMethod; @@ -35,7 +36,6 @@ import java.io.IOException; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; -import org.apache.thrift.TException; import org.junit.Before; import org.junit.Test; @@ -180,7 +180,7 @@ public void activity1() throws InterruptedException { } @Test - public void testHeartbeatCancellation() throws InterruptedException, TException { + public void testHeartbeatCancellation() throws InterruptedException, BaseError { testEnvironment.registerActivitiesImplementations(new HeartbeatCancellationActivityImpl()); IWorkflowService workflowService = mock(IWorkflowService.class); RecordActivityTaskHeartbeatResponse resp = new RecordActivityTaskHeartbeatResponse(); @@ -211,7 +211,7 @@ public void activity1() throws InterruptedException { } @Test - public void testCancellationOnNextHeartbeat() throws InterruptedException, TException { + public void testCancellationOnNextHeartbeat() throws InterruptedException, BaseError { testEnvironment.registerActivitiesImplementations( new CancellationOnNextHeartbeatActivityImpl()); IWorkflowService workflowService = mock(IWorkflowService.class); @@ -237,12 +237,12 @@ public void activity1() throws InterruptedException { } @Test - public void testHeartbeatIntermittentError() throws TException, InterruptedException { + public void testHeartbeatIntermittentError() throws BaseError, InterruptedException { testEnvironment.registerActivitiesImplementations(new SimpleHeartbeatActivityImpl()); IWorkflowService workflowService = mock(IWorkflowService.class); when(workflowService.RecordActivityTaskHeartbeat(any())) - .thenThrow(new TException("intermittent error")) - .thenThrow(new TException("intermittent error")) + .thenThrow(new BaseError("intermittent error")) + .thenThrow(new BaseError("intermittent error")) .thenReturn(new RecordActivityTaskHeartbeatResponse()); testEnvironment.setWorkflowService(workflowService); AtomicInteger count = new AtomicInteger(); diff --git a/src/test/java/com/uber/cadence/internal/testing/WorkflowStickynessTest.java b/src/test/java/com/uber/cadence/internal/testing/WorkflowStickynessTest.java index 3e9bd0bd4..750fe92f3 100644 --- a/src/test/java/com/uber/cadence/internal/testing/WorkflowStickynessTest.java +++ b/src/test/java/com/uber/cadence/internal/testing/WorkflowStickynessTest.java @@ -63,18 +63,18 @@ public void taskCompletionWithStickyExecutionAttributesWillScheduleDecisionsOnSt TestServiceUtils.pollForDecisionTask(DOMAIN, createNormalTaskList(TASK_LIST), service); TestServiceUtils.respondDecisionTaskCompletedWithSticky( - response.taskToken, HOST_TASKLIST, service); - TestServiceUtils.signalWorkflow(response.workflowExecution, DOMAIN, service); + response.getTaskToken(), HOST_TASKLIST, service); + TestServiceUtils.signalWorkflow(response.getWorkflowExecution(), DOMAIN, service); response = TestServiceUtils.pollForDecisionTask(DOMAIN, createStickyTaskList(HOST_TASKLIST), service); - assertEquals(4, response.history.getEventsSize()); + assertEquals(4, response.getHistory().getEvents().size()); assertEquals(TASK_LIST, response.getWorkflowExecutionTaskList().getName()); - List events = response.history.getEvents(); - assertEquals(EventType.DecisionTaskCompleted, events.get(0).eventType); - assertEquals(EventType.WorkflowExecutionSignaled, events.get(1).eventType); - assertEquals(EventType.DecisionTaskScheduled, events.get(2).eventType); - assertEquals(EventType.DecisionTaskStarted, events.get(3).eventType); + List events = response.getHistory().getEvents(); + assertEquals(EventType.DecisionTaskCompleted, events.get(0).getEventType()); + assertEquals(EventType.WorkflowExecutionSignaled, events.get(1).getEventType()); + assertEquals(EventType.DecisionTaskScheduled, events.get(2).getEventType()); + assertEquals(EventType.DecisionTaskStarted, events.get(3).getEventType()); } @Test @@ -84,19 +84,20 @@ public void taskFailureWillRescheduleTheTaskOnTheGlobalList() throws Exception { TestServiceUtils.pollForDecisionTask(DOMAIN, createNormalTaskList(TASK_LIST), service); TestServiceUtils.respondDecisionTaskCompletedWithSticky( - response.taskToken, HOST_TASKLIST, service); - TestServiceUtils.signalWorkflow(response.workflowExecution, DOMAIN, service); + response.getTaskToken(), HOST_TASKLIST, service); + TestServiceUtils.signalWorkflow(response.getWorkflowExecution(), DOMAIN, service); response = TestServiceUtils.pollForDecisionTask(DOMAIN, createStickyTaskList(HOST_TASKLIST), service); - TestServiceUtils.respondDecisionTaskFailedWithSticky(response.taskToken, service); + TestServiceUtils.respondDecisionTaskFailedWithSticky(response.getTaskToken(), service); response = TestServiceUtils.pollForDecisionTask(DOMAIN, createNormalTaskList(TASK_LIST), service); // Assert Full history // Make sure first is workflow execution started - assertNotNull(response.history.events.get(0).getWorkflowExecutionStartedEventAttributes()); + assertNotNull( + response.getHistory().getEvents().get(0).getWorkflowExecutionStartedEventAttributes()); // 10 is the expected number of events for the full history. - assertEquals(10, response.history.getEventsSize()); + assertEquals(10, response.getHistory().getEvents().size()); } @Test @@ -106,8 +107,8 @@ public void taskTimeoutWillRescheduleTheTaskOnTheGlobalList() throws Exception { TestServiceUtils.pollForDecisionTask(DOMAIN, createNormalTaskList(TASK_LIST), service); TestServiceUtils.respondDecisionTaskCompletedWithSticky( - response.taskToken, HOST_TASKLIST, 1, service); - TestServiceUtils.signalWorkflow(response.workflowExecution, DOMAIN, service); + response.getTaskToken(), HOST_TASKLIST, 1, service); + TestServiceUtils.signalWorkflow(response.getWorkflowExecution(), DOMAIN, service); TestServiceUtils.pollForDecisionTask(DOMAIN, createStickyTaskList(HOST_TASKLIST), service); service.unlockTimeSkipping(CALLER); service.sleep(Duration.ofMillis(1100)); @@ -117,8 +118,9 @@ public void taskTimeoutWillRescheduleTheTaskOnTheGlobalList() throws Exception { // Assert Full history // Make sure first is workflow execution started - assertNotNull(response.history.events.get(0).getWorkflowExecutionStartedEventAttributes()); + assertNotNull( + response.getHistory().getEvents().get(0).getWorkflowExecutionStartedEventAttributes()); // 10 is the expected number of events for the full history. - assertEquals(10, response.history.getEventsSize()); + assertEquals(10, response.getHistory().getEvents().size()); } } diff --git a/src/test/java/com/uber/cadence/internal/testing/WorkflowTestingTest.java b/src/test/java/com/uber/cadence/internal/testing/WorkflowTestingTest.java index 08051a726..aa5583946 100644 --- a/src/test/java/com/uber/cadence/internal/testing/WorkflowTestingTest.java +++ b/src/test/java/com/uber/cadence/internal/testing/WorkflowTestingTest.java @@ -22,17 +22,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import com.uber.cadence.EventType; -import com.uber.cadence.GetWorkflowExecutionHistoryRequest; -import com.uber.cadence.History; -import com.uber.cadence.HistoryEvent; -import com.uber.cadence.ListClosedWorkflowExecutionsRequest; -import com.uber.cadence.ListClosedWorkflowExecutionsResponse; -import com.uber.cadence.ListOpenWorkflowExecutionsRequest; -import com.uber.cadence.ListOpenWorkflowExecutionsResponse; -import com.uber.cadence.TimeoutType; -import com.uber.cadence.WorkflowExecution; -import com.uber.cadence.WorkflowExecutionInfo; +import com.uber.cadence.*; import com.uber.cadence.activity.Activity; import com.uber.cadence.activity.ActivityMethod; import com.uber.cadence.activity.ActivityOptions; @@ -50,7 +40,6 @@ import java.util.concurrent.CancellationException; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; -import org.apache.thrift.TException; import org.junit.After; import org.junit.Before; import org.junit.Rule; @@ -543,7 +532,7 @@ public String workflow1(String input) { } @Test - public void testTimerCancellation() throws TException { + public void testTimerCancellation() throws BaseError { Worker worker = testEnvironment.newWorker(TASK_LIST); worker.registerWorkflowImplementationTypes(TestTimerCancellationWorkflow.class); worker.registerActivitiesImplementations(new ActivityImpl()); diff --git a/src/test/java/com/uber/cadence/internal/tracing/StartWorkflowTest.java b/src/test/java/com/uber/cadence/internal/tracing/StartWorkflowTest.java index 23b39f000..a0b1cb904 100644 --- a/src/test/java/com/uber/cadence/internal/tracing/StartWorkflowTest.java +++ b/src/test/java/com/uber/cadence/internal/tracing/StartWorkflowTest.java @@ -25,11 +25,9 @@ import com.uber.cadence.activity.ActivityOptions; import com.uber.cadence.client.*; import com.uber.cadence.common.RetryOptions; -import com.uber.cadence.internal.compatibility.Thrift2ProtoAdapter; -import com.uber.cadence.internal.compatibility.proto.serviceclient.IGrpcServiceStubs; import com.uber.cadence.serviceclient.ClientOptions; import com.uber.cadence.serviceclient.IWorkflowService; -import com.uber.cadence.serviceclient.WorkflowServiceTChannel; +import com.uber.cadence.serviceclient.WorkflowServiceGrpc; import com.uber.cadence.testUtils.TestEnvironment; import com.uber.cadence.worker.Worker; import com.uber.cadence.worker.WorkerFactory; @@ -144,23 +142,13 @@ public Integer Double(Integer n) { private static final String DOMAIN = "test-domain"; private static final String TASK_LIST = "test-tasklist"; - @Test - public void testStartWorkflowTchannel() { - Assume.assumeTrue(useDockerService); - MockTracer mockTracer = new MockTracer(); - IWorkflowService service = - new WorkflowServiceTChannel(ClientOptions.newBuilder().setTracer(mockTracer).build()); - testStartWorkflowHelper(service, mockTracer, true); - } - @Test public void testStartWorkflowGRPC() { Assume.assumeTrue(useDockerService); MockTracer mockTracer = new MockTracer(); IWorkflowService service = - new Thrift2ProtoAdapter( - IGrpcServiceStubs.newInstance( - ClientOptions.newBuilder().setTracer(mockTracer).setPort(7833).build())); + new WorkflowServiceGrpc( + ClientOptions.newBuilder().setTracer(mockTracer).setPort(7833).build()); testStartWorkflowHelper(service, mockTracer, true); } @@ -169,9 +157,8 @@ public void testStartMultipleWorkflowGRPC() { Assume.assumeTrue(useDockerService); MockTracer mockTracer = new MockTracer(); IWorkflowService service = - new Thrift2ProtoAdapter( - IGrpcServiceStubs.newInstance( - ClientOptions.newBuilder().setTracer(mockTracer).setPort(7833).build())); + new WorkflowServiceGrpc( + ClientOptions.newBuilder().setTracer(mockTracer).setPort(7833).build()); try { service.RegisterDomain(new RegisterDomainRequest().setName(DOMAIN)); } catch (DomainAlreadyExistsError e) { @@ -243,59 +230,31 @@ public void testStartMultipleWorkflowGRPC() { } } - @Test - public void testSignalWithStartWorkflowTchannel() { - Assume.assumeTrue(useDockerService); - MockTracer mockTracer = new MockTracer(); - IWorkflowService service = - new WorkflowServiceTChannel(ClientOptions.newBuilder().setTracer(mockTracer).build()); - testSignalWithStartWorkflowHelper(service, mockTracer, true); - } - @Test public void testSignalWithStartWorkflowGRPC() { Assume.assumeTrue(useDockerService); MockTracer mockTracer = new MockTracer(); IWorkflowService service = - new Thrift2ProtoAdapter( - IGrpcServiceStubs.newInstance( - ClientOptions.newBuilder().setTracer(mockTracer).setPort(7833).build())); + new WorkflowServiceGrpc( + ClientOptions.newBuilder().setTracer(mockTracer).setPort(7833).build()); testSignalWithStartWorkflowHelper(service, mockTracer, true); } - @Test - public void testStartWorkflowTchannelNoPropagation() { - Assume.assumeTrue(useDockerService); - MockTracer mockTracer = new MockTracer(); - IWorkflowService service = new WorkflowServiceTChannel(ClientOptions.newBuilder().build()); - testStartWorkflowHelper(service, mockTracer, false); - } - @Test public void testStartWorkflowGRPCNoPropagation() { Assume.assumeTrue(useDockerService); MockTracer mockTracer = new MockTracer(); IWorkflowService service = - new Thrift2ProtoAdapter( - IGrpcServiceStubs.newInstance(ClientOptions.newBuilder().setPort(7833).build())); + new WorkflowServiceGrpc(ClientOptions.newBuilder().setPort(7833).build()); testStartWorkflowHelper(service, mockTracer, false); } - @Test - public void testSignalStartWorkflowTchannelNoPropagation() { - Assume.assumeTrue(useDockerService); - MockTracer mockTracer = new MockTracer(); - IWorkflowService service = new WorkflowServiceTChannel(ClientOptions.newBuilder().build()); - testSignalWithStartWorkflowHelper(service, mockTracer, false); - } - @Test public void testSignalStartWorkflowGRPCNoPropagation() { Assume.assumeTrue(useDockerService); MockTracer mockTracer = new MockTracer(); IWorkflowService service = - new Thrift2ProtoAdapter( - IGrpcServiceStubs.newInstance(ClientOptions.newBuilder().setPort(7833).build())); + new WorkflowServiceGrpc(ClientOptions.newBuilder().setPort(7833).build()); testSignalWithStartWorkflowHelper(service, mockTracer, false); } diff --git a/src/test/java/com/uber/cadence/internal/tracing/TracingPropagatorTest.java b/src/test/java/com/uber/cadence/internal/tracing/TracingPropagatorTest.java index 25f9da59f..9c50b5f48 100644 --- a/src/test/java/com/uber/cadence/internal/tracing/TracingPropagatorTest.java +++ b/src/test/java/com/uber/cadence/internal/tracing/TracingPropagatorTest.java @@ -26,7 +26,6 @@ import io.opentracing.Span; import io.opentracing.mock.MockSpan; import io.opentracing.mock.MockTracer; -import java.nio.ByteBuffer; import java.util.List; import org.junit.Test; @@ -39,12 +38,7 @@ public class TracingPropagatorTest { public void testSpanForExecuteActivity_allowReusingHeaders() { Header header = new Header() - .setFields( - ImmutableMap.of( - "traceid", - ByteBuffer.wrap("100".getBytes()), - "spanid", - ByteBuffer.wrap("200".getBytes()))); + .setFields(ImmutableMap.of("traceid", "100".getBytes(), "spanid", "200".getBytes())); Span span = propagator.spanForExecuteActivity( diff --git a/src/test/java/com/uber/cadence/internal/worker/ActivityPollTaskTest.java b/src/test/java/com/uber/cadence/internal/worker/ActivityPollTaskTest.java index 0fbe15fef..778e4995c 100644 --- a/src/test/java/com/uber/cadence/internal/worker/ActivityPollTaskTest.java +++ b/src/test/java/com/uber/cadence/internal/worker/ActivityPollTaskTest.java @@ -20,10 +20,7 @@ import static org.mockito.Mockito.*; import com.google.common.collect.ImmutableMap; -import com.uber.cadence.InternalServiceError; -import com.uber.cadence.PollForActivityTaskRequest; -import com.uber.cadence.PollForActivityTaskResponse; -import com.uber.cadence.ServiceBusyError; +import com.uber.cadence.*; import com.uber.cadence.internal.metrics.MetricsTag; import com.uber.cadence.internal.metrics.MetricsType; import com.uber.cadence.serviceclient.IWorkflowService; @@ -31,7 +28,6 @@ import com.uber.m3.tally.Scope; import com.uber.m3.tally.Stopwatch; import com.uber.m3.tally.Timer; -import org.apache.thrift.TException; import org.junit.Before; import org.junit.Test; @@ -75,7 +71,7 @@ public void setup() { } @Test - public void testPollTaskSuccess() throws TException { + public void testPollTaskSuccess() throws BaseError { PollForActivityTaskResponse response = new PollForActivityTaskResponse().setTaskToken("testToken".getBytes()); when(mockService.PollForActivityTask(any(PollForActivityTaskRequest.class))) @@ -100,7 +96,7 @@ public void testPollTaskSuccess() throws TException { } @Test(expected = InternalServiceError.class) - public void testPollTaskInternalServiceError() throws TException { + public void testPollTaskInternalServiceError() throws BaseError { // Set up mockService to throw an InternalServiceError exception when(mockService.PollForActivityTask(any(PollForActivityTaskRequest.class))) .thenThrow(new InternalServiceError()); @@ -126,7 +122,7 @@ public void testPollTaskInternalServiceError() throws TException { } @Test(expected = ServiceBusyError.class) - public void testPollTaskServiceBusyError() throws TException { + public void testPollTaskServiceBusyError() throws BaseError { // Set up mockService to throw a ServiceBusyError exception when(mockService.PollForActivityTask(any(PollForActivityTaskRequest.class))) .thenThrow(new ServiceBusyError()); @@ -151,11 +147,11 @@ public void testPollTaskServiceBusyError() throws TException { } } - @Test(expected = TException.class) - public void testPollTaskGeneralTException() throws TException { - // Set up mockService to throw a TException + @Test(expected = BaseError.class) + public void testPollTaskGeneralTException() throws BaseError { + // Set up mockService to throw a BaseError when(mockService.PollForActivityTask(any(PollForActivityTaskRequest.class))) - .thenThrow(new TException()); + .thenThrow(new BaseError()); // Mock the metricsScope and counter to ensure proper behavior Scope metricsScope = options.getMetricsScope(); @@ -163,7 +159,7 @@ public void testPollTaskGeneralTException() throws TException { when(metricsScope.counter(MetricsType.ACTIVITY_POLL_FAILED_COUNTER)).thenReturn(failedCounter); try { - // Call pollTask.pollTask(), expecting a TException to be thrown + // Call pollTask.pollTask(), expecting a BaseError to be thrown pollTask.pollTask(); } finally { // Verify that failedCounter.inc(1) is called once @@ -172,7 +168,7 @@ public void testPollTaskGeneralTException() throws TException { } @Test - public void testPollTaskNoTask() throws TException { + public void testPollTaskNoTask() throws BaseError { // Set up mockService to return an empty PollForActivityTaskResponse when(mockService.PollForActivityTask(any(PollForActivityTaskRequest.class))) .thenReturn(new PollForActivityTaskResponse()); diff --git a/src/test/java/com/uber/cadence/internal/worker/LocallyDispatchedActivityPollTaskTest.java b/src/test/java/com/uber/cadence/internal/worker/LocallyDispatchedActivityPollTaskTest.java index 2a9148e2a..a81c4fc8d 100644 --- a/src/test/java/com/uber/cadence/internal/worker/LocallyDispatchedActivityPollTaskTest.java +++ b/src/test/java/com/uber/cadence/internal/worker/LocallyDispatchedActivityPollTaskTest.java @@ -17,12 +17,12 @@ import static org.junit.Assert.*; import static org.mockito.Mockito.*; +import com.uber.cadence.BaseError; import com.uber.cadence.client.WorkflowClient; import com.uber.cadence.client.WorkflowClientOptions; import com.uber.cadence.serviceclient.ClientOptions; import com.uber.cadence.serviceclient.IWorkflowService; import com.uber.m3.tally.NoopScope; -import org.apache.thrift.TException; import org.junit.Before; import org.junit.Test; @@ -58,10 +58,10 @@ public void testPollTaskInterruptedException() throws Exception { try { pollTask.pollTask(); fail("Expected RuntimeException due to interruption"); + } catch (BaseError e) { + fail("Unexpected BaseError"); } catch (RuntimeException e) { assertTrue(e.getMessage().contains("locally dispatch activity poll task interrupted")); - } catch (TException e) { - fail("Unexpected TException"); } finally { Thread.interrupted(); } diff --git a/src/test/java/com/uber/cadence/internal/worker/TaskListKindTest.java b/src/test/java/com/uber/cadence/internal/worker/TaskListKindTest.java deleted file mode 100644 index 4bade807a..000000000 --- a/src/test/java/com/uber/cadence/internal/worker/TaskListKindTest.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.worker; - -import static junit.framework.TestCase.*; - -import org.junit.Test; - -public class TaskListKindTest { - @Test - public void toThrift() { - assertEquals( - TaskListKind.TASK_LIST_KIND_NORMAL.toThrift(), com.uber.cadence.TaskListKind.NORMAL); - assertEquals( - TaskListKind.TASK_LIST_KIND_STICKY.toThrift(), com.uber.cadence.TaskListKind.STICKY); - } -} diff --git a/src/test/java/com/uber/cadence/internal/worker/WorkflowPollTaskTest.java b/src/test/java/com/uber/cadence/internal/worker/WorkflowPollTaskTest.java index 9b36f551e..87158d69c 100644 --- a/src/test/java/com/uber/cadence/internal/worker/WorkflowPollTaskTest.java +++ b/src/test/java/com/uber/cadence/internal/worker/WorkflowPollTaskTest.java @@ -29,7 +29,6 @@ import com.uber.m3.tally.Stopwatch; import com.uber.m3.tally.Timer; import com.uber.m3.util.Duration; -import org.apache.thrift.TException; import org.junit.Before; import org.junit.Test; @@ -80,13 +79,13 @@ public void setup() { mockService, "test-domain", "test-taskList", - TaskListKind.TASK_LIST_KIND_NORMAL, + TaskListKind.NORMAL, mockMetricScope, "test-identity"); } @Test - public void testPollSuccess() throws TException { + public void testPollSuccess() throws BaseError { // Mock a successful response with all necessary fields WorkflowType workflowType = new WorkflowType().setName("testWorkflowType"); @@ -142,7 +141,7 @@ public void testPollSuccess() throws TException { } @Test(expected = InternalServiceError.class) - public void testPollInternalServiceError() throws TException { + public void testPollInternalServiceError() throws BaseError { when(mockService.PollForDecisionTask(any(PollForDecisionTaskRequest.class))) .thenThrow(new InternalServiceError()); @@ -161,7 +160,7 @@ public void testPollInternalServiceError() throws TException { } @Test(expected = ServiceBusyError.class) - public void testPollServiceBusyError() throws TException { + public void testPollServiceBusyError() throws BaseError { when(mockService.PollForDecisionTask(any(PollForDecisionTaskRequest.class))) .thenThrow(new ServiceBusyError()); @@ -179,10 +178,10 @@ public void testPollServiceBusyError() throws TException { } } - @Test(expected = TException.class) - public void testPollGeneralTException() throws TException { + @Test(expected = BaseError.class) + public void testPollGeneralTException() throws BaseError { when(mockService.PollForDecisionTask(any(PollForDecisionTaskRequest.class))) - .thenThrow(new TException()); + .thenThrow(new BaseError()); Counter failedCounter = mock(Counter.class); when(mockMetricScope.counter(MetricsType.DECISION_POLL_FAILED_COUNTER)) @@ -196,7 +195,7 @@ public void testPollGeneralTException() throws TException { } @Test - public void testPollNoTask() throws TException { + public void testPollNoTask() throws BaseError { when(mockService.PollForDecisionTask(any(PollForDecisionTaskRequest.class))) .thenReturn(new PollForDecisionTaskResponse()); diff --git a/src/test/java/com/uber/cadence/migration/MigrationIWorkflowServiceTest.java b/src/test/java/com/uber/cadence/migration/MigrationIWorkflowServiceTest.java index f32dd136a..9df1d0da5 100644 --- a/src/test/java/com/uber/cadence/migration/MigrationIWorkflowServiceTest.java +++ b/src/test/java/com/uber/cadence/migration/MigrationIWorkflowServiceTest.java @@ -24,7 +24,6 @@ import com.uber.cadence.serviceclient.ClientOptions; import com.uber.cadence.serviceclient.IWorkflowService; import java.util.ArrayList; -import org.apache.thrift.TException; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; @@ -46,7 +45,7 @@ public void setUp() { // No previous workflow found - launch a workflow in new cluster @Test - public void testStartWorkflowExecution_startNewWorkflow() throws TException { + public void testStartWorkflowExecution_startNewWorkflow() throws BaseError { StartWorkflowExecutionRequest startRequest = new StartWorkflowExecutionRequest() @@ -88,7 +87,7 @@ public void testStartWorkflowExecution_startNewWorkflow() throws TException { // Previous running workflow found: expected to launch a wf in the old cluster @Test - public void testStartWorkflowExecution_startOldWorkflow() throws TException { + public void testStartWorkflowExecution_startOldWorkflow() throws BaseError { StartWorkflowExecutionRequest startRequest = new StartWorkflowExecutionRequest() @@ -121,7 +120,7 @@ public void testStartWorkflowExecution_startOldWorkflow() throws TException { } @Test - public void testStartWorkflow_noWorkflowID() throws TException { + public void testStartWorkflow_noWorkflowID() throws BaseError { StartWorkflowExecutionRequest startRequest = new StartWorkflowExecutionRequest() .setWorkflowType(new WorkflowType().setName("sampleWorkflow")) @@ -138,7 +137,7 @@ public void testStartWorkflow_noWorkflowID() throws TException { } @Test - public void testStartWorkflow_errorInDescribeWorkflowExecution() throws TException { + public void testStartWorkflow_errorInDescribeWorkflowExecution() throws BaseError { StartWorkflowExecutionRequest startRequest = new StartWorkflowExecutionRequest() @@ -158,7 +157,7 @@ public void testStartWorkflow_errorInDescribeWorkflowExecution() throws TExcepti } @Test - public void testListWorkflows_InitialRequest() throws TException { + public void testListWorkflows_InitialRequest() throws BaseError { String domainNew = "test"; int one = 1; @@ -186,7 +185,7 @@ public void testListWorkflows_InitialRequest() throws TException { // calling old cluster when new cluster returns empty response @Test - public void testListWorkflow_OldClusterCall() throws TException { + public void testListWorkflow_OldClusterCall() throws BaseError { String domainNew = "test"; int one = 1; @@ -223,7 +222,7 @@ public void testListWorkflow_OldClusterCall() throws TException { // if fetching from new cluster result size is less than pageSize, fetch additional records from // Old Cluster @Test - public void testListWorkflow_fetchFromBothCluster() throws TException { + public void testListWorkflow_fetchFromBothCluster() throws BaseError { String domainNew = "test"; int one = 1; int two = 2; @@ -259,7 +258,7 @@ public void testListWorkflow_fetchFromBothCluster() throws TException { } @Test - public void testListWorkflows_emptyRequestTests() throws TException { + public void testListWorkflows_emptyRequestTests() throws BaseError { // Test when request is null try { @@ -278,7 +277,7 @@ public void testListWorkflows_emptyRequestTests() throws TException { // Test when error returned from internal client, return same error @Test - public void testListWorkflow_error() throws TException { + public void testListWorkflow_error() throws BaseError { String domainNew = "test"; when(serviceNew.ListWorkflowExecutions(any())).thenReturn(null); @@ -290,7 +289,7 @@ public void testListWorkflow_error() throws TException { } @Test - public void testListWorkflow_FromClusterOnly() throws TException { + public void testListWorkflow_FromClusterOnly() throws BaseError { String domain = "test"; @@ -312,7 +311,7 @@ public void testListWorkflow_FromClusterOnly() throws TException { } @Test - public void testListWorkflows_ResponseWithToken() throws TException { + public void testListWorkflows_ResponseWithToken() throws BaseError { String domainNew = "test"; @@ -350,7 +349,7 @@ public void testListWorkflows_ResponseWithToken() throws TException { } @Test - public void testScanWorkflow_InitialRequest() throws TException { + public void testScanWorkflow_InitialRequest() throws BaseError { String domainNew = "test"; @@ -380,7 +379,7 @@ public void testScanWorkflow_InitialRequest() throws TException { // Test scanWorkflow when new cluster returns an empty response and it falls back to the old // cluster. @Test - public void testScanWorkflow_OldClusterCall() throws TException { + public void testScanWorkflow_OldClusterCall() throws BaseError { String domainNew = "test"; @@ -422,7 +421,7 @@ public void testScanWorkflow_OldClusterCall() throws TException { } @Test - public void testScanWorkflow_FetchFromBothClusters() throws TException { + public void testScanWorkflow_FetchFromBothClusters() throws BaseError { String domainNew = "test"; @@ -464,7 +463,7 @@ public void testScanWorkflow_FetchFromBothClusters() throws TException { } @Test - public void testScanWorkflow_EmptyRequestTests() throws TException { + public void testScanWorkflow_EmptyRequestTests() throws BaseError { // Test when the request is null. try { @@ -483,7 +482,7 @@ public void testScanWorkflow_EmptyRequestTests() throws TException { // Test when an error is returned from the internal client, and the response is null. @Test - public void testScanWorkflow_Error() throws TException { + public void testScanWorkflow_Error() throws BaseError { String domainNew = "test"; @@ -497,7 +496,7 @@ public void testScanWorkflow_Error() throws TException { // Test scanWorkflow when fetching only from the 'from' cluster. @Test - public void testScanWorkflow_FromClusterOnly() throws TException { + public void testScanWorkflow_FromClusterOnly() throws BaseError { String domain = "test"; @@ -521,7 +520,7 @@ public void testScanWorkflow_FromClusterOnly() throws TException { } @Test - public void testScanWorkflows_ResponseWithToken() throws TException { + public void testScanWorkflows_ResponseWithToken() throws BaseError { String domainNew = "test"; @@ -564,7 +563,7 @@ public void testScanWorkflows_ResponseWithToken() throws TException { } @Test - public void testCountWorkflow_bothClusterSuccess() throws TException { + public void testCountWorkflow_bothClusterSuccess() throws BaseError { String domain = "test"; String query = ""; @@ -576,8 +575,7 @@ public void testCountWorkflow_bothClusterSuccess() throws TException { CountWorkflowExecutionsResponse mockResponseNew = new CountWorkflowExecutionsResponse().setCount(3); - CountWorkflowExecutionsResponse expectedResponse = - new CountWorkflowExecutionsResponse(mockResponseNew); + CountWorkflowExecutionsResponse expectedResponse = new CountWorkflowExecutionsResponse(); expectedResponse.setCount(5); // both clusters return successful response @@ -588,7 +586,7 @@ public void testCountWorkflow_bothClusterSuccess() throws TException { } @Test - public void testCountWorkflow_errorInOneCluster() throws TException { + public void testCountWorkflow_errorInOneCluster() throws BaseError { String domain = "test"; String query = ""; @@ -598,8 +596,7 @@ public void testCountWorkflow_errorInOneCluster() throws TException { CountWorkflowExecutionsResponse mockResponseOld = new CountWorkflowExecutionsResponse().setCount(2); - CountWorkflowExecutionsResponse expectedResponse = - new CountWorkflowExecutionsResponse(mockResponseOld); + CountWorkflowExecutionsResponse expectedResponse = new CountWorkflowExecutionsResponse(); expectedResponse.setCount(2); when(serviceOld.CountWorkflowExecutions(any())).thenReturn(mockResponseOld); @@ -610,7 +607,7 @@ public void testCountWorkflow_errorInOneCluster() throws TException { // query in the new cluster @Test - public void testQueryWorkflow_queryWorkflowInNew() throws TException { + public void testQueryWorkflow_queryWorkflowInNew() throws BaseError { String domain = "test"; String wfID = "123"; @@ -647,7 +644,7 @@ public void testQueryWorkflow_queryWorkflowInNew() throws TException { // query found in the old cluster @Test - public void testQueryWorkflow_queryWorkflowInOld() throws TException { + public void testQueryWorkflow_queryWorkflowInOld() throws BaseError { String domain = "test"; String wfID = "123"; @@ -683,7 +680,7 @@ public void testQueryWorkflow_queryWorkflowInOld() throws TException { } @Test - public void testQueryWorkflow_noWorkflowID() throws TException { + public void testQueryWorkflow_noWorkflowID() throws BaseError { String domain = "test"; QueryWorkflowRequest request = new QueryWorkflowRequest().setDomain(domain); @@ -697,7 +694,7 @@ public void testQueryWorkflow_noWorkflowID() throws TException { } @Test - public void testQueryWorkflow_errorInDescribeWorkflowExecution() throws TException { + public void testQueryWorkflow_errorInDescribeWorkflowExecution() throws BaseError { String domain = "test"; String wfID = "123"; @@ -720,7 +717,7 @@ public void testQueryWorkflow_errorInDescribeWorkflowExecution() throws TExcepti } @Test - public void testListOpenWorkflows_InitialRequest() throws TException { + public void testListOpenWorkflows_InitialRequest() throws BaseError { String domain = "test"; @@ -753,7 +750,7 @@ public void testListOpenWorkflows_InitialRequest() throws TException { // calling old cluster when new cluster returns empty response @Test - public void testListOpenWorkflow_OldClusterCall() throws TException { + public void testListOpenWorkflow_OldClusterCall() throws BaseError { String domain = "test"; @@ -795,7 +792,7 @@ public void testListOpenWorkflow_OldClusterCall() throws TException { // if fetching from new cluster result size is less than pageSize, fetch additional records from // Old Cluster @Test - public void testListOpenWorkflow_fetchFromBothCluster() throws TException { + public void testListOpenWorkflow_fetchFromBothCluster() throws BaseError { String domain = "test"; @@ -831,7 +828,7 @@ public void testListOpenWorkflow_fetchFromBothCluster() throws TException { } @Test - public void testListOpenWorkflows_emptyRequestTests() throws TException { + public void testListOpenWorkflows_emptyRequestTests() throws BaseError { // Test when request is null try { @@ -851,7 +848,7 @@ public void testListOpenWorkflows_emptyRequestTests() throws TException { // Test when error returned from internal client, return same error @Test - public void testListOpenWorkflow_error() throws TException { + public void testListOpenWorkflow_error() throws BaseError { String domain = "test"; when(serviceNew.ListOpenWorkflowExecutions(any())).thenReturn(null); @@ -863,7 +860,7 @@ public void testListOpenWorkflow_error() throws TException { } @Test - public void testListOpenWorkflow_FromClusterOnly() throws TException { + public void testListOpenWorkflow_FromClusterOnly() throws BaseError { String domain = "test"; @@ -885,7 +882,7 @@ public void testListOpenWorkflow_FromClusterOnly() throws TException { } @Test - public void testListOpenWorkflows_ResponseWithToken() throws TException { + public void testListOpenWorkflows_ResponseWithToken() throws BaseError { String domain = "test"; @@ -925,7 +922,7 @@ public void testListOpenWorkflows_ResponseWithToken() throws TException { } @Test - public void testListClosedWorkflows_InitialRequest() throws TException { + public void testListClosedWorkflows_InitialRequest() throws BaseError { String domain = "test"; @@ -958,7 +955,7 @@ public void testListClosedWorkflows_InitialRequest() throws TException { // calling old cluster when new cluster returns empty response @Test - public void testListClosedWorkflow_OldClusterCall() throws TException { + public void testListClosedWorkflow_OldClusterCall() throws BaseError { String domain = "test"; @@ -1000,7 +997,7 @@ public void testListClosedWorkflow_OldClusterCall() throws TException { // if fetching from new cluster result size is less than pageSize, fetch additional records from // Old Cluster @Test - public void testListClosedWorkflow_fetchFromBothCluster() throws TException { + public void testListClosedWorkflow_fetchFromBothCluster() throws BaseError { String domain = "test"; @@ -1038,7 +1035,7 @@ public void testListClosedWorkflow_fetchFromBothCluster() throws TException { } @Test - public void testListClosedWorkflows_emptyRequestTests() throws TException { + public void testListClosedWorkflows_emptyRequestTests() throws BaseError { // Test when request is null try { @@ -1058,7 +1055,7 @@ public void testListClosedWorkflows_emptyRequestTests() throws TException { // Test when error returned from internal client, return same error @Test - public void testListClosedWorkflow_error() throws TException { + public void testListClosedWorkflow_error() throws BaseError { String domain = "test"; when(serviceNew.ListClosedWorkflowExecutions(any())).thenReturn(null); @@ -1070,7 +1067,7 @@ public void testListClosedWorkflow_error() throws TException { } @Test - public void testListClosedWorkflow_FromClusterOnly() throws TException { + public void testListClosedWorkflow_FromClusterOnly() throws BaseError { String domain = "test"; @@ -1092,7 +1089,7 @@ public void testListClosedWorkflow_FromClusterOnly() throws TException { } @Test - public void testListClosedWorkflows_ResponseWithToken() throws TException { + public void testListClosedWorkflows_ResponseWithToken() throws BaseError { String domain = "test"; @@ -1132,7 +1129,7 @@ public void testListClosedWorkflows_ResponseWithToken() throws TException { } @Test - public void testSignalWithStartWorkflowExecution_NewService() throws TException { + public void testSignalWithStartWorkflowExecution_NewService() throws BaseError { SignalWithStartWorkflowExecutionRequest request = new SignalWithStartWorkflowExecutionRequest() .setWorkflowId("newSignalWorkflow") @@ -1151,7 +1148,7 @@ public void testSignalWithStartWorkflowExecution_NewService() throws TException } @Test - public void testSignalWithStartWorkflowExecution_OldService() throws TException { + public void testSignalWithStartWorkflowExecution_OldService() throws BaseError { SignalWithStartWorkflowExecutionRequest signal = new SignalWithStartWorkflowExecutionRequest() .setWorkflowId("testSignal") @@ -1180,7 +1177,7 @@ public void testSignalWithStartWorkflowExecution_OldService() throws TException } @Test - public void testSignalWorkflowExecution_SignalNewService() throws TException { + public void testSignalWorkflowExecution_SignalNewService() throws BaseError { SignalWorkflowExecutionRequest request = new SignalWorkflowExecutionRequest() .setWorkflowExecution(new WorkflowExecution().setWorkflowId("newSignal")) @@ -1196,7 +1193,7 @@ public void testSignalWorkflowExecution_SignalNewService() throws TException { } @Test - public void testSignalWorkflowExecution_SignalInOldService() throws TException { + public void testSignalWorkflowExecution_SignalInOldService() throws BaseError { SignalWorkflowExecutionRequest request = new SignalWorkflowExecutionRequest() .setWorkflowExecution(new WorkflowExecution().setWorkflowId("oldSignal")) diff --git a/src/test/java/com/uber/cadence/serviceclient/WorkflowServiceTChannelTest.java b/src/test/java/com/uber/cadence/serviceclient/WorkflowServiceTChannelTest.java deleted file mode 100644 index 8add61525..000000000 --- a/src/test/java/com/uber/cadence/serviceclient/WorkflowServiceTChannelTest.java +++ /dev/null @@ -1,3410 +0,0 @@ -/** - * 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.*; -import static org.mockito.Mockito.*; - -import com.uber.cadence.*; -import com.uber.tchannel.api.ResponseCode; -import com.uber.tchannel.api.SubChannel; -import com.uber.tchannel.api.TFuture; -import com.uber.tchannel.api.errors.TChannelError; -import com.uber.tchannel.headers.ArgScheme; -import com.uber.tchannel.messages.ThriftRequest; -import com.uber.tchannel.messages.ThriftResponse; -import com.uber.tchannel.messages.generated.HealthStatus; -import com.uber.tchannel.messages.generated.Meta; -import java.util.Arrays; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.runners.Enclosed; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - -@RunWith(Enclosed.class) -public class WorkflowServiceTChannelTest { - - interface RemoteCallAsync { - void apply(AsyncMethodCallback callback) throws TException; - } - - private static class BaseTest { - SubChannel mockSubChannel; - WorkflowServiceTChannel service; - - @Before - public void setUp() { - mockSubChannel = mock(SubChannel.class); - service = new WorkflowServiceTChannel(mockSubChannel, ClientOptions.newBuilder().build()); - } - - @Parameterized.Parameter(0) - public ResponseCode responseCode; - - @Parameterized.Parameter(1) - public T responseBody; - - @Parameterized.Parameter(2) - public Class expectedException; - - @Parameterized.Parameter(3) - public R expectedResponse; - - TFuture> mockResponse(ResponseCode responseCode, T body) { - // TFuture - TFuture> tFuture = TFuture.create(ArgScheme.THRIFT, null); - tFuture.set( - new ThriftResponse.Builder(new ThriftRequest.Builder<>("", "").build()) - .setResponseCode(responseCode) - .setBody(body) - .build()); - return tFuture; - } - - void testHelper(WorkflowServiceTChannel.RemoteCall method) throws TException, TChannelError { - when(mockSubChannel.send(any(ThriftRequest.class))) - .thenReturn(mockResponse(responseCode, responseBody)); - if (expectedException != null) { - assertThrows(expectedException, method::apply); - } else { - assertEquals(expectedResponse, method.apply()); - } - } - - void testHelperWithCallback(RemoteCallAsync method) throws TChannelError, TException { - when(mockSubChannel.send(any(ThriftRequest.class))) - .thenReturn(mockResponse(responseCode, responseBody)); - method.apply( - new AsyncMethodCallback() { - @Override - public void onComplete(R r) { - if (expectedException != null) { - fail("Expected exception but got response: " + r); - } else { - assertEquals(expectedResponse, r); - } - } - - @Override - public void onError(Exception e) { - assertEquals(expectedException, e.getClass()); - } - }); - } - - void assertUnimplementedWithCallback(RemoteCallAsync method) { - assertThrows( - UnsupportedOperationException.class, - () -> - method.apply( - new AsyncMethodCallback() { - @Override - public void onComplete(R r) { - fail("shouldn't reach this line"); - } - - @Override - public void onError(Exception e) { - fail("shouldn't reach this line"); - } - })); - } - - void assertNoOpWithCallback(RemoteCallAsync method) { - try { - method.apply( - new AsyncMethodCallback() { - @Override - public void onComplete(R r) { - fail("shouldn't reach this line"); - } - - @Override - public void onError(Exception e) { - fail("shouldn't reach this line"); - } - }); - } catch (TException e) { - fail("should not throw exception:" + e); - } - } - } - - @RunWith(Parameterized.class) - public static class RegisterDomainTest - extends BaseTest { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - {ResponseCode.OK, new WorkflowService.RegisterDomain_result(), null, null}, - { - ResponseCode.Error, - new WorkflowService.RegisterDomain_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null, - }, - { - ResponseCode.Error, - new WorkflowService.RegisterDomain_result() - .setDomainExistsError(new DomainAlreadyExistsError("")), - DomainAlreadyExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RegisterDomain_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RegisterDomain_result(), - TException.class, - null - }, - }); - } - - @Test - public void testResponse() throws Exception { - testHelper( - () -> { - service.RegisterDomain(new RegisterDomainRequest()); - return null; - }); - } - - @Test - public void responseIsHandledCorrectlyWithCallback() throws Exception { - testHelperWithCallback( - callback -> { - service.SignalWorkflowExecution(new SignalWorkflowExecutionRequest(), callback); - }); - } - } - - @RunWith(Parameterized.class) - public static class DescribeDomainTest - extends BaseTest { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.DescribeDomain_result().setSuccess(new DescribeDomainResponse()), - null, - new DescribeDomainResponse() - }, - { - ResponseCode.Error, - new WorkflowService.DescribeDomain_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - new DescribeDomainResponse(), - }, - { - ResponseCode.Error, - new WorkflowService.DescribeDomain_result() - .setSuccess(new DescribeDomainResponse()) - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.DescribeDomain_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.DescribeDomain_result(), - TException.class, - null - }, - }); - } - - @Test - public void testResponse() throws Exception { - testHelper(() -> service.DescribeDomain(new DescribeDomainRequest())); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> service.DescribeDomain(new DescribeDomainRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class ListDomainsTest - extends BaseTest { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.ListDomains_result().setSuccess(new ListDomainsResponse()), - null, - new ListDomainsResponse() - }, - { - ResponseCode.Error, - new WorkflowService.ListDomains_result().setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null, - }, - { - ResponseCode.Error, - new WorkflowService.ListDomains_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null, - }, - { - ResponseCode.Error, - new WorkflowService.ListDomains_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - {ResponseCode.Error, new WorkflowService.ListDomains_result(), TException.class, null}, - }); - } - - @Test - public void testResponse() throws Exception { - testHelper(() -> service.ListDomains(new ListDomainsRequest())); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> service.ListDomains(new ListDomainsRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class ResetWorkflowExecutionTest - extends BaseTest< - WorkflowService.ResetWorkflowExecution_result, ResetWorkflowExecutionResponse> { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.ResetWorkflowExecution_result() - .setSuccess(new ResetWorkflowExecutionResponse()), - null, - new ResetWorkflowExecutionResponse() - }, - { - ResponseCode.Error, - new WorkflowService.ResetWorkflowExecution_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null, - }, - { - ResponseCode.Error, - new WorkflowService.ResetWorkflowExecution_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ResetWorkflowExecution_result(), - TException.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ResetWorkflowExecution_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ResetWorkflowExecution_result() - .setDomainNotActiveError(new DomainNotActiveError()), - DomainNotActiveError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ResetWorkflowExecution_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ResetWorkflowExecution_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - }); - } - - @Test - public void testResponse() throws Exception { - testHelper(() -> service.ResetWorkflowExecution(new ResetWorkflowExecutionRequest())); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> service.ListDomains(new ListDomainsRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class TerminateWorkflowExecutionTest - extends BaseTest { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - {ResponseCode.OK, new WorkflowService.TerminateWorkflowExecution_result(), null, null}, - { - ResponseCode.Error, - new WorkflowService.TerminateWorkflowExecution_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null, - }, - { - ResponseCode.Error, - new WorkflowService.TerminateWorkflowExecution_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.TerminateWorkflowExecution_result(), - TException.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.TerminateWorkflowExecution_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.TerminateWorkflowExecution_result() - .setWorkflowExecutionAlreadyCompletedError( - new WorkflowExecutionAlreadyCompletedError("")), - WorkflowExecutionAlreadyCompletedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.TerminateWorkflowExecution_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.TerminateWorkflowExecution_result() - .setDomainNotActiveError(new DomainNotActiveError()), - DomainNotActiveError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.TerminateWorkflowExecution_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - }); - } - - @Test - public void testResponse() throws Exception { - testHelper( - () -> { - service.TerminateWorkflowExecution(new TerminateWorkflowExecutionRequest()); - return null; - }); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> - service.TerminateWorkflowExecution( - new TerminateWorkflowExecutionRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class ListOpenWorkflowExecutionsTest - extends BaseTest< - WorkflowService.ListOpenWorkflowExecutions_result, ListOpenWorkflowExecutionsResponse> { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.ListOpenWorkflowExecutions_result() - .setSuccess(new ListOpenWorkflowExecutionsResponse()), - null, - new ListOpenWorkflowExecutionsResponse() - }, - { - ResponseCode.Error, - new WorkflowService.ListOpenWorkflowExecutions_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null, - }, - { - ResponseCode.Error, - new WorkflowService.ListOpenWorkflowExecutions_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ListOpenWorkflowExecutions_result(), - TException.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ListOpenWorkflowExecutions_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ListOpenWorkflowExecutions_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ListOpenWorkflowExecutions_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - }); - } - - @Test - public void testResponse() throws Exception { - testHelper(() -> service.ListOpenWorkflowExecutions(new ListOpenWorkflowExecutionsRequest())); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> - service.ListOpenWorkflowExecutions( - new ListOpenWorkflowExecutionsRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class ListClosedWorkflowExecutionsTest - extends BaseTest< - WorkflowService.ListClosedWorkflowExecutions_result, - ListClosedWorkflowExecutionsResponse> { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.ListClosedWorkflowExecutions_result() - .setSuccess(new ListClosedWorkflowExecutionsResponse()), - null, - new ListClosedWorkflowExecutionsResponse() - }, - { - ResponseCode.Error, - new WorkflowService.ListClosedWorkflowExecutions_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null, - }, - { - ResponseCode.Error, - new WorkflowService.ListClosedWorkflowExecutions_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ListClosedWorkflowExecutions_result(), - TException.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ListClosedWorkflowExecutions_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ListClosedWorkflowExecutions_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - }); - } - - @Test - public void testResponse() throws Exception { - testHelper( - () -> service.ListClosedWorkflowExecutions(new ListClosedWorkflowExecutionsRequest())); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> - service.ListClosedWorkflowExecutions( - new ListClosedWorkflowExecutionsRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class ListWorkflowExecutionsTest - extends BaseTest< - WorkflowService.ListWorkflowExecutions_result, ListWorkflowExecutionsResponse> { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.ListWorkflowExecutions_result() - .setSuccess(new ListWorkflowExecutionsResponse()), - null, - new ListWorkflowExecutionsResponse() - }, - { - ResponseCode.Error, - new WorkflowService.ListWorkflowExecutions_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null, - }, - { - ResponseCode.Error, - new WorkflowService.ListWorkflowExecutions_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ListWorkflowExecutions_result(), - TException.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ListWorkflowExecutions_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ListWorkflowExecutions_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - }); - } - - @Test - public void testResponse() throws Exception { - testHelper(() -> service.ListWorkflowExecutions(new ListWorkflowExecutionsRequest())); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> - service.ListWorkflowExecutions(new ListWorkflowExecutionsRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class ListArchivedWorkflowExecutionsTest - extends BaseTest< - WorkflowService.ListArchivedWorkflowExecutions_result, - ListArchivedWorkflowExecutionsResponse> { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.ListArchivedWorkflowExecutions_result() - .setSuccess(new ListArchivedWorkflowExecutionsResponse()), - null, - new ListArchivedWorkflowExecutionsResponse() - }, - { - ResponseCode.Error, - new WorkflowService.ListArchivedWorkflowExecutions_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null, - }, - { - ResponseCode.Error, - new WorkflowService.ListArchivedWorkflowExecutions_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ListArchivedWorkflowExecutions_result(), - TException.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ListArchivedWorkflowExecutions_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ListArchivedWorkflowExecutions_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - }); - } - - @Test - public void testResponse() throws Exception { - testHelper( - () -> - service.ListArchivedWorkflowExecutions(new ListArchivedWorkflowExecutionsRequest())); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> - service.ListArchivedWorkflowExecutions( - new ListArchivedWorkflowExecutionsRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class ScanWorkflowExecutionsTest - extends BaseTest< - WorkflowService.ScanWorkflowExecutions_result, ListWorkflowExecutionsResponse> { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.ScanWorkflowExecutions_result() - .setSuccess(new ListWorkflowExecutionsResponse()), - null, - new ListWorkflowExecutionsResponse() - }, - { - ResponseCode.Error, - new WorkflowService.ScanWorkflowExecutions_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null, - }, - { - ResponseCode.Error, - new WorkflowService.ScanWorkflowExecutions_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ScanWorkflowExecutions_result(), - TException.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ScanWorkflowExecutions_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ScanWorkflowExecutions_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - }); - } - - @Test - public void testResponse() throws Exception { - testHelper(() -> service.ScanWorkflowExecutions(new ListWorkflowExecutionsRequest())); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> - service.ScanWorkflowExecutions(new ListWorkflowExecutionsRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class CountWorkflowExecutionsTest - extends BaseTest< - WorkflowService.CountWorkflowExecutions_result, CountWorkflowExecutionsResponse> { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.CountWorkflowExecutions_result() - .setSuccess(new CountWorkflowExecutionsResponse()), - null, - new CountWorkflowExecutionsResponse() - }, - { - ResponseCode.Error, - new WorkflowService.CountWorkflowExecutions_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null, - }, - { - ResponseCode.Error, - new WorkflowService.CountWorkflowExecutions_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.CountWorkflowExecutions_result(), - TException.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.CountWorkflowExecutions_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.CountWorkflowExecutions_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - }); - } - - @Test - public void testResponse() throws Exception { - testHelper(() -> service.CountWorkflowExecutions(new CountWorkflowExecutionsRequest())); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> - service.CountWorkflowExecutions(new CountWorkflowExecutionsRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class GetSearchAttributesTest - extends BaseTest { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.GetSearchAttributes_result() - .setSuccess(new GetSearchAttributesResponse()), - null, - new GetSearchAttributesResponse() - }, - { - ResponseCode.Error, - new WorkflowService.GetSearchAttributes_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null, - }, - { - ResponseCode.Error, - new WorkflowService.GetSearchAttributes_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.GetSearchAttributes_result(), - TException.class, - null - }, - }); - } - - @Test - public void testResponse() throws Exception { - testHelper(() -> service.GetSearchAttributes()); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback(callback -> service.GetSearchAttributes(callback)); - } - } - - @RunWith(Parameterized.class) - public static class RespondQueryTaskCompletedTest - extends BaseTest { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - {ResponseCode.OK, new WorkflowService.RespondQueryTaskCompleted_result(), null, null}, - { - ResponseCode.Error, - new WorkflowService.RespondQueryTaskCompleted_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null, - }, - { - ResponseCode.Error, - new WorkflowService.RespondQueryTaskCompleted_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondQueryTaskCompleted_result(), - TException.class, - null - }, - }); - } - - @Test - public void testResponse() throws Exception { - testHelper( - () -> { - service.RespondQueryTaskCompleted(new RespondQueryTaskCompletedRequest()); - return null; - }); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> - service.RespondQueryTaskCompleted(new RespondQueryTaskCompletedRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class ResetStickyTaskListTest - extends BaseTest { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.ResetStickyTaskList_result() - .setSuccess(new ResetStickyTaskListResponse()), - null, - new ResetStickyTaskListResponse() - }, - { - ResponseCode.Error, - new WorkflowService.ResetStickyTaskList_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null, - }, - { - ResponseCode.Error, - new WorkflowService.ResetStickyTaskList_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ResetStickyTaskList_result(), - TException.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ResetStickyTaskList_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ResetStickyTaskList_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ResetStickyTaskList_result() - .setDomainNotActiveError(new DomainNotActiveError()), - DomainNotActiveError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ResetStickyTaskList_result() - .setWorkflowExecutionAlreadyCompletedError( - new WorkflowExecutionAlreadyCompletedError()), - WorkflowExecutionAlreadyCompletedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ResetStickyTaskList_result() - .setWorkflowExecutionAlreadyCompletedError( - new WorkflowExecutionAlreadyCompletedError()), - WorkflowExecutionAlreadyCompletedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ResetStickyTaskList_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - }); - } - - @Test - public void testResponse() throws Exception { - testHelper(() -> service.ResetStickyTaskList(new ResetStickyTaskListRequest())); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> service.ResetStickyTaskList(new ResetStickyTaskListRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class QueryWorkflowTest - extends BaseTest { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.QueryWorkflow_result().setSuccess(new QueryWorkflowResponse()), - null, - new QueryWorkflowResponse() - }, - { - ResponseCode.Error, - new WorkflowService.QueryWorkflow_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null, - }, - { - ResponseCode.Error, - new WorkflowService.QueryWorkflow_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.QueryWorkflow_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.QueryWorkflow_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.QueryWorkflow_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, new WorkflowService.QueryWorkflow_result(), TException.class, null - }, - { - ResponseCode.Error, new WorkflowService.QueryWorkflow_result(), TException.class, null - }, - }); - } - - @Test - public void testResponse() throws Exception { - testHelper(() -> service.QueryWorkflow(new QueryWorkflowRequest())); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> service.QueryWorkflow(new QueryWorkflowRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class DescribeWorkflowExecutionTest - extends BaseTest< - WorkflowService.DescribeWorkflowExecution_result, DescribeWorkflowExecutionResponse> { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.DescribeWorkflowExecution_result() - .setSuccess(new DescribeWorkflowExecutionResponse()), - null, - new DescribeWorkflowExecutionResponse() - }, - { - ResponseCode.Error, - new WorkflowService.DescribeWorkflowExecution_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null, - }, - { - ResponseCode.Error, - new WorkflowService.DescribeWorkflowExecution_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.DescribeWorkflowExecution_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.DescribeWorkflowExecution_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.DescribeWorkflowExecution_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.DescribeWorkflowExecution_result(), - TException.class, - null - }, - }); - } - - @Test - public void testResponse() throws Exception { - testHelper(() -> service.DescribeWorkflowExecution(new DescribeWorkflowExecutionRequest())); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> - service.DescribeWorkflowExecution(new DescribeWorkflowExecutionRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class DescribeTaskListTest - extends BaseTest { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.DescribeTaskList_result() - .setSuccess(new DescribeTaskListResponse()), - null, - new DescribeTaskListResponse() - }, - { - ResponseCode.Error, - new WorkflowService.DescribeTaskList_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null, - }, - { - ResponseCode.Error, - new WorkflowService.DescribeTaskList_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.DescribeTaskList_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.DescribeTaskList_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.DescribeTaskList_result(), - TException.class, - null - }, - }); - } - - @Test - public void testResponse() throws Exception { - testHelper(() -> service.DescribeTaskList(new DescribeTaskListRequest())); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> service.DescribeTaskList(new DescribeTaskListRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class GetClusterInfoTest - extends BaseTest { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.GetClusterInfo_result().setSuccess(new ClusterInfo()), - null, - new ClusterInfo() - }, - { - ResponseCode.Error, - new WorkflowService.GetClusterInfo_result() - .setInternalServiceError(new InternalServiceError("")), - InternalServiceError.class, - null, - }, - { - ResponseCode.Error, - new WorkflowService.GetClusterInfo_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.GetClusterInfo_result(), - TException.class, - null - }, - }); - } - - @Test - public void testResponse() throws Exception { - testHelper(() -> service.GetClusterInfo()); - } - - @Test - public void callbackIsNotSupported() { - assertNoOpWithCallback(callback -> service.GetClusterInfo(callback)); - } - } - - @RunWith(Parameterized.class) - public static class ListTaskListPartitionsTest - extends BaseTest< - WorkflowService.ListTaskListPartitions_result, ListTaskListPartitionsResponse> { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.ListTaskListPartitions_result() - .setSuccess(new ListTaskListPartitionsResponse()), - null, - new ListTaskListPartitionsResponse() - }, - { - ResponseCode.Error, - new WorkflowService.ListTaskListPartitions_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null, - }, - { - ResponseCode.Error, - new WorkflowService.ListTaskListPartitions_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ListTaskListPartitions_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ListTaskListPartitions_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.ListTaskListPartitions_result(), - TException.class, - null - }, - }); - } - - @Test - public void testResponse() throws Exception { - testHelper(() -> service.ListTaskListPartitions(new ListTaskListPartitionsRequest())); - } - - @Test - public void callbackIsNotSupported() { - assertNoOpWithCallback( - callback -> - service.ListTaskListPartitions(new ListTaskListPartitionsRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class UpdateDomainTest - extends BaseTest { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.UpdateDomain_result().setSuccess(new UpdateDomainResponse()), - null, - new UpdateDomainResponse() - }, - { - ResponseCode.Error, - new WorkflowService.UpdateDomain_result().setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.UpdateDomain_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.UpdateDomain_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.UpdateDomain_result() - .setDomainNotActiveError(new DomainNotActiveError()), - DomainNotActiveError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.UpdateDomain_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - {ResponseCode.Error, new WorkflowService.UpdateDomain_result(), TException.class, null}, - }); - } - - @Test - public void responseIsHandledCorrectly() throws Exception { - testHelper(() -> service.UpdateDomain(new UpdateDomainRequest())); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> service.UpdateDomain(new UpdateDomainRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class GetWorkflowExecutionHistoryTest - extends BaseTest< - WorkflowService.GetWorkflowExecutionHistory_result, GetWorkflowExecutionHistoryResponse> { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.GetWorkflowExecutionHistory_result() - .setSuccess(new GetWorkflowExecutionHistoryResponse()), - null, - new GetWorkflowExecutionHistoryResponse() - }, - { - ResponseCode.Error, - new WorkflowService.GetWorkflowExecutionHistory_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.GetWorkflowExecutionHistory_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.GetWorkflowExecutionHistory_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.GetWorkflowExecutionHistory_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.GetWorkflowExecutionHistory_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.GetWorkflowExecutionHistory_result(), - TException.class, - null - }, - }); - } - - @Test - public void responseIsHandledCorrectly() throws Exception { - testHelper( - () -> service.GetWorkflowExecutionHistory(new GetWorkflowExecutionHistoryRequest())); - } - - @Test - public void responseIsHandledCorrectlyWithCallback() throws Exception { - testHelperWithCallback( - callback -> - service.GetWorkflowExecutionHistory( - new GetWorkflowExecutionHistoryRequest(), callback)); - testHelperWithCallback( - callback -> - service.GetWorkflowExecutionHistoryWithTimeout( - new GetWorkflowExecutionHistoryRequest(), callback, 1000L)); - } - - @Test - public void responseIsHandledCorrectlyWithTimeout() throws Exception { - testHelper( - () -> - service.GetWorkflowExecutionHistoryWithTimeout( - new GetWorkflowExecutionHistoryRequest(), 1000L)); - } - } - - @RunWith(Parameterized.class) - public static class StartWorkflowExecutionAsyncTest - extends BaseTest< - WorkflowService.StartWorkflowExecutionAsync_result, StartWorkflowExecutionAsyncResponse> { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.StartWorkflowExecutionAsync_result() - .setSuccess(new StartWorkflowExecutionAsyncResponse()), - null, - new StartWorkflowExecutionAsyncResponse() - }, - { - ResponseCode.Error, - new WorkflowService.StartWorkflowExecutionAsync_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.StartWorkflowExecutionAsync_result() - .setSessionAlreadyExistError(new WorkflowExecutionAlreadyStartedError()), - WorkflowExecutionAlreadyStartedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.StartWorkflowExecutionAsync_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.StartWorkflowExecutionAsync_result() - .setDomainNotActiveError(new DomainNotActiveError()), - DomainNotActiveError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.StartWorkflowExecutionAsync_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.StartWorkflowExecutionAsync_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.StartWorkflowExecutionAsync_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.StartWorkflowExecutionAsync_result() - .setDomainNotActiveError(new DomainNotActiveError()), - DomainNotActiveError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.StartWorkflowExecutionAsync_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.StartWorkflowExecutionAsync_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.StartWorkflowExecutionAsync_result(), - TException.class, - null - }, - }); - } - - @Test - public void responseIsHandledCorrectly() throws Exception { - testHelper( - () -> - service.StartWorkflowExecutionAsync( - new StartWorkflowExecutionAsyncRequest() - .setRequest(new StartWorkflowExecutionRequest()))); - } - - @Test - public void responseIsHandledCorrectWithCallback() throws TChannelError, TException { - testHelperWithCallback( - callback -> - service.StartWorkflowExecutionAsync( - new StartWorkflowExecutionAsyncRequest() - .setRequest(new StartWorkflowExecutionRequest()), - callback)); - testHelperWithCallback( - callback -> - service.StartWorkflowExecutionAsyncWithTimeout( - new StartWorkflowExecutionAsyncRequest() - .setRequest(new StartWorkflowExecutionRequest()), - callback, - 1000L)); - } - } - - @RunWith(Parameterized.class) - public static class StartWorkflowExecutionTest - extends BaseTest< - WorkflowService.StartWorkflowExecution_result, StartWorkflowExecutionResponse> { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.StartWorkflowExecution_result() - .setSuccess(new StartWorkflowExecutionResponse()), - null, - new StartWorkflowExecutionResponse() - }, - { - ResponseCode.Error, - new WorkflowService.StartWorkflowExecution_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.StartWorkflowExecution_result() - .setSessionAlreadyExistError(new WorkflowExecutionAlreadyStartedError()), - WorkflowExecutionAlreadyStartedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.StartWorkflowExecution_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.StartWorkflowExecution_result() - .setDomainNotActiveError(new DomainNotActiveError()), - DomainNotActiveError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.StartWorkflowExecution_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.StartWorkflowExecution_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.StartWorkflowExecution_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.StartWorkflowExecution_result() - .setDomainNotActiveError(new DomainNotActiveError()), - DomainNotActiveError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.StartWorkflowExecution_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.StartWorkflowExecution_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.StartWorkflowExecution_result(), - TException.class, - null - }, - }); - } - - @Test - public void responseIsHandledCorrectly() throws Exception { - testHelper(() -> service.StartWorkflowExecution(new StartWorkflowExecutionRequest())); - } - - @Test - public void responseIsHandledCorrectWithCallback() throws TChannelError, TException { - testHelperWithCallback( - callback -> - service.StartWorkflowExecution(new StartWorkflowExecutionRequest(), callback)); - testHelperWithCallback( - callback -> - service.StartWorkflowExecutionWithTimeout( - new StartWorkflowExecutionRequest(), callback, 1000L)); - } - } - - @RunWith(Parameterized.class) - public static class GetTaskListsByDomainTest - extends BaseTest { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.GetTaskListsByDomain_result() - .setSuccess(new GetTaskListsByDomainResponse()), - null, - new GetTaskListsByDomainResponse() - }, - { - ResponseCode.Error, - new WorkflowService.GetTaskListsByDomain_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.GetTaskListsByDomain_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.GetTaskListsByDomain_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.GetTaskListsByDomain_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.GetTaskListsByDomain_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.GetTaskListsByDomain_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.GetTaskListsByDomain_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.GetTaskListsByDomain_result(), - TException.class, - null - }, - }); - } - - @Test - public void responseIsHandledCorrectly() throws Exception { - testHelper(() -> service.GetTaskListsByDomain(new GetTaskListsByDomainRequest())); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> service.GetTaskListsByDomain(new GetTaskListsByDomainRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class DeprecateDomainTest - extends BaseTest { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - {ResponseCode.OK, new WorkflowService.DeprecateDomain_result(), null, null}, - { - ResponseCode.Error, - new WorkflowService.DeprecateDomain_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.DeprecateDomain_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.DeprecateDomain_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.DeprecateDomain_result() - .setDomainNotActiveError(new DomainNotActiveError()), - DomainNotActiveError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.DeprecateDomain_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.DeprecateDomain_result(), - TException.class, - null - }, - }); - } - - @Test - public void responseIsHandledCorrectly() throws Exception { - testHelper( - () -> { - service.DeprecateDomain(new DeprecateDomainRequest()); - return null; - }); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> service.DeprecateDomain(new DeprecateDomainRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class PollForDecisionTaskTest - extends BaseTest { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.PollForDecisionTask_result() - .setSuccess(new PollForDecisionTaskResponse()), - null, - new PollForDecisionTaskResponse() - }, - { - ResponseCode.Error, - new WorkflowService.PollForDecisionTask_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.PollForDecisionTask_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.PollForDecisionTask_result() - .setDomainNotActiveError(new DomainNotActiveError()), - DomainNotActiveError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.PollForDecisionTask_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.PollForDecisionTask_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.PollForDecisionTask_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.PollForDecisionTask_result(), - TException.class, - null - }, - }); - } - - @Test - public void responseIsHandledCorrectly() throws Exception { - testHelper(() -> service.PollForDecisionTask(new PollForDecisionTaskRequest())); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> service.PollForDecisionTask(new PollForDecisionTaskRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class RespondDecisionTaskCompletedTest - extends BaseTest< - WorkflowService.RespondDecisionTaskCompleted_result, - RespondDecisionTaskCompletedResponse> { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.RespondDecisionTaskCompleted_result() - .setSuccess(new RespondDecisionTaskCompletedResponse()), - null, - new RespondDecisionTaskCompletedResponse() - }, - { - ResponseCode.Error, - new WorkflowService.RespondDecisionTaskCompleted_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondDecisionTaskCompleted_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondDecisionTaskCompleted_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondDecisionTaskCompleted_result() - .setDomainNotActiveError(new DomainNotActiveError()), - DomainNotActiveError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondDecisionTaskCompleted_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondDecisionTaskCompleted_result() - .setWorkflowExecutionAlreadyCompletedError( - new WorkflowExecutionAlreadyCompletedError("")), - WorkflowExecutionAlreadyCompletedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondDecisionTaskCompleted_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondDecisionTaskCompleted_result(), - TException.class, - null - }, - }); - } - - @Test - public void responseIsHandledCorrectly() throws Exception { - testHelper( - () -> service.RespondDecisionTaskCompleted(new RespondDecisionTaskCompletedRequest())); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> - service.RespondDecisionTaskCompleted( - new RespondDecisionTaskCompletedRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class PollForActivityTaskTest - extends BaseTest { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.PollForActivityTask_result() - .setSuccess(new PollForActivityTaskResponse()), - null, - new PollForActivityTaskResponse() - }, - { - ResponseCode.Error, - new WorkflowService.PollForActivityTask_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.PollForActivityTask_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.PollForActivityTask_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.PollForActivityTask_result() - .setDomainNotActiveError(new DomainNotActiveError()), - DomainNotActiveError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.PollForActivityTask_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.PollForActivityTask_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.PollForActivityTask_result(), - TException.class, - null - }, - }); - } - - @Test - public void responseIsHandledCorrectly() throws Exception { - testHelper(() -> service.PollForActivityTask(new PollForActivityTaskRequest())); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> service.PollForActivityTask(new PollForActivityTaskRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class RecordActivityTaskHeartbeatTest - extends BaseTest< - WorkflowService.RecordActivityTaskHeartbeat_result, RecordActivityTaskHeartbeatResponse> { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.RecordActivityTaskHeartbeat_result() - .setSuccess(new RecordActivityTaskHeartbeatResponse()), - null, - new RecordActivityTaskHeartbeatResponse() - }, - { - ResponseCode.Error, - new WorkflowService.RecordActivityTaskHeartbeat_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RecordActivityTaskHeartbeat_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RecordActivityTaskHeartbeat_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RecordActivityTaskHeartbeat_result() - .setDomainNotActiveError(new DomainNotActiveError()), - DomainNotActiveError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RecordActivityTaskHeartbeat_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RecordActivityTaskHeartbeat_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RecordActivityTaskHeartbeat_result() - .setWorkflowExecutionAlreadyCompletedError( - new WorkflowExecutionAlreadyCompletedError()), - WorkflowExecutionAlreadyCompletedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RecordActivityTaskHeartbeat_result(), - TException.class, - null - }, - }); - } - - @Test - public void responseIsHandledCorrectly() throws Exception { - testHelper( - () -> service.RecordActivityTaskHeartbeat(new RecordActivityTaskHeartbeatRequest())); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> - service.RecordActivityTaskHeartbeat( - new RecordActivityTaskHeartbeatRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class RecordActivityTaskHeartbeatByIDTest - extends BaseTest< - WorkflowService.RecordActivityTaskHeartbeatByID_result, - RecordActivityTaskHeartbeatResponse> { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.RecordActivityTaskHeartbeatByID_result() - .setSuccess(new RecordActivityTaskHeartbeatResponse()), - null, - new RecordActivityTaskHeartbeatResponse() - }, - { - ResponseCode.Error, - new WorkflowService.RecordActivityTaskHeartbeatByID_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RecordActivityTaskHeartbeatByID_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RecordActivityTaskHeartbeatByID_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RecordActivityTaskHeartbeatByID_result() - .setDomainNotActiveError(new DomainNotActiveError()), - DomainNotActiveError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RecordActivityTaskHeartbeatByID_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RecordActivityTaskHeartbeatByID_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RecordActivityTaskHeartbeatByID_result() - .setWorkflowExecutionAlreadyCompletedError( - new WorkflowExecutionAlreadyCompletedError()), - WorkflowExecutionAlreadyCompletedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RecordActivityTaskHeartbeatByID_result(), - TException.class, - null - }, - }); - } - - @Test - public void responseIsHandledCorrectly() throws Exception { - testHelper( - () -> - service.RecordActivityTaskHeartbeatByID( - new RecordActivityTaskHeartbeatByIDRequest())); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> - service.RecordActivityTaskHeartbeatByID( - new RecordActivityTaskHeartbeatByIDRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class RespondActivityTaskCompletedTest - extends BaseTest { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, new WorkflowService.RespondActivityTaskCompleted_result(), null, null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCompleted_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCompleted_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCompleted_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCompleted_result() - .setWorkflowExecutionAlreadyCompletedError( - new WorkflowExecutionAlreadyCompletedError("")), - WorkflowExecutionAlreadyCompletedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCompleted_result() - .setDomainNotActiveError(new DomainNotActiveError()), - DomainNotActiveError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCompleted_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCompleted_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCompleted_result(), - TException.class, - null - }, - }); - } - - @Test - public void responseIsHandledCorrectly() throws Exception { - testHelper( - () -> { - service.RespondActivityTaskCompleted(new RespondActivityTaskCompletedRequest()); - return null; - }); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> - service.RespondActivityTaskCompleted( - new RespondActivityTaskCompletedRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class RespondActivityTaskCompletedByIDTest - extends BaseTest { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.RespondActivityTaskCompletedByID_result(), - null, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCompletedByID_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCompletedByID_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCompletedByID_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCompletedByID_result() - .setDomainNotActiveError(new DomainNotActiveError()), - DomainNotActiveError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCompletedByID_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCompletedByID_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCompletedByID_result() - .setWorkflowExecutionAlreadyCompletedError( - new WorkflowExecutionAlreadyCompletedError("")), - WorkflowExecutionAlreadyCompletedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCompletedByID_result(), - TException.class, - null - }, - }); - } - - @Test - public void responseIsHandledCorrectly() throws Exception { - testHelper( - () -> { - service.RespondActivityTaskCompletedByID(new RespondActivityTaskCompletedByIDRequest()); - return null; - }); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> - service.RespondActivityTaskCompletedByID( - new RespondActivityTaskCompletedByIDRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class RespondActivityTaskFailedTest - extends BaseTest { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - {ResponseCode.OK, new WorkflowService.RespondActivityTaskFailed_result(), null, null}, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskFailed_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskFailed_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskFailed_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskFailed_result() - .setWorkflowExecutionAlreadyCompletedError( - new WorkflowExecutionAlreadyCompletedError("")), - WorkflowExecutionAlreadyCompletedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskFailed_result() - .setDomainNotActiveError(new DomainNotActiveError()), - DomainNotActiveError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskFailed_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskFailed_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskFailed_result(), - TException.class, - null - }, - }); - } - - @Test - public void responseIsHandledCorrectly() throws Exception { - testHelper( - () -> { - service.RespondActivityTaskFailed(new RespondActivityTaskFailedRequest()); - return null; - }); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> - service.RespondActivityTaskFailed(new RespondActivityTaskFailedRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class RespondActivityTaskFailedByIDTest - extends BaseTest { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.RespondActivityTaskFailedByID_result(), - null, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskFailedByID_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskFailedByID_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskFailedByID_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskFailedByID_result(), - TException.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskFailedByID_result() - .setDomainNotActiveError(new DomainNotActiveError()), - DomainNotActiveError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskFailedByID_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskFailedByID_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskFailedByID_result() - .setWorkflowExecutionAlreadyCompletedError( - new WorkflowExecutionAlreadyCompletedError("")), - WorkflowExecutionAlreadyCompletedError.class, - null - }, - }); - } - - @Test - public void responseIsHandledCorrectly() throws Exception { - testHelper( - () -> { - service.RespondActivityTaskFailedByID(new RespondActivityTaskFailedByIDRequest()); - return null; - }); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> - service.RespondActivityTaskFailedByID( - new RespondActivityTaskFailedByIDRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class RespondActivityTaskCanceledTest - extends BaseTest { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - {ResponseCode.OK, new WorkflowService.RespondActivityTaskCanceled_result(), null, null}, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCanceled_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCanceled_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCanceled_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCanceled_result(), - TException.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCanceled_result() - .setDomainNotActiveError(new DomainNotActiveError()), - DomainNotActiveError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCanceled_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCanceled_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCanceled_result() - .setWorkflowExecutionAlreadyCompletedError( - new WorkflowExecutionAlreadyCompletedError("")), - WorkflowExecutionAlreadyCompletedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCanceled_result(), - TException.class, - null - } - }); - } - - @Test - public void responseIsHandledCorrectly() throws Exception { - testHelper( - () -> { - service.RespondActivityTaskCanceled(new RespondActivityTaskCanceledRequest()); - return null; - }); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> - service.RespondActivityTaskCanceled( - new RespondActivityTaskCanceledRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class RespondActivityTaskCanceledByIDTest - extends BaseTest { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.RespondActivityTaskCanceledByID_result(), - null, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCanceledByID_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCanceledByID_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCanceledByID_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCanceledByID_result(), - TException.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCanceledByID_result() - .setDomainNotActiveError(new DomainNotActiveError()), - DomainNotActiveError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCanceledByID_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCanceledByID_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondActivityTaskCanceledByID_result() - .setWorkflowExecutionAlreadyCompletedError( - new WorkflowExecutionAlreadyCompletedError("")), - WorkflowExecutionAlreadyCompletedError.class, - null - }, - }); - } - - @Test - public void responseIsHandledCorrectly() throws Exception { - testHelper( - () -> { - service.RespondActivityTaskCanceledByID(new RespondActivityTaskCanceledByIDRequest()); - return null; - }); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> - service.RespondActivityTaskCanceledByID( - new RespondActivityTaskCanceledByIDRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class RequestCancelWorkflowExecutionTest - extends BaseTest { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.RequestCancelWorkflowExecution_result(), - null, - null - }, - { - ResponseCode.Error, - new WorkflowService.RequestCancelWorkflowExecution_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RequestCancelWorkflowExecution_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RequestCancelWorkflowExecution_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RequestCancelWorkflowExecution_result(), - TException.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RequestCancelWorkflowExecution_result() - .setDomainNotActiveError(new DomainNotActiveError()), - DomainNotActiveError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RequestCancelWorkflowExecution_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RequestCancelWorkflowExecution_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RequestCancelWorkflowExecution_result() - .setWorkflowExecutionAlreadyCompletedError( - new WorkflowExecutionAlreadyCompletedError("")), - WorkflowExecutionAlreadyCompletedError.class, - null - }, - }); - } - - @Test - public void responseIsHandledCorrectly() throws Exception { - testHelper( - () -> { - service.RequestCancelWorkflowExecution(new RequestCancelWorkflowExecutionRequest()); - return null; - }); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> - service.RequestCancelWorkflowExecution( - new RequestCancelWorkflowExecutionRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class SignalWorkflowExecutionTest - extends BaseTest { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - {ResponseCode.OK, new WorkflowService.SignalWorkflowExecution_result(), null, null}, - { - ResponseCode.Error, - new WorkflowService.SignalWorkflowExecution_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.SignalWorkflowExecution_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.SignalWorkflowExecution_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.SignalWorkflowExecution_result(), - TException.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.SignalWorkflowExecution_result() - .setDomainNotActiveError(new DomainNotActiveError()), - DomainNotActiveError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.SignalWorkflowExecution_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.SignalWorkflowExecution_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.SignalWorkflowExecution_result() - .setWorkflowExecutionAlreadyCompletedError( - new WorkflowExecutionAlreadyCompletedError("")), - WorkflowExecutionAlreadyCompletedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.SignalWorkflowExecution_result(), - TException.class, - null - }, - }); - } - - @Test - public void responseIsHandledCorrectly() throws Exception { - testHelper( - () -> { - service.SignalWorkflowExecution(new SignalWorkflowExecutionRequest()); - return null; - }); - } - - @Test - public void responseIsHandledCorrectlyWithCallback() throws Exception { - testHelperWithCallback( - callback -> { - service.SignalWorkflowExecution(new SignalWorkflowExecutionRequest(), callback); - }); - } - } - - @RunWith(Parameterized.class) - public static class SignalWithStartWorkflowExecutionTest - extends BaseTest< - WorkflowService.SignalWithStartWorkflowExecution_result, StartWorkflowExecutionResponse> { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.SignalWithStartWorkflowExecution_result() - .setSuccess(new StartWorkflowExecutionResponse()), - null, - new StartWorkflowExecutionResponse() - }, - { - ResponseCode.Error, - new WorkflowService.SignalWithStartWorkflowExecution_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.SignalWithStartWorkflowExecution_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.SignalWithStartWorkflowExecution_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.SignalWithStartWorkflowExecution_result(), - TException.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.SignalWithStartWorkflowExecution_result() - .setDomainNotActiveError(new DomainNotActiveError()), - DomainNotActiveError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.SignalWithStartWorkflowExecution_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.SignalWithStartWorkflowExecution_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - }); - } - - @Test - public void responseIsHandledCorrectly() throws Exception { - testHelper( - () -> - service.SignalWithStartWorkflowExecution( - new SignalWithStartWorkflowExecutionRequest())); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> - service.SignalWithStartWorkflowExecution( - new SignalWithStartWorkflowExecutionRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class RefreshWorkflowTasksTest - extends BaseTest { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - {ResponseCode.OK, new WorkflowService.RefreshWorkflowTasks_result(), null, null}, - { - ResponseCode.Error, - new WorkflowService.RefreshWorkflowTasks_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RefreshWorkflowTasks_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RefreshWorkflowTasks_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RefreshWorkflowTasks_result() - .setDomainNotActiveError(new DomainNotActiveError()), - DomainNotActiveError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RefreshWorkflowTasks_result(), - TException.class, - null - }, - }); - } - - @Test - public void responseIsHandledCorrectly() throws Exception { - testHelper( - () -> { - service.RefreshWorkflowTasks(new RefreshWorkflowTasksRequest()); - return null; - }); - } - - @Test - public void callbackIsNotSupported() { - assertNoOpWithCallback( - callback -> service.RefreshWorkflowTasks(new RefreshWorkflowTasksRequest(), callback)); - } - } - - @RunWith(Parameterized.class) - public static class SignalWithStartWorkflowExecutionAsyncTest - extends BaseTest< - WorkflowService.SignalWithStartWorkflowExecutionAsync_result, - SignalWithStartWorkflowExecutionAsyncResponse> { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new WorkflowService.SignalWithStartWorkflowExecutionAsync_result() - .setSuccess(new SignalWithStartWorkflowExecutionAsyncResponse()), - null, - new SignalWithStartWorkflowExecutionAsyncResponse() - }, - { - ResponseCode.Error, - new WorkflowService.SignalWithStartWorkflowExecutionAsync_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.SignalWithStartWorkflowExecutionAsync_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.SignalWithStartWorkflowExecutionAsync_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.SignalWithStartWorkflowExecutionAsync_result(), - TException.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.SignalWithStartWorkflowExecutionAsync_result() - .setDomainNotActiveError(new DomainNotActiveError()), - DomainNotActiveError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.SignalWithStartWorkflowExecutionAsync_result() - .setLimitExceededError(new LimitExceededError("")), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.SignalWithStartWorkflowExecutionAsync_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - } - }); - } - - @Test - public void responseIsHandledCorrectly() throws Exception { - testHelper( - () -> - service.SignalWithStartWorkflowExecutionAsync( - new SignalWithStartWorkflowExecutionAsyncRequest() - .setRequest(new SignalWithStartWorkflowExecutionRequest()))); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> - service.SignalWithStartWorkflowExecutionAsync( - new SignalWithStartWorkflowExecutionAsyncRequest() - .setRequest(new SignalWithStartWorkflowExecutionRequest()), - callback)); - } - } - - @RunWith(Parameterized.class) - public static class RespondDecisionTaskFailedTest - extends BaseTest { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - {ResponseCode.OK, new WorkflowService.RespondDecisionTaskFailed_result(), null, null}, - { - ResponseCode.Error, - new WorkflowService.RespondDecisionTaskFailed_result() - .setBadRequestError(new BadRequestError("")), - BadRequestError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondDecisionTaskFailed_result() - .setEntityNotExistError(new EntityNotExistsError("")), - EntityNotExistsError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondDecisionTaskFailed_result() - .setWorkflowExecutionAlreadyCompletedError( - new WorkflowExecutionAlreadyCompletedError("")), - WorkflowExecutionAlreadyCompletedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondDecisionTaskFailed_result() - .setServiceBusyError(new ServiceBusyError("")), - ServiceBusyError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondDecisionTaskFailed_result() - .setDomainNotActiveError(new DomainNotActiveError()), - DomainNotActiveError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondDecisionTaskFailed_result() - .setClientVersionNotSupportedError(new ClientVersionNotSupportedError()), - ClientVersionNotSupportedError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondDecisionTaskFailed_result() - .setLimitExceededError(new LimitExceededError()), - LimitExceededError.class, - null - }, - { - ResponseCode.Error, - new WorkflowService.RespondDecisionTaskFailed_result(), - TException.class, - null - }, - }); - } - - @Test - public void responseIsHandledCorrectly() throws Exception { - testHelper( - () -> { - service.RespondDecisionTaskFailed(new RespondDecisionTaskFailedRequest()); - return null; - }); - } - - @Test - public void callbackIsNotSupported() { - assertUnimplementedWithCallback( - callback -> - service.RespondDecisionTaskFailed(new RespondDecisionTaskFailedRequest(), callback)); - } - } - - public static class ConstructorTest { - @Test - public void testDefault() { - IWorkflowService service = new WorkflowServiceTChannel(ClientOptions.newBuilder().build()); - assertNotNull(service); - } - } - - @RunWith(Parameterized.class) - public static class IsHealthyTest extends BaseTest { - @Parameterized.Parameters(name = "{index}: Response Code {0}, Response {1}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - { - ResponseCode.OK, - new Meta.health_result().setSuccess(new HealthStatus().setOk(true)), - null, - Boolean.TRUE - }, - { - ResponseCode.OK, - new Meta.health_result().setSuccess(new HealthStatus().setOk(false)), - null, - Boolean.FALSE - }, - }); - } - - @Test - public void testResult() throws TException, TChannelError { - testHelper( - () -> { - try { - return service.isHealthy().get(); - } catch (Exception e) { - fail("should not throw exception: " + e); - } - return null; - }); - } - } -} diff --git a/src/test/java/com/uber/cadence/testUtils/HistoryUtils.java b/src/test/java/com/uber/cadence/testUtils/HistoryUtils.java index 58d385fee..533653670 100644 --- a/src/test/java/com/uber/cadence/testUtils/HistoryUtils.java +++ b/src/test/java/com/uber/cadence/testUtils/HistoryUtils.java @@ -72,8 +72,8 @@ public static PollForDecisionTaskResponse generateDecisionTaskWithPartialHistory TestWorkflowService service) throws Exception { - signalWorkflow(response.workflowExecution, domain, service); - respondDecisionTaskCompletedWithSticky(response.taskToken, stickyTaskListName, service); + signalWorkflow(response.getWorkflowExecution(), domain, service); + respondDecisionTaskCompletedWithSticky(response.getTaskToken(), stickyTaskListName, service); return pollForDecisionTask(domain, createStickyTaskList(stickyTaskListName), service); } } diff --git a/src/test/java/com/uber/cadence/testUtils/TestEnvironment.java b/src/test/java/com/uber/cadence/testUtils/TestEnvironment.java index 08faf2c67..29f1f1b31 100644 --- a/src/test/java/com/uber/cadence/testUtils/TestEnvironment.java +++ b/src/test/java/com/uber/cadence/testUtils/TestEnvironment.java @@ -14,10 +14,9 @@ */ package com.uber.cadence.testUtils; -import com.uber.cadence.internal.compatibility.Thrift2ProtoAdapter; -import com.uber.cadence.internal.compatibility.proto.serviceclient.IGrpcServiceStubs; import com.uber.cadence.serviceclient.ClientOptions; import com.uber.cadence.serviceclient.IWorkflowService; +import com.uber.cadence.serviceclient.WorkflowServiceGrpc; public final class TestEnvironment { public static final String DOMAIN = "UnitTest"; @@ -42,7 +41,6 @@ public static boolean isUseDockerService() { } public static IWorkflowService getDockerService() { - return new Thrift2ProtoAdapter( - IGrpcServiceStubs.newInstance(ClientOptions.newBuilder().setPort(7833).build())); + return new WorkflowServiceGrpc(ClientOptions.newBuilder().setPort(7833).build()); } } diff --git a/src/test/java/com/uber/cadence/testUtils/TestServiceUtils.java b/src/test/java/com/uber/cadence/testUtils/TestServiceUtils.java index b6c58bb0c..68473f5f0 100644 --- a/src/test/java/com/uber/cadence/testUtils/TestServiceUtils.java +++ b/src/test/java/com/uber/cadence/testUtils/TestServiceUtils.java @@ -22,7 +22,6 @@ import com.uber.cadence.*; import com.uber.cadence.internal.testservice.TestWorkflowService; -import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.UUID; @@ -43,26 +42,24 @@ public static void startWorkflowExecution( int taskStartToCloseTimeoutSeconds, TestWorkflowService service) throws Exception { - StartWorkflowExecutionRequest request = new StartWorkflowExecutionRequest(); - request.domain = domain; - request.workflowId = UUID.randomUUID().toString(); - request.taskList = createNormalTaskList(tasklistName); - request.setExecutionStartToCloseTimeoutSeconds(executionStartToCloseTimeoutSeconds); - request.setTaskStartToCloseTimeoutSeconds(taskStartToCloseTimeoutSeconds); - WorkflowType type = new WorkflowType(); - type.name = workflowType; - request.workflowType = type; + StartWorkflowExecutionRequest request = + new StartWorkflowExecutionRequest() + .setDomain(domain) + .setWorkflowId(UUID.randomUUID().toString()) + .setTaskList(createNormalTaskList(tasklistName)) + .setExecutionStartToCloseTimeoutSeconds(executionStartToCloseTimeoutSeconds) + .setTaskStartToCloseTimeoutSeconds(taskStartToCloseTimeoutSeconds) + .setWorkflowType(new WorkflowType().setName(workflowType)); service.StartWorkflowExecution(request); } public static void respondDecisionTaskCompletedWithSticky( - ByteBuffer taskToken, String stickyTasklistName, TestWorkflowService service) - throws Exception { + byte[] taskToken, String stickyTasklistName, TestWorkflowService service) throws Exception { respondDecisionTaskCompletedWithSticky(taskToken, stickyTasklistName, 100, service); } public static void respondDecisionTaskCompletedWithSticky( - ByteBuffer taskToken, + byte[] taskToken, String stickyTasklistName, int startToCloseTimeout, TestWorkflowService service) @@ -78,7 +75,7 @@ public static void respondDecisionTaskCompletedWithSticky( } public static void respondDecisionTaskFailedWithSticky( - ByteBuffer taskToken, TestWorkflowService service) throws Exception { + byte[] taskToken, TestWorkflowService service) throws Exception { RespondDecisionTaskFailedRequest request = new RespondDecisionTaskFailedRequest(); request.setTaskToken(taskToken); service.RespondDecisionTaskFailed(request); diff --git a/src/test/java/com/uber/cadence/worker/CleanWorkerShutdownTest.java b/src/test/java/com/uber/cadence/worker/CleanWorkerShutdownTest.java index a91315e1b..132f35d65 100644 --- a/src/test/java/com/uber/cadence/worker/CleanWorkerShutdownTest.java +++ b/src/test/java/com/uber/cadence/worker/CleanWorkerShutdownTest.java @@ -21,11 +21,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import com.uber.cadence.EventType; -import com.uber.cadence.GetWorkflowExecutionHistoryRequest; -import com.uber.cadence.GetWorkflowExecutionHistoryResponse; -import com.uber.cadence.HistoryEvent; -import com.uber.cadence.WorkflowExecution; +import com.uber.cadence.*; import com.uber.cadence.activity.Activity; import com.uber.cadence.activity.ActivityMethod; import com.uber.cadence.client.ActivityWorkerShutdownException; @@ -44,7 +40,6 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; -import org.apache.thrift.TException; import org.junit.After; import org.junit.Before; import org.junit.Rule; @@ -128,7 +123,7 @@ public String execute() { } @Test - public void testShutdown() throws ExecutionException, InterruptedException, TException { + public void testShutdown() throws ExecutionException, InterruptedException, BaseError { String taskList = "CleanWorkerShutdownTest-" + testName.getMethodName() + "-" + UUID.randomUUID().toString(); WorkflowClient workflowClient; @@ -182,7 +177,7 @@ public void testShutdown() throws ExecutionException, InterruptedException, TExc } @Test - public void testShutdownNow() throws ExecutionException, InterruptedException, TException { + public void testShutdownNow() throws ExecutionException, InterruptedException, BaseError { String taskList = "CleanWorkerShutdownTest-" + testName.getMethodName() + "-" + UUID.randomUUID().toString(); WorkflowClient workflowClient; @@ -263,7 +258,7 @@ public String execute() { */ @Test public void testShutdownHeartbeatingActivity() - throws ExecutionException, InterruptedException, TException { + throws ExecutionException, InterruptedException, BaseError { String taskList = "CleanWorkerShutdownTest-" + testName.getMethodName() + "-" + UUID.randomUUID().toString(); WorkflowClient workflowClient; diff --git a/src/test/java/com/uber/cadence/worker/ShadowingWorkerTest.java b/src/test/java/com/uber/cadence/worker/ShadowingWorkerTest.java index 7c338731a..c5bf5b401 100644 --- a/src/test/java/com/uber/cadence/worker/ShadowingWorkerTest.java +++ b/src/test/java/com/uber/cadence/worker/ShadowingWorkerTest.java @@ -29,11 +29,12 @@ import com.uber.cadence.WorkflowType; import com.uber.cadence.client.WorkflowClient; import com.uber.cadence.client.WorkflowClientOptions; +import com.uber.cadence.converter.JsonDataConverter; import com.uber.cadence.serviceclient.IWorkflowService; +import com.uber.cadence.shadower.Constants; import com.uber.cadence.shadower.ExitCondition; import com.uber.cadence.shadower.Mode; import com.uber.cadence.shadower.WorkflowParams; -import com.uber.cadence.shadower.shadowerConstants; import com.uber.m3.tally.NoopScope; import java.time.ZonedDateTime; import java.util.Arrays; @@ -87,14 +88,14 @@ public void testStartShadowingWorkflow_ReceiveExpectedRequest() throws Exception .setWorkflowQuery(shadowingOptions.getWorkflowQuery()); StartWorkflowExecutionRequest expectedRequest = new StartWorkflowExecutionRequest() - .setDomain(shadowerConstants.LocalDomainName) - .setWorkflowId(shadowingOptions.getDomain() + shadowerConstants.WorkflowIDSuffix) - .setTaskList(new TaskList().setName(shadowerConstants.TaskList)) - .setWorkflowType(new WorkflowType().setName(shadowerConstants.WorkflowName)) + .setDomain(Constants.LocalDomainName) + .setWorkflowId(shadowingOptions.getDomain() + Constants.WorkflowIDSuffix) + .setTaskList(new TaskList().setName(Constants.TaskList)) + .setWorkflowType(new WorkflowType().setName(Constants.WorkflowName)) .setWorkflowIdReusePolicy(WorkflowIdReusePolicy.AllowDuplicate) .setExecutionStartToCloseTimeoutSeconds(864000) .setTaskStartToCloseTimeoutSeconds(60) - .setInput(serializer.serialize(params)); + .setInput(JsonDataConverter.getInstance().toData(params)); when(mockService.StartWorkflowExecution(any())).thenReturn(null); shadowingWorker.startShadowingWorkflow(); diff --git a/src/test/java/com/uber/cadence/workflow/TestEnvironmentWorkflowTest.java b/src/test/java/com/uber/cadence/workflow/TestEnvironmentWorkflowTest.java index 81d69cef7..41a0b6e06 100644 --- a/src/test/java/com/uber/cadence/workflow/TestEnvironmentWorkflowTest.java +++ b/src/test/java/com/uber/cadence/workflow/TestEnvironmentWorkflowTest.java @@ -110,7 +110,7 @@ public void testCronWorkflow() { testEnv.getWorkflowService().ListClosedWorkflowExecutions(listRequest); Assert.assertEquals(2, listResponse.getExecutions().size()); for (WorkflowExecutionInfo e : listResponse.getExecutions()) { - assertTrue(e.isIsCron()); + assertTrue(e.isCron()); assertEquals(WorkflowExecutionCloseStatus.CONTINUED_AS_NEW, e.getCloseStatus()); } } catch (Exception e) { diff --git a/src/test/java/com/uber/cadence/workflow/WorkflowMigrationTest.java b/src/test/java/com/uber/cadence/workflow/WorkflowMigrationTest.java index ad9a368ee..421806f37 100644 --- a/src/test/java/com/uber/cadence/workflow/WorkflowMigrationTest.java +++ b/src/test/java/com/uber/cadence/workflow/WorkflowMigrationTest.java @@ -40,7 +40,6 @@ import com.uber.cadence.workflow.interceptors.TracingWorkflowInterceptorFactory; import java.util.UUID; import java.util.concurrent.CancellationException; -import org.apache.thrift.TException; import org.junit.*; public class WorkflowMigrationTest { @@ -187,7 +186,7 @@ public void continueAsNewWorkflowMigration() { } private GetWorkflowExecutionHistoryResponse getWorkflowHistory( - WorkflowClient wc, String workflowID) throws TException { + WorkflowClient wc, String workflowID) throws BaseError { return wc.getService() .GetWorkflowExecutionHistory( new GetWorkflowExecutionHistoryRequest() diff --git a/src/test/java/com/uber/cadence/workflow/WorkflowTest.java b/src/test/java/com/uber/cadence/workflow/WorkflowTest.java index 4535afd16..e6701a10b 100644 --- a/src/test/java/com/uber/cadence/workflow/WorkflowTest.java +++ b/src/test/java/com/uber/cadence/workflow/WorkflowTest.java @@ -1409,9 +1409,9 @@ public void testMemo() { GetWorkflowExecutionHistoryResponse historyResp = WorkflowExecutionUtils.getHistoryPage( new byte[] {}, workflowClient.getService(), DOMAIN, executionF); - HistoryEvent startEvent = historyResp.history.getEvents().get(0); - Memo memoFromEvent = startEvent.workflowExecutionStartedEventAttributes.getMemo(); - byte[] memoBytes = memoFromEvent.getFields().get(testMemoKey).array(); + HistoryEvent startEvent = historyResp.getHistory().getEvents().get(0); + Memo memoFromEvent = startEvent.getWorkflowExecutionStartedEventAttributes().getMemo(); + byte[] memoBytes = memoFromEvent.getFields().get(testMemoKey); String memoRetrieved = JsonDataConverter.getInstance().fromData(memoBytes, String.class, String.class); assertEquals(testMemoValue, memoRetrieved); @@ -1449,33 +1449,29 @@ public void testSearchAttributes() { GetWorkflowExecutionHistoryResponse historyResp = WorkflowExecutionUtils.getHistoryPage( new byte[] {}, workflowClient.getService(), DOMAIN, executionF); - HistoryEvent startEvent = historyResp.history.getEvents().get(0); + HistoryEvent startEvent = historyResp.getHistory().getEvents().get(0); SearchAttributes searchAttrFromEvent = - startEvent.workflowExecutionStartedEventAttributes.getSearchAttributes(); + startEvent.getWorkflowExecutionStartedEventAttributes().getSearchAttributes(); - byte[] searchAttrStringBytes = - searchAttrFromEvent.getIndexedFields().get(testKeyString).array(); + byte[] searchAttrStringBytes = searchAttrFromEvent.getIndexedFields().get(testKeyString); String retrievedString = JsonDataConverter.getInstance().fromData(searchAttrStringBytes, String.class, String.class); assertEquals(testValueString, retrievedString); - byte[] searchAttrIntegerBytes = - searchAttrFromEvent.getIndexedFields().get(testKeyInteger).array(); + byte[] searchAttrIntegerBytes = searchAttrFromEvent.getIndexedFields().get(testKeyInteger); Integer retrievedInteger = JsonDataConverter.getInstance() .fromData(searchAttrIntegerBytes, Integer.class, Integer.class); assertEquals(testValueInteger, retrievedInteger); - byte[] searchAttrDateTimeBytes = - searchAttrFromEvent.getIndexedFields().get(testKeyDateTime).array(); + byte[] searchAttrDateTimeBytes = searchAttrFromEvent.getIndexedFields().get(testKeyDateTime); LocalDateTime retrievedDateTime = JsonDataConverter.getInstance() .fromData(searchAttrDateTimeBytes, LocalDateTime.class, LocalDateTime.class); assertEquals(testValueDateTime, retrievedDateTime); - byte[] searchAttrBoolBytes = searchAttrFromEvent.getIndexedFields().get(testKeyBool).array(); + byte[] searchAttrBoolBytes = searchAttrFromEvent.getIndexedFields().get(testKeyBool); Boolean retrievedBool = JsonDataConverter.getInstance().fromData(searchAttrBoolBytes, Boolean.class, Boolean.class); assertEquals(testValueBool, retrievedBool); - byte[] searchAttrDoubleBytes = - searchAttrFromEvent.getIndexedFields().get(testKeyDouble).array(); + byte[] searchAttrDoubleBytes = searchAttrFromEvent.getIndexedFields().get(testKeyDouble); Double retrievedDouble = JsonDataConverter.getInstance().fromData(searchAttrDoubleBytes, Double.class, Double.class); assertEquals(testValueDouble, retrievedDouble);