github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/cf/commandregistry/commandregistryfakes/fake_command.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package commandregistryfakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/commandregistry" 8 "code.cloudfoundry.org/cli/cf/flags" 9 "code.cloudfoundry.org/cli/cf/requirements" 10 ) 11 12 type FakeCommand struct { 13 ExecuteStub func(flags.FlagContext) error 14 executeMutex sync.RWMutex 15 executeArgsForCall []struct { 16 arg1 flags.FlagContext 17 } 18 executeReturns struct { 19 result1 error 20 } 21 executeReturnsOnCall map[int]struct { 22 result1 error 23 } 24 MetaDataStub func() commandregistry.CommandMetadata 25 metaDataMutex sync.RWMutex 26 metaDataArgsForCall []struct { 27 } 28 metaDataReturns struct { 29 result1 commandregistry.CommandMetadata 30 } 31 metaDataReturnsOnCall map[int]struct { 32 result1 commandregistry.CommandMetadata 33 } 34 RequirementsStub func(requirements.Factory, flags.FlagContext) ([]requirements.Requirement, error) 35 requirementsMutex sync.RWMutex 36 requirementsArgsForCall []struct { 37 arg1 requirements.Factory 38 arg2 flags.FlagContext 39 } 40 requirementsReturns struct { 41 result1 []requirements.Requirement 42 result2 error 43 } 44 requirementsReturnsOnCall map[int]struct { 45 result1 []requirements.Requirement 46 result2 error 47 } 48 SetDependencyStub func(commandregistry.Dependency, bool) commandregistry.Command 49 setDependencyMutex sync.RWMutex 50 setDependencyArgsForCall []struct { 51 arg1 commandregistry.Dependency 52 arg2 bool 53 } 54 setDependencyReturns struct { 55 result1 commandregistry.Command 56 } 57 setDependencyReturnsOnCall map[int]struct { 58 result1 commandregistry.Command 59 } 60 invocations map[string][][]interface{} 61 invocationsMutex sync.RWMutex 62 } 63 64 func (fake *FakeCommand) Execute(arg1 flags.FlagContext) error { 65 fake.executeMutex.Lock() 66 ret, specificReturn := fake.executeReturnsOnCall[len(fake.executeArgsForCall)] 67 fake.executeArgsForCall = append(fake.executeArgsForCall, struct { 68 arg1 flags.FlagContext 69 }{arg1}) 70 fake.recordInvocation("Execute", []interface{}{arg1}) 71 fake.executeMutex.Unlock() 72 if fake.ExecuteStub != nil { 73 return fake.ExecuteStub(arg1) 74 } 75 if specificReturn { 76 return ret.result1 77 } 78 fakeReturns := fake.executeReturns 79 return fakeReturns.result1 80 } 81 82 func (fake *FakeCommand) ExecuteCallCount() int { 83 fake.executeMutex.RLock() 84 defer fake.executeMutex.RUnlock() 85 return len(fake.executeArgsForCall) 86 } 87 88 func (fake *FakeCommand) ExecuteCalls(stub func(flags.FlagContext) error) { 89 fake.executeMutex.Lock() 90 defer fake.executeMutex.Unlock() 91 fake.ExecuteStub = stub 92 } 93 94 func (fake *FakeCommand) ExecuteArgsForCall(i int) flags.FlagContext { 95 fake.executeMutex.RLock() 96 defer fake.executeMutex.RUnlock() 97 argsForCall := fake.executeArgsForCall[i] 98 return argsForCall.arg1 99 } 100 101 func (fake *FakeCommand) ExecuteReturns(result1 error) { 102 fake.executeMutex.Lock() 103 defer fake.executeMutex.Unlock() 104 fake.ExecuteStub = nil 105 fake.executeReturns = struct { 106 result1 error 107 }{result1} 108 } 109 110 func (fake *FakeCommand) ExecuteReturnsOnCall(i int, result1 error) { 111 fake.executeMutex.Lock() 112 defer fake.executeMutex.Unlock() 113 fake.ExecuteStub = nil 114 if fake.executeReturnsOnCall == nil { 115 fake.executeReturnsOnCall = make(map[int]struct { 116 result1 error 117 }) 118 } 119 fake.executeReturnsOnCall[i] = struct { 120 result1 error 121 }{result1} 122 } 123 124 func (fake *FakeCommand) MetaData() commandregistry.CommandMetadata { 125 fake.metaDataMutex.Lock() 126 ret, specificReturn := fake.metaDataReturnsOnCall[len(fake.metaDataArgsForCall)] 127 fake.metaDataArgsForCall = append(fake.metaDataArgsForCall, struct { 128 }{}) 129 fake.recordInvocation("MetaData", []interface{}{}) 130 fake.metaDataMutex.Unlock() 131 if fake.MetaDataStub != nil { 132 return fake.MetaDataStub() 133 } 134 if specificReturn { 135 return ret.result1 136 } 137 fakeReturns := fake.metaDataReturns 138 return fakeReturns.result1 139 } 140 141 func (fake *FakeCommand) MetaDataCallCount() int { 142 fake.metaDataMutex.RLock() 143 defer fake.metaDataMutex.RUnlock() 144 return len(fake.metaDataArgsForCall) 145 } 146 147 func (fake *FakeCommand) MetaDataCalls(stub func() commandregistry.CommandMetadata) { 148 fake.metaDataMutex.Lock() 149 defer fake.metaDataMutex.Unlock() 150 fake.MetaDataStub = stub 151 } 152 153 func (fake *FakeCommand) MetaDataReturns(result1 commandregistry.CommandMetadata) { 154 fake.metaDataMutex.Lock() 155 defer fake.metaDataMutex.Unlock() 156 fake.MetaDataStub = nil 157 fake.metaDataReturns = struct { 158 result1 commandregistry.CommandMetadata 159 }{result1} 160 } 161 162 func (fake *FakeCommand) MetaDataReturnsOnCall(i int, result1 commandregistry.CommandMetadata) { 163 fake.metaDataMutex.Lock() 164 defer fake.metaDataMutex.Unlock() 165 fake.MetaDataStub = nil 166 if fake.metaDataReturnsOnCall == nil { 167 fake.metaDataReturnsOnCall = make(map[int]struct { 168 result1 commandregistry.CommandMetadata 169 }) 170 } 171 fake.metaDataReturnsOnCall[i] = struct { 172 result1 commandregistry.CommandMetadata 173 }{result1} 174 } 175 176 func (fake *FakeCommand) Requirements(arg1 requirements.Factory, arg2 flags.FlagContext) ([]requirements.Requirement, error) { 177 fake.requirementsMutex.Lock() 178 ret, specificReturn := fake.requirementsReturnsOnCall[len(fake.requirementsArgsForCall)] 179 fake.requirementsArgsForCall = append(fake.requirementsArgsForCall, struct { 180 arg1 requirements.Factory 181 arg2 flags.FlagContext 182 }{arg1, arg2}) 183 fake.recordInvocation("Requirements", []interface{}{arg1, arg2}) 184 fake.requirementsMutex.Unlock() 185 if fake.RequirementsStub != nil { 186 return fake.RequirementsStub(arg1, arg2) 187 } 188 if specificReturn { 189 return ret.result1, ret.result2 190 } 191 fakeReturns := fake.requirementsReturns 192 return fakeReturns.result1, fakeReturns.result2 193 } 194 195 func (fake *FakeCommand) RequirementsCallCount() int { 196 fake.requirementsMutex.RLock() 197 defer fake.requirementsMutex.RUnlock() 198 return len(fake.requirementsArgsForCall) 199 } 200 201 func (fake *FakeCommand) RequirementsCalls(stub func(requirements.Factory, flags.FlagContext) ([]requirements.Requirement, error)) { 202 fake.requirementsMutex.Lock() 203 defer fake.requirementsMutex.Unlock() 204 fake.RequirementsStub = stub 205 } 206 207 func (fake *FakeCommand) RequirementsArgsForCall(i int) (requirements.Factory, flags.FlagContext) { 208 fake.requirementsMutex.RLock() 209 defer fake.requirementsMutex.RUnlock() 210 argsForCall := fake.requirementsArgsForCall[i] 211 return argsForCall.arg1, argsForCall.arg2 212 } 213 214 func (fake *FakeCommand) RequirementsReturns(result1 []requirements.Requirement, result2 error) { 215 fake.requirementsMutex.Lock() 216 defer fake.requirementsMutex.Unlock() 217 fake.RequirementsStub = nil 218 fake.requirementsReturns = struct { 219 result1 []requirements.Requirement 220 result2 error 221 }{result1, result2} 222 } 223 224 func (fake *FakeCommand) RequirementsReturnsOnCall(i int, result1 []requirements.Requirement, result2 error) { 225 fake.requirementsMutex.Lock() 226 defer fake.requirementsMutex.Unlock() 227 fake.RequirementsStub = nil 228 if fake.requirementsReturnsOnCall == nil { 229 fake.requirementsReturnsOnCall = make(map[int]struct { 230 result1 []requirements.Requirement 231 result2 error 232 }) 233 } 234 fake.requirementsReturnsOnCall[i] = struct { 235 result1 []requirements.Requirement 236 result2 error 237 }{result1, result2} 238 } 239 240 func (fake *FakeCommand) SetDependency(arg1 commandregistry.Dependency, arg2 bool) commandregistry.Command { 241 fake.setDependencyMutex.Lock() 242 ret, specificReturn := fake.setDependencyReturnsOnCall[len(fake.setDependencyArgsForCall)] 243 fake.setDependencyArgsForCall = append(fake.setDependencyArgsForCall, struct { 244 arg1 commandregistry.Dependency 245 arg2 bool 246 }{arg1, arg2}) 247 fake.recordInvocation("SetDependency", []interface{}{arg1, arg2}) 248 fake.setDependencyMutex.Unlock() 249 if fake.SetDependencyStub != nil { 250 return fake.SetDependencyStub(arg1, arg2) 251 } 252 if specificReturn { 253 return ret.result1 254 } 255 fakeReturns := fake.setDependencyReturns 256 return fakeReturns.result1 257 } 258 259 func (fake *FakeCommand) SetDependencyCallCount() int { 260 fake.setDependencyMutex.RLock() 261 defer fake.setDependencyMutex.RUnlock() 262 return len(fake.setDependencyArgsForCall) 263 } 264 265 func (fake *FakeCommand) SetDependencyCalls(stub func(commandregistry.Dependency, bool) commandregistry.Command) { 266 fake.setDependencyMutex.Lock() 267 defer fake.setDependencyMutex.Unlock() 268 fake.SetDependencyStub = stub 269 } 270 271 func (fake *FakeCommand) SetDependencyArgsForCall(i int) (commandregistry.Dependency, bool) { 272 fake.setDependencyMutex.RLock() 273 defer fake.setDependencyMutex.RUnlock() 274 argsForCall := fake.setDependencyArgsForCall[i] 275 return argsForCall.arg1, argsForCall.arg2 276 } 277 278 func (fake *FakeCommand) SetDependencyReturns(result1 commandregistry.Command) { 279 fake.setDependencyMutex.Lock() 280 defer fake.setDependencyMutex.Unlock() 281 fake.SetDependencyStub = nil 282 fake.setDependencyReturns = struct { 283 result1 commandregistry.Command 284 }{result1} 285 } 286 287 func (fake *FakeCommand) SetDependencyReturnsOnCall(i int, result1 commandregistry.Command) { 288 fake.setDependencyMutex.Lock() 289 defer fake.setDependencyMutex.Unlock() 290 fake.SetDependencyStub = nil 291 if fake.setDependencyReturnsOnCall == nil { 292 fake.setDependencyReturnsOnCall = make(map[int]struct { 293 result1 commandregistry.Command 294 }) 295 } 296 fake.setDependencyReturnsOnCall[i] = struct { 297 result1 commandregistry.Command 298 }{result1} 299 } 300 301 func (fake *FakeCommand) Invocations() map[string][][]interface{} { 302 fake.invocationsMutex.RLock() 303 defer fake.invocationsMutex.RUnlock() 304 fake.executeMutex.RLock() 305 defer fake.executeMutex.RUnlock() 306 fake.metaDataMutex.RLock() 307 defer fake.metaDataMutex.RUnlock() 308 fake.requirementsMutex.RLock() 309 defer fake.requirementsMutex.RUnlock() 310 fake.setDependencyMutex.RLock() 311 defer fake.setDependencyMutex.RUnlock() 312 copiedInvocations := map[string][][]interface{}{} 313 for key, value := range fake.invocations { 314 copiedInvocations[key] = value 315 } 316 return copiedInvocations 317 } 318 319 func (fake *FakeCommand) recordInvocation(key string, args []interface{}) { 320 fake.invocationsMutex.Lock() 321 defer fake.invocationsMutex.Unlock() 322 if fake.invocations == nil { 323 fake.invocations = map[string][][]interface{}{} 324 } 325 if fake.invocations[key] == nil { 326 fake.invocations[key] = [][]interface{}{} 327 } 328 fake.invocations[key] = append(fake.invocations[key], args) 329 } 330 331 var _ commandregistry.Command = new(FakeCommand)