github.com/cloudfoundry-attic/cli-with-i18n@v6.32.1-0.20171002233121-7401370d3b85+incompatible/cf/commands/application/applicationfakes/fake_stopper.go (about) 1 // This file was generated by counterfeiter 2 package applicationfakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/commandregistry" 8 "code.cloudfoundry.org/cli/cf/commands/application" 9 "code.cloudfoundry.org/cli/cf/flags" 10 "code.cloudfoundry.org/cli/cf/models" 11 "code.cloudfoundry.org/cli/cf/requirements" 12 ) 13 14 type FakeStopper struct { 15 MetaDataStub func() commandregistry.CommandMetadata 16 metaDataMutex sync.RWMutex 17 metaDataArgsForCall []struct{} 18 metaDataReturns struct { 19 result1 commandregistry.CommandMetadata 20 } 21 SetDependencyStub func(deps commandregistry.Dependency, pluginCall bool) commandregistry.Command 22 setDependencyMutex sync.RWMutex 23 setDependencyArgsForCall []struct { 24 deps commandregistry.Dependency 25 pluginCall bool 26 } 27 setDependencyReturns struct { 28 result1 commandregistry.Command 29 } 30 RequirementsStub func(requirementsFactory requirements.Factory, context flags.FlagContext) ([]requirements.Requirement, error) 31 requirementsMutex sync.RWMutex 32 requirementsArgsForCall []struct { 33 requirementsFactory requirements.Factory 34 context flags.FlagContext 35 } 36 requirementsReturns struct { 37 result1 []requirements.Requirement 38 result2 error 39 } 40 ExecuteStub func(context flags.FlagContext) error 41 executeMutex sync.RWMutex 42 executeArgsForCall []struct { 43 context flags.FlagContext 44 } 45 executeReturns struct { 46 result1 error 47 } 48 ApplicationStopStub func(app models.Application, orgName string, spaceName string) (updatedApp models.Application, err error) 49 applicationStopMutex sync.RWMutex 50 applicationStopArgsForCall []struct { 51 app models.Application 52 orgName string 53 spaceName string 54 } 55 applicationStopReturns struct { 56 result1 models.Application 57 result2 error 58 } 59 invocations map[string][][]interface{} 60 invocationsMutex sync.RWMutex 61 } 62 63 func (fake *FakeStopper) MetaData() commandregistry.CommandMetadata { 64 fake.metaDataMutex.Lock() 65 fake.metaDataArgsForCall = append(fake.metaDataArgsForCall, struct{}{}) 66 fake.recordInvocation("MetaData", []interface{}{}) 67 fake.metaDataMutex.Unlock() 68 if fake.MetaDataStub != nil { 69 return fake.MetaDataStub() 70 } else { 71 return fake.metaDataReturns.result1 72 } 73 } 74 75 func (fake *FakeStopper) MetaDataCallCount() int { 76 fake.metaDataMutex.RLock() 77 defer fake.metaDataMutex.RUnlock() 78 return len(fake.metaDataArgsForCall) 79 } 80 81 func (fake *FakeStopper) MetaDataReturns(result1 commandregistry.CommandMetadata) { 82 fake.MetaDataStub = nil 83 fake.metaDataReturns = struct { 84 result1 commandregistry.CommandMetadata 85 }{result1} 86 } 87 88 func (fake *FakeStopper) SetDependency(deps commandregistry.Dependency, pluginCall bool) commandregistry.Command { 89 fake.setDependencyMutex.Lock() 90 fake.setDependencyArgsForCall = append(fake.setDependencyArgsForCall, struct { 91 deps commandregistry.Dependency 92 pluginCall bool 93 }{deps, pluginCall}) 94 fake.recordInvocation("SetDependency", []interface{}{deps, pluginCall}) 95 fake.setDependencyMutex.Unlock() 96 if fake.SetDependencyStub != nil { 97 return fake.SetDependencyStub(deps, pluginCall) 98 } else { 99 return fake.setDependencyReturns.result1 100 } 101 } 102 103 func (fake *FakeStopper) SetDependencyCallCount() int { 104 fake.setDependencyMutex.RLock() 105 defer fake.setDependencyMutex.RUnlock() 106 return len(fake.setDependencyArgsForCall) 107 } 108 109 func (fake *FakeStopper) SetDependencyArgsForCall(i int) (commandregistry.Dependency, bool) { 110 fake.setDependencyMutex.RLock() 111 defer fake.setDependencyMutex.RUnlock() 112 return fake.setDependencyArgsForCall[i].deps, fake.setDependencyArgsForCall[i].pluginCall 113 } 114 115 func (fake *FakeStopper) SetDependencyReturns(result1 commandregistry.Command) { 116 fake.SetDependencyStub = nil 117 fake.setDependencyReturns = struct { 118 result1 commandregistry.Command 119 }{result1} 120 } 121 122 func (fake *FakeStopper) Requirements(requirementsFactory requirements.Factory, context flags.FlagContext) ([]requirements.Requirement, error) { 123 fake.requirementsMutex.Lock() 124 fake.requirementsArgsForCall = append(fake.requirementsArgsForCall, struct { 125 requirementsFactory requirements.Factory 126 context flags.FlagContext 127 }{requirementsFactory, context}) 128 fake.recordInvocation("Requirements", []interface{}{requirementsFactory, context}) 129 fake.requirementsMutex.Unlock() 130 if fake.RequirementsStub != nil { 131 return fake.RequirementsStub(requirementsFactory, context) 132 } else { 133 return fake.requirementsReturns.result1, fake.requirementsReturns.result2 134 } 135 } 136 137 func (fake *FakeStopper) RequirementsCallCount() int { 138 fake.requirementsMutex.RLock() 139 defer fake.requirementsMutex.RUnlock() 140 return len(fake.requirementsArgsForCall) 141 } 142 143 func (fake *FakeStopper) RequirementsArgsForCall(i int) (requirements.Factory, flags.FlagContext) { 144 fake.requirementsMutex.RLock() 145 defer fake.requirementsMutex.RUnlock() 146 return fake.requirementsArgsForCall[i].requirementsFactory, fake.requirementsArgsForCall[i].context 147 } 148 149 func (fake *FakeStopper) RequirementsReturns(result1 []requirements.Requirement, result2 error) { 150 fake.RequirementsStub = nil 151 fake.requirementsReturns = struct { 152 result1 []requirements.Requirement 153 result2 error 154 }{result1, result2} 155 } 156 157 func (fake *FakeStopper) Execute(context flags.FlagContext) error { 158 fake.executeMutex.Lock() 159 fake.executeArgsForCall = append(fake.executeArgsForCall, struct { 160 context flags.FlagContext 161 }{context}) 162 fake.recordInvocation("Execute", []interface{}{context}) 163 fake.executeMutex.Unlock() 164 if fake.ExecuteStub != nil { 165 return fake.ExecuteStub(context) 166 } else { 167 return fake.executeReturns.result1 168 } 169 } 170 171 func (fake *FakeStopper) ExecuteCallCount() int { 172 fake.executeMutex.RLock() 173 defer fake.executeMutex.RUnlock() 174 return len(fake.executeArgsForCall) 175 } 176 177 func (fake *FakeStopper) ExecuteArgsForCall(i int) flags.FlagContext { 178 fake.executeMutex.RLock() 179 defer fake.executeMutex.RUnlock() 180 return fake.executeArgsForCall[i].context 181 } 182 183 func (fake *FakeStopper) ExecuteReturns(result1 error) { 184 fake.ExecuteStub = nil 185 fake.executeReturns = struct { 186 result1 error 187 }{result1} 188 } 189 190 func (fake *FakeStopper) ApplicationStop(app models.Application, orgName string, spaceName string) (updatedApp models.Application, err error) { 191 fake.applicationStopMutex.Lock() 192 fake.applicationStopArgsForCall = append(fake.applicationStopArgsForCall, struct { 193 app models.Application 194 orgName string 195 spaceName string 196 }{app, orgName, spaceName}) 197 fake.recordInvocation("ApplicationStop", []interface{}{app, orgName, spaceName}) 198 fake.applicationStopMutex.Unlock() 199 if fake.ApplicationStopStub != nil { 200 return fake.ApplicationStopStub(app, orgName, spaceName) 201 } else { 202 return fake.applicationStopReturns.result1, fake.applicationStopReturns.result2 203 } 204 } 205 206 func (fake *FakeStopper) ApplicationStopCallCount() int { 207 fake.applicationStopMutex.RLock() 208 defer fake.applicationStopMutex.RUnlock() 209 return len(fake.applicationStopArgsForCall) 210 } 211 212 func (fake *FakeStopper) ApplicationStopArgsForCall(i int) (models.Application, string, string) { 213 fake.applicationStopMutex.RLock() 214 defer fake.applicationStopMutex.RUnlock() 215 return fake.applicationStopArgsForCall[i].app, fake.applicationStopArgsForCall[i].orgName, fake.applicationStopArgsForCall[i].spaceName 216 } 217 218 func (fake *FakeStopper) ApplicationStopReturns(result1 models.Application, result2 error) { 219 fake.ApplicationStopStub = nil 220 fake.applicationStopReturns = struct { 221 result1 models.Application 222 result2 error 223 }{result1, result2} 224 } 225 226 func (fake *FakeStopper) Invocations() map[string][][]interface{} { 227 fake.invocationsMutex.RLock() 228 defer fake.invocationsMutex.RUnlock() 229 fake.metaDataMutex.RLock() 230 defer fake.metaDataMutex.RUnlock() 231 fake.setDependencyMutex.RLock() 232 defer fake.setDependencyMutex.RUnlock() 233 fake.requirementsMutex.RLock() 234 defer fake.requirementsMutex.RUnlock() 235 fake.executeMutex.RLock() 236 defer fake.executeMutex.RUnlock() 237 fake.applicationStopMutex.RLock() 238 defer fake.applicationStopMutex.RUnlock() 239 return fake.invocations 240 } 241 242 func (fake *FakeStopper) recordInvocation(key string, args []interface{}) { 243 fake.invocationsMutex.Lock() 244 defer fake.invocationsMutex.Unlock() 245 if fake.invocations == nil { 246 fake.invocations = map[string][][]interface{}{} 247 } 248 if fake.invocations[key] == nil { 249 fake.invocations[key] = [][]interface{}{} 250 } 251 fake.invocations[key] = append(fake.invocations[key], args) 252 } 253 254 var _ application.Stopper = new(FakeStopper)