github.com/ahlemtn/fabric@v2.1.1+incompatible/core/container/mock/instance.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package mock
     3  
     4  import (
     5  	"sync"
     6  
     7  	"github.com/hyperledger/fabric/core/container"
     8  	"github.com/hyperledger/fabric/core/container/ccintf"
     9  )
    10  
    11  type Instance struct {
    12  	ChaincodeServerInfoStub        func() (*ccintf.ChaincodeServerInfo, error)
    13  	chaincodeServerInfoMutex       sync.RWMutex
    14  	chaincodeServerInfoArgsForCall []struct {
    15  	}
    16  	chaincodeServerInfoReturns struct {
    17  		result1 *ccintf.ChaincodeServerInfo
    18  		result2 error
    19  	}
    20  	chaincodeServerInfoReturnsOnCall map[int]struct {
    21  		result1 *ccintf.ChaincodeServerInfo
    22  		result2 error
    23  	}
    24  	StartStub        func(*ccintf.PeerConnection) error
    25  	startMutex       sync.RWMutex
    26  	startArgsForCall []struct {
    27  		arg1 *ccintf.PeerConnection
    28  	}
    29  	startReturns struct {
    30  		result1 error
    31  	}
    32  	startReturnsOnCall map[int]struct {
    33  		result1 error
    34  	}
    35  	StopStub        func() error
    36  	stopMutex       sync.RWMutex
    37  	stopArgsForCall []struct {
    38  	}
    39  	stopReturns struct {
    40  		result1 error
    41  	}
    42  	stopReturnsOnCall map[int]struct {
    43  		result1 error
    44  	}
    45  	WaitStub        func() (int, error)
    46  	waitMutex       sync.RWMutex
    47  	waitArgsForCall []struct {
    48  	}
    49  	waitReturns struct {
    50  		result1 int
    51  		result2 error
    52  	}
    53  	waitReturnsOnCall map[int]struct {
    54  		result1 int
    55  		result2 error
    56  	}
    57  	invocations      map[string][][]interface{}
    58  	invocationsMutex sync.RWMutex
    59  }
    60  
    61  func (fake *Instance) ChaincodeServerInfo() (*ccintf.ChaincodeServerInfo, error) {
    62  	fake.chaincodeServerInfoMutex.Lock()
    63  	ret, specificReturn := fake.chaincodeServerInfoReturnsOnCall[len(fake.chaincodeServerInfoArgsForCall)]
    64  	fake.chaincodeServerInfoArgsForCall = append(fake.chaincodeServerInfoArgsForCall, struct {
    65  	}{})
    66  	fake.recordInvocation("ChaincodeServerInfo", []interface{}{})
    67  	fake.chaincodeServerInfoMutex.Unlock()
    68  	if fake.ChaincodeServerInfoStub != nil {
    69  		return fake.ChaincodeServerInfoStub()
    70  	}
    71  	if specificReturn {
    72  		return ret.result1, ret.result2
    73  	}
    74  	fakeReturns := fake.chaincodeServerInfoReturns
    75  	return fakeReturns.result1, fakeReturns.result2
    76  }
    77  
    78  func (fake *Instance) ChaincodeServerInfoCallCount() int {
    79  	fake.chaincodeServerInfoMutex.RLock()
    80  	defer fake.chaincodeServerInfoMutex.RUnlock()
    81  	return len(fake.chaincodeServerInfoArgsForCall)
    82  }
    83  
    84  func (fake *Instance) ChaincodeServerInfoCalls(stub func() (*ccintf.ChaincodeServerInfo, error)) {
    85  	fake.chaincodeServerInfoMutex.Lock()
    86  	defer fake.chaincodeServerInfoMutex.Unlock()
    87  	fake.ChaincodeServerInfoStub = stub
    88  }
    89  
    90  func (fake *Instance) ChaincodeServerInfoReturns(result1 *ccintf.ChaincodeServerInfo, result2 error) {
    91  	fake.chaincodeServerInfoMutex.Lock()
    92  	defer fake.chaincodeServerInfoMutex.Unlock()
    93  	fake.ChaincodeServerInfoStub = nil
    94  	fake.chaincodeServerInfoReturns = struct {
    95  		result1 *ccintf.ChaincodeServerInfo
    96  		result2 error
    97  	}{result1, result2}
    98  }
    99  
   100  func (fake *Instance) ChaincodeServerInfoReturnsOnCall(i int, result1 *ccintf.ChaincodeServerInfo, result2 error) {
   101  	fake.chaincodeServerInfoMutex.Lock()
   102  	defer fake.chaincodeServerInfoMutex.Unlock()
   103  	fake.ChaincodeServerInfoStub = nil
   104  	if fake.chaincodeServerInfoReturnsOnCall == nil {
   105  		fake.chaincodeServerInfoReturnsOnCall = make(map[int]struct {
   106  			result1 *ccintf.ChaincodeServerInfo
   107  			result2 error
   108  		})
   109  	}
   110  	fake.chaincodeServerInfoReturnsOnCall[i] = struct {
   111  		result1 *ccintf.ChaincodeServerInfo
   112  		result2 error
   113  	}{result1, result2}
   114  }
   115  
   116  func (fake *Instance) Start(arg1 *ccintf.PeerConnection) error {
   117  	fake.startMutex.Lock()
   118  	ret, specificReturn := fake.startReturnsOnCall[len(fake.startArgsForCall)]
   119  	fake.startArgsForCall = append(fake.startArgsForCall, struct {
   120  		arg1 *ccintf.PeerConnection
   121  	}{arg1})
   122  	fake.recordInvocation("Start", []interface{}{arg1})
   123  	fake.startMutex.Unlock()
   124  	if fake.StartStub != nil {
   125  		return fake.StartStub(arg1)
   126  	}
   127  	if specificReturn {
   128  		return ret.result1
   129  	}
   130  	fakeReturns := fake.startReturns
   131  	return fakeReturns.result1
   132  }
   133  
   134  func (fake *Instance) StartCallCount() int {
   135  	fake.startMutex.RLock()
   136  	defer fake.startMutex.RUnlock()
   137  	return len(fake.startArgsForCall)
   138  }
   139  
   140  func (fake *Instance) StartCalls(stub func(*ccintf.PeerConnection) error) {
   141  	fake.startMutex.Lock()
   142  	defer fake.startMutex.Unlock()
   143  	fake.StartStub = stub
   144  }
   145  
   146  func (fake *Instance) StartArgsForCall(i int) *ccintf.PeerConnection {
   147  	fake.startMutex.RLock()
   148  	defer fake.startMutex.RUnlock()
   149  	argsForCall := fake.startArgsForCall[i]
   150  	return argsForCall.arg1
   151  }
   152  
   153  func (fake *Instance) StartReturns(result1 error) {
   154  	fake.startMutex.Lock()
   155  	defer fake.startMutex.Unlock()
   156  	fake.StartStub = nil
   157  	fake.startReturns = struct {
   158  		result1 error
   159  	}{result1}
   160  }
   161  
   162  func (fake *Instance) StartReturnsOnCall(i int, result1 error) {
   163  	fake.startMutex.Lock()
   164  	defer fake.startMutex.Unlock()
   165  	fake.StartStub = nil
   166  	if fake.startReturnsOnCall == nil {
   167  		fake.startReturnsOnCall = make(map[int]struct {
   168  			result1 error
   169  		})
   170  	}
   171  	fake.startReturnsOnCall[i] = struct {
   172  		result1 error
   173  	}{result1}
   174  }
   175  
   176  func (fake *Instance) Stop() error {
   177  	fake.stopMutex.Lock()
   178  	ret, specificReturn := fake.stopReturnsOnCall[len(fake.stopArgsForCall)]
   179  	fake.stopArgsForCall = append(fake.stopArgsForCall, struct {
   180  	}{})
   181  	fake.recordInvocation("Stop", []interface{}{})
   182  	fake.stopMutex.Unlock()
   183  	if fake.StopStub != nil {
   184  		return fake.StopStub()
   185  	}
   186  	if specificReturn {
   187  		return ret.result1
   188  	}
   189  	fakeReturns := fake.stopReturns
   190  	return fakeReturns.result1
   191  }
   192  
   193  func (fake *Instance) StopCallCount() int {
   194  	fake.stopMutex.RLock()
   195  	defer fake.stopMutex.RUnlock()
   196  	return len(fake.stopArgsForCall)
   197  }
   198  
   199  func (fake *Instance) StopCalls(stub func() error) {
   200  	fake.stopMutex.Lock()
   201  	defer fake.stopMutex.Unlock()
   202  	fake.StopStub = stub
   203  }
   204  
   205  func (fake *Instance) StopReturns(result1 error) {
   206  	fake.stopMutex.Lock()
   207  	defer fake.stopMutex.Unlock()
   208  	fake.StopStub = nil
   209  	fake.stopReturns = struct {
   210  		result1 error
   211  	}{result1}
   212  }
   213  
   214  func (fake *Instance) StopReturnsOnCall(i int, result1 error) {
   215  	fake.stopMutex.Lock()
   216  	defer fake.stopMutex.Unlock()
   217  	fake.StopStub = nil
   218  	if fake.stopReturnsOnCall == nil {
   219  		fake.stopReturnsOnCall = make(map[int]struct {
   220  			result1 error
   221  		})
   222  	}
   223  	fake.stopReturnsOnCall[i] = struct {
   224  		result1 error
   225  	}{result1}
   226  }
   227  
   228  func (fake *Instance) Wait() (int, error) {
   229  	fake.waitMutex.Lock()
   230  	ret, specificReturn := fake.waitReturnsOnCall[len(fake.waitArgsForCall)]
   231  	fake.waitArgsForCall = append(fake.waitArgsForCall, struct {
   232  	}{})
   233  	fake.recordInvocation("Wait", []interface{}{})
   234  	fake.waitMutex.Unlock()
   235  	if fake.WaitStub != nil {
   236  		return fake.WaitStub()
   237  	}
   238  	if specificReturn {
   239  		return ret.result1, ret.result2
   240  	}
   241  	fakeReturns := fake.waitReturns
   242  	return fakeReturns.result1, fakeReturns.result2
   243  }
   244  
   245  func (fake *Instance) WaitCallCount() int {
   246  	fake.waitMutex.RLock()
   247  	defer fake.waitMutex.RUnlock()
   248  	return len(fake.waitArgsForCall)
   249  }
   250  
   251  func (fake *Instance) WaitCalls(stub func() (int, error)) {
   252  	fake.waitMutex.Lock()
   253  	defer fake.waitMutex.Unlock()
   254  	fake.WaitStub = stub
   255  }
   256  
   257  func (fake *Instance) WaitReturns(result1 int, result2 error) {
   258  	fake.waitMutex.Lock()
   259  	defer fake.waitMutex.Unlock()
   260  	fake.WaitStub = nil
   261  	fake.waitReturns = struct {
   262  		result1 int
   263  		result2 error
   264  	}{result1, result2}
   265  }
   266  
   267  func (fake *Instance) WaitReturnsOnCall(i int, result1 int, result2 error) {
   268  	fake.waitMutex.Lock()
   269  	defer fake.waitMutex.Unlock()
   270  	fake.WaitStub = nil
   271  	if fake.waitReturnsOnCall == nil {
   272  		fake.waitReturnsOnCall = make(map[int]struct {
   273  			result1 int
   274  			result2 error
   275  		})
   276  	}
   277  	fake.waitReturnsOnCall[i] = struct {
   278  		result1 int
   279  		result2 error
   280  	}{result1, result2}
   281  }
   282  
   283  func (fake *Instance) Invocations() map[string][][]interface{} {
   284  	fake.invocationsMutex.RLock()
   285  	defer fake.invocationsMutex.RUnlock()
   286  	fake.chaincodeServerInfoMutex.RLock()
   287  	defer fake.chaincodeServerInfoMutex.RUnlock()
   288  	fake.startMutex.RLock()
   289  	defer fake.startMutex.RUnlock()
   290  	fake.stopMutex.RLock()
   291  	defer fake.stopMutex.RUnlock()
   292  	fake.waitMutex.RLock()
   293  	defer fake.waitMutex.RUnlock()
   294  	copiedInvocations := map[string][][]interface{}{}
   295  	for key, value := range fake.invocations {
   296  		copiedInvocations[key] = value
   297  	}
   298  	return copiedInvocations
   299  }
   300  
   301  func (fake *Instance) recordInvocation(key string, args []interface{}) {
   302  	fake.invocationsMutex.Lock()
   303  	defer fake.invocationsMutex.Unlock()
   304  	if fake.invocations == nil {
   305  		fake.invocations = map[string][][]interface{}{}
   306  	}
   307  	if fake.invocations[key] == nil {
   308  		fake.invocations[key] = [][]interface{}{}
   309  	}
   310  	fake.invocations[key] = append(fake.invocations[key], args)
   311  }
   312  
   313  var _ container.Instance = new(Instance)