github.com/anjalikarhana/fabric@v2.1.1+incompatible/orderer/common/broadcast/mock/channel_support_registrar.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/common"
     8  	"github.com/hyperledger/fabric/orderer/common/broadcast"
     9  )
    10  
    11  type ChannelSupportRegistrar struct {
    12  	BroadcastChannelSupportStub        func(*common.Envelope) (*common.ChannelHeader, bool, broadcast.ChannelSupport, error)
    13  	broadcastChannelSupportMutex       sync.RWMutex
    14  	broadcastChannelSupportArgsForCall []struct {
    15  		arg1 *common.Envelope
    16  	}
    17  	broadcastChannelSupportReturns struct {
    18  		result1 *common.ChannelHeader
    19  		result2 bool
    20  		result3 broadcast.ChannelSupport
    21  		result4 error
    22  	}
    23  	broadcastChannelSupportReturnsOnCall map[int]struct {
    24  		result1 *common.ChannelHeader
    25  		result2 bool
    26  		result3 broadcast.ChannelSupport
    27  		result4 error
    28  	}
    29  	invocations      map[string][][]interface{}
    30  	invocationsMutex sync.RWMutex
    31  }
    32  
    33  func (fake *ChannelSupportRegistrar) BroadcastChannelSupport(arg1 *common.Envelope) (*common.ChannelHeader, bool, broadcast.ChannelSupport, error) {
    34  	fake.broadcastChannelSupportMutex.Lock()
    35  	ret, specificReturn := fake.broadcastChannelSupportReturnsOnCall[len(fake.broadcastChannelSupportArgsForCall)]
    36  	fake.broadcastChannelSupportArgsForCall = append(fake.broadcastChannelSupportArgsForCall, struct {
    37  		arg1 *common.Envelope
    38  	}{arg1})
    39  	fake.recordInvocation("BroadcastChannelSupport", []interface{}{arg1})
    40  	fake.broadcastChannelSupportMutex.Unlock()
    41  	if fake.BroadcastChannelSupportStub != nil {
    42  		return fake.BroadcastChannelSupportStub(arg1)
    43  	}
    44  	if specificReturn {
    45  		return ret.result1, ret.result2, ret.result3, ret.result4
    46  	}
    47  	fakeReturns := fake.broadcastChannelSupportReturns
    48  	return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3, fakeReturns.result4
    49  }
    50  
    51  func (fake *ChannelSupportRegistrar) BroadcastChannelSupportCallCount() int {
    52  	fake.broadcastChannelSupportMutex.RLock()
    53  	defer fake.broadcastChannelSupportMutex.RUnlock()
    54  	return len(fake.broadcastChannelSupportArgsForCall)
    55  }
    56  
    57  func (fake *ChannelSupportRegistrar) BroadcastChannelSupportCalls(stub func(*common.Envelope) (*common.ChannelHeader, bool, broadcast.ChannelSupport, error)) {
    58  	fake.broadcastChannelSupportMutex.Lock()
    59  	defer fake.broadcastChannelSupportMutex.Unlock()
    60  	fake.BroadcastChannelSupportStub = stub
    61  }
    62  
    63  func (fake *ChannelSupportRegistrar) BroadcastChannelSupportArgsForCall(i int) *common.Envelope {
    64  	fake.broadcastChannelSupportMutex.RLock()
    65  	defer fake.broadcastChannelSupportMutex.RUnlock()
    66  	argsForCall := fake.broadcastChannelSupportArgsForCall[i]
    67  	return argsForCall.arg1
    68  }
    69  
    70  func (fake *ChannelSupportRegistrar) BroadcastChannelSupportReturns(result1 *common.ChannelHeader, result2 bool, result3 broadcast.ChannelSupport, result4 error) {
    71  	fake.broadcastChannelSupportMutex.Lock()
    72  	defer fake.broadcastChannelSupportMutex.Unlock()
    73  	fake.BroadcastChannelSupportStub = nil
    74  	fake.broadcastChannelSupportReturns = struct {
    75  		result1 *common.ChannelHeader
    76  		result2 bool
    77  		result3 broadcast.ChannelSupport
    78  		result4 error
    79  	}{result1, result2, result3, result4}
    80  }
    81  
    82  func (fake *ChannelSupportRegistrar) BroadcastChannelSupportReturnsOnCall(i int, result1 *common.ChannelHeader, result2 bool, result3 broadcast.ChannelSupport, result4 error) {
    83  	fake.broadcastChannelSupportMutex.Lock()
    84  	defer fake.broadcastChannelSupportMutex.Unlock()
    85  	fake.BroadcastChannelSupportStub = nil
    86  	if fake.broadcastChannelSupportReturnsOnCall == nil {
    87  		fake.broadcastChannelSupportReturnsOnCall = make(map[int]struct {
    88  			result1 *common.ChannelHeader
    89  			result2 bool
    90  			result3 broadcast.ChannelSupport
    91  			result4 error
    92  		})
    93  	}
    94  	fake.broadcastChannelSupportReturnsOnCall[i] = struct {
    95  		result1 *common.ChannelHeader
    96  		result2 bool
    97  		result3 broadcast.ChannelSupport
    98  		result4 error
    99  	}{result1, result2, result3, result4}
   100  }
   101  
   102  func (fake *ChannelSupportRegistrar) Invocations() map[string][][]interface{} {
   103  	fake.invocationsMutex.RLock()
   104  	defer fake.invocationsMutex.RUnlock()
   105  	fake.broadcastChannelSupportMutex.RLock()
   106  	defer fake.broadcastChannelSupportMutex.RUnlock()
   107  	copiedInvocations := map[string][][]interface{}{}
   108  	for key, value := range fake.invocations {
   109  		copiedInvocations[key] = value
   110  	}
   111  	return copiedInvocations
   112  }
   113  
   114  func (fake *ChannelSupportRegistrar) recordInvocation(key string, args []interface{}) {
   115  	fake.invocationsMutex.Lock()
   116  	defer fake.invocationsMutex.Unlock()
   117  	if fake.invocations == nil {
   118  		fake.invocations = map[string][][]interface{}{}
   119  	}
   120  	if fake.invocations[key] == nil {
   121  		fake.invocations[key] = [][]interface{}{}
   122  	}
   123  	fake.invocations[key] = append(fake.invocations[key], args)
   124  }
   125  
   126  var _ broadcast.ChannelSupportRegistrar = new(ChannelSupportRegistrar)