github.com/true-sqn/fabric@v2.1.1+incompatible/core/ledger/mock/cc_event_listener.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package mock
     3  
     4  import (
     5  	"sync"
     6  
     7  	"github.com/hyperledger/fabric/core/ledger"
     8  )
     9  
    10  type ChaincodeLifecycleEventListener struct {
    11  	ChaincodeDeployDoneStub        func(bool)
    12  	chaincodeDeployDoneMutex       sync.RWMutex
    13  	chaincodeDeployDoneArgsForCall []struct {
    14  		arg1 bool
    15  	}
    16  	HandleChaincodeDeployStub        func(*ledger.ChaincodeDefinition, []byte) error
    17  	handleChaincodeDeployMutex       sync.RWMutex
    18  	handleChaincodeDeployArgsForCall []struct {
    19  		arg1 *ledger.ChaincodeDefinition
    20  		arg2 []byte
    21  	}
    22  	handleChaincodeDeployReturns struct {
    23  		result1 error
    24  	}
    25  	handleChaincodeDeployReturnsOnCall map[int]struct {
    26  		result1 error
    27  	}
    28  	invocations      map[string][][]interface{}
    29  	invocationsMutex sync.RWMutex
    30  }
    31  
    32  func (fake *ChaincodeLifecycleEventListener) ChaincodeDeployDone(arg1 bool) {
    33  	fake.chaincodeDeployDoneMutex.Lock()
    34  	fake.chaincodeDeployDoneArgsForCall = append(fake.chaincodeDeployDoneArgsForCall, struct {
    35  		arg1 bool
    36  	}{arg1})
    37  	fake.recordInvocation("ChaincodeDeployDone", []interface{}{arg1})
    38  	fake.chaincodeDeployDoneMutex.Unlock()
    39  	if fake.ChaincodeDeployDoneStub != nil {
    40  		fake.ChaincodeDeployDoneStub(arg1)
    41  	}
    42  }
    43  
    44  func (fake *ChaincodeLifecycleEventListener) ChaincodeDeployDoneCallCount() int {
    45  	fake.chaincodeDeployDoneMutex.RLock()
    46  	defer fake.chaincodeDeployDoneMutex.RUnlock()
    47  	return len(fake.chaincodeDeployDoneArgsForCall)
    48  }
    49  
    50  func (fake *ChaincodeLifecycleEventListener) ChaincodeDeployDoneCalls(stub func(bool)) {
    51  	fake.chaincodeDeployDoneMutex.Lock()
    52  	defer fake.chaincodeDeployDoneMutex.Unlock()
    53  	fake.ChaincodeDeployDoneStub = stub
    54  }
    55  
    56  func (fake *ChaincodeLifecycleEventListener) ChaincodeDeployDoneArgsForCall(i int) bool {
    57  	fake.chaincodeDeployDoneMutex.RLock()
    58  	defer fake.chaincodeDeployDoneMutex.RUnlock()
    59  	argsForCall := fake.chaincodeDeployDoneArgsForCall[i]
    60  	return argsForCall.arg1
    61  }
    62  
    63  func (fake *ChaincodeLifecycleEventListener) HandleChaincodeDeploy(arg1 *ledger.ChaincodeDefinition, arg2 []byte) error {
    64  	var arg2Copy []byte
    65  	if arg2 != nil {
    66  		arg2Copy = make([]byte, len(arg2))
    67  		copy(arg2Copy, arg2)
    68  	}
    69  	fake.handleChaincodeDeployMutex.Lock()
    70  	ret, specificReturn := fake.handleChaincodeDeployReturnsOnCall[len(fake.handleChaincodeDeployArgsForCall)]
    71  	fake.handleChaincodeDeployArgsForCall = append(fake.handleChaincodeDeployArgsForCall, struct {
    72  		arg1 *ledger.ChaincodeDefinition
    73  		arg2 []byte
    74  	}{arg1, arg2Copy})
    75  	fake.recordInvocation("HandleChaincodeDeploy", []interface{}{arg1, arg2Copy})
    76  	fake.handleChaincodeDeployMutex.Unlock()
    77  	if fake.HandleChaincodeDeployStub != nil {
    78  		return fake.HandleChaincodeDeployStub(arg1, arg2)
    79  	}
    80  	if specificReturn {
    81  		return ret.result1
    82  	}
    83  	fakeReturns := fake.handleChaincodeDeployReturns
    84  	return fakeReturns.result1
    85  }
    86  
    87  func (fake *ChaincodeLifecycleEventListener) HandleChaincodeDeployCallCount() int {
    88  	fake.handleChaincodeDeployMutex.RLock()
    89  	defer fake.handleChaincodeDeployMutex.RUnlock()
    90  	return len(fake.handleChaincodeDeployArgsForCall)
    91  }
    92  
    93  func (fake *ChaincodeLifecycleEventListener) HandleChaincodeDeployCalls(stub func(*ledger.ChaincodeDefinition, []byte) error) {
    94  	fake.handleChaincodeDeployMutex.Lock()
    95  	defer fake.handleChaincodeDeployMutex.Unlock()
    96  	fake.HandleChaincodeDeployStub = stub
    97  }
    98  
    99  func (fake *ChaincodeLifecycleEventListener) HandleChaincodeDeployArgsForCall(i int) (*ledger.ChaincodeDefinition, []byte) {
   100  	fake.handleChaincodeDeployMutex.RLock()
   101  	defer fake.handleChaincodeDeployMutex.RUnlock()
   102  	argsForCall := fake.handleChaincodeDeployArgsForCall[i]
   103  	return argsForCall.arg1, argsForCall.arg2
   104  }
   105  
   106  func (fake *ChaincodeLifecycleEventListener) HandleChaincodeDeployReturns(result1 error) {
   107  	fake.handleChaincodeDeployMutex.Lock()
   108  	defer fake.handleChaincodeDeployMutex.Unlock()
   109  	fake.HandleChaincodeDeployStub = nil
   110  	fake.handleChaincodeDeployReturns = struct {
   111  		result1 error
   112  	}{result1}
   113  }
   114  
   115  func (fake *ChaincodeLifecycleEventListener) HandleChaincodeDeployReturnsOnCall(i int, result1 error) {
   116  	fake.handleChaincodeDeployMutex.Lock()
   117  	defer fake.handleChaincodeDeployMutex.Unlock()
   118  	fake.HandleChaincodeDeployStub = nil
   119  	if fake.handleChaincodeDeployReturnsOnCall == nil {
   120  		fake.handleChaincodeDeployReturnsOnCall = make(map[int]struct {
   121  			result1 error
   122  		})
   123  	}
   124  	fake.handleChaincodeDeployReturnsOnCall[i] = struct {
   125  		result1 error
   126  	}{result1}
   127  }
   128  
   129  func (fake *ChaincodeLifecycleEventListener) Invocations() map[string][][]interface{} {
   130  	fake.invocationsMutex.RLock()
   131  	defer fake.invocationsMutex.RUnlock()
   132  	fake.chaincodeDeployDoneMutex.RLock()
   133  	defer fake.chaincodeDeployDoneMutex.RUnlock()
   134  	fake.handleChaincodeDeployMutex.RLock()
   135  	defer fake.handleChaincodeDeployMutex.RUnlock()
   136  	copiedInvocations := map[string][][]interface{}{}
   137  	for key, value := range fake.invocations {
   138  		copiedInvocations[key] = value
   139  	}
   140  	return copiedInvocations
   141  }
   142  
   143  func (fake *ChaincodeLifecycleEventListener) recordInvocation(key string, args []interface{}) {
   144  	fake.invocationsMutex.Lock()
   145  	defer fake.invocationsMutex.Unlock()
   146  	if fake.invocations == nil {
   147  		fake.invocations = map[string][][]interface{}{}
   148  	}
   149  	if fake.invocations[key] == nil {
   150  		fake.invocations[key] = [][]interface{}{}
   151  	}
   152  	fake.invocations[key] = append(fake.invocations[key], args)
   153  }
   154  
   155  var _ ledger.ChaincodeLifecycleEventListener = new(ChaincodeLifecycleEventListener)