github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/api/uaa/wrapper/wrapperfakes/fake_token_cache.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/uaa/wrapper"
     8  )
     9  
    10  type FakeTokenCache struct {
    11  	AccessTokenStub        func() string
    12  	accessTokenMutex       sync.RWMutex
    13  	accessTokenArgsForCall []struct {
    14  	}
    15  	accessTokenReturns struct {
    16  		result1 string
    17  	}
    18  	accessTokenReturnsOnCall map[int]struct {
    19  		result1 string
    20  	}
    21  	RefreshTokenStub        func() string
    22  	refreshTokenMutex       sync.RWMutex
    23  	refreshTokenArgsForCall []struct {
    24  	}
    25  	refreshTokenReturns struct {
    26  		result1 string
    27  	}
    28  	refreshTokenReturnsOnCall map[int]struct {
    29  		result1 string
    30  	}
    31  	SetAccessTokenStub        func(string)
    32  	setAccessTokenMutex       sync.RWMutex
    33  	setAccessTokenArgsForCall []struct {
    34  		arg1 string
    35  	}
    36  	SetRefreshTokenStub        func(string)
    37  	setRefreshTokenMutex       sync.RWMutex
    38  	setRefreshTokenArgsForCall []struct {
    39  		arg1 string
    40  	}
    41  	invocations      map[string][][]interface{}
    42  	invocationsMutex sync.RWMutex
    43  }
    44  
    45  func (fake *FakeTokenCache) AccessToken() string {
    46  	fake.accessTokenMutex.Lock()
    47  	ret, specificReturn := fake.accessTokenReturnsOnCall[len(fake.accessTokenArgsForCall)]
    48  	fake.accessTokenArgsForCall = append(fake.accessTokenArgsForCall, struct {
    49  	}{})
    50  	fake.recordInvocation("AccessToken", []interface{}{})
    51  	fake.accessTokenMutex.Unlock()
    52  	if fake.AccessTokenStub != nil {
    53  		return fake.AccessTokenStub()
    54  	}
    55  	if specificReturn {
    56  		return ret.result1
    57  	}
    58  	fakeReturns := fake.accessTokenReturns
    59  	return fakeReturns.result1
    60  }
    61  
    62  func (fake *FakeTokenCache) AccessTokenCallCount() int {
    63  	fake.accessTokenMutex.RLock()
    64  	defer fake.accessTokenMutex.RUnlock()
    65  	return len(fake.accessTokenArgsForCall)
    66  }
    67  
    68  func (fake *FakeTokenCache) AccessTokenCalls(stub func() string) {
    69  	fake.accessTokenMutex.Lock()
    70  	defer fake.accessTokenMutex.Unlock()
    71  	fake.AccessTokenStub = stub
    72  }
    73  
    74  func (fake *FakeTokenCache) AccessTokenReturns(result1 string) {
    75  	fake.accessTokenMutex.Lock()
    76  	defer fake.accessTokenMutex.Unlock()
    77  	fake.AccessTokenStub = nil
    78  	fake.accessTokenReturns = struct {
    79  		result1 string
    80  	}{result1}
    81  }
    82  
    83  func (fake *FakeTokenCache) AccessTokenReturnsOnCall(i int, result1 string) {
    84  	fake.accessTokenMutex.Lock()
    85  	defer fake.accessTokenMutex.Unlock()
    86  	fake.AccessTokenStub = nil
    87  	if fake.accessTokenReturnsOnCall == nil {
    88  		fake.accessTokenReturnsOnCall = make(map[int]struct {
    89  			result1 string
    90  		})
    91  	}
    92  	fake.accessTokenReturnsOnCall[i] = struct {
    93  		result1 string
    94  	}{result1}
    95  }
    96  
    97  func (fake *FakeTokenCache) RefreshToken() string {
    98  	fake.refreshTokenMutex.Lock()
    99  	ret, specificReturn := fake.refreshTokenReturnsOnCall[len(fake.refreshTokenArgsForCall)]
   100  	fake.refreshTokenArgsForCall = append(fake.refreshTokenArgsForCall, struct {
   101  	}{})
   102  	fake.recordInvocation("RefreshToken", []interface{}{})
   103  	fake.refreshTokenMutex.Unlock()
   104  	if fake.RefreshTokenStub != nil {
   105  		return fake.RefreshTokenStub()
   106  	}
   107  	if specificReturn {
   108  		return ret.result1
   109  	}
   110  	fakeReturns := fake.refreshTokenReturns
   111  	return fakeReturns.result1
   112  }
   113  
   114  func (fake *FakeTokenCache) RefreshTokenCallCount() int {
   115  	fake.refreshTokenMutex.RLock()
   116  	defer fake.refreshTokenMutex.RUnlock()
   117  	return len(fake.refreshTokenArgsForCall)
   118  }
   119  
   120  func (fake *FakeTokenCache) RefreshTokenCalls(stub func() string) {
   121  	fake.refreshTokenMutex.Lock()
   122  	defer fake.refreshTokenMutex.Unlock()
   123  	fake.RefreshTokenStub = stub
   124  }
   125  
   126  func (fake *FakeTokenCache) RefreshTokenReturns(result1 string) {
   127  	fake.refreshTokenMutex.Lock()
   128  	defer fake.refreshTokenMutex.Unlock()
   129  	fake.RefreshTokenStub = nil
   130  	fake.refreshTokenReturns = struct {
   131  		result1 string
   132  	}{result1}
   133  }
   134  
   135  func (fake *FakeTokenCache) RefreshTokenReturnsOnCall(i int, result1 string) {
   136  	fake.refreshTokenMutex.Lock()
   137  	defer fake.refreshTokenMutex.Unlock()
   138  	fake.RefreshTokenStub = nil
   139  	if fake.refreshTokenReturnsOnCall == nil {
   140  		fake.refreshTokenReturnsOnCall = make(map[int]struct {
   141  			result1 string
   142  		})
   143  	}
   144  	fake.refreshTokenReturnsOnCall[i] = struct {
   145  		result1 string
   146  	}{result1}
   147  }
   148  
   149  func (fake *FakeTokenCache) SetAccessToken(arg1 string) {
   150  	fake.setAccessTokenMutex.Lock()
   151  	fake.setAccessTokenArgsForCall = append(fake.setAccessTokenArgsForCall, struct {
   152  		arg1 string
   153  	}{arg1})
   154  	fake.recordInvocation("SetAccessToken", []interface{}{arg1})
   155  	fake.setAccessTokenMutex.Unlock()
   156  	if fake.SetAccessTokenStub != nil {
   157  		fake.SetAccessTokenStub(arg1)
   158  	}
   159  }
   160  
   161  func (fake *FakeTokenCache) SetAccessTokenCallCount() int {
   162  	fake.setAccessTokenMutex.RLock()
   163  	defer fake.setAccessTokenMutex.RUnlock()
   164  	return len(fake.setAccessTokenArgsForCall)
   165  }
   166  
   167  func (fake *FakeTokenCache) SetAccessTokenCalls(stub func(string)) {
   168  	fake.setAccessTokenMutex.Lock()
   169  	defer fake.setAccessTokenMutex.Unlock()
   170  	fake.SetAccessTokenStub = stub
   171  }
   172  
   173  func (fake *FakeTokenCache) SetAccessTokenArgsForCall(i int) string {
   174  	fake.setAccessTokenMutex.RLock()
   175  	defer fake.setAccessTokenMutex.RUnlock()
   176  	argsForCall := fake.setAccessTokenArgsForCall[i]
   177  	return argsForCall.arg1
   178  }
   179  
   180  func (fake *FakeTokenCache) SetRefreshToken(arg1 string) {
   181  	fake.setRefreshTokenMutex.Lock()
   182  	fake.setRefreshTokenArgsForCall = append(fake.setRefreshTokenArgsForCall, struct {
   183  		arg1 string
   184  	}{arg1})
   185  	fake.recordInvocation("SetRefreshToken", []interface{}{arg1})
   186  	fake.setRefreshTokenMutex.Unlock()
   187  	if fake.SetRefreshTokenStub != nil {
   188  		fake.SetRefreshTokenStub(arg1)
   189  	}
   190  }
   191  
   192  func (fake *FakeTokenCache) SetRefreshTokenCallCount() int {
   193  	fake.setRefreshTokenMutex.RLock()
   194  	defer fake.setRefreshTokenMutex.RUnlock()
   195  	return len(fake.setRefreshTokenArgsForCall)
   196  }
   197  
   198  func (fake *FakeTokenCache) SetRefreshTokenCalls(stub func(string)) {
   199  	fake.setRefreshTokenMutex.Lock()
   200  	defer fake.setRefreshTokenMutex.Unlock()
   201  	fake.SetRefreshTokenStub = stub
   202  }
   203  
   204  func (fake *FakeTokenCache) SetRefreshTokenArgsForCall(i int) string {
   205  	fake.setRefreshTokenMutex.RLock()
   206  	defer fake.setRefreshTokenMutex.RUnlock()
   207  	argsForCall := fake.setRefreshTokenArgsForCall[i]
   208  	return argsForCall.arg1
   209  }
   210  
   211  func (fake *FakeTokenCache) Invocations() map[string][][]interface{} {
   212  	fake.invocationsMutex.RLock()
   213  	defer fake.invocationsMutex.RUnlock()
   214  	fake.accessTokenMutex.RLock()
   215  	defer fake.accessTokenMutex.RUnlock()
   216  	fake.refreshTokenMutex.RLock()
   217  	defer fake.refreshTokenMutex.RUnlock()
   218  	fake.setAccessTokenMutex.RLock()
   219  	defer fake.setAccessTokenMutex.RUnlock()
   220  	fake.setRefreshTokenMutex.RLock()
   221  	defer fake.setRefreshTokenMutex.RUnlock()
   222  	copiedInvocations := map[string][][]interface{}{}
   223  	for key, value := range fake.invocations {
   224  		copiedInvocations[key] = value
   225  	}
   226  	return copiedInvocations
   227  }
   228  
   229  func (fake *FakeTokenCache) recordInvocation(key string, args []interface{}) {
   230  	fake.invocationsMutex.Lock()
   231  	defer fake.invocationsMutex.Unlock()
   232  	if fake.invocations == nil {
   233  		fake.invocations = map[string][][]interface{}{}
   234  	}
   235  	if fake.invocations[key] == nil {
   236  		fake.invocations[key] = [][]interface{}{}
   237  	}
   238  	fake.invocations[key] = append(fake.invocations[key], args)
   239  }
   240  
   241  var _ wrapper.TokenCache = new(FakeTokenCache)