github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/api/cloudcontroller/wrapper/wrapperfakes/fake_token_cache.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package wrapperfakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/api/cloudcontroller/wrapper" 8 ) 9 10 type FakeTokenCache struct { 11 AccessTokenStub func() string 12 accessTokenMutex sync.RWMutex 13 accessTokenArgsForCall []struct{} 14 accessTokenReturns struct { 15 result1 string 16 } 17 accessTokenReturnsOnCall map[int]struct { 18 result1 string 19 } 20 RefreshTokenStub func() string 21 refreshTokenMutex sync.RWMutex 22 refreshTokenArgsForCall []struct{} 23 refreshTokenReturns struct { 24 result1 string 25 } 26 refreshTokenReturnsOnCall map[int]struct { 27 result1 string 28 } 29 SetAccessTokenStub func(token string) 30 setAccessTokenMutex sync.RWMutex 31 setAccessTokenArgsForCall []struct { 32 token string 33 } 34 SetRefreshTokenStub func(token string) 35 setRefreshTokenMutex sync.RWMutex 36 setRefreshTokenArgsForCall []struct { 37 token string 38 } 39 invocations map[string][][]interface{} 40 invocationsMutex sync.RWMutex 41 } 42 43 func (fake *FakeTokenCache) AccessToken() string { 44 fake.accessTokenMutex.Lock() 45 ret, specificReturn := fake.accessTokenReturnsOnCall[len(fake.accessTokenArgsForCall)] 46 fake.accessTokenArgsForCall = append(fake.accessTokenArgsForCall, struct{}{}) 47 fake.recordInvocation("AccessToken", []interface{}{}) 48 fake.accessTokenMutex.Unlock() 49 if fake.AccessTokenStub != nil { 50 return fake.AccessTokenStub() 51 } 52 if specificReturn { 53 return ret.result1 54 } 55 return fake.accessTokenReturns.result1 56 } 57 58 func (fake *FakeTokenCache) AccessTokenCallCount() int { 59 fake.accessTokenMutex.RLock() 60 defer fake.accessTokenMutex.RUnlock() 61 return len(fake.accessTokenArgsForCall) 62 } 63 64 func (fake *FakeTokenCache) AccessTokenReturns(result1 string) { 65 fake.AccessTokenStub = nil 66 fake.accessTokenReturns = struct { 67 result1 string 68 }{result1} 69 } 70 71 func (fake *FakeTokenCache) AccessTokenReturnsOnCall(i int, result1 string) { 72 fake.AccessTokenStub = nil 73 if fake.accessTokenReturnsOnCall == nil { 74 fake.accessTokenReturnsOnCall = make(map[int]struct { 75 result1 string 76 }) 77 } 78 fake.accessTokenReturnsOnCall[i] = struct { 79 result1 string 80 }{result1} 81 } 82 83 func (fake *FakeTokenCache) RefreshToken() string { 84 fake.refreshTokenMutex.Lock() 85 ret, specificReturn := fake.refreshTokenReturnsOnCall[len(fake.refreshTokenArgsForCall)] 86 fake.refreshTokenArgsForCall = append(fake.refreshTokenArgsForCall, struct{}{}) 87 fake.recordInvocation("RefreshToken", []interface{}{}) 88 fake.refreshTokenMutex.Unlock() 89 if fake.RefreshTokenStub != nil { 90 return fake.RefreshTokenStub() 91 } 92 if specificReturn { 93 return ret.result1 94 } 95 return fake.refreshTokenReturns.result1 96 } 97 98 func (fake *FakeTokenCache) RefreshTokenCallCount() int { 99 fake.refreshTokenMutex.RLock() 100 defer fake.refreshTokenMutex.RUnlock() 101 return len(fake.refreshTokenArgsForCall) 102 } 103 104 func (fake *FakeTokenCache) RefreshTokenReturns(result1 string) { 105 fake.RefreshTokenStub = nil 106 fake.refreshTokenReturns = struct { 107 result1 string 108 }{result1} 109 } 110 111 func (fake *FakeTokenCache) RefreshTokenReturnsOnCall(i int, result1 string) { 112 fake.RefreshTokenStub = nil 113 if fake.refreshTokenReturnsOnCall == nil { 114 fake.refreshTokenReturnsOnCall = make(map[int]struct { 115 result1 string 116 }) 117 } 118 fake.refreshTokenReturnsOnCall[i] = struct { 119 result1 string 120 }{result1} 121 } 122 123 func (fake *FakeTokenCache) SetAccessToken(token string) { 124 fake.setAccessTokenMutex.Lock() 125 fake.setAccessTokenArgsForCall = append(fake.setAccessTokenArgsForCall, struct { 126 token string 127 }{token}) 128 fake.recordInvocation("SetAccessToken", []interface{}{token}) 129 fake.setAccessTokenMutex.Unlock() 130 if fake.SetAccessTokenStub != nil { 131 fake.SetAccessTokenStub(token) 132 } 133 } 134 135 func (fake *FakeTokenCache) SetAccessTokenCallCount() int { 136 fake.setAccessTokenMutex.RLock() 137 defer fake.setAccessTokenMutex.RUnlock() 138 return len(fake.setAccessTokenArgsForCall) 139 } 140 141 func (fake *FakeTokenCache) SetAccessTokenArgsForCall(i int) string { 142 fake.setAccessTokenMutex.RLock() 143 defer fake.setAccessTokenMutex.RUnlock() 144 return fake.setAccessTokenArgsForCall[i].token 145 } 146 147 func (fake *FakeTokenCache) SetRefreshToken(token string) { 148 fake.setRefreshTokenMutex.Lock() 149 fake.setRefreshTokenArgsForCall = append(fake.setRefreshTokenArgsForCall, struct { 150 token string 151 }{token}) 152 fake.recordInvocation("SetRefreshToken", []interface{}{token}) 153 fake.setRefreshTokenMutex.Unlock() 154 if fake.SetRefreshTokenStub != nil { 155 fake.SetRefreshTokenStub(token) 156 } 157 } 158 159 func (fake *FakeTokenCache) SetRefreshTokenCallCount() int { 160 fake.setRefreshTokenMutex.RLock() 161 defer fake.setRefreshTokenMutex.RUnlock() 162 return len(fake.setRefreshTokenArgsForCall) 163 } 164 165 func (fake *FakeTokenCache) SetRefreshTokenArgsForCall(i int) string { 166 fake.setRefreshTokenMutex.RLock() 167 defer fake.setRefreshTokenMutex.RUnlock() 168 return fake.setRefreshTokenArgsForCall[i].token 169 } 170 171 func (fake *FakeTokenCache) Invocations() map[string][][]interface{} { 172 fake.invocationsMutex.RLock() 173 defer fake.invocationsMutex.RUnlock() 174 fake.accessTokenMutex.RLock() 175 defer fake.accessTokenMutex.RUnlock() 176 fake.refreshTokenMutex.RLock() 177 defer fake.refreshTokenMutex.RUnlock() 178 fake.setAccessTokenMutex.RLock() 179 defer fake.setAccessTokenMutex.RUnlock() 180 fake.setRefreshTokenMutex.RLock() 181 defer fake.setRefreshTokenMutex.RUnlock() 182 copiedInvocations := map[string][][]interface{}{} 183 for key, value := range fake.invocations { 184 copiedInvocations[key] = value 185 } 186 return copiedInvocations 187 } 188 189 func (fake *FakeTokenCache) recordInvocation(key string, args []interface{}) { 190 fake.invocationsMutex.Lock() 191 defer fake.invocationsMutex.Unlock() 192 if fake.invocations == nil { 193 fake.invocations = map[string][][]interface{}{} 194 } 195 if fake.invocations[key] == nil { 196 fake.invocations[key] = [][]interface{}{} 197 } 198 fake.invocations[key] = append(fake.invocations[key], args) 199 } 200 201 var _ wrapper.TokenCache = new(FakeTokenCache)