github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/api/apifakes/fake_service_summary_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 FakeServiceSummaryRepository struct {
    12  	GetSummariesInCurrentSpaceStub        func() ([]models.ServiceInstance, error)
    13  	getSummariesInCurrentSpaceMutex       sync.RWMutex
    14  	getSummariesInCurrentSpaceArgsForCall []struct{}
    15  	getSummariesInCurrentSpaceReturns     struct {
    16  		result1 []models.ServiceInstance
    17  		result2 error
    18  	}
    19  	invocations      map[string][][]interface{}
    20  	invocationsMutex sync.RWMutex
    21  }
    22  
    23  func (fake *FakeServiceSummaryRepository) GetSummariesInCurrentSpace() ([]models.ServiceInstance, error) {
    24  	fake.getSummariesInCurrentSpaceMutex.Lock()
    25  	fake.getSummariesInCurrentSpaceArgsForCall = append(fake.getSummariesInCurrentSpaceArgsForCall, struct{}{})
    26  	fake.recordInvocation("GetSummariesInCurrentSpace", []interface{}{})
    27  	fake.getSummariesInCurrentSpaceMutex.Unlock()
    28  	if fake.GetSummariesInCurrentSpaceStub != nil {
    29  		return fake.GetSummariesInCurrentSpaceStub()
    30  	} else {
    31  		return fake.getSummariesInCurrentSpaceReturns.result1, fake.getSummariesInCurrentSpaceReturns.result2
    32  	}
    33  }
    34  
    35  func (fake *FakeServiceSummaryRepository) GetSummariesInCurrentSpaceCallCount() int {
    36  	fake.getSummariesInCurrentSpaceMutex.RLock()
    37  	defer fake.getSummariesInCurrentSpaceMutex.RUnlock()
    38  	return len(fake.getSummariesInCurrentSpaceArgsForCall)
    39  }
    40  
    41  func (fake *FakeServiceSummaryRepository) GetSummariesInCurrentSpaceReturns(result1 []models.ServiceInstance, result2 error) {
    42  	fake.GetSummariesInCurrentSpaceStub = nil
    43  	fake.getSummariesInCurrentSpaceReturns = struct {
    44  		result1 []models.ServiceInstance
    45  		result2 error
    46  	}{result1, result2}
    47  }
    48  
    49  func (fake *FakeServiceSummaryRepository) Invocations() map[string][][]interface{} {
    50  	fake.invocationsMutex.RLock()
    51  	defer fake.invocationsMutex.RUnlock()
    52  	fake.getSummariesInCurrentSpaceMutex.RLock()
    53  	defer fake.getSummariesInCurrentSpaceMutex.RUnlock()
    54  	return fake.invocations
    55  }
    56  
    57  func (fake *FakeServiceSummaryRepository) recordInvocation(key string, args []interface{}) {
    58  	fake.invocationsMutex.Lock()
    59  	defer fake.invocationsMutex.Unlock()
    60  	if fake.invocations == nil {
    61  		fake.invocations = map[string][][]interface{}{}
    62  	}
    63  	if fake.invocations[key] == nil {
    64  		fake.invocations[key] = [][]interface{}{}
    65  	}
    66  	fake.invocations[key] = append(fake.invocations[key], args)
    67  }
    68  
    69  var _ api.ServiceSummaryRepository = new(FakeServiceSummaryRepository)