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

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package mocks
     3  
     4  import (
     5  	"sync"
     6  )
     7  
     8  type MetadataValidator struct {
     9  	ValidateConsensusMetadataStub        func([]byte, []byte, bool) error
    10  	validateConsensusMetadataMutex       sync.RWMutex
    11  	validateConsensusMetadataArgsForCall []struct {
    12  		arg1 []byte
    13  		arg2 []byte
    14  		arg3 bool
    15  	}
    16  	validateConsensusMetadataReturns struct {
    17  		result1 error
    18  	}
    19  	validateConsensusMetadataReturnsOnCall map[int]struct {
    20  		result1 error
    21  	}
    22  	invocations      map[string][][]interface{}
    23  	invocationsMutex sync.RWMutex
    24  }
    25  
    26  func (fake *MetadataValidator) ValidateConsensusMetadata(arg1 []byte, arg2 []byte, arg3 bool) error {
    27  	var arg1Copy []byte
    28  	if arg1 != nil {
    29  		arg1Copy = make([]byte, len(arg1))
    30  		copy(arg1Copy, arg1)
    31  	}
    32  	var arg2Copy []byte
    33  	if arg2 != nil {
    34  		arg2Copy = make([]byte, len(arg2))
    35  		copy(arg2Copy, arg2)
    36  	}
    37  	fake.validateConsensusMetadataMutex.Lock()
    38  	ret, specificReturn := fake.validateConsensusMetadataReturnsOnCall[len(fake.validateConsensusMetadataArgsForCall)]
    39  	fake.validateConsensusMetadataArgsForCall = append(fake.validateConsensusMetadataArgsForCall, struct {
    40  		arg1 []byte
    41  		arg2 []byte
    42  		arg3 bool
    43  	}{arg1Copy, arg2Copy, arg3})
    44  	fake.recordInvocation("ValidateConsensusMetadata", []interface{}{arg1Copy, arg2Copy, arg3})
    45  	fake.validateConsensusMetadataMutex.Unlock()
    46  	if fake.ValidateConsensusMetadataStub != nil {
    47  		return fake.ValidateConsensusMetadataStub(arg1, arg2, arg3)
    48  	}
    49  	if specificReturn {
    50  		return ret.result1
    51  	}
    52  	fakeReturns := fake.validateConsensusMetadataReturns
    53  	return fakeReturns.result1
    54  }
    55  
    56  func (fake *MetadataValidator) ValidateConsensusMetadataCallCount() int {
    57  	fake.validateConsensusMetadataMutex.RLock()
    58  	defer fake.validateConsensusMetadataMutex.RUnlock()
    59  	return len(fake.validateConsensusMetadataArgsForCall)
    60  }
    61  
    62  func (fake *MetadataValidator) ValidateConsensusMetadataCalls(stub func([]byte, []byte, bool) error) {
    63  	fake.validateConsensusMetadataMutex.Lock()
    64  	defer fake.validateConsensusMetadataMutex.Unlock()
    65  	fake.ValidateConsensusMetadataStub = stub
    66  }
    67  
    68  func (fake *MetadataValidator) ValidateConsensusMetadataArgsForCall(i int) ([]byte, []byte, bool) {
    69  	fake.validateConsensusMetadataMutex.RLock()
    70  	defer fake.validateConsensusMetadataMutex.RUnlock()
    71  	argsForCall := fake.validateConsensusMetadataArgsForCall[i]
    72  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
    73  }
    74  
    75  func (fake *MetadataValidator) ValidateConsensusMetadataReturns(result1 error) {
    76  	fake.validateConsensusMetadataMutex.Lock()
    77  	defer fake.validateConsensusMetadataMutex.Unlock()
    78  	fake.ValidateConsensusMetadataStub = nil
    79  	fake.validateConsensusMetadataReturns = struct {
    80  		result1 error
    81  	}{result1}
    82  }
    83  
    84  func (fake *MetadataValidator) ValidateConsensusMetadataReturnsOnCall(i int, result1 error) {
    85  	fake.validateConsensusMetadataMutex.Lock()
    86  	defer fake.validateConsensusMetadataMutex.Unlock()
    87  	fake.ValidateConsensusMetadataStub = nil
    88  	if fake.validateConsensusMetadataReturnsOnCall == nil {
    89  		fake.validateConsensusMetadataReturnsOnCall = make(map[int]struct {
    90  			result1 error
    91  		})
    92  	}
    93  	fake.validateConsensusMetadataReturnsOnCall[i] = struct {
    94  		result1 error
    95  	}{result1}
    96  }
    97  
    98  func (fake *MetadataValidator) Invocations() map[string][][]interface{} {
    99  	fake.invocationsMutex.RLock()
   100  	defer fake.invocationsMutex.RUnlock()
   101  	fake.validateConsensusMetadataMutex.RLock()
   102  	defer fake.validateConsensusMetadataMutex.RUnlock()
   103  	copiedInvocations := map[string][][]interface{}{}
   104  	for key, value := range fake.invocations {
   105  		copiedInvocations[key] = value
   106  	}
   107  	return copiedInvocations
   108  }
   109  
   110  func (fake *MetadataValidator) recordInvocation(key string, args []interface{}) {
   111  	fake.invocationsMutex.Lock()
   112  	defer fake.invocationsMutex.Unlock()
   113  	if fake.invocations == nil {
   114  		fake.invocations = map[string][][]interface{}{}
   115  	}
   116  	if fake.invocations[key] == nil {
   117  		fake.invocations[key] = [][]interface{}{}
   118  	}
   119  	fake.invocations[key] = append(fake.invocations[key], args)
   120  }