qor_job.go 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. // Code generated by moq; DO NOT EDIT.
  2. // github.com/matryer/moq
  3. package mock
  4. import (
  5. "github.com/qor5/admin/worker"
  6. "sync"
  7. )
  8. // Ensure, that QorJobInterfaceMock does implement worker.QorJobInterface.
  9. // If this is not the case, regenerate this file with moq.
  10. var _ worker.QorJobInterface = &QorJobInterfaceMock{}
  11. // QorJobInterfaceMock is a mock implementation of worker.QorJobInterface.
  12. //
  13. // func TestSomethingThatUsesQorJobInterface(t *testing.T) {
  14. //
  15. // // make and configure a mocked worker.QorJobInterface
  16. // mockedQorJobInterface := &QorJobInterfaceMock{
  17. // AddLogFunc: func(s string) error {
  18. // panic("mock out the AddLog method")
  19. // },
  20. // AddLogfFunc: func(format string, a ...interface{}) error {
  21. // panic("mock out the AddLogf method")
  22. // },
  23. // GetJobInfoFunc: func() (*worker.JobInfo, error) {
  24. // panic("mock out the GetJobInfo method")
  25. // },
  26. // SetProgressFunc: func(v uint) error {
  27. // panic("mock out the SetProgress method")
  28. // },
  29. // SetProgressTextFunc: func(s string) error {
  30. // panic("mock out the SetProgressText method")
  31. // },
  32. // }
  33. //
  34. // // use mockedQorJobInterface in code that requires worker.QorJobInterface
  35. // // and then make assertions.
  36. //
  37. // }
  38. type QorJobInterfaceMock struct {
  39. // AddLogFunc mocks the AddLog method.
  40. AddLogFunc func(s string) error
  41. // AddLogfFunc mocks the AddLogf method.
  42. AddLogfFunc func(format string, a ...interface{}) error
  43. // GetJobInfoFunc mocks the GetJobInfo method.
  44. GetJobInfoFunc func() (*worker.JobInfo, error)
  45. // SetProgressFunc mocks the SetProgress method.
  46. SetProgressFunc func(v uint) error
  47. // SetProgressTextFunc mocks the SetProgressText method.
  48. SetProgressTextFunc func(s string) error
  49. // calls tracks calls to the methods.
  50. calls struct {
  51. // AddLog holds details about calls to the AddLog method.
  52. AddLog []struct {
  53. // S is the s argument value.
  54. S string
  55. }
  56. // AddLogf holds details about calls to the AddLogf method.
  57. AddLogf []struct {
  58. // Format is the format argument value.
  59. Format string
  60. // A is the a argument value.
  61. A []interface{}
  62. }
  63. // GetJobInfo holds details about calls to the GetJobInfo method.
  64. GetJobInfo []struct {
  65. }
  66. // SetProgress holds details about calls to the SetProgress method.
  67. SetProgress []struct {
  68. // V is the v argument value.
  69. V uint
  70. }
  71. // SetProgressText holds details about calls to the SetProgressText method.
  72. SetProgressText []struct {
  73. // S is the s argument value.
  74. S string
  75. }
  76. }
  77. lockAddLog sync.RWMutex
  78. lockAddLogf sync.RWMutex
  79. lockGetJobInfo sync.RWMutex
  80. lockSetProgress sync.RWMutex
  81. lockSetProgressText sync.RWMutex
  82. }
  83. // AddLog calls AddLogFunc.
  84. func (mock *QorJobInterfaceMock) AddLog(s string) error {
  85. if mock.AddLogFunc == nil {
  86. panic("QorJobInterfaceMock.AddLogFunc: method is nil but QorJobInterface.AddLog was just called")
  87. }
  88. callInfo := struct {
  89. S string
  90. }{
  91. S: s,
  92. }
  93. mock.lockAddLog.Lock()
  94. mock.calls.AddLog = append(mock.calls.AddLog, callInfo)
  95. mock.lockAddLog.Unlock()
  96. return mock.AddLogFunc(s)
  97. }
  98. // AddLogCalls gets all the calls that were made to AddLog.
  99. // Check the length with:
  100. //
  101. // len(mockedQorJobInterface.AddLogCalls())
  102. func (mock *QorJobInterfaceMock) AddLogCalls() []struct {
  103. S string
  104. } {
  105. var calls []struct {
  106. S string
  107. }
  108. mock.lockAddLog.RLock()
  109. calls = mock.calls.AddLog
  110. mock.lockAddLog.RUnlock()
  111. return calls
  112. }
  113. // AddLogf calls AddLogfFunc.
  114. func (mock *QorJobInterfaceMock) AddLogf(format string, a ...interface{}) error {
  115. if mock.AddLogfFunc == nil {
  116. panic("QorJobInterfaceMock.AddLogfFunc: method is nil but QorJobInterface.AddLogf was just called")
  117. }
  118. callInfo := struct {
  119. Format string
  120. A []interface{}
  121. }{
  122. Format: format,
  123. A: a,
  124. }
  125. mock.lockAddLogf.Lock()
  126. mock.calls.AddLogf = append(mock.calls.AddLogf, callInfo)
  127. mock.lockAddLogf.Unlock()
  128. return mock.AddLogfFunc(format, a...)
  129. }
  130. // AddLogfCalls gets all the calls that were made to AddLogf.
  131. // Check the length with:
  132. //
  133. // len(mockedQorJobInterface.AddLogfCalls())
  134. func (mock *QorJobInterfaceMock) AddLogfCalls() []struct {
  135. Format string
  136. A []interface{}
  137. } {
  138. var calls []struct {
  139. Format string
  140. A []interface{}
  141. }
  142. mock.lockAddLogf.RLock()
  143. calls = mock.calls.AddLogf
  144. mock.lockAddLogf.RUnlock()
  145. return calls
  146. }
  147. // GetJobInfo calls GetJobInfoFunc.
  148. func (mock *QorJobInterfaceMock) GetJobInfo() (*worker.JobInfo, error) {
  149. if mock.GetJobInfoFunc == nil {
  150. panic("QorJobInterfaceMock.GetJobInfoFunc: method is nil but QorJobInterface.GetJobInfo was just called")
  151. }
  152. callInfo := struct {
  153. }{}
  154. mock.lockGetJobInfo.Lock()
  155. mock.calls.GetJobInfo = append(mock.calls.GetJobInfo, callInfo)
  156. mock.lockGetJobInfo.Unlock()
  157. return mock.GetJobInfoFunc()
  158. }
  159. // GetJobInfoCalls gets all the calls that were made to GetJobInfo.
  160. // Check the length with:
  161. //
  162. // len(mockedQorJobInterface.GetJobInfoCalls())
  163. func (mock *QorJobInterfaceMock) GetJobInfoCalls() []struct {
  164. } {
  165. var calls []struct {
  166. }
  167. mock.lockGetJobInfo.RLock()
  168. calls = mock.calls.GetJobInfo
  169. mock.lockGetJobInfo.RUnlock()
  170. return calls
  171. }
  172. // SetProgress calls SetProgressFunc.
  173. func (mock *QorJobInterfaceMock) SetProgress(v uint) error {
  174. if mock.SetProgressFunc == nil {
  175. panic("QorJobInterfaceMock.SetProgressFunc: method is nil but QorJobInterface.SetProgress was just called")
  176. }
  177. callInfo := struct {
  178. V uint
  179. }{
  180. V: v,
  181. }
  182. mock.lockSetProgress.Lock()
  183. mock.calls.SetProgress = append(mock.calls.SetProgress, callInfo)
  184. mock.lockSetProgress.Unlock()
  185. return mock.SetProgressFunc(v)
  186. }
  187. // SetProgressCalls gets all the calls that were made to SetProgress.
  188. // Check the length with:
  189. //
  190. // len(mockedQorJobInterface.SetProgressCalls())
  191. func (mock *QorJobInterfaceMock) SetProgressCalls() []struct {
  192. V uint
  193. } {
  194. var calls []struct {
  195. V uint
  196. }
  197. mock.lockSetProgress.RLock()
  198. calls = mock.calls.SetProgress
  199. mock.lockSetProgress.RUnlock()
  200. return calls
  201. }
  202. // SetProgressText calls SetProgressTextFunc.
  203. func (mock *QorJobInterfaceMock) SetProgressText(s string) error {
  204. if mock.SetProgressTextFunc == nil {
  205. panic("QorJobInterfaceMock.SetProgressTextFunc: method is nil but QorJobInterface.SetProgressText was just called")
  206. }
  207. callInfo := struct {
  208. S string
  209. }{
  210. S: s,
  211. }
  212. mock.lockSetProgressText.Lock()
  213. mock.calls.SetProgressText = append(mock.calls.SetProgressText, callInfo)
  214. mock.lockSetProgressText.Unlock()
  215. return mock.SetProgressTextFunc(s)
  216. }
  217. // SetProgressTextCalls gets all the calls that were made to SetProgressText.
  218. // Check the length with:
  219. //
  220. // len(mockedQorJobInterface.SetProgressTextCalls())
  221. func (mock *QorJobInterfaceMock) SetProgressTextCalls() []struct {
  222. S string
  223. } {
  224. var calls []struct {
  225. S string
  226. }
  227. mock.lockSetProgressText.RLock()
  228. calls = mock.calls.SetProgressText
  229. mock.lockSetProgressText.RUnlock()
  230. return calls
  231. }