github.com/anjalikarhana/fabric@v2.1.1+incompatible/orderer/common/msgprocessor/mocks/policy.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package mocks
     3  
     4  import (
     5  	"sync"
     6  
     7  	"github.com/hyperledger/fabric/msp"
     8  	"github.com/hyperledger/fabric/protoutil"
     9  )
    10  
    11  type Policy struct {
    12  	EvaluateIdentitiesStub        func([]msp.Identity) error
    13  	evaluateIdentitiesMutex       sync.RWMutex
    14  	evaluateIdentitiesArgsForCall []struct {
    15  		arg1 []msp.Identity
    16  	}
    17  	evaluateIdentitiesReturns struct {
    18  		result1 error
    19  	}
    20  	evaluateIdentitiesReturnsOnCall map[int]struct {
    21  		result1 error
    22  	}
    23  	EvaluateSignedDataStub        func([]*protoutil.SignedData) error
    24  	evaluateSignedDataMutex       sync.RWMutex
    25  	evaluateSignedDataArgsForCall []struct {
    26  		arg1 []*protoutil.SignedData
    27  	}
    28  	evaluateSignedDataReturns struct {
    29  		result1 error
    30  	}
    31  	evaluateSignedDataReturnsOnCall map[int]struct {
    32  		result1 error
    33  	}
    34  	invocations      map[string][][]interface{}
    35  	invocationsMutex sync.RWMutex
    36  }
    37  
    38  func (fake *Policy) EvaluateIdentities(arg1 []msp.Identity) error {
    39  	var arg1Copy []msp.Identity
    40  	if arg1 != nil {
    41  		arg1Copy = make([]msp.Identity, len(arg1))
    42  		copy(arg1Copy, arg1)
    43  	}
    44  	fake.evaluateIdentitiesMutex.Lock()
    45  	ret, specificReturn := fake.evaluateIdentitiesReturnsOnCall[len(fake.evaluateIdentitiesArgsForCall)]
    46  	fake.evaluateIdentitiesArgsForCall = append(fake.evaluateIdentitiesArgsForCall, struct {
    47  		arg1 []msp.Identity
    48  	}{arg1Copy})
    49  	fake.recordInvocation("EvaluateIdentities", []interface{}{arg1Copy})
    50  	fake.evaluateIdentitiesMutex.Unlock()
    51  	if fake.EvaluateIdentitiesStub != nil {
    52  		return fake.EvaluateIdentitiesStub(arg1)
    53  	}
    54  	if specificReturn {
    55  		return ret.result1
    56  	}
    57  	fakeReturns := fake.evaluateIdentitiesReturns
    58  	return fakeReturns.result1
    59  }
    60  
    61  func (fake *Policy) EvaluateIdentitiesCallCount() int {
    62  	fake.evaluateIdentitiesMutex.RLock()
    63  	defer fake.evaluateIdentitiesMutex.RUnlock()
    64  	return len(fake.evaluateIdentitiesArgsForCall)
    65  }
    66  
    67  func (fake *Policy) EvaluateIdentitiesCalls(stub func([]msp.Identity) error) {
    68  	fake.evaluateIdentitiesMutex.Lock()
    69  	defer fake.evaluateIdentitiesMutex.Unlock()
    70  	fake.EvaluateIdentitiesStub = stub
    71  }
    72  
    73  func (fake *Policy) EvaluateIdentitiesArgsForCall(i int) []msp.Identity {
    74  	fake.evaluateIdentitiesMutex.RLock()
    75  	defer fake.evaluateIdentitiesMutex.RUnlock()
    76  	argsForCall := fake.evaluateIdentitiesArgsForCall[i]
    77  	return argsForCall.arg1
    78  }
    79  
    80  func (fake *Policy) EvaluateIdentitiesReturns(result1 error) {
    81  	fake.evaluateIdentitiesMutex.Lock()
    82  	defer fake.evaluateIdentitiesMutex.Unlock()
    83  	fake.EvaluateIdentitiesStub = nil
    84  	fake.evaluateIdentitiesReturns = struct {
    85  		result1 error
    86  	}{result1}
    87  }
    88  
    89  func (fake *Policy) EvaluateIdentitiesReturnsOnCall(i int, result1 error) {
    90  	fake.evaluateIdentitiesMutex.Lock()
    91  	defer fake.evaluateIdentitiesMutex.Unlock()
    92  	fake.EvaluateIdentitiesStub = nil
    93  	if fake.evaluateIdentitiesReturnsOnCall == nil {
    94  		fake.evaluateIdentitiesReturnsOnCall = make(map[int]struct {
    95  			result1 error
    96  		})
    97  	}
    98  	fake.evaluateIdentitiesReturnsOnCall[i] = struct {
    99  		result1 error
   100  	}{result1}
   101  }
   102  
   103  func (fake *Policy) EvaluateSignedData(arg1 []*protoutil.SignedData) error {
   104  	var arg1Copy []*protoutil.SignedData
   105  	if arg1 != nil {
   106  		arg1Copy = make([]*protoutil.SignedData, len(arg1))
   107  		copy(arg1Copy, arg1)
   108  	}
   109  	fake.evaluateSignedDataMutex.Lock()
   110  	ret, specificReturn := fake.evaluateSignedDataReturnsOnCall[len(fake.evaluateSignedDataArgsForCall)]
   111  	fake.evaluateSignedDataArgsForCall = append(fake.evaluateSignedDataArgsForCall, struct {
   112  		arg1 []*protoutil.SignedData
   113  	}{arg1Copy})
   114  	fake.recordInvocation("EvaluateSignedData", []interface{}{arg1Copy})
   115  	fake.evaluateSignedDataMutex.Unlock()
   116  	if fake.EvaluateSignedDataStub != nil {
   117  		return fake.EvaluateSignedDataStub(arg1)
   118  	}
   119  	if specificReturn {
   120  		return ret.result1
   121  	}
   122  	fakeReturns := fake.evaluateSignedDataReturns
   123  	return fakeReturns.result1
   124  }
   125  
   126  func (fake *Policy) EvaluateSignedDataCallCount() int {
   127  	fake.evaluateSignedDataMutex.RLock()
   128  	defer fake.evaluateSignedDataMutex.RUnlock()
   129  	return len(fake.evaluateSignedDataArgsForCall)
   130  }
   131  
   132  func (fake *Policy) EvaluateSignedDataCalls(stub func([]*protoutil.SignedData) error) {
   133  	fake.evaluateSignedDataMutex.Lock()
   134  	defer fake.evaluateSignedDataMutex.Unlock()
   135  	fake.EvaluateSignedDataStub = stub
   136  }
   137  
   138  func (fake *Policy) EvaluateSignedDataArgsForCall(i int) []*protoutil.SignedData {
   139  	fake.evaluateSignedDataMutex.RLock()
   140  	defer fake.evaluateSignedDataMutex.RUnlock()
   141  	argsForCall := fake.evaluateSignedDataArgsForCall[i]
   142  	return argsForCall.arg1
   143  }
   144  
   145  func (fake *Policy) EvaluateSignedDataReturns(result1 error) {
   146  	fake.evaluateSignedDataMutex.Lock()
   147  	defer fake.evaluateSignedDataMutex.Unlock()
   148  	fake.EvaluateSignedDataStub = nil
   149  	fake.evaluateSignedDataReturns = struct {
   150  		result1 error
   151  	}{result1}
   152  }
   153  
   154  func (fake *Policy) EvaluateSignedDataReturnsOnCall(i int, result1 error) {
   155  	fake.evaluateSignedDataMutex.Lock()
   156  	defer fake.evaluateSignedDataMutex.Unlock()
   157  	fake.EvaluateSignedDataStub = nil
   158  	if fake.evaluateSignedDataReturnsOnCall == nil {
   159  		fake.evaluateSignedDataReturnsOnCall = make(map[int]struct {
   160  			result1 error
   161  		})
   162  	}
   163  	fake.evaluateSignedDataReturnsOnCall[i] = struct {
   164  		result1 error
   165  	}{result1}
   166  }
   167  
   168  func (fake *Policy) Invocations() map[string][][]interface{} {
   169  	fake.invocationsMutex.RLock()
   170  	defer fake.invocationsMutex.RUnlock()
   171  	fake.evaluateIdentitiesMutex.RLock()
   172  	defer fake.evaluateIdentitiesMutex.RUnlock()
   173  	fake.evaluateSignedDataMutex.RLock()
   174  	defer fake.evaluateSignedDataMutex.RUnlock()
   175  	copiedInvocations := map[string][][]interface{}{}
   176  	for key, value := range fake.invocations {
   177  		copiedInvocations[key] = value
   178  	}
   179  	return copiedInvocations
   180  }
   181  
   182  func (fake *Policy) recordInvocation(key string, args []interface{}) {
   183  	fake.invocationsMutex.Lock()
   184  	defer fake.invocationsMutex.Unlock()
   185  	if fake.invocations == nil {
   186  		fake.invocations = map[string][][]interface{}{}
   187  	}
   188  	if fake.invocations[key] == nil {
   189  		fake.invocations[key] = [][]interface{}{}
   190  	}
   191  	fake.invocations[key] = append(fake.invocations[key], args)
   192  }