github.com/ewagmig/fabric@v2.1.1+incompatible/gossip/service/mocks/signer_serializer.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package mocks 3 4 import ( 5 "sync" 6 ) 7 8 type SignerSerializer struct { 9 SerializeStub func() ([]byte, error) 10 serializeMutex sync.RWMutex 11 serializeArgsForCall []struct { 12 } 13 serializeReturns struct { 14 result1 []byte 15 result2 error 16 } 17 serializeReturnsOnCall map[int]struct { 18 result1 []byte 19 result2 error 20 } 21 SignStub func([]byte) ([]byte, error) 22 signMutex sync.RWMutex 23 signArgsForCall []struct { 24 arg1 []byte 25 } 26 signReturns struct { 27 result1 []byte 28 result2 error 29 } 30 signReturnsOnCall map[int]struct { 31 result1 []byte 32 result2 error 33 } 34 invocations map[string][][]interface{} 35 invocationsMutex sync.RWMutex 36 } 37 38 func (fake *SignerSerializer) Serialize() ([]byte, error) { 39 fake.serializeMutex.Lock() 40 ret, specificReturn := fake.serializeReturnsOnCall[len(fake.serializeArgsForCall)] 41 fake.serializeArgsForCall = append(fake.serializeArgsForCall, struct { 42 }{}) 43 fake.recordInvocation("Serialize", []interface{}{}) 44 fake.serializeMutex.Unlock() 45 if fake.SerializeStub != nil { 46 return fake.SerializeStub() 47 } 48 if specificReturn { 49 return ret.result1, ret.result2 50 } 51 fakeReturns := fake.serializeReturns 52 return fakeReturns.result1, fakeReturns.result2 53 } 54 55 func (fake *SignerSerializer) SerializeCallCount() int { 56 fake.serializeMutex.RLock() 57 defer fake.serializeMutex.RUnlock() 58 return len(fake.serializeArgsForCall) 59 } 60 61 func (fake *SignerSerializer) SerializeCalls(stub func() ([]byte, error)) { 62 fake.serializeMutex.Lock() 63 defer fake.serializeMutex.Unlock() 64 fake.SerializeStub = stub 65 } 66 67 func (fake *SignerSerializer) SerializeReturns(result1 []byte, result2 error) { 68 fake.serializeMutex.Lock() 69 defer fake.serializeMutex.Unlock() 70 fake.SerializeStub = nil 71 fake.serializeReturns = struct { 72 result1 []byte 73 result2 error 74 }{result1, result2} 75 } 76 77 func (fake *SignerSerializer) SerializeReturnsOnCall(i int, result1 []byte, result2 error) { 78 fake.serializeMutex.Lock() 79 defer fake.serializeMutex.Unlock() 80 fake.SerializeStub = nil 81 if fake.serializeReturnsOnCall == nil { 82 fake.serializeReturnsOnCall = make(map[int]struct { 83 result1 []byte 84 result2 error 85 }) 86 } 87 fake.serializeReturnsOnCall[i] = struct { 88 result1 []byte 89 result2 error 90 }{result1, result2} 91 } 92 93 func (fake *SignerSerializer) Sign(arg1 []byte) ([]byte, error) { 94 var arg1Copy []byte 95 if arg1 != nil { 96 arg1Copy = make([]byte, len(arg1)) 97 copy(arg1Copy, arg1) 98 } 99 fake.signMutex.Lock() 100 ret, specificReturn := fake.signReturnsOnCall[len(fake.signArgsForCall)] 101 fake.signArgsForCall = append(fake.signArgsForCall, struct { 102 arg1 []byte 103 }{arg1Copy}) 104 fake.recordInvocation("Sign", []interface{}{arg1Copy}) 105 fake.signMutex.Unlock() 106 if fake.SignStub != nil { 107 return fake.SignStub(arg1) 108 } 109 if specificReturn { 110 return ret.result1, ret.result2 111 } 112 fakeReturns := fake.signReturns 113 return fakeReturns.result1, fakeReturns.result2 114 } 115 116 func (fake *SignerSerializer) SignCallCount() int { 117 fake.signMutex.RLock() 118 defer fake.signMutex.RUnlock() 119 return len(fake.signArgsForCall) 120 } 121 122 func (fake *SignerSerializer) SignCalls(stub func([]byte) ([]byte, error)) { 123 fake.signMutex.Lock() 124 defer fake.signMutex.Unlock() 125 fake.SignStub = stub 126 } 127 128 func (fake *SignerSerializer) SignArgsForCall(i int) []byte { 129 fake.signMutex.RLock() 130 defer fake.signMutex.RUnlock() 131 argsForCall := fake.signArgsForCall[i] 132 return argsForCall.arg1 133 } 134 135 func (fake *SignerSerializer) SignReturns(result1 []byte, result2 error) { 136 fake.signMutex.Lock() 137 defer fake.signMutex.Unlock() 138 fake.SignStub = nil 139 fake.signReturns = struct { 140 result1 []byte 141 result2 error 142 }{result1, result2} 143 } 144 145 func (fake *SignerSerializer) SignReturnsOnCall(i int, result1 []byte, result2 error) { 146 fake.signMutex.Lock() 147 defer fake.signMutex.Unlock() 148 fake.SignStub = nil 149 if fake.signReturnsOnCall == nil { 150 fake.signReturnsOnCall = make(map[int]struct { 151 result1 []byte 152 result2 error 153 }) 154 } 155 fake.signReturnsOnCall[i] = struct { 156 result1 []byte 157 result2 error 158 }{result1, result2} 159 } 160 161 func (fake *SignerSerializer) Invocations() map[string][][]interface{} { 162 fake.invocationsMutex.RLock() 163 defer fake.invocationsMutex.RUnlock() 164 fake.serializeMutex.RLock() 165 defer fake.serializeMutex.RUnlock() 166 fake.signMutex.RLock() 167 defer fake.signMutex.RUnlock() 168 copiedInvocations := map[string][][]interface{}{} 169 for key, value := range fake.invocations { 170 copiedInvocations[key] = value 171 } 172 return copiedInvocations 173 } 174 175 func (fake *SignerSerializer) recordInvocation(key string, args []interface{}) { 176 fake.invocationsMutex.Lock() 177 defer fake.invocationsMutex.Unlock() 178 if fake.invocations == nil { 179 fake.invocations = map[string][][]interface{}{} 180 } 181 if fake.invocations[key] == nil { 182 fake.invocations[key] = [][]interface{}{} 183 } 184 fake.invocations[key] = append(fake.invocations[key], args) 185 }