github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/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  	}
    15  	refreshTokenReturns struct {
    16  		result1 string
    17  	}
    18  	refreshTokenReturnsOnCall map[int]struct {
    19  		result1 string
    20  	}
    21  	SetAccessTokenStub        func(string)
    22  	setAccessTokenMutex       sync.RWMutex
    23  	setAccessTokenArgsForCall []struct {
    24  		arg1 string
    25  	}
    26  	SetRefreshTokenStub        func(string)
    27  	setRefreshTokenMutex       sync.RWMutex
    28  	setRefreshTokenArgsForCall []struct {
    29  		arg1 string
    30  	}
    31  	invocations      map[string][][]interface{}
    32  	invocationsMutex sync.RWMutex
    33  }
    34  
    35  func (fake *FakeTokenCache) RefreshToken() string {
    36  	fake.refreshTokenMutex.Lock()
    37  	ret, specificReturn := fake.refreshTokenReturnsOnCall[len(fake.refreshTokenArgsForCall)]
    38  	fake.refreshTokenArgsForCall = append(fake.refreshTokenArgsForCall, struct {
    39  	}{})
    40  	fake.recordInvocation("RefreshToken", []interface{}{})
    41  	fake.refreshTokenMutex.Unlock()
    42  	if fake.RefreshTokenStub != nil {
    43  		return fake.RefreshTokenStub()
    44  	}
    45  	if specificReturn {
    46  		return ret.result1
    47  	}
    48  	fakeReturns := fake.refreshTokenReturns
    49  	return fakeReturns.result1
    50  }
    51  
    52  func (fake *FakeTokenCache) RefreshTokenCallCount() int {
    53  	fake.refreshTokenMutex.RLock()
    54  	defer fake.refreshTokenMutex.RUnlock()
    55  	return len(fake.refreshTokenArgsForCall)
    56  }
    57  
    58  func (fake *FakeTokenCache) RefreshTokenCalls(stub func() string) {
    59  	fake.refreshTokenMutex.Lock()
    60  	defer fake.refreshTokenMutex.Unlock()
    61  	fake.RefreshTokenStub = stub
    62  }
    63  
    64  func (fake *FakeTokenCache) RefreshTokenReturns(result1 string) {
    65  	fake.refreshTokenMutex.Lock()
    66  	defer fake.refreshTokenMutex.Unlock()
    67  	fake.RefreshTokenStub = nil
    68  	fake.refreshTokenReturns = struct {
    69  		result1 string
    70  	}{result1}
    71  }
    72  
    73  func (fake *FakeTokenCache) RefreshTokenReturnsOnCall(i int, result1 string) {
    74  	fake.refreshTokenMutex.Lock()
    75  	defer fake.refreshTokenMutex.Unlock()
    76  	fake.RefreshTokenStub = nil
    77  	if fake.refreshTokenReturnsOnCall == nil {
    78  		fake.refreshTokenReturnsOnCall = make(map[int]struct {
    79  			result1 string
    80  		})
    81  	}
    82  	fake.refreshTokenReturnsOnCall[i] = struct {
    83  		result1 string
    84  	}{result1}
    85  }
    86  
    87  func (fake *FakeTokenCache) SetAccessToken(arg1 string) {
    88  	fake.setAccessTokenMutex.Lock()
    89  	fake.setAccessTokenArgsForCall = append(fake.setAccessTokenArgsForCall, struct {
    90  		arg1 string
    91  	}{arg1})
    92  	fake.recordInvocation("SetAccessToken", []interface{}{arg1})
    93  	fake.setAccessTokenMutex.Unlock()
    94  	if fake.SetAccessTokenStub != nil {
    95  		fake.SetAccessTokenStub(arg1)
    96  	}
    97  }
    98  
    99  func (fake *FakeTokenCache) SetAccessTokenCallCount() int {
   100  	fake.setAccessTokenMutex.RLock()
   101  	defer fake.setAccessTokenMutex.RUnlock()
   102  	return len(fake.setAccessTokenArgsForCall)
   103  }
   104  
   105  func (fake *FakeTokenCache) SetAccessTokenCalls(stub func(string)) {
   106  	fake.setAccessTokenMutex.Lock()
   107  	defer fake.setAccessTokenMutex.Unlock()
   108  	fake.SetAccessTokenStub = stub
   109  }
   110  
   111  func (fake *FakeTokenCache) SetAccessTokenArgsForCall(i int) string {
   112  	fake.setAccessTokenMutex.RLock()
   113  	defer fake.setAccessTokenMutex.RUnlock()
   114  	argsForCall := fake.setAccessTokenArgsForCall[i]
   115  	return argsForCall.arg1
   116  }
   117  
   118  func (fake *FakeTokenCache) SetRefreshToken(arg1 string) {
   119  	fake.setRefreshTokenMutex.Lock()
   120  	fake.setRefreshTokenArgsForCall = append(fake.setRefreshTokenArgsForCall, struct {
   121  		arg1 string
   122  	}{arg1})
   123  	fake.recordInvocation("SetRefreshToken", []interface{}{arg1})
   124  	fake.setRefreshTokenMutex.Unlock()
   125  	if fake.SetRefreshTokenStub != nil {
   126  		fake.SetRefreshTokenStub(arg1)
   127  	}
   128  }
   129  
   130  func (fake *FakeTokenCache) SetRefreshTokenCallCount() int {
   131  	fake.setRefreshTokenMutex.RLock()
   132  	defer fake.setRefreshTokenMutex.RUnlock()
   133  	return len(fake.setRefreshTokenArgsForCall)
   134  }
   135  
   136  func (fake *FakeTokenCache) SetRefreshTokenCalls(stub func(string)) {
   137  	fake.setRefreshTokenMutex.Lock()
   138  	defer fake.setRefreshTokenMutex.Unlock()
   139  	fake.SetRefreshTokenStub = stub
   140  }
   141  
   142  func (fake *FakeTokenCache) SetRefreshTokenArgsForCall(i int) string {
   143  	fake.setRefreshTokenMutex.RLock()
   144  	defer fake.setRefreshTokenMutex.RUnlock()
   145  	argsForCall := fake.setRefreshTokenArgsForCall[i]
   146  	return argsForCall.arg1
   147  }
   148  
   149  func (fake *FakeTokenCache) Invocations() map[string][][]interface{} {
   150  	fake.invocationsMutex.RLock()
   151  	defer fake.invocationsMutex.RUnlock()
   152  	fake.refreshTokenMutex.RLock()
   153  	defer fake.refreshTokenMutex.RUnlock()
   154  	fake.setAccessTokenMutex.RLock()
   155  	defer fake.setAccessTokenMutex.RUnlock()
   156  	fake.setRefreshTokenMutex.RLock()
   157  	defer fake.setRefreshTokenMutex.RUnlock()
   158  	copiedInvocations := map[string][][]interface{}{}
   159  	for key, value := range fake.invocations {
   160  		copiedInvocations[key] = value
   161  	}
   162  	return copiedInvocations
   163  }
   164  
   165  func (fake *FakeTokenCache) recordInvocation(key string, args []interface{}) {
   166  	fake.invocationsMutex.Lock()
   167  	defer fake.invocationsMutex.Unlock()
   168  	if fake.invocations == nil {
   169  		fake.invocations = map[string][][]interface{}{}
   170  	}
   171  	if fake.invocations[key] == nil {
   172  		fake.invocations[key] = [][]interface{}{}
   173  	}
   174  	fake.invocations[key] = append(fake.invocations[key], args)
   175  }
   176  
   177  var _ noaabridge.TokenCache = new(FakeTokenCache)