-
Notifications
You must be signed in to change notification settings - Fork 0
/
vm.go
182 lines (167 loc) · 5.06 KB
/
vm.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
// Code generated by counterfeiter. DO NOT EDIT.
package mock
import (
"sync"
container_test "github.com/hyperledger/fabric/core/container"
"github.com/hyperledger/fabric/core/container/ccintf"
)
type VM struct {
StartStub func(ccid ccintf.CCID, args []string, env []string, filesToUpload map[string][]byte, builder container_test.Builder) error
startMutex sync.RWMutex
startArgsForCall []struct {
ccid ccintf.CCID
args []string
env []string
filesToUpload map[string][]byte
builder container_test.Builder
}
startReturns struct {
result1 error
}
startReturnsOnCall map[int]struct {
result1 error
}
StopStub func(ccid ccintf.CCID, timeout uint, dontkill bool, dontremove bool) error
stopMutex sync.RWMutex
stopArgsForCall []struct {
ccid ccintf.CCID
timeout uint
dontkill bool
dontremove bool
}
stopReturns struct {
result1 error
}
stopReturnsOnCall map[int]struct {
result1 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *VM) Start(ccid ccintf.CCID, args []string, env []string, filesToUpload map[string][]byte, builder container_test.Builder) error {
var argsCopy []string
if args != nil {
argsCopy = make([]string, len(args))
copy(argsCopy, args)
}
var envCopy []string
if env != nil {
envCopy = make([]string, len(env))
copy(envCopy, env)
}
fake.startMutex.Lock()
ret, specificReturn := fake.startReturnsOnCall[len(fake.startArgsForCall)]
fake.startArgsForCall = append(fake.startArgsForCall, struct {
ccid ccintf.CCID
args []string
env []string
filesToUpload map[string][]byte
builder container_test.Builder
}{ccid, argsCopy, envCopy, filesToUpload, builder})
fake.recordInvocation("Start", []interface{}{ccid, argsCopy, envCopy, filesToUpload, builder})
fake.startMutex.Unlock()
if fake.StartStub != nil {
return fake.StartStub(ccid, args, env, filesToUpload, builder)
}
if specificReturn {
return ret.result1
}
return fake.startReturns.result1
}
func (fake *VM) StartCallCount() int {
fake.startMutex.RLock()
defer fake.startMutex.RUnlock()
return len(fake.startArgsForCall)
}
func (fake *VM) StartArgsForCall(i int) (ccintf.CCID, []string, []string, map[string][]byte, container_test.Builder) {
fake.startMutex.RLock()
defer fake.startMutex.RUnlock()
return fake.startArgsForCall[i].ccid, fake.startArgsForCall[i].args, fake.startArgsForCall[i].env, fake.startArgsForCall[i].filesToUpload, fake.startArgsForCall[i].builder
}
func (fake *VM) StartReturns(result1 error) {
fake.StartStub = nil
fake.startReturns = struct {
result1 error
}{result1}
}
func (fake *VM) StartReturnsOnCall(i int, result1 error) {
fake.StartStub = nil
if fake.startReturnsOnCall == nil {
fake.startReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.startReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *VM) Stop(ccid ccintf.CCID, timeout uint, dontkill bool, dontremove bool) error {
fake.stopMutex.Lock()
ret, specificReturn := fake.stopReturnsOnCall[len(fake.stopArgsForCall)]
fake.stopArgsForCall = append(fake.stopArgsForCall, struct {
ccid ccintf.CCID
timeout uint
dontkill bool
dontremove bool
}{ccid, timeout, dontkill, dontremove})
fake.recordInvocation("Stop", []interface{}{ccid, timeout, dontkill, dontremove})
fake.stopMutex.Unlock()
if fake.StopStub != nil {
return fake.StopStub(ccid, timeout, dontkill, dontremove)
}
if specificReturn {
return ret.result1
}
return fake.stopReturns.result1
}
func (fake *VM) StopCallCount() int {
fake.stopMutex.RLock()
defer fake.stopMutex.RUnlock()
return len(fake.stopArgsForCall)
}
func (fake *VM) StopArgsForCall(i int) (ccintf.CCID, uint, bool, bool) {
fake.stopMutex.RLock()
defer fake.stopMutex.RUnlock()
return fake.stopArgsForCall[i].ccid, fake.stopArgsForCall[i].timeout, fake.stopArgsForCall[i].dontkill, fake.stopArgsForCall[i].dontremove
}
func (fake *VM) StopReturns(result1 error) {
fake.StopStub = nil
fake.stopReturns = struct {
result1 error
}{result1}
}
func (fake *VM) StopReturnsOnCall(i int, result1 error) {
fake.StopStub = nil
if fake.stopReturnsOnCall == nil {
fake.stopReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.stopReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *VM) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.startMutex.RLock()
defer fake.startMutex.RUnlock()
fake.stopMutex.RLock()
defer fake.stopMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *VM) 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)
}