github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/configuration/configurationfakes/fake_persistor.go (about)

     1  // This file was generated by counterfeiter
     2  package configurationfakes
     3  
     4  import (
     5  	"sync"
     6  
     7  	"code.cloudfoundry.org/cli/cf/configuration"
     8  )
     9  
    10  type FakePersistor struct {
    11  	DeleteStub        func()
    12  	deleteMutex       sync.RWMutex
    13  	deleteArgsForCall []struct{}
    14  	ExistsStub        func() bool
    15  	existsMutex       sync.RWMutex
    16  	existsArgsForCall []struct{}
    17  	existsReturns     struct {
    18  		result1 bool
    19  	}
    20  	LoadStub        func(configuration.DataInterface) error
    21  	loadMutex       sync.RWMutex
    22  	loadArgsForCall []struct {
    23  		arg1 configuration.DataInterface
    24  	}
    25  	loadReturns struct {
    26  		result1 error
    27  	}
    28  	SaveStub        func(configuration.DataInterface) error
    29  	saveMutex       sync.RWMutex
    30  	saveArgsForCall []struct {
    31  		arg1 configuration.DataInterface
    32  	}
    33  	saveReturns struct {
    34  		result1 error
    35  	}
    36  	invocations      map[string][][]interface{}
    37  	invocationsMutex sync.RWMutex
    38  }
    39  
    40  func (fake *FakePersistor) Delete() {
    41  	fake.deleteMutex.Lock()
    42  	fake.deleteArgsForCall = append(fake.deleteArgsForCall, struct{}{})
    43  	fake.recordInvocation("Delete", []interface{}{})
    44  	fake.deleteMutex.Unlock()
    45  	if fake.DeleteStub != nil {
    46  		fake.DeleteStub()
    47  	}
    48  }
    49  
    50  func (fake *FakePersistor) DeleteCallCount() int {
    51  	fake.deleteMutex.RLock()
    52  	defer fake.deleteMutex.RUnlock()
    53  	return len(fake.deleteArgsForCall)
    54  }
    55  
    56  func (fake *FakePersistor) Exists() bool {
    57  	fake.existsMutex.Lock()
    58  	fake.existsArgsForCall = append(fake.existsArgsForCall, struct{}{})
    59  	fake.recordInvocation("Exists", []interface{}{})
    60  	fake.existsMutex.Unlock()
    61  	if fake.ExistsStub != nil {
    62  		return fake.ExistsStub()
    63  	} else {
    64  		return fake.existsReturns.result1
    65  	}
    66  }
    67  
    68  func (fake *FakePersistor) ExistsCallCount() int {
    69  	fake.existsMutex.RLock()
    70  	defer fake.existsMutex.RUnlock()
    71  	return len(fake.existsArgsForCall)
    72  }
    73  
    74  func (fake *FakePersistor) ExistsReturns(result1 bool) {
    75  	fake.ExistsStub = nil
    76  	fake.existsReturns = struct {
    77  		result1 bool
    78  	}{result1}
    79  }
    80  
    81  func (fake *FakePersistor) Load(arg1 configuration.DataInterface) error {
    82  	fake.loadMutex.Lock()
    83  	fake.loadArgsForCall = append(fake.loadArgsForCall, struct {
    84  		arg1 configuration.DataInterface
    85  	}{arg1})
    86  	fake.recordInvocation("Load", []interface{}{arg1})
    87  	fake.loadMutex.Unlock()
    88  	if fake.LoadStub != nil {
    89  		return fake.LoadStub(arg1)
    90  	} else {
    91  		return fake.loadReturns.result1
    92  	}
    93  }
    94  
    95  func (fake *FakePersistor) LoadCallCount() int {
    96  	fake.loadMutex.RLock()
    97  	defer fake.loadMutex.RUnlock()
    98  	return len(fake.loadArgsForCall)
    99  }
   100  
   101  func (fake *FakePersistor) LoadArgsForCall(i int) configuration.DataInterface {
   102  	fake.loadMutex.RLock()
   103  	defer fake.loadMutex.RUnlock()
   104  	return fake.loadArgsForCall[i].arg1
   105  }
   106  
   107  func (fake *FakePersistor) LoadReturns(result1 error) {
   108  	fake.LoadStub = nil
   109  	fake.loadReturns = struct {
   110  		result1 error
   111  	}{result1}
   112  }
   113  
   114  func (fake *FakePersistor) Save(arg1 configuration.DataInterface) error {
   115  	fake.saveMutex.Lock()
   116  	fake.saveArgsForCall = append(fake.saveArgsForCall, struct {
   117  		arg1 configuration.DataInterface
   118  	}{arg1})
   119  	fake.recordInvocation("Save", []interface{}{arg1})
   120  	fake.saveMutex.Unlock()
   121  	if fake.SaveStub != nil {
   122  		return fake.SaveStub(arg1)
   123  	} else {
   124  		return fake.saveReturns.result1
   125  	}
   126  }
   127  
   128  func (fake *FakePersistor) SaveCallCount() int {
   129  	fake.saveMutex.RLock()
   130  	defer fake.saveMutex.RUnlock()
   131  	return len(fake.saveArgsForCall)
   132  }
   133  
   134  func (fake *FakePersistor) SaveArgsForCall(i int) configuration.DataInterface {
   135  	fake.saveMutex.RLock()
   136  	defer fake.saveMutex.RUnlock()
   137  	return fake.saveArgsForCall[i].arg1
   138  }
   139  
   140  func (fake *FakePersistor) SaveReturns(result1 error) {
   141  	fake.SaveStub = nil
   142  	fake.saveReturns = struct {
   143  		result1 error
   144  	}{result1}
   145  }
   146  
   147  func (fake *FakePersistor) Invocations() map[string][][]interface{} {
   148  	fake.invocationsMutex.RLock()
   149  	defer fake.invocationsMutex.RUnlock()
   150  	fake.deleteMutex.RLock()
   151  	defer fake.deleteMutex.RUnlock()
   152  	fake.existsMutex.RLock()
   153  	defer fake.existsMutex.RUnlock()
   154  	fake.loadMutex.RLock()
   155  	defer fake.loadMutex.RUnlock()
   156  	fake.saveMutex.RLock()
   157  	defer fake.saveMutex.RUnlock()
   158  	return fake.invocations
   159  }
   160  
   161  func (fake *FakePersistor) recordInvocation(key string, args []interface{}) {
   162  	fake.invocationsMutex.Lock()
   163  	defer fake.invocationsMutex.Unlock()
   164  	if fake.invocations == nil {
   165  		fake.invocations = map[string][][]interface{}{}
   166  	}
   167  	if fake.invocations[key] == nil {
   168  		fake.invocations[key] = [][]interface{}{}
   169  	}
   170  	fake.invocations[key] = append(fake.invocations[key], args)
   171  }
   172  
   173  var _ configuration.Persistor = new(FakePersistor)