You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

mock_datasource_manager.go 11 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. // Code generated by MockGen. DO NOT EDIT.
  18. // Source: datasource_manager.go
  19. // Package mock is a generated GoMock package.
  20. package mock
  21. import (
  22. context "context"
  23. sql "database/sql"
  24. reflect "reflect"
  25. sync "sync"
  26. gomock "github.com/golang/mock/gomock"
  27. datasource "github.com/seata/seata-go/pkg/datasource/sql/datasource"
  28. types "github.com/seata/seata-go/pkg/datasource/sql/types"
  29. branch "github.com/seata/seata-go/pkg/protocol/branch"
  30. rm "github.com/seata/seata-go/pkg/rm"
  31. )
  32. // MockDataSourceManager is a mock of DataSourceManager interface.
  33. type MockDataSourceManager struct {
  34. ctrl *gomock.Controller
  35. recorder *MockDataSourceManagerMockRecorder
  36. branchType branch.BranchType
  37. }
  38. // MockDataSourceManagerMockRecorder is the mock recorder for MockDataSourceManager.
  39. type MockDataSourceManagerMockRecorder struct {
  40. mock *MockDataSourceManager
  41. }
  42. // NewMockDataSourceManager creates a new mock instance.
  43. func NewMockDataSourceManager(ctrl *gomock.Controller) *MockDataSourceManager {
  44. mock := &MockDataSourceManager{ctrl: ctrl}
  45. mock.recorder = &MockDataSourceManagerMockRecorder{mock}
  46. return mock
  47. }
  48. // EXPECT returns an object that allows the caller to indicate expected use.
  49. func (m *MockDataSourceManager) EXPECT() *MockDataSourceManagerMockRecorder {
  50. return m.recorder
  51. }
  52. // BranchCommit mocks base method.
  53. func (m *MockDataSourceManager) BranchCommit(ctx context.Context, resource rm.BranchResource) (branch.BranchStatus, error) {
  54. m.ctrl.T.Helper()
  55. ret := m.ctrl.Call(m, "BranchCommit", ctx, resource)
  56. ret0, _ := ret[0].(branch.BranchStatus)
  57. ret1, _ := ret[1].(error)
  58. return ret0, ret1
  59. }
  60. // BranchCommit indicates an expected call of BranchCommit.
  61. func (mr *MockDataSourceManagerMockRecorder) BranchCommit(ctx, resource interface{}) *gomock.Call {
  62. mr.mock.ctrl.T.Helper()
  63. return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BranchCommit", reflect.TypeOf((*MockDataSourceManager)(nil).BranchCommit), ctx, resource)
  64. }
  65. // BranchRegister mocks base method.
  66. func (m *MockDataSourceManager) BranchRegister(ctx context.Context, param rm.BranchRegisterParam) (int64, error) {
  67. m.ctrl.T.Helper()
  68. ret := m.ctrl.Call(m, "BranchRegister", ctx, param)
  69. ret0, _ := ret[0].(int64)
  70. ret1, _ := ret[1].(error)
  71. return ret0, ret1
  72. }
  73. // BranchRegister indicates an expected call of BranchRegister.
  74. func (mr *MockDataSourceManagerMockRecorder) BranchRegister(ctx, param interface{}) *gomock.Call {
  75. mr.mock.ctrl.T.Helper()
  76. return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BranchRegister", reflect.TypeOf((*MockDataSourceManager)(nil).BranchRegister), ctx, param)
  77. }
  78. // BranchReport mocks base method.
  79. func (m *MockDataSourceManager) BranchReport(ctx context.Context, param rm.BranchReportParam) error {
  80. m.ctrl.T.Helper()
  81. ret := m.ctrl.Call(m, "BranchReport", ctx, param)
  82. ret0, _ := ret[0].(error)
  83. return ret0
  84. }
  85. // BranchReport indicates an expected call of BranchReport.
  86. func (mr *MockDataSourceManagerMockRecorder) BranchReport(ctx, param interface{}) *gomock.Call {
  87. mr.mock.ctrl.T.Helper()
  88. return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BranchReport", reflect.TypeOf((*MockDataSourceManager)(nil).BranchReport), ctx, param)
  89. }
  90. // BranchRollback mocks base method.
  91. func (m *MockDataSourceManager) BranchRollback(ctx context.Context, resource rm.BranchResource) (branch.BranchStatus, error) {
  92. m.ctrl.T.Helper()
  93. ret := m.ctrl.Call(m, "BranchRollback", ctx, resource)
  94. ret0, _ := ret[0].(branch.BranchStatus)
  95. ret1, _ := ret[1].(error)
  96. return ret0, ret1
  97. }
  98. // BranchRollback indicates an expected call of BranchRollback.
  99. func (mr *MockDataSourceManagerMockRecorder) BranchRollback(ctx, resource interface{}) *gomock.Call {
  100. mr.mock.ctrl.T.Helper()
  101. return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BranchRollback", reflect.TypeOf((*MockDataSourceManager)(nil).BranchRollback), ctx, resource)
  102. }
  103. // CreateTableMetaCache mocks base method.
  104. func (m *MockDataSourceManager) CreateTableMetaCache(ctx context.Context, resID string, dbType types.DBType, db *sql.DB) (datasource.TableMetaCache, error) {
  105. m.ctrl.T.Helper()
  106. ret := m.ctrl.Call(m, "CreateTableMetaCache", ctx, resID, dbType, db)
  107. ret0, _ := ret[0].(datasource.TableMetaCache)
  108. ret1, _ := ret[1].(error)
  109. return ret0, ret1
  110. }
  111. // CreateTableMetaCache indicates an expected call of CreateTableMetaCache.
  112. func (mr *MockDataSourceManagerMockRecorder) CreateTableMetaCache(ctx, resID, dbType, db interface{}) *gomock.Call {
  113. mr.mock.ctrl.T.Helper()
  114. return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTableMetaCache", reflect.TypeOf((*MockDataSourceManager)(nil).CreateTableMetaCache), ctx, resID, dbType, db)
  115. }
  116. func (m *MockDataSourceManager) SetBranchType(branchType branch.BranchType) {
  117. m.branchType = branchType
  118. }
  119. // GetBranchType mocks base method.
  120. func (m *MockDataSourceManager) GetBranchType() branch.BranchType {
  121. return m.branchType
  122. }
  123. // GetBranchType indicates an expected call of GetBranchType.
  124. func (mr *MockDataSourceManagerMockRecorder) GetBranchType() *gomock.Call {
  125. mr.mock.ctrl.T.Helper()
  126. return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBranchType", reflect.TypeOf((*MockDataSourceManager)(nil).GetBranchType))
  127. }
  128. // GetCachedResources mocks base method.
  129. func (m *MockDataSourceManager) GetCachedResources() *sync.Map {
  130. m.ctrl.T.Helper()
  131. ret := m.ctrl.Call(m, "GetCachedResources")
  132. ret0, _ := ret[0].(*sync.Map)
  133. return ret0
  134. }
  135. // GetCachedResources indicates an expected call of GetCachedResources.
  136. func (mr *MockDataSourceManagerMockRecorder) GetCachedResources() *gomock.Call {
  137. mr.mock.ctrl.T.Helper()
  138. return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCachedResources", reflect.TypeOf((*MockDataSourceManager)(nil).GetCachedResources))
  139. }
  140. // LockQuery mocks base method.
  141. func (m *MockDataSourceManager) LockQuery(ctx context.Context, param rm.LockQueryParam) (bool, error) {
  142. m.ctrl.T.Helper()
  143. ret := m.ctrl.Call(m, "LockQuery", ctx, param)
  144. ret0, _ := ret[0].(bool)
  145. ret1, _ := ret[1].(error)
  146. return ret0, ret1
  147. }
  148. // LockQuery indicates an expected call of LockQuery.
  149. func (mr *MockDataSourceManagerMockRecorder) LockQuery(ctx, param interface{}) *gomock.Call {
  150. mr.mock.ctrl.T.Helper()
  151. return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LockQuery", reflect.TypeOf((*MockDataSourceManager)(nil).LockQuery), ctx, param)
  152. }
  153. // RegisterResource mocks base method.
  154. func (m *MockDataSourceManager) RegisterResource(resource rm.Resource) error {
  155. m.ctrl.T.Helper()
  156. ret := m.ctrl.Call(m, "RegisterResource", resource)
  157. ret0, _ := ret[0].(error)
  158. return ret0
  159. }
  160. // RegisterResource indicates an expected call of RegisterResource.
  161. func (mr *MockDataSourceManagerMockRecorder) RegisterResource(resource interface{}) *gomock.Call {
  162. mr.mock.ctrl.T.Helper()
  163. return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterResource", reflect.TypeOf((*MockDataSourceManager)(nil).RegisterResource), resource)
  164. }
  165. // UnregisterResource mocks base method.
  166. func (m *MockDataSourceManager) UnregisterResource(resource rm.Resource) error {
  167. m.ctrl.T.Helper()
  168. ret := m.ctrl.Call(m, "UnregisterResource", resource)
  169. ret0, _ := ret[0].(error)
  170. return ret0
  171. }
  172. // UnregisterResource indicates an expected call of UnregisterResource.
  173. func (mr *MockDataSourceManagerMockRecorder) UnregisterResource(resource interface{}) *gomock.Call {
  174. mr.mock.ctrl.T.Helper()
  175. return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnregisterResource", reflect.TypeOf((*MockDataSourceManager)(nil).UnregisterResource), resource)
  176. }
  177. // MockTableMetaCache is a mock of TableMetaCache interface.
  178. type MockTableMetaCache struct {
  179. ctrl *gomock.Controller
  180. recorder *MockTableMetaCacheMockRecorder
  181. }
  182. // MockTableMetaCacheMockRecorder is the mock recorder for MockTableMetaCache.
  183. type MockTableMetaCacheMockRecorder struct {
  184. mock *MockTableMetaCache
  185. }
  186. // NewMockTableMetaCache creates a new mock instance.
  187. func NewMockTableMetaCache(ctrl *gomock.Controller) *MockTableMetaCache {
  188. mock := &MockTableMetaCache{ctrl: ctrl}
  189. mock.recorder = &MockTableMetaCacheMockRecorder{mock}
  190. return mock
  191. }
  192. // EXPECT returns an object that allows the caller to indicate expected use.
  193. func (m *MockTableMetaCache) EXPECT() *MockTableMetaCacheMockRecorder {
  194. return m.recorder
  195. }
  196. // Destroy mocks base method.
  197. func (m *MockTableMetaCache) Destroy() error {
  198. m.ctrl.T.Helper()
  199. ret := m.ctrl.Call(m, "Destroy")
  200. ret0, _ := ret[0].(error)
  201. return ret0
  202. }
  203. // Destroy indicates an expected call of Destroy.
  204. func (mr *MockTableMetaCacheMockRecorder) Destroy() *gomock.Call {
  205. mr.mock.ctrl.T.Helper()
  206. return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Destroy", reflect.TypeOf((*MockTableMetaCache)(nil).Destroy))
  207. }
  208. // GetTableMeta mocks base method.
  209. func (m *MockTableMetaCache) GetTableMeta(ctx context.Context, dbName, table string) (*types.TableMeta, error) {
  210. m.ctrl.T.Helper()
  211. ret := m.ctrl.Call(m, "GetTableMeta", ctx, dbName, table)
  212. ret0, _ := ret[0].(*types.TableMeta)
  213. ret1, _ := ret[1].(error)
  214. return ret0, ret1
  215. }
  216. // GetTableMeta indicates an expected call of GetTableMeta.
  217. func (mr *MockTableMetaCacheMockRecorder) GetTableMeta(ctx, dbName, table interface{}) *gomock.Call {
  218. mr.mock.ctrl.T.Helper()
  219. return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTableMeta", reflect.TypeOf((*MockTableMetaCache)(nil).GetTableMeta), ctx, dbName, table)
  220. }
  221. // Init mocks base method.
  222. func (m *MockTableMetaCache) Init(ctx context.Context, conn *sql.DB) error {
  223. m.ctrl.T.Helper()
  224. ret := m.ctrl.Call(m, "Init", ctx, conn)
  225. ret0, _ := ret[0].(error)
  226. return ret0
  227. }
  228. // Init indicates an expected call of Init.
  229. func (mr *MockTableMetaCacheMockRecorder) Init(ctx, conn interface{}) *gomock.Call {
  230. mr.mock.ctrl.T.Helper()
  231. return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Init", reflect.TypeOf((*MockTableMetaCache)(nil).Init), ctx, conn)
  232. }