github.com/vijaypunugubati/fabric@v2.0.0-alpha.0.20200109185758-70466159f5b3+incompatible/core/chaincode/mock/runtime.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package mock 3 4 import ( 5 "sync" 6 7 "github.com/hyperledger/fabric/core/container/ccintf" 8 ) 9 10 type Runtime struct { 11 BuildStub func(string) (*ccintf.ChaincodeServerInfo, error) 12 buildMutex sync.RWMutex 13 buildArgsForCall []struct { 14 arg1 string 15 } 16 buildReturns struct { 17 result1 *ccintf.ChaincodeServerInfo 18 result2 error 19 } 20 buildReturnsOnCall map[int]struct { 21 result1 *ccintf.ChaincodeServerInfo 22 result2 error 23 } 24 StartStub func(string, *ccintf.PeerConnection) error 25 startMutex sync.RWMutex 26 startArgsForCall []struct { 27 arg1 string 28 arg2 *ccintf.PeerConnection 29 } 30 startReturns struct { 31 result1 error 32 } 33 startReturnsOnCall map[int]struct { 34 result1 error 35 } 36 StopStub func(string) error 37 stopMutex sync.RWMutex 38 stopArgsForCall []struct { 39 arg1 string 40 } 41 stopReturns struct { 42 result1 error 43 } 44 stopReturnsOnCall map[int]struct { 45 result1 error 46 } 47 WaitStub func(string) (int, error) 48 waitMutex sync.RWMutex 49 waitArgsForCall []struct { 50 arg1 string 51 } 52 waitReturns struct { 53 result1 int 54 result2 error 55 } 56 waitReturnsOnCall map[int]struct { 57 result1 int 58 result2 error 59 } 60 invocations map[string][][]interface{} 61 invocationsMutex sync.RWMutex 62 } 63 64 func (fake *Runtime) Build(arg1 string) (*ccintf.ChaincodeServerInfo, error) { 65 fake.buildMutex.Lock() 66 ret, specificReturn := fake.buildReturnsOnCall[len(fake.buildArgsForCall)] 67 fake.buildArgsForCall = append(fake.buildArgsForCall, struct { 68 arg1 string 69 }{arg1}) 70 fake.recordInvocation("Build", []interface{}{arg1}) 71 fake.buildMutex.Unlock() 72 if fake.BuildStub != nil { 73 return fake.BuildStub(arg1) 74 } 75 if specificReturn { 76 return ret.result1, ret.result2 77 } 78 fakeReturns := fake.buildReturns 79 return fakeReturns.result1, fakeReturns.result2 80 } 81 82 func (fake *Runtime) BuildCallCount() int { 83 fake.buildMutex.RLock() 84 defer fake.buildMutex.RUnlock() 85 return len(fake.buildArgsForCall) 86 } 87 88 func (fake *Runtime) BuildCalls(stub func(string) (*ccintf.ChaincodeServerInfo, error)) { 89 fake.buildMutex.Lock() 90 defer fake.buildMutex.Unlock() 91 fake.BuildStub = stub 92 } 93 94 func (fake *Runtime) BuildArgsForCall(i int) string { 95 fake.buildMutex.RLock() 96 defer fake.buildMutex.RUnlock() 97 argsForCall := fake.buildArgsForCall[i] 98 return argsForCall.arg1 99 } 100 101 func (fake *Runtime) BuildReturns(result1 *ccintf.ChaincodeServerInfo, result2 error) { 102 fake.buildMutex.Lock() 103 defer fake.buildMutex.Unlock() 104 fake.BuildStub = nil 105 fake.buildReturns = struct { 106 result1 *ccintf.ChaincodeServerInfo 107 result2 error 108 }{result1, result2} 109 } 110 111 func (fake *Runtime) BuildReturnsOnCall(i int, result1 *ccintf.ChaincodeServerInfo, result2 error) { 112 fake.buildMutex.Lock() 113 defer fake.buildMutex.Unlock() 114 fake.BuildStub = nil 115 if fake.buildReturnsOnCall == nil { 116 fake.buildReturnsOnCall = make(map[int]struct { 117 result1 *ccintf.ChaincodeServerInfo 118 result2 error 119 }) 120 } 121 fake.buildReturnsOnCall[i] = struct { 122 result1 *ccintf.ChaincodeServerInfo 123 result2 error 124 }{result1, result2} 125 } 126 127 func (fake *Runtime) Start(arg1 string, arg2 *ccintf.PeerConnection) error { 128 fake.startMutex.Lock() 129 ret, specificReturn := fake.startReturnsOnCall[len(fake.startArgsForCall)] 130 fake.startArgsForCall = append(fake.startArgsForCall, struct { 131 arg1 string 132 arg2 *ccintf.PeerConnection 133 }{arg1, arg2}) 134 fake.recordInvocation("Start", []interface{}{arg1, arg2}) 135 fake.startMutex.Unlock() 136 if fake.StartStub != nil { 137 return fake.StartStub(arg1, arg2) 138 } 139 if specificReturn { 140 return ret.result1 141 } 142 fakeReturns := fake.startReturns 143 return fakeReturns.result1 144 } 145 146 func (fake *Runtime) StartCallCount() int { 147 fake.startMutex.RLock() 148 defer fake.startMutex.RUnlock() 149 return len(fake.startArgsForCall) 150 } 151 152 func (fake *Runtime) StartCalls(stub func(string, *ccintf.PeerConnection) error) { 153 fake.startMutex.Lock() 154 defer fake.startMutex.Unlock() 155 fake.StartStub = stub 156 } 157 158 func (fake *Runtime) StartArgsForCall(i int) (string, *ccintf.PeerConnection) { 159 fake.startMutex.RLock() 160 defer fake.startMutex.RUnlock() 161 argsForCall := fake.startArgsForCall[i] 162 return argsForCall.arg1, argsForCall.arg2 163 } 164 165 func (fake *Runtime) StartReturns(result1 error) { 166 fake.startMutex.Lock() 167 defer fake.startMutex.Unlock() 168 fake.StartStub = nil 169 fake.startReturns = struct { 170 result1 error 171 }{result1} 172 } 173 174 func (fake *Runtime) StartReturnsOnCall(i int, result1 error) { 175 fake.startMutex.Lock() 176 defer fake.startMutex.Unlock() 177 fake.StartStub = nil 178 if fake.startReturnsOnCall == nil { 179 fake.startReturnsOnCall = make(map[int]struct { 180 result1 error 181 }) 182 } 183 fake.startReturnsOnCall[i] = struct { 184 result1 error 185 }{result1} 186 } 187 188 func (fake *Runtime) Stop(arg1 string) error { 189 fake.stopMutex.Lock() 190 ret, specificReturn := fake.stopReturnsOnCall[len(fake.stopArgsForCall)] 191 fake.stopArgsForCall = append(fake.stopArgsForCall, struct { 192 arg1 string 193 }{arg1}) 194 fake.recordInvocation("Stop", []interface{}{arg1}) 195 fake.stopMutex.Unlock() 196 if fake.StopStub != nil { 197 return fake.StopStub(arg1) 198 } 199 if specificReturn { 200 return ret.result1 201 } 202 fakeReturns := fake.stopReturns 203 return fakeReturns.result1 204 } 205 206 func (fake *Runtime) StopCallCount() int { 207 fake.stopMutex.RLock() 208 defer fake.stopMutex.RUnlock() 209 return len(fake.stopArgsForCall) 210 } 211 212 func (fake *Runtime) StopCalls(stub func(string) error) { 213 fake.stopMutex.Lock() 214 defer fake.stopMutex.Unlock() 215 fake.StopStub = stub 216 } 217 218 func (fake *Runtime) StopArgsForCall(i int) string { 219 fake.stopMutex.RLock() 220 defer fake.stopMutex.RUnlock() 221 argsForCall := fake.stopArgsForCall[i] 222 return argsForCall.arg1 223 } 224 225 func (fake *Runtime) StopReturns(result1 error) { 226 fake.stopMutex.Lock() 227 defer fake.stopMutex.Unlock() 228 fake.StopStub = nil 229 fake.stopReturns = struct { 230 result1 error 231 }{result1} 232 } 233 234 func (fake *Runtime) StopReturnsOnCall(i int, result1 error) { 235 fake.stopMutex.Lock() 236 defer fake.stopMutex.Unlock() 237 fake.StopStub = nil 238 if fake.stopReturnsOnCall == nil { 239 fake.stopReturnsOnCall = make(map[int]struct { 240 result1 error 241 }) 242 } 243 fake.stopReturnsOnCall[i] = struct { 244 result1 error 245 }{result1} 246 } 247 248 func (fake *Runtime) Wait(arg1 string) (int, error) { 249 fake.waitMutex.Lock() 250 ret, specificReturn := fake.waitReturnsOnCall[len(fake.waitArgsForCall)] 251 fake.waitArgsForCall = append(fake.waitArgsForCall, struct { 252 arg1 string 253 }{arg1}) 254 fake.recordInvocation("Wait", []interface{}{arg1}) 255 fake.waitMutex.Unlock() 256 if fake.WaitStub != nil { 257 return fake.WaitStub(arg1) 258 } 259 if specificReturn { 260 return ret.result1, ret.result2 261 } 262 fakeReturns := fake.waitReturns 263 return fakeReturns.result1, fakeReturns.result2 264 } 265 266 func (fake *Runtime) WaitCallCount() int { 267 fake.waitMutex.RLock() 268 defer fake.waitMutex.RUnlock() 269 return len(fake.waitArgsForCall) 270 } 271 272 func (fake *Runtime) WaitCalls(stub func(string) (int, error)) { 273 fake.waitMutex.Lock() 274 defer fake.waitMutex.Unlock() 275 fake.WaitStub = stub 276 } 277 278 func (fake *Runtime) WaitArgsForCall(i int) string { 279 fake.waitMutex.RLock() 280 defer fake.waitMutex.RUnlock() 281 argsForCall := fake.waitArgsForCall[i] 282 return argsForCall.arg1 283 } 284 285 func (fake *Runtime) WaitReturns(result1 int, result2 error) { 286 fake.waitMutex.Lock() 287 defer fake.waitMutex.Unlock() 288 fake.WaitStub = nil 289 fake.waitReturns = struct { 290 result1 int 291 result2 error 292 }{result1, result2} 293 } 294 295 func (fake *Runtime) WaitReturnsOnCall(i int, result1 int, result2 error) { 296 fake.waitMutex.Lock() 297 defer fake.waitMutex.Unlock() 298 fake.WaitStub = nil 299 if fake.waitReturnsOnCall == nil { 300 fake.waitReturnsOnCall = make(map[int]struct { 301 result1 int 302 result2 error 303 }) 304 } 305 fake.waitReturnsOnCall[i] = struct { 306 result1 int 307 result2 error 308 }{result1, result2} 309 } 310 311 func (fake *Runtime) Invocations() map[string][][]interface{} { 312 fake.invocationsMutex.RLock() 313 defer fake.invocationsMutex.RUnlock() 314 fake.buildMutex.RLock() 315 defer fake.buildMutex.RUnlock() 316 fake.startMutex.RLock() 317 defer fake.startMutex.RUnlock() 318 fake.stopMutex.RLock() 319 defer fake.stopMutex.RUnlock() 320 fake.waitMutex.RLock() 321 defer fake.waitMutex.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 *Runtime) 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 }