forked from cloudfoundry/guardian
-
Notifications
You must be signed in to change notification settings - Fork 1
/
fake_config_store.go
140 lines (126 loc) · 3.59 KB
/
fake_config_store.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
// Code generated by counterfeiter. DO NOT EDIT.
package kawasakifakes
import (
"sync"
"code.cloudfoundry.org/guardian/kawasaki"
)
type FakeConfigStore struct {
SetStub func(handle string, name string, value string)
setMutex sync.RWMutex
setArgsForCall []struct {
handle string
name string
value string
}
GetStub func(handle string, name string) (string, bool)
getMutex sync.RWMutex
getArgsForCall []struct {
handle string
name string
}
getReturns struct {
result1 string
result2 bool
}
getReturnsOnCall map[int]struct {
result1 string
result2 bool
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeConfigStore) Set(handle string, name string, value string) {
fake.setMutex.Lock()
fake.setArgsForCall = append(fake.setArgsForCall, struct {
handle string
name string
value string
}{handle, name, value})
fake.recordInvocation("Set", []interface{}{handle, name, value})
fake.setMutex.Unlock()
if fake.SetStub != nil {
fake.SetStub(handle, name, value)
}
}
func (fake *FakeConfigStore) SetCallCount() int {
fake.setMutex.RLock()
defer fake.setMutex.RUnlock()
return len(fake.setArgsForCall)
}
func (fake *FakeConfigStore) SetArgsForCall(i int) (string, string, string) {
fake.setMutex.RLock()
defer fake.setMutex.RUnlock()
return fake.setArgsForCall[i].handle, fake.setArgsForCall[i].name, fake.setArgsForCall[i].value
}
func (fake *FakeConfigStore) Get(handle string, name string) (string, bool) {
fake.getMutex.Lock()
ret, specificReturn := fake.getReturnsOnCall[len(fake.getArgsForCall)]
fake.getArgsForCall = append(fake.getArgsForCall, struct {
handle string
name string
}{handle, name})
fake.recordInvocation("Get", []interface{}{handle, name})
fake.getMutex.Unlock()
if fake.GetStub != nil {
return fake.GetStub(handle, name)
}
if specificReturn {
return ret.result1, ret.result2
}
return fake.getReturns.result1, fake.getReturns.result2
}
func (fake *FakeConfigStore) GetCallCount() int {
fake.getMutex.RLock()
defer fake.getMutex.RUnlock()
return len(fake.getArgsForCall)
}
func (fake *FakeConfigStore) GetArgsForCall(i int) (string, string) {
fake.getMutex.RLock()
defer fake.getMutex.RUnlock()
return fake.getArgsForCall[i].handle, fake.getArgsForCall[i].name
}
func (fake *FakeConfigStore) GetReturns(result1 string, result2 bool) {
fake.GetStub = nil
fake.getReturns = struct {
result1 string
result2 bool
}{result1, result2}
}
func (fake *FakeConfigStore) GetReturnsOnCall(i int, result1 string, result2 bool) {
fake.GetStub = nil
if fake.getReturnsOnCall == nil {
fake.getReturnsOnCall = make(map[int]struct {
result1 string
result2 bool
})
}
fake.getReturnsOnCall[i] = struct {
result1 string
result2 bool
}{result1, result2}
}
func (fake *FakeConfigStore) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.setMutex.RLock()
defer fake.setMutex.RUnlock()
fake.getMutex.RLock()
defer fake.getMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakeConfigStore) 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 _ kawasaki.ConfigStore = new(FakeConfigStore)