github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/api/apifakes/fake_service_key_repository.go (about)

     1  // This file was generated by counterfeiter
     2  package apifakes
     3  
     4  import (
     5  	"sync"
     6  
     7  	"code.cloudfoundry.org/cli/cf/api"
     8  	"code.cloudfoundry.org/cli/cf/models"
     9  )
    10  
    11  type FakeServiceKeyRepository struct {
    12  	CreateServiceKeyStub        func(serviceKeyGUID string, keyName string, params map[string]interface{}) error
    13  	createServiceKeyMutex       sync.RWMutex
    14  	createServiceKeyArgsForCall []struct {
    15  		serviceKeyGUID string
    16  		keyName        string
    17  		params         map[string]interface{}
    18  	}
    19  	createServiceKeyReturns struct {
    20  		result1 error
    21  	}
    22  	ListServiceKeysStub        func(serviceKeyGUID string) ([]models.ServiceKey, error)
    23  	listServiceKeysMutex       sync.RWMutex
    24  	listServiceKeysArgsForCall []struct {
    25  		serviceKeyGUID string
    26  	}
    27  	listServiceKeysReturns struct {
    28  		result1 []models.ServiceKey
    29  		result2 error
    30  	}
    31  	GetServiceKeyStub        func(serviceKeyGUID string, keyName string) (models.ServiceKey, error)
    32  	getServiceKeyMutex       sync.RWMutex
    33  	getServiceKeyArgsForCall []struct {
    34  		serviceKeyGUID string
    35  		keyName        string
    36  	}
    37  	getServiceKeyReturns struct {
    38  		result1 models.ServiceKey
    39  		result2 error
    40  	}
    41  	DeleteServiceKeyStub        func(serviceKeyGUID string) error
    42  	deleteServiceKeyMutex       sync.RWMutex
    43  	deleteServiceKeyArgsForCall []struct {
    44  		serviceKeyGUID string
    45  	}
    46  	deleteServiceKeyReturns struct {
    47  		result1 error
    48  	}
    49  	invocations      map[string][][]interface{}
    50  	invocationsMutex sync.RWMutex
    51  }
    52  
    53  func (fake *FakeServiceKeyRepository) CreateServiceKey(serviceKeyGUID string, keyName string, params map[string]interface{}) error {
    54  	fake.createServiceKeyMutex.Lock()
    55  	fake.createServiceKeyArgsForCall = append(fake.createServiceKeyArgsForCall, struct {
    56  		serviceKeyGUID string
    57  		keyName        string
    58  		params         map[string]interface{}
    59  	}{serviceKeyGUID, keyName, params})
    60  	fake.recordInvocation("CreateServiceKey", []interface{}{serviceKeyGUID, keyName, params})
    61  	fake.createServiceKeyMutex.Unlock()
    62  	if fake.CreateServiceKeyStub != nil {
    63  		return fake.CreateServiceKeyStub(serviceKeyGUID, keyName, params)
    64  	} else {
    65  		return fake.createServiceKeyReturns.result1
    66  	}
    67  }
    68  
    69  func (fake *FakeServiceKeyRepository) CreateServiceKeyCallCount() int {
    70  	fake.createServiceKeyMutex.RLock()
    71  	defer fake.createServiceKeyMutex.RUnlock()
    72  	return len(fake.createServiceKeyArgsForCall)
    73  }
    74  
    75  func (fake *FakeServiceKeyRepository) CreateServiceKeyArgsForCall(i int) (string, string, map[string]interface{}) {
    76  	fake.createServiceKeyMutex.RLock()
    77  	defer fake.createServiceKeyMutex.RUnlock()
    78  	return fake.createServiceKeyArgsForCall[i].serviceKeyGUID, fake.createServiceKeyArgsForCall[i].keyName, fake.createServiceKeyArgsForCall[i].params
    79  }
    80  
    81  func (fake *FakeServiceKeyRepository) CreateServiceKeyReturns(result1 error) {
    82  	fake.CreateServiceKeyStub = nil
    83  	fake.createServiceKeyReturns = struct {
    84  		result1 error
    85  	}{result1}
    86  }
    87  
    88  func (fake *FakeServiceKeyRepository) ListServiceKeys(serviceKeyGUID string) ([]models.ServiceKey, error) {
    89  	fake.listServiceKeysMutex.Lock()
    90  	fake.listServiceKeysArgsForCall = append(fake.listServiceKeysArgsForCall, struct {
    91  		serviceKeyGUID string
    92  	}{serviceKeyGUID})
    93  	fake.recordInvocation("ListServiceKeys", []interface{}{serviceKeyGUID})
    94  	fake.listServiceKeysMutex.Unlock()
    95  	if fake.ListServiceKeysStub != nil {
    96  		return fake.ListServiceKeysStub(serviceKeyGUID)
    97  	} else {
    98  		return fake.listServiceKeysReturns.result1, fake.listServiceKeysReturns.result2
    99  	}
   100  }
   101  
   102  func (fake *FakeServiceKeyRepository) ListServiceKeysCallCount() int {
   103  	fake.listServiceKeysMutex.RLock()
   104  	defer fake.listServiceKeysMutex.RUnlock()
   105  	return len(fake.listServiceKeysArgsForCall)
   106  }
   107  
   108  func (fake *FakeServiceKeyRepository) ListServiceKeysArgsForCall(i int) string {
   109  	fake.listServiceKeysMutex.RLock()
   110  	defer fake.listServiceKeysMutex.RUnlock()
   111  	return fake.listServiceKeysArgsForCall[i].serviceKeyGUID
   112  }
   113  
   114  func (fake *FakeServiceKeyRepository) ListServiceKeysReturns(result1 []models.ServiceKey, result2 error) {
   115  	fake.ListServiceKeysStub = nil
   116  	fake.listServiceKeysReturns = struct {
   117  		result1 []models.ServiceKey
   118  		result2 error
   119  	}{result1, result2}
   120  }
   121  
   122  func (fake *FakeServiceKeyRepository) GetServiceKey(serviceKeyGUID string, keyName string) (models.ServiceKey, error) {
   123  	fake.getServiceKeyMutex.Lock()
   124  	fake.getServiceKeyArgsForCall = append(fake.getServiceKeyArgsForCall, struct {
   125  		serviceKeyGUID string
   126  		keyName        string
   127  	}{serviceKeyGUID, keyName})
   128  	fake.recordInvocation("GetServiceKey", []interface{}{serviceKeyGUID, keyName})
   129  	fake.getServiceKeyMutex.Unlock()
   130  	if fake.GetServiceKeyStub != nil {
   131  		return fake.GetServiceKeyStub(serviceKeyGUID, keyName)
   132  	} else {
   133  		return fake.getServiceKeyReturns.result1, fake.getServiceKeyReturns.result2
   134  	}
   135  }
   136  
   137  func (fake *FakeServiceKeyRepository) GetServiceKeyCallCount() int {
   138  	fake.getServiceKeyMutex.RLock()
   139  	defer fake.getServiceKeyMutex.RUnlock()
   140  	return len(fake.getServiceKeyArgsForCall)
   141  }
   142  
   143  func (fake *FakeServiceKeyRepository) GetServiceKeyArgsForCall(i int) (string, string) {
   144  	fake.getServiceKeyMutex.RLock()
   145  	defer fake.getServiceKeyMutex.RUnlock()
   146  	return fake.getServiceKeyArgsForCall[i].serviceKeyGUID, fake.getServiceKeyArgsForCall[i].keyName
   147  }
   148  
   149  func (fake *FakeServiceKeyRepository) GetServiceKeyReturns(result1 models.ServiceKey, result2 error) {
   150  	fake.GetServiceKeyStub = nil
   151  	fake.getServiceKeyReturns = struct {
   152  		result1 models.ServiceKey
   153  		result2 error
   154  	}{result1, result2}
   155  }
   156  
   157  func (fake *FakeServiceKeyRepository) DeleteServiceKey(serviceKeyGUID string) error {
   158  	fake.deleteServiceKeyMutex.Lock()
   159  	fake.deleteServiceKeyArgsForCall = append(fake.deleteServiceKeyArgsForCall, struct {
   160  		serviceKeyGUID string
   161  	}{serviceKeyGUID})
   162  	fake.recordInvocation("DeleteServiceKey", []interface{}{serviceKeyGUID})
   163  	fake.deleteServiceKeyMutex.Unlock()
   164  	if fake.DeleteServiceKeyStub != nil {
   165  		return fake.DeleteServiceKeyStub(serviceKeyGUID)
   166  	} else {
   167  		return fake.deleteServiceKeyReturns.result1
   168  	}
   169  }
   170  
   171  func (fake *FakeServiceKeyRepository) DeleteServiceKeyCallCount() int {
   172  	fake.deleteServiceKeyMutex.RLock()
   173  	defer fake.deleteServiceKeyMutex.RUnlock()
   174  	return len(fake.deleteServiceKeyArgsForCall)
   175  }
   176  
   177  func (fake *FakeServiceKeyRepository) DeleteServiceKeyArgsForCall(i int) string {
   178  	fake.deleteServiceKeyMutex.RLock()
   179  	defer fake.deleteServiceKeyMutex.RUnlock()
   180  	return fake.deleteServiceKeyArgsForCall[i].serviceKeyGUID
   181  }
   182  
   183  func (fake *FakeServiceKeyRepository) DeleteServiceKeyReturns(result1 error) {
   184  	fake.DeleteServiceKeyStub = nil
   185  	fake.deleteServiceKeyReturns = struct {
   186  		result1 error
   187  	}{result1}
   188  }
   189  
   190  func (fake *FakeServiceKeyRepository) Invocations() map[string][][]interface{} {
   191  	fake.invocationsMutex.RLock()
   192  	defer fake.invocationsMutex.RUnlock()
   193  	fake.createServiceKeyMutex.RLock()
   194  	defer fake.createServiceKeyMutex.RUnlock()
   195  	fake.listServiceKeysMutex.RLock()
   196  	defer fake.listServiceKeysMutex.RUnlock()
   197  	fake.getServiceKeyMutex.RLock()
   198  	defer fake.getServiceKeyMutex.RUnlock()
   199  	fake.deleteServiceKeyMutex.RLock()
   200  	defer fake.deleteServiceKeyMutex.RUnlock()
   201  	return fake.invocations
   202  }
   203  
   204  func (fake *FakeServiceKeyRepository) recordInvocation(key string, args []interface{}) {
   205  	fake.invocationsMutex.Lock()
   206  	defer fake.invocationsMutex.Unlock()
   207  	if fake.invocations == nil {
   208  		fake.invocations = map[string][][]interface{}{}
   209  	}
   210  	if fake.invocations[key] == nil {
   211  		fake.invocations[key] = [][]interface{}{}
   212  	}
   213  	fake.invocations[key] = append(fake.invocations[key], args)
   214  }
   215  
   216  var _ api.ServiceKeyRepository = new(FakeServiceKeyRepository)