github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/api/stacks/stacksfakes/fake_stack_repository.go (about) 1 // This file was generated by counterfeiter 2 package stacksfakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/api/stacks" 8 "code.cloudfoundry.org/cli/cf/models" 9 ) 10 11 type FakeStackRepository struct { 12 FindByNameStub func(name string) (stack models.Stack, apiErr error) 13 findByNameMutex sync.RWMutex 14 findByNameArgsForCall []struct { 15 name string 16 } 17 findByNameReturns struct { 18 result1 models.Stack 19 result2 error 20 } 21 FindByGUIDStub func(guid string) (models.Stack, error) 22 findByGUIDMutex sync.RWMutex 23 findByGUIDArgsForCall []struct { 24 guid string 25 } 26 findByGUIDReturns struct { 27 result1 models.Stack 28 result2 error 29 } 30 FindAllStub func() (stacks []models.Stack, apiErr error) 31 findAllMutex sync.RWMutex 32 findAllArgsForCall []struct{} 33 findAllReturns struct { 34 result1 []models.Stack 35 result2 error 36 } 37 invocations map[string][][]interface{} 38 invocationsMutex sync.RWMutex 39 } 40 41 func (fake *FakeStackRepository) FindByName(name string) (stack models.Stack, apiErr error) { 42 fake.findByNameMutex.Lock() 43 fake.findByNameArgsForCall = append(fake.findByNameArgsForCall, struct { 44 name string 45 }{name}) 46 fake.recordInvocation("FindByName", []interface{}{name}) 47 fake.findByNameMutex.Unlock() 48 if fake.FindByNameStub != nil { 49 return fake.FindByNameStub(name) 50 } else { 51 return fake.findByNameReturns.result1, fake.findByNameReturns.result2 52 } 53 } 54 55 func (fake *FakeStackRepository) FindByNameCallCount() int { 56 fake.findByNameMutex.RLock() 57 defer fake.findByNameMutex.RUnlock() 58 return len(fake.findByNameArgsForCall) 59 } 60 61 func (fake *FakeStackRepository) FindByNameArgsForCall(i int) string { 62 fake.findByNameMutex.RLock() 63 defer fake.findByNameMutex.RUnlock() 64 return fake.findByNameArgsForCall[i].name 65 } 66 67 func (fake *FakeStackRepository) FindByNameReturns(result1 models.Stack, result2 error) { 68 fake.FindByNameStub = nil 69 fake.findByNameReturns = struct { 70 result1 models.Stack 71 result2 error 72 }{result1, result2} 73 } 74 75 func (fake *FakeStackRepository) FindByGUID(guid string) (models.Stack, error) { 76 fake.findByGUIDMutex.Lock() 77 fake.findByGUIDArgsForCall = append(fake.findByGUIDArgsForCall, struct { 78 guid string 79 }{guid}) 80 fake.recordInvocation("FindByGUID", []interface{}{guid}) 81 fake.findByGUIDMutex.Unlock() 82 if fake.FindByGUIDStub != nil { 83 return fake.FindByGUIDStub(guid) 84 } else { 85 return fake.findByGUIDReturns.result1, fake.findByGUIDReturns.result2 86 } 87 } 88 89 func (fake *FakeStackRepository) FindByGUIDCallCount() int { 90 fake.findByGUIDMutex.RLock() 91 defer fake.findByGUIDMutex.RUnlock() 92 return len(fake.findByGUIDArgsForCall) 93 } 94 95 func (fake *FakeStackRepository) FindByGUIDArgsForCall(i int) string { 96 fake.findByGUIDMutex.RLock() 97 defer fake.findByGUIDMutex.RUnlock() 98 return fake.findByGUIDArgsForCall[i].guid 99 } 100 101 func (fake *FakeStackRepository) FindByGUIDReturns(result1 models.Stack, result2 error) { 102 fake.FindByGUIDStub = nil 103 fake.findByGUIDReturns = struct { 104 result1 models.Stack 105 result2 error 106 }{result1, result2} 107 } 108 109 func (fake *FakeStackRepository) FindAll() (stacks []models.Stack, apiErr error) { 110 fake.findAllMutex.Lock() 111 fake.findAllArgsForCall = append(fake.findAllArgsForCall, struct{}{}) 112 fake.recordInvocation("FindAll", []interface{}{}) 113 fake.findAllMutex.Unlock() 114 if fake.FindAllStub != nil { 115 return fake.FindAllStub() 116 } else { 117 return fake.findAllReturns.result1, fake.findAllReturns.result2 118 } 119 } 120 121 func (fake *FakeStackRepository) FindAllCallCount() int { 122 fake.findAllMutex.RLock() 123 defer fake.findAllMutex.RUnlock() 124 return len(fake.findAllArgsForCall) 125 } 126 127 func (fake *FakeStackRepository) FindAllReturns(result1 []models.Stack, result2 error) { 128 fake.FindAllStub = nil 129 fake.findAllReturns = struct { 130 result1 []models.Stack 131 result2 error 132 }{result1, result2} 133 } 134 135 func (fake *FakeStackRepository) Invocations() map[string][][]interface{} { 136 fake.invocationsMutex.RLock() 137 defer fake.invocationsMutex.RUnlock() 138 fake.findByNameMutex.RLock() 139 defer fake.findByNameMutex.RUnlock() 140 fake.findByGUIDMutex.RLock() 141 defer fake.findByGUIDMutex.RUnlock() 142 fake.findAllMutex.RLock() 143 defer fake.findAllMutex.RUnlock() 144 return fake.invocations 145 } 146 147 func (fake *FakeStackRepository) recordInvocation(key string, args []interface{}) { 148 fake.invocationsMutex.Lock() 149 defer fake.invocationsMutex.Unlock() 150 if fake.invocations == nil { 151 fake.invocations = map[string][][]interface{}{} 152 } 153 if fake.invocations[key] == nil { 154 fake.invocations[key] = [][]interface{}{} 155 } 156 fake.invocations[key] = append(fake.invocations[key], args) 157 } 158 159 var _ stacks.StackRepository = new(FakeStackRepository)