-
Notifications
You must be signed in to change notification settings - Fork 161
/
fake_reporter.go
139 lines (124 loc) · 3.93 KB
/
fake_reporter.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
// Code generated by counterfeiter. DO NOT EDIT.
package taskfakes
import (
"sync"
"github.com/cloudfoundry/bosh-cli/ui/task"
)
type FakeReporter struct {
TaskStartedStub func(int)
taskStartedMutex sync.RWMutex
taskStartedArgsForCall []struct {
arg1 int
}
TaskFinishedStub func(int, string)
taskFinishedMutex sync.RWMutex
taskFinishedArgsForCall []struct {
arg1 int
arg2 string
}
TaskOutputChunkStub func(int, []byte)
taskOutputChunkMutex sync.RWMutex
taskOutputChunkArgsForCall []struct {
arg1 int
arg2 []byte
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeReporter) TaskStarted(arg1 int) {
fake.taskStartedMutex.Lock()
fake.taskStartedArgsForCall = append(fake.taskStartedArgsForCall, struct {
arg1 int
}{arg1})
fake.recordInvocation("TaskStarted", []interface{}{arg1})
fake.taskStartedMutex.Unlock()
if fake.TaskStartedStub != nil {
fake.TaskStartedStub(arg1)
}
}
func (fake *FakeReporter) TaskStartedCallCount() int {
fake.taskStartedMutex.RLock()
defer fake.taskStartedMutex.RUnlock()
return len(fake.taskStartedArgsForCall)
}
func (fake *FakeReporter) TaskStartedArgsForCall(i int) int {
fake.taskStartedMutex.RLock()
defer fake.taskStartedMutex.RUnlock()
return fake.taskStartedArgsForCall[i].arg1
}
func (fake *FakeReporter) TaskFinished(arg1 int, arg2 string) {
fake.taskFinishedMutex.Lock()
fake.taskFinishedArgsForCall = append(fake.taskFinishedArgsForCall, struct {
arg1 int
arg2 string
}{arg1, arg2})
fake.recordInvocation("TaskFinished", []interface{}{arg1, arg2})
fake.taskFinishedMutex.Unlock()
if fake.TaskFinishedStub != nil {
fake.TaskFinishedStub(arg1, arg2)
}
}
func (fake *FakeReporter) TaskFinishedCallCount() int {
fake.taskFinishedMutex.RLock()
defer fake.taskFinishedMutex.RUnlock()
return len(fake.taskFinishedArgsForCall)
}
func (fake *FakeReporter) TaskFinishedArgsForCall(i int) (int, string) {
fake.taskFinishedMutex.RLock()
defer fake.taskFinishedMutex.RUnlock()
return fake.taskFinishedArgsForCall[i].arg1, fake.taskFinishedArgsForCall[i].arg2
}
func (fake *FakeReporter) TaskOutputChunk(arg1 int, arg2 []byte) {
var arg2Copy []byte
if arg2 != nil {
arg2Copy = make([]byte, len(arg2))
copy(arg2Copy, arg2)
}
fake.taskOutputChunkMutex.Lock()
fake.taskOutputChunkArgsForCall = append(fake.taskOutputChunkArgsForCall, struct {
arg1 int
arg2 []byte
}{arg1, arg2Copy})
fake.recordInvocation("TaskOutputChunk", []interface{}{arg1, arg2Copy})
fake.taskOutputChunkMutex.Unlock()
if fake.TaskOutputChunkStub != nil {
fake.TaskOutputChunkStub(arg1, arg2)
}
}
func (fake *FakeReporter) TaskOutputChunkCallCount() int {
fake.taskOutputChunkMutex.RLock()
defer fake.taskOutputChunkMutex.RUnlock()
return len(fake.taskOutputChunkArgsForCall)
}
func (fake *FakeReporter) TaskOutputChunkArgsForCall(i int) (int, []byte) {
fake.taskOutputChunkMutex.RLock()
defer fake.taskOutputChunkMutex.RUnlock()
return fake.taskOutputChunkArgsForCall[i].arg1, fake.taskOutputChunkArgsForCall[i].arg2
}
func (fake *FakeReporter) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.taskStartedMutex.RLock()
defer fake.taskStartedMutex.RUnlock()
fake.taskFinishedMutex.RLock()
defer fake.taskFinishedMutex.RUnlock()
fake.taskOutputChunkMutex.RLock()
defer fake.taskOutputChunkMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakeReporter) 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 _ task.Reporter = new(FakeReporter)