forked from hyperledger/fabric
-
Notifications
You must be signed in to change notification settings - Fork 0
/
msp_manager.go
339 lines (311 loc) · 9.36 KB
/
msp_manager.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
// Code generated by counterfeiter. DO NOT EDIT.
package mocks
import (
"sync"
mspa "github.com/hyperledger/fabric-protos-go/msp"
"github.com/hyperledger/fabric/msp"
)
type MSPManager struct {
DeserializeIdentityStub func([]byte) (msp.Identity, error)
deserializeIdentityMutex sync.RWMutex
deserializeIdentityArgsForCall []struct {
arg1 []byte
}
deserializeIdentityReturns struct {
result1 msp.Identity
result2 error
}
deserializeIdentityReturnsOnCall map[int]struct {
result1 msp.Identity
result2 error
}
GetMSPsStub func() (map[string]msp.MSP, error)
getMSPsMutex sync.RWMutex
getMSPsArgsForCall []struct {
}
getMSPsReturns struct {
result1 map[string]msp.MSP
result2 error
}
getMSPsReturnsOnCall map[int]struct {
result1 map[string]msp.MSP
result2 error
}
IsWellFormedStub func(*mspa.SerializedIdentity) error
isWellFormedMutex sync.RWMutex
isWellFormedArgsForCall []struct {
arg1 *mspa.SerializedIdentity
}
isWellFormedReturns struct {
result1 error
}
isWellFormedReturnsOnCall map[int]struct {
result1 error
}
SetupStub func([]msp.MSP) error
setupMutex sync.RWMutex
setupArgsForCall []struct {
arg1 []msp.MSP
}
setupReturns struct {
result1 error
}
setupReturnsOnCall map[int]struct {
result1 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *MSPManager) DeserializeIdentity(arg1 []byte) (msp.Identity, error) {
var arg1Copy []byte
if arg1 != nil {
arg1Copy = make([]byte, len(arg1))
copy(arg1Copy, arg1)
}
fake.deserializeIdentityMutex.Lock()
ret, specificReturn := fake.deserializeIdentityReturnsOnCall[len(fake.deserializeIdentityArgsForCall)]
fake.deserializeIdentityArgsForCall = append(fake.deserializeIdentityArgsForCall, struct {
arg1 []byte
}{arg1Copy})
fake.recordInvocation("DeserializeIdentity", []interface{}{arg1Copy})
fake.deserializeIdentityMutex.Unlock()
if fake.DeserializeIdentityStub != nil {
return fake.DeserializeIdentityStub(arg1)
}
if specificReturn {
return ret.result1, ret.result2
}
fakeReturns := fake.deserializeIdentityReturns
return fakeReturns.result1, fakeReturns.result2
}
func (fake *MSPManager) DeserializeIdentityCallCount() int {
fake.deserializeIdentityMutex.RLock()
defer fake.deserializeIdentityMutex.RUnlock()
return len(fake.deserializeIdentityArgsForCall)
}
func (fake *MSPManager) DeserializeIdentityCalls(stub func([]byte) (msp.Identity, error)) {
fake.deserializeIdentityMutex.Lock()
defer fake.deserializeIdentityMutex.Unlock()
fake.DeserializeIdentityStub = stub
}
func (fake *MSPManager) DeserializeIdentityArgsForCall(i int) []byte {
fake.deserializeIdentityMutex.RLock()
defer fake.deserializeIdentityMutex.RUnlock()
argsForCall := fake.deserializeIdentityArgsForCall[i]
return argsForCall.arg1
}
func (fake *MSPManager) DeserializeIdentityReturns(result1 msp.Identity, result2 error) {
fake.deserializeIdentityMutex.Lock()
defer fake.deserializeIdentityMutex.Unlock()
fake.DeserializeIdentityStub = nil
fake.deserializeIdentityReturns = struct {
result1 msp.Identity
result2 error
}{result1, result2}
}
func (fake *MSPManager) DeserializeIdentityReturnsOnCall(i int, result1 msp.Identity, result2 error) {
fake.deserializeIdentityMutex.Lock()
defer fake.deserializeIdentityMutex.Unlock()
fake.DeserializeIdentityStub = nil
if fake.deserializeIdentityReturnsOnCall == nil {
fake.deserializeIdentityReturnsOnCall = make(map[int]struct {
result1 msp.Identity
result2 error
})
}
fake.deserializeIdentityReturnsOnCall[i] = struct {
result1 msp.Identity
result2 error
}{result1, result2}
}
func (fake *MSPManager) GetMSPs() (map[string]msp.MSP, error) {
fake.getMSPsMutex.Lock()
ret, specificReturn := fake.getMSPsReturnsOnCall[len(fake.getMSPsArgsForCall)]
fake.getMSPsArgsForCall = append(fake.getMSPsArgsForCall, struct {
}{})
fake.recordInvocation("GetMSPs", []interface{}{})
fake.getMSPsMutex.Unlock()
if fake.GetMSPsStub != nil {
return fake.GetMSPsStub()
}
if specificReturn {
return ret.result1, ret.result2
}
fakeReturns := fake.getMSPsReturns
return fakeReturns.result1, fakeReturns.result2
}
func (fake *MSPManager) GetMSPsCallCount() int {
fake.getMSPsMutex.RLock()
defer fake.getMSPsMutex.RUnlock()
return len(fake.getMSPsArgsForCall)
}
func (fake *MSPManager) GetMSPsCalls(stub func() (map[string]msp.MSP, error)) {
fake.getMSPsMutex.Lock()
defer fake.getMSPsMutex.Unlock()
fake.GetMSPsStub = stub
}
func (fake *MSPManager) GetMSPsReturns(result1 map[string]msp.MSP, result2 error) {
fake.getMSPsMutex.Lock()
defer fake.getMSPsMutex.Unlock()
fake.GetMSPsStub = nil
fake.getMSPsReturns = struct {
result1 map[string]msp.MSP
result2 error
}{result1, result2}
}
func (fake *MSPManager) GetMSPsReturnsOnCall(i int, result1 map[string]msp.MSP, result2 error) {
fake.getMSPsMutex.Lock()
defer fake.getMSPsMutex.Unlock()
fake.GetMSPsStub = nil
if fake.getMSPsReturnsOnCall == nil {
fake.getMSPsReturnsOnCall = make(map[int]struct {
result1 map[string]msp.MSP
result2 error
})
}
fake.getMSPsReturnsOnCall[i] = struct {
result1 map[string]msp.MSP
result2 error
}{result1, result2}
}
func (fake *MSPManager) IsWellFormed(arg1 *mspa.SerializedIdentity) error {
fake.isWellFormedMutex.Lock()
ret, specificReturn := fake.isWellFormedReturnsOnCall[len(fake.isWellFormedArgsForCall)]
fake.isWellFormedArgsForCall = append(fake.isWellFormedArgsForCall, struct {
arg1 *mspa.SerializedIdentity
}{arg1})
fake.recordInvocation("IsWellFormed", []interface{}{arg1})
fake.isWellFormedMutex.Unlock()
if fake.IsWellFormedStub != nil {
return fake.IsWellFormedStub(arg1)
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.isWellFormedReturns
return fakeReturns.result1
}
func (fake *MSPManager) IsWellFormedCallCount() int {
fake.isWellFormedMutex.RLock()
defer fake.isWellFormedMutex.RUnlock()
return len(fake.isWellFormedArgsForCall)
}
func (fake *MSPManager) IsWellFormedCalls(stub func(*mspa.SerializedIdentity) error) {
fake.isWellFormedMutex.Lock()
defer fake.isWellFormedMutex.Unlock()
fake.IsWellFormedStub = stub
}
func (fake *MSPManager) IsWellFormedArgsForCall(i int) *mspa.SerializedIdentity {
fake.isWellFormedMutex.RLock()
defer fake.isWellFormedMutex.RUnlock()
argsForCall := fake.isWellFormedArgsForCall[i]
return argsForCall.arg1
}
func (fake *MSPManager) IsWellFormedReturns(result1 error) {
fake.isWellFormedMutex.Lock()
defer fake.isWellFormedMutex.Unlock()
fake.IsWellFormedStub = nil
fake.isWellFormedReturns = struct {
result1 error
}{result1}
}
func (fake *MSPManager) IsWellFormedReturnsOnCall(i int, result1 error) {
fake.isWellFormedMutex.Lock()
defer fake.isWellFormedMutex.Unlock()
fake.IsWellFormedStub = nil
if fake.isWellFormedReturnsOnCall == nil {
fake.isWellFormedReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.isWellFormedReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *MSPManager) Setup(arg1 []msp.MSP) error {
var arg1Copy []msp.MSP
if arg1 != nil {
arg1Copy = make([]msp.MSP, len(arg1))
copy(arg1Copy, arg1)
}
fake.setupMutex.Lock()
ret, specificReturn := fake.setupReturnsOnCall[len(fake.setupArgsForCall)]
fake.setupArgsForCall = append(fake.setupArgsForCall, struct {
arg1 []msp.MSP
}{arg1Copy})
fake.recordInvocation("Setup", []interface{}{arg1Copy})
fake.setupMutex.Unlock()
if fake.SetupStub != nil {
return fake.SetupStub(arg1)
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.setupReturns
return fakeReturns.result1
}
func (fake *MSPManager) SetupCallCount() int {
fake.setupMutex.RLock()
defer fake.setupMutex.RUnlock()
return len(fake.setupArgsForCall)
}
func (fake *MSPManager) SetupCalls(stub func([]msp.MSP) error) {
fake.setupMutex.Lock()
defer fake.setupMutex.Unlock()
fake.SetupStub = stub
}
func (fake *MSPManager) SetupArgsForCall(i int) []msp.MSP {
fake.setupMutex.RLock()
defer fake.setupMutex.RUnlock()
argsForCall := fake.setupArgsForCall[i]
return argsForCall.arg1
}
func (fake *MSPManager) SetupReturns(result1 error) {
fake.setupMutex.Lock()
defer fake.setupMutex.Unlock()
fake.SetupStub = nil
fake.setupReturns = struct {
result1 error
}{result1}
}
func (fake *MSPManager) SetupReturnsOnCall(i int, result1 error) {
fake.setupMutex.Lock()
defer fake.setupMutex.Unlock()
fake.SetupStub = nil
if fake.setupReturnsOnCall == nil {
fake.setupReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.setupReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *MSPManager) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.deserializeIdentityMutex.RLock()
defer fake.deserializeIdentityMutex.RUnlock()
fake.getMSPsMutex.RLock()
defer fake.getMSPsMutex.RUnlock()
fake.isWellFormedMutex.RLock()
defer fake.isWellFormedMutex.RUnlock()
fake.setupMutex.RLock()
defer fake.setupMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *MSPManager) 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)
}