github.com/hyperledger-labs/bdls@v2.1.1+incompatible/core/chaincode/lifecycle/mock/convertible_policy.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package mock 3 4 import ( 5 "sync" 6 7 "github.com/hyperledger/fabric-protos-go/common" 8 "github.com/hyperledger/fabric/msp" 9 "github.com/hyperledger/fabric/protoutil" 10 ) 11 12 type ConvertiblePolicy struct { 13 ConvertStub func() (*common.SignaturePolicyEnvelope, error) 14 convertMutex sync.RWMutex 15 convertArgsForCall []struct { 16 } 17 convertReturns struct { 18 result1 *common.SignaturePolicyEnvelope 19 result2 error 20 } 21 convertReturnsOnCall map[int]struct { 22 result1 *common.SignaturePolicyEnvelope 23 result2 error 24 } 25 EvaluateIdentitiesStub func([]msp.Identity) error 26 evaluateIdentitiesMutex sync.RWMutex 27 evaluateIdentitiesArgsForCall []struct { 28 arg1 []msp.Identity 29 } 30 evaluateIdentitiesReturns struct { 31 result1 error 32 } 33 evaluateIdentitiesReturnsOnCall map[int]struct { 34 result1 error 35 } 36 EvaluateSignedDataStub func([]*protoutil.SignedData) error 37 evaluateSignedDataMutex sync.RWMutex 38 evaluateSignedDataArgsForCall []struct { 39 arg1 []*protoutil.SignedData 40 } 41 evaluateSignedDataReturns struct { 42 result1 error 43 } 44 evaluateSignedDataReturnsOnCall map[int]struct { 45 result1 error 46 } 47 invocations map[string][][]interface{} 48 invocationsMutex sync.RWMutex 49 } 50 51 func (fake *ConvertiblePolicy) Convert() (*common.SignaturePolicyEnvelope, error) { 52 fake.convertMutex.Lock() 53 ret, specificReturn := fake.convertReturnsOnCall[len(fake.convertArgsForCall)] 54 fake.convertArgsForCall = append(fake.convertArgsForCall, struct { 55 }{}) 56 fake.recordInvocation("Convert", []interface{}{}) 57 fake.convertMutex.Unlock() 58 if fake.ConvertStub != nil { 59 return fake.ConvertStub() 60 } 61 if specificReturn { 62 return ret.result1, ret.result2 63 } 64 fakeReturns := fake.convertReturns 65 return fakeReturns.result1, fakeReturns.result2 66 } 67 68 func (fake *ConvertiblePolicy) ConvertCallCount() int { 69 fake.convertMutex.RLock() 70 defer fake.convertMutex.RUnlock() 71 return len(fake.convertArgsForCall) 72 } 73 74 func (fake *ConvertiblePolicy) ConvertCalls(stub func() (*common.SignaturePolicyEnvelope, error)) { 75 fake.convertMutex.Lock() 76 defer fake.convertMutex.Unlock() 77 fake.ConvertStub = stub 78 } 79 80 func (fake *ConvertiblePolicy) ConvertReturns(result1 *common.SignaturePolicyEnvelope, result2 error) { 81 fake.convertMutex.Lock() 82 defer fake.convertMutex.Unlock() 83 fake.ConvertStub = nil 84 fake.convertReturns = struct { 85 result1 *common.SignaturePolicyEnvelope 86 result2 error 87 }{result1, result2} 88 } 89 90 func (fake *ConvertiblePolicy) ConvertReturnsOnCall(i int, result1 *common.SignaturePolicyEnvelope, result2 error) { 91 fake.convertMutex.Lock() 92 defer fake.convertMutex.Unlock() 93 fake.ConvertStub = nil 94 if fake.convertReturnsOnCall == nil { 95 fake.convertReturnsOnCall = make(map[int]struct { 96 result1 *common.SignaturePolicyEnvelope 97 result2 error 98 }) 99 } 100 fake.convertReturnsOnCall[i] = struct { 101 result1 *common.SignaturePolicyEnvelope 102 result2 error 103 }{result1, result2} 104 } 105 106 func (fake *ConvertiblePolicy) EvaluateIdentities(arg1 []msp.Identity) error { 107 var arg1Copy []msp.Identity 108 if arg1 != nil { 109 arg1Copy = make([]msp.Identity, len(arg1)) 110 copy(arg1Copy, arg1) 111 } 112 fake.evaluateIdentitiesMutex.Lock() 113 ret, specificReturn := fake.evaluateIdentitiesReturnsOnCall[len(fake.evaluateIdentitiesArgsForCall)] 114 fake.evaluateIdentitiesArgsForCall = append(fake.evaluateIdentitiesArgsForCall, struct { 115 arg1 []msp.Identity 116 }{arg1Copy}) 117 fake.recordInvocation("EvaluateIdentities", []interface{}{arg1Copy}) 118 fake.evaluateIdentitiesMutex.Unlock() 119 if fake.EvaluateIdentitiesStub != nil { 120 return fake.EvaluateIdentitiesStub(arg1) 121 } 122 if specificReturn { 123 return ret.result1 124 } 125 fakeReturns := fake.evaluateIdentitiesReturns 126 return fakeReturns.result1 127 } 128 129 func (fake *ConvertiblePolicy) EvaluateIdentitiesCallCount() int { 130 fake.evaluateIdentitiesMutex.RLock() 131 defer fake.evaluateIdentitiesMutex.RUnlock() 132 return len(fake.evaluateIdentitiesArgsForCall) 133 } 134 135 func (fake *ConvertiblePolicy) EvaluateIdentitiesCalls(stub func([]msp.Identity) error) { 136 fake.evaluateIdentitiesMutex.Lock() 137 defer fake.evaluateIdentitiesMutex.Unlock() 138 fake.EvaluateIdentitiesStub = stub 139 } 140 141 func (fake *ConvertiblePolicy) EvaluateIdentitiesArgsForCall(i int) []msp.Identity { 142 fake.evaluateIdentitiesMutex.RLock() 143 defer fake.evaluateIdentitiesMutex.RUnlock() 144 argsForCall := fake.evaluateIdentitiesArgsForCall[i] 145 return argsForCall.arg1 146 } 147 148 func (fake *ConvertiblePolicy) EvaluateIdentitiesReturns(result1 error) { 149 fake.evaluateIdentitiesMutex.Lock() 150 defer fake.evaluateIdentitiesMutex.Unlock() 151 fake.EvaluateIdentitiesStub = nil 152 fake.evaluateIdentitiesReturns = struct { 153 result1 error 154 }{result1} 155 } 156 157 func (fake *ConvertiblePolicy) EvaluateIdentitiesReturnsOnCall(i int, result1 error) { 158 fake.evaluateIdentitiesMutex.Lock() 159 defer fake.evaluateIdentitiesMutex.Unlock() 160 fake.EvaluateIdentitiesStub = nil 161 if fake.evaluateIdentitiesReturnsOnCall == nil { 162 fake.evaluateIdentitiesReturnsOnCall = make(map[int]struct { 163 result1 error 164 }) 165 } 166 fake.evaluateIdentitiesReturnsOnCall[i] = struct { 167 result1 error 168 }{result1} 169 } 170 171 func (fake *ConvertiblePolicy) EvaluateSignedData(arg1 []*protoutil.SignedData) error { 172 var arg1Copy []*protoutil.SignedData 173 if arg1 != nil { 174 arg1Copy = make([]*protoutil.SignedData, len(arg1)) 175 copy(arg1Copy, arg1) 176 } 177 fake.evaluateSignedDataMutex.Lock() 178 ret, specificReturn := fake.evaluateSignedDataReturnsOnCall[len(fake.evaluateSignedDataArgsForCall)] 179 fake.evaluateSignedDataArgsForCall = append(fake.evaluateSignedDataArgsForCall, struct { 180 arg1 []*protoutil.SignedData 181 }{arg1Copy}) 182 fake.recordInvocation("EvaluateSignedData", []interface{}{arg1Copy}) 183 fake.evaluateSignedDataMutex.Unlock() 184 if fake.EvaluateSignedDataStub != nil { 185 return fake.EvaluateSignedDataStub(arg1) 186 } 187 if specificReturn { 188 return ret.result1 189 } 190 fakeReturns := fake.evaluateSignedDataReturns 191 return fakeReturns.result1 192 } 193 194 func (fake *ConvertiblePolicy) EvaluateSignedDataCallCount() int { 195 fake.evaluateSignedDataMutex.RLock() 196 defer fake.evaluateSignedDataMutex.RUnlock() 197 return len(fake.evaluateSignedDataArgsForCall) 198 } 199 200 func (fake *ConvertiblePolicy) EvaluateSignedDataCalls(stub func([]*protoutil.SignedData) error) { 201 fake.evaluateSignedDataMutex.Lock() 202 defer fake.evaluateSignedDataMutex.Unlock() 203 fake.EvaluateSignedDataStub = stub 204 } 205 206 func (fake *ConvertiblePolicy) EvaluateSignedDataArgsForCall(i int) []*protoutil.SignedData { 207 fake.evaluateSignedDataMutex.RLock() 208 defer fake.evaluateSignedDataMutex.RUnlock() 209 argsForCall := fake.evaluateSignedDataArgsForCall[i] 210 return argsForCall.arg1 211 } 212 213 func (fake *ConvertiblePolicy) EvaluateSignedDataReturns(result1 error) { 214 fake.evaluateSignedDataMutex.Lock() 215 defer fake.evaluateSignedDataMutex.Unlock() 216 fake.EvaluateSignedDataStub = nil 217 fake.evaluateSignedDataReturns = struct { 218 result1 error 219 }{result1} 220 } 221 222 func (fake *ConvertiblePolicy) EvaluateSignedDataReturnsOnCall(i int, result1 error) { 223 fake.evaluateSignedDataMutex.Lock() 224 defer fake.evaluateSignedDataMutex.Unlock() 225 fake.EvaluateSignedDataStub = nil 226 if fake.evaluateSignedDataReturnsOnCall == nil { 227 fake.evaluateSignedDataReturnsOnCall = make(map[int]struct { 228 result1 error 229 }) 230 } 231 fake.evaluateSignedDataReturnsOnCall[i] = struct { 232 result1 error 233 }{result1} 234 } 235 236 func (fake *ConvertiblePolicy) Invocations() map[string][][]interface{} { 237 fake.invocationsMutex.RLock() 238 defer fake.invocationsMutex.RUnlock() 239 fake.convertMutex.RLock() 240 defer fake.convertMutex.RUnlock() 241 fake.evaluateIdentitiesMutex.RLock() 242 defer fake.evaluateIdentitiesMutex.RUnlock() 243 fake.evaluateSignedDataMutex.RLock() 244 defer fake.evaluateSignedDataMutex.RUnlock() 245 copiedInvocations := map[string][][]interface{}{} 246 for key, value := range fake.invocations { 247 copiedInvocations[key] = value 248 } 249 return copiedInvocations 250 } 251 252 func (fake *ConvertiblePolicy) recordInvocation(key string, args []interface{}) { 253 fake.invocationsMutex.Lock() 254 defer fake.invocationsMutex.Unlock() 255 if fake.invocations == nil { 256 fake.invocations = map[string][][]interface{}{} 257 } 258 if fake.invocations[key] == nil { 259 fake.invocations[key] = [][]interface{}{} 260 } 261 fake.invocations[key] = append(fake.invocations[key], args) 262 }