go.uber.org/cadence@v1.2.9/internal/compatibility/api_test.go (about) 1 // Copyright (c) 2021 Uber Technologies Inc. 2 // 3 // Permission is hereby granted, free of charge, to any person obtaining a copy 4 // of this software and associated documentation files (the "Software"), to deal 5 // in the Software without restriction, including without limitation the rights 6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 // copies of the Software, and to permit persons to whom the Software is 8 // furnished to do so, subject to the following conditions: 9 // 10 // The above copyright notice and this permission notice shall be included in all 11 // copies or substantial portions of the Software. 12 // 13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 // SOFTWARE. 20 21 package compatibility 22 23 import ( 24 "testing" 25 26 gogo "github.com/gogo/protobuf/types" 27 "github.com/stretchr/testify/assert" 28 29 "go.uber.org/cadence/.gen/go/shared" 30 "go.uber.org/cadence/internal/common" 31 "go.uber.org/cadence/internal/compatibility/proto" 32 "go.uber.org/cadence/internal/compatibility/testdata" 33 "go.uber.org/cadence/internal/compatibility/thrift" 34 35 apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" 36 ) 37 38 func TestActivityLocalDispatchInfo(t *testing.T) { 39 for _, item := range []*apiv1.ActivityLocalDispatchInfo{nil, {}, &testdata.ActivityLocalDispatchInfo} { 40 assert.Equal(t, item, proto.ActivityLocalDispatchInfo(thrift.ActivityLocalDispatchInfo(item))) 41 } 42 } 43 func TestActivityTaskCancelRequestedEventAttributes(t *testing.T) { 44 for _, item := range []*apiv1.ActivityTaskCancelRequestedEventAttributes{nil, {}, &testdata.ActivityTaskCancelRequestedEventAttributes} { 45 assert.Equal(t, item, proto.ActivityTaskCancelRequestedEventAttributes(thrift.ActivityTaskCancelRequestedEventAttributes(item))) 46 } 47 } 48 func TestActivityTaskCanceledEventAttributes(t *testing.T) { 49 for _, item := range []*apiv1.ActivityTaskCanceledEventAttributes{nil, {}, &testdata.ActivityTaskCanceledEventAttributes} { 50 assert.Equal(t, item, proto.ActivityTaskCanceledEventAttributes(thrift.ActivityTaskCanceledEventAttributes(item))) 51 } 52 } 53 func TestActivityTaskCompletedEventAttributes(t *testing.T) { 54 for _, item := range []*apiv1.ActivityTaskCompletedEventAttributes{nil, {}, &testdata.ActivityTaskCompletedEventAttributes} { 55 assert.Equal(t, item, proto.ActivityTaskCompletedEventAttributes(thrift.ActivityTaskCompletedEventAttributes(item))) 56 } 57 } 58 func TestActivityTaskFailedEventAttributes(t *testing.T) { 59 for _, item := range []*apiv1.ActivityTaskFailedEventAttributes{nil, {}, &testdata.ActivityTaskFailedEventAttributes} { 60 assert.Equal(t, item, proto.ActivityTaskFailedEventAttributes(thrift.ActivityTaskFailedEventAttributes(item))) 61 } 62 } 63 func TestActivityTaskScheduledEventAttributes(t *testing.T) { 64 for _, item := range []*apiv1.ActivityTaskScheduledEventAttributes{nil, {}, &testdata.ActivityTaskScheduledEventAttributes} { 65 assert.Equal(t, item, proto.ActivityTaskScheduledEventAttributes(thrift.ActivityTaskScheduledEventAttributes(item))) 66 } 67 } 68 func TestActivityTaskStartedEventAttributes(t *testing.T) { 69 for _, item := range []*apiv1.ActivityTaskStartedEventAttributes{nil, {}, &testdata.ActivityTaskStartedEventAttributes} { 70 assert.Equal(t, item, proto.ActivityTaskStartedEventAttributes(thrift.ActivityTaskStartedEventAttributes(item))) 71 } 72 } 73 func TestActivityTaskTimedOutEventAttributes(t *testing.T) { 74 for _, item := range []*apiv1.ActivityTaskTimedOutEventAttributes{nil, {}, &testdata.ActivityTaskTimedOutEventAttributes} { 75 assert.Equal(t, item, proto.ActivityTaskTimedOutEventAttributes(thrift.ActivityTaskTimedOutEventAttributes(item))) 76 } 77 } 78 func TestActivityType(t *testing.T) { 79 for _, item := range []*apiv1.ActivityType{nil, {}, &testdata.ActivityType} { 80 assert.Equal(t, item, proto.ActivityType(thrift.ActivityType(item))) 81 } 82 } 83 func TestBadBinaries(t *testing.T) { 84 for _, item := range []*apiv1.BadBinaries{nil, {}, &testdata.BadBinaries} { 85 assert.Equal(t, item, proto.BadBinaries(thrift.BadBinaries(item))) 86 } 87 } 88 func TestBadBinaryInfo(t *testing.T) { 89 for _, item := range []*apiv1.BadBinaryInfo{nil, {}, &testdata.BadBinaryInfo} { 90 assert.Equal(t, item, proto.BadBinaryInfo(thrift.BadBinaryInfo(item))) 91 } 92 } 93 func TestCancelTimerFailedEventAttributes(t *testing.T) { 94 for _, item := range []*apiv1.CancelTimerFailedEventAttributes{nil, {}, &testdata.CancelTimerFailedEventAttributes} { 95 assert.Equal(t, item, proto.CancelTimerFailedEventAttributes(thrift.CancelTimerFailedEventAttributes(item))) 96 } 97 } 98 func TestChildWorkflowExecutionCanceledEventAttributes(t *testing.T) { 99 for _, item := range []*apiv1.ChildWorkflowExecutionCanceledEventAttributes{nil, {}, &testdata.ChildWorkflowExecutionCanceledEventAttributes} { 100 assert.Equal(t, item, proto.ChildWorkflowExecutionCanceledEventAttributes(thrift.ChildWorkflowExecutionCanceledEventAttributes(item))) 101 } 102 } 103 func TestChildWorkflowExecutionCompletedEventAttributes(t *testing.T) { 104 for _, item := range []*apiv1.ChildWorkflowExecutionCompletedEventAttributes{nil, {}, &testdata.ChildWorkflowExecutionCompletedEventAttributes} { 105 assert.Equal(t, item, proto.ChildWorkflowExecutionCompletedEventAttributes(thrift.ChildWorkflowExecutionCompletedEventAttributes(item))) 106 } 107 } 108 func TestChildWorkflowExecutionFailedEventAttributes(t *testing.T) { 109 for _, item := range []*apiv1.ChildWorkflowExecutionFailedEventAttributes{nil, {}, &testdata.ChildWorkflowExecutionFailedEventAttributes} { 110 assert.Equal(t, item, proto.ChildWorkflowExecutionFailedEventAttributes(thrift.ChildWorkflowExecutionFailedEventAttributes(item))) 111 } 112 } 113 func TestChildWorkflowExecutionStartedEventAttributes(t *testing.T) { 114 for _, item := range []*apiv1.ChildWorkflowExecutionStartedEventAttributes{nil, {}, &testdata.ChildWorkflowExecutionStartedEventAttributes} { 115 assert.Equal(t, item, proto.ChildWorkflowExecutionStartedEventAttributes(thrift.ChildWorkflowExecutionStartedEventAttributes(item))) 116 } 117 } 118 func TestChildWorkflowExecutionTerminatedEventAttributes(t *testing.T) { 119 for _, item := range []*apiv1.ChildWorkflowExecutionTerminatedEventAttributes{nil, {}, &testdata.ChildWorkflowExecutionTerminatedEventAttributes} { 120 assert.Equal(t, item, proto.ChildWorkflowExecutionTerminatedEventAttributes(thrift.ChildWorkflowExecutionTerminatedEventAttributes(item))) 121 } 122 } 123 func TestChildWorkflowExecutionTimedOutEventAttributes(t *testing.T) { 124 for _, item := range []*apiv1.ChildWorkflowExecutionTimedOutEventAttributes{nil, {}, &testdata.ChildWorkflowExecutionTimedOutEventAttributes} { 125 assert.Equal(t, item, proto.ChildWorkflowExecutionTimedOutEventAttributes(thrift.ChildWorkflowExecutionTimedOutEventAttributes(item))) 126 } 127 } 128 func TestClusterReplicationConfiguration(t *testing.T) { 129 for _, item := range []*apiv1.ClusterReplicationConfiguration{nil, {}, &testdata.ClusterReplicationConfiguration} { 130 assert.Equal(t, item, proto.ClusterReplicationConfiguration(thrift.ClusterReplicationConfiguration(item))) 131 } 132 } 133 func TestCountWorkflowExecutionsRequest(t *testing.T) { 134 for _, item := range []*apiv1.CountWorkflowExecutionsRequest{nil, {}, &testdata.CountWorkflowExecutionsRequest} { 135 assert.Equal(t, item, proto.CountWorkflowExecutionsRequest(thrift.CountWorkflowExecutionsRequest(item))) 136 } 137 } 138 func TestCountWorkflowExecutionsResponse(t *testing.T) { 139 for _, item := range []*apiv1.CountWorkflowExecutionsResponse{nil, {}, &testdata.CountWorkflowExecutionsResponse} { 140 assert.Equal(t, item, proto.CountWorkflowExecutionsResponse(thrift.CountWorkflowExecutionsResponse(item))) 141 } 142 } 143 func TestDataBlob(t *testing.T) { 144 for _, item := range []*apiv1.DataBlob{nil, {}, &testdata.DataBlob} { 145 assert.Equal(t, item, proto.DataBlob(thrift.DataBlob(item))) 146 } 147 } 148 func TestDecisionTaskCompletedEventAttributes(t *testing.T) { 149 for _, item := range []*apiv1.DecisionTaskCompletedEventAttributes{nil, {}, &testdata.DecisionTaskCompletedEventAttributes} { 150 assert.Equal(t, item, proto.DecisionTaskCompletedEventAttributes(thrift.DecisionTaskCompletedEventAttributes(item))) 151 } 152 } 153 func TestDecisionTaskFailedEventAttributes(t *testing.T) { 154 for _, item := range []*apiv1.DecisionTaskFailedEventAttributes{nil, {}, &testdata.DecisionTaskFailedEventAttributes} { 155 assert.Equal(t, item, proto.DecisionTaskFailedEventAttributes(thrift.DecisionTaskFailedEventAttributes(item))) 156 } 157 } 158 func TestDecisionTaskScheduledEventAttributes(t *testing.T) { 159 for _, item := range []*apiv1.DecisionTaskScheduledEventAttributes{nil, {}, &testdata.DecisionTaskScheduledEventAttributes} { 160 assert.Equal(t, item, proto.DecisionTaskScheduledEventAttributes(thrift.DecisionTaskScheduledEventAttributes(item))) 161 } 162 } 163 func TestDecisionTaskStartedEventAttributes(t *testing.T) { 164 for _, item := range []*apiv1.DecisionTaskStartedEventAttributes{nil, {}, &testdata.DecisionTaskStartedEventAttributes} { 165 assert.Equal(t, item, proto.DecisionTaskStartedEventAttributes(thrift.DecisionTaskStartedEventAttributes(item))) 166 } 167 } 168 func TestDecisionTaskTimedOutEventAttributes(t *testing.T) { 169 for _, item := range []*apiv1.DecisionTaskTimedOutEventAttributes{nil, {}, &testdata.DecisionTaskTimedOutEventAttributes} { 170 assert.Equal(t, item, proto.DecisionTaskTimedOutEventAttributes(thrift.DecisionTaskTimedOutEventAttributes(item))) 171 } 172 } 173 func TestDeprecateDomainRequest(t *testing.T) { 174 for _, item := range []*apiv1.DeprecateDomainRequest{nil, {}, &testdata.DeprecateDomainRequest} { 175 assert.Equal(t, item, proto.DeprecateDomainRequest(thrift.DeprecateDomainRequest(item))) 176 } 177 } 178 func TestDescribeDomainRequest(t *testing.T) { 179 for _, item := range []*apiv1.DescribeDomainRequest{ 180 &testdata.DescribeDomainRequest_ID, 181 &testdata.DescribeDomainRequest_Name, 182 } { 183 assert.Equal(t, item, proto.DescribeDomainRequest(thrift.DescribeDomainRequest(item))) 184 } 185 assert.Nil(t, proto.DescribeDomainRequest(nil)) 186 assert.Nil(t, thrift.DescribeDomainRequest(nil)) 187 assert.Panics(t, func() { proto.DescribeDomainRequest(&shared.DescribeDomainRequest{}) }) 188 assert.Panics(t, func() { thrift.DescribeDomainRequest(&apiv1.DescribeDomainRequest{}) }) 189 } 190 func TestDescribeDomainResponse_Domain(t *testing.T) { 191 for _, item := range []*apiv1.Domain{nil, &testdata.Domain} { 192 assert.Equal(t, item, proto.DescribeDomainResponseDomain(thrift.DescribeDomainResponseDomain(item))) 193 } 194 } 195 func TestDescribeDomainResponse(t *testing.T) { 196 for _, item := range []*apiv1.DescribeDomainResponse{nil, &testdata.DescribeDomainResponse} { 197 assert.Equal(t, item, proto.DescribeDomainResponse(thrift.DescribeDomainResponse(item))) 198 } 199 } 200 func TestDescribeTaskListRequest(t *testing.T) { 201 for _, item := range []*apiv1.DescribeTaskListRequest{nil, {}, &testdata.DescribeTaskListRequest} { 202 assert.Equal(t, item, proto.DescribeTaskListRequest(thrift.DescribeTaskListRequest(item))) 203 } 204 } 205 func TestDescribeTaskListResponse(t *testing.T) { 206 for _, item := range []*apiv1.DescribeTaskListResponse{nil, {}, &testdata.DescribeTaskListResponse} { 207 assert.Equal(t, item, proto.DescribeTaskListResponse(thrift.DescribeTaskListResponse(item))) 208 } 209 } 210 func TestDescribeWorkflowExecutionRequest(t *testing.T) { 211 for _, item := range []*apiv1.DescribeWorkflowExecutionRequest{nil, {}, &testdata.DescribeWorkflowExecutionRequest} { 212 assert.Equal(t, item, proto.DescribeWorkflowExecutionRequest(thrift.DescribeWorkflowExecutionRequest(item))) 213 } 214 } 215 func TestDescribeWorkflowExecutionResponse(t *testing.T) { 216 for _, item := range []*apiv1.DescribeWorkflowExecutionResponse{nil, {}, &testdata.DescribeWorkflowExecutionResponse} { 217 assert.Equal(t, item, proto.DescribeWorkflowExecutionResponse(thrift.DescribeWorkflowExecutionResponse(item))) 218 } 219 } 220 func TestExternalWorkflowExecutionCancelRequestedEventAttributes(t *testing.T) { 221 for _, item := range []*apiv1.ExternalWorkflowExecutionCancelRequestedEventAttributes{nil, {}, &testdata.ExternalWorkflowExecutionCancelRequestedEventAttributes} { 222 assert.Equal(t, item, proto.ExternalWorkflowExecutionCancelRequestedEventAttributes(thrift.ExternalWorkflowExecutionCancelRequestedEventAttributes(item))) 223 } 224 } 225 func TestExternalWorkflowExecutionSignaledEventAttributes(t *testing.T) { 226 for _, item := range []*apiv1.ExternalWorkflowExecutionSignaledEventAttributes{nil, {}, &testdata.ExternalWorkflowExecutionSignaledEventAttributes} { 227 assert.Equal(t, item, proto.ExternalWorkflowExecutionSignaledEventAttributes(thrift.ExternalWorkflowExecutionSignaledEventAttributes(item))) 228 } 229 } 230 func TestGetClusterInfoResponse(t *testing.T) { 231 for _, item := range []*apiv1.GetClusterInfoResponse{nil, {}, &testdata.GetClusterInfoResponse} { 232 assert.Equal(t, item, proto.GetClusterInfoResponse(thrift.GetClusterInfoResponse(item))) 233 } 234 } 235 func TestGetSearchAttributesResponse(t *testing.T) { 236 for _, item := range []*apiv1.GetSearchAttributesResponse{nil, {}, &testdata.GetSearchAttributesResponse} { 237 assert.Equal(t, item, proto.GetSearchAttributesResponse(thrift.GetSearchAttributesResponse(item))) 238 } 239 } 240 func TestGetWorkflowExecutionHistoryRequest(t *testing.T) { 241 for _, item := range []*apiv1.GetWorkflowExecutionHistoryRequest{nil, {}, &testdata.GetWorkflowExecutionHistoryRequest} { 242 assert.Equal(t, item, proto.GetWorkflowExecutionHistoryRequest(thrift.GetWorkflowExecutionHistoryRequest(item))) 243 } 244 } 245 func TestGetWorkflowExecutionHistoryResponse(t *testing.T) { 246 for _, item := range []*apiv1.GetWorkflowExecutionHistoryResponse{nil, {}, &testdata.GetWorkflowExecutionHistoryResponse} { 247 assert.Equal(t, item, proto.GetWorkflowExecutionHistoryResponse(thrift.GetWorkflowExecutionHistoryResponse(item))) 248 } 249 } 250 func TestHeader(t *testing.T) { 251 for _, item := range []*apiv1.Header{nil, {}, &testdata.Header} { 252 assert.Equal(t, item, proto.Header(thrift.Header(item))) 253 } 254 } 255 func TestHistory(t *testing.T) { 256 for _, item := range []*apiv1.History{nil, {}, &testdata.History} { 257 assert.Equal(t, item, proto.History(thrift.History(item))) 258 } 259 } 260 func TestListArchivedWorkflowExecutionsRequest(t *testing.T) { 261 for _, item := range []*apiv1.ListArchivedWorkflowExecutionsRequest{nil, {}, &testdata.ListArchivedWorkflowExecutionsRequest} { 262 assert.Equal(t, item, proto.ListArchivedWorkflowExecutionsRequest(thrift.ListArchivedWorkflowExecutionsRequest(item))) 263 } 264 } 265 func TestListArchivedWorkflowExecutionsResponse(t *testing.T) { 266 for _, item := range []*apiv1.ListArchivedWorkflowExecutionsResponse{nil, {}, &testdata.ListArchivedWorkflowExecutionsResponse} { 267 assert.Equal(t, item, proto.ListArchivedWorkflowExecutionsResponse(thrift.ListArchivedWorkflowExecutionsResponse(item))) 268 } 269 } 270 func TestListClosedWorkflowExecutionsResponse(t *testing.T) { 271 for _, item := range []*apiv1.ListClosedWorkflowExecutionsResponse{nil, {}, &testdata.ListClosedWorkflowExecutionsResponse} { 272 assert.Equal(t, item, proto.ListClosedWorkflowExecutionsResponse(thrift.ListClosedWorkflowExecutionsResponse(item))) 273 } 274 } 275 func TestListDomainsRequest(t *testing.T) { 276 for _, item := range []*apiv1.ListDomainsRequest{nil, {}, &testdata.ListDomainsRequest} { 277 assert.Equal(t, item, proto.ListDomainsRequest(thrift.ListDomainsRequest(item))) 278 } 279 } 280 func TestListDomainsResponse(t *testing.T) { 281 for _, item := range []*apiv1.ListDomainsResponse{nil, {}, &testdata.ListDomainsResponse} { 282 assert.Equal(t, item, proto.ListDomainsResponse(thrift.ListDomainsResponse(item))) 283 } 284 } 285 func TestListOpenWorkflowExecutionsResponse(t *testing.T) { 286 for _, item := range []*apiv1.ListOpenWorkflowExecutionsResponse{nil, {}, &testdata.ListOpenWorkflowExecutionsResponse} { 287 assert.Equal(t, item, proto.ListOpenWorkflowExecutionsResponse(thrift.ListOpenWorkflowExecutionsResponse(item))) 288 } 289 } 290 func TestListTaskListPartitionsRequest(t *testing.T) { 291 for _, item := range []*apiv1.ListTaskListPartitionsRequest{nil, {}, &testdata.ListTaskListPartitionsRequest} { 292 assert.Equal(t, item, proto.ListTaskListPartitionsRequest(thrift.ListTaskListPartitionsRequest(item))) 293 } 294 } 295 func TestListTaskListPartitionsResponse(t *testing.T) { 296 for _, item := range []*apiv1.ListTaskListPartitionsResponse{nil, {}, &testdata.ListTaskListPartitionsResponse} { 297 assert.Equal(t, item, proto.ListTaskListPartitionsResponse(thrift.ListTaskListPartitionsResponse(item))) 298 } 299 } 300 func TestListWorkflowExecutionsRequest(t *testing.T) { 301 for _, item := range []*apiv1.ListWorkflowExecutionsRequest{nil, {}, &testdata.ListWorkflowExecutionsRequest} { 302 assert.Equal(t, item, proto.ListWorkflowExecutionsRequest(thrift.ListWorkflowExecutionsRequest(item))) 303 } 304 } 305 func TestListWorkflowExecutionsResponse(t *testing.T) { 306 for _, item := range []*apiv1.ListWorkflowExecutionsResponse{nil, {}, &testdata.ListWorkflowExecutionsResponse} { 307 assert.Equal(t, item, proto.ListWorkflowExecutionsResponse(thrift.ListWorkflowExecutionsResponse(item))) 308 } 309 } 310 func TestMarkerRecordedEventAttributes(t *testing.T) { 311 for _, item := range []*apiv1.MarkerRecordedEventAttributes{nil, {}, &testdata.MarkerRecordedEventAttributes} { 312 assert.Equal(t, item, proto.MarkerRecordedEventAttributes(thrift.MarkerRecordedEventAttributes(item))) 313 } 314 } 315 func TestMemo(t *testing.T) { 316 for _, item := range []*apiv1.Memo{nil, {}, &testdata.Memo} { 317 assert.Equal(t, item, proto.Memo(thrift.Memo(item))) 318 } 319 } 320 func TestPendingActivityInfo(t *testing.T) { 321 for _, item := range []*apiv1.PendingActivityInfo{nil, {}, &testdata.PendingActivityInfo} { 322 assert.Equal(t, item, proto.PendingActivityInfo(thrift.PendingActivityInfo(item))) 323 } 324 } 325 func TestPendingChildExecutionInfo(t *testing.T) { 326 for _, item := range []*apiv1.PendingChildExecutionInfo{nil, {}, &testdata.PendingChildExecutionInfo} { 327 assert.Equal(t, item, proto.PendingChildExecutionInfo(thrift.PendingChildExecutionInfo(item))) 328 } 329 } 330 func TestPendingDecisionInfo(t *testing.T) { 331 for _, item := range []*apiv1.PendingDecisionInfo{nil, {}, &testdata.PendingDecisionInfo} { 332 assert.Equal(t, item, proto.PendingDecisionInfo(thrift.PendingDecisionInfo(item))) 333 } 334 } 335 func TestPollForActivityTaskRequest(t *testing.T) { 336 for _, item := range []*apiv1.PollForActivityTaskRequest{nil, {}, &testdata.PollForActivityTaskRequest} { 337 assert.Equal(t, item, proto.PollForActivityTaskRequest(thrift.PollForActivityTaskRequest(item))) 338 } 339 } 340 func TestPollForActivityTaskResponse(t *testing.T) { 341 for _, item := range []*apiv1.PollForActivityTaskResponse{nil, {}, &testdata.PollForActivityTaskResponse} { 342 assert.Equal(t, item, proto.PollForActivityTaskResponse(thrift.PollForActivityTaskResponse(item))) 343 } 344 } 345 func TestPollForDecisionTaskRequest(t *testing.T) { 346 for _, item := range []*apiv1.PollForDecisionTaskRequest{nil, {}, &testdata.PollForDecisionTaskRequest} { 347 assert.Equal(t, item, proto.PollForDecisionTaskRequest(thrift.PollForDecisionTaskRequest(item))) 348 } 349 } 350 func TestPollForDecisionTaskResponse(t *testing.T) { 351 for _, item := range []*apiv1.PollForDecisionTaskResponse{nil, {}, &testdata.PollForDecisionTaskResponse} { 352 assert.Equal(t, item, proto.PollForDecisionTaskResponse(thrift.PollForDecisionTaskResponse(item))) 353 } 354 } 355 func TestPollerInfo(t *testing.T) { 356 for _, item := range []*apiv1.PollerInfo{nil, {}, &testdata.PollerInfo} { 357 assert.Equal(t, item, proto.PollerInfo(thrift.PollerInfo(item))) 358 } 359 } 360 func TestQueryRejected(t *testing.T) { 361 for _, item := range []*apiv1.QueryRejected{nil, {}, &testdata.QueryRejected} { 362 assert.Equal(t, item, proto.QueryRejected(thrift.QueryRejected(item))) 363 } 364 } 365 func TestQueryWorkflowRequest(t *testing.T) { 366 for _, item := range []*apiv1.QueryWorkflowRequest{nil, {}, &testdata.QueryWorkflowRequest} { 367 assert.Equal(t, item, proto.QueryWorkflowRequest(thrift.QueryWorkflowRequest(item))) 368 } 369 } 370 func TestQueryWorkflowResponse(t *testing.T) { 371 for _, item := range []*apiv1.QueryWorkflowResponse{nil, {}, &testdata.QueryWorkflowResponse} { 372 assert.Equal(t, item, proto.QueryWorkflowResponse(thrift.QueryWorkflowResponse(item))) 373 } 374 } 375 func TestRecordActivityTaskHeartbeatByIDRequest(t *testing.T) { 376 for _, item := range []*apiv1.RecordActivityTaskHeartbeatByIDRequest{nil, {}, &testdata.RecordActivityTaskHeartbeatByIDRequest} { 377 assert.Equal(t, item, proto.RecordActivityTaskHeartbeatByIdRequest(thrift.RecordActivityTaskHeartbeatByIdRequest(item))) 378 } 379 } 380 func TestRecordActivityTaskHeartbeatByIDResponse(t *testing.T) { 381 for _, item := range []*apiv1.RecordActivityTaskHeartbeatByIDResponse{nil, {}, &testdata.RecordActivityTaskHeartbeatByIDResponse} { 382 assert.Equal(t, item, proto.RecordActivityTaskHeartbeatByIdResponse(thrift.RecordActivityTaskHeartbeatByIdResponse(item))) 383 } 384 } 385 func TestRecordActivityTaskHeartbeatRequest(t *testing.T) { 386 for _, item := range []*apiv1.RecordActivityTaskHeartbeatRequest{nil, {}, &testdata.RecordActivityTaskHeartbeatRequest} { 387 assert.Equal(t, item, proto.RecordActivityTaskHeartbeatRequest(thrift.RecordActivityTaskHeartbeatRequest(item))) 388 } 389 } 390 func TestRecordActivityTaskHeartbeatResponse(t *testing.T) { 391 for _, item := range []*apiv1.RecordActivityTaskHeartbeatResponse{nil, {}, &testdata.RecordActivityTaskHeartbeatResponse} { 392 assert.Equal(t, item, proto.RecordActivityTaskHeartbeatResponse(thrift.RecordActivityTaskHeartbeatResponse(item))) 393 } 394 } 395 func TestRegisterDomainRequest(t *testing.T) { 396 for _, item := range []*apiv1.RegisterDomainRequest{nil, &testdata.RegisterDomainRequest} { 397 assert.Equal(t, item, proto.RegisterDomainRequest(thrift.RegisterDomainRequest(item))) 398 } 399 } 400 func TestRequestCancelActivityTaskFailedEventAttributes(t *testing.T) { 401 for _, item := range []*apiv1.RequestCancelActivityTaskFailedEventAttributes{nil, {}, &testdata.RequestCancelActivityTaskFailedEventAttributes} { 402 assert.Equal(t, item, proto.RequestCancelActivityTaskFailedEventAttributes(thrift.RequestCancelActivityTaskFailedEventAttributes(item))) 403 } 404 } 405 func TestRequestCancelExternalWorkflowExecutionFailedEventAttributes(t *testing.T) { 406 for _, item := range []*apiv1.RequestCancelExternalWorkflowExecutionFailedEventAttributes{nil, {}, &testdata.RequestCancelExternalWorkflowExecutionFailedEventAttributes} { 407 assert.Equal(t, item, proto.RequestCancelExternalWorkflowExecutionFailedEventAttributes(thrift.RequestCancelExternalWorkflowExecutionFailedEventAttributes(item))) 408 } 409 } 410 func TestRequestCancelExternalWorkflowExecutionInitiatedEventAttributes(t *testing.T) { 411 for _, item := range []*apiv1.RequestCancelExternalWorkflowExecutionInitiatedEventAttributes{nil, {}, &testdata.RequestCancelExternalWorkflowExecutionInitiatedEventAttributes} { 412 assert.Equal(t, item, proto.RequestCancelExternalWorkflowExecutionInitiatedEventAttributes(thrift.RequestCancelExternalWorkflowExecutionInitiatedEventAttributes(item))) 413 } 414 } 415 func TestRequestCancelWorkflowExecutionRequest(t *testing.T) { 416 for _, item := range []*apiv1.RequestCancelWorkflowExecutionRequest{nil, {}, &testdata.RequestCancelWorkflowExecutionRequest} { 417 assert.Equal(t, item, proto.RequestCancelWorkflowExecutionRequest(thrift.RequestCancelWorkflowExecutionRequest(item))) 418 } 419 } 420 func TestResetPointInfo(t *testing.T) { 421 for _, item := range []*apiv1.ResetPointInfo{nil, {}, &testdata.ResetPointInfo} { 422 assert.Equal(t, item, proto.ResetPointInfo(thrift.ResetPointInfo(item))) 423 } 424 } 425 func TestResetPoints(t *testing.T) { 426 for _, item := range []*apiv1.ResetPoints{nil, {}, &testdata.ResetPoints} { 427 assert.Equal(t, item, proto.ResetPoints(thrift.ResetPoints(item))) 428 } 429 } 430 func TestResetStickyTaskListRequest(t *testing.T) { 431 for _, item := range []*apiv1.ResetStickyTaskListRequest{nil, {}, &testdata.ResetStickyTaskListRequest} { 432 assert.Equal(t, item, proto.ResetStickyTaskListRequest(thrift.ResetStickyTaskListRequest(item))) 433 } 434 } 435 func TestResetWorkflowExecutionRequest(t *testing.T) { 436 for _, item := range []*apiv1.ResetWorkflowExecutionRequest{nil, {}, &testdata.ResetWorkflowExecutionRequest} { 437 assert.Equal(t, item, proto.ResetWorkflowExecutionRequest(thrift.ResetWorkflowExecutionRequest(item))) 438 } 439 } 440 func TestResetWorkflowExecutionResponse(t *testing.T) { 441 for _, item := range []*apiv1.ResetWorkflowExecutionResponse{nil, {}, &testdata.ResetWorkflowExecutionResponse} { 442 assert.Equal(t, item, proto.ResetWorkflowExecutionResponse(thrift.ResetWorkflowExecutionResponse(item))) 443 } 444 } 445 func TestRespondActivityTaskCanceledByIDRequest(t *testing.T) { 446 for _, item := range []*apiv1.RespondActivityTaskCanceledByIDRequest{nil, {}, &testdata.RespondActivityTaskCanceledByIDRequest} { 447 assert.Equal(t, item, proto.RespondActivityTaskCanceledByIdRequest(thrift.RespondActivityTaskCanceledByIdRequest(item))) 448 } 449 } 450 func TestRespondActivityTaskCanceledRequest(t *testing.T) { 451 for _, item := range []*apiv1.RespondActivityTaskCanceledRequest{nil, {}, &testdata.RespondActivityTaskCanceledRequest} { 452 assert.Equal(t, item, proto.RespondActivityTaskCanceledRequest(thrift.RespondActivityTaskCanceledRequest(item))) 453 } 454 } 455 func TestRespondActivityTaskCompletedByIDRequest(t *testing.T) { 456 for _, item := range []*apiv1.RespondActivityTaskCompletedByIDRequest{nil, {}, &testdata.RespondActivityTaskCompletedByIDRequest} { 457 assert.Equal(t, item, proto.RespondActivityTaskCompletedByIdRequest(thrift.RespondActivityTaskCompletedByIdRequest(item))) 458 } 459 } 460 func TestRespondActivityTaskCompletedRequest(t *testing.T) { 461 for _, item := range []*apiv1.RespondActivityTaskCompletedRequest{nil, {}, &testdata.RespondActivityTaskCompletedRequest} { 462 assert.Equal(t, item, proto.RespondActivityTaskCompletedRequest(thrift.RespondActivityTaskCompletedRequest(item))) 463 } 464 } 465 func TestRespondActivityTaskFailedByIDRequest(t *testing.T) { 466 for _, item := range []*apiv1.RespondActivityTaskFailedByIDRequest{nil, {}, &testdata.RespondActivityTaskFailedByIDRequest} { 467 assert.Equal(t, item, proto.RespondActivityTaskFailedByIdRequest(thrift.RespondActivityTaskFailedByIdRequest(item))) 468 } 469 } 470 func TestRespondActivityTaskFailedRequest(t *testing.T) { 471 for _, item := range []*apiv1.RespondActivityTaskFailedRequest{nil, {}, &testdata.RespondActivityTaskFailedRequest} { 472 assert.Equal(t, item, proto.RespondActivityTaskFailedRequest(thrift.RespondActivityTaskFailedRequest(item))) 473 } 474 } 475 func TestRespondDecisionTaskCompletedRequest(t *testing.T) { 476 for _, item := range []*apiv1.RespondDecisionTaskCompletedRequest{nil, {}, &testdata.RespondDecisionTaskCompletedRequest} { 477 assert.Equal(t, item, proto.RespondDecisionTaskCompletedRequest(thrift.RespondDecisionTaskCompletedRequest(item))) 478 } 479 } 480 func TestRespondDecisionTaskCompletedResponse(t *testing.T) { 481 for _, item := range []*apiv1.RespondDecisionTaskCompletedResponse{nil, {}, &testdata.RespondDecisionTaskCompletedResponse} { 482 assert.Equal(t, item, proto.RespondDecisionTaskCompletedResponse(thrift.RespondDecisionTaskCompletedResponse(item))) 483 } 484 } 485 func TestRespondDecisionTaskFailedRequest(t *testing.T) { 486 for _, item := range []*apiv1.RespondDecisionTaskFailedRequest{nil, {}, &testdata.RespondDecisionTaskFailedRequest} { 487 assert.Equal(t, item, proto.RespondDecisionTaskFailedRequest(thrift.RespondDecisionTaskFailedRequest(item))) 488 } 489 } 490 func TestRespondQueryTaskCompletedRequest(t *testing.T) { 491 for _, item := range []*apiv1.RespondQueryTaskCompletedRequest{nil, {Result: &apiv1.WorkflowQueryResult{}}, &testdata.RespondQueryTaskCompletedRequest} { 492 assert.Equal(t, item, proto.RespondQueryTaskCompletedRequest(thrift.RespondQueryTaskCompletedRequest(item))) 493 } 494 } 495 func TestRetryPolicy(t *testing.T) { 496 for _, item := range []*apiv1.RetryPolicy{nil, {}, &testdata.RetryPolicy} { 497 assert.Equal(t, item, proto.RetryPolicy(thrift.RetryPolicy(item))) 498 } 499 } 500 func TestScanWorkflowExecutionsRequest(t *testing.T) { 501 for _, item := range []*apiv1.ScanWorkflowExecutionsRequest{nil, {}, &testdata.ScanWorkflowExecutionsRequest} { 502 assert.Equal(t, item, proto.ScanWorkflowExecutionsRequest(thrift.ScanWorkflowExecutionsRequest(item))) 503 } 504 } 505 func TestScanWorkflowExecutionsResponse(t *testing.T) { 506 for _, item := range []*apiv1.ScanWorkflowExecutionsResponse{nil, {}, &testdata.ScanWorkflowExecutionsResponse} { 507 assert.Equal(t, item, proto.ScanWorkflowExecutionsResponse(thrift.ScanWorkflowExecutionsResponse(item))) 508 } 509 } 510 func TestSearchAttributes(t *testing.T) { 511 for _, item := range []*apiv1.SearchAttributes{nil, {}, &testdata.SearchAttributes} { 512 assert.Equal(t, item, proto.SearchAttributes(thrift.SearchAttributes(item))) 513 } 514 } 515 func TestSignalExternalWorkflowExecutionFailedEventAttributes(t *testing.T) { 516 for _, item := range []*apiv1.SignalExternalWorkflowExecutionFailedEventAttributes{nil, {}, &testdata.SignalExternalWorkflowExecutionFailedEventAttributes} { 517 assert.Equal(t, item, proto.SignalExternalWorkflowExecutionFailedEventAttributes(thrift.SignalExternalWorkflowExecutionFailedEventAttributes(item))) 518 } 519 } 520 func TestSignalExternalWorkflowExecutionInitiatedEventAttributes(t *testing.T) { 521 for _, item := range []*apiv1.SignalExternalWorkflowExecutionInitiatedEventAttributes{nil, {}, &testdata.SignalExternalWorkflowExecutionInitiatedEventAttributes} { 522 assert.Equal(t, item, proto.SignalExternalWorkflowExecutionInitiatedEventAttributes(thrift.SignalExternalWorkflowExecutionInitiatedEventAttributes(item))) 523 } 524 } 525 func TestSignalWithStartWorkflowExecutionRequest(t *testing.T) { 526 for _, item := range []*apiv1.SignalWithStartWorkflowExecutionRequest{nil, {StartRequest: &apiv1.StartWorkflowExecutionRequest{}}, &testdata.SignalWithStartWorkflowExecutionRequest} { 527 assert.Equal(t, item, proto.SignalWithStartWorkflowExecutionRequest(thrift.SignalWithStartWorkflowExecutionRequest(item))) 528 } 529 } 530 func TestSignalWithStartWorkflowExecutionResponse(t *testing.T) { 531 for _, item := range []*apiv1.SignalWithStartWorkflowExecutionResponse{nil, {}, &testdata.SignalWithStartWorkflowExecutionResponse} { 532 assert.Equal(t, item, proto.SignalWithStartWorkflowExecutionResponse(thrift.SignalWithStartWorkflowExecutionResponse(item))) 533 } 534 } 535 func TestSignalWorkflowExecutionRequest(t *testing.T) { 536 for _, item := range []*apiv1.SignalWorkflowExecutionRequest{nil, {}, &testdata.SignalWorkflowExecutionRequest} { 537 assert.Equal(t, item, proto.SignalWorkflowExecutionRequest(thrift.SignalWorkflowExecutionRequest(item))) 538 } 539 } 540 func TestStartChildWorkflowExecutionFailedEventAttributes(t *testing.T) { 541 for _, item := range []*apiv1.StartChildWorkflowExecutionFailedEventAttributes{nil, {}, &testdata.StartChildWorkflowExecutionFailedEventAttributes} { 542 assert.Equal(t, item, proto.StartChildWorkflowExecutionFailedEventAttributes(thrift.StartChildWorkflowExecutionFailedEventAttributes(item))) 543 } 544 } 545 func TestStartChildWorkflowExecutionInitiatedEventAttributes(t *testing.T) { 546 for _, item := range []*apiv1.StartChildWorkflowExecutionInitiatedEventAttributes{nil, {}, &testdata.StartChildWorkflowExecutionInitiatedEventAttributes} { 547 assert.Equal(t, item, proto.StartChildWorkflowExecutionInitiatedEventAttributes(thrift.StartChildWorkflowExecutionInitiatedEventAttributes(item))) 548 } 549 } 550 func TestStartTimeFilter(t *testing.T) { 551 for _, item := range []*apiv1.StartTimeFilter{nil, {}, &testdata.StartTimeFilter} { 552 assert.Equal(t, item, proto.StartTimeFilter(thrift.StartTimeFilter(item))) 553 } 554 } 555 func TestStartWorkflowExecutionRequest(t *testing.T) { 556 for _, item := range []*apiv1.StartWorkflowExecutionRequest{nil, {}, &testdata.StartWorkflowExecutionRequest} { 557 assert.Equal(t, item, proto.StartWorkflowExecutionRequest(thrift.StartWorkflowExecutionRequest(item))) 558 } 559 } 560 func TestStartWorkflowExecutionResponse(t *testing.T) { 561 for _, item := range []*apiv1.StartWorkflowExecutionResponse{nil, {}, &testdata.StartWorkflowExecutionResponse} { 562 assert.Equal(t, item, proto.StartWorkflowExecutionResponse(thrift.StartWorkflowExecutionResponse(item))) 563 } 564 } 565 func TestStatusFilter(t *testing.T) { 566 for _, item := range []*apiv1.StatusFilter{nil, &testdata.StatusFilter} { 567 assert.Equal(t, item, proto.StatusFilter(thrift.StatusFilter(item))) 568 } 569 } 570 func TestStickyExecutionAttributes(t *testing.T) { 571 for _, item := range []*apiv1.StickyExecutionAttributes{nil, {}, &testdata.StickyExecutionAttributes} { 572 assert.Equal(t, item, proto.StickyExecutionAttributes(thrift.StickyExecutionAttributes(item))) 573 } 574 } 575 func TestSupportedClientVersions(t *testing.T) { 576 for _, item := range []*apiv1.SupportedClientVersions{nil, {}, &testdata.SupportedClientVersions} { 577 assert.Equal(t, item, proto.SupportedClientVersions(thrift.SupportedClientVersions(item))) 578 } 579 } 580 func TestTaskIDBlock(t *testing.T) { 581 for _, item := range []*apiv1.TaskIDBlock{nil, {}, &testdata.TaskIDBlock} { 582 assert.Equal(t, item, proto.TaskIdBlock(thrift.TaskIdBlock(item))) 583 } 584 } 585 func TestTaskList(t *testing.T) { 586 for _, item := range []*apiv1.TaskList{nil, {}, &testdata.TaskList} { 587 assert.Equal(t, item, proto.TaskList(thrift.TaskList(item))) 588 } 589 } 590 func TestTaskListMetadata(t *testing.T) { 591 for _, item := range []*apiv1.TaskListMetadata{nil, {}, &testdata.TaskListMetadata} { 592 assert.Equal(t, item, proto.TaskListMetadata(thrift.TaskListMetadata(item))) 593 } 594 } 595 func TestTaskListPartitionMetadata(t *testing.T) { 596 for _, item := range []*apiv1.TaskListPartitionMetadata{nil, {}, &testdata.TaskListPartitionMetadata} { 597 assert.Equal(t, item, proto.TaskListPartitionMetadata(thrift.TaskListPartitionMetadata(item))) 598 } 599 } 600 func TestTaskListStatus(t *testing.T) { 601 for _, item := range []*apiv1.TaskListStatus{nil, {}, &testdata.TaskListStatus} { 602 assert.Equal(t, item, proto.TaskListStatus(thrift.TaskListStatus(item))) 603 } 604 } 605 func TestTerminateWorkflowExecutionRequest(t *testing.T) { 606 for _, item := range []*apiv1.TerminateWorkflowExecutionRequest{nil, {}, &testdata.TerminateWorkflowExecutionRequest} { 607 assert.Equal(t, item, proto.TerminateWorkflowExecutionRequest(thrift.TerminateWorkflowExecutionRequest(item))) 608 } 609 } 610 func TestTimerCanceledEventAttributes(t *testing.T) { 611 for _, item := range []*apiv1.TimerCanceledEventAttributes{nil, {}, &testdata.TimerCanceledEventAttributes} { 612 assert.Equal(t, item, proto.TimerCanceledEventAttributes(thrift.TimerCanceledEventAttributes(item))) 613 } 614 } 615 func TestTimerFiredEventAttributes(t *testing.T) { 616 for _, item := range []*apiv1.TimerFiredEventAttributes{nil, {}, &testdata.TimerFiredEventAttributes} { 617 assert.Equal(t, item, proto.TimerFiredEventAttributes(thrift.TimerFiredEventAttributes(item))) 618 } 619 } 620 func TestTimerStartedEventAttributes(t *testing.T) { 621 for _, item := range []*apiv1.TimerStartedEventAttributes{nil, {}, &testdata.TimerStartedEventAttributes} { 622 assert.Equal(t, item, proto.TimerStartedEventAttributes(thrift.TimerStartedEventAttributes(item))) 623 } 624 } 625 func TestUpdateDomainRequest(t *testing.T) { 626 for _, item := range []*apiv1.UpdateDomainRequest{nil, {UpdateMask: &gogo.FieldMask{}}, &testdata.UpdateDomainRequest} { 627 assert.Equal(t, item, proto.UpdateDomainRequest(thrift.UpdateDomainRequest(item))) 628 } 629 } 630 func TestUpdateDomainResponse(t *testing.T) { 631 for _, item := range []*apiv1.UpdateDomainResponse{nil, &testdata.UpdateDomainResponse} { 632 assert.Equal(t, item, proto.UpdateDomainResponse(thrift.UpdateDomainResponse(item))) 633 } 634 } 635 func TestUpsertWorkflowSearchAttributesEventAttributes(t *testing.T) { 636 for _, item := range []*apiv1.UpsertWorkflowSearchAttributesEventAttributes{nil, {}, &testdata.UpsertWorkflowSearchAttributesEventAttributes} { 637 assert.Equal(t, item, proto.UpsertWorkflowSearchAttributesEventAttributes(thrift.UpsertWorkflowSearchAttributesEventAttributes(item))) 638 } 639 } 640 func TestWorkerVersionInfo(t *testing.T) { 641 for _, item := range []*apiv1.WorkerVersionInfo{nil, {}, &testdata.WorkerVersionInfo} { 642 assert.Equal(t, item, proto.WorkerVersionInfo(thrift.WorkerVersionInfo(item))) 643 } 644 } 645 func TestWorkflowExecution(t *testing.T) { 646 for _, item := range []*apiv1.WorkflowExecution{nil, {}, &testdata.WorkflowExecution} { 647 assert.Equal(t, item, proto.WorkflowExecution(thrift.WorkflowExecution(item))) 648 } 649 assert.Empty(t, thrift.WorkflowId(nil)) 650 assert.Empty(t, thrift.RunId(nil)) 651 } 652 func TestExternalExecutionInfo(t *testing.T) { 653 assert.Nil(t, proto.ExternalExecutionInfo(nil, nil)) 654 assert.Nil(t, thrift.ExternalWorkflowExecution(nil)) 655 assert.Nil(t, thrift.ExternalInitiatedId(nil)) 656 assert.Panics(t, func() { proto.ExternalExecutionInfo(nil, common.Int64Ptr(testdata.EventID1)) }) 657 assert.Panics(t, func() { proto.ExternalExecutionInfo(thrift.WorkflowExecution(&testdata.WorkflowExecution), nil) }) 658 info := proto.ExternalExecutionInfo(thrift.WorkflowExecution(&testdata.WorkflowExecution), common.Int64Ptr(testdata.EventID1)) 659 assert.Equal(t, testdata.WorkflowExecution, *info.WorkflowExecution) 660 assert.Equal(t, testdata.EventID1, info.InitiatedId) 661 } 662 func TestWorkflowExecutionCancelRequestedEventAttributes(t *testing.T) { 663 for _, item := range []*apiv1.WorkflowExecutionCancelRequestedEventAttributes{nil, {}, &testdata.WorkflowExecutionCancelRequestedEventAttributes} { 664 assert.Equal(t, item, proto.WorkflowExecutionCancelRequestedEventAttributes(thrift.WorkflowExecutionCancelRequestedEventAttributes(item))) 665 } 666 } 667 func TestWorkflowExecutionCanceledEventAttributes(t *testing.T) { 668 for _, item := range []*apiv1.WorkflowExecutionCanceledEventAttributes{nil, {}, &testdata.WorkflowExecutionCanceledEventAttributes} { 669 assert.Equal(t, item, proto.WorkflowExecutionCanceledEventAttributes(thrift.WorkflowExecutionCanceledEventAttributes(item))) 670 } 671 } 672 func TestWorkflowExecutionCompletedEventAttributes(t *testing.T) { 673 for _, item := range []*apiv1.WorkflowExecutionCompletedEventAttributes{nil, {}, &testdata.WorkflowExecutionCompletedEventAttributes} { 674 assert.Equal(t, item, proto.WorkflowExecutionCompletedEventAttributes(thrift.WorkflowExecutionCompletedEventAttributes(item))) 675 } 676 } 677 func TestWorkflowExecutionConfiguration(t *testing.T) { 678 for _, item := range []*apiv1.WorkflowExecutionConfiguration{nil, {}, &testdata.WorkflowExecutionConfiguration} { 679 assert.Equal(t, item, proto.WorkflowExecutionConfiguration(thrift.WorkflowExecutionConfiguration(item))) 680 } 681 } 682 func TestWorkflowExecutionContinuedAsNewEventAttributes(t *testing.T) { 683 for _, item := range []*apiv1.WorkflowExecutionContinuedAsNewEventAttributes{nil, {}, &testdata.WorkflowExecutionContinuedAsNewEventAttributes} { 684 assert.Equal(t, item, proto.WorkflowExecutionContinuedAsNewEventAttributes(thrift.WorkflowExecutionContinuedAsNewEventAttributes(item))) 685 } 686 } 687 func TestWorkflowExecutionFailedEventAttributes(t *testing.T) { 688 for _, item := range []*apiv1.WorkflowExecutionFailedEventAttributes{nil, {}, &testdata.WorkflowExecutionFailedEventAttributes} { 689 assert.Equal(t, item, proto.WorkflowExecutionFailedEventAttributes(thrift.WorkflowExecutionFailedEventAttributes(item))) 690 } 691 } 692 func TestWorkflowExecutionFilter(t *testing.T) { 693 for _, item := range []*apiv1.WorkflowExecutionFilter{nil, {}, &testdata.WorkflowExecutionFilter} { 694 assert.Equal(t, item, proto.WorkflowExecutionFilter(thrift.WorkflowExecutionFilter(item))) 695 } 696 } 697 func TestParentExecutionInfo(t *testing.T) { 698 assert.Nil(t, proto.ParentExecutionInfo(nil, nil, nil, nil)) 699 assert.Panics(t, func() { proto.ParentExecutionInfo(nil, &testdata.ParentExecutionInfo.DomainName, nil, nil) }) 700 info := proto.ParentExecutionInfo(nil, 701 &testdata.ParentExecutionInfo.DomainName, 702 thrift.WorkflowExecution(testdata.ParentExecutionInfo.WorkflowExecution), 703 &testdata.ParentExecutionInfo.InitiatedId) 704 assert.Equal(t, "", info.DomainId) 705 assert.Equal(t, testdata.ParentExecutionInfo.DomainName, info.DomainName) 706 assert.Equal(t, testdata.ParentExecutionInfo.WorkflowExecution, info.WorkflowExecution) 707 assert.Equal(t, testdata.ParentExecutionInfo.InitiatedId, info.InitiatedId) 708 } 709 710 func TestWorkflowExecutionInfo(t *testing.T) { 711 for _, item := range []*apiv1.WorkflowExecutionInfo{nil, {}, &testdata.WorkflowExecutionInfo} { 712 assert.Equal(t, item, proto.WorkflowExecutionInfo(thrift.WorkflowExecutionInfo(item))) 713 } 714 } 715 func TestWorkflowExecutionSignaledEventAttributes(t *testing.T) { 716 for _, item := range []*apiv1.WorkflowExecutionSignaledEventAttributes{nil, {}, &testdata.WorkflowExecutionSignaledEventAttributes} { 717 assert.Equal(t, item, proto.WorkflowExecutionSignaledEventAttributes(thrift.WorkflowExecutionSignaledEventAttributes(item))) 718 } 719 } 720 func TestWorkflowExecutionStartedEventAttributes(t *testing.T) { 721 for _, item := range []*apiv1.WorkflowExecutionStartedEventAttributes{nil, {}, &testdata.WorkflowExecutionStartedEventAttributes} { 722 assert.Equal(t, item, proto.WorkflowExecutionStartedEventAttributes(thrift.WorkflowExecutionStartedEventAttributes(item))) 723 } 724 } 725 func TestWorkflowExecutionTerminatedEventAttributes(t *testing.T) { 726 for _, item := range []*apiv1.WorkflowExecutionTerminatedEventAttributes{nil, {}, &testdata.WorkflowExecutionTerminatedEventAttributes} { 727 assert.Equal(t, item, proto.WorkflowExecutionTerminatedEventAttributes(thrift.WorkflowExecutionTerminatedEventAttributes(item))) 728 } 729 } 730 func TestWorkflowExecutionTimedOutEventAttributes(t *testing.T) { 731 for _, item := range []*apiv1.WorkflowExecutionTimedOutEventAttributes{nil, {}, &testdata.WorkflowExecutionTimedOutEventAttributes} { 732 assert.Equal(t, item, proto.WorkflowExecutionTimedOutEventAttributes(thrift.WorkflowExecutionTimedOutEventAttributes(item))) 733 } 734 } 735 func TestWorkflowQuery(t *testing.T) { 736 for _, item := range []*apiv1.WorkflowQuery{nil, {}, &testdata.WorkflowQuery} { 737 assert.Equal(t, item, proto.WorkflowQuery(thrift.WorkflowQuery(item))) 738 } 739 } 740 func TestWorkflowQueryResult(t *testing.T) { 741 for _, item := range []*apiv1.WorkflowQueryResult{nil, {}, &testdata.WorkflowQueryResult} { 742 assert.Equal(t, item, proto.WorkflowQueryResult(thrift.WorkflowQueryResult(item))) 743 } 744 } 745 func TestWorkflowType(t *testing.T) { 746 for _, item := range []*apiv1.WorkflowType{nil, {}, &testdata.WorkflowType} { 747 assert.Equal(t, item, proto.WorkflowType(thrift.WorkflowType(item))) 748 } 749 } 750 func TestWorkflowTypeFilter(t *testing.T) { 751 for _, item := range []*apiv1.WorkflowTypeFilter{nil, {}, &testdata.WorkflowTypeFilter} { 752 assert.Equal(t, item, proto.WorkflowTypeFilter(thrift.WorkflowTypeFilter(item))) 753 } 754 } 755 func TestDataBlobArray(t *testing.T) { 756 for _, item := range [][]*apiv1.DataBlob{nil, {}, testdata.DataBlobArray} { 757 assert.Equal(t, item, proto.DataBlobArray(thrift.DataBlobArray(item))) 758 } 759 } 760 func TestHistoryEventArray(t *testing.T) { 761 for _, item := range [][]*apiv1.HistoryEvent{nil, {}, testdata.HistoryEventArray} { 762 assert.Equal(t, item, proto.HistoryEventArray(thrift.HistoryEventArray(item))) 763 } 764 } 765 func TestTaskListPartitionMetadataArray(t *testing.T) { 766 for _, item := range [][]*apiv1.TaskListPartitionMetadata{nil, {}, testdata.TaskListPartitionMetadataArray} { 767 assert.Equal(t, item, proto.TaskListPartitionMetadataArray(thrift.TaskListPartitionMetadataArray(item))) 768 } 769 } 770 func TestDecisionArray(t *testing.T) { 771 for _, item := range [][]*apiv1.Decision{nil, {}, testdata.DecisionArray} { 772 assert.Equal(t, item, proto.DecisionArray(thrift.DecisionArray(item))) 773 } 774 } 775 func TestPollerInfoArray(t *testing.T) { 776 for _, item := range [][]*apiv1.PollerInfo{nil, {}, testdata.PollerInfoArray} { 777 assert.Equal(t, item, proto.PollerInfoArray(thrift.PollerInfoArray(item))) 778 } 779 } 780 func TestPendingChildExecutionInfoArray(t *testing.T) { 781 for _, item := range [][]*apiv1.PendingChildExecutionInfo{nil, {}, testdata.PendingChildExecutionInfoArray} { 782 assert.Equal(t, item, proto.PendingChildExecutionInfoArray(thrift.PendingChildExecutionInfoArray(item))) 783 } 784 } 785 func TestWorkflowExecutionInfoArray(t *testing.T) { 786 for _, item := range [][]*apiv1.WorkflowExecutionInfo{nil, {}, testdata.WorkflowExecutionInfoArray} { 787 assert.Equal(t, item, proto.WorkflowExecutionInfoArray(thrift.WorkflowExecutionInfoArray(item))) 788 } 789 } 790 func TestDescribeDomainResponseArray(t *testing.T) { 791 for _, item := range [][]*apiv1.Domain{nil, {}, testdata.DomainArray} { 792 assert.Equal(t, item, proto.DescribeDomainResponseArray(thrift.DescribeDomainResponseArray(item))) 793 } 794 } 795 func TestResetPointInfoArray(t *testing.T) { 796 for _, item := range [][]*apiv1.ResetPointInfo{nil, {}, testdata.ResetPointInfoArray} { 797 assert.Equal(t, item, proto.ResetPointInfoArray(thrift.ResetPointInfoArray(item))) 798 } 799 } 800 func TestPendingActivityInfoArray(t *testing.T) { 801 for _, item := range [][]*apiv1.PendingActivityInfo{nil, {}, testdata.PendingActivityInfoArray} { 802 assert.Equal(t, item, proto.PendingActivityInfoArray(thrift.PendingActivityInfoArray(item))) 803 } 804 } 805 func TestClusterReplicationConfigurationArray(t *testing.T) { 806 for _, item := range [][]*apiv1.ClusterReplicationConfiguration{nil, {}, testdata.ClusterReplicationConfigurationArray} { 807 assert.Equal(t, item, proto.ClusterReplicationConfigurationArray(thrift.ClusterReplicationConfigurationArray(item))) 808 } 809 } 810 func TestActivityLocalDispatchInfoMap(t *testing.T) { 811 for _, item := range []map[string]*apiv1.ActivityLocalDispatchInfo{nil, {}, testdata.ActivityLocalDispatchInfoMap} { 812 assert.Equal(t, item, proto.ActivityLocalDispatchInfoMap(thrift.ActivityLocalDispatchInfoMap(item))) 813 } 814 } 815 func TestBadBinaryInfoMap(t *testing.T) { 816 for _, item := range []map[string]*apiv1.BadBinaryInfo{nil, {}, testdata.BadBinaryInfoMap} { 817 assert.Equal(t, item, proto.BadBinaryInfoMap(thrift.BadBinaryInfoMap(item))) 818 } 819 } 820 func TestIndexedValueTypeMap(t *testing.T) { 821 for _, item := range []map[string]apiv1.IndexedValueType{nil, {}, testdata.IndexedValueTypeMap} { 822 assert.Equal(t, item, proto.IndexedValueTypeMap(thrift.IndexedValueTypeMap(item))) 823 } 824 } 825 func TestWorkflowQueryMap(t *testing.T) { 826 for _, item := range []map[string]*apiv1.WorkflowQuery{nil, {}, testdata.WorkflowQueryMap} { 827 assert.Equal(t, item, proto.WorkflowQueryMap(thrift.WorkflowQueryMap(item))) 828 } 829 } 830 func TestWorkflowQueryResultMap(t *testing.T) { 831 for _, item := range []map[string]*apiv1.WorkflowQueryResult{nil, {}, testdata.WorkflowQueryResultMap} { 832 assert.Equal(t, item, proto.WorkflowQueryResultMap(thrift.WorkflowQueryResultMap(item))) 833 } 834 } 835 func TestPayload(t *testing.T) { 836 for _, item := range []*apiv1.Payload{nil, &testdata.Payload1} { 837 assert.Equal(t, item, proto.Payload(thrift.Payload(item))) 838 } 839 840 assert.Equal(t, &apiv1.Payload{Data: []byte{}}, proto.Payload(thrift.Payload(&apiv1.Payload{}))) 841 } 842 func TestPayloadMap(t *testing.T) { 843 for _, item := range []map[string]*apiv1.Payload{nil, {}, testdata.PayloadMap} { 844 assert.Equal(t, item, proto.PayloadMap(thrift.PayloadMap(item))) 845 } 846 } 847 func TestFailure(t *testing.T) { 848 assert.Nil(t, proto.Failure(nil, nil)) 849 assert.Nil(t, thrift.FailureReason(nil)) 850 assert.Nil(t, thrift.FailureDetails(nil)) 851 failure := proto.Failure(&testdata.FailureReason, testdata.FailureDetails) 852 assert.Equal(t, testdata.FailureReason, *thrift.FailureReason(failure)) 853 assert.Equal(t, testdata.FailureDetails, thrift.FailureDetails(failure)) 854 } 855 func TestHistoryEvent(t *testing.T) { 856 for _, item := range []*apiv1.HistoryEvent{ 857 nil, 858 &testdata.HistoryEvent_WorkflowExecutionStarted, 859 &testdata.HistoryEvent_WorkflowExecutionCompleted, 860 &testdata.HistoryEvent_WorkflowExecutionFailed, 861 &testdata.HistoryEvent_WorkflowExecutionTimedOut, 862 &testdata.HistoryEvent_DecisionTaskScheduled, 863 &testdata.HistoryEvent_DecisionTaskStarted, 864 &testdata.HistoryEvent_DecisionTaskCompleted, 865 &testdata.HistoryEvent_DecisionTaskTimedOut, 866 &testdata.HistoryEvent_DecisionTaskFailed, 867 &testdata.HistoryEvent_ActivityTaskScheduled, 868 &testdata.HistoryEvent_ActivityTaskStarted, 869 &testdata.HistoryEvent_ActivityTaskCompleted, 870 &testdata.HistoryEvent_ActivityTaskFailed, 871 &testdata.HistoryEvent_ActivityTaskTimedOut, 872 &testdata.HistoryEvent_ActivityTaskCancelRequested, 873 &testdata.HistoryEvent_RequestCancelActivityTaskFailed, 874 &testdata.HistoryEvent_ActivityTaskCanceled, 875 &testdata.HistoryEvent_TimerStarted, 876 &testdata.HistoryEvent_TimerFired, 877 &testdata.HistoryEvent_CancelTimerFailed, 878 &testdata.HistoryEvent_TimerCanceled, 879 &testdata.HistoryEvent_WorkflowExecutionCancelRequested, 880 &testdata.HistoryEvent_WorkflowExecutionCanceled, 881 &testdata.HistoryEvent_RequestCancelExternalWorkflowExecutionInitiated, 882 &testdata.HistoryEvent_RequestCancelExternalWorkflowExecutionFailed, 883 &testdata.HistoryEvent_ExternalWorkflowExecutionCancelRequested, 884 &testdata.HistoryEvent_MarkerRecorded, 885 &testdata.HistoryEvent_WorkflowExecutionSignaled, 886 &testdata.HistoryEvent_WorkflowExecutionTerminated, 887 &testdata.HistoryEvent_WorkflowExecutionContinuedAsNew, 888 &testdata.HistoryEvent_StartChildWorkflowExecutionInitiated, 889 &testdata.HistoryEvent_StartChildWorkflowExecutionFailed, 890 &testdata.HistoryEvent_ChildWorkflowExecutionStarted, 891 &testdata.HistoryEvent_ChildWorkflowExecutionCompleted, 892 &testdata.HistoryEvent_ChildWorkflowExecutionFailed, 893 &testdata.HistoryEvent_ChildWorkflowExecutionCanceled, 894 &testdata.HistoryEvent_ChildWorkflowExecutionTimedOut, 895 &testdata.HistoryEvent_ChildWorkflowExecutionTerminated, 896 &testdata.HistoryEvent_SignalExternalWorkflowExecutionInitiated, 897 &testdata.HistoryEvent_SignalExternalWorkflowExecutionFailed, 898 &testdata.HistoryEvent_ExternalWorkflowExecutionSignaled, 899 &testdata.HistoryEvent_UpsertWorkflowSearchAttributes, 900 } { 901 assert.Equal(t, item, proto.HistoryEvent(thrift.HistoryEvent(item))) 902 } 903 assert.Panics(t, func() { proto.HistoryEvent(&shared.HistoryEvent{EventType: shared.EventType(UnknownValue).Ptr()}) }) 904 assert.Panics(t, func() { thrift.HistoryEvent(&apiv1.HistoryEvent{}) }) 905 } 906 func TestDecision(t *testing.T) { 907 for _, item := range []*apiv1.Decision{ 908 nil, 909 &testdata.Decision_CancelTimer, 910 &testdata.Decision_CancelWorkflowExecution, 911 &testdata.Decision_CompleteWorkflowExecution, 912 &testdata.Decision_ContinueAsNewWorkflowExecution, 913 &testdata.Decision_FailWorkflowExecution, 914 &testdata.Decision_RecordMarker, 915 &testdata.Decision_RequestCancelActivityTask, 916 &testdata.Decision_RequestCancelExternalWorkflowExecution, 917 &testdata.Decision_ScheduleActivityTask, 918 &testdata.Decision_SignalExternalWorkflowExecution, 919 &testdata.Decision_StartChildWorkflowExecution, 920 &testdata.Decision_StartTimer, 921 &testdata.Decision_UpsertWorkflowSearchAttributes, 922 } { 923 assert.Equal(t, item, proto.Decision(thrift.Decision(item))) 924 } 925 assert.Panics(t, func() { proto.Decision(&shared.Decision{DecisionType: shared.DecisionType(UnknownValue).Ptr()}) }) 926 assert.Panics(t, func() { thrift.Decision(&apiv1.Decision{}) }) 927 } 928 func TestListClosedWorkflowExecutionsRequest(t *testing.T) { 929 for _, item := range []*apiv1.ListClosedWorkflowExecutionsRequest{ 930 nil, 931 {}, 932 &testdata.ListClosedWorkflowExecutionsRequest_ExecutionFilter, 933 &testdata.ListClosedWorkflowExecutionsRequest_StatusFilter, 934 &testdata.ListClosedWorkflowExecutionsRequest_TypeFilter, 935 } { 936 assert.Equal(t, item, proto.ListClosedWorkflowExecutionsRequest(thrift.ListClosedWorkflowExecutionsRequest(item))) 937 } 938 } 939 func TestListOpenWorkflowExecutionsRequest(t *testing.T) { 940 for _, item := range []*apiv1.ListOpenWorkflowExecutionsRequest{ 941 nil, 942 {}, 943 &testdata.ListOpenWorkflowExecutionsRequest_ExecutionFilter, 944 &testdata.ListOpenWorkflowExecutionsRequest_TypeFilter, 945 } { 946 assert.Equal(t, item, proto.ListOpenWorkflowExecutionsRequest(thrift.ListOpenWorkflowExecutionsRequest(item))) 947 } 948 }