github.com/cloudfoundry-attic/cli-with-i18n@v6.32.1-0.20171002233121-7401370d3b85+incompatible/cf/commands/application/applicationfakes/fake_restarter.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 FakeRestarter 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 ApplicationRestartStub func(app models.Application, orgName string, spaceName string) error 49 applicationRestartMutex sync.RWMutex 50 applicationRestartArgsForCall []struct { 51 app models.Application 52 orgName string 53 spaceName string 54 } 55 applicationRestartReturns struct { 56 result1 error 57 } 58 invocations map[string][][]interface{} 59 invocationsMutex sync.RWMutex 60 } 61 62 func (fake *FakeRestarter) MetaData() commandregistry.CommandMetadata { 63 fake.metaDataMutex.Lock() 64 fake.metaDataArgsForCall = append(fake.metaDataArgsForCall, struct{}{}) 65 fake.recordInvocation("MetaData", []interface{}{}) 66 fake.metaDataMutex.Unlock() 67 if fake.MetaDataStub != nil { 68 return fake.MetaDataStub() 69 } else { 70 return fake.metaDataReturns.result1 71 } 72 } 73 74 func (fake *FakeRestarter) MetaDataCallCount() int { 75 fake.metaDataMutex.RLock() 76 defer fake.metaDataMutex.RUnlock() 77 return len(fake.metaDataArgsForCall) 78 } 79 80 func (fake *FakeRestarter) MetaDataReturns(result1 commandregistry.CommandMetadata) { 81 fake.MetaDataStub = nil 82 fake.metaDataReturns = struct { 83 result1 commandregistry.CommandMetadata 84 }{result1} 85 } 86 87 func (fake *FakeRestarter) SetDependency(deps commandregistry.Dependency, pluginCall bool) commandregistry.Command { 88 fake.setDependencyMutex.Lock() 89 fake.setDependencyArgsForCall = append(fake.setDependencyArgsForCall, struct { 90 deps commandregistry.Dependency 91 pluginCall bool 92 }{deps, pluginCall}) 93 fake.recordInvocation("SetDependency", []interface{}{deps, pluginCall}) 94 fake.setDependencyMutex.Unlock() 95 if fake.SetDependencyStub != nil { 96 return fake.SetDependencyStub(deps, pluginCall) 97 } else { 98 return fake.setDependencyReturns.result1 99 } 100 } 101 102 func (fake *FakeRestarter) SetDependencyCallCount() int { 103 fake.setDependencyMutex.RLock() 104 defer fake.setDependencyMutex.RUnlock() 105 return len(fake.setDependencyArgsForCall) 106 } 107 108 func (fake *FakeRestarter) SetDependencyArgsForCall(i int) (commandregistry.Dependency, bool) { 109 fake.setDependencyMutex.RLock() 110 defer fake.setDependencyMutex.RUnlock() 111 return fake.setDependencyArgsForCall[i].deps, fake.setDependencyArgsForCall[i].pluginCall 112 } 113 114 func (fake *FakeRestarter) SetDependencyReturns(result1 commandregistry.Command) { 115 fake.SetDependencyStub = nil 116 fake.setDependencyReturns = struct { 117 result1 commandregistry.Command 118 }{result1} 119 } 120 121 func (fake *FakeRestarter) Requirements(requirementsFactory requirements.Factory, context flags.FlagContext) ([]requirements.Requirement, error) { 122 fake.requirementsMutex.Lock() 123 fake.requirementsArgsForCall = append(fake.requirementsArgsForCall, struct { 124 requirementsFactory requirements.Factory 125 context flags.FlagContext 126 }{requirementsFactory, context}) 127 fake.recordInvocation("Requirements", []interface{}{requirementsFactory, context}) 128 fake.requirementsMutex.Unlock() 129 if fake.RequirementsStub != nil { 130 return fake.RequirementsStub(requirementsFactory, context) 131 } else { 132 return fake.requirementsReturns.result1, fake.requirementsReturns.result2 133 } 134 } 135 136 func (fake *FakeRestarter) RequirementsCallCount() int { 137 fake.requirementsMutex.RLock() 138 defer fake.requirementsMutex.RUnlock() 139 return len(fake.requirementsArgsForCall) 140 } 141 142 func (fake *FakeRestarter) RequirementsArgsForCall(i int) (requirements.Factory, flags.FlagContext) { 143 fake.requirementsMutex.RLock() 144 defer fake.requirementsMutex.RUnlock() 145 return fake.requirementsArgsForCall[i].requirementsFactory, fake.requirementsArgsForCall[i].context 146 } 147 148 func (fake *FakeRestarter) RequirementsReturns(result1 []requirements.Requirement, result2 error) { 149 fake.RequirementsStub = nil 150 fake.requirementsReturns = struct { 151 result1 []requirements.Requirement 152 result2 error 153 }{result1, result2} 154 } 155 156 func (fake *FakeRestarter) Execute(context flags.FlagContext) error { 157 fake.executeMutex.Lock() 158 fake.executeArgsForCall = append(fake.executeArgsForCall, struct { 159 context flags.FlagContext 160 }{context}) 161 fake.recordInvocation("Execute", []interface{}{context}) 162 fake.executeMutex.Unlock() 163 if fake.ExecuteStub != nil { 164 return fake.ExecuteStub(context) 165 } else { 166 return fake.executeReturns.result1 167 } 168 } 169 170 func (fake *FakeRestarter) ExecuteCallCount() int { 171 fake.executeMutex.RLock() 172 defer fake.executeMutex.RUnlock() 173 return len(fake.executeArgsForCall) 174 } 175 176 func (fake *FakeRestarter) ExecuteArgsForCall(i int) flags.FlagContext { 177 fake.executeMutex.RLock() 178 defer fake.executeMutex.RUnlock() 179 return fake.executeArgsForCall[i].context 180 } 181 182 func (fake *FakeRestarter) ExecuteReturns(result1 error) { 183 fake.ExecuteStub = nil 184 fake.executeReturns = struct { 185 result1 error 186 }{result1} 187 } 188 189 func (fake *FakeRestarter) ApplicationRestart(app models.Application, orgName string, spaceName string) error { 190 fake.applicationRestartMutex.Lock() 191 fake.applicationRestartArgsForCall = append(fake.applicationRestartArgsForCall, struct { 192 app models.Application 193 orgName string 194 spaceName string 195 }{app, orgName, spaceName}) 196 fake.recordInvocation("ApplicationRestart", []interface{}{app, orgName, spaceName}) 197 fake.applicationRestartMutex.Unlock() 198 if fake.ApplicationRestartStub != nil { 199 return fake.ApplicationRestartStub(app, orgName, spaceName) 200 } else { 201 return fake.applicationRestartReturns.result1 202 } 203 } 204 205 func (fake *FakeRestarter) ApplicationRestartCallCount() int { 206 fake.applicationRestartMutex.RLock() 207 defer fake.applicationRestartMutex.RUnlock() 208 return len(fake.applicationRestartArgsForCall) 209 } 210 211 func (fake *FakeRestarter) ApplicationRestartArgsForCall(i int) (models.Application, string, string) { 212 fake.applicationRestartMutex.RLock() 213 defer fake.applicationRestartMutex.RUnlock() 214 return fake.applicationRestartArgsForCall[i].app, fake.applicationRestartArgsForCall[i].orgName, fake.applicationRestartArgsForCall[i].spaceName 215 } 216 217 func (fake *FakeRestarter) ApplicationRestartReturns(result1 error) { 218 fake.ApplicationRestartStub = nil 219 fake.applicationRestartReturns = struct { 220 result1 error 221 }{result1} 222 } 223 224 func (fake *FakeRestarter) Invocations() map[string][][]interface{} { 225 fake.invocationsMutex.RLock() 226 defer fake.invocationsMutex.RUnlock() 227 fake.metaDataMutex.RLock() 228 defer fake.metaDataMutex.RUnlock() 229 fake.setDependencyMutex.RLock() 230 defer fake.setDependencyMutex.RUnlock() 231 fake.requirementsMutex.RLock() 232 defer fake.requirementsMutex.RUnlock() 233 fake.executeMutex.RLock() 234 defer fake.executeMutex.RUnlock() 235 fake.applicationRestartMutex.RLock() 236 defer fake.applicationRestartMutex.RUnlock() 237 return fake.invocations 238 } 239 240 func (fake *FakeRestarter) recordInvocation(key string, args []interface{}) { 241 fake.invocationsMutex.Lock() 242 defer fake.invocationsMutex.Unlock() 243 if fake.invocations == nil { 244 fake.invocations = map[string][][]interface{}{} 245 } 246 if fake.invocations[key] == nil { 247 fake.invocations[key] = [][]interface{}{} 248 } 249 fake.invocations[key] = append(fake.invocations[key], args) 250 } 251 252 var _ application.Restarter = new(FakeRestarter)