forked from vmware-archive/atc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_tracker.go
158 lines (144 loc) · 6 KB
/
fake_tracker.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
// This file was generated by counterfeiter
package resourcefakes
import (
"sync"
"code.cloudfoundry.org/lager"
"github.com/concourse/atc"
"github.com/concourse/atc/resource"
"github.com/concourse/atc/worker"
)
type FakeTracker struct {
InitStub func(lager.Logger, resource.Metadata, resource.Session, resource.ResourceType, atc.Tags, int, atc.ResourceTypes, worker.ImageFetchingDelegate) (resource.Resource, error)
initMutex sync.RWMutex
initArgsForCall []struct {
arg1 lager.Logger
arg2 resource.Metadata
arg3 resource.Session
arg4 resource.ResourceType
arg5 atc.Tags
arg6 int
arg7 atc.ResourceTypes
arg8 worker.ImageFetchingDelegate
}
initReturns struct {
result1 resource.Resource
result2 error
}
InitWithSourcesStub func(lager.Logger, resource.Metadata, resource.Session, resource.ResourceType, atc.Tags, int, map[string]resource.ArtifactSource, atc.ResourceTypes, worker.ImageFetchingDelegate) (resource.Resource, []string, error)
initWithSourcesMutex sync.RWMutex
initWithSourcesArgsForCall []struct {
arg1 lager.Logger
arg2 resource.Metadata
arg3 resource.Session
arg4 resource.ResourceType
arg5 atc.Tags
arg6 int
arg7 map[string]resource.ArtifactSource
arg8 atc.ResourceTypes
arg9 worker.ImageFetchingDelegate
}
initWithSourcesReturns struct {
result1 resource.Resource
result2 []string
result3 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeTracker) Init(arg1 lager.Logger, arg2 resource.Metadata, arg3 resource.Session, arg4 resource.ResourceType, arg5 atc.Tags, arg6 int, arg7 atc.ResourceTypes, arg8 worker.ImageFetchingDelegate) (resource.Resource, error) {
fake.initMutex.Lock()
fake.initArgsForCall = append(fake.initArgsForCall, struct {
arg1 lager.Logger
arg2 resource.Metadata
arg3 resource.Session
arg4 resource.ResourceType
arg5 atc.Tags
arg6 int
arg7 atc.ResourceTypes
arg8 worker.ImageFetchingDelegate
}{arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8})
fake.recordInvocation("Init", []interface{}{arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8})
fake.initMutex.Unlock()
if fake.InitStub != nil {
return fake.InitStub(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
} else {
return fake.initReturns.result1, fake.initReturns.result2
}
}
func (fake *FakeTracker) InitCallCount() int {
fake.initMutex.RLock()
defer fake.initMutex.RUnlock()
return len(fake.initArgsForCall)
}
func (fake *FakeTracker) InitArgsForCall(i int) (lager.Logger, resource.Metadata, resource.Session, resource.ResourceType, atc.Tags, int, atc.ResourceTypes, worker.ImageFetchingDelegate) {
fake.initMutex.RLock()
defer fake.initMutex.RUnlock()
return fake.initArgsForCall[i].arg1, fake.initArgsForCall[i].arg2, fake.initArgsForCall[i].arg3, fake.initArgsForCall[i].arg4, fake.initArgsForCall[i].arg5, fake.initArgsForCall[i].arg6, fake.initArgsForCall[i].arg7, fake.initArgsForCall[i].arg8
}
func (fake *FakeTracker) InitReturns(result1 resource.Resource, result2 error) {
fake.InitStub = nil
fake.initReturns = struct {
result1 resource.Resource
result2 error
}{result1, result2}
}
func (fake *FakeTracker) InitWithSources(arg1 lager.Logger, arg2 resource.Metadata, arg3 resource.Session, arg4 resource.ResourceType, arg5 atc.Tags, arg6 int, arg7 map[string]resource.ArtifactSource, arg8 atc.ResourceTypes, arg9 worker.ImageFetchingDelegate) (resource.Resource, []string, error) {
fake.initWithSourcesMutex.Lock()
fake.initWithSourcesArgsForCall = append(fake.initWithSourcesArgsForCall, struct {
arg1 lager.Logger
arg2 resource.Metadata
arg3 resource.Session
arg4 resource.ResourceType
arg5 atc.Tags
arg6 int
arg7 map[string]resource.ArtifactSource
arg8 atc.ResourceTypes
arg9 worker.ImageFetchingDelegate
}{arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9})
fake.recordInvocation("InitWithSources", []interface{}{arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9})
fake.initWithSourcesMutex.Unlock()
if fake.InitWithSourcesStub != nil {
return fake.InitWithSourcesStub(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
} else {
return fake.initWithSourcesReturns.result1, fake.initWithSourcesReturns.result2, fake.initWithSourcesReturns.result3
}
}
func (fake *FakeTracker) InitWithSourcesCallCount() int {
fake.initWithSourcesMutex.RLock()
defer fake.initWithSourcesMutex.RUnlock()
return len(fake.initWithSourcesArgsForCall)
}
func (fake *FakeTracker) InitWithSourcesArgsForCall(i int) (lager.Logger, resource.Metadata, resource.Session, resource.ResourceType, atc.Tags, int, map[string]resource.ArtifactSource, atc.ResourceTypes, worker.ImageFetchingDelegate) {
fake.initWithSourcesMutex.RLock()
defer fake.initWithSourcesMutex.RUnlock()
return fake.initWithSourcesArgsForCall[i].arg1, fake.initWithSourcesArgsForCall[i].arg2, fake.initWithSourcesArgsForCall[i].arg3, fake.initWithSourcesArgsForCall[i].arg4, fake.initWithSourcesArgsForCall[i].arg5, fake.initWithSourcesArgsForCall[i].arg6, fake.initWithSourcesArgsForCall[i].arg7, fake.initWithSourcesArgsForCall[i].arg8, fake.initWithSourcesArgsForCall[i].arg9
}
func (fake *FakeTracker) InitWithSourcesReturns(result1 resource.Resource, result2 []string, result3 error) {
fake.InitWithSourcesStub = nil
fake.initWithSourcesReturns = struct {
result1 resource.Resource
result2 []string
result3 error
}{result1, result2, result3}
}
func (fake *FakeTracker) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.initMutex.RLock()
defer fake.initMutex.RUnlock()
fake.initWithSourcesMutex.RLock()
defer fake.initWithSourcesMutex.RUnlock()
return fake.invocations
}
func (fake *FakeTracker) 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 _ resource.Tracker = new(FakeTracker)