github.com/renegr87/renegr87@v2.1.1+incompatible/core/peer/mock/collection_policy_checker.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  	"github.com/hyperledger/fabric/msp"
     9  	"github.com/hyperledger/fabric/protoutil"
    10  )
    11  
    12  type CollectionPolicyChecker struct {
    13  	CheckCollectionPolicyStub        func(uint64, string, string, ledger.ConfigHistoryRetriever, msp.IdentityDeserializer, *protoutil.SignedData) (bool, error)
    14  	checkCollectionPolicyMutex       sync.RWMutex
    15  	checkCollectionPolicyArgsForCall []struct {
    16  		arg1 uint64
    17  		arg2 string
    18  		arg3 string
    19  		arg4 ledger.ConfigHistoryRetriever
    20  		arg5 msp.IdentityDeserializer
    21  		arg6 *protoutil.SignedData
    22  	}
    23  	checkCollectionPolicyReturns struct {
    24  		result1 bool
    25  		result2 error
    26  	}
    27  	checkCollectionPolicyReturnsOnCall map[int]struct {
    28  		result1 bool
    29  		result2 error
    30  	}
    31  	invocations      map[string][][]interface{}
    32  	invocationsMutex sync.RWMutex
    33  }
    34  
    35  func (fake *CollectionPolicyChecker) CheckCollectionPolicy(arg1 uint64, arg2 string, arg3 string, arg4 ledger.ConfigHistoryRetriever, arg5 msp.IdentityDeserializer, arg6 *protoutil.SignedData) (bool, error) {
    36  	fake.checkCollectionPolicyMutex.Lock()
    37  	ret, specificReturn := fake.checkCollectionPolicyReturnsOnCall[len(fake.checkCollectionPolicyArgsForCall)]
    38  	fake.checkCollectionPolicyArgsForCall = append(fake.checkCollectionPolicyArgsForCall, struct {
    39  		arg1 uint64
    40  		arg2 string
    41  		arg3 string
    42  		arg4 ledger.ConfigHistoryRetriever
    43  		arg5 msp.IdentityDeserializer
    44  		arg6 *protoutil.SignedData
    45  	}{arg1, arg2, arg3, arg4, arg5, arg6})
    46  	fake.recordInvocation("CheckCollectionPolicy", []interface{}{arg1, arg2, arg3, arg4, arg5, arg6})
    47  	fake.checkCollectionPolicyMutex.Unlock()
    48  	if fake.CheckCollectionPolicyStub != nil {
    49  		return fake.CheckCollectionPolicyStub(arg1, arg2, arg3, arg4, arg5, arg6)
    50  	}
    51  	if specificReturn {
    52  		return ret.result1, ret.result2
    53  	}
    54  	fakeReturns := fake.checkCollectionPolicyReturns
    55  	return fakeReturns.result1, fakeReturns.result2
    56  }
    57  
    58  func (fake *CollectionPolicyChecker) CheckCollectionPolicyCallCount() int {
    59  	fake.checkCollectionPolicyMutex.RLock()
    60  	defer fake.checkCollectionPolicyMutex.RUnlock()
    61  	return len(fake.checkCollectionPolicyArgsForCall)
    62  }
    63  
    64  func (fake *CollectionPolicyChecker) CheckCollectionPolicyCalls(stub func(uint64, string, string, ledger.ConfigHistoryRetriever, msp.IdentityDeserializer, *protoutil.SignedData) (bool, error)) {
    65  	fake.checkCollectionPolicyMutex.Lock()
    66  	defer fake.checkCollectionPolicyMutex.Unlock()
    67  	fake.CheckCollectionPolicyStub = stub
    68  }
    69  
    70  func (fake *CollectionPolicyChecker) CheckCollectionPolicyArgsForCall(i int) (uint64, string, string, ledger.ConfigHistoryRetriever, msp.IdentityDeserializer, *protoutil.SignedData) {
    71  	fake.checkCollectionPolicyMutex.RLock()
    72  	defer fake.checkCollectionPolicyMutex.RUnlock()
    73  	argsForCall := fake.checkCollectionPolicyArgsForCall[i]
    74  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4, argsForCall.arg5, argsForCall.arg6
    75  }
    76  
    77  func (fake *CollectionPolicyChecker) CheckCollectionPolicyReturns(result1 bool, result2 error) {
    78  	fake.checkCollectionPolicyMutex.Lock()
    79  	defer fake.checkCollectionPolicyMutex.Unlock()
    80  	fake.CheckCollectionPolicyStub = nil
    81  	fake.checkCollectionPolicyReturns = struct {
    82  		result1 bool
    83  		result2 error
    84  	}{result1, result2}
    85  }
    86  
    87  func (fake *CollectionPolicyChecker) CheckCollectionPolicyReturnsOnCall(i int, result1 bool, result2 error) {
    88  	fake.checkCollectionPolicyMutex.Lock()
    89  	defer fake.checkCollectionPolicyMutex.Unlock()
    90  	fake.CheckCollectionPolicyStub = nil
    91  	if fake.checkCollectionPolicyReturnsOnCall == nil {
    92  		fake.checkCollectionPolicyReturnsOnCall = make(map[int]struct {
    93  			result1 bool
    94  			result2 error
    95  		})
    96  	}
    97  	fake.checkCollectionPolicyReturnsOnCall[i] = struct {
    98  		result1 bool
    99  		result2 error
   100  	}{result1, result2}
   101  }
   102  
   103  func (fake *CollectionPolicyChecker) Invocations() map[string][][]interface{} {
   104  	fake.invocationsMutex.RLock()
   105  	defer fake.invocationsMutex.RUnlock()
   106  	fake.checkCollectionPolicyMutex.RLock()
   107  	defer fake.checkCollectionPolicyMutex.RUnlock()
   108  	copiedInvocations := map[string][][]interface{}{}
   109  	for key, value := range fake.invocations {
   110  		copiedInvocations[key] = value
   111  	}
   112  	return copiedInvocations
   113  }
   114  
   115  func (fake *CollectionPolicyChecker) recordInvocation(key string, args []interface{}) {
   116  	fake.invocationsMutex.Lock()
   117  	defer fake.invocationsMutex.Unlock()
   118  	if fake.invocations == nil {
   119  		fake.invocations = map[string][][]interface{}{}
   120  	}
   121  	if fake.invocations[key] == nil {
   122  		fake.invocations[key] = [][]interface{}{}
   123  	}
   124  	fake.invocations[key] = append(fake.invocations[key], args)
   125  }