github.com/anjalikarhana/fabric@v2.1.1+incompatible/orderer/common/server/mocks/health_checker.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package mocks
     3  
     4  import (
     5  	"sync"
     6  
     7  	"github.com/hyperledger/fabric-lib-go/healthz"
     8  )
     9  
    10  type HealthChecker struct {
    11  	RegisterCheckerStub        func(string, healthz.HealthChecker) error
    12  	registerCheckerMutex       sync.RWMutex
    13  	registerCheckerArgsForCall []struct {
    14  		arg1 string
    15  		arg2 healthz.HealthChecker
    16  	}
    17  	registerCheckerReturns struct {
    18  		result1 error
    19  	}
    20  	registerCheckerReturnsOnCall map[int]struct {
    21  		result1 error
    22  	}
    23  	invocations      map[string][][]interface{}
    24  	invocationsMutex sync.RWMutex
    25  }
    26  
    27  func (fake *HealthChecker) RegisterChecker(arg1 string, arg2 healthz.HealthChecker) error {
    28  	fake.registerCheckerMutex.Lock()
    29  	ret, specificReturn := fake.registerCheckerReturnsOnCall[len(fake.registerCheckerArgsForCall)]
    30  	fake.registerCheckerArgsForCall = append(fake.registerCheckerArgsForCall, struct {
    31  		arg1 string
    32  		arg2 healthz.HealthChecker
    33  	}{arg1, arg2})
    34  	fake.recordInvocation("RegisterChecker", []interface{}{arg1, arg2})
    35  	fake.registerCheckerMutex.Unlock()
    36  	if fake.RegisterCheckerStub != nil {
    37  		return fake.RegisterCheckerStub(arg1, arg2)
    38  	}
    39  	if specificReturn {
    40  		return ret.result1
    41  	}
    42  	fakeReturns := fake.registerCheckerReturns
    43  	return fakeReturns.result1
    44  }
    45  
    46  func (fake *HealthChecker) RegisterCheckerCallCount() int {
    47  	fake.registerCheckerMutex.RLock()
    48  	defer fake.registerCheckerMutex.RUnlock()
    49  	return len(fake.registerCheckerArgsForCall)
    50  }
    51  
    52  func (fake *HealthChecker) RegisterCheckerCalls(stub func(string, healthz.HealthChecker) error) {
    53  	fake.registerCheckerMutex.Lock()
    54  	defer fake.registerCheckerMutex.Unlock()
    55  	fake.RegisterCheckerStub = stub
    56  }
    57  
    58  func (fake *HealthChecker) RegisterCheckerArgsForCall(i int) (string, healthz.HealthChecker) {
    59  	fake.registerCheckerMutex.RLock()
    60  	defer fake.registerCheckerMutex.RUnlock()
    61  	argsForCall := fake.registerCheckerArgsForCall[i]
    62  	return argsForCall.arg1, argsForCall.arg2
    63  }
    64  
    65  func (fake *HealthChecker) RegisterCheckerReturns(result1 error) {
    66  	fake.registerCheckerMutex.Lock()
    67  	defer fake.registerCheckerMutex.Unlock()
    68  	fake.RegisterCheckerStub = nil
    69  	fake.registerCheckerReturns = struct {
    70  		result1 error
    71  	}{result1}
    72  }
    73  
    74  func (fake *HealthChecker) RegisterCheckerReturnsOnCall(i int, result1 error) {
    75  	fake.registerCheckerMutex.Lock()
    76  	defer fake.registerCheckerMutex.Unlock()
    77  	fake.RegisterCheckerStub = nil
    78  	if fake.registerCheckerReturnsOnCall == nil {
    79  		fake.registerCheckerReturnsOnCall = make(map[int]struct {
    80  			result1 error
    81  		})
    82  	}
    83  	fake.registerCheckerReturnsOnCall[i] = struct {
    84  		result1 error
    85  	}{result1}
    86  }
    87  
    88  func (fake *HealthChecker) Invocations() map[string][][]interface{} {
    89  	fake.invocationsMutex.RLock()
    90  	defer fake.invocationsMutex.RUnlock()
    91  	fake.registerCheckerMutex.RLock()
    92  	defer fake.registerCheckerMutex.RUnlock()
    93  	copiedInvocations := map[string][][]interface{}{}
    94  	for key, value := range fake.invocations {
    95  		copiedInvocations[key] = value
    96  	}
    97  	return copiedInvocations
    98  }
    99  
   100  func (fake *HealthChecker) recordInvocation(key string, args []interface{}) {
   101  	fake.invocationsMutex.Lock()
   102  	defer fake.invocationsMutex.Unlock()
   103  	if fake.invocations == nil {
   104  		fake.invocations = map[string][][]interface{}{}
   105  	}
   106  	if fake.invocations[key] == nil {
   107  		fake.invocations[key] = [][]interface{}{}
   108  	}
   109  	fake.invocations[key] = append(fake.invocations[key], args)
   110  }