-
Notifications
You must be signed in to change notification settings - Fork 162
/
fake_extractor.go
168 lines (150 loc) · 4.77 KB
/
fake_extractor.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
// This file was generated by counterfeiter
package fakeblobextract
import (
"sync"
"github.com/cloudfoundry/bosh-cli/installation/blobextract"
)
type FakeExtractor struct {
ExtractStub func(blobID, blobSHA1, targetDir string) error
extractMutex sync.RWMutex
extractArgsForCall []struct {
blobID string
blobSHA1 string
targetDir string
}
extractReturns struct {
result1 error
}
CleanupStub func(blobID string, extractedBlobPath string) error
cleanupMutex sync.RWMutex
cleanupArgsForCall []struct {
blobID string
extractedBlobPath string
}
cleanupReturns struct {
result1 error
}
ChmodExecutablesStub func(binPath string) error
chmodExecutablesMutex sync.RWMutex
chmodExecutablesArgsForCall []struct {
binPath string
}
chmodExecutablesReturns struct {
result1 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeExtractor) Extract(blobID string, blobSHA1 string, targetDir string) error {
fake.extractMutex.Lock()
fake.extractArgsForCall = append(fake.extractArgsForCall, struct {
blobID string
blobSHA1 string
targetDir string
}{blobID, blobSHA1, targetDir})
fake.recordInvocation("Extract", []interface{}{blobID, blobSHA1, targetDir})
fake.extractMutex.Unlock()
if fake.ExtractStub != nil {
return fake.ExtractStub(blobID, blobSHA1, targetDir)
} else {
return fake.extractReturns.result1
}
}
func (fake *FakeExtractor) ExtractCallCount() int {
fake.extractMutex.RLock()
defer fake.extractMutex.RUnlock()
return len(fake.extractArgsForCall)
}
func (fake *FakeExtractor) ExtractArgsForCall(i int) (string, string, string) {
fake.extractMutex.RLock()
defer fake.extractMutex.RUnlock()
return fake.extractArgsForCall[i].blobID, fake.extractArgsForCall[i].blobSHA1, fake.extractArgsForCall[i].targetDir
}
func (fake *FakeExtractor) ExtractReturns(result1 error) {
fake.ExtractStub = nil
fake.extractReturns = struct {
result1 error
}{result1}
}
func (fake *FakeExtractor) Cleanup(blobID string, extractedBlobPath string) error {
fake.cleanupMutex.Lock()
fake.cleanupArgsForCall = append(fake.cleanupArgsForCall, struct {
blobID string
extractedBlobPath string
}{blobID, extractedBlobPath})
fake.recordInvocation("Cleanup", []interface{}{blobID, extractedBlobPath})
fake.cleanupMutex.Unlock()
if fake.CleanupStub != nil {
return fake.CleanupStub(blobID, extractedBlobPath)
} else {
return fake.cleanupReturns.result1
}
}
func (fake *FakeExtractor) CleanupCallCount() int {
fake.cleanupMutex.RLock()
defer fake.cleanupMutex.RUnlock()
return len(fake.cleanupArgsForCall)
}
func (fake *FakeExtractor) CleanupArgsForCall(i int) (string, string) {
fake.cleanupMutex.RLock()
defer fake.cleanupMutex.RUnlock()
return fake.cleanupArgsForCall[i].blobID, fake.cleanupArgsForCall[i].extractedBlobPath
}
func (fake *FakeExtractor) CleanupReturns(result1 error) {
fake.CleanupStub = nil
fake.cleanupReturns = struct {
result1 error
}{result1}
}
func (fake *FakeExtractor) ChmodExecutables(binPath string) error {
fake.chmodExecutablesMutex.Lock()
fake.chmodExecutablesArgsForCall = append(fake.chmodExecutablesArgsForCall, struct {
binPath string
}{binPath})
fake.recordInvocation("ChmodExecutables", []interface{}{binPath})
fake.chmodExecutablesMutex.Unlock()
if fake.ChmodExecutablesStub != nil {
return fake.ChmodExecutablesStub(binPath)
} else {
return fake.chmodExecutablesReturns.result1
}
}
func (fake *FakeExtractor) ChmodExecutablesCallCount() int {
fake.chmodExecutablesMutex.RLock()
defer fake.chmodExecutablesMutex.RUnlock()
return len(fake.chmodExecutablesArgsForCall)
}
func (fake *FakeExtractor) ChmodExecutablesArgsForCall(i int) string {
fake.chmodExecutablesMutex.RLock()
defer fake.chmodExecutablesMutex.RUnlock()
return fake.chmodExecutablesArgsForCall[i].binPath
}
func (fake *FakeExtractor) ChmodExecutablesReturns(result1 error) {
fake.ChmodExecutablesStub = nil
fake.chmodExecutablesReturns = struct {
result1 error
}{result1}
}
func (fake *FakeExtractor) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.extractMutex.RLock()
defer fake.extractMutex.RUnlock()
fake.cleanupMutex.RLock()
defer fake.cleanupMutex.RUnlock()
fake.chmodExecutablesMutex.RLock()
defer fake.chmodExecutablesMutex.RUnlock()
return fake.invocations
}
func (fake *FakeExtractor) 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)
}
var _ blobextract.Extractor = new(FakeExtractor)