github.com/yacovm/fabric@v2.0.0-alpha.0.20191128145320-c5d4087dc723+incompatible/common/policies/mocks/identity_deserializer.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package mocks 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 IdentityDeserializer 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 IsWellFormedStub func(*mspa.SerializedIdentity) error 26 isWellFormedMutex sync.RWMutex 27 isWellFormedArgsForCall []struct { 28 arg1 *mspa.SerializedIdentity 29 } 30 isWellFormedReturns struct { 31 result1 error 32 } 33 isWellFormedReturnsOnCall map[int]struct { 34 result1 error 35 } 36 invocations map[string][][]interface{} 37 invocationsMutex sync.RWMutex 38 } 39 40 func (fake *IdentityDeserializer) DeserializeIdentity(arg1 []byte) (msp.Identity, error) { 41 var arg1Copy []byte 42 if arg1 != nil { 43 arg1Copy = make([]byte, len(arg1)) 44 copy(arg1Copy, arg1) 45 } 46 fake.deserializeIdentityMutex.Lock() 47 ret, specificReturn := fake.deserializeIdentityReturnsOnCall[len(fake.deserializeIdentityArgsForCall)] 48 fake.deserializeIdentityArgsForCall = append(fake.deserializeIdentityArgsForCall, struct { 49 arg1 []byte 50 }{arg1Copy}) 51 fake.recordInvocation("DeserializeIdentity", []interface{}{arg1Copy}) 52 fake.deserializeIdentityMutex.Unlock() 53 if fake.DeserializeIdentityStub != nil { 54 return fake.DeserializeIdentityStub(arg1) 55 } 56 if specificReturn { 57 return ret.result1, ret.result2 58 } 59 fakeReturns := fake.deserializeIdentityReturns 60 return fakeReturns.result1, fakeReturns.result2 61 } 62 63 func (fake *IdentityDeserializer) DeserializeIdentityCallCount() int { 64 fake.deserializeIdentityMutex.RLock() 65 defer fake.deserializeIdentityMutex.RUnlock() 66 return len(fake.deserializeIdentityArgsForCall) 67 } 68 69 func (fake *IdentityDeserializer) DeserializeIdentityCalls(stub func([]byte) (msp.Identity, error)) { 70 fake.deserializeIdentityMutex.Lock() 71 defer fake.deserializeIdentityMutex.Unlock() 72 fake.DeserializeIdentityStub = stub 73 } 74 75 func (fake *IdentityDeserializer) DeserializeIdentityArgsForCall(i int) []byte { 76 fake.deserializeIdentityMutex.RLock() 77 defer fake.deserializeIdentityMutex.RUnlock() 78 argsForCall := fake.deserializeIdentityArgsForCall[i] 79 return argsForCall.arg1 80 } 81 82 func (fake *IdentityDeserializer) DeserializeIdentityReturns(result1 msp.Identity, result2 error) { 83 fake.deserializeIdentityMutex.Lock() 84 defer fake.deserializeIdentityMutex.Unlock() 85 fake.DeserializeIdentityStub = nil 86 fake.deserializeIdentityReturns = struct { 87 result1 msp.Identity 88 result2 error 89 }{result1, result2} 90 } 91 92 func (fake *IdentityDeserializer) DeserializeIdentityReturnsOnCall(i int, result1 msp.Identity, result2 error) { 93 fake.deserializeIdentityMutex.Lock() 94 defer fake.deserializeIdentityMutex.Unlock() 95 fake.DeserializeIdentityStub = nil 96 if fake.deserializeIdentityReturnsOnCall == nil { 97 fake.deserializeIdentityReturnsOnCall = make(map[int]struct { 98 result1 msp.Identity 99 result2 error 100 }) 101 } 102 fake.deserializeIdentityReturnsOnCall[i] = struct { 103 result1 msp.Identity 104 result2 error 105 }{result1, result2} 106 } 107 108 func (fake *IdentityDeserializer) IsWellFormed(arg1 *mspa.SerializedIdentity) error { 109 fake.isWellFormedMutex.Lock() 110 ret, specificReturn := fake.isWellFormedReturnsOnCall[len(fake.isWellFormedArgsForCall)] 111 fake.isWellFormedArgsForCall = append(fake.isWellFormedArgsForCall, struct { 112 arg1 *mspa.SerializedIdentity 113 }{arg1}) 114 fake.recordInvocation("IsWellFormed", []interface{}{arg1}) 115 fake.isWellFormedMutex.Unlock() 116 if fake.IsWellFormedStub != nil { 117 return fake.IsWellFormedStub(arg1) 118 } 119 if specificReturn { 120 return ret.result1 121 } 122 fakeReturns := fake.isWellFormedReturns 123 return fakeReturns.result1 124 } 125 126 func (fake *IdentityDeserializer) IsWellFormedCallCount() int { 127 fake.isWellFormedMutex.RLock() 128 defer fake.isWellFormedMutex.RUnlock() 129 return len(fake.isWellFormedArgsForCall) 130 } 131 132 func (fake *IdentityDeserializer) IsWellFormedCalls(stub func(*mspa.SerializedIdentity) error) { 133 fake.isWellFormedMutex.Lock() 134 defer fake.isWellFormedMutex.Unlock() 135 fake.IsWellFormedStub = stub 136 } 137 138 func (fake *IdentityDeserializer) IsWellFormedArgsForCall(i int) *mspa.SerializedIdentity { 139 fake.isWellFormedMutex.RLock() 140 defer fake.isWellFormedMutex.RUnlock() 141 argsForCall := fake.isWellFormedArgsForCall[i] 142 return argsForCall.arg1 143 } 144 145 func (fake *IdentityDeserializer) IsWellFormedReturns(result1 error) { 146 fake.isWellFormedMutex.Lock() 147 defer fake.isWellFormedMutex.Unlock() 148 fake.IsWellFormedStub = nil 149 fake.isWellFormedReturns = struct { 150 result1 error 151 }{result1} 152 } 153 154 func (fake *IdentityDeserializer) IsWellFormedReturnsOnCall(i int, result1 error) { 155 fake.isWellFormedMutex.Lock() 156 defer fake.isWellFormedMutex.Unlock() 157 fake.IsWellFormedStub = nil 158 if fake.isWellFormedReturnsOnCall == nil { 159 fake.isWellFormedReturnsOnCall = make(map[int]struct { 160 result1 error 161 }) 162 } 163 fake.isWellFormedReturnsOnCall[i] = struct { 164 result1 error 165 }{result1} 166 } 167 168 func (fake *IdentityDeserializer) Invocations() map[string][][]interface{} { 169 fake.invocationsMutex.RLock() 170 defer fake.invocationsMutex.RUnlock() 171 fake.deserializeIdentityMutex.RLock() 172 defer fake.deserializeIdentityMutex.RUnlock() 173 fake.isWellFormedMutex.RLock() 174 defer fake.isWellFormedMutex.RUnlock() 175 copiedInvocations := map[string][][]interface{}{} 176 for key, value := range fake.invocations { 177 copiedInvocations[key] = value 178 } 179 return copiedInvocations 180 } 181 182 func (fake *IdentityDeserializer) recordInvocation(key string, args []interface{}) { 183 fake.invocationsMutex.Lock() 184 defer fake.invocationsMutex.Unlock() 185 if fake.invocations == nil { 186 fake.invocations = map[string][][]interface{}{} 187 } 188 if fake.invocations[key] == nil { 189 fake.invocations[key] = [][]interface{}{} 190 } 191 fake.invocations[key] = append(fake.invocations[key], args) 192 }