github.com/ablease/cli@v6.37.1-0.20180613014814-3adbb7d7fb19+incompatible/cf/api/apifakes/fake_app_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 FakeAppSummaryRepository struct {
    12  	GetSummariesInCurrentSpaceStub        func() (apps []models.Application, apiErr error)
    13  	getSummariesInCurrentSpaceMutex       sync.RWMutex
    14  	getSummariesInCurrentSpaceArgsForCall []struct{}
    15  	getSummariesInCurrentSpaceReturns     struct {
    16  		result1 []models.Application
    17  		result2 error
    18  	}
    19  	GetSummaryStub        func(appGUID string) (summary models.Application, apiErr error)
    20  	getSummaryMutex       sync.RWMutex
    21  	getSummaryArgsForCall []struct {
    22  		appGUID string
    23  	}
    24  	getSummaryReturns struct {
    25  		result1 models.Application
    26  		result2 error
    27  	}
    28  	invocations      map[string][][]interface{}
    29  	invocationsMutex sync.RWMutex
    30  }
    31  
    32  func (fake *FakeAppSummaryRepository) GetSummariesInCurrentSpace() (apps []models.Application, apiErr error) {
    33  	fake.getSummariesInCurrentSpaceMutex.Lock()
    34  	fake.getSummariesInCurrentSpaceArgsForCall = append(fake.getSummariesInCurrentSpaceArgsForCall, struct{}{})
    35  	fake.recordInvocation("GetSummariesInCurrentSpace", []interface{}{})
    36  	fake.getSummariesInCurrentSpaceMutex.Unlock()
    37  	if fake.GetSummariesInCurrentSpaceStub != nil {
    38  		return fake.GetSummariesInCurrentSpaceStub()
    39  	} else {
    40  		return fake.getSummariesInCurrentSpaceReturns.result1, fake.getSummariesInCurrentSpaceReturns.result2
    41  	}
    42  }
    43  
    44  func (fake *FakeAppSummaryRepository) GetSummariesInCurrentSpaceCallCount() int {
    45  	fake.getSummariesInCurrentSpaceMutex.RLock()
    46  	defer fake.getSummariesInCurrentSpaceMutex.RUnlock()
    47  	return len(fake.getSummariesInCurrentSpaceArgsForCall)
    48  }
    49  
    50  func (fake *FakeAppSummaryRepository) GetSummariesInCurrentSpaceReturns(result1 []models.Application, result2 error) {
    51  	fake.GetSummariesInCurrentSpaceStub = nil
    52  	fake.getSummariesInCurrentSpaceReturns = struct {
    53  		result1 []models.Application
    54  		result2 error
    55  	}{result1, result2}
    56  }
    57  
    58  func (fake *FakeAppSummaryRepository) GetSummary(appGUID string) (summary models.Application, apiErr error) {
    59  	fake.getSummaryMutex.Lock()
    60  	fake.getSummaryArgsForCall = append(fake.getSummaryArgsForCall, struct {
    61  		appGUID string
    62  	}{appGUID})
    63  	fake.recordInvocation("GetSummary", []interface{}{appGUID})
    64  	fake.getSummaryMutex.Unlock()
    65  	if fake.GetSummaryStub != nil {
    66  		return fake.GetSummaryStub(appGUID)
    67  	} else {
    68  		return fake.getSummaryReturns.result1, fake.getSummaryReturns.result2
    69  	}
    70  }
    71  
    72  func (fake *FakeAppSummaryRepository) GetSummaryCallCount() int {
    73  	fake.getSummaryMutex.RLock()
    74  	defer fake.getSummaryMutex.RUnlock()
    75  	return len(fake.getSummaryArgsForCall)
    76  }
    77  
    78  func (fake *FakeAppSummaryRepository) GetSummaryArgsForCall(i int) string {
    79  	fake.getSummaryMutex.RLock()
    80  	defer fake.getSummaryMutex.RUnlock()
    81  	return fake.getSummaryArgsForCall[i].appGUID
    82  }
    83  
    84  func (fake *FakeAppSummaryRepository) GetSummaryReturns(result1 models.Application, result2 error) {
    85  	fake.GetSummaryStub = nil
    86  	fake.getSummaryReturns = struct {
    87  		result1 models.Application
    88  		result2 error
    89  	}{result1, result2}
    90  }
    91  
    92  func (fake *FakeAppSummaryRepository) Invocations() map[string][][]interface{} {
    93  	fake.invocationsMutex.RLock()
    94  	defer fake.invocationsMutex.RUnlock()
    95  	fake.getSummariesInCurrentSpaceMutex.RLock()
    96  	defer fake.getSummariesInCurrentSpaceMutex.RUnlock()
    97  	fake.getSummaryMutex.RLock()
    98  	defer fake.getSummaryMutex.RUnlock()
    99  	return fake.invocations
   100  }
   101  
   102  func (fake *FakeAppSummaryRepository) recordInvocation(key string, args []interface{}) {
   103  	fake.invocationsMutex.Lock()
   104  	defer fake.invocationsMutex.Unlock()
   105  	if fake.invocations == nil {
   106  		fake.invocations = map[string][][]interface{}{}
   107  	}
   108  	if fake.invocations[key] == nil {
   109  		fake.invocations[key] = [][]interface{}{}
   110  	}
   111  	fake.invocations[key] = append(fake.invocations[key], args)
   112  }
   113  
   114  var _ api.AppSummaryRepository = new(FakeAppSummaryRepository)