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

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package mocks
     3  
     4  import (
     5  	"sync"
     6  
     7  	"github.com/hyperledger/fabric-protos-go/common"
     8  )
     9  
    10  type ConfigTXValidator struct {
    11  	ChannelIDStub        func() string
    12  	channelIDMutex       sync.RWMutex
    13  	channelIDArgsForCall []struct {
    14  	}
    15  	channelIDReturns struct {
    16  		result1 string
    17  	}
    18  	channelIDReturnsOnCall map[int]struct {
    19  		result1 string
    20  	}
    21  	ConfigProtoStub        func() *common.Config
    22  	configProtoMutex       sync.RWMutex
    23  	configProtoArgsForCall []struct {
    24  	}
    25  	configProtoReturns struct {
    26  		result1 *common.Config
    27  	}
    28  	configProtoReturnsOnCall map[int]struct {
    29  		result1 *common.Config
    30  	}
    31  	ProposeConfigUpdateStub        func(*common.Envelope) (*common.ConfigEnvelope, error)
    32  	proposeConfigUpdateMutex       sync.RWMutex
    33  	proposeConfigUpdateArgsForCall []struct {
    34  		arg1 *common.Envelope
    35  	}
    36  	proposeConfigUpdateReturns struct {
    37  		result1 *common.ConfigEnvelope
    38  		result2 error
    39  	}
    40  	proposeConfigUpdateReturnsOnCall map[int]struct {
    41  		result1 *common.ConfigEnvelope
    42  		result2 error
    43  	}
    44  	SequenceStub        func() uint64
    45  	sequenceMutex       sync.RWMutex
    46  	sequenceArgsForCall []struct {
    47  	}
    48  	sequenceReturns struct {
    49  		result1 uint64
    50  	}
    51  	sequenceReturnsOnCall map[int]struct {
    52  		result1 uint64
    53  	}
    54  	ValidateStub        func(*common.ConfigEnvelope) error
    55  	validateMutex       sync.RWMutex
    56  	validateArgsForCall []struct {
    57  		arg1 *common.ConfigEnvelope
    58  	}
    59  	validateReturns struct {
    60  		result1 error
    61  	}
    62  	validateReturnsOnCall map[int]struct {
    63  		result1 error
    64  	}
    65  	invocations      map[string][][]interface{}
    66  	invocationsMutex sync.RWMutex
    67  }
    68  
    69  func (fake *ConfigTXValidator) ChannelID() string {
    70  	fake.channelIDMutex.Lock()
    71  	ret, specificReturn := fake.channelIDReturnsOnCall[len(fake.channelIDArgsForCall)]
    72  	fake.channelIDArgsForCall = append(fake.channelIDArgsForCall, struct {
    73  	}{})
    74  	fake.recordInvocation("ChannelID", []interface{}{})
    75  	fake.channelIDMutex.Unlock()
    76  	if fake.ChannelIDStub != nil {
    77  		return fake.ChannelIDStub()
    78  	}
    79  	if specificReturn {
    80  		return ret.result1
    81  	}
    82  	fakeReturns := fake.channelIDReturns
    83  	return fakeReturns.result1
    84  }
    85  
    86  func (fake *ConfigTXValidator) ChannelIDCallCount() int {
    87  	fake.channelIDMutex.RLock()
    88  	defer fake.channelIDMutex.RUnlock()
    89  	return len(fake.channelIDArgsForCall)
    90  }
    91  
    92  func (fake *ConfigTXValidator) ChannelIDCalls(stub func() string) {
    93  	fake.channelIDMutex.Lock()
    94  	defer fake.channelIDMutex.Unlock()
    95  	fake.ChannelIDStub = stub
    96  }
    97  
    98  func (fake *ConfigTXValidator) ChannelIDReturns(result1 string) {
    99  	fake.channelIDMutex.Lock()
   100  	defer fake.channelIDMutex.Unlock()
   101  	fake.ChannelIDStub = nil
   102  	fake.channelIDReturns = struct {
   103  		result1 string
   104  	}{result1}
   105  }
   106  
   107  func (fake *ConfigTXValidator) ChannelIDReturnsOnCall(i int, result1 string) {
   108  	fake.channelIDMutex.Lock()
   109  	defer fake.channelIDMutex.Unlock()
   110  	fake.ChannelIDStub = nil
   111  	if fake.channelIDReturnsOnCall == nil {
   112  		fake.channelIDReturnsOnCall = make(map[int]struct {
   113  			result1 string
   114  		})
   115  	}
   116  	fake.channelIDReturnsOnCall[i] = struct {
   117  		result1 string
   118  	}{result1}
   119  }
   120  
   121  func (fake *ConfigTXValidator) ConfigProto() *common.Config {
   122  	fake.configProtoMutex.Lock()
   123  	ret, specificReturn := fake.configProtoReturnsOnCall[len(fake.configProtoArgsForCall)]
   124  	fake.configProtoArgsForCall = append(fake.configProtoArgsForCall, struct {
   125  	}{})
   126  	fake.recordInvocation("ConfigProto", []interface{}{})
   127  	fake.configProtoMutex.Unlock()
   128  	if fake.ConfigProtoStub != nil {
   129  		return fake.ConfigProtoStub()
   130  	}
   131  	if specificReturn {
   132  		return ret.result1
   133  	}
   134  	fakeReturns := fake.configProtoReturns
   135  	return fakeReturns.result1
   136  }
   137  
   138  func (fake *ConfigTXValidator) ConfigProtoCallCount() int {
   139  	fake.configProtoMutex.RLock()
   140  	defer fake.configProtoMutex.RUnlock()
   141  	return len(fake.configProtoArgsForCall)
   142  }
   143  
   144  func (fake *ConfigTXValidator) ConfigProtoCalls(stub func() *common.Config) {
   145  	fake.configProtoMutex.Lock()
   146  	defer fake.configProtoMutex.Unlock()
   147  	fake.ConfigProtoStub = stub
   148  }
   149  
   150  func (fake *ConfigTXValidator) ConfigProtoReturns(result1 *common.Config) {
   151  	fake.configProtoMutex.Lock()
   152  	defer fake.configProtoMutex.Unlock()
   153  	fake.ConfigProtoStub = nil
   154  	fake.configProtoReturns = struct {
   155  		result1 *common.Config
   156  	}{result1}
   157  }
   158  
   159  func (fake *ConfigTXValidator) ConfigProtoReturnsOnCall(i int, result1 *common.Config) {
   160  	fake.configProtoMutex.Lock()
   161  	defer fake.configProtoMutex.Unlock()
   162  	fake.ConfigProtoStub = nil
   163  	if fake.configProtoReturnsOnCall == nil {
   164  		fake.configProtoReturnsOnCall = make(map[int]struct {
   165  			result1 *common.Config
   166  		})
   167  	}
   168  	fake.configProtoReturnsOnCall[i] = struct {
   169  		result1 *common.Config
   170  	}{result1}
   171  }
   172  
   173  func (fake *ConfigTXValidator) ProposeConfigUpdate(arg1 *common.Envelope) (*common.ConfigEnvelope, error) {
   174  	fake.proposeConfigUpdateMutex.Lock()
   175  	ret, specificReturn := fake.proposeConfigUpdateReturnsOnCall[len(fake.proposeConfigUpdateArgsForCall)]
   176  	fake.proposeConfigUpdateArgsForCall = append(fake.proposeConfigUpdateArgsForCall, struct {
   177  		arg1 *common.Envelope
   178  	}{arg1})
   179  	fake.recordInvocation("ProposeConfigUpdate", []interface{}{arg1})
   180  	fake.proposeConfigUpdateMutex.Unlock()
   181  	if fake.ProposeConfigUpdateStub != nil {
   182  		return fake.ProposeConfigUpdateStub(arg1)
   183  	}
   184  	if specificReturn {
   185  		return ret.result1, ret.result2
   186  	}
   187  	fakeReturns := fake.proposeConfigUpdateReturns
   188  	return fakeReturns.result1, fakeReturns.result2
   189  }
   190  
   191  func (fake *ConfigTXValidator) ProposeConfigUpdateCallCount() int {
   192  	fake.proposeConfigUpdateMutex.RLock()
   193  	defer fake.proposeConfigUpdateMutex.RUnlock()
   194  	return len(fake.proposeConfigUpdateArgsForCall)
   195  }
   196  
   197  func (fake *ConfigTXValidator) ProposeConfigUpdateCalls(stub func(*common.Envelope) (*common.ConfigEnvelope, error)) {
   198  	fake.proposeConfigUpdateMutex.Lock()
   199  	defer fake.proposeConfigUpdateMutex.Unlock()
   200  	fake.ProposeConfigUpdateStub = stub
   201  }
   202  
   203  func (fake *ConfigTXValidator) ProposeConfigUpdateArgsForCall(i int) *common.Envelope {
   204  	fake.proposeConfigUpdateMutex.RLock()
   205  	defer fake.proposeConfigUpdateMutex.RUnlock()
   206  	argsForCall := fake.proposeConfigUpdateArgsForCall[i]
   207  	return argsForCall.arg1
   208  }
   209  
   210  func (fake *ConfigTXValidator) ProposeConfigUpdateReturns(result1 *common.ConfigEnvelope, result2 error) {
   211  	fake.proposeConfigUpdateMutex.Lock()
   212  	defer fake.proposeConfigUpdateMutex.Unlock()
   213  	fake.ProposeConfigUpdateStub = nil
   214  	fake.proposeConfigUpdateReturns = struct {
   215  		result1 *common.ConfigEnvelope
   216  		result2 error
   217  	}{result1, result2}
   218  }
   219  
   220  func (fake *ConfigTXValidator) ProposeConfigUpdateReturnsOnCall(i int, result1 *common.ConfigEnvelope, result2 error) {
   221  	fake.proposeConfigUpdateMutex.Lock()
   222  	defer fake.proposeConfigUpdateMutex.Unlock()
   223  	fake.ProposeConfigUpdateStub = nil
   224  	if fake.proposeConfigUpdateReturnsOnCall == nil {
   225  		fake.proposeConfigUpdateReturnsOnCall = make(map[int]struct {
   226  			result1 *common.ConfigEnvelope
   227  			result2 error
   228  		})
   229  	}
   230  	fake.proposeConfigUpdateReturnsOnCall[i] = struct {
   231  		result1 *common.ConfigEnvelope
   232  		result2 error
   233  	}{result1, result2}
   234  }
   235  
   236  func (fake *ConfigTXValidator) Sequence() uint64 {
   237  	fake.sequenceMutex.Lock()
   238  	ret, specificReturn := fake.sequenceReturnsOnCall[len(fake.sequenceArgsForCall)]
   239  	fake.sequenceArgsForCall = append(fake.sequenceArgsForCall, struct {
   240  	}{})
   241  	fake.recordInvocation("Sequence", []interface{}{})
   242  	fake.sequenceMutex.Unlock()
   243  	if fake.SequenceStub != nil {
   244  		return fake.SequenceStub()
   245  	}
   246  	if specificReturn {
   247  		return ret.result1
   248  	}
   249  	fakeReturns := fake.sequenceReturns
   250  	return fakeReturns.result1
   251  }
   252  
   253  func (fake *ConfigTXValidator) SequenceCallCount() int {
   254  	fake.sequenceMutex.RLock()
   255  	defer fake.sequenceMutex.RUnlock()
   256  	return len(fake.sequenceArgsForCall)
   257  }
   258  
   259  func (fake *ConfigTXValidator) SequenceCalls(stub func() uint64) {
   260  	fake.sequenceMutex.Lock()
   261  	defer fake.sequenceMutex.Unlock()
   262  	fake.SequenceStub = stub
   263  }
   264  
   265  func (fake *ConfigTXValidator) SequenceReturns(result1 uint64) {
   266  	fake.sequenceMutex.Lock()
   267  	defer fake.sequenceMutex.Unlock()
   268  	fake.SequenceStub = nil
   269  	fake.sequenceReturns = struct {
   270  		result1 uint64
   271  	}{result1}
   272  }
   273  
   274  func (fake *ConfigTXValidator) SequenceReturnsOnCall(i int, result1 uint64) {
   275  	fake.sequenceMutex.Lock()
   276  	defer fake.sequenceMutex.Unlock()
   277  	fake.SequenceStub = nil
   278  	if fake.sequenceReturnsOnCall == nil {
   279  		fake.sequenceReturnsOnCall = make(map[int]struct {
   280  			result1 uint64
   281  		})
   282  	}
   283  	fake.sequenceReturnsOnCall[i] = struct {
   284  		result1 uint64
   285  	}{result1}
   286  }
   287  
   288  func (fake *ConfigTXValidator) Validate(arg1 *common.ConfigEnvelope) error {
   289  	fake.validateMutex.Lock()
   290  	ret, specificReturn := fake.validateReturnsOnCall[len(fake.validateArgsForCall)]
   291  	fake.validateArgsForCall = append(fake.validateArgsForCall, struct {
   292  		arg1 *common.ConfigEnvelope
   293  	}{arg1})
   294  	fake.recordInvocation("Validate", []interface{}{arg1})
   295  	fake.validateMutex.Unlock()
   296  	if fake.ValidateStub != nil {
   297  		return fake.ValidateStub(arg1)
   298  	}
   299  	if specificReturn {
   300  		return ret.result1
   301  	}
   302  	fakeReturns := fake.validateReturns
   303  	return fakeReturns.result1
   304  }
   305  
   306  func (fake *ConfigTXValidator) ValidateCallCount() int {
   307  	fake.validateMutex.RLock()
   308  	defer fake.validateMutex.RUnlock()
   309  	return len(fake.validateArgsForCall)
   310  }
   311  
   312  func (fake *ConfigTXValidator) ValidateCalls(stub func(*common.ConfigEnvelope) error) {
   313  	fake.validateMutex.Lock()
   314  	defer fake.validateMutex.Unlock()
   315  	fake.ValidateStub = stub
   316  }
   317  
   318  func (fake *ConfigTXValidator) ValidateArgsForCall(i int) *common.ConfigEnvelope {
   319  	fake.validateMutex.RLock()
   320  	defer fake.validateMutex.RUnlock()
   321  	argsForCall := fake.validateArgsForCall[i]
   322  	return argsForCall.arg1
   323  }
   324  
   325  func (fake *ConfigTXValidator) ValidateReturns(result1 error) {
   326  	fake.validateMutex.Lock()
   327  	defer fake.validateMutex.Unlock()
   328  	fake.ValidateStub = nil
   329  	fake.validateReturns = struct {
   330  		result1 error
   331  	}{result1}
   332  }
   333  
   334  func (fake *ConfigTXValidator) ValidateReturnsOnCall(i int, result1 error) {
   335  	fake.validateMutex.Lock()
   336  	defer fake.validateMutex.Unlock()
   337  	fake.ValidateStub = nil
   338  	if fake.validateReturnsOnCall == nil {
   339  		fake.validateReturnsOnCall = make(map[int]struct {
   340  			result1 error
   341  		})
   342  	}
   343  	fake.validateReturnsOnCall[i] = struct {
   344  		result1 error
   345  	}{result1}
   346  }
   347  
   348  func (fake *ConfigTXValidator) Invocations() map[string][][]interface{} {
   349  	fake.invocationsMutex.RLock()
   350  	defer fake.invocationsMutex.RUnlock()
   351  	fake.channelIDMutex.RLock()
   352  	defer fake.channelIDMutex.RUnlock()
   353  	fake.configProtoMutex.RLock()
   354  	defer fake.configProtoMutex.RUnlock()
   355  	fake.proposeConfigUpdateMutex.RLock()
   356  	defer fake.proposeConfigUpdateMutex.RUnlock()
   357  	fake.sequenceMutex.RLock()
   358  	defer fake.sequenceMutex.RUnlock()
   359  	fake.validateMutex.RLock()
   360  	defer fake.validateMutex.RUnlock()
   361  	copiedInvocations := map[string][][]interface{}{}
   362  	for key, value := range fake.invocations {
   363  		copiedInvocations[key] = value
   364  	}
   365  	return copiedInvocations
   366  }
   367  
   368  func (fake *ConfigTXValidator) recordInvocation(key string, args []interface{}) {
   369  	fake.invocationsMutex.Lock()
   370  	defer fake.invocationsMutex.Unlock()
   371  	if fake.invocations == nil {
   372  		fake.invocations = map[string][][]interface{}{}
   373  	}
   374  	if fake.invocations[key] == nil {
   375  		fake.invocations[key] = [][]interface{}{}
   376  	}
   377  	fake.invocations[key] = append(fake.invocations[key], args)
   378  }