github.com/lzy4123/fabric@v2.1.1+incompatible/bccsp/idemix/handlers/mock/revocation.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package mock 3 4 import ( 5 "crypto/ecdsa" 6 "sync" 7 8 "github.com/hyperledger/fabric/bccsp" 9 "github.com/hyperledger/fabric/bccsp/idemix/handlers" 10 ) 11 12 type Revocation struct { 13 NewKeyStub func() (*ecdsa.PrivateKey, error) 14 newKeyMutex sync.RWMutex 15 newKeyArgsForCall []struct { 16 } 17 newKeyReturns struct { 18 result1 *ecdsa.PrivateKey 19 result2 error 20 } 21 newKeyReturnsOnCall map[int]struct { 22 result1 *ecdsa.PrivateKey 23 result2 error 24 } 25 SignStub func(*ecdsa.PrivateKey, [][]byte, int, bccsp.RevocationAlgorithm) ([]byte, error) 26 signMutex sync.RWMutex 27 signArgsForCall []struct { 28 arg1 *ecdsa.PrivateKey 29 arg2 [][]byte 30 arg3 int 31 arg4 bccsp.RevocationAlgorithm 32 } 33 signReturns struct { 34 result1 []byte 35 result2 error 36 } 37 signReturnsOnCall map[int]struct { 38 result1 []byte 39 result2 error 40 } 41 VerifyStub func(*ecdsa.PublicKey, []byte, int, bccsp.RevocationAlgorithm) error 42 verifyMutex sync.RWMutex 43 verifyArgsForCall []struct { 44 arg1 *ecdsa.PublicKey 45 arg2 []byte 46 arg3 int 47 arg4 bccsp.RevocationAlgorithm 48 } 49 verifyReturns struct { 50 result1 error 51 } 52 verifyReturnsOnCall map[int]struct { 53 result1 error 54 } 55 invocations map[string][][]interface{} 56 invocationsMutex sync.RWMutex 57 } 58 59 func (fake *Revocation) NewKey() (*ecdsa.PrivateKey, error) { 60 fake.newKeyMutex.Lock() 61 ret, specificReturn := fake.newKeyReturnsOnCall[len(fake.newKeyArgsForCall)] 62 fake.newKeyArgsForCall = append(fake.newKeyArgsForCall, struct { 63 }{}) 64 fake.recordInvocation("NewKey", []interface{}{}) 65 fake.newKeyMutex.Unlock() 66 if fake.NewKeyStub != nil { 67 return fake.NewKeyStub() 68 } 69 if specificReturn { 70 return ret.result1, ret.result2 71 } 72 fakeReturns := fake.newKeyReturns 73 return fakeReturns.result1, fakeReturns.result2 74 } 75 76 func (fake *Revocation) NewKeyCallCount() int { 77 fake.newKeyMutex.RLock() 78 defer fake.newKeyMutex.RUnlock() 79 return len(fake.newKeyArgsForCall) 80 } 81 82 func (fake *Revocation) NewKeyCalls(stub func() (*ecdsa.PrivateKey, error)) { 83 fake.newKeyMutex.Lock() 84 defer fake.newKeyMutex.Unlock() 85 fake.NewKeyStub = stub 86 } 87 88 func (fake *Revocation) NewKeyReturns(result1 *ecdsa.PrivateKey, result2 error) { 89 fake.newKeyMutex.Lock() 90 defer fake.newKeyMutex.Unlock() 91 fake.NewKeyStub = nil 92 fake.newKeyReturns = struct { 93 result1 *ecdsa.PrivateKey 94 result2 error 95 }{result1, result2} 96 } 97 98 func (fake *Revocation) NewKeyReturnsOnCall(i int, result1 *ecdsa.PrivateKey, result2 error) { 99 fake.newKeyMutex.Lock() 100 defer fake.newKeyMutex.Unlock() 101 fake.NewKeyStub = nil 102 if fake.newKeyReturnsOnCall == nil { 103 fake.newKeyReturnsOnCall = make(map[int]struct { 104 result1 *ecdsa.PrivateKey 105 result2 error 106 }) 107 } 108 fake.newKeyReturnsOnCall[i] = struct { 109 result1 *ecdsa.PrivateKey 110 result2 error 111 }{result1, result2} 112 } 113 114 func (fake *Revocation) Sign(arg1 *ecdsa.PrivateKey, arg2 [][]byte, arg3 int, arg4 bccsp.RevocationAlgorithm) ([]byte, error) { 115 var arg2Copy [][]byte 116 if arg2 != nil { 117 arg2Copy = make([][]byte, len(arg2)) 118 copy(arg2Copy, arg2) 119 } 120 fake.signMutex.Lock() 121 ret, specificReturn := fake.signReturnsOnCall[len(fake.signArgsForCall)] 122 fake.signArgsForCall = append(fake.signArgsForCall, struct { 123 arg1 *ecdsa.PrivateKey 124 arg2 [][]byte 125 arg3 int 126 arg4 bccsp.RevocationAlgorithm 127 }{arg1, arg2Copy, arg3, arg4}) 128 fake.recordInvocation("Sign", []interface{}{arg1, arg2Copy, arg3, arg4}) 129 fake.signMutex.Unlock() 130 if fake.SignStub != nil { 131 return fake.SignStub(arg1, arg2, arg3, arg4) 132 } 133 if specificReturn { 134 return ret.result1, ret.result2 135 } 136 fakeReturns := fake.signReturns 137 return fakeReturns.result1, fakeReturns.result2 138 } 139 140 func (fake *Revocation) SignCallCount() int { 141 fake.signMutex.RLock() 142 defer fake.signMutex.RUnlock() 143 return len(fake.signArgsForCall) 144 } 145 146 func (fake *Revocation) SignCalls(stub func(*ecdsa.PrivateKey, [][]byte, int, bccsp.RevocationAlgorithm) ([]byte, error)) { 147 fake.signMutex.Lock() 148 defer fake.signMutex.Unlock() 149 fake.SignStub = stub 150 } 151 152 func (fake *Revocation) SignArgsForCall(i int) (*ecdsa.PrivateKey, [][]byte, int, bccsp.RevocationAlgorithm) { 153 fake.signMutex.RLock() 154 defer fake.signMutex.RUnlock() 155 argsForCall := fake.signArgsForCall[i] 156 return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4 157 } 158 159 func (fake *Revocation) SignReturns(result1 []byte, result2 error) { 160 fake.signMutex.Lock() 161 defer fake.signMutex.Unlock() 162 fake.SignStub = nil 163 fake.signReturns = struct { 164 result1 []byte 165 result2 error 166 }{result1, result2} 167 } 168 169 func (fake *Revocation) SignReturnsOnCall(i int, result1 []byte, result2 error) { 170 fake.signMutex.Lock() 171 defer fake.signMutex.Unlock() 172 fake.SignStub = nil 173 if fake.signReturnsOnCall == nil { 174 fake.signReturnsOnCall = make(map[int]struct { 175 result1 []byte 176 result2 error 177 }) 178 } 179 fake.signReturnsOnCall[i] = struct { 180 result1 []byte 181 result2 error 182 }{result1, result2} 183 } 184 185 func (fake *Revocation) Verify(arg1 *ecdsa.PublicKey, arg2 []byte, arg3 int, arg4 bccsp.RevocationAlgorithm) error { 186 var arg2Copy []byte 187 if arg2 != nil { 188 arg2Copy = make([]byte, len(arg2)) 189 copy(arg2Copy, arg2) 190 } 191 fake.verifyMutex.Lock() 192 ret, specificReturn := fake.verifyReturnsOnCall[len(fake.verifyArgsForCall)] 193 fake.verifyArgsForCall = append(fake.verifyArgsForCall, struct { 194 arg1 *ecdsa.PublicKey 195 arg2 []byte 196 arg3 int 197 arg4 bccsp.RevocationAlgorithm 198 }{arg1, arg2Copy, arg3, arg4}) 199 fake.recordInvocation("Verify", []interface{}{arg1, arg2Copy, arg3, arg4}) 200 fake.verifyMutex.Unlock() 201 if fake.VerifyStub != nil { 202 return fake.VerifyStub(arg1, arg2, arg3, arg4) 203 } 204 if specificReturn { 205 return ret.result1 206 } 207 fakeReturns := fake.verifyReturns 208 return fakeReturns.result1 209 } 210 211 func (fake *Revocation) VerifyCallCount() int { 212 fake.verifyMutex.RLock() 213 defer fake.verifyMutex.RUnlock() 214 return len(fake.verifyArgsForCall) 215 } 216 217 func (fake *Revocation) VerifyCalls(stub func(*ecdsa.PublicKey, []byte, int, bccsp.RevocationAlgorithm) error) { 218 fake.verifyMutex.Lock() 219 defer fake.verifyMutex.Unlock() 220 fake.VerifyStub = stub 221 } 222 223 func (fake *Revocation) VerifyArgsForCall(i int) (*ecdsa.PublicKey, []byte, int, bccsp.RevocationAlgorithm) { 224 fake.verifyMutex.RLock() 225 defer fake.verifyMutex.RUnlock() 226 argsForCall := fake.verifyArgsForCall[i] 227 return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4 228 } 229 230 func (fake *Revocation) VerifyReturns(result1 error) { 231 fake.verifyMutex.Lock() 232 defer fake.verifyMutex.Unlock() 233 fake.VerifyStub = nil 234 fake.verifyReturns = struct { 235 result1 error 236 }{result1} 237 } 238 239 func (fake *Revocation) VerifyReturnsOnCall(i int, result1 error) { 240 fake.verifyMutex.Lock() 241 defer fake.verifyMutex.Unlock() 242 fake.VerifyStub = nil 243 if fake.verifyReturnsOnCall == nil { 244 fake.verifyReturnsOnCall = make(map[int]struct { 245 result1 error 246 }) 247 } 248 fake.verifyReturnsOnCall[i] = struct { 249 result1 error 250 }{result1} 251 } 252 253 func (fake *Revocation) Invocations() map[string][][]interface{} { 254 fake.invocationsMutex.RLock() 255 defer fake.invocationsMutex.RUnlock() 256 fake.newKeyMutex.RLock() 257 defer fake.newKeyMutex.RUnlock() 258 fake.signMutex.RLock() 259 defer fake.signMutex.RUnlock() 260 fake.verifyMutex.RLock() 261 defer fake.verifyMutex.RUnlock() 262 copiedInvocations := map[string][][]interface{}{} 263 for key, value := range fake.invocations { 264 copiedInvocations[key] = value 265 } 266 return copiedInvocations 267 } 268 269 func (fake *Revocation) recordInvocation(key string, args []interface{}) { 270 fake.invocationsMutex.Lock() 271 defer fake.invocationsMutex.Unlock() 272 if fake.invocations == nil { 273 fake.invocations = map[string][][]interface{}{} 274 } 275 if fake.invocations[key] == nil { 276 fake.invocations[key] = [][]interface{}{} 277 } 278 fake.invocations[key] = append(fake.invocations[key], args) 279 } 280 281 var _ handlers.Revocation = new(Revocation)