github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/commands/service/servicefakes/fake_binder.go (about)

     1  // This file was generated by counterfeiter
     2  package servicefakes
     3  
     4  import (
     5  	"sync"
     6  
     7  	"code.cloudfoundry.org/cli/cf/commands/service"
     8  	"code.cloudfoundry.org/cli/cf/models"
     9  )
    10  
    11  type FakeBinder struct {
    12  	BindApplicationStub        func(app models.Application, serviceInstance models.ServiceInstance, paramsMap map[string]interface{}) (apiErr error)
    13  	bindApplicationMutex       sync.RWMutex
    14  	bindApplicationArgsForCall []struct {
    15  		app             models.Application
    16  		serviceInstance models.ServiceInstance
    17  		paramsMap       map[string]interface{}
    18  	}
    19  	bindApplicationReturns struct {
    20  		result1 error
    21  	}
    22  	invocations      map[string][][]interface{}
    23  	invocationsMutex sync.RWMutex
    24  }
    25  
    26  func (fake *FakeBinder) BindApplication(app models.Application, serviceInstance models.ServiceInstance, paramsMap map[string]interface{}) (apiErr error) {
    27  	fake.bindApplicationMutex.Lock()
    28  	fake.bindApplicationArgsForCall = append(fake.bindApplicationArgsForCall, struct {
    29  		app             models.Application
    30  		serviceInstance models.ServiceInstance
    31  		paramsMap       map[string]interface{}
    32  	}{app, serviceInstance, paramsMap})
    33  	fake.recordInvocation("BindApplication", []interface{}{app, serviceInstance, paramsMap})
    34  	fake.bindApplicationMutex.Unlock()
    35  	if fake.BindApplicationStub != nil {
    36  		return fake.BindApplicationStub(app, serviceInstance, paramsMap)
    37  	} else {
    38  		return fake.bindApplicationReturns.result1
    39  	}
    40  }
    41  
    42  func (fake *FakeBinder) BindApplicationCallCount() int {
    43  	fake.bindApplicationMutex.RLock()
    44  	defer fake.bindApplicationMutex.RUnlock()
    45  	return len(fake.bindApplicationArgsForCall)
    46  }
    47  
    48  func (fake *FakeBinder) BindApplicationArgsForCall(i int) (models.Application, models.ServiceInstance, map[string]interface{}) {
    49  	fake.bindApplicationMutex.RLock()
    50  	defer fake.bindApplicationMutex.RUnlock()
    51  	return fake.bindApplicationArgsForCall[i].app, fake.bindApplicationArgsForCall[i].serviceInstance, fake.bindApplicationArgsForCall[i].paramsMap
    52  }
    53  
    54  func (fake *FakeBinder) BindApplicationReturns(result1 error) {
    55  	fake.BindApplicationStub = nil
    56  	fake.bindApplicationReturns = struct {
    57  		result1 error
    58  	}{result1}
    59  }
    60  
    61  func (fake *FakeBinder) Invocations() map[string][][]interface{} {
    62  	fake.invocationsMutex.RLock()
    63  	defer fake.invocationsMutex.RUnlock()
    64  	fake.bindApplicationMutex.RLock()
    65  	defer fake.bindApplicationMutex.RUnlock()
    66  	return fake.invocations
    67  }
    68  
    69  func (fake *FakeBinder) recordInvocation(key string, args []interface{}) {
    70  	fake.invocationsMutex.Lock()
    71  	defer fake.invocationsMutex.Unlock()
    72  	if fake.invocations == nil {
    73  		fake.invocations = map[string][][]interface{}{}
    74  	}
    75  	if fake.invocations[key] == nil {
    76  		fake.invocations[key] = [][]interface{}{}
    77  	}
    78  	fake.invocations[key] = append(fake.invocations[key], args)
    79  }
    80  
    81  var _ service.Binder = new(FakeBinder)