This repository has been archived by the owner on Mar 13, 2021. It is now read-only.
forked from cloudfoundry/guardian
-
Notifications
You must be signed in to change notification settings - Fork 1
/
fake_state_store.go
107 lines (94 loc) · 2.83 KB
/
fake_state_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
// This file was generated by counterfeiter
package rundmcfakes
import (
"sync"
"code.cloudfoundry.org/guardian/rundmc"
)
type FakeStateStore struct {
StoreStoppedStub func(handle string)
storeStoppedMutex sync.RWMutex
storeStoppedArgsForCall []struct {
handle string
}
IsStoppedStub func(handle string) bool
isStoppedMutex sync.RWMutex
isStoppedArgsForCall []struct {
handle string
}
isStoppedReturns struct {
result1 bool
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeStateStore) StoreStopped(handle string) {
fake.storeStoppedMutex.Lock()
fake.storeStoppedArgsForCall = append(fake.storeStoppedArgsForCall, struct {
handle string
}{handle})
fake.recordInvocation("StoreStopped", []interface{}{handle})
fake.storeStoppedMutex.Unlock()
if fake.StoreStoppedStub != nil {
fake.StoreStoppedStub(handle)
}
}
func (fake *FakeStateStore) StoreStoppedCallCount() int {
fake.storeStoppedMutex.RLock()
defer fake.storeStoppedMutex.RUnlock()
return len(fake.storeStoppedArgsForCall)
}
func (fake *FakeStateStore) StoreStoppedArgsForCall(i int) string {
fake.storeStoppedMutex.RLock()
defer fake.storeStoppedMutex.RUnlock()
return fake.storeStoppedArgsForCall[i].handle
}
func (fake *FakeStateStore) IsStopped(handle string) bool {
fake.isStoppedMutex.Lock()
fake.isStoppedArgsForCall = append(fake.isStoppedArgsForCall, struct {
handle string
}{handle})
fake.recordInvocation("IsStopped", []interface{}{handle})
fake.isStoppedMutex.Unlock()
if fake.IsStoppedStub != nil {
return fake.IsStoppedStub(handle)
} else {
return fake.isStoppedReturns.result1
}
}
func (fake *FakeStateStore) IsStoppedCallCount() int {
fake.isStoppedMutex.RLock()
defer fake.isStoppedMutex.RUnlock()
return len(fake.isStoppedArgsForCall)
}
func (fake *FakeStateStore) IsStoppedArgsForCall(i int) string {
fake.isStoppedMutex.RLock()
defer fake.isStoppedMutex.RUnlock()
return fake.isStoppedArgsForCall[i].handle
}
func (fake *FakeStateStore) IsStoppedReturns(result1 bool) {
fake.IsStoppedStub = nil
fake.isStoppedReturns = struct {
result1 bool
}{result1}
}
func (fake *FakeStateStore) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.storeStoppedMutex.RLock()
defer fake.storeStoppedMutex.RUnlock()
fake.isStoppedMutex.RLock()
defer fake.isStoppedMutex.RUnlock()
return fake.invocations
}
func (fake *FakeStateStore) 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 _ rundmc.StateStore = new(FakeStateStore)