-
Notifications
You must be signed in to change notification settings - Fork 0
/
platform.go
558 lines (513 loc) · 16.5 KB
/
platform.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
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
// Code generated by counterfeiter. DO NOT EDIT.
package mock
import (
tar "archive/tar"
sync "sync"
platforms "github.com/hyperledger/fabric/core/chaincode/platforms"
)
type Platform struct {
GenerateDockerBuildStub func(string, []byte, *tar.Writer) error
generateDockerBuildMutex sync.RWMutex
generateDockerBuildArgsForCall []struct {
arg1 string
arg2 []byte
arg3 *tar.Writer
}
generateDockerBuildReturns struct {
result1 error
}
generateDockerBuildReturnsOnCall map[int]struct {
result1 error
}
GenerateDockerfileStub func() (string, error)
generateDockerfileMutex sync.RWMutex
generateDockerfileArgsForCall []struct {
}
generateDockerfileReturns struct {
result1 string
result2 error
}
generateDockerfileReturnsOnCall map[int]struct {
result1 string
result2 error
}
GetDeploymentPayloadStub func(string) ([]byte, error)
getDeploymentPayloadMutex sync.RWMutex
getDeploymentPayloadArgsForCall []struct {
arg1 string
}
getDeploymentPayloadReturns struct {
result1 []byte
result2 error
}
getDeploymentPayloadReturnsOnCall map[int]struct {
result1 []byte
result2 error
}
GetMetadataProviderStub func([]byte) platforms.MetadataProvider
getMetadataProviderMutex sync.RWMutex
getMetadataProviderArgsForCall []struct {
arg1 []byte
}
getMetadataProviderReturns struct {
result1 platforms.MetadataProvider
}
getMetadataProviderReturnsOnCall map[int]struct {
result1 platforms.MetadataProvider
}
NameStub func() string
nameMutex sync.RWMutex
nameArgsForCall []struct {
}
nameReturns struct {
result1 string
}
nameReturnsOnCall map[int]struct {
result1 string
}
ValidateCodePackageStub func([]byte) error
validateCodePackageMutex sync.RWMutex
validateCodePackageArgsForCall []struct {
arg1 []byte
}
validateCodePackageReturns struct {
result1 error
}
validateCodePackageReturnsOnCall map[int]struct {
result1 error
}
ValidatePathStub func(string) error
validatePathMutex sync.RWMutex
validatePathArgsForCall []struct {
arg1 string
}
validatePathReturns struct {
result1 error
}
validatePathReturnsOnCall map[int]struct {
result1 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *Platform) GenerateDockerBuild(arg1 string, arg2 []byte, arg3 *tar.Writer) error {
var arg2Copy []byte
if arg2 != nil {
arg2Copy = make([]byte, len(arg2))
copy(arg2Copy, arg2)
}
fake.generateDockerBuildMutex.Lock()
ret, specificReturn := fake.generateDockerBuildReturnsOnCall[len(fake.generateDockerBuildArgsForCall)]
fake.generateDockerBuildArgsForCall = append(fake.generateDockerBuildArgsForCall, struct {
arg1 string
arg2 []byte
arg3 *tar.Writer
}{arg1, arg2Copy, arg3})
fake.recordInvocation("GenerateDockerBuild", []interface{}{arg1, arg2Copy, arg3})
fake.generateDockerBuildMutex.Unlock()
if fake.GenerateDockerBuildStub != nil {
return fake.GenerateDockerBuildStub(arg1, arg2, arg3)
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.generateDockerBuildReturns
return fakeReturns.result1
}
func (fake *Platform) GenerateDockerBuildCallCount() int {
fake.generateDockerBuildMutex.RLock()
defer fake.generateDockerBuildMutex.RUnlock()
return len(fake.generateDockerBuildArgsForCall)
}
func (fake *Platform) GenerateDockerBuildCalls(stub func(string, []byte, *tar.Writer) error) {
fake.generateDockerBuildMutex.Lock()
defer fake.generateDockerBuildMutex.Unlock()
fake.GenerateDockerBuildStub = stub
}
func (fake *Platform) GenerateDockerBuildArgsForCall(i int) (string, []byte, *tar.Writer) {
fake.generateDockerBuildMutex.RLock()
defer fake.generateDockerBuildMutex.RUnlock()
argsForCall := fake.generateDockerBuildArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
}
func (fake *Platform) GenerateDockerBuildReturns(result1 error) {
fake.generateDockerBuildMutex.Lock()
defer fake.generateDockerBuildMutex.Unlock()
fake.GenerateDockerBuildStub = nil
fake.generateDockerBuildReturns = struct {
result1 error
}{result1}
}
func (fake *Platform) GenerateDockerBuildReturnsOnCall(i int, result1 error) {
fake.generateDockerBuildMutex.Lock()
defer fake.generateDockerBuildMutex.Unlock()
fake.GenerateDockerBuildStub = nil
if fake.generateDockerBuildReturnsOnCall == nil {
fake.generateDockerBuildReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.generateDockerBuildReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *Platform) GenerateDockerfile() (string, error) {
fake.generateDockerfileMutex.Lock()
ret, specificReturn := fake.generateDockerfileReturnsOnCall[len(fake.generateDockerfileArgsForCall)]
fake.generateDockerfileArgsForCall = append(fake.generateDockerfileArgsForCall, struct {
}{})
fake.recordInvocation("GenerateDockerfile", []interface{}{})
fake.generateDockerfileMutex.Unlock()
if fake.GenerateDockerfileStub != nil {
return fake.GenerateDockerfileStub()
}
if specificReturn {
return ret.result1, ret.result2
}
fakeReturns := fake.generateDockerfileReturns
return fakeReturns.result1, fakeReturns.result2
}
func (fake *Platform) GenerateDockerfileCallCount() int {
fake.generateDockerfileMutex.RLock()
defer fake.generateDockerfileMutex.RUnlock()
return len(fake.generateDockerfileArgsForCall)
}
func (fake *Platform) GenerateDockerfileCalls(stub func() (string, error)) {
fake.generateDockerfileMutex.Lock()
defer fake.generateDockerfileMutex.Unlock()
fake.GenerateDockerfileStub = stub
}
func (fake *Platform) GenerateDockerfileReturns(result1 string, result2 error) {
fake.generateDockerfileMutex.Lock()
defer fake.generateDockerfileMutex.Unlock()
fake.GenerateDockerfileStub = nil
fake.generateDockerfileReturns = struct {
result1 string
result2 error
}{result1, result2}
}
func (fake *Platform) GenerateDockerfileReturnsOnCall(i int, result1 string, result2 error) {
fake.generateDockerfileMutex.Lock()
defer fake.generateDockerfileMutex.Unlock()
fake.GenerateDockerfileStub = nil
if fake.generateDockerfileReturnsOnCall == nil {
fake.generateDockerfileReturnsOnCall = make(map[int]struct {
result1 string
result2 error
})
}
fake.generateDockerfileReturnsOnCall[i] = struct {
result1 string
result2 error
}{result1, result2}
}
func (fake *Platform) GetDeploymentPayload(arg1 string) ([]byte, error) {
fake.getDeploymentPayloadMutex.Lock()
ret, specificReturn := fake.getDeploymentPayloadReturnsOnCall[len(fake.getDeploymentPayloadArgsForCall)]
fake.getDeploymentPayloadArgsForCall = append(fake.getDeploymentPayloadArgsForCall, struct {
arg1 string
}{arg1})
fake.recordInvocation("GetDeploymentPayload", []interface{}{arg1})
fake.getDeploymentPayloadMutex.Unlock()
if fake.GetDeploymentPayloadStub != nil {
return fake.GetDeploymentPayloadStub(arg1)
}
if specificReturn {
return ret.result1, ret.result2
}
fakeReturns := fake.getDeploymentPayloadReturns
return fakeReturns.result1, fakeReturns.result2
}
func (fake *Platform) GetDeploymentPayloadCallCount() int {
fake.getDeploymentPayloadMutex.RLock()
defer fake.getDeploymentPayloadMutex.RUnlock()
return len(fake.getDeploymentPayloadArgsForCall)
}
func (fake *Platform) GetDeploymentPayloadCalls(stub func(string) ([]byte, error)) {
fake.getDeploymentPayloadMutex.Lock()
defer fake.getDeploymentPayloadMutex.Unlock()
fake.GetDeploymentPayloadStub = stub
}
func (fake *Platform) GetDeploymentPayloadArgsForCall(i int) string {
fake.getDeploymentPayloadMutex.RLock()
defer fake.getDeploymentPayloadMutex.RUnlock()
argsForCall := fake.getDeploymentPayloadArgsForCall[i]
return argsForCall.arg1
}
func (fake *Platform) GetDeploymentPayloadReturns(result1 []byte, result2 error) {
fake.getDeploymentPayloadMutex.Lock()
defer fake.getDeploymentPayloadMutex.Unlock()
fake.GetDeploymentPayloadStub = nil
fake.getDeploymentPayloadReturns = struct {
result1 []byte
result2 error
}{result1, result2}
}
func (fake *Platform) GetDeploymentPayloadReturnsOnCall(i int, result1 []byte, result2 error) {
fake.getDeploymentPayloadMutex.Lock()
defer fake.getDeploymentPayloadMutex.Unlock()
fake.GetDeploymentPayloadStub = nil
if fake.getDeploymentPayloadReturnsOnCall == nil {
fake.getDeploymentPayloadReturnsOnCall = make(map[int]struct {
result1 []byte
result2 error
})
}
fake.getDeploymentPayloadReturnsOnCall[i] = struct {
result1 []byte
result2 error
}{result1, result2}
}
func (fake *Platform) GetMetadataProvider(arg1 []byte) platforms.MetadataProvider {
var arg1Copy []byte
if arg1 != nil {
arg1Copy = make([]byte, len(arg1))
copy(arg1Copy, arg1)
}
fake.getMetadataProviderMutex.Lock()
ret, specificReturn := fake.getMetadataProviderReturnsOnCall[len(fake.getMetadataProviderArgsForCall)]
fake.getMetadataProviderArgsForCall = append(fake.getMetadataProviderArgsForCall, struct {
arg1 []byte
}{arg1Copy})
fake.recordInvocation("GetMetadataProvider", []interface{}{arg1Copy})
fake.getMetadataProviderMutex.Unlock()
if fake.GetMetadataProviderStub != nil {
return fake.GetMetadataProviderStub(arg1)
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.getMetadataProviderReturns
return fakeReturns.result1
}
func (fake *Platform) GetMetadataProviderCallCount() int {
fake.getMetadataProviderMutex.RLock()
defer fake.getMetadataProviderMutex.RUnlock()
return len(fake.getMetadataProviderArgsForCall)
}
func (fake *Platform) GetMetadataProviderCalls(stub func([]byte) platforms.MetadataProvider) {
fake.getMetadataProviderMutex.Lock()
defer fake.getMetadataProviderMutex.Unlock()
fake.GetMetadataProviderStub = stub
}
func (fake *Platform) GetMetadataProviderArgsForCall(i int) []byte {
fake.getMetadataProviderMutex.RLock()
defer fake.getMetadataProviderMutex.RUnlock()
argsForCall := fake.getMetadataProviderArgsForCall[i]
return argsForCall.arg1
}
func (fake *Platform) GetMetadataProviderReturns(result1 platforms.MetadataProvider) {
fake.getMetadataProviderMutex.Lock()
defer fake.getMetadataProviderMutex.Unlock()
fake.GetMetadataProviderStub = nil
fake.getMetadataProviderReturns = struct {
result1 platforms.MetadataProvider
}{result1}
}
func (fake *Platform) GetMetadataProviderReturnsOnCall(i int, result1 platforms.MetadataProvider) {
fake.getMetadataProviderMutex.Lock()
defer fake.getMetadataProviderMutex.Unlock()
fake.GetMetadataProviderStub = nil
if fake.getMetadataProviderReturnsOnCall == nil {
fake.getMetadataProviderReturnsOnCall = make(map[int]struct {
result1 platforms.MetadataProvider
})
}
fake.getMetadataProviderReturnsOnCall[i] = struct {
result1 platforms.MetadataProvider
}{result1}
}
func (fake *Platform) Name() string {
fake.nameMutex.Lock()
ret, specificReturn := fake.nameReturnsOnCall[len(fake.nameArgsForCall)]
fake.nameArgsForCall = append(fake.nameArgsForCall, struct {
}{})
fake.recordInvocation("Name", []interface{}{})
fake.nameMutex.Unlock()
if fake.NameStub != nil {
return fake.NameStub()
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.nameReturns
return fakeReturns.result1
}
func (fake *Platform) NameCallCount() int {
fake.nameMutex.RLock()
defer fake.nameMutex.RUnlock()
return len(fake.nameArgsForCall)
}
func (fake *Platform) NameCalls(stub func() string) {
fake.nameMutex.Lock()
defer fake.nameMutex.Unlock()
fake.NameStub = stub
}
func (fake *Platform) NameReturns(result1 string) {
fake.nameMutex.Lock()
defer fake.nameMutex.Unlock()
fake.NameStub = nil
fake.nameReturns = struct {
result1 string
}{result1}
}
func (fake *Platform) NameReturnsOnCall(i int, result1 string) {
fake.nameMutex.Lock()
defer fake.nameMutex.Unlock()
fake.NameStub = nil
if fake.nameReturnsOnCall == nil {
fake.nameReturnsOnCall = make(map[int]struct {
result1 string
})
}
fake.nameReturnsOnCall[i] = struct {
result1 string
}{result1}
}
func (fake *Platform) ValidateCodePackage(arg1 []byte) error {
var arg1Copy []byte
if arg1 != nil {
arg1Copy = make([]byte, len(arg1))
copy(arg1Copy, arg1)
}
fake.validateCodePackageMutex.Lock()
ret, specificReturn := fake.validateCodePackageReturnsOnCall[len(fake.validateCodePackageArgsForCall)]
fake.validateCodePackageArgsForCall = append(fake.validateCodePackageArgsForCall, struct {
arg1 []byte
}{arg1Copy})
fake.recordInvocation("ValidateCodePackage", []interface{}{arg1Copy})
fake.validateCodePackageMutex.Unlock()
if fake.ValidateCodePackageStub != nil {
return fake.ValidateCodePackageStub(arg1)
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.validateCodePackageReturns
return fakeReturns.result1
}
func (fake *Platform) ValidateCodePackageCallCount() int {
fake.validateCodePackageMutex.RLock()
defer fake.validateCodePackageMutex.RUnlock()
return len(fake.validateCodePackageArgsForCall)
}
func (fake *Platform) ValidateCodePackageCalls(stub func([]byte) error) {
fake.validateCodePackageMutex.Lock()
defer fake.validateCodePackageMutex.Unlock()
fake.ValidateCodePackageStub = stub
}
func (fake *Platform) ValidateCodePackageArgsForCall(i int) []byte {
fake.validateCodePackageMutex.RLock()
defer fake.validateCodePackageMutex.RUnlock()
argsForCall := fake.validateCodePackageArgsForCall[i]
return argsForCall.arg1
}
func (fake *Platform) ValidateCodePackageReturns(result1 error) {
fake.validateCodePackageMutex.Lock()
defer fake.validateCodePackageMutex.Unlock()
fake.ValidateCodePackageStub = nil
fake.validateCodePackageReturns = struct {
result1 error
}{result1}
}
func (fake *Platform) ValidateCodePackageReturnsOnCall(i int, result1 error) {
fake.validateCodePackageMutex.Lock()
defer fake.validateCodePackageMutex.Unlock()
fake.ValidateCodePackageStub = nil
if fake.validateCodePackageReturnsOnCall == nil {
fake.validateCodePackageReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.validateCodePackageReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *Platform) ValidatePath(arg1 string) error {
fake.validatePathMutex.Lock()
ret, specificReturn := fake.validatePathReturnsOnCall[len(fake.validatePathArgsForCall)]
fake.validatePathArgsForCall = append(fake.validatePathArgsForCall, struct {
arg1 string
}{arg1})
fake.recordInvocation("ValidatePath", []interface{}{arg1})
fake.validatePathMutex.Unlock()
if fake.ValidatePathStub != nil {
return fake.ValidatePathStub(arg1)
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.validatePathReturns
return fakeReturns.result1
}
func (fake *Platform) ValidatePathCallCount() int {
fake.validatePathMutex.RLock()
defer fake.validatePathMutex.RUnlock()
return len(fake.validatePathArgsForCall)
}
func (fake *Platform) ValidatePathCalls(stub func(string) error) {
fake.validatePathMutex.Lock()
defer fake.validatePathMutex.Unlock()
fake.ValidatePathStub = stub
}
func (fake *Platform) ValidatePathArgsForCall(i int) string {
fake.validatePathMutex.RLock()
defer fake.validatePathMutex.RUnlock()
argsForCall := fake.validatePathArgsForCall[i]
return argsForCall.arg1
}
func (fake *Platform) ValidatePathReturns(result1 error) {
fake.validatePathMutex.Lock()
defer fake.validatePathMutex.Unlock()
fake.ValidatePathStub = nil
fake.validatePathReturns = struct {
result1 error
}{result1}
}
func (fake *Platform) ValidatePathReturnsOnCall(i int, result1 error) {
fake.validatePathMutex.Lock()
defer fake.validatePathMutex.Unlock()
fake.ValidatePathStub = nil
if fake.validatePathReturnsOnCall == nil {
fake.validatePathReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.validatePathReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *Platform) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.generateDockerBuildMutex.RLock()
defer fake.generateDockerBuildMutex.RUnlock()
fake.generateDockerfileMutex.RLock()
defer fake.generateDockerfileMutex.RUnlock()
fake.getDeploymentPayloadMutex.RLock()
defer fake.getDeploymentPayloadMutex.RUnlock()
fake.getMetadataProviderMutex.RLock()
defer fake.getMetadataProviderMutex.RUnlock()
fake.nameMutex.RLock()
defer fake.nameMutex.RUnlock()
fake.validateCodePackageMutex.RLock()
defer fake.validateCodePackageMutex.RUnlock()
fake.validatePathMutex.RLock()
defer fake.validatePathMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *Platform) 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)
}