github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/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(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  	WrapStub        func(innerconnection plugin.Connection) plugin.Connection
    26  	wrapMutex       sync.RWMutex
    27  	wrapArgsForCall []struct {
    28  		innerconnection 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(request *http.Request, passedResponse *plugin.Response, proxyReader plugin.ProxyReader) error {
    41  	fake.makeMutex.Lock()
    42  	ret, specificReturn := fake.makeReturnsOnCall[len(fake.makeArgsForCall)]
    43  	fake.makeArgsForCall = append(fake.makeArgsForCall, struct {
    44  		request        *http.Request
    45  		passedResponse *plugin.Response
    46  		proxyReader    plugin.ProxyReader
    47  	}{request, passedResponse, proxyReader})
    48  	fake.recordInvocation("Make", []interface{}{request, passedResponse, proxyReader})
    49  	fake.makeMutex.Unlock()
    50  	if fake.MakeStub != nil {
    51  		return fake.MakeStub(request, passedResponse, proxyReader)
    52  	}
    53  	if specificReturn {
    54  		return ret.result1
    55  	}
    56  	return fake.makeReturns.result1
    57  }
    58  
    59  func (fake *FakeConnectionWrapper) MakeCallCount() int {
    60  	fake.makeMutex.RLock()
    61  	defer fake.makeMutex.RUnlock()
    62  	return len(fake.makeArgsForCall)
    63  }
    64  
    65  func (fake *FakeConnectionWrapper) MakeArgsForCall(i int) (*http.Request, *plugin.Response, plugin.ProxyReader) {
    66  	fake.makeMutex.RLock()
    67  	defer fake.makeMutex.RUnlock()
    68  	return fake.makeArgsForCall[i].request, fake.makeArgsForCall[i].passedResponse, fake.makeArgsForCall[i].proxyReader
    69  }
    70  
    71  func (fake *FakeConnectionWrapper) MakeReturns(result1 error) {
    72  	fake.MakeStub = nil
    73  	fake.makeReturns = struct {
    74  		result1 error
    75  	}{result1}
    76  }
    77  
    78  func (fake *FakeConnectionWrapper) MakeReturnsOnCall(i int, result1 error) {
    79  	fake.MakeStub = nil
    80  	if fake.makeReturnsOnCall == nil {
    81  		fake.makeReturnsOnCall = make(map[int]struct {
    82  			result1 error
    83  		})
    84  	}
    85  	fake.makeReturnsOnCall[i] = struct {
    86  		result1 error
    87  	}{result1}
    88  }
    89  
    90  func (fake *FakeConnectionWrapper) Wrap(innerconnection plugin.Connection) plugin.Connection {
    91  	fake.wrapMutex.Lock()
    92  	ret, specificReturn := fake.wrapReturnsOnCall[len(fake.wrapArgsForCall)]
    93  	fake.wrapArgsForCall = append(fake.wrapArgsForCall, struct {
    94  		innerconnection plugin.Connection
    95  	}{innerconnection})
    96  	fake.recordInvocation("Wrap", []interface{}{innerconnection})
    97  	fake.wrapMutex.Unlock()
    98  	if fake.WrapStub != nil {
    99  		return fake.WrapStub(innerconnection)
   100  	}
   101  	if specificReturn {
   102  		return ret.result1
   103  	}
   104  	return fake.wrapReturns.result1
   105  }
   106  
   107  func (fake *FakeConnectionWrapper) WrapCallCount() int {
   108  	fake.wrapMutex.RLock()
   109  	defer fake.wrapMutex.RUnlock()
   110  	return len(fake.wrapArgsForCall)
   111  }
   112  
   113  func (fake *FakeConnectionWrapper) WrapArgsForCall(i int) plugin.Connection {
   114  	fake.wrapMutex.RLock()
   115  	defer fake.wrapMutex.RUnlock()
   116  	return fake.wrapArgsForCall[i].innerconnection
   117  }
   118  
   119  func (fake *FakeConnectionWrapper) WrapReturns(result1 plugin.Connection) {
   120  	fake.WrapStub = nil
   121  	fake.wrapReturns = struct {
   122  		result1 plugin.Connection
   123  	}{result1}
   124  }
   125  
   126  func (fake *FakeConnectionWrapper) WrapReturnsOnCall(i int, result1 plugin.Connection) {
   127  	fake.WrapStub = nil
   128  	if fake.wrapReturnsOnCall == nil {
   129  		fake.wrapReturnsOnCall = make(map[int]struct {
   130  			result1 plugin.Connection
   131  		})
   132  	}
   133  	fake.wrapReturnsOnCall[i] = struct {
   134  		result1 plugin.Connection
   135  	}{result1}
   136  }
   137  
   138  func (fake *FakeConnectionWrapper) Invocations() map[string][][]interface{} {
   139  	fake.invocationsMutex.RLock()
   140  	defer fake.invocationsMutex.RUnlock()
   141  	fake.makeMutex.RLock()
   142  	defer fake.makeMutex.RUnlock()
   143  	fake.wrapMutex.RLock()
   144  	defer fake.wrapMutex.RUnlock()
   145  	copiedInvocations := map[string][][]interface{}{}
   146  	for key, value := range fake.invocations {
   147  		copiedInvocations[key] = value
   148  	}
   149  	return copiedInvocations
   150  }
   151  
   152  func (fake *FakeConnectionWrapper) recordInvocation(key string, args []interface{}) {
   153  	fake.invocationsMutex.Lock()
   154  	defer fake.invocationsMutex.Unlock()
   155  	if fake.invocations == nil {
   156  		fake.invocations = map[string][][]interface{}{}
   157  	}
   158  	if fake.invocations[key] == nil {
   159  		fake.invocations[key] = [][]interface{}{}
   160  	}
   161  	fake.invocations[key] = append(fake.invocations[key], args)
   162  }
   163  
   164  var _ plugin.ConnectionWrapper = new(FakeConnectionWrapper)