github.com/cloudfoundry-attic/cli-with-i18n@v6.32.1-0.20171002233121-7401370d3b85+incompatible/cf/commands/route/routefakes/fake_creator.go (about) 1 // This file was generated by counterfeiter 2 package routefakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/commands/route" 8 "code.cloudfoundry.org/cli/cf/models" 9 ) 10 11 type FakeCreator struct { 12 CreateRouteStub func(hostName string, path string, port int, randomPort bool, domain models.DomainFields, space models.SpaceFields) (route models.Route, apiErr error) 13 createRouteMutex sync.RWMutex 14 createRouteArgsForCall []struct { 15 hostName string 16 path string 17 port int 18 randomPort bool 19 domain models.DomainFields 20 space models.SpaceFields 21 } 22 createRouteReturns struct { 23 result1 models.Route 24 result2 error 25 } 26 invocations map[string][][]interface{} 27 invocationsMutex sync.RWMutex 28 } 29 30 func (fake *FakeCreator) 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.recordInvocation("CreateRoute", []interface{}{hostName, path, port, randomPort, domain, space}) 41 fake.createRouteMutex.Unlock() 42 if fake.CreateRouteStub != nil { 43 return fake.CreateRouteStub(hostName, path, port, randomPort, domain, space) 44 } else { 45 return fake.createRouteReturns.result1, fake.createRouteReturns.result2 46 } 47 } 48 49 func (fake *FakeCreator) CreateRouteCallCount() int { 50 fake.createRouteMutex.RLock() 51 defer fake.createRouteMutex.RUnlock() 52 return len(fake.createRouteArgsForCall) 53 } 54 55 func (fake *FakeCreator) CreateRouteArgsForCall(i int) (string, string, int, bool, models.DomainFields, models.SpaceFields) { 56 fake.createRouteMutex.RLock() 57 defer fake.createRouteMutex.RUnlock() 58 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 59 } 60 61 func (fake *FakeCreator) CreateRouteReturns(result1 models.Route, result2 error) { 62 fake.CreateRouteStub = nil 63 fake.createRouteReturns = struct { 64 result1 models.Route 65 result2 error 66 }{result1, result2} 67 } 68 69 func (fake *FakeCreator) Invocations() map[string][][]interface{} { 70 fake.invocationsMutex.RLock() 71 defer fake.invocationsMutex.RUnlock() 72 fake.createRouteMutex.RLock() 73 defer fake.createRouteMutex.RUnlock() 74 return fake.invocations 75 } 76 77 func (fake *FakeCreator) recordInvocation(key string, args []interface{}) { 78 fake.invocationsMutex.Lock() 79 defer fake.invocationsMutex.Unlock() 80 if fake.invocations == nil { 81 fake.invocations = map[string][][]interface{}{} 82 } 83 if fake.invocations[key] == nil { 84 fake.invocations[key] = [][]interface{}{} 85 } 86 fake.invocations[key] = append(fake.invocations[key], args) 87 } 88 89 var _ route.Creator = new(FakeCreator)