github.com/sykesm/fabric@v1.1.0-preview.0.20200129034918-2aa12b1a0181/common/deliver/mock/chain.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package mock
     3  
     4  import (
     5  	"sync"
     6  
     7  	"github.com/hyperledger/fabric/common/deliver"
     8  	"github.com/hyperledger/fabric/common/ledger/blockledger"
     9  	"github.com/hyperledger/fabric/common/policies"
    10  )
    11  
    12  type Chain struct {
    13  	ErroredStub        func() <-chan struct{}
    14  	erroredMutex       sync.RWMutex
    15  	erroredArgsForCall []struct {
    16  	}
    17  	erroredReturns struct {
    18  		result1 <-chan struct{}
    19  	}
    20  	erroredReturnsOnCall map[int]struct {
    21  		result1 <-chan struct{}
    22  	}
    23  	PolicyManagerStub        func() policies.Manager
    24  	policyManagerMutex       sync.RWMutex
    25  	policyManagerArgsForCall []struct {
    26  	}
    27  	policyManagerReturns struct {
    28  		result1 policies.Manager
    29  	}
    30  	policyManagerReturnsOnCall map[int]struct {
    31  		result1 policies.Manager
    32  	}
    33  	ReaderStub        func() blockledger.Reader
    34  	readerMutex       sync.RWMutex
    35  	readerArgsForCall []struct {
    36  	}
    37  	readerReturns struct {
    38  		result1 blockledger.Reader
    39  	}
    40  	readerReturnsOnCall map[int]struct {
    41  		result1 blockledger.Reader
    42  	}
    43  	SequenceStub        func() uint64
    44  	sequenceMutex       sync.RWMutex
    45  	sequenceArgsForCall []struct {
    46  	}
    47  	sequenceReturns struct {
    48  		result1 uint64
    49  	}
    50  	sequenceReturnsOnCall map[int]struct {
    51  		result1 uint64
    52  	}
    53  	invocations      map[string][][]interface{}
    54  	invocationsMutex sync.RWMutex
    55  }
    56  
    57  func (fake *Chain) Errored() <-chan struct{} {
    58  	fake.erroredMutex.Lock()
    59  	ret, specificReturn := fake.erroredReturnsOnCall[len(fake.erroredArgsForCall)]
    60  	fake.erroredArgsForCall = append(fake.erroredArgsForCall, struct {
    61  	}{})
    62  	fake.recordInvocation("Errored", []interface{}{})
    63  	fake.erroredMutex.Unlock()
    64  	if fake.ErroredStub != nil {
    65  		return fake.ErroredStub()
    66  	}
    67  	if specificReturn {
    68  		return ret.result1
    69  	}
    70  	fakeReturns := fake.erroredReturns
    71  	return fakeReturns.result1
    72  }
    73  
    74  func (fake *Chain) ErroredCallCount() int {
    75  	fake.erroredMutex.RLock()
    76  	defer fake.erroredMutex.RUnlock()
    77  	return len(fake.erroredArgsForCall)
    78  }
    79  
    80  func (fake *Chain) ErroredCalls(stub func() <-chan struct{}) {
    81  	fake.erroredMutex.Lock()
    82  	defer fake.erroredMutex.Unlock()
    83  	fake.ErroredStub = stub
    84  }
    85  
    86  func (fake *Chain) ErroredReturns(result1 <-chan struct{}) {
    87  	fake.erroredMutex.Lock()
    88  	defer fake.erroredMutex.Unlock()
    89  	fake.ErroredStub = nil
    90  	fake.erroredReturns = struct {
    91  		result1 <-chan struct{}
    92  	}{result1}
    93  }
    94  
    95  func (fake *Chain) ErroredReturnsOnCall(i int, result1 <-chan struct{}) {
    96  	fake.erroredMutex.Lock()
    97  	defer fake.erroredMutex.Unlock()
    98  	fake.ErroredStub = nil
    99  	if fake.erroredReturnsOnCall == nil {
   100  		fake.erroredReturnsOnCall = make(map[int]struct {
   101  			result1 <-chan struct{}
   102  		})
   103  	}
   104  	fake.erroredReturnsOnCall[i] = struct {
   105  		result1 <-chan struct{}
   106  	}{result1}
   107  }
   108  
   109  func (fake *Chain) PolicyManager() policies.Manager {
   110  	fake.policyManagerMutex.Lock()
   111  	ret, specificReturn := fake.policyManagerReturnsOnCall[len(fake.policyManagerArgsForCall)]
   112  	fake.policyManagerArgsForCall = append(fake.policyManagerArgsForCall, struct {
   113  	}{})
   114  	fake.recordInvocation("PolicyManager", []interface{}{})
   115  	fake.policyManagerMutex.Unlock()
   116  	if fake.PolicyManagerStub != nil {
   117  		return fake.PolicyManagerStub()
   118  	}
   119  	if specificReturn {
   120  		return ret.result1
   121  	}
   122  	fakeReturns := fake.policyManagerReturns
   123  	return fakeReturns.result1
   124  }
   125  
   126  func (fake *Chain) PolicyManagerCallCount() int {
   127  	fake.policyManagerMutex.RLock()
   128  	defer fake.policyManagerMutex.RUnlock()
   129  	return len(fake.policyManagerArgsForCall)
   130  }
   131  
   132  func (fake *Chain) PolicyManagerCalls(stub func() policies.Manager) {
   133  	fake.policyManagerMutex.Lock()
   134  	defer fake.policyManagerMutex.Unlock()
   135  	fake.PolicyManagerStub = stub
   136  }
   137  
   138  func (fake *Chain) PolicyManagerReturns(result1 policies.Manager) {
   139  	fake.policyManagerMutex.Lock()
   140  	defer fake.policyManagerMutex.Unlock()
   141  	fake.PolicyManagerStub = nil
   142  	fake.policyManagerReturns = struct {
   143  		result1 policies.Manager
   144  	}{result1}
   145  }
   146  
   147  func (fake *Chain) PolicyManagerReturnsOnCall(i int, result1 policies.Manager) {
   148  	fake.policyManagerMutex.Lock()
   149  	defer fake.policyManagerMutex.Unlock()
   150  	fake.PolicyManagerStub = nil
   151  	if fake.policyManagerReturnsOnCall == nil {
   152  		fake.policyManagerReturnsOnCall = make(map[int]struct {
   153  			result1 policies.Manager
   154  		})
   155  	}
   156  	fake.policyManagerReturnsOnCall[i] = struct {
   157  		result1 policies.Manager
   158  	}{result1}
   159  }
   160  
   161  func (fake *Chain) Reader() blockledger.Reader {
   162  	fake.readerMutex.Lock()
   163  	ret, specificReturn := fake.readerReturnsOnCall[len(fake.readerArgsForCall)]
   164  	fake.readerArgsForCall = append(fake.readerArgsForCall, struct {
   165  	}{})
   166  	fake.recordInvocation("Reader", []interface{}{})
   167  	fake.readerMutex.Unlock()
   168  	if fake.ReaderStub != nil {
   169  		return fake.ReaderStub()
   170  	}
   171  	if specificReturn {
   172  		return ret.result1
   173  	}
   174  	fakeReturns := fake.readerReturns
   175  	return fakeReturns.result1
   176  }
   177  
   178  func (fake *Chain) ReaderCallCount() int {
   179  	fake.readerMutex.RLock()
   180  	defer fake.readerMutex.RUnlock()
   181  	return len(fake.readerArgsForCall)
   182  }
   183  
   184  func (fake *Chain) ReaderCalls(stub func() blockledger.Reader) {
   185  	fake.readerMutex.Lock()
   186  	defer fake.readerMutex.Unlock()
   187  	fake.ReaderStub = stub
   188  }
   189  
   190  func (fake *Chain) ReaderReturns(result1 blockledger.Reader) {
   191  	fake.readerMutex.Lock()
   192  	defer fake.readerMutex.Unlock()
   193  	fake.ReaderStub = nil
   194  	fake.readerReturns = struct {
   195  		result1 blockledger.Reader
   196  	}{result1}
   197  }
   198  
   199  func (fake *Chain) ReaderReturnsOnCall(i int, result1 blockledger.Reader) {
   200  	fake.readerMutex.Lock()
   201  	defer fake.readerMutex.Unlock()
   202  	fake.ReaderStub = nil
   203  	if fake.readerReturnsOnCall == nil {
   204  		fake.readerReturnsOnCall = make(map[int]struct {
   205  			result1 blockledger.Reader
   206  		})
   207  	}
   208  	fake.readerReturnsOnCall[i] = struct {
   209  		result1 blockledger.Reader
   210  	}{result1}
   211  }
   212  
   213  func (fake *Chain) Sequence() uint64 {
   214  	fake.sequenceMutex.Lock()
   215  	ret, specificReturn := fake.sequenceReturnsOnCall[len(fake.sequenceArgsForCall)]
   216  	fake.sequenceArgsForCall = append(fake.sequenceArgsForCall, struct {
   217  	}{})
   218  	fake.recordInvocation("Sequence", []interface{}{})
   219  	fake.sequenceMutex.Unlock()
   220  	if fake.SequenceStub != nil {
   221  		return fake.SequenceStub()
   222  	}
   223  	if specificReturn {
   224  		return ret.result1
   225  	}
   226  	fakeReturns := fake.sequenceReturns
   227  	return fakeReturns.result1
   228  }
   229  
   230  func (fake *Chain) SequenceCallCount() int {
   231  	fake.sequenceMutex.RLock()
   232  	defer fake.sequenceMutex.RUnlock()
   233  	return len(fake.sequenceArgsForCall)
   234  }
   235  
   236  func (fake *Chain) SequenceCalls(stub func() uint64) {
   237  	fake.sequenceMutex.Lock()
   238  	defer fake.sequenceMutex.Unlock()
   239  	fake.SequenceStub = stub
   240  }
   241  
   242  func (fake *Chain) SequenceReturns(result1 uint64) {
   243  	fake.sequenceMutex.Lock()
   244  	defer fake.sequenceMutex.Unlock()
   245  	fake.SequenceStub = nil
   246  	fake.sequenceReturns = struct {
   247  		result1 uint64
   248  	}{result1}
   249  }
   250  
   251  func (fake *Chain) SequenceReturnsOnCall(i int, result1 uint64) {
   252  	fake.sequenceMutex.Lock()
   253  	defer fake.sequenceMutex.Unlock()
   254  	fake.SequenceStub = nil
   255  	if fake.sequenceReturnsOnCall == nil {
   256  		fake.sequenceReturnsOnCall = make(map[int]struct {
   257  			result1 uint64
   258  		})
   259  	}
   260  	fake.sequenceReturnsOnCall[i] = struct {
   261  		result1 uint64
   262  	}{result1}
   263  }
   264  
   265  func (fake *Chain) Invocations() map[string][][]interface{} {
   266  	fake.invocationsMutex.RLock()
   267  	defer fake.invocationsMutex.RUnlock()
   268  	fake.erroredMutex.RLock()
   269  	defer fake.erroredMutex.RUnlock()
   270  	fake.policyManagerMutex.RLock()
   271  	defer fake.policyManagerMutex.RUnlock()
   272  	fake.readerMutex.RLock()
   273  	defer fake.readerMutex.RUnlock()
   274  	fake.sequenceMutex.RLock()
   275  	defer fake.sequenceMutex.RUnlock()
   276  	copiedInvocations := map[string][][]interface{}{}
   277  	for key, value := range fake.invocations {
   278  		copiedInvocations[key] = value
   279  	}
   280  	return copiedInvocations
   281  }
   282  
   283  func (fake *Chain) recordInvocation(key string, args []interface{}) {
   284  	fake.invocationsMutex.Lock()
   285  	defer fake.invocationsMutex.Unlock()
   286  	if fake.invocations == nil {
   287  		fake.invocations = map[string][][]interface{}{}
   288  	}
   289  	if fake.invocations[key] == nil {
   290  		fake.invocations[key] = [][]interface{}{}
   291  	}
   292  	fake.invocations[key] = append(fake.invocations[key], args)
   293  }
   294  
   295  var _ deliver.Chain = new(Chain)