github.com/hyperledger-labs/bdls@v2.1.1+incompatible/core/chaincode/lifecycle/mock/msp_manager.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package mock 3 4 import ( 5 "sync" 6 7 mspa "github.com/hyperledger/fabric-protos-go/msp" 8 "github.com/hyperledger/fabric/msp" 9 ) 10 11 type MSPManager struct { 12 DeserializeIdentityStub func([]byte) (msp.Identity, error) 13 deserializeIdentityMutex sync.RWMutex 14 deserializeIdentityArgsForCall []struct { 15 arg1 []byte 16 } 17 deserializeIdentityReturns struct { 18 result1 msp.Identity 19 result2 error 20 } 21 deserializeIdentityReturnsOnCall map[int]struct { 22 result1 msp.Identity 23 result2 error 24 } 25 GetMSPsStub func() (map[string]msp.MSP, error) 26 getMSPsMutex sync.RWMutex 27 getMSPsArgsForCall []struct { 28 } 29 getMSPsReturns struct { 30 result1 map[string]msp.MSP 31 result2 error 32 } 33 getMSPsReturnsOnCall map[int]struct { 34 result1 map[string]msp.MSP 35 result2 error 36 } 37 IsWellFormedStub func(*mspa.SerializedIdentity) error 38 isWellFormedMutex sync.RWMutex 39 isWellFormedArgsForCall []struct { 40 arg1 *mspa.SerializedIdentity 41 } 42 isWellFormedReturns struct { 43 result1 error 44 } 45 isWellFormedReturnsOnCall map[int]struct { 46 result1 error 47 } 48 SetupStub func([]msp.MSP) error 49 setupMutex sync.RWMutex 50 setupArgsForCall []struct { 51 arg1 []msp.MSP 52 } 53 setupReturns struct { 54 result1 error 55 } 56 setupReturnsOnCall map[int]struct { 57 result1 error 58 } 59 invocations map[string][][]interface{} 60 invocationsMutex sync.RWMutex 61 } 62 63 func (fake *MSPManager) DeserializeIdentity(arg1 []byte) (msp.Identity, error) { 64 var arg1Copy []byte 65 if arg1 != nil { 66 arg1Copy = make([]byte, len(arg1)) 67 copy(arg1Copy, arg1) 68 } 69 fake.deserializeIdentityMutex.Lock() 70 ret, specificReturn := fake.deserializeIdentityReturnsOnCall[len(fake.deserializeIdentityArgsForCall)] 71 fake.deserializeIdentityArgsForCall = append(fake.deserializeIdentityArgsForCall, struct { 72 arg1 []byte 73 }{arg1Copy}) 74 fake.recordInvocation("DeserializeIdentity", []interface{}{arg1Copy}) 75 fake.deserializeIdentityMutex.Unlock() 76 if fake.DeserializeIdentityStub != nil { 77 return fake.DeserializeIdentityStub(arg1) 78 } 79 if specificReturn { 80 return ret.result1, ret.result2 81 } 82 fakeReturns := fake.deserializeIdentityReturns 83 return fakeReturns.result1, fakeReturns.result2 84 } 85 86 func (fake *MSPManager) DeserializeIdentityCallCount() int { 87 fake.deserializeIdentityMutex.RLock() 88 defer fake.deserializeIdentityMutex.RUnlock() 89 return len(fake.deserializeIdentityArgsForCall) 90 } 91 92 func (fake *MSPManager) DeserializeIdentityCalls(stub func([]byte) (msp.Identity, error)) { 93 fake.deserializeIdentityMutex.Lock() 94 defer fake.deserializeIdentityMutex.Unlock() 95 fake.DeserializeIdentityStub = stub 96 } 97 98 func (fake *MSPManager) DeserializeIdentityArgsForCall(i int) []byte { 99 fake.deserializeIdentityMutex.RLock() 100 defer fake.deserializeIdentityMutex.RUnlock() 101 argsForCall := fake.deserializeIdentityArgsForCall[i] 102 return argsForCall.arg1 103 } 104 105 func (fake *MSPManager) DeserializeIdentityReturns(result1 msp.Identity, result2 error) { 106 fake.deserializeIdentityMutex.Lock() 107 defer fake.deserializeIdentityMutex.Unlock() 108 fake.DeserializeIdentityStub = nil 109 fake.deserializeIdentityReturns = struct { 110 result1 msp.Identity 111 result2 error 112 }{result1, result2} 113 } 114 115 func (fake *MSPManager) DeserializeIdentityReturnsOnCall(i int, result1 msp.Identity, result2 error) { 116 fake.deserializeIdentityMutex.Lock() 117 defer fake.deserializeIdentityMutex.Unlock() 118 fake.DeserializeIdentityStub = nil 119 if fake.deserializeIdentityReturnsOnCall == nil { 120 fake.deserializeIdentityReturnsOnCall = make(map[int]struct { 121 result1 msp.Identity 122 result2 error 123 }) 124 } 125 fake.deserializeIdentityReturnsOnCall[i] = struct { 126 result1 msp.Identity 127 result2 error 128 }{result1, result2} 129 } 130 131 func (fake *MSPManager) GetMSPs() (map[string]msp.MSP, error) { 132 fake.getMSPsMutex.Lock() 133 ret, specificReturn := fake.getMSPsReturnsOnCall[len(fake.getMSPsArgsForCall)] 134 fake.getMSPsArgsForCall = append(fake.getMSPsArgsForCall, struct { 135 }{}) 136 fake.recordInvocation("GetMSPs", []interface{}{}) 137 fake.getMSPsMutex.Unlock() 138 if fake.GetMSPsStub != nil { 139 return fake.GetMSPsStub() 140 } 141 if specificReturn { 142 return ret.result1, ret.result2 143 } 144 fakeReturns := fake.getMSPsReturns 145 return fakeReturns.result1, fakeReturns.result2 146 } 147 148 func (fake *MSPManager) GetMSPsCallCount() int { 149 fake.getMSPsMutex.RLock() 150 defer fake.getMSPsMutex.RUnlock() 151 return len(fake.getMSPsArgsForCall) 152 } 153 154 func (fake *MSPManager) GetMSPsCalls(stub func() (map[string]msp.MSP, error)) { 155 fake.getMSPsMutex.Lock() 156 defer fake.getMSPsMutex.Unlock() 157 fake.GetMSPsStub = stub 158 } 159 160 func (fake *MSPManager) GetMSPsReturns(result1 map[string]msp.MSP, result2 error) { 161 fake.getMSPsMutex.Lock() 162 defer fake.getMSPsMutex.Unlock() 163 fake.GetMSPsStub = nil 164 fake.getMSPsReturns = struct { 165 result1 map[string]msp.MSP 166 result2 error 167 }{result1, result2} 168 } 169 170 func (fake *MSPManager) GetMSPsReturnsOnCall(i int, result1 map[string]msp.MSP, result2 error) { 171 fake.getMSPsMutex.Lock() 172 defer fake.getMSPsMutex.Unlock() 173 fake.GetMSPsStub = nil 174 if fake.getMSPsReturnsOnCall == nil { 175 fake.getMSPsReturnsOnCall = make(map[int]struct { 176 result1 map[string]msp.MSP 177 result2 error 178 }) 179 } 180 fake.getMSPsReturnsOnCall[i] = struct { 181 result1 map[string]msp.MSP 182 result2 error 183 }{result1, result2} 184 } 185 186 func (fake *MSPManager) IsWellFormed(arg1 *mspa.SerializedIdentity) error { 187 fake.isWellFormedMutex.Lock() 188 ret, specificReturn := fake.isWellFormedReturnsOnCall[len(fake.isWellFormedArgsForCall)] 189 fake.isWellFormedArgsForCall = append(fake.isWellFormedArgsForCall, struct { 190 arg1 *mspa.SerializedIdentity 191 }{arg1}) 192 fake.recordInvocation("IsWellFormed", []interface{}{arg1}) 193 fake.isWellFormedMutex.Unlock() 194 if fake.IsWellFormedStub != nil { 195 return fake.IsWellFormedStub(arg1) 196 } 197 if specificReturn { 198 return ret.result1 199 } 200 fakeReturns := fake.isWellFormedReturns 201 return fakeReturns.result1 202 } 203 204 func (fake *MSPManager) IsWellFormedCallCount() int { 205 fake.isWellFormedMutex.RLock() 206 defer fake.isWellFormedMutex.RUnlock() 207 return len(fake.isWellFormedArgsForCall) 208 } 209 210 func (fake *MSPManager) IsWellFormedCalls(stub func(*mspa.SerializedIdentity) error) { 211 fake.isWellFormedMutex.Lock() 212 defer fake.isWellFormedMutex.Unlock() 213 fake.IsWellFormedStub = stub 214 } 215 216 func (fake *MSPManager) IsWellFormedArgsForCall(i int) *mspa.SerializedIdentity { 217 fake.isWellFormedMutex.RLock() 218 defer fake.isWellFormedMutex.RUnlock() 219 argsForCall := fake.isWellFormedArgsForCall[i] 220 return argsForCall.arg1 221 } 222 223 func (fake *MSPManager) IsWellFormedReturns(result1 error) { 224 fake.isWellFormedMutex.Lock() 225 defer fake.isWellFormedMutex.Unlock() 226 fake.IsWellFormedStub = nil 227 fake.isWellFormedReturns = struct { 228 result1 error 229 }{result1} 230 } 231 232 func (fake *MSPManager) IsWellFormedReturnsOnCall(i int, result1 error) { 233 fake.isWellFormedMutex.Lock() 234 defer fake.isWellFormedMutex.Unlock() 235 fake.IsWellFormedStub = nil 236 if fake.isWellFormedReturnsOnCall == nil { 237 fake.isWellFormedReturnsOnCall = make(map[int]struct { 238 result1 error 239 }) 240 } 241 fake.isWellFormedReturnsOnCall[i] = struct { 242 result1 error 243 }{result1} 244 } 245 246 func (fake *MSPManager) Setup(arg1 []msp.MSP) error { 247 var arg1Copy []msp.MSP 248 if arg1 != nil { 249 arg1Copy = make([]msp.MSP, len(arg1)) 250 copy(arg1Copy, arg1) 251 } 252 fake.setupMutex.Lock() 253 ret, specificReturn := fake.setupReturnsOnCall[len(fake.setupArgsForCall)] 254 fake.setupArgsForCall = append(fake.setupArgsForCall, struct { 255 arg1 []msp.MSP 256 }{arg1Copy}) 257 fake.recordInvocation("Setup", []interface{}{arg1Copy}) 258 fake.setupMutex.Unlock() 259 if fake.SetupStub != nil { 260 return fake.SetupStub(arg1) 261 } 262 if specificReturn { 263 return ret.result1 264 } 265 fakeReturns := fake.setupReturns 266 return fakeReturns.result1 267 } 268 269 func (fake *MSPManager) SetupCallCount() int { 270 fake.setupMutex.RLock() 271 defer fake.setupMutex.RUnlock() 272 return len(fake.setupArgsForCall) 273 } 274 275 func (fake *MSPManager) SetupCalls(stub func([]msp.MSP) error) { 276 fake.setupMutex.Lock() 277 defer fake.setupMutex.Unlock() 278 fake.SetupStub = stub 279 } 280 281 func (fake *MSPManager) SetupArgsForCall(i int) []msp.MSP { 282 fake.setupMutex.RLock() 283 defer fake.setupMutex.RUnlock() 284 argsForCall := fake.setupArgsForCall[i] 285 return argsForCall.arg1 286 } 287 288 func (fake *MSPManager) SetupReturns(result1 error) { 289 fake.setupMutex.Lock() 290 defer fake.setupMutex.Unlock() 291 fake.SetupStub = nil 292 fake.setupReturns = struct { 293 result1 error 294 }{result1} 295 } 296 297 func (fake *MSPManager) SetupReturnsOnCall(i int, result1 error) { 298 fake.setupMutex.Lock() 299 defer fake.setupMutex.Unlock() 300 fake.SetupStub = nil 301 if fake.setupReturnsOnCall == nil { 302 fake.setupReturnsOnCall = make(map[int]struct { 303 result1 error 304 }) 305 } 306 fake.setupReturnsOnCall[i] = struct { 307 result1 error 308 }{result1} 309 } 310 311 func (fake *MSPManager) Invocations() map[string][][]interface{} { 312 fake.invocationsMutex.RLock() 313 defer fake.invocationsMutex.RUnlock() 314 fake.deserializeIdentityMutex.RLock() 315 defer fake.deserializeIdentityMutex.RUnlock() 316 fake.getMSPsMutex.RLock() 317 defer fake.getMSPsMutex.RUnlock() 318 fake.isWellFormedMutex.RLock() 319 defer fake.isWellFormedMutex.RUnlock() 320 fake.setupMutex.RLock() 321 defer fake.setupMutex.RUnlock() 322 copiedInvocations := map[string][][]interface{}{} 323 for key, value := range fake.invocations { 324 copiedInvocations[key] = value 325 } 326 return copiedInvocations 327 } 328 329 func (fake *MSPManager) recordInvocation(key string, args []interface{}) { 330 fake.invocationsMutex.Lock() 331 defer fake.invocationsMutex.Unlock() 332 if fake.invocations == nil { 333 fake.invocations = map[string][][]interface{}{} 334 } 335 if fake.invocations[key] == nil { 336 fake.invocations[key] = [][]interface{}{} 337 } 338 fake.invocations[key] = append(fake.invocations[key], args) 339 }