github.com/IBM-Blockchain/fabric-operator@v1.0.4/controllers/ibpca/mocks/careconcile.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package mocks 3 4 import ( 5 "sync" 6 7 "github.com/IBM-Blockchain/fabric-operator/api/v1beta1" 8 baseca "github.com/IBM-Blockchain/fabric-operator/pkg/offering/base/ca" 9 "github.com/IBM-Blockchain/fabric-operator/pkg/offering/common" 10 ) 11 12 type CAReconcile struct { 13 ReconcileStub func(*v1beta1.IBPCA, baseca.Update) (common.Result, error) 14 reconcileMutex sync.RWMutex 15 reconcileArgsForCall []struct { 16 arg1 *v1beta1.IBPCA 17 arg2 baseca.Update 18 } 19 reconcileReturns struct { 20 result1 common.Result 21 result2 error 22 } 23 reconcileReturnsOnCall map[int]struct { 24 result1 common.Result 25 result2 error 26 } 27 invocations map[string][][]interface{} 28 invocationsMutex sync.RWMutex 29 } 30 31 func (fake *CAReconcile) Reconcile(arg1 *v1beta1.IBPCA, arg2 baseca.Update) (common.Result, error) { 32 fake.reconcileMutex.Lock() 33 ret, specificReturn := fake.reconcileReturnsOnCall[len(fake.reconcileArgsForCall)] 34 fake.reconcileArgsForCall = append(fake.reconcileArgsForCall, struct { 35 arg1 *v1beta1.IBPCA 36 arg2 baseca.Update 37 }{arg1, arg2}) 38 stub := fake.ReconcileStub 39 fakeReturns := fake.reconcileReturns 40 fake.recordInvocation("Reconcile", []interface{}{arg1, arg2}) 41 fake.reconcileMutex.Unlock() 42 if stub != nil { 43 return stub(arg1, arg2) 44 } 45 if specificReturn { 46 return ret.result1, ret.result2 47 } 48 return fakeReturns.result1, fakeReturns.result2 49 } 50 51 func (fake *CAReconcile) ReconcileCallCount() int { 52 fake.reconcileMutex.RLock() 53 defer fake.reconcileMutex.RUnlock() 54 return len(fake.reconcileArgsForCall) 55 } 56 57 func (fake *CAReconcile) ReconcileCalls(stub func(*v1beta1.IBPCA, baseca.Update) (common.Result, error)) { 58 fake.reconcileMutex.Lock() 59 defer fake.reconcileMutex.Unlock() 60 fake.ReconcileStub = stub 61 } 62 63 func (fake *CAReconcile) ReconcileArgsForCall(i int) (*v1beta1.IBPCA, baseca.Update) { 64 fake.reconcileMutex.RLock() 65 defer fake.reconcileMutex.RUnlock() 66 argsForCall := fake.reconcileArgsForCall[i] 67 return argsForCall.arg1, argsForCall.arg2 68 } 69 70 func (fake *CAReconcile) ReconcileReturns(result1 common.Result, result2 error) { 71 fake.reconcileMutex.Lock() 72 defer fake.reconcileMutex.Unlock() 73 fake.ReconcileStub = nil 74 fake.reconcileReturns = struct { 75 result1 common.Result 76 result2 error 77 }{result1, result2} 78 } 79 80 func (fake *CAReconcile) ReconcileReturnsOnCall(i int, result1 common.Result, result2 error) { 81 fake.reconcileMutex.Lock() 82 defer fake.reconcileMutex.Unlock() 83 fake.ReconcileStub = nil 84 if fake.reconcileReturnsOnCall == nil { 85 fake.reconcileReturnsOnCall = make(map[int]struct { 86 result1 common.Result 87 result2 error 88 }) 89 } 90 fake.reconcileReturnsOnCall[i] = struct { 91 result1 common.Result 92 result2 error 93 }{result1, result2} 94 } 95 96 func (fake *CAReconcile) Invocations() map[string][][]interface{} { 97 fake.invocationsMutex.RLock() 98 defer fake.invocationsMutex.RUnlock() 99 fake.reconcileMutex.RLock() 100 defer fake.reconcileMutex.RUnlock() 101 copiedInvocations := map[string][][]interface{}{} 102 for key, value := range fake.invocations { 103 copiedInvocations[key] = value 104 } 105 return copiedInvocations 106 } 107 108 func (fake *CAReconcile) recordInvocation(key string, args []interface{}) { 109 fake.invocationsMutex.Lock() 110 defer fake.invocationsMutex.Unlock() 111 if fake.invocations == nil { 112 fake.invocations = map[string][][]interface{}{} 113 } 114 if fake.invocations[key] == nil { 115 fake.invocations[key] = [][]interface{}{} 116 } 117 fake.invocations[key] = append(fake.invocations[key], args) 118 }