github.com/operator-framework/operator-lifecycle-manager@v0.30.0/pkg/fakes/fake_reconciler_factory.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package fakes 3 4 import ( 5 "sync" 6 7 "github.com/operator-framework/api/pkg/operators/v1alpha1" 8 "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/reconciler" 9 ) 10 11 type FakeRegistryReconcilerFactory struct { 12 ReconcilerForSourceStub func(*v1alpha1.CatalogSource) reconciler.RegistryReconciler 13 reconcilerForSourceMutex sync.RWMutex 14 reconcilerForSourceArgsForCall []struct { 15 arg1 *v1alpha1.CatalogSource 16 } 17 reconcilerForSourceReturns struct { 18 result1 reconciler.RegistryReconciler 19 } 20 reconcilerForSourceReturnsOnCall map[int]struct { 21 result1 reconciler.RegistryReconciler 22 } 23 invocations map[string][][]interface{} 24 invocationsMutex sync.RWMutex 25 } 26 27 func (fake *FakeRegistryReconcilerFactory) ReconcilerForSource(arg1 *v1alpha1.CatalogSource) reconciler.RegistryReconciler { 28 fake.reconcilerForSourceMutex.Lock() 29 ret, specificReturn := fake.reconcilerForSourceReturnsOnCall[len(fake.reconcilerForSourceArgsForCall)] 30 fake.reconcilerForSourceArgsForCall = append(fake.reconcilerForSourceArgsForCall, struct { 31 arg1 *v1alpha1.CatalogSource 32 }{arg1}) 33 stub := fake.ReconcilerForSourceStub 34 fakeReturns := fake.reconcilerForSourceReturns 35 fake.recordInvocation("ReconcilerForSource", []interface{}{arg1}) 36 fake.reconcilerForSourceMutex.Unlock() 37 if stub != nil { 38 return stub(arg1) 39 } 40 if specificReturn { 41 return ret.result1 42 } 43 return fakeReturns.result1 44 } 45 46 func (fake *FakeRegistryReconcilerFactory) ReconcilerForSourceCallCount() int { 47 fake.reconcilerForSourceMutex.RLock() 48 defer fake.reconcilerForSourceMutex.RUnlock() 49 return len(fake.reconcilerForSourceArgsForCall) 50 } 51 52 func (fake *FakeRegistryReconcilerFactory) ReconcilerForSourceCalls(stub func(*v1alpha1.CatalogSource) reconciler.RegistryReconciler) { 53 fake.reconcilerForSourceMutex.Lock() 54 defer fake.reconcilerForSourceMutex.Unlock() 55 fake.ReconcilerForSourceStub = stub 56 } 57 58 func (fake *FakeRegistryReconcilerFactory) ReconcilerForSourceArgsForCall(i int) *v1alpha1.CatalogSource { 59 fake.reconcilerForSourceMutex.RLock() 60 defer fake.reconcilerForSourceMutex.RUnlock() 61 argsForCall := fake.reconcilerForSourceArgsForCall[i] 62 return argsForCall.arg1 63 } 64 65 func (fake *FakeRegistryReconcilerFactory) ReconcilerForSourceReturns(result1 reconciler.RegistryReconciler) { 66 fake.reconcilerForSourceMutex.Lock() 67 defer fake.reconcilerForSourceMutex.Unlock() 68 fake.ReconcilerForSourceStub = nil 69 fake.reconcilerForSourceReturns = struct { 70 result1 reconciler.RegistryReconciler 71 }{result1} 72 } 73 74 func (fake *FakeRegistryReconcilerFactory) ReconcilerForSourceReturnsOnCall(i int, result1 reconciler.RegistryReconciler) { 75 fake.reconcilerForSourceMutex.Lock() 76 defer fake.reconcilerForSourceMutex.Unlock() 77 fake.ReconcilerForSourceStub = nil 78 if fake.reconcilerForSourceReturnsOnCall == nil { 79 fake.reconcilerForSourceReturnsOnCall = make(map[int]struct { 80 result1 reconciler.RegistryReconciler 81 }) 82 } 83 fake.reconcilerForSourceReturnsOnCall[i] = struct { 84 result1 reconciler.RegistryReconciler 85 }{result1} 86 } 87 88 func (fake *FakeRegistryReconcilerFactory) Invocations() map[string][][]interface{} { 89 fake.invocationsMutex.RLock() 90 defer fake.invocationsMutex.RUnlock() 91 fake.reconcilerForSourceMutex.RLock() 92 defer fake.reconcilerForSourceMutex.RUnlock() 93 copiedInvocations := map[string][][]interface{}{} 94 for key, value := range fake.invocations { 95 copiedInvocations[key] = value 96 } 97 return copiedInvocations 98 } 99 100 func (fake *FakeRegistryReconcilerFactory) recordInvocation(key string, args []interface{}) { 101 fake.invocationsMutex.Lock() 102 defer fake.invocationsMutex.Unlock() 103 if fake.invocations == nil { 104 fake.invocations = map[string][][]interface{}{} 105 } 106 if fake.invocations[key] == nil { 107 fake.invocations[key] = [][]interface{}{} 108 } 109 fake.invocations[key] = append(fake.invocations[key], args) 110 } 111 112 var _ reconciler.RegistryReconcilerFactory = new(FakeRegistryReconcilerFactory)