github.com/hyperledger-labs/bdls@v2.1.1+incompatible/core/chaincode/lifecycle/mock/legacy_lifecycle.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/chaincode/lifecycle"
     8  	"github.com/hyperledger/fabric/core/ledger"
     9  )
    10  
    11  type LegacyLifecycle struct {
    12  	ChaincodeEndorsementInfoStub        func(string, string, ledger.SimpleQueryExecutor) (*lifecycle.ChaincodeEndorsementInfo, error)
    13  	chaincodeEndorsementInfoMutex       sync.RWMutex
    14  	chaincodeEndorsementInfoArgsForCall []struct {
    15  		arg1 string
    16  		arg2 string
    17  		arg3 ledger.SimpleQueryExecutor
    18  	}
    19  	chaincodeEndorsementInfoReturns struct {
    20  		result1 *lifecycle.ChaincodeEndorsementInfo
    21  		result2 error
    22  	}
    23  	chaincodeEndorsementInfoReturnsOnCall map[int]struct {
    24  		result1 *lifecycle.ChaincodeEndorsementInfo
    25  		result2 error
    26  	}
    27  	invocations      map[string][][]interface{}
    28  	invocationsMutex sync.RWMutex
    29  }
    30  
    31  func (fake *LegacyLifecycle) ChaincodeEndorsementInfo(arg1 string, arg2 string, arg3 ledger.SimpleQueryExecutor) (*lifecycle.ChaincodeEndorsementInfo, error) {
    32  	fake.chaincodeEndorsementInfoMutex.Lock()
    33  	ret, specificReturn := fake.chaincodeEndorsementInfoReturnsOnCall[len(fake.chaincodeEndorsementInfoArgsForCall)]
    34  	fake.chaincodeEndorsementInfoArgsForCall = append(fake.chaincodeEndorsementInfoArgsForCall, struct {
    35  		arg1 string
    36  		arg2 string
    37  		arg3 ledger.SimpleQueryExecutor
    38  	}{arg1, arg2, arg3})
    39  	fake.recordInvocation("ChaincodeEndorsementInfo", []interface{}{arg1, arg2, arg3})
    40  	fake.chaincodeEndorsementInfoMutex.Unlock()
    41  	if fake.ChaincodeEndorsementInfoStub != nil {
    42  		return fake.ChaincodeEndorsementInfoStub(arg1, arg2, arg3)
    43  	}
    44  	if specificReturn {
    45  		return ret.result1, ret.result2
    46  	}
    47  	fakeReturns := fake.chaincodeEndorsementInfoReturns
    48  	return fakeReturns.result1, fakeReturns.result2
    49  }
    50  
    51  func (fake *LegacyLifecycle) ChaincodeEndorsementInfoCallCount() int {
    52  	fake.chaincodeEndorsementInfoMutex.RLock()
    53  	defer fake.chaincodeEndorsementInfoMutex.RUnlock()
    54  	return len(fake.chaincodeEndorsementInfoArgsForCall)
    55  }
    56  
    57  func (fake *LegacyLifecycle) ChaincodeEndorsementInfoCalls(stub func(string, string, ledger.SimpleQueryExecutor) (*lifecycle.ChaincodeEndorsementInfo, error)) {
    58  	fake.chaincodeEndorsementInfoMutex.Lock()
    59  	defer fake.chaincodeEndorsementInfoMutex.Unlock()
    60  	fake.ChaincodeEndorsementInfoStub = stub
    61  }
    62  
    63  func (fake *LegacyLifecycle) ChaincodeEndorsementInfoArgsForCall(i int) (string, string, ledger.SimpleQueryExecutor) {
    64  	fake.chaincodeEndorsementInfoMutex.RLock()
    65  	defer fake.chaincodeEndorsementInfoMutex.RUnlock()
    66  	argsForCall := fake.chaincodeEndorsementInfoArgsForCall[i]
    67  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
    68  }
    69  
    70  func (fake *LegacyLifecycle) ChaincodeEndorsementInfoReturns(result1 *lifecycle.ChaincodeEndorsementInfo, result2 error) {
    71  	fake.chaincodeEndorsementInfoMutex.Lock()
    72  	defer fake.chaincodeEndorsementInfoMutex.Unlock()
    73  	fake.ChaincodeEndorsementInfoStub = nil
    74  	fake.chaincodeEndorsementInfoReturns = struct {
    75  		result1 *lifecycle.ChaincodeEndorsementInfo
    76  		result2 error
    77  	}{result1, result2}
    78  }
    79  
    80  func (fake *LegacyLifecycle) ChaincodeEndorsementInfoReturnsOnCall(i int, result1 *lifecycle.ChaincodeEndorsementInfo, result2 error) {
    81  	fake.chaincodeEndorsementInfoMutex.Lock()
    82  	defer fake.chaincodeEndorsementInfoMutex.Unlock()
    83  	fake.ChaincodeEndorsementInfoStub = nil
    84  	if fake.chaincodeEndorsementInfoReturnsOnCall == nil {
    85  		fake.chaincodeEndorsementInfoReturnsOnCall = make(map[int]struct {
    86  			result1 *lifecycle.ChaincodeEndorsementInfo
    87  			result2 error
    88  		})
    89  	}
    90  	fake.chaincodeEndorsementInfoReturnsOnCall[i] = struct {
    91  		result1 *lifecycle.ChaincodeEndorsementInfo
    92  		result2 error
    93  	}{result1, result2}
    94  }
    95  
    96  func (fake *LegacyLifecycle) Invocations() map[string][][]interface{} {
    97  	fake.invocationsMutex.RLock()
    98  	defer fake.invocationsMutex.RUnlock()
    99  	fake.chaincodeEndorsementInfoMutex.RLock()
   100  	defer fake.chaincodeEndorsementInfoMutex.RUnlock()
   101  	copiedInvocations := map[string][][]interface{}{}
   102  	for key, value := range fake.invocations {
   103  		copiedInvocations[key] = value
   104  	}
   105  	return copiedInvocations
   106  }
   107  
   108  func (fake *LegacyLifecycle) recordInvocation(key string, args []interface{}) {
   109  	fake.invocationsMutex.Lock()
   110  	defer fake.invocationsMutex.Unlock()
   111  	if fake.invocations == nil {
   112  		fake.invocations = map[string][][]interface{}{}
   113  	}
   114  	if fake.invocations[key] == nil {
   115  		fake.invocations[key] = [][]interface{}{}
   116  	}
   117  	fake.invocations[key] = append(fake.invocations[key], args)
   118  }
   119  
   120  var _ lifecycle.Lifecycle = new(LegacyLifecycle)