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