forked from hyperledger/fabric
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fs_support.go
420 lines (386 loc) · 15.3 KB
/
fs_support.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
// Code generated by counterfeiter. DO NOT EDIT.
package mock
import (
sync "sync"
ccprovider "github.com/hyperledger/fabric/core/common/ccprovider"
peer "github.com/hyperledger/fabric/protos/peer"
)
type FileSystemSupport struct {
CheckInstantiationPolicyStub func(*peer.SignedProposal, string, []byte) error
checkInstantiationPolicyMutex sync.RWMutex
checkInstantiationPolicyArgsForCall []struct {
arg1 *peer.SignedProposal
arg2 string
arg3 []byte
}
checkInstantiationPolicyReturns struct {
result1 error
}
checkInstantiationPolicyReturnsOnCall map[int]struct {
result1 error
}
GetChaincodeFromLocalStorageStub func(string, string) (ccprovider.CCPackage, error)
getChaincodeFromLocalStorageMutex sync.RWMutex
getChaincodeFromLocalStorageArgsForCall []struct {
arg1 string
arg2 string
}
getChaincodeFromLocalStorageReturns struct {
result1 ccprovider.CCPackage
result2 error
}
getChaincodeFromLocalStorageReturnsOnCall map[int]struct {
result1 ccprovider.CCPackage
result2 error
}
GetChaincodesFromLocalStorageStub func() (*peer.ChaincodeQueryResponse, error)
getChaincodesFromLocalStorageMutex sync.RWMutex
getChaincodesFromLocalStorageArgsForCall []struct {
}
getChaincodesFromLocalStorageReturns struct {
result1 *peer.ChaincodeQueryResponse
result2 error
}
getChaincodesFromLocalStorageReturnsOnCall map[int]struct {
result1 *peer.ChaincodeQueryResponse
result2 error
}
GetInstantiationPolicyStub func(string, ccprovider.CCPackage) ([]byte, error)
getInstantiationPolicyMutex sync.RWMutex
getInstantiationPolicyArgsForCall []struct {
arg1 string
arg2 ccprovider.CCPackage
}
getInstantiationPolicyReturns struct {
result1 []byte
result2 error
}
getInstantiationPolicyReturnsOnCall map[int]struct {
result1 []byte
result2 error
}
PutChaincodeToLocalStorageStub func(ccprovider.CCPackage) error
putChaincodeToLocalStorageMutex sync.RWMutex
putChaincodeToLocalStorageArgsForCall []struct {
arg1 ccprovider.CCPackage
}
putChaincodeToLocalStorageReturns struct {
result1 error
}
putChaincodeToLocalStorageReturnsOnCall map[int]struct {
result1 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FileSystemSupport) CheckInstantiationPolicy(arg1 *peer.SignedProposal, arg2 string, arg3 []byte) error {
var arg3Copy []byte
if arg3 != nil {
arg3Copy = make([]byte, len(arg3))
copy(arg3Copy, arg3)
}
fake.checkInstantiationPolicyMutex.Lock()
ret, specificReturn := fake.checkInstantiationPolicyReturnsOnCall[len(fake.checkInstantiationPolicyArgsForCall)]
fake.checkInstantiationPolicyArgsForCall = append(fake.checkInstantiationPolicyArgsForCall, struct {
arg1 *peer.SignedProposal
arg2 string
arg3 []byte
}{arg1, arg2, arg3Copy})
fake.recordInvocation("CheckInstantiationPolicy", []interface{}{arg1, arg2, arg3Copy})
fake.checkInstantiationPolicyMutex.Unlock()
if fake.CheckInstantiationPolicyStub != nil {
return fake.CheckInstantiationPolicyStub(arg1, arg2, arg3)
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.checkInstantiationPolicyReturns
return fakeReturns.result1
}
func (fake *FileSystemSupport) CheckInstantiationPolicyCallCount() int {
fake.checkInstantiationPolicyMutex.RLock()
defer fake.checkInstantiationPolicyMutex.RUnlock()
return len(fake.checkInstantiationPolicyArgsForCall)
}
func (fake *FileSystemSupport) CheckInstantiationPolicyCalls(stub func(*peer.SignedProposal, string, []byte) error) {
fake.checkInstantiationPolicyMutex.Lock()
defer fake.checkInstantiationPolicyMutex.Unlock()
fake.CheckInstantiationPolicyStub = stub
}
func (fake *FileSystemSupport) CheckInstantiationPolicyArgsForCall(i int) (*peer.SignedProposal, string, []byte) {
fake.checkInstantiationPolicyMutex.RLock()
defer fake.checkInstantiationPolicyMutex.RUnlock()
argsForCall := fake.checkInstantiationPolicyArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
}
func (fake *FileSystemSupport) CheckInstantiationPolicyReturns(result1 error) {
fake.checkInstantiationPolicyMutex.Lock()
defer fake.checkInstantiationPolicyMutex.Unlock()
fake.CheckInstantiationPolicyStub = nil
fake.checkInstantiationPolicyReturns = struct {
result1 error
}{result1}
}
func (fake *FileSystemSupport) CheckInstantiationPolicyReturnsOnCall(i int, result1 error) {
fake.checkInstantiationPolicyMutex.Lock()
defer fake.checkInstantiationPolicyMutex.Unlock()
fake.CheckInstantiationPolicyStub = nil
if fake.checkInstantiationPolicyReturnsOnCall == nil {
fake.checkInstantiationPolicyReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.checkInstantiationPolicyReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FileSystemSupport) GetChaincodeFromLocalStorage(arg1 string, arg2 string) (ccprovider.CCPackage, error) {
fake.getChaincodeFromLocalStorageMutex.Lock()
ret, specificReturn := fake.getChaincodeFromLocalStorageReturnsOnCall[len(fake.getChaincodeFromLocalStorageArgsForCall)]
fake.getChaincodeFromLocalStorageArgsForCall = append(fake.getChaincodeFromLocalStorageArgsForCall, struct {
arg1 string
arg2 string
}{arg1, arg2})
fake.recordInvocation("GetChaincodeFromLocalStorage", []interface{}{arg1, arg2})
fake.getChaincodeFromLocalStorageMutex.Unlock()
if fake.GetChaincodeFromLocalStorageStub != nil {
return fake.GetChaincodeFromLocalStorageStub(arg1, arg2)
}
if specificReturn {
return ret.result1, ret.result2
}
fakeReturns := fake.getChaincodeFromLocalStorageReturns
return fakeReturns.result1, fakeReturns.result2
}
func (fake *FileSystemSupport) GetChaincodeFromLocalStorageCallCount() int {
fake.getChaincodeFromLocalStorageMutex.RLock()
defer fake.getChaincodeFromLocalStorageMutex.RUnlock()
return len(fake.getChaincodeFromLocalStorageArgsForCall)
}
func (fake *FileSystemSupport) GetChaincodeFromLocalStorageCalls(stub func(string, string) (ccprovider.CCPackage, error)) {
fake.getChaincodeFromLocalStorageMutex.Lock()
defer fake.getChaincodeFromLocalStorageMutex.Unlock()
fake.GetChaincodeFromLocalStorageStub = stub
}
func (fake *FileSystemSupport) GetChaincodeFromLocalStorageArgsForCall(i int) (string, string) {
fake.getChaincodeFromLocalStorageMutex.RLock()
defer fake.getChaincodeFromLocalStorageMutex.RUnlock()
argsForCall := fake.getChaincodeFromLocalStorageArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2
}
func (fake *FileSystemSupport) GetChaincodeFromLocalStorageReturns(result1 ccprovider.CCPackage, result2 error) {
fake.getChaincodeFromLocalStorageMutex.Lock()
defer fake.getChaincodeFromLocalStorageMutex.Unlock()
fake.GetChaincodeFromLocalStorageStub = nil
fake.getChaincodeFromLocalStorageReturns = struct {
result1 ccprovider.CCPackage
result2 error
}{result1, result2}
}
func (fake *FileSystemSupport) GetChaincodeFromLocalStorageReturnsOnCall(i int, result1 ccprovider.CCPackage, result2 error) {
fake.getChaincodeFromLocalStorageMutex.Lock()
defer fake.getChaincodeFromLocalStorageMutex.Unlock()
fake.GetChaincodeFromLocalStorageStub = nil
if fake.getChaincodeFromLocalStorageReturnsOnCall == nil {
fake.getChaincodeFromLocalStorageReturnsOnCall = make(map[int]struct {
result1 ccprovider.CCPackage
result2 error
})
}
fake.getChaincodeFromLocalStorageReturnsOnCall[i] = struct {
result1 ccprovider.CCPackage
result2 error
}{result1, result2}
}
func (fake *FileSystemSupport) GetChaincodesFromLocalStorage() (*peer.ChaincodeQueryResponse, error) {
fake.getChaincodesFromLocalStorageMutex.Lock()
ret, specificReturn := fake.getChaincodesFromLocalStorageReturnsOnCall[len(fake.getChaincodesFromLocalStorageArgsForCall)]
fake.getChaincodesFromLocalStorageArgsForCall = append(fake.getChaincodesFromLocalStorageArgsForCall, struct {
}{})
fake.recordInvocation("GetChaincodesFromLocalStorage", []interface{}{})
fake.getChaincodesFromLocalStorageMutex.Unlock()
if fake.GetChaincodesFromLocalStorageStub != nil {
return fake.GetChaincodesFromLocalStorageStub()
}
if specificReturn {
return ret.result1, ret.result2
}
fakeReturns := fake.getChaincodesFromLocalStorageReturns
return fakeReturns.result1, fakeReturns.result2
}
func (fake *FileSystemSupport) GetChaincodesFromLocalStorageCallCount() int {
fake.getChaincodesFromLocalStorageMutex.RLock()
defer fake.getChaincodesFromLocalStorageMutex.RUnlock()
return len(fake.getChaincodesFromLocalStorageArgsForCall)
}
func (fake *FileSystemSupport) GetChaincodesFromLocalStorageCalls(stub func() (*peer.ChaincodeQueryResponse, error)) {
fake.getChaincodesFromLocalStorageMutex.Lock()
defer fake.getChaincodesFromLocalStorageMutex.Unlock()
fake.GetChaincodesFromLocalStorageStub = stub
}
func (fake *FileSystemSupport) GetChaincodesFromLocalStorageReturns(result1 *peer.ChaincodeQueryResponse, result2 error) {
fake.getChaincodesFromLocalStorageMutex.Lock()
defer fake.getChaincodesFromLocalStorageMutex.Unlock()
fake.GetChaincodesFromLocalStorageStub = nil
fake.getChaincodesFromLocalStorageReturns = struct {
result1 *peer.ChaincodeQueryResponse
result2 error
}{result1, result2}
}
func (fake *FileSystemSupport) GetChaincodesFromLocalStorageReturnsOnCall(i int, result1 *peer.ChaincodeQueryResponse, result2 error) {
fake.getChaincodesFromLocalStorageMutex.Lock()
defer fake.getChaincodesFromLocalStorageMutex.Unlock()
fake.GetChaincodesFromLocalStorageStub = nil
if fake.getChaincodesFromLocalStorageReturnsOnCall == nil {
fake.getChaincodesFromLocalStorageReturnsOnCall = make(map[int]struct {
result1 *peer.ChaincodeQueryResponse
result2 error
})
}
fake.getChaincodesFromLocalStorageReturnsOnCall[i] = struct {
result1 *peer.ChaincodeQueryResponse
result2 error
}{result1, result2}
}
func (fake *FileSystemSupport) GetInstantiationPolicy(arg1 string, arg2 ccprovider.CCPackage) ([]byte, error) {
fake.getInstantiationPolicyMutex.Lock()
ret, specificReturn := fake.getInstantiationPolicyReturnsOnCall[len(fake.getInstantiationPolicyArgsForCall)]
fake.getInstantiationPolicyArgsForCall = append(fake.getInstantiationPolicyArgsForCall, struct {
arg1 string
arg2 ccprovider.CCPackage
}{arg1, arg2})
fake.recordInvocation("GetInstantiationPolicy", []interface{}{arg1, arg2})
fake.getInstantiationPolicyMutex.Unlock()
if fake.GetInstantiationPolicyStub != nil {
return fake.GetInstantiationPolicyStub(arg1, arg2)
}
if specificReturn {
return ret.result1, ret.result2
}
fakeReturns := fake.getInstantiationPolicyReturns
return fakeReturns.result1, fakeReturns.result2
}
func (fake *FileSystemSupport) GetInstantiationPolicyCallCount() int {
fake.getInstantiationPolicyMutex.RLock()
defer fake.getInstantiationPolicyMutex.RUnlock()
return len(fake.getInstantiationPolicyArgsForCall)
}
func (fake *FileSystemSupport) GetInstantiationPolicyCalls(stub func(string, ccprovider.CCPackage) ([]byte, error)) {
fake.getInstantiationPolicyMutex.Lock()
defer fake.getInstantiationPolicyMutex.Unlock()
fake.GetInstantiationPolicyStub = stub
}
func (fake *FileSystemSupport) GetInstantiationPolicyArgsForCall(i int) (string, ccprovider.CCPackage) {
fake.getInstantiationPolicyMutex.RLock()
defer fake.getInstantiationPolicyMutex.RUnlock()
argsForCall := fake.getInstantiationPolicyArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2
}
func (fake *FileSystemSupport) GetInstantiationPolicyReturns(result1 []byte, result2 error) {
fake.getInstantiationPolicyMutex.Lock()
defer fake.getInstantiationPolicyMutex.Unlock()
fake.GetInstantiationPolicyStub = nil
fake.getInstantiationPolicyReturns = struct {
result1 []byte
result2 error
}{result1, result2}
}
func (fake *FileSystemSupport) GetInstantiationPolicyReturnsOnCall(i int, result1 []byte, result2 error) {
fake.getInstantiationPolicyMutex.Lock()
defer fake.getInstantiationPolicyMutex.Unlock()
fake.GetInstantiationPolicyStub = nil
if fake.getInstantiationPolicyReturnsOnCall == nil {
fake.getInstantiationPolicyReturnsOnCall = make(map[int]struct {
result1 []byte
result2 error
})
}
fake.getInstantiationPolicyReturnsOnCall[i] = struct {
result1 []byte
result2 error
}{result1, result2}
}
func (fake *FileSystemSupport) PutChaincodeToLocalStorage(arg1 ccprovider.CCPackage) error {
fake.putChaincodeToLocalStorageMutex.Lock()
ret, specificReturn := fake.putChaincodeToLocalStorageReturnsOnCall[len(fake.putChaincodeToLocalStorageArgsForCall)]
fake.putChaincodeToLocalStorageArgsForCall = append(fake.putChaincodeToLocalStorageArgsForCall, struct {
arg1 ccprovider.CCPackage
}{arg1})
fake.recordInvocation("PutChaincodeToLocalStorage", []interface{}{arg1})
fake.putChaincodeToLocalStorageMutex.Unlock()
if fake.PutChaincodeToLocalStorageStub != nil {
return fake.PutChaincodeToLocalStorageStub(arg1)
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.putChaincodeToLocalStorageReturns
return fakeReturns.result1
}
func (fake *FileSystemSupport) PutChaincodeToLocalStorageCallCount() int {
fake.putChaincodeToLocalStorageMutex.RLock()
defer fake.putChaincodeToLocalStorageMutex.RUnlock()
return len(fake.putChaincodeToLocalStorageArgsForCall)
}
func (fake *FileSystemSupport) PutChaincodeToLocalStorageCalls(stub func(ccprovider.CCPackage) error) {
fake.putChaincodeToLocalStorageMutex.Lock()
defer fake.putChaincodeToLocalStorageMutex.Unlock()
fake.PutChaincodeToLocalStorageStub = stub
}
func (fake *FileSystemSupport) PutChaincodeToLocalStorageArgsForCall(i int) ccprovider.CCPackage {
fake.putChaincodeToLocalStorageMutex.RLock()
defer fake.putChaincodeToLocalStorageMutex.RUnlock()
argsForCall := fake.putChaincodeToLocalStorageArgsForCall[i]
return argsForCall.arg1
}
func (fake *FileSystemSupport) PutChaincodeToLocalStorageReturns(result1 error) {
fake.putChaincodeToLocalStorageMutex.Lock()
defer fake.putChaincodeToLocalStorageMutex.Unlock()
fake.PutChaincodeToLocalStorageStub = nil
fake.putChaincodeToLocalStorageReturns = struct {
result1 error
}{result1}
}
func (fake *FileSystemSupport) PutChaincodeToLocalStorageReturnsOnCall(i int, result1 error) {
fake.putChaincodeToLocalStorageMutex.Lock()
defer fake.putChaincodeToLocalStorageMutex.Unlock()
fake.PutChaincodeToLocalStorageStub = nil
if fake.putChaincodeToLocalStorageReturnsOnCall == nil {
fake.putChaincodeToLocalStorageReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.putChaincodeToLocalStorageReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FileSystemSupport) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.checkInstantiationPolicyMutex.RLock()
defer fake.checkInstantiationPolicyMutex.RUnlock()
fake.getChaincodeFromLocalStorageMutex.RLock()
defer fake.getChaincodeFromLocalStorageMutex.RUnlock()
fake.getChaincodesFromLocalStorageMutex.RLock()
defer fake.getChaincodesFromLocalStorageMutex.RUnlock()
fake.getInstantiationPolicyMutex.RLock()
defer fake.getInstantiationPolicyMutex.RUnlock()
fake.putChaincodeToLocalStorageMutex.RLock()
defer fake.putChaincodeToLocalStorageMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FileSystemSupport) recordInvocation(key string, args []interface{}) {
fake.invocationsMutex.Lock()
defer fake.invocationsMutex.Unlock()
if fake.invocations == nil {
fake.invocations = map[string][][]interface{}{}
}
if fake.invocations[key] == nil {
fake.invocations[key] = [][]interface{}{}
}
fake.invocations[key] = append(fake.invocations[key], args)
}