github.com/ablease/cli@v6.37.1-0.20180613014814-3adbb7d7fb19+incompatible/cf/api/logs/logsfakes/fake_repository.go (about)

     1  // This file was generated by counterfeiter
     2  package logsfakes
     3  
     4  import (
     5  	"sync"
     6  
     7  	"code.cloudfoundry.org/cli/cf/api/logs"
     8  )
     9  
    10  type FakeRepository struct {
    11  	RecentLogsForStub        func(appGUID string) ([]logs.Loggable, error)
    12  	recentLogsForMutex       sync.RWMutex
    13  	recentLogsForArgsForCall []struct {
    14  		appGUID string
    15  	}
    16  	recentLogsForReturns struct {
    17  		result1 []logs.Loggable
    18  		result2 error
    19  	}
    20  	TailLogsForStub        func(appGUID string, onConnect func(), logChan chan<- logs.Loggable, errChan chan<- error)
    21  	tailLogsForMutex       sync.RWMutex
    22  	tailLogsForArgsForCall []struct {
    23  		appGUID   string
    24  		onConnect func()
    25  		logChan   chan<- logs.Loggable
    26  		errChan   chan<- error
    27  	}
    28  	CloseStub        func()
    29  	closeMutex       sync.RWMutex
    30  	closeArgsForCall []struct{}
    31  	invocations      map[string][][]interface{}
    32  	invocationsMutex sync.RWMutex
    33  }
    34  
    35  func (fake *FakeRepository) RecentLogsFor(appGUID string) ([]logs.Loggable, error) {
    36  	fake.recentLogsForMutex.Lock()
    37  	fake.recentLogsForArgsForCall = append(fake.recentLogsForArgsForCall, struct {
    38  		appGUID string
    39  	}{appGUID})
    40  	fake.recordInvocation("RecentLogsFor", []interface{}{appGUID})
    41  	fake.recentLogsForMutex.Unlock()
    42  	if fake.RecentLogsForStub != nil {
    43  		return fake.RecentLogsForStub(appGUID)
    44  	} else {
    45  		return fake.recentLogsForReturns.result1, fake.recentLogsForReturns.result2
    46  	}
    47  }
    48  
    49  func (fake *FakeRepository) RecentLogsForCallCount() int {
    50  	fake.recentLogsForMutex.RLock()
    51  	defer fake.recentLogsForMutex.RUnlock()
    52  	return len(fake.recentLogsForArgsForCall)
    53  }
    54  
    55  func (fake *FakeRepository) RecentLogsForArgsForCall(i int) string {
    56  	fake.recentLogsForMutex.RLock()
    57  	defer fake.recentLogsForMutex.RUnlock()
    58  	return fake.recentLogsForArgsForCall[i].appGUID
    59  }
    60  
    61  func (fake *FakeRepository) RecentLogsForReturns(result1 []logs.Loggable, result2 error) {
    62  	fake.RecentLogsForStub = nil
    63  	fake.recentLogsForReturns = struct {
    64  		result1 []logs.Loggable
    65  		result2 error
    66  	}{result1, result2}
    67  }
    68  
    69  func (fake *FakeRepository) TailLogsFor(appGUID string, onConnect func(), logChan chan<- logs.Loggable, errChan chan<- error) {
    70  	fake.tailLogsForMutex.Lock()
    71  	fake.tailLogsForArgsForCall = append(fake.tailLogsForArgsForCall, struct {
    72  		appGUID   string
    73  		onConnect func()
    74  		logChan   chan<- logs.Loggable
    75  		errChan   chan<- error
    76  	}{appGUID, onConnect, logChan, errChan})
    77  	fake.recordInvocation("TailLogsFor", []interface{}{appGUID, onConnect, logChan, errChan})
    78  	fake.tailLogsForMutex.Unlock()
    79  	if fake.TailLogsForStub != nil {
    80  		fake.TailLogsForStub(appGUID, onConnect, logChan, errChan)
    81  	}
    82  }
    83  
    84  func (fake *FakeRepository) TailLogsForCallCount() int {
    85  	fake.tailLogsForMutex.RLock()
    86  	defer fake.tailLogsForMutex.RUnlock()
    87  	return len(fake.tailLogsForArgsForCall)
    88  }
    89  
    90  func (fake *FakeRepository) TailLogsForArgsForCall(i int) (string, func(), chan<- logs.Loggable, chan<- error) {
    91  	fake.tailLogsForMutex.RLock()
    92  	defer fake.tailLogsForMutex.RUnlock()
    93  	return fake.tailLogsForArgsForCall[i].appGUID, fake.tailLogsForArgsForCall[i].onConnect, fake.tailLogsForArgsForCall[i].logChan, fake.tailLogsForArgsForCall[i].errChan
    94  }
    95  
    96  func (fake *FakeRepository) Close() {
    97  	fake.closeMutex.Lock()
    98  	fake.closeArgsForCall = append(fake.closeArgsForCall, struct{}{})
    99  	fake.recordInvocation("Close", []interface{}{})
   100  	fake.closeMutex.Unlock()
   101  	if fake.CloseStub != nil {
   102  		fake.CloseStub()
   103  	}
   104  }
   105  
   106  func (fake *FakeRepository) CloseCallCount() int {
   107  	fake.closeMutex.RLock()
   108  	defer fake.closeMutex.RUnlock()
   109  	return len(fake.closeArgsForCall)
   110  }
   111  
   112  func (fake *FakeRepository) Invocations() map[string][][]interface{} {
   113  	fake.invocationsMutex.RLock()
   114  	defer fake.invocationsMutex.RUnlock()
   115  	fake.recentLogsForMutex.RLock()
   116  	defer fake.recentLogsForMutex.RUnlock()
   117  	fake.tailLogsForMutex.RLock()
   118  	defer fake.tailLogsForMutex.RUnlock()
   119  	fake.closeMutex.RLock()
   120  	defer fake.closeMutex.RUnlock()
   121  	return fake.invocations
   122  }
   123  
   124  func (fake *FakeRepository) recordInvocation(key string, args []interface{}) {
   125  	fake.invocationsMutex.Lock()
   126  	defer fake.invocationsMutex.Unlock()
   127  	if fake.invocations == nil {
   128  		fake.invocations = map[string][][]interface{}{}
   129  	}
   130  	if fake.invocations[key] == nil {
   131  		fake.invocations[key] = [][]interface{}{}
   132  	}
   133  	fake.invocations[key] = append(fake.invocations[key], args)
   134  }
   135  
   136  var _ logs.Repository = new(FakeRepository)