Files
tasks/common/persistence/visibility/manager/visibility_manager_mock.go
Yichao YangandGitHub ae221a7806 Switch to uber gomock (#6493)
## What changed?
<!-- Describe what has changed in this PR -->
- Switch to uber gomock
- Generate workflowservice and operatorservice mock inside server repo,
instead of using imports from api-go to avoid making breaking changes
there.

## Why?
<!-- Tell your future self why have you made these changes -->
- google gomock is no longer maintained and doesn't support generics

## How did you test it?
<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->

## Potential risks
<!-- Assuming the worst case, what can be broken when deploying this
change to production? -->

## Documentation
<!-- Have you made sure this change doesn't falsify anything currently
stated in `docs/`? If significant
new behavior is added, have you described that in `docs/`? -->

## Is hotfix candidate?
<!-- Is this PR a hotfix candidate or does it require a notification to
be sent to the broader community? (Yes/No) -->
2024-09-09 14:44:20 -07:00

265 lines
11 KiB
Go

// The MIT License
//
// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved.
//
// Copyright (c) 2020 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// Code generated by MockGen. DO NOT EDIT.
// Source: visibility_manager.go
//
// Generated by this command:
//
// mockgen -copyright_file ../../../../LICENSE -package manager -source visibility_manager.go -destination visibility_manager_mock.go -aux_files go.temporal.io/server/common/persistence=../../data_interfaces.go
//
// Package manager is a generated GoMock package.
package manager
import (
context "context"
reflect "reflect"
namespace "go.temporal.io/server/common/namespace"
gomock "go.uber.org/mock/gomock"
)
// MockVisibilityManager is a mock of VisibilityManager interface.
type MockVisibilityManager struct {
ctrl *gomock.Controller
recorder *MockVisibilityManagerMockRecorder
}
// MockVisibilityManagerMockRecorder is the mock recorder for MockVisibilityManager.
type MockVisibilityManagerMockRecorder struct {
mock *MockVisibilityManager
}
// NewMockVisibilityManager creates a new mock instance.
func NewMockVisibilityManager(ctrl *gomock.Controller) *MockVisibilityManager {
mock := &MockVisibilityManager{ctrl: ctrl}
mock.recorder = &MockVisibilityManagerMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockVisibilityManager) EXPECT() *MockVisibilityManagerMockRecorder {
return m.recorder
}
// Close mocks base method.
func (m *MockVisibilityManager) Close() {
m.ctrl.T.Helper()
m.ctrl.Call(m, "Close")
}
// Close indicates an expected call of Close.
func (mr *MockVisibilityManagerMockRecorder) Close() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockVisibilityManager)(nil).Close))
}
// CountWorkflowExecutions mocks base method.
func (m *MockVisibilityManager) CountWorkflowExecutions(ctx context.Context, request *CountWorkflowExecutionsRequest) (*CountWorkflowExecutionsResponse, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "CountWorkflowExecutions", ctx, request)
ret0, _ := ret[0].(*CountWorkflowExecutionsResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// CountWorkflowExecutions indicates an expected call of CountWorkflowExecutions.
func (mr *MockVisibilityManagerMockRecorder) CountWorkflowExecutions(ctx, request any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CountWorkflowExecutions", reflect.TypeOf((*MockVisibilityManager)(nil).CountWorkflowExecutions), ctx, request)
}
// DeleteWorkflowExecution mocks base method.
func (m *MockVisibilityManager) DeleteWorkflowExecution(ctx context.Context, request *VisibilityDeleteWorkflowExecutionRequest) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "DeleteWorkflowExecution", ctx, request)
ret0, _ := ret[0].(error)
return ret0
}
// DeleteWorkflowExecution indicates an expected call of DeleteWorkflowExecution.
func (mr *MockVisibilityManagerMockRecorder) DeleteWorkflowExecution(ctx, request any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteWorkflowExecution", reflect.TypeOf((*MockVisibilityManager)(nil).DeleteWorkflowExecution), ctx, request)
}
// GetIndexName mocks base method.
func (m *MockVisibilityManager) GetIndexName() string {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetIndexName")
ret0, _ := ret[0].(string)
return ret0
}
// GetIndexName indicates an expected call of GetIndexName.
func (mr *MockVisibilityManagerMockRecorder) GetIndexName() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetIndexName", reflect.TypeOf((*MockVisibilityManager)(nil).GetIndexName))
}
// GetReadStoreName mocks base method.
func (m *MockVisibilityManager) GetReadStoreName(nsName namespace.Name) string {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetReadStoreName", nsName)
ret0, _ := ret[0].(string)
return ret0
}
// GetReadStoreName indicates an expected call of GetReadStoreName.
func (mr *MockVisibilityManagerMockRecorder) GetReadStoreName(nsName any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetReadStoreName", reflect.TypeOf((*MockVisibilityManager)(nil).GetReadStoreName), nsName)
}
// GetStoreNames mocks base method.
func (m *MockVisibilityManager) GetStoreNames() []string {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetStoreNames")
ret0, _ := ret[0].([]string)
return ret0
}
// GetStoreNames indicates an expected call of GetStoreNames.
func (mr *MockVisibilityManagerMockRecorder) GetStoreNames() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetStoreNames", reflect.TypeOf((*MockVisibilityManager)(nil).GetStoreNames))
}
// GetWorkflowExecution mocks base method.
func (m *MockVisibilityManager) GetWorkflowExecution(ctx context.Context, request *GetWorkflowExecutionRequest) (*GetWorkflowExecutionResponse, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetWorkflowExecution", ctx, request)
ret0, _ := ret[0].(*GetWorkflowExecutionResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// GetWorkflowExecution indicates an expected call of GetWorkflowExecution.
func (mr *MockVisibilityManagerMockRecorder) GetWorkflowExecution(ctx, request any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWorkflowExecution", reflect.TypeOf((*MockVisibilityManager)(nil).GetWorkflowExecution), ctx, request)
}
// HasStoreName mocks base method.
func (m *MockVisibilityManager) HasStoreName(stName string) bool {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "HasStoreName", stName)
ret0, _ := ret[0].(bool)
return ret0
}
// HasStoreName indicates an expected call of HasStoreName.
func (mr *MockVisibilityManagerMockRecorder) HasStoreName(stName any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HasStoreName", reflect.TypeOf((*MockVisibilityManager)(nil).HasStoreName), stName)
}
// ListWorkflowExecutions mocks base method.
func (m *MockVisibilityManager) ListWorkflowExecutions(ctx context.Context, request *ListWorkflowExecutionsRequestV2) (*ListWorkflowExecutionsResponse, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ListWorkflowExecutions", ctx, request)
ret0, _ := ret[0].(*ListWorkflowExecutionsResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// ListWorkflowExecutions indicates an expected call of ListWorkflowExecutions.
func (mr *MockVisibilityManagerMockRecorder) ListWorkflowExecutions(ctx, request any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListWorkflowExecutions", reflect.TypeOf((*MockVisibilityManager)(nil).ListWorkflowExecutions), ctx, request)
}
// RecordWorkflowExecutionClosed mocks base method.
func (m *MockVisibilityManager) RecordWorkflowExecutionClosed(ctx context.Context, request *RecordWorkflowExecutionClosedRequest) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "RecordWorkflowExecutionClosed", ctx, request)
ret0, _ := ret[0].(error)
return ret0
}
// RecordWorkflowExecutionClosed indicates an expected call of RecordWorkflowExecutionClosed.
func (mr *MockVisibilityManagerMockRecorder) RecordWorkflowExecutionClosed(ctx, request any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecordWorkflowExecutionClosed", reflect.TypeOf((*MockVisibilityManager)(nil).RecordWorkflowExecutionClosed), ctx, request)
}
// RecordWorkflowExecutionStarted mocks base method.
func (m *MockVisibilityManager) RecordWorkflowExecutionStarted(ctx context.Context, request *RecordWorkflowExecutionStartedRequest) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "RecordWorkflowExecutionStarted", ctx, request)
ret0, _ := ret[0].(error)
return ret0
}
// RecordWorkflowExecutionStarted indicates an expected call of RecordWorkflowExecutionStarted.
func (mr *MockVisibilityManagerMockRecorder) RecordWorkflowExecutionStarted(ctx, request any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecordWorkflowExecutionStarted", reflect.TypeOf((*MockVisibilityManager)(nil).RecordWorkflowExecutionStarted), ctx, request)
}
// ScanWorkflowExecutions mocks base method.
func (m *MockVisibilityManager) ScanWorkflowExecutions(ctx context.Context, request *ListWorkflowExecutionsRequestV2) (*ListWorkflowExecutionsResponse, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ScanWorkflowExecutions", ctx, request)
ret0, _ := ret[0].(*ListWorkflowExecutionsResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// ScanWorkflowExecutions indicates an expected call of ScanWorkflowExecutions.
func (mr *MockVisibilityManagerMockRecorder) ScanWorkflowExecutions(ctx, request any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ScanWorkflowExecutions", reflect.TypeOf((*MockVisibilityManager)(nil).ScanWorkflowExecutions), ctx, request)
}
// UpsertWorkflowExecution mocks base method.
func (m *MockVisibilityManager) UpsertWorkflowExecution(ctx context.Context, request *UpsertWorkflowExecutionRequest) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "UpsertWorkflowExecution", ctx, request)
ret0, _ := ret[0].(error)
return ret0
}
// UpsertWorkflowExecution indicates an expected call of UpsertWorkflowExecution.
func (mr *MockVisibilityManagerMockRecorder) UpsertWorkflowExecution(ctx, request any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpsertWorkflowExecution", reflect.TypeOf((*MockVisibilityManager)(nil).UpsertWorkflowExecution), ctx, request)
}
// ValidateCustomSearchAttributes mocks base method.
func (m *MockVisibilityManager) ValidateCustomSearchAttributes(searchAttributes map[string]any) (map[string]any, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ValidateCustomSearchAttributes", searchAttributes)
ret0, _ := ret[0].(map[string]any)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// ValidateCustomSearchAttributes indicates an expected call of ValidateCustomSearchAttributes.
func (mr *MockVisibilityManagerMockRecorder) ValidateCustomSearchAttributes(searchAttributes any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateCustomSearchAttributes", reflect.TypeOf((*MockVisibilityManager)(nil).ValidateCustomSearchAttributes), searchAttributes)
}