github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/requirements/requirementsfakes/fake_config_refresher.go (about)

     1  // This file was generated by counterfeiter
     2  package requirementsfakes
     3  
     4  import (
     5  	"sync"
     6  
     7  	"code.cloudfoundry.org/cli/cf/configuration/coreconfig"
     8  	"code.cloudfoundry.org/cli/cf/requirements"
     9  )
    10  
    11  type FakeConfigRefresher struct {
    12  	RefreshStub        func() (coreconfig.Warning, error)
    13  	refreshMutex       sync.RWMutex
    14  	refreshArgsForCall []struct{}
    15  	refreshReturns     struct {
    16  		result1 coreconfig.Warning
    17  		result2 error
    18  	}
    19  	invocations      map[string][][]interface{}
    20  	invocationsMutex sync.RWMutex
    21  }
    22  
    23  func (fake *FakeConfigRefresher) Refresh() (coreconfig.Warning, error) {
    24  	fake.refreshMutex.Lock()
    25  	fake.refreshArgsForCall = append(fake.refreshArgsForCall, struct{}{})
    26  	fake.recordInvocation("Refresh", []interface{}{})
    27  	fake.refreshMutex.Unlock()
    28  	if fake.RefreshStub != nil {
    29  		return fake.RefreshStub()
    30  	} else {
    31  		return fake.refreshReturns.result1, fake.refreshReturns.result2
    32  	}
    33  }
    34  
    35  func (fake *FakeConfigRefresher) RefreshCallCount() int {
    36  	fake.refreshMutex.RLock()
    37  	defer fake.refreshMutex.RUnlock()
    38  	return len(fake.refreshArgsForCall)
    39  }
    40  
    41  func (fake *FakeConfigRefresher) RefreshReturns(result1 coreconfig.Warning, result2 error) {
    42  	fake.RefreshStub = nil
    43  	fake.refreshReturns = struct {
    44  		result1 coreconfig.Warning
    45  		result2 error
    46  	}{result1, result2}
    47  }
    48  
    49  func (fake *FakeConfigRefresher) Invocations() map[string][][]interface{} {
    50  	fake.invocationsMutex.RLock()
    51  	defer fake.invocationsMutex.RUnlock()
    52  	fake.refreshMutex.RLock()
    53  	defer fake.refreshMutex.RUnlock()
    54  	return fake.invocations
    55  }
    56  
    57  func (fake *FakeConfigRefresher) 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 _ requirements.ConfigRefresher = new(FakeConfigRefresher)