github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/api/environmentvariablegroups/environmentvariablegroupsfakes/fake_repository.go (about) 1 // This file was generated by counterfeiter 2 package environmentvariablegroupsfakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/api/environmentvariablegroups" 8 "code.cloudfoundry.org/cli/cf/models" 9 ) 10 11 type FakeRepository struct { 12 ListRunningStub func() (variables []models.EnvironmentVariable, apiErr error) 13 listRunningMutex sync.RWMutex 14 listRunningArgsForCall []struct{} 15 listRunningReturns struct { 16 result1 []models.EnvironmentVariable 17 result2 error 18 } 19 ListStagingStub func() (variables []models.EnvironmentVariable, apiErr error) 20 listStagingMutex sync.RWMutex 21 listStagingArgsForCall []struct{} 22 listStagingReturns struct { 23 result1 []models.EnvironmentVariable 24 result2 error 25 } 26 SetStagingStub func(string) error 27 setStagingMutex sync.RWMutex 28 setStagingArgsForCall []struct { 29 arg1 string 30 } 31 setStagingReturns struct { 32 result1 error 33 } 34 SetRunningStub func(string) error 35 setRunningMutex sync.RWMutex 36 setRunningArgsForCall []struct { 37 arg1 string 38 } 39 setRunningReturns struct { 40 result1 error 41 } 42 invocations map[string][][]interface{} 43 invocationsMutex sync.RWMutex 44 } 45 46 func (fake *FakeRepository) ListRunning() (variables []models.EnvironmentVariable, apiErr error) { 47 fake.listRunningMutex.Lock() 48 fake.listRunningArgsForCall = append(fake.listRunningArgsForCall, struct{}{}) 49 fake.recordInvocation("ListRunning", []interface{}{}) 50 fake.listRunningMutex.Unlock() 51 if fake.ListRunningStub != nil { 52 return fake.ListRunningStub() 53 } else { 54 return fake.listRunningReturns.result1, fake.listRunningReturns.result2 55 } 56 } 57 58 func (fake *FakeRepository) ListRunningCallCount() int { 59 fake.listRunningMutex.RLock() 60 defer fake.listRunningMutex.RUnlock() 61 return len(fake.listRunningArgsForCall) 62 } 63 64 func (fake *FakeRepository) ListRunningReturns(result1 []models.EnvironmentVariable, result2 error) { 65 fake.ListRunningStub = nil 66 fake.listRunningReturns = struct { 67 result1 []models.EnvironmentVariable 68 result2 error 69 }{result1, result2} 70 } 71 72 func (fake *FakeRepository) ListStaging() (variables []models.EnvironmentVariable, apiErr error) { 73 fake.listStagingMutex.Lock() 74 fake.listStagingArgsForCall = append(fake.listStagingArgsForCall, struct{}{}) 75 fake.recordInvocation("ListStaging", []interface{}{}) 76 fake.listStagingMutex.Unlock() 77 if fake.ListStagingStub != nil { 78 return fake.ListStagingStub() 79 } else { 80 return fake.listStagingReturns.result1, fake.listStagingReturns.result2 81 } 82 } 83 84 func (fake *FakeRepository) ListStagingCallCount() int { 85 fake.listStagingMutex.RLock() 86 defer fake.listStagingMutex.RUnlock() 87 return len(fake.listStagingArgsForCall) 88 } 89 90 func (fake *FakeRepository) ListStagingReturns(result1 []models.EnvironmentVariable, result2 error) { 91 fake.ListStagingStub = nil 92 fake.listStagingReturns = struct { 93 result1 []models.EnvironmentVariable 94 result2 error 95 }{result1, result2} 96 } 97 98 func (fake *FakeRepository) SetStaging(arg1 string) error { 99 fake.setStagingMutex.Lock() 100 fake.setStagingArgsForCall = append(fake.setStagingArgsForCall, struct { 101 arg1 string 102 }{arg1}) 103 fake.recordInvocation("SetStaging", []interface{}{arg1}) 104 fake.setStagingMutex.Unlock() 105 if fake.SetStagingStub != nil { 106 return fake.SetStagingStub(arg1) 107 } else { 108 return fake.setStagingReturns.result1 109 } 110 } 111 112 func (fake *FakeRepository) SetStagingCallCount() int { 113 fake.setStagingMutex.RLock() 114 defer fake.setStagingMutex.RUnlock() 115 return len(fake.setStagingArgsForCall) 116 } 117 118 func (fake *FakeRepository) SetStagingArgsForCall(i int) string { 119 fake.setStagingMutex.RLock() 120 defer fake.setStagingMutex.RUnlock() 121 return fake.setStagingArgsForCall[i].arg1 122 } 123 124 func (fake *FakeRepository) SetStagingReturns(result1 error) { 125 fake.SetStagingStub = nil 126 fake.setStagingReturns = struct { 127 result1 error 128 }{result1} 129 } 130 131 func (fake *FakeRepository) SetRunning(arg1 string) error { 132 fake.setRunningMutex.Lock() 133 fake.setRunningArgsForCall = append(fake.setRunningArgsForCall, struct { 134 arg1 string 135 }{arg1}) 136 fake.recordInvocation("SetRunning", []interface{}{arg1}) 137 fake.setRunningMutex.Unlock() 138 if fake.SetRunningStub != nil { 139 return fake.SetRunningStub(arg1) 140 } else { 141 return fake.setRunningReturns.result1 142 } 143 } 144 145 func (fake *FakeRepository) SetRunningCallCount() int { 146 fake.setRunningMutex.RLock() 147 defer fake.setRunningMutex.RUnlock() 148 return len(fake.setRunningArgsForCall) 149 } 150 151 func (fake *FakeRepository) SetRunningArgsForCall(i int) string { 152 fake.setRunningMutex.RLock() 153 defer fake.setRunningMutex.RUnlock() 154 return fake.setRunningArgsForCall[i].arg1 155 } 156 157 func (fake *FakeRepository) SetRunningReturns(result1 error) { 158 fake.SetRunningStub = nil 159 fake.setRunningReturns = struct { 160 result1 error 161 }{result1} 162 } 163 164 func (fake *FakeRepository) Invocations() map[string][][]interface{} { 165 fake.invocationsMutex.RLock() 166 defer fake.invocationsMutex.RUnlock() 167 fake.listRunningMutex.RLock() 168 defer fake.listRunningMutex.RUnlock() 169 fake.listStagingMutex.RLock() 170 defer fake.listStagingMutex.RUnlock() 171 fake.setStagingMutex.RLock() 172 defer fake.setStagingMutex.RUnlock() 173 fake.setRunningMutex.RLock() 174 defer fake.setRunningMutex.RUnlock() 175 return fake.invocations 176 } 177 178 func (fake *FakeRepository) recordInvocation(key string, args []interface{}) { 179 fake.invocationsMutex.Lock() 180 defer fake.invocationsMutex.Unlock() 181 if fake.invocations == nil { 182 fake.invocations = map[string][][]interface{}{} 183 } 184 if fake.invocations[key] == nil { 185 fake.invocations[key] = [][]interface{}{} 186 } 187 fake.invocations[key] = append(fake.invocations[key], args) 188 } 189 190 var _ environmentvariablegroups.Repository = new(FakeRepository)