github.com/olli-ai/jx/v2@v2.0.400-0.20210921045218-14731b4dd448/pkg/jxfactory/mocks/factory.go (about) 1 // Code generated by pegomock. DO NOT EDIT. 2 // Source: github.com/olli-ai/jx/v2/pkg/jxfactory (interfaces: Factory) 3 4 package jxfactory_test 5 6 import ( 7 "reflect" 8 "time" 9 10 versioned "github.com/jenkins-x/jx-api/pkg/client/clientset/versioned" 11 jxfactory "github.com/olli-ai/jx/v2/pkg/jxfactory" 12 kube "github.com/olli-ai/jx/v2/pkg/kube" 13 pegomock "github.com/petergtz/pegomock" 14 versioned0 "github.com/tektoncd/pipeline/pkg/client/clientset/versioned" 15 versioned1 "github.com/tektoncd/pipeline/pkg/client/resource/clientset/versioned" 16 kubernetes "k8s.io/client-go/kubernetes" 17 rest "k8s.io/client-go/rest" 18 ) 19 20 type MockFactory struct { 21 fail func(message string, callerSkip ...int) 22 } 23 24 func NewMockFactory(options ...pegomock.Option) *MockFactory { 25 mock := &MockFactory{} 26 for _, option := range options { 27 option.Apply(mock) 28 } 29 return mock 30 } 31 32 func (mock *MockFactory) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } 33 func (mock *MockFactory) FailHandler() pegomock.FailHandler { return mock.fail } 34 35 func (mock *MockFactory) CreateJXClient() (versioned.Interface, string, error) { 36 if mock == nil { 37 panic("mock must not be nil. Use myMock := NewMockFactory().") 38 } 39 params := []pegomock.Param{} 40 result := pegomock.GetGenericMockFrom(mock).Invoke("CreateJXClient", params, []reflect.Type{reflect.TypeOf((*versioned.Interface)(nil)).Elem(), reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) 41 var ret0 versioned.Interface 42 var ret1 string 43 var ret2 error 44 if len(result) != 0 { 45 if result[0] != nil { 46 ret0 = result[0].(versioned.Interface) 47 } 48 if result[1] != nil { 49 ret1 = result[1].(string) 50 } 51 if result[2] != nil { 52 ret2 = result[2].(error) 53 } 54 } 55 return ret0, ret1, ret2 56 } 57 58 func (mock *MockFactory) CreateKubeClient() (kubernetes.Interface, string, error) { 59 if mock == nil { 60 panic("mock must not be nil. Use myMock := NewMockFactory().") 61 } 62 params := []pegomock.Param{} 63 result := pegomock.GetGenericMockFrom(mock).Invoke("CreateKubeClient", params, []reflect.Type{reflect.TypeOf((*kubernetes.Interface)(nil)).Elem(), reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) 64 var ret0 kubernetes.Interface 65 var ret1 string 66 var ret2 error 67 if len(result) != 0 { 68 if result[0] != nil { 69 ret0 = result[0].(kubernetes.Interface) 70 } 71 if result[1] != nil { 72 ret1 = result[1].(string) 73 } 74 if result[2] != nil { 75 ret2 = result[2].(error) 76 } 77 } 78 return ret0, ret1, ret2 79 } 80 81 func (mock *MockFactory) CreateKubeConfig() (*rest.Config, error) { 82 if mock == nil { 83 panic("mock must not be nil. Use myMock := NewMockFactory().") 84 } 85 params := []pegomock.Param{} 86 result := pegomock.GetGenericMockFrom(mock).Invoke("CreateKubeConfig", params, []reflect.Type{reflect.TypeOf((**rest.Config)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) 87 var ret0 *rest.Config 88 var ret1 error 89 if len(result) != 0 { 90 if result[0] != nil { 91 ret0 = result[0].(*rest.Config) 92 } 93 if result[1] != nil { 94 ret1 = result[1].(error) 95 } 96 } 97 return ret0, ret1 98 } 99 100 func (mock *MockFactory) CreateTektonClient() (versioned0.Interface, string, error) { 101 if mock == nil { 102 panic("mock must not be nil. Use myMock := NewMockFactory().") 103 } 104 params := []pegomock.Param{} 105 result := pegomock.GetGenericMockFrom(mock).Invoke("CreateTektonClient", params, []reflect.Type{reflect.TypeOf((*versioned0.Interface)(nil)).Elem(), reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) 106 var ret0 versioned0.Interface 107 var ret1 string 108 var ret2 error 109 if len(result) != 0 { 110 if result[0] != nil { 111 ret0 = result[0].(versioned0.Interface) 112 } 113 if result[1] != nil { 114 ret1 = result[1].(string) 115 } 116 if result[2] != nil { 117 ret2 = result[2].(error) 118 } 119 } 120 return ret0, ret1, ret2 121 } 122 123 func (mock *MockFactory) CreateTektonPipelineResourceClient() (versioned1.Interface, string, error) { 124 if mock == nil { 125 panic("mock must not be nil. Use myMock := NewMockFactory().") 126 } 127 params := []pegomock.Param{} 128 result := pegomock.GetGenericMockFrom(mock).Invoke("CreateTektonPipelineResourceClient", params, []reflect.Type{reflect.TypeOf((*versioned1.Interface)(nil)).Elem(), reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) 129 var ret0 versioned1.Interface 130 var ret1 string 131 var ret2 error 132 if len(result) != 0 { 133 if result[0] != nil { 134 ret0 = result[0].(versioned1.Interface) 135 } 136 if result[1] != nil { 137 ret1 = result[1].(string) 138 } 139 if result[2] != nil { 140 ret2 = result[2].(error) 141 } 142 } 143 return ret0, ret1, ret2 144 } 145 146 func (mock *MockFactory) ImpersonateUser(_param0 string) jxfactory.Factory { 147 if mock == nil { 148 panic("mock must not be nil. Use myMock := NewMockFactory().") 149 } 150 params := []pegomock.Param{_param0} 151 result := pegomock.GetGenericMockFrom(mock).Invoke("ImpersonateUser", params, []reflect.Type{reflect.TypeOf((*jxfactory.Factory)(nil)).Elem()}) 152 var ret0 jxfactory.Factory 153 if len(result) != 0 { 154 if result[0] != nil { 155 ret0 = result[0].(jxfactory.Factory) 156 } 157 } 158 return ret0 159 } 160 161 func (mock *MockFactory) KubeConfig() kube.Kuber { 162 if mock == nil { 163 panic("mock must not be nil. Use myMock := NewMockFactory().") 164 } 165 params := []pegomock.Param{} 166 result := pegomock.GetGenericMockFrom(mock).Invoke("KubeConfig", params, []reflect.Type{reflect.TypeOf((*kube.Kuber)(nil)).Elem()}) 167 var ret0 kube.Kuber 168 if len(result) != 0 { 169 if result[0] != nil { 170 ret0 = result[0].(kube.Kuber) 171 } 172 } 173 return ret0 174 } 175 176 func (mock *MockFactory) WithBearerToken(_param0 string) jxfactory.Factory { 177 if mock == nil { 178 panic("mock must not be nil. Use myMock := NewMockFactory().") 179 } 180 params := []pegomock.Param{_param0} 181 result := pegomock.GetGenericMockFrom(mock).Invoke("WithBearerToken", params, []reflect.Type{reflect.TypeOf((*jxfactory.Factory)(nil)).Elem()}) 182 var ret0 jxfactory.Factory 183 if len(result) != 0 { 184 if result[0] != nil { 185 ret0 = result[0].(jxfactory.Factory) 186 } 187 } 188 return ret0 189 } 190 191 func (mock *MockFactory) VerifyWasCalledOnce() *VerifierMockFactory { 192 return &VerifierMockFactory{ 193 mock: mock, 194 invocationCountMatcher: pegomock.Times(1), 195 } 196 } 197 198 func (mock *MockFactory) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockFactory { 199 return &VerifierMockFactory{ 200 mock: mock, 201 invocationCountMatcher: invocationCountMatcher, 202 } 203 } 204 205 func (mock *MockFactory) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockFactory { 206 return &VerifierMockFactory{ 207 mock: mock, 208 invocationCountMatcher: invocationCountMatcher, 209 inOrderContext: inOrderContext, 210 } 211 } 212 213 func (mock *MockFactory) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockFactory { 214 return &VerifierMockFactory{ 215 mock: mock, 216 invocationCountMatcher: invocationCountMatcher, 217 timeout: timeout, 218 } 219 } 220 221 type VerifierMockFactory struct { 222 mock *MockFactory 223 invocationCountMatcher pegomock.Matcher 224 inOrderContext *pegomock.InOrderContext 225 timeout time.Duration 226 } 227 228 func (verifier *VerifierMockFactory) CreateJXClient() *MockFactory_CreateJXClient_OngoingVerification { 229 params := []pegomock.Param{} 230 methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CreateJXClient", params, verifier.timeout) 231 return &MockFactory_CreateJXClient_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} 232 } 233 234 type MockFactory_CreateJXClient_OngoingVerification struct { 235 mock *MockFactory 236 methodInvocations []pegomock.MethodInvocation 237 } 238 239 func (c *MockFactory_CreateJXClient_OngoingVerification) GetCapturedArguments() { 240 } 241 242 func (c *MockFactory_CreateJXClient_OngoingVerification) GetAllCapturedArguments() { 243 } 244 245 func (verifier *VerifierMockFactory) CreateKubeClient() *MockFactory_CreateKubeClient_OngoingVerification { 246 params := []pegomock.Param{} 247 methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CreateKubeClient", params, verifier.timeout) 248 return &MockFactory_CreateKubeClient_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} 249 } 250 251 type MockFactory_CreateKubeClient_OngoingVerification struct { 252 mock *MockFactory 253 methodInvocations []pegomock.MethodInvocation 254 } 255 256 func (c *MockFactory_CreateKubeClient_OngoingVerification) GetCapturedArguments() { 257 } 258 259 func (c *MockFactory_CreateKubeClient_OngoingVerification) GetAllCapturedArguments() { 260 } 261 262 func (verifier *VerifierMockFactory) CreateKubeConfig() *MockFactory_CreateKubeConfig_OngoingVerification { 263 params := []pegomock.Param{} 264 methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CreateKubeConfig", params, verifier.timeout) 265 return &MockFactory_CreateKubeConfig_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} 266 } 267 268 type MockFactory_CreateKubeConfig_OngoingVerification struct { 269 mock *MockFactory 270 methodInvocations []pegomock.MethodInvocation 271 } 272 273 func (c *MockFactory_CreateKubeConfig_OngoingVerification) GetCapturedArguments() { 274 } 275 276 func (c *MockFactory_CreateKubeConfig_OngoingVerification) GetAllCapturedArguments() { 277 } 278 279 func (verifier *VerifierMockFactory) CreateTektonClient() *MockFactory_CreateTektonClient_OngoingVerification { 280 params := []pegomock.Param{} 281 methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CreateTektonClient", params, verifier.timeout) 282 return &MockFactory_CreateTektonClient_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} 283 } 284 285 type MockFactory_CreateTektonClient_OngoingVerification struct { 286 mock *MockFactory 287 methodInvocations []pegomock.MethodInvocation 288 } 289 290 func (c *MockFactory_CreateTektonClient_OngoingVerification) GetCapturedArguments() { 291 } 292 293 func (c *MockFactory_CreateTektonClient_OngoingVerification) GetAllCapturedArguments() { 294 } 295 296 func (verifier *VerifierMockFactory) CreateTektonPipelineResourceClient() *MockFactory_CreateTektonPipelineResourceClient_OngoingVerification { 297 params := []pegomock.Param{} 298 methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CreateTektonPipelineResourceClient", params, verifier.timeout) 299 return &MockFactory_CreateTektonPipelineResourceClient_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} 300 } 301 302 type MockFactory_CreateTektonPipelineResourceClient_OngoingVerification struct { 303 mock *MockFactory 304 methodInvocations []pegomock.MethodInvocation 305 } 306 307 func (c *MockFactory_CreateTektonPipelineResourceClient_OngoingVerification) GetCapturedArguments() { 308 } 309 310 func (c *MockFactory_CreateTektonPipelineResourceClient_OngoingVerification) GetAllCapturedArguments() { 311 } 312 313 func (verifier *VerifierMockFactory) ImpersonateUser(_param0 string) *MockFactory_ImpersonateUser_OngoingVerification { 314 params := []pegomock.Param{_param0} 315 methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ImpersonateUser", params, verifier.timeout) 316 return &MockFactory_ImpersonateUser_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} 317 } 318 319 type MockFactory_ImpersonateUser_OngoingVerification struct { 320 mock *MockFactory 321 methodInvocations []pegomock.MethodInvocation 322 } 323 324 func (c *MockFactory_ImpersonateUser_OngoingVerification) GetCapturedArguments() string { 325 _param0 := c.GetAllCapturedArguments() 326 return _param0[len(_param0)-1] 327 } 328 329 func (c *MockFactory_ImpersonateUser_OngoingVerification) GetAllCapturedArguments() (_param0 []string) { 330 params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations) 331 if len(params) > 0 { 332 _param0 = make([]string, len(c.methodInvocations)) 333 for u, param := range params[0] { 334 _param0[u] = param.(string) 335 } 336 } 337 return 338 } 339 340 func (verifier *VerifierMockFactory) KubeConfig() *MockFactory_KubeConfig_OngoingVerification { 341 params := []pegomock.Param{} 342 methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "KubeConfig", params, verifier.timeout) 343 return &MockFactory_KubeConfig_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} 344 } 345 346 type MockFactory_KubeConfig_OngoingVerification struct { 347 mock *MockFactory 348 methodInvocations []pegomock.MethodInvocation 349 } 350 351 func (c *MockFactory_KubeConfig_OngoingVerification) GetCapturedArguments() { 352 } 353 354 func (c *MockFactory_KubeConfig_OngoingVerification) GetAllCapturedArguments() { 355 } 356 357 func (verifier *VerifierMockFactory) WithBearerToken(_param0 string) *MockFactory_WithBearerToken_OngoingVerification { 358 params := []pegomock.Param{_param0} 359 methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "WithBearerToken", params, verifier.timeout) 360 return &MockFactory_WithBearerToken_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} 361 } 362 363 type MockFactory_WithBearerToken_OngoingVerification struct { 364 mock *MockFactory 365 methodInvocations []pegomock.MethodInvocation 366 } 367 368 func (c *MockFactory_WithBearerToken_OngoingVerification) GetCapturedArguments() string { 369 _param0 := c.GetAllCapturedArguments() 370 return _param0[len(_param0)-1] 371 } 372 373 func (c *MockFactory_WithBearerToken_OngoingVerification) GetAllCapturedArguments() (_param0 []string) { 374 params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations) 375 if len(params) > 0 { 376 _param0 = make([]string, len(c.methodInvocations)) 377 for u, param := range params[0] { 378 _param0[u] = param.(string) 379 } 380 } 381 return 382 }