github.com/IBM-Blockchain/fabric-operator@v1.0.4/pkg/action/mocks/reenroller.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package mocks
     3  
     4  import (
     5  	"sync"
     6  
     7  	"github.com/IBM-Blockchain/fabric-operator/pkg/action"
     8  	"github.com/IBM-Blockchain/fabric-operator/pkg/initializer/common"
     9  	"k8s.io/apimachinery/pkg/runtime"
    10  )
    11  
    12  type Reenroller struct {
    13  	RenewCertStub        func(common.SecretType, runtime.Object, bool) error
    14  	renewCertMutex       sync.RWMutex
    15  	renewCertArgsForCall []struct {
    16  		arg1 common.SecretType
    17  		arg2 runtime.Object
    18  		arg3 bool
    19  	}
    20  	renewCertReturns struct {
    21  		result1 error
    22  	}
    23  	renewCertReturnsOnCall map[int]struct {
    24  		result1 error
    25  	}
    26  	invocations      map[string][][]interface{}
    27  	invocationsMutex sync.RWMutex
    28  }
    29  
    30  func (fake *Reenroller) RenewCert(arg1 common.SecretType, arg2 runtime.Object, arg3 bool) error {
    31  	fake.renewCertMutex.Lock()
    32  	ret, specificReturn := fake.renewCertReturnsOnCall[len(fake.renewCertArgsForCall)]
    33  	fake.renewCertArgsForCall = append(fake.renewCertArgsForCall, struct {
    34  		arg1 common.SecretType
    35  		arg2 runtime.Object
    36  		arg3 bool
    37  	}{arg1, arg2, arg3})
    38  	stub := fake.RenewCertStub
    39  	fakeReturns := fake.renewCertReturns
    40  	fake.recordInvocation("RenewCert", []interface{}{arg1, arg2, arg3})
    41  	fake.renewCertMutex.Unlock()
    42  	if stub != nil {
    43  		return stub(arg1, arg2, arg3)
    44  	}
    45  	if specificReturn {
    46  		return ret.result1
    47  	}
    48  	return fakeReturns.result1
    49  }
    50  
    51  func (fake *Reenroller) RenewCertCallCount() int {
    52  	fake.renewCertMutex.RLock()
    53  	defer fake.renewCertMutex.RUnlock()
    54  	return len(fake.renewCertArgsForCall)
    55  }
    56  
    57  func (fake *Reenroller) RenewCertCalls(stub func(common.SecretType, runtime.Object, bool) error) {
    58  	fake.renewCertMutex.Lock()
    59  	defer fake.renewCertMutex.Unlock()
    60  	fake.RenewCertStub = stub
    61  }
    62  
    63  func (fake *Reenroller) RenewCertArgsForCall(i int) (common.SecretType, runtime.Object, bool) {
    64  	fake.renewCertMutex.RLock()
    65  	defer fake.renewCertMutex.RUnlock()
    66  	argsForCall := fake.renewCertArgsForCall[i]
    67  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
    68  }
    69  
    70  func (fake *Reenroller) RenewCertReturns(result1 error) {
    71  	fake.renewCertMutex.Lock()
    72  	defer fake.renewCertMutex.Unlock()
    73  	fake.RenewCertStub = nil
    74  	fake.renewCertReturns = struct {
    75  		result1 error
    76  	}{result1}
    77  }
    78  
    79  func (fake *Reenroller) RenewCertReturnsOnCall(i int, result1 error) {
    80  	fake.renewCertMutex.Lock()
    81  	defer fake.renewCertMutex.Unlock()
    82  	fake.RenewCertStub = nil
    83  	if fake.renewCertReturnsOnCall == nil {
    84  		fake.renewCertReturnsOnCall = make(map[int]struct {
    85  			result1 error
    86  		})
    87  	}
    88  	fake.renewCertReturnsOnCall[i] = struct {
    89  		result1 error
    90  	}{result1}
    91  }
    92  
    93  func (fake *Reenroller) Invocations() map[string][][]interface{} {
    94  	fake.invocationsMutex.RLock()
    95  	defer fake.invocationsMutex.RUnlock()
    96  	fake.renewCertMutex.RLock()
    97  	defer fake.renewCertMutex.RUnlock()
    98  	copiedInvocations := map[string][][]interface{}{}
    99  	for key, value := range fake.invocations {
   100  		copiedInvocations[key] = value
   101  	}
   102  	return copiedInvocations
   103  }
   104  
   105  func (fake *Reenroller) recordInvocation(key string, args []interface{}) {
   106  	fake.invocationsMutex.Lock()
   107  	defer fake.invocationsMutex.Unlock()
   108  	if fake.invocations == nil {
   109  		fake.invocations = map[string][][]interface{}{}
   110  	}
   111  	if fake.invocations[key] == nil {
   112  		fake.invocations[key] = [][]interface{}{}
   113  	}
   114  	fake.invocations[key] = append(fake.invocations[key], args)
   115  }
   116  
   117  var _ action.Reenroller = new(Reenroller)