github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/api/plugin/pluginfakes/fake_connection.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package pluginfakes 3 4 import ( 5 "net/http" 6 "sync" 7 8 "code.cloudfoundry.org/cli/api/plugin" 9 ) 10 11 type FakeConnection struct { 12 MakeStub func(request *http.Request, passedResponse *plugin.Response, proxyReader plugin.ProxyReader) error 13 makeMutex sync.RWMutex 14 makeArgsForCall []struct { 15 request *http.Request 16 passedResponse *plugin.Response 17 proxyReader plugin.ProxyReader 18 } 19 makeReturns struct { 20 result1 error 21 } 22 makeReturnsOnCall map[int]struct { 23 result1 error 24 } 25 invocations map[string][][]interface{} 26 invocationsMutex sync.RWMutex 27 } 28 29 func (fake *FakeConnection) Make(request *http.Request, passedResponse *plugin.Response, proxyReader plugin.ProxyReader) error { 30 fake.makeMutex.Lock() 31 ret, specificReturn := fake.makeReturnsOnCall[len(fake.makeArgsForCall)] 32 fake.makeArgsForCall = append(fake.makeArgsForCall, struct { 33 request *http.Request 34 passedResponse *plugin.Response 35 proxyReader plugin.ProxyReader 36 }{request, passedResponse, proxyReader}) 37 fake.recordInvocation("Make", []interface{}{request, passedResponse, proxyReader}) 38 fake.makeMutex.Unlock() 39 if fake.MakeStub != nil { 40 return fake.MakeStub(request, passedResponse, proxyReader) 41 } 42 if specificReturn { 43 return ret.result1 44 } 45 return fake.makeReturns.result1 46 } 47 48 func (fake *FakeConnection) MakeCallCount() int { 49 fake.makeMutex.RLock() 50 defer fake.makeMutex.RUnlock() 51 return len(fake.makeArgsForCall) 52 } 53 54 func (fake *FakeConnection) MakeArgsForCall(i int) (*http.Request, *plugin.Response, plugin.ProxyReader) { 55 fake.makeMutex.RLock() 56 defer fake.makeMutex.RUnlock() 57 return fake.makeArgsForCall[i].request, fake.makeArgsForCall[i].passedResponse, fake.makeArgsForCall[i].proxyReader 58 } 59 60 func (fake *FakeConnection) MakeReturns(result1 error) { 61 fake.MakeStub = nil 62 fake.makeReturns = struct { 63 result1 error 64 }{result1} 65 } 66 67 func (fake *FakeConnection) MakeReturnsOnCall(i int, result1 error) { 68 fake.MakeStub = nil 69 if fake.makeReturnsOnCall == nil { 70 fake.makeReturnsOnCall = make(map[int]struct { 71 result1 error 72 }) 73 } 74 fake.makeReturnsOnCall[i] = struct { 75 result1 error 76 }{result1} 77 } 78 79 func (fake *FakeConnection) Invocations() map[string][][]interface{} { 80 fake.invocationsMutex.RLock() 81 defer fake.invocationsMutex.RUnlock() 82 fake.makeMutex.RLock() 83 defer fake.makeMutex.RUnlock() 84 copiedInvocations := map[string][][]interface{}{} 85 for key, value := range fake.invocations { 86 copiedInvocations[key] = value 87 } 88 return copiedInvocations 89 } 90 91 func (fake *FakeConnection) recordInvocation(key string, args []interface{}) { 92 fake.invocationsMutex.Lock() 93 defer fake.invocationsMutex.Unlock() 94 if fake.invocations == nil { 95 fake.invocations = map[string][][]interface{}{} 96 } 97 if fake.invocations[key] == nil { 98 fake.invocations[key] = [][]interface{}{} 99 } 100 fake.invocations[key] = append(fake.invocations[key], args) 101 } 102 103 var _ plugin.Connection = new(FakeConnection)