github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/api/apifakes/fake_domain_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 FakeDomainRepository struct {
    12  	ListDomainsForOrgStub        func(orgGUID string, cb func(models.DomainFields) bool) error
    13  	listDomainsForOrgMutex       sync.RWMutex
    14  	listDomainsForOrgArgsForCall []struct {
    15  		orgGUID string
    16  		cb      func(models.DomainFields) bool
    17  	}
    18  	listDomainsForOrgReturns struct {
    19  		result1 error
    20  	}
    21  	FindSharedByNameStub        func(name string) (domain models.DomainFields, apiErr error)
    22  	findSharedByNameMutex       sync.RWMutex
    23  	findSharedByNameArgsForCall []struct {
    24  		name string
    25  	}
    26  	findSharedByNameReturns struct {
    27  		result1 models.DomainFields
    28  		result2 error
    29  	}
    30  	FindPrivateByNameStub        func(name string) (domain models.DomainFields, apiErr error)
    31  	findPrivateByNameMutex       sync.RWMutex
    32  	findPrivateByNameArgsForCall []struct {
    33  		name string
    34  	}
    35  	findPrivateByNameReturns struct {
    36  		result1 models.DomainFields
    37  		result2 error
    38  	}
    39  	FindByNameInOrgStub        func(name string, owningOrgGUID string) (domain models.DomainFields, apiErr error)
    40  	findByNameInOrgMutex       sync.RWMutex
    41  	findByNameInOrgArgsForCall []struct {
    42  		name          string
    43  		owningOrgGUID string
    44  	}
    45  	findByNameInOrgReturns struct {
    46  		result1 models.DomainFields
    47  		result2 error
    48  	}
    49  	CreateStub        func(domainName string, owningOrgGUID string) (createdDomain models.DomainFields, apiErr error)
    50  	createMutex       sync.RWMutex
    51  	createArgsForCall []struct {
    52  		domainName    string
    53  		owningOrgGUID string
    54  	}
    55  	createReturns struct {
    56  		result1 models.DomainFields
    57  		result2 error
    58  	}
    59  	CreateSharedDomainStub        func(domainName string, routerGroupGUID string) (apiErr error)
    60  	createSharedDomainMutex       sync.RWMutex
    61  	createSharedDomainArgsForCall []struct {
    62  		domainName      string
    63  		routerGroupGUID string
    64  	}
    65  	createSharedDomainReturns struct {
    66  		result1 error
    67  	}
    68  	DeleteStub        func(domainGUID string) (apiErr error)
    69  	deleteMutex       sync.RWMutex
    70  	deleteArgsForCall []struct {
    71  		domainGUID string
    72  	}
    73  	deleteReturns struct {
    74  		result1 error
    75  	}
    76  	DeleteSharedDomainStub        func(domainGUID string) (apiErr error)
    77  	deleteSharedDomainMutex       sync.RWMutex
    78  	deleteSharedDomainArgsForCall []struct {
    79  		domainGUID string
    80  	}
    81  	deleteSharedDomainReturns struct {
    82  		result1 error
    83  	}
    84  	FirstOrDefaultStub        func(orgGUID string, name *string) (domain models.DomainFields, error error)
    85  	firstOrDefaultMutex       sync.RWMutex
    86  	firstOrDefaultArgsForCall []struct {
    87  		orgGUID string
    88  		name    *string
    89  	}
    90  	firstOrDefaultReturns struct {
    91  		result1 models.DomainFields
    92  		result2 error
    93  	}
    94  	invocations      map[string][][]interface{}
    95  	invocationsMutex sync.RWMutex
    96  }
    97  
    98  func (fake *FakeDomainRepository) ListDomainsForOrg(orgGUID string, cb func(models.DomainFields) bool) error {
    99  	fake.listDomainsForOrgMutex.Lock()
   100  	fake.listDomainsForOrgArgsForCall = append(fake.listDomainsForOrgArgsForCall, struct {
   101  		orgGUID string
   102  		cb      func(models.DomainFields) bool
   103  	}{orgGUID, cb})
   104  	fake.recordInvocation("ListDomainsForOrg", []interface{}{orgGUID, cb})
   105  	fake.listDomainsForOrgMutex.Unlock()
   106  	if fake.ListDomainsForOrgStub != nil {
   107  		return fake.ListDomainsForOrgStub(orgGUID, cb)
   108  	} else {
   109  		return fake.listDomainsForOrgReturns.result1
   110  	}
   111  }
   112  
   113  func (fake *FakeDomainRepository) ListDomainsForOrgCallCount() int {
   114  	fake.listDomainsForOrgMutex.RLock()
   115  	defer fake.listDomainsForOrgMutex.RUnlock()
   116  	return len(fake.listDomainsForOrgArgsForCall)
   117  }
   118  
   119  func (fake *FakeDomainRepository) ListDomainsForOrgArgsForCall(i int) (string, func(models.DomainFields) bool) {
   120  	fake.listDomainsForOrgMutex.RLock()
   121  	defer fake.listDomainsForOrgMutex.RUnlock()
   122  	return fake.listDomainsForOrgArgsForCall[i].orgGUID, fake.listDomainsForOrgArgsForCall[i].cb
   123  }
   124  
   125  func (fake *FakeDomainRepository) ListDomainsForOrgReturns(result1 error) {
   126  	fake.ListDomainsForOrgStub = nil
   127  	fake.listDomainsForOrgReturns = struct {
   128  		result1 error
   129  	}{result1}
   130  }
   131  
   132  func (fake *FakeDomainRepository) FindSharedByName(name string) (domain models.DomainFields, apiErr error) {
   133  	fake.findSharedByNameMutex.Lock()
   134  	fake.findSharedByNameArgsForCall = append(fake.findSharedByNameArgsForCall, struct {
   135  		name string
   136  	}{name})
   137  	fake.recordInvocation("FindSharedByName", []interface{}{name})
   138  	fake.findSharedByNameMutex.Unlock()
   139  	if fake.FindSharedByNameStub != nil {
   140  		return fake.FindSharedByNameStub(name)
   141  	} else {
   142  		return fake.findSharedByNameReturns.result1, fake.findSharedByNameReturns.result2
   143  	}
   144  }
   145  
   146  func (fake *FakeDomainRepository) FindSharedByNameCallCount() int {
   147  	fake.findSharedByNameMutex.RLock()
   148  	defer fake.findSharedByNameMutex.RUnlock()
   149  	return len(fake.findSharedByNameArgsForCall)
   150  }
   151  
   152  func (fake *FakeDomainRepository) FindSharedByNameArgsForCall(i int) string {
   153  	fake.findSharedByNameMutex.RLock()
   154  	defer fake.findSharedByNameMutex.RUnlock()
   155  	return fake.findSharedByNameArgsForCall[i].name
   156  }
   157  
   158  func (fake *FakeDomainRepository) FindSharedByNameReturns(result1 models.DomainFields, result2 error) {
   159  	fake.FindSharedByNameStub = nil
   160  	fake.findSharedByNameReturns = struct {
   161  		result1 models.DomainFields
   162  		result2 error
   163  	}{result1, result2}
   164  }
   165  
   166  func (fake *FakeDomainRepository) FindPrivateByName(name string) (domain models.DomainFields, apiErr error) {
   167  	fake.findPrivateByNameMutex.Lock()
   168  	fake.findPrivateByNameArgsForCall = append(fake.findPrivateByNameArgsForCall, struct {
   169  		name string
   170  	}{name})
   171  	fake.recordInvocation("FindPrivateByName", []interface{}{name})
   172  	fake.findPrivateByNameMutex.Unlock()
   173  	if fake.FindPrivateByNameStub != nil {
   174  		return fake.FindPrivateByNameStub(name)
   175  	} else {
   176  		return fake.findPrivateByNameReturns.result1, fake.findPrivateByNameReturns.result2
   177  	}
   178  }
   179  
   180  func (fake *FakeDomainRepository) FindPrivateByNameCallCount() int {
   181  	fake.findPrivateByNameMutex.RLock()
   182  	defer fake.findPrivateByNameMutex.RUnlock()
   183  	return len(fake.findPrivateByNameArgsForCall)
   184  }
   185  
   186  func (fake *FakeDomainRepository) FindPrivateByNameArgsForCall(i int) string {
   187  	fake.findPrivateByNameMutex.RLock()
   188  	defer fake.findPrivateByNameMutex.RUnlock()
   189  	return fake.findPrivateByNameArgsForCall[i].name
   190  }
   191  
   192  func (fake *FakeDomainRepository) FindPrivateByNameReturns(result1 models.DomainFields, result2 error) {
   193  	fake.FindPrivateByNameStub = nil
   194  	fake.findPrivateByNameReturns = struct {
   195  		result1 models.DomainFields
   196  		result2 error
   197  	}{result1, result2}
   198  }
   199  
   200  func (fake *FakeDomainRepository) FindByNameInOrg(name string, owningOrgGUID string) (domain models.DomainFields, apiErr error) {
   201  	fake.findByNameInOrgMutex.Lock()
   202  	fake.findByNameInOrgArgsForCall = append(fake.findByNameInOrgArgsForCall, struct {
   203  		name          string
   204  		owningOrgGUID string
   205  	}{name, owningOrgGUID})
   206  	fake.recordInvocation("FindByNameInOrg", []interface{}{name, owningOrgGUID})
   207  	fake.findByNameInOrgMutex.Unlock()
   208  	if fake.FindByNameInOrgStub != nil {
   209  		return fake.FindByNameInOrgStub(name, owningOrgGUID)
   210  	} else {
   211  		return fake.findByNameInOrgReturns.result1, fake.findByNameInOrgReturns.result2
   212  	}
   213  }
   214  
   215  func (fake *FakeDomainRepository) FindByNameInOrgCallCount() int {
   216  	fake.findByNameInOrgMutex.RLock()
   217  	defer fake.findByNameInOrgMutex.RUnlock()
   218  	return len(fake.findByNameInOrgArgsForCall)
   219  }
   220  
   221  func (fake *FakeDomainRepository) FindByNameInOrgArgsForCall(i int) (string, string) {
   222  	fake.findByNameInOrgMutex.RLock()
   223  	defer fake.findByNameInOrgMutex.RUnlock()
   224  	return fake.findByNameInOrgArgsForCall[i].name, fake.findByNameInOrgArgsForCall[i].owningOrgGUID
   225  }
   226  
   227  func (fake *FakeDomainRepository) FindByNameInOrgReturns(result1 models.DomainFields, result2 error) {
   228  	fake.FindByNameInOrgStub = nil
   229  	fake.findByNameInOrgReturns = struct {
   230  		result1 models.DomainFields
   231  		result2 error
   232  	}{result1, result2}
   233  }
   234  
   235  func (fake *FakeDomainRepository) Create(domainName string, owningOrgGUID string) (createdDomain models.DomainFields, apiErr error) {
   236  	fake.createMutex.Lock()
   237  	fake.createArgsForCall = append(fake.createArgsForCall, struct {
   238  		domainName    string
   239  		owningOrgGUID string
   240  	}{domainName, owningOrgGUID})
   241  	fake.recordInvocation("Create", []interface{}{domainName, owningOrgGUID})
   242  	fake.createMutex.Unlock()
   243  	if fake.CreateStub != nil {
   244  		return fake.CreateStub(domainName, owningOrgGUID)
   245  	} else {
   246  		return fake.createReturns.result1, fake.createReturns.result2
   247  	}
   248  }
   249  
   250  func (fake *FakeDomainRepository) CreateCallCount() int {
   251  	fake.createMutex.RLock()
   252  	defer fake.createMutex.RUnlock()
   253  	return len(fake.createArgsForCall)
   254  }
   255  
   256  func (fake *FakeDomainRepository) CreateArgsForCall(i int) (string, string) {
   257  	fake.createMutex.RLock()
   258  	defer fake.createMutex.RUnlock()
   259  	return fake.createArgsForCall[i].domainName, fake.createArgsForCall[i].owningOrgGUID
   260  }
   261  
   262  func (fake *FakeDomainRepository) CreateReturns(result1 models.DomainFields, result2 error) {
   263  	fake.CreateStub = nil
   264  	fake.createReturns = struct {
   265  		result1 models.DomainFields
   266  		result2 error
   267  	}{result1, result2}
   268  }
   269  
   270  func (fake *FakeDomainRepository) CreateSharedDomain(domainName string, routerGroupGUID string) (apiErr error) {
   271  	fake.createSharedDomainMutex.Lock()
   272  	fake.createSharedDomainArgsForCall = append(fake.createSharedDomainArgsForCall, struct {
   273  		domainName      string
   274  		routerGroupGUID string
   275  	}{domainName, routerGroupGUID})
   276  	fake.recordInvocation("CreateSharedDomain", []interface{}{domainName, routerGroupGUID})
   277  	fake.createSharedDomainMutex.Unlock()
   278  	if fake.CreateSharedDomainStub != nil {
   279  		return fake.CreateSharedDomainStub(domainName, routerGroupGUID)
   280  	} else {
   281  		return fake.createSharedDomainReturns.result1
   282  	}
   283  }
   284  
   285  func (fake *FakeDomainRepository) CreateSharedDomainCallCount() int {
   286  	fake.createSharedDomainMutex.RLock()
   287  	defer fake.createSharedDomainMutex.RUnlock()
   288  	return len(fake.createSharedDomainArgsForCall)
   289  }
   290  
   291  func (fake *FakeDomainRepository) CreateSharedDomainArgsForCall(i int) (string, string) {
   292  	fake.createSharedDomainMutex.RLock()
   293  	defer fake.createSharedDomainMutex.RUnlock()
   294  	return fake.createSharedDomainArgsForCall[i].domainName, fake.createSharedDomainArgsForCall[i].routerGroupGUID
   295  }
   296  
   297  func (fake *FakeDomainRepository) CreateSharedDomainReturns(result1 error) {
   298  	fake.CreateSharedDomainStub = nil
   299  	fake.createSharedDomainReturns = struct {
   300  		result1 error
   301  	}{result1}
   302  }
   303  
   304  func (fake *FakeDomainRepository) Delete(domainGUID string) (apiErr error) {
   305  	fake.deleteMutex.Lock()
   306  	fake.deleteArgsForCall = append(fake.deleteArgsForCall, struct {
   307  		domainGUID string
   308  	}{domainGUID})
   309  	fake.recordInvocation("Delete", []interface{}{domainGUID})
   310  	fake.deleteMutex.Unlock()
   311  	if fake.DeleteStub != nil {
   312  		return fake.DeleteStub(domainGUID)
   313  	} else {
   314  		return fake.deleteReturns.result1
   315  	}
   316  }
   317  
   318  func (fake *FakeDomainRepository) DeleteCallCount() int {
   319  	fake.deleteMutex.RLock()
   320  	defer fake.deleteMutex.RUnlock()
   321  	return len(fake.deleteArgsForCall)
   322  }
   323  
   324  func (fake *FakeDomainRepository) DeleteArgsForCall(i int) string {
   325  	fake.deleteMutex.RLock()
   326  	defer fake.deleteMutex.RUnlock()
   327  	return fake.deleteArgsForCall[i].domainGUID
   328  }
   329  
   330  func (fake *FakeDomainRepository) DeleteReturns(result1 error) {
   331  	fake.DeleteStub = nil
   332  	fake.deleteReturns = struct {
   333  		result1 error
   334  	}{result1}
   335  }
   336  
   337  func (fake *FakeDomainRepository) DeleteSharedDomain(domainGUID string) (apiErr error) {
   338  	fake.deleteSharedDomainMutex.Lock()
   339  	fake.deleteSharedDomainArgsForCall = append(fake.deleteSharedDomainArgsForCall, struct {
   340  		domainGUID string
   341  	}{domainGUID})
   342  	fake.recordInvocation("DeleteSharedDomain", []interface{}{domainGUID})
   343  	fake.deleteSharedDomainMutex.Unlock()
   344  	if fake.DeleteSharedDomainStub != nil {
   345  		return fake.DeleteSharedDomainStub(domainGUID)
   346  	} else {
   347  		return fake.deleteSharedDomainReturns.result1
   348  	}
   349  }
   350  
   351  func (fake *FakeDomainRepository) DeleteSharedDomainCallCount() int {
   352  	fake.deleteSharedDomainMutex.RLock()
   353  	defer fake.deleteSharedDomainMutex.RUnlock()
   354  	return len(fake.deleteSharedDomainArgsForCall)
   355  }
   356  
   357  func (fake *FakeDomainRepository) DeleteSharedDomainArgsForCall(i int) string {
   358  	fake.deleteSharedDomainMutex.RLock()
   359  	defer fake.deleteSharedDomainMutex.RUnlock()
   360  	return fake.deleteSharedDomainArgsForCall[i].domainGUID
   361  }
   362  
   363  func (fake *FakeDomainRepository) DeleteSharedDomainReturns(result1 error) {
   364  	fake.DeleteSharedDomainStub = nil
   365  	fake.deleteSharedDomainReturns = struct {
   366  		result1 error
   367  	}{result1}
   368  }
   369  
   370  func (fake *FakeDomainRepository) FirstOrDefault(orgGUID string, name *string) (domain models.DomainFields, error error) {
   371  	fake.firstOrDefaultMutex.Lock()
   372  	fake.firstOrDefaultArgsForCall = append(fake.firstOrDefaultArgsForCall, struct {
   373  		orgGUID string
   374  		name    *string
   375  	}{orgGUID, name})
   376  	fake.recordInvocation("FirstOrDefault", []interface{}{orgGUID, name})
   377  	fake.firstOrDefaultMutex.Unlock()
   378  	if fake.FirstOrDefaultStub != nil {
   379  		return fake.FirstOrDefaultStub(orgGUID, name)
   380  	} else {
   381  		return fake.firstOrDefaultReturns.result1, fake.firstOrDefaultReturns.result2
   382  	}
   383  }
   384  
   385  func (fake *FakeDomainRepository) FirstOrDefaultCallCount() int {
   386  	fake.firstOrDefaultMutex.RLock()
   387  	defer fake.firstOrDefaultMutex.RUnlock()
   388  	return len(fake.firstOrDefaultArgsForCall)
   389  }
   390  
   391  func (fake *FakeDomainRepository) FirstOrDefaultArgsForCall(i int) (string, *string) {
   392  	fake.firstOrDefaultMutex.RLock()
   393  	defer fake.firstOrDefaultMutex.RUnlock()
   394  	return fake.firstOrDefaultArgsForCall[i].orgGUID, fake.firstOrDefaultArgsForCall[i].name
   395  }
   396  
   397  func (fake *FakeDomainRepository) FirstOrDefaultReturns(result1 models.DomainFields, result2 error) {
   398  	fake.FirstOrDefaultStub = nil
   399  	fake.firstOrDefaultReturns = struct {
   400  		result1 models.DomainFields
   401  		result2 error
   402  	}{result1, result2}
   403  }
   404  
   405  func (fake *FakeDomainRepository) Invocations() map[string][][]interface{} {
   406  	fake.invocationsMutex.RLock()
   407  	defer fake.invocationsMutex.RUnlock()
   408  	fake.listDomainsForOrgMutex.RLock()
   409  	defer fake.listDomainsForOrgMutex.RUnlock()
   410  	fake.findSharedByNameMutex.RLock()
   411  	defer fake.findSharedByNameMutex.RUnlock()
   412  	fake.findPrivateByNameMutex.RLock()
   413  	defer fake.findPrivateByNameMutex.RUnlock()
   414  	fake.findByNameInOrgMutex.RLock()
   415  	defer fake.findByNameInOrgMutex.RUnlock()
   416  	fake.createMutex.RLock()
   417  	defer fake.createMutex.RUnlock()
   418  	fake.createSharedDomainMutex.RLock()
   419  	defer fake.createSharedDomainMutex.RUnlock()
   420  	fake.deleteMutex.RLock()
   421  	defer fake.deleteMutex.RUnlock()
   422  	fake.deleteSharedDomainMutex.RLock()
   423  	defer fake.deleteSharedDomainMutex.RUnlock()
   424  	fake.firstOrDefaultMutex.RLock()
   425  	defer fake.firstOrDefaultMutex.RUnlock()
   426  	return fake.invocations
   427  }
   428  
   429  func (fake *FakeDomainRepository) recordInvocation(key string, args []interface{}) {
   430  	fake.invocationsMutex.Lock()
   431  	defer fake.invocationsMutex.Unlock()
   432  	if fake.invocations == nil {
   433  		fake.invocations = map[string][][]interface{}{}
   434  	}
   435  	if fake.invocations[key] == nil {
   436  		fake.invocations[key] = [][]interface{}{}
   437  	}
   438  	fake.invocations[key] = append(fake.invocations[key], args)
   439  }
   440  
   441  var _ api.DomainRepository = new(FakeDomainRepository)