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

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package mock
     3  
     4  import (
     5  	"sync"
     6  
     7  	"github.com/hyperledger/fabric-protos-go/peer"
     8  	"github.com/hyperledger/fabric/core/ledger"
     9  )
    10  
    11  type MembershipInfoProvider struct {
    12  	AmMemberOfStub        func(string, *peer.CollectionPolicyConfig) (bool, error)
    13  	amMemberOfMutex       sync.RWMutex
    14  	amMemberOfArgsForCall []struct {
    15  		arg1 string
    16  		arg2 *peer.CollectionPolicyConfig
    17  	}
    18  	amMemberOfReturns struct {
    19  		result1 bool
    20  		result2 error
    21  	}
    22  	amMemberOfReturnsOnCall map[int]struct {
    23  		result1 bool
    24  		result2 error
    25  	}
    26  	invocations      map[string][][]interface{}
    27  	invocationsMutex sync.RWMutex
    28  }
    29  
    30  func (fake *MembershipInfoProvider) AmMemberOf(arg1 string, arg2 *peer.CollectionPolicyConfig) (bool, error) {
    31  	fake.amMemberOfMutex.Lock()
    32  	ret, specificReturn := fake.amMemberOfReturnsOnCall[len(fake.amMemberOfArgsForCall)]
    33  	fake.amMemberOfArgsForCall = append(fake.amMemberOfArgsForCall, struct {
    34  		arg1 string
    35  		arg2 *peer.CollectionPolicyConfig
    36  	}{arg1, arg2})
    37  	fake.recordInvocation("AmMemberOf", []interface{}{arg1, arg2})
    38  	fake.amMemberOfMutex.Unlock()
    39  	if fake.AmMemberOfStub != nil {
    40  		return fake.AmMemberOfStub(arg1, arg2)
    41  	}
    42  	if specificReturn {
    43  		return ret.result1, ret.result2
    44  	}
    45  	fakeReturns := fake.amMemberOfReturns
    46  	return fakeReturns.result1, fakeReturns.result2
    47  }
    48  
    49  func (fake *MembershipInfoProvider) AmMemberOfCallCount() int {
    50  	fake.amMemberOfMutex.RLock()
    51  	defer fake.amMemberOfMutex.RUnlock()
    52  	return len(fake.amMemberOfArgsForCall)
    53  }
    54  
    55  func (fake *MembershipInfoProvider) AmMemberOfCalls(stub func(string, *peer.CollectionPolicyConfig) (bool, error)) {
    56  	fake.amMemberOfMutex.Lock()
    57  	defer fake.amMemberOfMutex.Unlock()
    58  	fake.AmMemberOfStub = stub
    59  }
    60  
    61  func (fake *MembershipInfoProvider) AmMemberOfArgsForCall(i int) (string, *peer.CollectionPolicyConfig) {
    62  	fake.amMemberOfMutex.RLock()
    63  	defer fake.amMemberOfMutex.RUnlock()
    64  	argsForCall := fake.amMemberOfArgsForCall[i]
    65  	return argsForCall.arg1, argsForCall.arg2
    66  }
    67  
    68  func (fake *MembershipInfoProvider) AmMemberOfReturns(result1 bool, result2 error) {
    69  	fake.amMemberOfMutex.Lock()
    70  	defer fake.amMemberOfMutex.Unlock()
    71  	fake.AmMemberOfStub = nil
    72  	fake.amMemberOfReturns = struct {
    73  		result1 bool
    74  		result2 error
    75  	}{result1, result2}
    76  }
    77  
    78  func (fake *MembershipInfoProvider) AmMemberOfReturnsOnCall(i int, result1 bool, result2 error) {
    79  	fake.amMemberOfMutex.Lock()
    80  	defer fake.amMemberOfMutex.Unlock()
    81  	fake.AmMemberOfStub = nil
    82  	if fake.amMemberOfReturnsOnCall == nil {
    83  		fake.amMemberOfReturnsOnCall = make(map[int]struct {
    84  			result1 bool
    85  			result2 error
    86  		})
    87  	}
    88  	fake.amMemberOfReturnsOnCall[i] = struct {
    89  		result1 bool
    90  		result2 error
    91  	}{result1, result2}
    92  }
    93  
    94  func (fake *MembershipInfoProvider) Invocations() map[string][][]interface{} {
    95  	fake.invocationsMutex.RLock()
    96  	defer fake.invocationsMutex.RUnlock()
    97  	fake.amMemberOfMutex.RLock()
    98  	defer fake.amMemberOfMutex.RUnlock()
    99  	copiedInvocations := map[string][][]interface{}{}
   100  	for key, value := range fake.invocations {
   101  		copiedInvocations[key] = value
   102  	}
   103  	return copiedInvocations
   104  }
   105  
   106  func (fake *MembershipInfoProvider) recordInvocation(key string, args []interface{}) {
   107  	fake.invocationsMutex.Lock()
   108  	defer fake.invocationsMutex.Unlock()
   109  	if fake.invocations == nil {
   110  		fake.invocations = map[string][][]interface{}{}
   111  	}
   112  	if fake.invocations[key] == nil {
   113  		fake.invocations[key] = [][]interface{}{}
   114  	}
   115  	fake.invocations[key] = append(fake.invocations[key], args)
   116  }
   117  
   118  var _ ledger.MembershipInfoProvider = new(MembershipInfoProvider)