github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/api/plugin/pluginfakes/fake_connection_wrapper.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 FakeConnectionWrapper struct { 12 MakeStub func(*http.Request, *plugin.Response, plugin.ProxyReader) error 13 makeMutex sync.RWMutex 14 makeArgsForCall []struct { 15 arg1 *http.Request 16 arg2 *plugin.Response 17 arg3 plugin.ProxyReader 18 } 19 makeReturns struct { 20 result1 error 21 } 22 makeReturnsOnCall map[int]struct { 23 result1 error 24 } 25 WrapStub func(plugin.Connection) plugin.Connection 26 wrapMutex sync.RWMutex 27 wrapArgsForCall []struct { 28 arg1 plugin.Connection 29 } 30 wrapReturns struct { 31 result1 plugin.Connection 32 } 33 wrapReturnsOnCall map[int]struct { 34 result1 plugin.Connection 35 } 36 invocations map[string][][]interface{} 37 invocationsMutex sync.RWMutex 38 } 39 40 func (fake *FakeConnectionWrapper) Make(arg1 *http.Request, arg2 *plugin.Response, arg3 plugin.ProxyReader) error { 41 fake.makeMutex.Lock() 42 ret, specificReturn := fake.makeReturnsOnCall[len(fake.makeArgsForCall)] 43 fake.makeArgsForCall = append(fake.makeArgsForCall, struct { 44 arg1 *http.Request 45 arg2 *plugin.Response 46 arg3 plugin.ProxyReader 47 }{arg1, arg2, arg3}) 48 fake.recordInvocation("Make", []interface{}{arg1, arg2, arg3}) 49 fake.makeMutex.Unlock() 50 if fake.MakeStub != nil { 51 return fake.MakeStub(arg1, arg2, arg3) 52 } 53 if specificReturn { 54 return ret.result1 55 } 56 fakeReturns := fake.makeReturns 57 return fakeReturns.result1 58 } 59 60 func (fake *FakeConnectionWrapper) MakeCallCount() int { 61 fake.makeMutex.RLock() 62 defer fake.makeMutex.RUnlock() 63 return len(fake.makeArgsForCall) 64 } 65 66 func (fake *FakeConnectionWrapper) MakeCalls(stub func(*http.Request, *plugin.Response, plugin.ProxyReader) error) { 67 fake.makeMutex.Lock() 68 defer fake.makeMutex.Unlock() 69 fake.MakeStub = stub 70 } 71 72 func (fake *FakeConnectionWrapper) MakeArgsForCall(i int) (*http.Request, *plugin.Response, plugin.ProxyReader) { 73 fake.makeMutex.RLock() 74 defer fake.makeMutex.RUnlock() 75 argsForCall := fake.makeArgsForCall[i] 76 return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 77 } 78 79 func (fake *FakeConnectionWrapper) MakeReturns(result1 error) { 80 fake.makeMutex.Lock() 81 defer fake.makeMutex.Unlock() 82 fake.MakeStub = nil 83 fake.makeReturns = struct { 84 result1 error 85 }{result1} 86 } 87 88 func (fake *FakeConnectionWrapper) MakeReturnsOnCall(i int, result1 error) { 89 fake.makeMutex.Lock() 90 defer fake.makeMutex.Unlock() 91 fake.MakeStub = nil 92 if fake.makeReturnsOnCall == nil { 93 fake.makeReturnsOnCall = make(map[int]struct { 94 result1 error 95 }) 96 } 97 fake.makeReturnsOnCall[i] = struct { 98 result1 error 99 }{result1} 100 } 101 102 func (fake *FakeConnectionWrapper) Wrap(arg1 plugin.Connection) plugin.Connection { 103 fake.wrapMutex.Lock() 104 ret, specificReturn := fake.wrapReturnsOnCall[len(fake.wrapArgsForCall)] 105 fake.wrapArgsForCall = append(fake.wrapArgsForCall, struct { 106 arg1 plugin.Connection 107 }{arg1}) 108 fake.recordInvocation("Wrap", []interface{}{arg1}) 109 fake.wrapMutex.Unlock() 110 if fake.WrapStub != nil { 111 return fake.WrapStub(arg1) 112 } 113 if specificReturn { 114 return ret.result1 115 } 116 fakeReturns := fake.wrapReturns 117 return fakeReturns.result1 118 } 119 120 func (fake *FakeConnectionWrapper) WrapCallCount() int { 121 fake.wrapMutex.RLock() 122 defer fake.wrapMutex.RUnlock() 123 return len(fake.wrapArgsForCall) 124 } 125 126 func (fake *FakeConnectionWrapper) WrapCalls(stub func(plugin.Connection) plugin.Connection) { 127 fake.wrapMutex.Lock() 128 defer fake.wrapMutex.Unlock() 129 fake.WrapStub = stub 130 } 131 132 func (fake *FakeConnectionWrapper) WrapArgsForCall(i int) plugin.Connection { 133 fake.wrapMutex.RLock() 134 defer fake.wrapMutex.RUnlock() 135 argsForCall := fake.wrapArgsForCall[i] 136 return argsForCall.arg1 137 } 138 139 func (fake *FakeConnectionWrapper) WrapReturns(result1 plugin.Connection) { 140 fake.wrapMutex.Lock() 141 defer fake.wrapMutex.Unlock() 142 fake.WrapStub = nil 143 fake.wrapReturns = struct { 144 result1 plugin.Connection 145 }{result1} 146 } 147 148 func (fake *FakeConnectionWrapper) WrapReturnsOnCall(i int, result1 plugin.Connection) { 149 fake.wrapMutex.Lock() 150 defer fake.wrapMutex.Unlock() 151 fake.WrapStub = nil 152 if fake.wrapReturnsOnCall == nil { 153 fake.wrapReturnsOnCall = make(map[int]struct { 154 result1 plugin.Connection 155 }) 156 } 157 fake.wrapReturnsOnCall[i] = struct { 158 result1 plugin.Connection 159 }{result1} 160 } 161 162 func (fake *FakeConnectionWrapper) Invocations() map[string][][]interface{} { 163 fake.invocationsMutex.RLock() 164 defer fake.invocationsMutex.RUnlock() 165 fake.makeMutex.RLock() 166 defer fake.makeMutex.RUnlock() 167 fake.wrapMutex.RLock() 168 defer fake.wrapMutex.RUnlock() 169 copiedInvocations := map[string][][]interface{}{} 170 for key, value := range fake.invocations { 171 copiedInvocations[key] = value 172 } 173 return copiedInvocations 174 } 175 176 func (fake *FakeConnectionWrapper) recordInvocation(key string, args []interface{}) { 177 fake.invocationsMutex.Lock() 178 defer fake.invocationsMutex.Unlock() 179 if fake.invocations == nil { 180 fake.invocations = map[string][][]interface{}{} 181 } 182 if fake.invocations[key] == nil { 183 fake.invocations[key] = [][]interface{}{} 184 } 185 fake.invocations[key] = append(fake.invocations[key], args) 186 } 187 188 var _ plugin.ConnectionWrapper = new(FakeConnectionWrapper)