forked from hyperledger/fabric
-
Notifications
You must be signed in to change notification settings - Fork 0
/
system_chaincode_provider.go
271 lines (248 loc) · 9.12 KB
/
system_chaincode_provider.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
// Code generated by counterfeiter. DO NOT EDIT.
package mock
import (
"sync"
"github.com/hyperledger/fabric/common/channelconfig"
"github.com/hyperledger/fabric/common/policies"
"github.com/hyperledger/fabric/core/ledger"
)
type SystemChaincodeProvider struct {
GetApplicationConfigStub func(string) (channelconfig.Application, bool)
getApplicationConfigMutex sync.RWMutex
getApplicationConfigArgsForCall []struct {
arg1 string
}
getApplicationConfigReturns struct {
result1 channelconfig.Application
result2 bool
}
getApplicationConfigReturnsOnCall map[int]struct {
result1 channelconfig.Application
result2 bool
}
GetQueryExecutorForLedgerStub func(string) (ledger.QueryExecutor, error)
getQueryExecutorForLedgerMutex sync.RWMutex
getQueryExecutorForLedgerArgsForCall []struct {
arg1 string
}
getQueryExecutorForLedgerReturns struct {
result1 ledger.QueryExecutor
result2 error
}
getQueryExecutorForLedgerReturnsOnCall map[int]struct {
result1 ledger.QueryExecutor
result2 error
}
PolicyManagerStub func(string) (policies.Manager, bool)
policyManagerMutex sync.RWMutex
policyManagerArgsForCall []struct {
arg1 string
}
policyManagerReturns struct {
result1 policies.Manager
result2 bool
}
policyManagerReturnsOnCall map[int]struct {
result1 policies.Manager
result2 bool
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *SystemChaincodeProvider) GetApplicationConfig(arg1 string) (channelconfig.Application, bool) {
fake.getApplicationConfigMutex.Lock()
ret, specificReturn := fake.getApplicationConfigReturnsOnCall[len(fake.getApplicationConfigArgsForCall)]
fake.getApplicationConfigArgsForCall = append(fake.getApplicationConfigArgsForCall, struct {
arg1 string
}{arg1})
fake.recordInvocation("GetApplicationConfig", []interface{}{arg1})
fake.getApplicationConfigMutex.Unlock()
if fake.GetApplicationConfigStub != nil {
return fake.GetApplicationConfigStub(arg1)
}
if specificReturn {
return ret.result1, ret.result2
}
fakeReturns := fake.getApplicationConfigReturns
return fakeReturns.result1, fakeReturns.result2
}
func (fake *SystemChaincodeProvider) GetApplicationConfigCallCount() int {
fake.getApplicationConfigMutex.RLock()
defer fake.getApplicationConfigMutex.RUnlock()
return len(fake.getApplicationConfigArgsForCall)
}
func (fake *SystemChaincodeProvider) GetApplicationConfigCalls(stub func(string) (channelconfig.Application, bool)) {
fake.getApplicationConfigMutex.Lock()
defer fake.getApplicationConfigMutex.Unlock()
fake.GetApplicationConfigStub = stub
}
func (fake *SystemChaincodeProvider) GetApplicationConfigArgsForCall(i int) string {
fake.getApplicationConfigMutex.RLock()
defer fake.getApplicationConfigMutex.RUnlock()
argsForCall := fake.getApplicationConfigArgsForCall[i]
return argsForCall.arg1
}
func (fake *SystemChaincodeProvider) GetApplicationConfigReturns(result1 channelconfig.Application, result2 bool) {
fake.getApplicationConfigMutex.Lock()
defer fake.getApplicationConfigMutex.Unlock()
fake.GetApplicationConfigStub = nil
fake.getApplicationConfigReturns = struct {
result1 channelconfig.Application
result2 bool
}{result1, result2}
}
func (fake *SystemChaincodeProvider) GetApplicationConfigReturnsOnCall(i int, result1 channelconfig.Application, result2 bool) {
fake.getApplicationConfigMutex.Lock()
defer fake.getApplicationConfigMutex.Unlock()
fake.GetApplicationConfigStub = nil
if fake.getApplicationConfigReturnsOnCall == nil {
fake.getApplicationConfigReturnsOnCall = make(map[int]struct {
result1 channelconfig.Application
result2 bool
})
}
fake.getApplicationConfigReturnsOnCall[i] = struct {
result1 channelconfig.Application
result2 bool
}{result1, result2}
}
func (fake *SystemChaincodeProvider) GetQueryExecutorForLedger(arg1 string) (ledger.QueryExecutor, error) {
fake.getQueryExecutorForLedgerMutex.Lock()
ret, specificReturn := fake.getQueryExecutorForLedgerReturnsOnCall[len(fake.getQueryExecutorForLedgerArgsForCall)]
fake.getQueryExecutorForLedgerArgsForCall = append(fake.getQueryExecutorForLedgerArgsForCall, struct {
arg1 string
}{arg1})
fake.recordInvocation("GetQueryExecutorForLedger", []interface{}{arg1})
fake.getQueryExecutorForLedgerMutex.Unlock()
if fake.GetQueryExecutorForLedgerStub != nil {
return fake.GetQueryExecutorForLedgerStub(arg1)
}
if specificReturn {
return ret.result1, ret.result2
}
fakeReturns := fake.getQueryExecutorForLedgerReturns
return fakeReturns.result1, fakeReturns.result2
}
func (fake *SystemChaincodeProvider) GetQueryExecutorForLedgerCallCount() int {
fake.getQueryExecutorForLedgerMutex.RLock()
defer fake.getQueryExecutorForLedgerMutex.RUnlock()
return len(fake.getQueryExecutorForLedgerArgsForCall)
}
func (fake *SystemChaincodeProvider) GetQueryExecutorForLedgerCalls(stub func(string) (ledger.QueryExecutor, error)) {
fake.getQueryExecutorForLedgerMutex.Lock()
defer fake.getQueryExecutorForLedgerMutex.Unlock()
fake.GetQueryExecutorForLedgerStub = stub
}
func (fake *SystemChaincodeProvider) GetQueryExecutorForLedgerArgsForCall(i int) string {
fake.getQueryExecutorForLedgerMutex.RLock()
defer fake.getQueryExecutorForLedgerMutex.RUnlock()
argsForCall := fake.getQueryExecutorForLedgerArgsForCall[i]
return argsForCall.arg1
}
func (fake *SystemChaincodeProvider) GetQueryExecutorForLedgerReturns(result1 ledger.QueryExecutor, result2 error) {
fake.getQueryExecutorForLedgerMutex.Lock()
defer fake.getQueryExecutorForLedgerMutex.Unlock()
fake.GetQueryExecutorForLedgerStub = nil
fake.getQueryExecutorForLedgerReturns = struct {
result1 ledger.QueryExecutor
result2 error
}{result1, result2}
}
func (fake *SystemChaincodeProvider) GetQueryExecutorForLedgerReturnsOnCall(i int, result1 ledger.QueryExecutor, result2 error) {
fake.getQueryExecutorForLedgerMutex.Lock()
defer fake.getQueryExecutorForLedgerMutex.Unlock()
fake.GetQueryExecutorForLedgerStub = nil
if fake.getQueryExecutorForLedgerReturnsOnCall == nil {
fake.getQueryExecutorForLedgerReturnsOnCall = make(map[int]struct {
result1 ledger.QueryExecutor
result2 error
})
}
fake.getQueryExecutorForLedgerReturnsOnCall[i] = struct {
result1 ledger.QueryExecutor
result2 error
}{result1, result2}
}
func (fake *SystemChaincodeProvider) PolicyManager(arg1 string) (policies.Manager, bool) {
fake.policyManagerMutex.Lock()
ret, specificReturn := fake.policyManagerReturnsOnCall[len(fake.policyManagerArgsForCall)]
fake.policyManagerArgsForCall = append(fake.policyManagerArgsForCall, struct {
arg1 string
}{arg1})
fake.recordInvocation("PolicyManager", []interface{}{arg1})
fake.policyManagerMutex.Unlock()
if fake.PolicyManagerStub != nil {
return fake.PolicyManagerStub(arg1)
}
if specificReturn {
return ret.result1, ret.result2
}
fakeReturns := fake.policyManagerReturns
return fakeReturns.result1, fakeReturns.result2
}
func (fake *SystemChaincodeProvider) PolicyManagerCallCount() int {
fake.policyManagerMutex.RLock()
defer fake.policyManagerMutex.RUnlock()
return len(fake.policyManagerArgsForCall)
}
func (fake *SystemChaincodeProvider) PolicyManagerCalls(stub func(string) (policies.Manager, bool)) {
fake.policyManagerMutex.Lock()
defer fake.policyManagerMutex.Unlock()
fake.PolicyManagerStub = stub
}
func (fake *SystemChaincodeProvider) PolicyManagerArgsForCall(i int) string {
fake.policyManagerMutex.RLock()
defer fake.policyManagerMutex.RUnlock()
argsForCall := fake.policyManagerArgsForCall[i]
return argsForCall.arg1
}
func (fake *SystemChaincodeProvider) PolicyManagerReturns(result1 policies.Manager, result2 bool) {
fake.policyManagerMutex.Lock()
defer fake.policyManagerMutex.Unlock()
fake.PolicyManagerStub = nil
fake.policyManagerReturns = struct {
result1 policies.Manager
result2 bool
}{result1, result2}
}
func (fake *SystemChaincodeProvider) PolicyManagerReturnsOnCall(i int, result1 policies.Manager, result2 bool) {
fake.policyManagerMutex.Lock()
defer fake.policyManagerMutex.Unlock()
fake.PolicyManagerStub = nil
if fake.policyManagerReturnsOnCall == nil {
fake.policyManagerReturnsOnCall = make(map[int]struct {
result1 policies.Manager
result2 bool
})
}
fake.policyManagerReturnsOnCall[i] = struct {
result1 policies.Manager
result2 bool
}{result1, result2}
}
func (fake *SystemChaincodeProvider) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.getApplicationConfigMutex.RLock()
defer fake.getApplicationConfigMutex.RUnlock()
fake.getQueryExecutorForLedgerMutex.RLock()
defer fake.getQueryExecutorForLedgerMutex.RUnlock()
fake.policyManagerMutex.RLock()
defer fake.policyManagerMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *SystemChaincodeProvider) 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)
}