go.uber.org/cadence@v1.2.9/internal/compatibility/testdata/service.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 testdata
    22  
    23  import (
    24  	gogo "github.com/gogo/protobuf/types"
    25  
    26  	apiv1 "github.com/uber/cadence-idl/go/proto/api/v1"
    27  )
    28  
    29  var (
    30  	RegisterDomainRequest = apiv1.RegisterDomainRequest{
    31  		Name:                             DomainName,
    32  		Description:                      DomainDescription,
    33  		OwnerEmail:                       DomainOwnerEmail,
    34  		WorkflowExecutionRetentionPeriod: DomainRetention,
    35  		Clusters:                         ClusterReplicationConfigurationArray,
    36  		ActiveClusterName:                ClusterName1,
    37  		Data:                             DomainData,
    38  		SecurityToken:                    SecurityToken,
    39  		IsGlobalDomain:                   true,
    40  		HistoryArchivalStatus:            ArchivalStatus,
    41  		HistoryArchivalUri:               HistoryArchivalURI,
    42  		VisibilityArchivalStatus:         ArchivalStatus,
    43  		VisibilityArchivalUri:            VisibilityArchivalURI,
    44  	}
    45  	DescribeDomainRequest_ID = apiv1.DescribeDomainRequest{
    46  		DescribeBy: &apiv1.DescribeDomainRequest_Id{Id: DomainID},
    47  	}
    48  	DescribeDomainRequest_Name = apiv1.DescribeDomainRequest{
    49  		DescribeBy: &apiv1.DescribeDomainRequest_Name{Name: DomainName},
    50  	}
    51  	DescribeDomainResponse = apiv1.DescribeDomainResponse{
    52  		Domain: &Domain,
    53  	}
    54  	ListDomainsRequest = apiv1.ListDomainsRequest{
    55  		PageSize:      PageSize,
    56  		NextPageToken: NextPageToken,
    57  	}
    58  	ListDomainsResponse = apiv1.ListDomainsResponse{
    59  		Domains:       []*apiv1.Domain{&Domain},
    60  		NextPageToken: NextPageToken,
    61  	}
    62  	UpdateDomainRequest = apiv1.UpdateDomainRequest{
    63  		Name:                             DomainName,
    64  		Description:                      DomainDescription,
    65  		OwnerEmail:                       DomainOwnerEmail,
    66  		Data:                             DomainData,
    67  		WorkflowExecutionRetentionPeriod: DomainRetention,
    68  		BadBinaries:                      &BadBinaries,
    69  		HistoryArchivalStatus:            ArchivalStatus,
    70  		HistoryArchivalUri:               HistoryArchivalURI,
    71  		VisibilityArchivalStatus:         ArchivalStatus,
    72  		VisibilityArchivalUri:            VisibilityArchivalURI,
    73  		ActiveClusterName:                ClusterName1,
    74  		Clusters:                         ClusterReplicationConfigurationArray,
    75  		SecurityToken:                    SecurityToken,
    76  		DeleteBadBinary:                  DeleteBadBinary,
    77  		FailoverTimeout:                  Duration1,
    78  		UpdateMask:                       &gogo.FieldMask{Paths: []string{"description", "owner_email", "data", "workflow_execution_retention_period", "bad_binaries", "history_archival_status", "history_archival_uri", "visibility_archival_status", "visibility_archival_uri", "active_cluster_name", "clusters", "delete_bad_binary", "failover_timeout"}},
    79  	}
    80  	UpdateDomainResponse = apiv1.UpdateDomainResponse{
    81  		Domain: &Domain,
    82  	}
    83  	DeprecateDomainRequest = apiv1.DeprecateDomainRequest{
    84  		Name:          DomainName,
    85  		SecurityToken: SecurityToken,
    86  	}
    87  	ListWorkflowExecutionsRequest = apiv1.ListWorkflowExecutionsRequest{
    88  		Domain:        DomainName,
    89  		PageSize:      PageSize,
    90  		NextPageToken: NextPageToken,
    91  		Query:         VisibilityQuery,
    92  	}
    93  	ListWorkflowExecutionsResponse = apiv1.ListWorkflowExecutionsResponse{
    94  		Executions:    WorkflowExecutionInfoArray,
    95  		NextPageToken: NextPageToken,
    96  	}
    97  	ScanWorkflowExecutionsRequest = apiv1.ScanWorkflowExecutionsRequest{
    98  		Domain:        DomainName,
    99  		PageSize:      PageSize,
   100  		NextPageToken: NextPageToken,
   101  		Query:         VisibilityQuery,
   102  	}
   103  	ScanWorkflowExecutionsResponse = apiv1.ScanWorkflowExecutionsResponse{
   104  		Executions:    WorkflowExecutionInfoArray,
   105  		NextPageToken: NextPageToken,
   106  	}
   107  	ListOpenWorkflowExecutionsRequest_ExecutionFilter = apiv1.ListOpenWorkflowExecutionsRequest{
   108  		Domain:          DomainName,
   109  		PageSize:        PageSize,
   110  		NextPageToken:   NextPageToken,
   111  		StartTimeFilter: &StartTimeFilter,
   112  		Filters: &apiv1.ListOpenWorkflowExecutionsRequest_ExecutionFilter{
   113  			ExecutionFilter: &WorkflowExecutionFilter,
   114  		},
   115  	}
   116  	ListOpenWorkflowExecutionsRequest_TypeFilter = apiv1.ListOpenWorkflowExecutionsRequest{
   117  		Domain:          DomainName,
   118  		PageSize:        PageSize,
   119  		NextPageToken:   NextPageToken,
   120  		StartTimeFilter: &StartTimeFilter,
   121  		Filters: &apiv1.ListOpenWorkflowExecutionsRequest_TypeFilter{
   122  			TypeFilter: &WorkflowTypeFilter,
   123  		},
   124  	}
   125  	ListOpenWorkflowExecutionsResponse = apiv1.ListOpenWorkflowExecutionsResponse{
   126  		Executions:    WorkflowExecutionInfoArray,
   127  		NextPageToken: NextPageToken,
   128  	}
   129  	ListClosedWorkflowExecutionsRequest_ExecutionFilter = apiv1.ListClosedWorkflowExecutionsRequest{
   130  		Domain:          DomainName,
   131  		PageSize:        PageSize,
   132  		NextPageToken:   NextPageToken,
   133  		StartTimeFilter: &StartTimeFilter,
   134  		Filters: &apiv1.ListClosedWorkflowExecutionsRequest_ExecutionFilter{
   135  			ExecutionFilter: &WorkflowExecutionFilter,
   136  		},
   137  	}
   138  	ListClosedWorkflowExecutionsRequest_TypeFilter = apiv1.ListClosedWorkflowExecutionsRequest{
   139  		Domain:          DomainName,
   140  		PageSize:        PageSize,
   141  		NextPageToken:   NextPageToken,
   142  		StartTimeFilter: &StartTimeFilter,
   143  		Filters: &apiv1.ListClosedWorkflowExecutionsRequest_TypeFilter{
   144  			TypeFilter: &WorkflowTypeFilter,
   145  		},
   146  	}
   147  	ListClosedWorkflowExecutionsRequest_StatusFilter = apiv1.ListClosedWorkflowExecutionsRequest{
   148  		Domain:          DomainName,
   149  		PageSize:        PageSize,
   150  		NextPageToken:   NextPageToken,
   151  		StartTimeFilter: &StartTimeFilter,
   152  		Filters: &apiv1.ListClosedWorkflowExecutionsRequest_StatusFilter{
   153  			StatusFilter: &StatusFilter,
   154  		},
   155  	}
   156  	ListClosedWorkflowExecutionsResponse = apiv1.ListClosedWorkflowExecutionsResponse{
   157  		Executions:    WorkflowExecutionInfoArray,
   158  		NextPageToken: NextPageToken,
   159  	}
   160  	ListArchivedWorkflowExecutionsRequest = apiv1.ListArchivedWorkflowExecutionsRequest{
   161  		Domain:        DomainName,
   162  		PageSize:      PageSize,
   163  		NextPageToken: NextPageToken,
   164  		Query:         VisibilityQuery,
   165  	}
   166  	ListArchivedWorkflowExecutionsResponse = apiv1.ListArchivedWorkflowExecutionsResponse{
   167  		Executions:    WorkflowExecutionInfoArray,
   168  		NextPageToken: NextPageToken,
   169  	}
   170  	CountWorkflowExecutionsRequest = apiv1.CountWorkflowExecutionsRequest{
   171  		Domain: DomainName,
   172  		Query:  VisibilityQuery,
   173  	}
   174  	CountWorkflowExecutionsResponse = apiv1.CountWorkflowExecutionsResponse{
   175  		Count: int64(8),
   176  	}
   177  	GetSearchAttributesResponse = apiv1.GetSearchAttributesResponse{
   178  		Keys: IndexedValueTypeMap,
   179  	}
   180  	PollForDecisionTaskRequest = apiv1.PollForDecisionTaskRequest{
   181  		Domain:         DomainName,
   182  		TaskList:       &TaskList,
   183  		Identity:       Identity,
   184  		BinaryChecksum: Checksum,
   185  	}
   186  	PollForDecisionTaskResponse = apiv1.PollForDecisionTaskResponse{
   187  		TaskToken:                 TaskToken,
   188  		WorkflowExecution:         &WorkflowExecution,
   189  		WorkflowType:              &WorkflowType,
   190  		PreviousStartedEventId:    &gogo.Int64Value{Value: EventID1},
   191  		StartedEventId:            EventID2,
   192  		Attempt:                   Attempt,
   193  		BacklogCountHint:          BacklogCountHint,
   194  		History:                   &History,
   195  		NextPageToken:             NextPageToken,
   196  		Query:                     &WorkflowQuery,
   197  		WorkflowExecutionTaskList: &TaskList,
   198  		ScheduledTime:             Timestamp1,
   199  		StartedTime:               Timestamp2,
   200  		Queries:                   WorkflowQueryMap,
   201  		NextEventId:               EventID3,
   202  	}
   203  	RespondDecisionTaskCompletedRequest = apiv1.RespondDecisionTaskCompletedRequest{
   204  		TaskToken:                  TaskToken,
   205  		Decisions:                  DecisionArray,
   206  		ExecutionContext:           ExecutionContext,
   207  		Identity:                   Identity,
   208  		StickyAttributes:           &StickyExecutionAttributes,
   209  		ReturnNewDecisionTask:      true,
   210  		ForceCreateNewDecisionTask: true,
   211  		BinaryChecksum:             Checksum,
   212  		QueryResults:               WorkflowQueryResultMap,
   213  	}
   214  	RespondDecisionTaskCompletedResponse = apiv1.RespondDecisionTaskCompletedResponse{
   215  		DecisionTask:                &PollForDecisionTaskResponse,
   216  		ActivitiesToDispatchLocally: ActivityLocalDispatchInfoMap,
   217  	}
   218  	RespondDecisionTaskFailedRequest = apiv1.RespondDecisionTaskFailedRequest{
   219  		TaskToken:      TaskToken,
   220  		Cause:          DecisionTaskFailedCause,
   221  		Details:        &Payload1,
   222  		Identity:       Identity,
   223  		BinaryChecksum: Checksum,
   224  	}
   225  	PollForActivityTaskRequest = apiv1.PollForActivityTaskRequest{
   226  		Domain:           DomainName,
   227  		TaskList:         &TaskList,
   228  		Identity:         Identity,
   229  		TaskListMetadata: &TaskListMetadata,
   230  	}
   231  	PollForActivityTaskResponse = apiv1.PollForActivityTaskResponse{
   232  		TaskToken:                  TaskToken,
   233  		WorkflowExecution:          &WorkflowExecution,
   234  		ActivityId:                 ActivityID,
   235  		ActivityType:               &ActivityType,
   236  		Input:                      &Payload1,
   237  		ScheduledTime:              Timestamp1,
   238  		ScheduleToCloseTimeout:     Duration1,
   239  		StartedTime:                Timestamp2,
   240  		StartToCloseTimeout:        Duration2,
   241  		HeartbeatTimeout:           Duration3,
   242  		Attempt:                    Attempt,
   243  		ScheduledTimeOfThisAttempt: Timestamp3,
   244  		HeartbeatDetails:           &Payload2,
   245  		WorkflowType:               &WorkflowType,
   246  		WorkflowDomain:             DomainName,
   247  		Header:                     &Header,
   248  	}
   249  	RespondActivityTaskCompletedRequest = apiv1.RespondActivityTaskCompletedRequest{
   250  		TaskToken: TaskToken,
   251  		Result:    &Payload1,
   252  		Identity:  Identity,
   253  	}
   254  	RespondActivityTaskCompletedByIDRequest = apiv1.RespondActivityTaskCompletedByIDRequest{
   255  		Domain:            DomainName,
   256  		WorkflowExecution: &WorkflowExecution,
   257  		ActivityId:        ActivityID,
   258  		Result:            &Payload1,
   259  		Identity:          Identity,
   260  	}
   261  	RespondActivityTaskFailedRequest = apiv1.RespondActivityTaskFailedRequest{
   262  		TaskToken: TaskToken,
   263  		Failure:   &Failure,
   264  		Identity:  Identity,
   265  	}
   266  	RespondActivityTaskFailedByIDRequest = apiv1.RespondActivityTaskFailedByIDRequest{
   267  		Domain:            DomainName,
   268  		WorkflowExecution: &WorkflowExecution,
   269  		ActivityId:        ActivityID,
   270  		Failure:           &Failure,
   271  		Identity:          Identity,
   272  	}
   273  	RespondActivityTaskCanceledRequest = apiv1.RespondActivityTaskCanceledRequest{
   274  		TaskToken: TaskToken,
   275  		Details:   &Payload1,
   276  		Identity:  Identity,
   277  	}
   278  	RespondActivityTaskCanceledByIDRequest = apiv1.RespondActivityTaskCanceledByIDRequest{
   279  		Domain:            DomainName,
   280  		WorkflowExecution: &WorkflowExecution,
   281  		ActivityId:        ActivityID,
   282  		Details:           &Payload1,
   283  		Identity:          Identity,
   284  	}
   285  	RecordActivityTaskHeartbeatRequest = apiv1.RecordActivityTaskHeartbeatRequest{
   286  		TaskToken: TaskToken,
   287  		Details:   &Payload1,
   288  		Identity:  Identity,
   289  	}
   290  	RecordActivityTaskHeartbeatResponse = apiv1.RecordActivityTaskHeartbeatResponse{
   291  		CancelRequested: true,
   292  	}
   293  	RecordActivityTaskHeartbeatByIDResponse = apiv1.RecordActivityTaskHeartbeatByIDResponse{
   294  		CancelRequested: true,
   295  	}
   296  	RecordActivityTaskHeartbeatByIDRequest = apiv1.RecordActivityTaskHeartbeatByIDRequest{
   297  		Domain:            DomainName,
   298  		WorkflowExecution: &WorkflowExecution,
   299  		ActivityId:        ActivityID,
   300  		Details:           &Payload1,
   301  		Identity:          Identity,
   302  	}
   303  	RespondQueryTaskCompletedRequest = apiv1.RespondQueryTaskCompletedRequest{
   304  		TaskToken: TaskToken,
   305  		Result: &apiv1.WorkflowQueryResult{
   306  			ResultType:   QueryResultType,
   307  			Answer:       &Payload1,
   308  			ErrorMessage: ErrorMessage,
   309  		},
   310  		WorkerVersionInfo: &WorkerVersionInfo,
   311  	}
   312  	RequestCancelWorkflowExecutionRequest = apiv1.RequestCancelWorkflowExecutionRequest{
   313  		Domain:            DomainName,
   314  		WorkflowExecution: &WorkflowExecution,
   315  		Identity:          Identity,
   316  		RequestId:         RequestID,
   317  	}
   318  	StartWorkflowExecutionRequest = apiv1.StartWorkflowExecutionRequest{
   319  		Domain:                       DomainName,
   320  		WorkflowId:                   WorkflowID,
   321  		WorkflowType:                 &WorkflowType,
   322  		TaskList:                     &TaskList,
   323  		Input:                        &Payload1,
   324  		ExecutionStartToCloseTimeout: Duration1,
   325  		TaskStartToCloseTimeout:      Duration2,
   326  		Identity:                     Identity,
   327  		RequestId:                    RequestID,
   328  		WorkflowIdReusePolicy:        WorkflowIDReusePolicy,
   329  		RetryPolicy:                  &RetryPolicy,
   330  		CronSchedule:                 CronSchedule,
   331  		Memo:                         &Memo,
   332  		SearchAttributes:             &SearchAttributes,
   333  		Header:                       &Header,
   334  	}
   335  	StartWorkflowExecutionResponse = apiv1.StartWorkflowExecutionResponse{
   336  		RunId: RunID,
   337  	}
   338  	SignalWorkflowExecutionRequest = apiv1.SignalWorkflowExecutionRequest{
   339  		Domain:            DomainName,
   340  		WorkflowExecution: &WorkflowExecution,
   341  		SignalName:        SignalName,
   342  		SignalInput:       &Payload1,
   343  		Identity:          Identity,
   344  		RequestId:         RequestID,
   345  		Control:           Control,
   346  	}
   347  	SignalWithStartWorkflowExecutionRequest = apiv1.SignalWithStartWorkflowExecutionRequest{
   348  		StartRequest: &StartWorkflowExecutionRequest,
   349  		SignalName:   SignalName,
   350  		SignalInput:  &Payload2,
   351  		Control:      Control,
   352  	}
   353  	SignalWithStartWorkflowExecutionResponse = apiv1.SignalWithStartWorkflowExecutionResponse{
   354  		RunId: RunID,
   355  	}
   356  	ResetWorkflowExecutionRequest = apiv1.ResetWorkflowExecutionRequest{
   357  		Domain:                DomainName,
   358  		WorkflowExecution:     &WorkflowExecution,
   359  		Reason:                Reason,
   360  		DecisionFinishEventId: EventID1,
   361  		RequestId:             RequestID,
   362  		SkipSignalReapply:     true,
   363  	}
   364  	ResetWorkflowExecutionResponse = apiv1.ResetWorkflowExecutionResponse{
   365  		RunId: RunID,
   366  	}
   367  	TerminateWorkflowExecutionRequest = apiv1.TerminateWorkflowExecutionRequest{
   368  		Domain:            DomainName,
   369  		WorkflowExecution: &WorkflowExecution,
   370  		Reason:            Reason,
   371  		Details:           &Payload1,
   372  		Identity:          Identity,
   373  	}
   374  	DescribeWorkflowExecutionRequest = apiv1.DescribeWorkflowExecutionRequest{
   375  		Domain:            DomainName,
   376  		WorkflowExecution: &WorkflowExecution,
   377  	}
   378  	DescribeWorkflowExecutionResponse = apiv1.DescribeWorkflowExecutionResponse{
   379  		ExecutionConfiguration: &WorkflowExecutionConfiguration,
   380  		WorkflowExecutionInfo:  &WorkflowExecutionInfo,
   381  		PendingActivities:      PendingActivityInfoArray,
   382  		PendingChildren:        PendingChildExecutionInfoArray,
   383  		PendingDecision:        &PendingDecisionInfo,
   384  	}
   385  	QueryWorkflowRequest = apiv1.QueryWorkflowRequest{
   386  		Domain:                DomainName,
   387  		WorkflowExecution:     &WorkflowExecution,
   388  		Query:                 &WorkflowQuery,
   389  		QueryRejectCondition:  QueryRejectCondition,
   390  		QueryConsistencyLevel: QueryConsistencyLevel,
   391  	}
   392  	QueryWorkflowResponse = apiv1.QueryWorkflowResponse{
   393  		QueryResult:   &Payload1,
   394  		QueryRejected: &QueryRejected,
   395  	}
   396  	DescribeTaskListRequest = apiv1.DescribeTaskListRequest{
   397  		Domain:                DomainName,
   398  		TaskList:              &TaskList,
   399  		TaskListType:          TaskListType,
   400  		IncludeTaskListStatus: true,
   401  	}
   402  	DescribeTaskListResponse = apiv1.DescribeTaskListResponse{
   403  		Pollers:        PollerInfoArray,
   404  		TaskListStatus: &TaskListStatus,
   405  	}
   406  	ListTaskListPartitionsRequest = apiv1.ListTaskListPartitionsRequest{
   407  		Domain:   DomainName,
   408  		TaskList: &TaskList,
   409  	}
   410  	ListTaskListPartitionsResponse = apiv1.ListTaskListPartitionsResponse{
   411  		ActivityTaskListPartitions: TaskListPartitionMetadataArray,
   412  		DecisionTaskListPartitions: TaskListPartitionMetadataArray,
   413  	}
   414  	ResetStickyTaskListRequest = apiv1.ResetStickyTaskListRequest{
   415  		Domain:            DomainName,
   416  		WorkflowExecution: &WorkflowExecution,
   417  	}
   418  	ResetStickyTaskListResponse        = apiv1.ResetStickyTaskListResponse{}
   419  	GetWorkflowExecutionHistoryRequest = apiv1.GetWorkflowExecutionHistoryRequest{
   420  		Domain:                 DomainName,
   421  		WorkflowExecution:      &WorkflowExecution,
   422  		PageSize:               PageSize,
   423  		NextPageToken:          NextPageToken,
   424  		WaitForNewEvent:        true,
   425  		HistoryEventFilterType: HistoryEventFilterType,
   426  		SkipArchival:           true,
   427  	}
   428  	GetWorkflowExecutionHistoryResponse = apiv1.GetWorkflowExecutionHistoryResponse{
   429  		History:       &History,
   430  		RawHistory:    DataBlobArray,
   431  		NextPageToken: NextPageToken,
   432  		Archived:      true,
   433  	}
   434  
   435  	DomainArray = []*apiv1.Domain{
   436  		&Domain,
   437  	}
   438  	GetClusterInfoResponse = apiv1.GetClusterInfoResponse{
   439  		SupportedClientVersions: &SupportedClientVersions,
   440  	}
   441  )