forked from vmware-archive/atc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_cache.go
135 lines (120 loc) · 3.55 KB
/
fake_cache.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
// This file was generated by counterfeiter
package resourcefakes
import (
"sync"
"github.com/concourse/atc/resource"
"github.com/concourse/atc/worker"
)
type FakeCache struct {
IsInitializedStub func() (bool, error)
isInitializedMutex sync.RWMutex
isInitializedArgsForCall []struct{}
isInitializedReturns struct {
result1 bool
result2 error
}
InitializeStub func() error
initializeMutex sync.RWMutex
initializeArgsForCall []struct{}
initializeReturns struct {
result1 error
}
VolumeStub func() worker.Volume
volumeMutex sync.RWMutex
volumeArgsForCall []struct{}
volumeReturns struct {
result1 worker.Volume
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeCache) IsInitialized() (bool, error) {
fake.isInitializedMutex.Lock()
fake.isInitializedArgsForCall = append(fake.isInitializedArgsForCall, struct{}{})
fake.recordInvocation("IsInitialized", []interface{}{})
fake.isInitializedMutex.Unlock()
if fake.IsInitializedStub != nil {
return fake.IsInitializedStub()
} else {
return fake.isInitializedReturns.result1, fake.isInitializedReturns.result2
}
}
func (fake *FakeCache) IsInitializedCallCount() int {
fake.isInitializedMutex.RLock()
defer fake.isInitializedMutex.RUnlock()
return len(fake.isInitializedArgsForCall)
}
func (fake *FakeCache) IsInitializedReturns(result1 bool, result2 error) {
fake.IsInitializedStub = nil
fake.isInitializedReturns = struct {
result1 bool
result2 error
}{result1, result2}
}
func (fake *FakeCache) Initialize() error {
fake.initializeMutex.Lock()
fake.initializeArgsForCall = append(fake.initializeArgsForCall, struct{}{})
fake.recordInvocation("Initialize", []interface{}{})
fake.initializeMutex.Unlock()
if fake.InitializeStub != nil {
return fake.InitializeStub()
} else {
return fake.initializeReturns.result1
}
}
func (fake *FakeCache) InitializeCallCount() int {
fake.initializeMutex.RLock()
defer fake.initializeMutex.RUnlock()
return len(fake.initializeArgsForCall)
}
func (fake *FakeCache) InitializeReturns(result1 error) {
fake.InitializeStub = nil
fake.initializeReturns = struct {
result1 error
}{result1}
}
func (fake *FakeCache) Volume() worker.Volume {
fake.volumeMutex.Lock()
fake.volumeArgsForCall = append(fake.volumeArgsForCall, struct{}{})
fake.recordInvocation("Volume", []interface{}{})
fake.volumeMutex.Unlock()
if fake.VolumeStub != nil {
return fake.VolumeStub()
} else {
return fake.volumeReturns.result1
}
}
func (fake *FakeCache) VolumeCallCount() int {
fake.volumeMutex.RLock()
defer fake.volumeMutex.RUnlock()
return len(fake.volumeArgsForCall)
}
func (fake *FakeCache) VolumeReturns(result1 worker.Volume) {
fake.VolumeStub = nil
fake.volumeReturns = struct {
result1 worker.Volume
}{result1}
}
func (fake *FakeCache) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.isInitializedMutex.RLock()
defer fake.isInitializedMutex.RUnlock()
fake.initializeMutex.RLock()
defer fake.initializeMutex.RUnlock()
fake.volumeMutex.RLock()
defer fake.volumeMutex.RUnlock()
return fake.invocations
}
func (fake *FakeCache) 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.Cache = new(FakeCache)