github.com/swisscom/cloudfoundry-cli@v7.1.0+incompatible/cf/configuration/configurationfakes/fake_persistor.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     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  	}
    15  	ExistsStub        func() bool
    16  	existsMutex       sync.RWMutex
    17  	existsArgsForCall []struct {
    18  	}
    19  	existsReturns struct {
    20  		result1 bool
    21  	}
    22  	existsReturnsOnCall map[int]struct {
    23  		result1 bool
    24  	}
    25  	LoadStub        func(configuration.DataInterface) error
    26  	loadMutex       sync.RWMutex
    27  	loadArgsForCall []struct {
    28  		arg1 configuration.DataInterface
    29  	}
    30  	loadReturns struct {
    31  		result1 error
    32  	}
    33  	loadReturnsOnCall map[int]struct {
    34  		result1 error
    35  	}
    36  	SaveStub        func(configuration.DataInterface) error
    37  	saveMutex       sync.RWMutex
    38  	saveArgsForCall []struct {
    39  		arg1 configuration.DataInterface
    40  	}
    41  	saveReturns struct {
    42  		result1 error
    43  	}
    44  	saveReturnsOnCall map[int]struct {
    45  		result1 error
    46  	}
    47  	invocations      map[string][][]interface{}
    48  	invocationsMutex sync.RWMutex
    49  }
    50  
    51  func (fake *FakePersistor) Delete() {
    52  	fake.deleteMutex.Lock()
    53  	fake.deleteArgsForCall = append(fake.deleteArgsForCall, struct {
    54  	}{})
    55  	fake.recordInvocation("Delete", []interface{}{})
    56  	fake.deleteMutex.Unlock()
    57  	if fake.DeleteStub != nil {
    58  		fake.DeleteStub()
    59  	}
    60  }
    61  
    62  func (fake *FakePersistor) DeleteCallCount() int {
    63  	fake.deleteMutex.RLock()
    64  	defer fake.deleteMutex.RUnlock()
    65  	return len(fake.deleteArgsForCall)
    66  }
    67  
    68  func (fake *FakePersistor) DeleteCalls(stub func()) {
    69  	fake.deleteMutex.Lock()
    70  	defer fake.deleteMutex.Unlock()
    71  	fake.DeleteStub = stub
    72  }
    73  
    74  func (fake *FakePersistor) Exists() bool {
    75  	fake.existsMutex.Lock()
    76  	ret, specificReturn := fake.existsReturnsOnCall[len(fake.existsArgsForCall)]
    77  	fake.existsArgsForCall = append(fake.existsArgsForCall, struct {
    78  	}{})
    79  	fake.recordInvocation("Exists", []interface{}{})
    80  	fake.existsMutex.Unlock()
    81  	if fake.ExistsStub != nil {
    82  		return fake.ExistsStub()
    83  	}
    84  	if specificReturn {
    85  		return ret.result1
    86  	}
    87  	fakeReturns := fake.existsReturns
    88  	return fakeReturns.result1
    89  }
    90  
    91  func (fake *FakePersistor) ExistsCallCount() int {
    92  	fake.existsMutex.RLock()
    93  	defer fake.existsMutex.RUnlock()
    94  	return len(fake.existsArgsForCall)
    95  }
    96  
    97  func (fake *FakePersistor) ExistsCalls(stub func() bool) {
    98  	fake.existsMutex.Lock()
    99  	defer fake.existsMutex.Unlock()
   100  	fake.ExistsStub = stub
   101  }
   102  
   103  func (fake *FakePersistor) ExistsReturns(result1 bool) {
   104  	fake.existsMutex.Lock()
   105  	defer fake.existsMutex.Unlock()
   106  	fake.ExistsStub = nil
   107  	fake.existsReturns = struct {
   108  		result1 bool
   109  	}{result1}
   110  }
   111  
   112  func (fake *FakePersistor) ExistsReturnsOnCall(i int, result1 bool) {
   113  	fake.existsMutex.Lock()
   114  	defer fake.existsMutex.Unlock()
   115  	fake.ExistsStub = nil
   116  	if fake.existsReturnsOnCall == nil {
   117  		fake.existsReturnsOnCall = make(map[int]struct {
   118  			result1 bool
   119  		})
   120  	}
   121  	fake.existsReturnsOnCall[i] = struct {
   122  		result1 bool
   123  	}{result1}
   124  }
   125  
   126  func (fake *FakePersistor) Load(arg1 configuration.DataInterface) error {
   127  	fake.loadMutex.Lock()
   128  	ret, specificReturn := fake.loadReturnsOnCall[len(fake.loadArgsForCall)]
   129  	fake.loadArgsForCall = append(fake.loadArgsForCall, struct {
   130  		arg1 configuration.DataInterface
   131  	}{arg1})
   132  	fake.recordInvocation("Load", []interface{}{arg1})
   133  	fake.loadMutex.Unlock()
   134  	if fake.LoadStub != nil {
   135  		return fake.LoadStub(arg1)
   136  	}
   137  	if specificReturn {
   138  		return ret.result1
   139  	}
   140  	fakeReturns := fake.loadReturns
   141  	return fakeReturns.result1
   142  }
   143  
   144  func (fake *FakePersistor) LoadCallCount() int {
   145  	fake.loadMutex.RLock()
   146  	defer fake.loadMutex.RUnlock()
   147  	return len(fake.loadArgsForCall)
   148  }
   149  
   150  func (fake *FakePersistor) LoadCalls(stub func(configuration.DataInterface) error) {
   151  	fake.loadMutex.Lock()
   152  	defer fake.loadMutex.Unlock()
   153  	fake.LoadStub = stub
   154  }
   155  
   156  func (fake *FakePersistor) LoadArgsForCall(i int) configuration.DataInterface {
   157  	fake.loadMutex.RLock()
   158  	defer fake.loadMutex.RUnlock()
   159  	argsForCall := fake.loadArgsForCall[i]
   160  	return argsForCall.arg1
   161  }
   162  
   163  func (fake *FakePersistor) LoadReturns(result1 error) {
   164  	fake.loadMutex.Lock()
   165  	defer fake.loadMutex.Unlock()
   166  	fake.LoadStub = nil
   167  	fake.loadReturns = struct {
   168  		result1 error
   169  	}{result1}
   170  }
   171  
   172  func (fake *FakePersistor) LoadReturnsOnCall(i int, result1 error) {
   173  	fake.loadMutex.Lock()
   174  	defer fake.loadMutex.Unlock()
   175  	fake.LoadStub = nil
   176  	if fake.loadReturnsOnCall == nil {
   177  		fake.loadReturnsOnCall = make(map[int]struct {
   178  			result1 error
   179  		})
   180  	}
   181  	fake.loadReturnsOnCall[i] = struct {
   182  		result1 error
   183  	}{result1}
   184  }
   185  
   186  func (fake *FakePersistor) Save(arg1 configuration.DataInterface) error {
   187  	fake.saveMutex.Lock()
   188  	ret, specificReturn := fake.saveReturnsOnCall[len(fake.saveArgsForCall)]
   189  	fake.saveArgsForCall = append(fake.saveArgsForCall, struct {
   190  		arg1 configuration.DataInterface
   191  	}{arg1})
   192  	fake.recordInvocation("Save", []interface{}{arg1})
   193  	fake.saveMutex.Unlock()
   194  	if fake.SaveStub != nil {
   195  		return fake.SaveStub(arg1)
   196  	}
   197  	if specificReturn {
   198  		return ret.result1
   199  	}
   200  	fakeReturns := fake.saveReturns
   201  	return fakeReturns.result1
   202  }
   203  
   204  func (fake *FakePersistor) SaveCallCount() int {
   205  	fake.saveMutex.RLock()
   206  	defer fake.saveMutex.RUnlock()
   207  	return len(fake.saveArgsForCall)
   208  }
   209  
   210  func (fake *FakePersistor) SaveCalls(stub func(configuration.DataInterface) error) {
   211  	fake.saveMutex.Lock()
   212  	defer fake.saveMutex.Unlock()
   213  	fake.SaveStub = stub
   214  }
   215  
   216  func (fake *FakePersistor) SaveArgsForCall(i int) configuration.DataInterface {
   217  	fake.saveMutex.RLock()
   218  	defer fake.saveMutex.RUnlock()
   219  	argsForCall := fake.saveArgsForCall[i]
   220  	return argsForCall.arg1
   221  }
   222  
   223  func (fake *FakePersistor) SaveReturns(result1 error) {
   224  	fake.saveMutex.Lock()
   225  	defer fake.saveMutex.Unlock()
   226  	fake.SaveStub = nil
   227  	fake.saveReturns = struct {
   228  		result1 error
   229  	}{result1}
   230  }
   231  
   232  func (fake *FakePersistor) SaveReturnsOnCall(i int, result1 error) {
   233  	fake.saveMutex.Lock()
   234  	defer fake.saveMutex.Unlock()
   235  	fake.SaveStub = nil
   236  	if fake.saveReturnsOnCall == nil {
   237  		fake.saveReturnsOnCall = make(map[int]struct {
   238  			result1 error
   239  		})
   240  	}
   241  	fake.saveReturnsOnCall[i] = struct {
   242  		result1 error
   243  	}{result1}
   244  }
   245  
   246  func (fake *FakePersistor) Invocations() map[string][][]interface{} {
   247  	fake.invocationsMutex.RLock()
   248  	defer fake.invocationsMutex.RUnlock()
   249  	fake.deleteMutex.RLock()
   250  	defer fake.deleteMutex.RUnlock()
   251  	fake.existsMutex.RLock()
   252  	defer fake.existsMutex.RUnlock()
   253  	fake.loadMutex.RLock()
   254  	defer fake.loadMutex.RUnlock()
   255  	fake.saveMutex.RLock()
   256  	defer fake.saveMutex.RUnlock()
   257  	copiedInvocations := map[string][][]interface{}{}
   258  	for key, value := range fake.invocations {
   259  		copiedInvocations[key] = value
   260  	}
   261  	return copiedInvocations
   262  }
   263  
   264  func (fake *FakePersistor) recordInvocation(key string, args []interface{}) {
   265  	fake.invocationsMutex.Lock()
   266  	defer fake.invocationsMutex.Unlock()
   267  	if fake.invocations == nil {
   268  		fake.invocations = map[string][][]interface{}{}
   269  	}
   270  	if fake.invocations[key] == nil {
   271  		fake.invocations[key] = [][]interface{}{}
   272  	}
   273  	fake.invocations[key] = append(fake.invocations[key], args)
   274  }
   275  
   276  var _ configuration.Persistor = new(FakePersistor)