github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/api/cloudcontroller/wrapper/wrapperfakes/fake_uaaclient.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package wrapperfakes
     3  
     4  import (
     5  	"sync"
     6  
     7  	"code.cloudfoundry.org/cli/api/cloudcontroller/wrapper"
     8  	"code.cloudfoundry.org/cli/api/uaa"
     9  )
    10  
    11  type FakeUAAClient struct {
    12  	RefreshAccessTokenStub        func(refreshToken string) (uaa.RefreshedTokens, error)
    13  	refreshAccessTokenMutex       sync.RWMutex
    14  	refreshAccessTokenArgsForCall []struct {
    15  		refreshToken string
    16  	}
    17  	refreshAccessTokenReturns struct {
    18  		result1 uaa.RefreshedTokens
    19  		result2 error
    20  	}
    21  	refreshAccessTokenReturnsOnCall map[int]struct {
    22  		result1 uaa.RefreshedTokens
    23  		result2 error
    24  	}
    25  	invocations      map[string][][]interface{}
    26  	invocationsMutex sync.RWMutex
    27  }
    28  
    29  func (fake *FakeUAAClient) RefreshAccessToken(refreshToken string) (uaa.RefreshedTokens, error) {
    30  	fake.refreshAccessTokenMutex.Lock()
    31  	ret, specificReturn := fake.refreshAccessTokenReturnsOnCall[len(fake.refreshAccessTokenArgsForCall)]
    32  	fake.refreshAccessTokenArgsForCall = append(fake.refreshAccessTokenArgsForCall, struct {
    33  		refreshToken string
    34  	}{refreshToken})
    35  	fake.recordInvocation("RefreshAccessToken", []interface{}{refreshToken})
    36  	fake.refreshAccessTokenMutex.Unlock()
    37  	if fake.RefreshAccessTokenStub != nil {
    38  		return fake.RefreshAccessTokenStub(refreshToken)
    39  	}
    40  	if specificReturn {
    41  		return ret.result1, ret.result2
    42  	}
    43  	return fake.refreshAccessTokenReturns.result1, fake.refreshAccessTokenReturns.result2
    44  }
    45  
    46  func (fake *FakeUAAClient) RefreshAccessTokenCallCount() int {
    47  	fake.refreshAccessTokenMutex.RLock()
    48  	defer fake.refreshAccessTokenMutex.RUnlock()
    49  	return len(fake.refreshAccessTokenArgsForCall)
    50  }
    51  
    52  func (fake *FakeUAAClient) RefreshAccessTokenArgsForCall(i int) string {
    53  	fake.refreshAccessTokenMutex.RLock()
    54  	defer fake.refreshAccessTokenMutex.RUnlock()
    55  	return fake.refreshAccessTokenArgsForCall[i].refreshToken
    56  }
    57  
    58  func (fake *FakeUAAClient) RefreshAccessTokenReturns(result1 uaa.RefreshedTokens, result2 error) {
    59  	fake.RefreshAccessTokenStub = nil
    60  	fake.refreshAccessTokenReturns = struct {
    61  		result1 uaa.RefreshedTokens
    62  		result2 error
    63  	}{result1, result2}
    64  }
    65  
    66  func (fake *FakeUAAClient) RefreshAccessTokenReturnsOnCall(i int, result1 uaa.RefreshedTokens, result2 error) {
    67  	fake.RefreshAccessTokenStub = nil
    68  	if fake.refreshAccessTokenReturnsOnCall == nil {
    69  		fake.refreshAccessTokenReturnsOnCall = make(map[int]struct {
    70  			result1 uaa.RefreshedTokens
    71  			result2 error
    72  		})
    73  	}
    74  	fake.refreshAccessTokenReturnsOnCall[i] = struct {
    75  		result1 uaa.RefreshedTokens
    76  		result2 error
    77  	}{result1, result2}
    78  }
    79  
    80  func (fake *FakeUAAClient) Invocations() map[string][][]interface{} {
    81  	fake.invocationsMutex.RLock()
    82  	defer fake.invocationsMutex.RUnlock()
    83  	fake.refreshAccessTokenMutex.RLock()
    84  	defer fake.refreshAccessTokenMutex.RUnlock()
    85  	copiedInvocations := map[string][][]interface{}{}
    86  	for key, value := range fake.invocations {
    87  		copiedInvocations[key] = value
    88  	}
    89  	return copiedInvocations
    90  }
    91  
    92  func (fake *FakeUAAClient) recordInvocation(key string, args []interface{}) {
    93  	fake.invocationsMutex.Lock()
    94  	defer fake.invocationsMutex.Unlock()
    95  	if fake.invocations == nil {
    96  		fake.invocations = map[string][][]interface{}{}
    97  	}
    98  	if fake.invocations[key] == nil {
    99  		fake.invocations[key] = [][]interface{}{}
   100  	}
   101  	fake.invocations[key] = append(fake.invocations[key], args)
   102  }
   103  
   104  var _ wrapper.UAAClient = new(FakeUAAClient)