github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/api/uaa/noaabridge/noaabridgefakes/fake_token_cache.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package noaabridgefakes
     3  
     4  import (
     5  	"sync"
     6  
     7  	"code.cloudfoundry.org/cli/api/uaa/noaabridge"
     8  )
     9  
    10  type FakeTokenCache struct {
    11  	RefreshTokenStub        func() string
    12  	refreshTokenMutex       sync.RWMutex
    13  	refreshTokenArgsForCall []struct{}
    14  	refreshTokenReturns     struct {
    15  		result1 string
    16  	}
    17  	refreshTokenReturnsOnCall map[int]struct {
    18  		result1 string
    19  	}
    20  	SetAccessTokenStub        func(token string)
    21  	setAccessTokenMutex       sync.RWMutex
    22  	setAccessTokenArgsForCall []struct {
    23  		token string
    24  	}
    25  	SetRefreshTokenStub        func(token string)
    26  	setRefreshTokenMutex       sync.RWMutex
    27  	setRefreshTokenArgsForCall []struct {
    28  		token string
    29  	}
    30  	invocations      map[string][][]interface{}
    31  	invocationsMutex sync.RWMutex
    32  }
    33  
    34  func (fake *FakeTokenCache) RefreshToken() string {
    35  	fake.refreshTokenMutex.Lock()
    36  	ret, specificReturn := fake.refreshTokenReturnsOnCall[len(fake.refreshTokenArgsForCall)]
    37  	fake.refreshTokenArgsForCall = append(fake.refreshTokenArgsForCall, struct{}{})
    38  	fake.recordInvocation("RefreshToken", []interface{}{})
    39  	fake.refreshTokenMutex.Unlock()
    40  	if fake.RefreshTokenStub != nil {
    41  		return fake.RefreshTokenStub()
    42  	}
    43  	if specificReturn {
    44  		return ret.result1
    45  	}
    46  	return fake.refreshTokenReturns.result1
    47  }
    48  
    49  func (fake *FakeTokenCache) RefreshTokenCallCount() int {
    50  	fake.refreshTokenMutex.RLock()
    51  	defer fake.refreshTokenMutex.RUnlock()
    52  	return len(fake.refreshTokenArgsForCall)
    53  }
    54  
    55  func (fake *FakeTokenCache) RefreshTokenReturns(result1 string) {
    56  	fake.RefreshTokenStub = nil
    57  	fake.refreshTokenReturns = struct {
    58  		result1 string
    59  	}{result1}
    60  }
    61  
    62  func (fake *FakeTokenCache) RefreshTokenReturnsOnCall(i int, result1 string) {
    63  	fake.RefreshTokenStub = nil
    64  	if fake.refreshTokenReturnsOnCall == nil {
    65  		fake.refreshTokenReturnsOnCall = make(map[int]struct {
    66  			result1 string
    67  		})
    68  	}
    69  	fake.refreshTokenReturnsOnCall[i] = struct {
    70  		result1 string
    71  	}{result1}
    72  }
    73  
    74  func (fake *FakeTokenCache) SetAccessToken(token string) {
    75  	fake.setAccessTokenMutex.Lock()
    76  	fake.setAccessTokenArgsForCall = append(fake.setAccessTokenArgsForCall, struct {
    77  		token string
    78  	}{token})
    79  	fake.recordInvocation("SetAccessToken", []interface{}{token})
    80  	fake.setAccessTokenMutex.Unlock()
    81  	if fake.SetAccessTokenStub != nil {
    82  		fake.SetAccessTokenStub(token)
    83  	}
    84  }
    85  
    86  func (fake *FakeTokenCache) SetAccessTokenCallCount() int {
    87  	fake.setAccessTokenMutex.RLock()
    88  	defer fake.setAccessTokenMutex.RUnlock()
    89  	return len(fake.setAccessTokenArgsForCall)
    90  }
    91  
    92  func (fake *FakeTokenCache) SetAccessTokenArgsForCall(i int) string {
    93  	fake.setAccessTokenMutex.RLock()
    94  	defer fake.setAccessTokenMutex.RUnlock()
    95  	return fake.setAccessTokenArgsForCall[i].token
    96  }
    97  
    98  func (fake *FakeTokenCache) SetRefreshToken(token string) {
    99  	fake.setRefreshTokenMutex.Lock()
   100  	fake.setRefreshTokenArgsForCall = append(fake.setRefreshTokenArgsForCall, struct {
   101  		token string
   102  	}{token})
   103  	fake.recordInvocation("SetRefreshToken", []interface{}{token})
   104  	fake.setRefreshTokenMutex.Unlock()
   105  	if fake.SetRefreshTokenStub != nil {
   106  		fake.SetRefreshTokenStub(token)
   107  	}
   108  }
   109  
   110  func (fake *FakeTokenCache) SetRefreshTokenCallCount() int {
   111  	fake.setRefreshTokenMutex.RLock()
   112  	defer fake.setRefreshTokenMutex.RUnlock()
   113  	return len(fake.setRefreshTokenArgsForCall)
   114  }
   115  
   116  func (fake *FakeTokenCache) SetRefreshTokenArgsForCall(i int) string {
   117  	fake.setRefreshTokenMutex.RLock()
   118  	defer fake.setRefreshTokenMutex.RUnlock()
   119  	return fake.setRefreshTokenArgsForCall[i].token
   120  }
   121  
   122  func (fake *FakeTokenCache) Invocations() map[string][][]interface{} {
   123  	fake.invocationsMutex.RLock()
   124  	defer fake.invocationsMutex.RUnlock()
   125  	fake.refreshTokenMutex.RLock()
   126  	defer fake.refreshTokenMutex.RUnlock()
   127  	fake.setAccessTokenMutex.RLock()
   128  	defer fake.setAccessTokenMutex.RUnlock()
   129  	fake.setRefreshTokenMutex.RLock()
   130  	defer fake.setRefreshTokenMutex.RUnlock()
   131  	copiedInvocations := map[string][][]interface{}{}
   132  	for key, value := range fake.invocations {
   133  		copiedInvocations[key] = value
   134  	}
   135  	return copiedInvocations
   136  }
   137  
   138  func (fake *FakeTokenCache) recordInvocation(key string, args []interface{}) {
   139  	fake.invocationsMutex.Lock()
   140  	defer fake.invocationsMutex.Unlock()
   141  	if fake.invocations == nil {
   142  		fake.invocations = map[string][][]interface{}{}
   143  	}
   144  	if fake.invocations[key] == nil {
   145  		fake.invocations[key] = [][]interface{}{}
   146  	}
   147  	fake.invocations[key] = append(fake.invocations[key], args)
   148  }
   149  
   150  var _ noaabridge.TokenCache = new(FakeTokenCache)