github.com/hyperledger-labs/bdls@v2.1.1+incompatible/core/chaincode/lifecycle/mock/aclprovider.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package mock
     3  
     4  import (
     5  	"sync"
     6  )
     7  
     8  type ACLProvider struct {
     9  	CheckACLStub        func(string, string, interface{}) error
    10  	checkACLMutex       sync.RWMutex
    11  	checkACLArgsForCall []struct {
    12  		arg1 string
    13  		arg2 string
    14  		arg3 interface{}
    15  	}
    16  	checkACLReturns struct {
    17  		result1 error
    18  	}
    19  	checkACLReturnsOnCall map[int]struct {
    20  		result1 error
    21  	}
    22  	invocations      map[string][][]interface{}
    23  	invocationsMutex sync.RWMutex
    24  }
    25  
    26  func (fake *ACLProvider) CheckACL(arg1 string, arg2 string, arg3 interface{}) error {
    27  	fake.checkACLMutex.Lock()
    28  	ret, specificReturn := fake.checkACLReturnsOnCall[len(fake.checkACLArgsForCall)]
    29  	fake.checkACLArgsForCall = append(fake.checkACLArgsForCall, struct {
    30  		arg1 string
    31  		arg2 string
    32  		arg3 interface{}
    33  	}{arg1, arg2, arg3})
    34  	fake.recordInvocation("CheckACL", []interface{}{arg1, arg2, arg3})
    35  	fake.checkACLMutex.Unlock()
    36  	if fake.CheckACLStub != nil {
    37  		return fake.CheckACLStub(arg1, arg2, arg3)
    38  	}
    39  	if specificReturn {
    40  		return ret.result1
    41  	}
    42  	fakeReturns := fake.checkACLReturns
    43  	return fakeReturns.result1
    44  }
    45  
    46  func (fake *ACLProvider) CheckACLCallCount() int {
    47  	fake.checkACLMutex.RLock()
    48  	defer fake.checkACLMutex.RUnlock()
    49  	return len(fake.checkACLArgsForCall)
    50  }
    51  
    52  func (fake *ACLProvider) CheckACLCalls(stub func(string, string, interface{}) error) {
    53  	fake.checkACLMutex.Lock()
    54  	defer fake.checkACLMutex.Unlock()
    55  	fake.CheckACLStub = stub
    56  }
    57  
    58  func (fake *ACLProvider) CheckACLArgsForCall(i int) (string, string, interface{}) {
    59  	fake.checkACLMutex.RLock()
    60  	defer fake.checkACLMutex.RUnlock()
    61  	argsForCall := fake.checkACLArgsForCall[i]
    62  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
    63  }
    64  
    65  func (fake *ACLProvider) CheckACLReturns(result1 error) {
    66  	fake.checkACLMutex.Lock()
    67  	defer fake.checkACLMutex.Unlock()
    68  	fake.CheckACLStub = nil
    69  	fake.checkACLReturns = struct {
    70  		result1 error
    71  	}{result1}
    72  }
    73  
    74  func (fake *ACLProvider) CheckACLReturnsOnCall(i int, result1 error) {
    75  	fake.checkACLMutex.Lock()
    76  	defer fake.checkACLMutex.Unlock()
    77  	fake.CheckACLStub = nil
    78  	if fake.checkACLReturnsOnCall == nil {
    79  		fake.checkACLReturnsOnCall = make(map[int]struct {
    80  			result1 error
    81  		})
    82  	}
    83  	fake.checkACLReturnsOnCall[i] = struct {
    84  		result1 error
    85  	}{result1}
    86  }
    87  
    88  func (fake *ACLProvider) Invocations() map[string][][]interface{} {
    89  	fake.invocationsMutex.RLock()
    90  	defer fake.invocationsMutex.RUnlock()
    91  	fake.checkACLMutex.RLock()
    92  	defer fake.checkACLMutex.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 *ACLProvider) 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  }