github.com/cloudfoundry-attic/cli-with-i18n@v6.32.1-0.20171002233121-7401370d3b85+incompatible/cf/commands/route/routefakes/old_fake_route_creator.go (about) 1 package routefakes 2 3 import ( 4 "sync" 5 6 "code.cloudfoundry.org/cli/cf/commandregistry" 7 "code.cloudfoundry.org/cli/cf/commands/route" 8 "code.cloudfoundry.org/cli/cf/flags" 9 "code.cloudfoundry.org/cli/cf/models" 10 "code.cloudfoundry.org/cli/cf/requirements" 11 ) 12 13 type OldFakeRouteCreator struct { 14 CreateRouteStub func(hostName string, path string, port int, randomPort bool, domain models.DomainFields, space models.SpaceFields) (route models.Route, apiErr error) 15 createRouteMutex sync.RWMutex 16 createRouteArgsForCall []struct { 17 hostName string 18 path string 19 port int 20 randomPort bool 21 domain models.DomainFields 22 space models.SpaceFields 23 } 24 createRouteReturns struct { 25 result1 models.Route 26 result2 error 27 } 28 } 29 30 func (fake *OldFakeRouteCreator) CreateRoute(hostName string, path string, port int, randomPort bool, domain models.DomainFields, space models.SpaceFields) (route models.Route, apiErr error) { 31 fake.createRouteMutex.Lock() 32 fake.createRouteArgsForCall = append(fake.createRouteArgsForCall, struct { 33 hostName string 34 path string 35 port int 36 randomPort bool 37 domain models.DomainFields 38 space models.SpaceFields 39 }{hostName, path, port, randomPort, domain, space}) 40 fake.createRouteMutex.Unlock() 41 if fake.CreateRouteStub != nil { 42 return fake.CreateRouteStub(hostName, path, port, randomPort, domain, space) 43 } else { 44 return fake.createRouteReturns.result1, fake.createRouteReturns.result2 45 } 46 } 47 48 func (fake *OldFakeRouteCreator) CreateRouteCallCount() int { 49 fake.createRouteMutex.RLock() 50 defer fake.createRouteMutex.RUnlock() 51 return len(fake.createRouteArgsForCall) 52 } 53 54 func (fake *OldFakeRouteCreator) CreateRouteArgsForCall(i int) (string, string, int, bool, models.DomainFields, models.SpaceFields) { 55 fake.createRouteMutex.RLock() 56 defer fake.createRouteMutex.RUnlock() 57 return fake.createRouteArgsForCall[i].hostName, fake.createRouteArgsForCall[i].path, fake.createRouteArgsForCall[i].port, fake.createRouteArgsForCall[i].randomPort, fake.createRouteArgsForCall[i].domain, fake.createRouteArgsForCall[i].space 58 } 59 60 func (fake *OldFakeRouteCreator) CreateRouteReturns(result1 models.Route, result2 error) { 61 fake.CreateRouteStub = nil 62 fake.createRouteReturns = struct { 63 result1 models.Route 64 result2 error 65 }{result1, result2} 66 } 67 68 func (cmd *OldFakeRouteCreator) MetaData() commandregistry.CommandMetadata { 69 return commandregistry.CommandMetadata{Name: "create-route"} 70 } 71 72 func (cmd *OldFakeRouteCreator) SetDependency(_ commandregistry.Dependency, _ bool) commandregistry.Command { 73 return cmd 74 } 75 76 func (cmd *OldFakeRouteCreator) Requirements(_ requirements.Factory, _ flags.FlagContext) ([]requirements.Requirement, error) { 77 return []requirements.Requirement{}, nil 78 } 79 80 func (cmd *OldFakeRouteCreator) Execute(_ flags.FlagContext) error { 81 return nil 82 } 83 84 var _ route.Creator = new(OldFakeRouteCreator)