github.com/renegr87/renegr87@v2.1.1+incompatible/core/peer/mock/identity_deserializer_manager.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package mock 3 4 import ( 5 "sync" 6 7 "github.com/hyperledger/fabric/msp" 8 ) 9 10 type IdentityDeserializerManager struct { 11 DeserializerStub func(string) (msp.IdentityDeserializer, error) 12 deserializerMutex sync.RWMutex 13 deserializerArgsForCall []struct { 14 arg1 string 15 } 16 deserializerReturns struct { 17 result1 msp.IdentityDeserializer 18 result2 error 19 } 20 deserializerReturnsOnCall map[int]struct { 21 result1 msp.IdentityDeserializer 22 result2 error 23 } 24 invocations map[string][][]interface{} 25 invocationsMutex sync.RWMutex 26 } 27 28 func (fake *IdentityDeserializerManager) Deserializer(arg1 string) (msp.IdentityDeserializer, error) { 29 fake.deserializerMutex.Lock() 30 ret, specificReturn := fake.deserializerReturnsOnCall[len(fake.deserializerArgsForCall)] 31 fake.deserializerArgsForCall = append(fake.deserializerArgsForCall, struct { 32 arg1 string 33 }{arg1}) 34 fake.recordInvocation("Deserializer", []interface{}{arg1}) 35 fake.deserializerMutex.Unlock() 36 if fake.DeserializerStub != nil { 37 return fake.DeserializerStub(arg1) 38 } 39 if specificReturn { 40 return ret.result1, ret.result2 41 } 42 fakeReturns := fake.deserializerReturns 43 return fakeReturns.result1, fakeReturns.result2 44 } 45 46 func (fake *IdentityDeserializerManager) DeserializerCallCount() int { 47 fake.deserializerMutex.RLock() 48 defer fake.deserializerMutex.RUnlock() 49 return len(fake.deserializerArgsForCall) 50 } 51 52 func (fake *IdentityDeserializerManager) DeserializerCalls(stub func(string) (msp.IdentityDeserializer, error)) { 53 fake.deserializerMutex.Lock() 54 defer fake.deserializerMutex.Unlock() 55 fake.DeserializerStub = stub 56 } 57 58 func (fake *IdentityDeserializerManager) DeserializerArgsForCall(i int) string { 59 fake.deserializerMutex.RLock() 60 defer fake.deserializerMutex.RUnlock() 61 argsForCall := fake.deserializerArgsForCall[i] 62 return argsForCall.arg1 63 } 64 65 func (fake *IdentityDeserializerManager) DeserializerReturns(result1 msp.IdentityDeserializer, result2 error) { 66 fake.deserializerMutex.Lock() 67 defer fake.deserializerMutex.Unlock() 68 fake.DeserializerStub = nil 69 fake.deserializerReturns = struct { 70 result1 msp.IdentityDeserializer 71 result2 error 72 }{result1, result2} 73 } 74 75 func (fake *IdentityDeserializerManager) DeserializerReturnsOnCall(i int, result1 msp.IdentityDeserializer, result2 error) { 76 fake.deserializerMutex.Lock() 77 defer fake.deserializerMutex.Unlock() 78 fake.DeserializerStub = nil 79 if fake.deserializerReturnsOnCall == nil { 80 fake.deserializerReturnsOnCall = make(map[int]struct { 81 result1 msp.IdentityDeserializer 82 result2 error 83 }) 84 } 85 fake.deserializerReturnsOnCall[i] = struct { 86 result1 msp.IdentityDeserializer 87 result2 error 88 }{result1, result2} 89 } 90 91 func (fake *IdentityDeserializerManager) Invocations() map[string][][]interface{} { 92 fake.invocationsMutex.RLock() 93 defer fake.invocationsMutex.RUnlock() 94 fake.deserializerMutex.RLock() 95 defer fake.deserializerMutex.RUnlock() 96 copiedInvocations := map[string][][]interface{}{} 97 for key, value := range fake.invocations { 98 copiedInvocations[key] = value 99 } 100 return copiedInvocations 101 } 102 103 func (fake *IdentityDeserializerManager) recordInvocation(key string, args []interface{}) { 104 fake.invocationsMutex.Lock() 105 defer fake.invocationsMutex.Unlock() 106 if fake.invocations == nil { 107 fake.invocations = map[string][][]interface{}{} 108 } 109 if fake.invocations[key] == nil { 110 fake.invocations[key] = [][]interface{}{} 111 } 112 fake.invocations[key] = append(fake.invocations[key], args) 113 }