github.com/yimialmonte/fabric@v2.1.1+incompatible/core/scc/mock/chaincode.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package mock
     3  
     4  import (
     5  	"sync"
     6  
     7  	"github.com/hyperledger/fabric-chaincode-go/shim"
     8  	"github.com/hyperledger/fabric-protos-go/peer"
     9  )
    10  
    11  type Chaincode struct {
    12  	InitStub        func(shim.ChaincodeStubInterface) peer.Response
    13  	initMutex       sync.RWMutex
    14  	initArgsForCall []struct {
    15  		arg1 shim.ChaincodeStubInterface
    16  	}
    17  	initReturns struct {
    18  		result1 peer.Response
    19  	}
    20  	initReturnsOnCall map[int]struct {
    21  		result1 peer.Response
    22  	}
    23  	InvokeStub        func(shim.ChaincodeStubInterface) peer.Response
    24  	invokeMutex       sync.RWMutex
    25  	invokeArgsForCall []struct {
    26  		arg1 shim.ChaincodeStubInterface
    27  	}
    28  	invokeReturns struct {
    29  		result1 peer.Response
    30  	}
    31  	invokeReturnsOnCall map[int]struct {
    32  		result1 peer.Response
    33  	}
    34  	invocations      map[string][][]interface{}
    35  	invocationsMutex sync.RWMutex
    36  }
    37  
    38  func (fake *Chaincode) Init(arg1 shim.ChaincodeStubInterface) peer.Response {
    39  	fake.initMutex.Lock()
    40  	ret, specificReturn := fake.initReturnsOnCall[len(fake.initArgsForCall)]
    41  	fake.initArgsForCall = append(fake.initArgsForCall, struct {
    42  		arg1 shim.ChaincodeStubInterface
    43  	}{arg1})
    44  	fake.recordInvocation("Init", []interface{}{arg1})
    45  	fake.initMutex.Unlock()
    46  	if fake.InitStub != nil {
    47  		return fake.InitStub(arg1)
    48  	}
    49  	if specificReturn {
    50  		return ret.result1
    51  	}
    52  	fakeReturns := fake.initReturns
    53  	return fakeReturns.result1
    54  }
    55  
    56  func (fake *Chaincode) InitCallCount() int {
    57  	fake.initMutex.RLock()
    58  	defer fake.initMutex.RUnlock()
    59  	return len(fake.initArgsForCall)
    60  }
    61  
    62  func (fake *Chaincode) InitCalls(stub func(shim.ChaincodeStubInterface) peer.Response) {
    63  	fake.initMutex.Lock()
    64  	defer fake.initMutex.Unlock()
    65  	fake.InitStub = stub
    66  }
    67  
    68  func (fake *Chaincode) InitArgsForCall(i int) shim.ChaincodeStubInterface {
    69  	fake.initMutex.RLock()
    70  	defer fake.initMutex.RUnlock()
    71  	argsForCall := fake.initArgsForCall[i]
    72  	return argsForCall.arg1
    73  }
    74  
    75  func (fake *Chaincode) InitReturns(result1 peer.Response) {
    76  	fake.initMutex.Lock()
    77  	defer fake.initMutex.Unlock()
    78  	fake.InitStub = nil
    79  	fake.initReturns = struct {
    80  		result1 peer.Response
    81  	}{result1}
    82  }
    83  
    84  func (fake *Chaincode) InitReturnsOnCall(i int, result1 peer.Response) {
    85  	fake.initMutex.Lock()
    86  	defer fake.initMutex.Unlock()
    87  	fake.InitStub = nil
    88  	if fake.initReturnsOnCall == nil {
    89  		fake.initReturnsOnCall = make(map[int]struct {
    90  			result1 peer.Response
    91  		})
    92  	}
    93  	fake.initReturnsOnCall[i] = struct {
    94  		result1 peer.Response
    95  	}{result1}
    96  }
    97  
    98  func (fake *Chaincode) Invoke(arg1 shim.ChaincodeStubInterface) peer.Response {
    99  	fake.invokeMutex.Lock()
   100  	ret, specificReturn := fake.invokeReturnsOnCall[len(fake.invokeArgsForCall)]
   101  	fake.invokeArgsForCall = append(fake.invokeArgsForCall, struct {
   102  		arg1 shim.ChaincodeStubInterface
   103  	}{arg1})
   104  	fake.recordInvocation("Invoke", []interface{}{arg1})
   105  	fake.invokeMutex.Unlock()
   106  	if fake.InvokeStub != nil {
   107  		return fake.InvokeStub(arg1)
   108  	}
   109  	if specificReturn {
   110  		return ret.result1
   111  	}
   112  	fakeReturns := fake.invokeReturns
   113  	return fakeReturns.result1
   114  }
   115  
   116  func (fake *Chaincode) InvokeCallCount() int {
   117  	fake.invokeMutex.RLock()
   118  	defer fake.invokeMutex.RUnlock()
   119  	return len(fake.invokeArgsForCall)
   120  }
   121  
   122  func (fake *Chaincode) InvokeCalls(stub func(shim.ChaincodeStubInterface) peer.Response) {
   123  	fake.invokeMutex.Lock()
   124  	defer fake.invokeMutex.Unlock()
   125  	fake.InvokeStub = stub
   126  }
   127  
   128  func (fake *Chaincode) InvokeArgsForCall(i int) shim.ChaincodeStubInterface {
   129  	fake.invokeMutex.RLock()
   130  	defer fake.invokeMutex.RUnlock()
   131  	argsForCall := fake.invokeArgsForCall[i]
   132  	return argsForCall.arg1
   133  }
   134  
   135  func (fake *Chaincode) InvokeReturns(result1 peer.Response) {
   136  	fake.invokeMutex.Lock()
   137  	defer fake.invokeMutex.Unlock()
   138  	fake.InvokeStub = nil
   139  	fake.invokeReturns = struct {
   140  		result1 peer.Response
   141  	}{result1}
   142  }
   143  
   144  func (fake *Chaincode) InvokeReturnsOnCall(i int, result1 peer.Response) {
   145  	fake.invokeMutex.Lock()
   146  	defer fake.invokeMutex.Unlock()
   147  	fake.InvokeStub = nil
   148  	if fake.invokeReturnsOnCall == nil {
   149  		fake.invokeReturnsOnCall = make(map[int]struct {
   150  			result1 peer.Response
   151  		})
   152  	}
   153  	fake.invokeReturnsOnCall[i] = struct {
   154  		result1 peer.Response
   155  	}{result1}
   156  }
   157  
   158  func (fake *Chaincode) Invocations() map[string][][]interface{} {
   159  	fake.invocationsMutex.RLock()
   160  	defer fake.invocationsMutex.RUnlock()
   161  	fake.initMutex.RLock()
   162  	defer fake.initMutex.RUnlock()
   163  	fake.invokeMutex.RLock()
   164  	defer fake.invokeMutex.RUnlock()
   165  	copiedInvocations := map[string][][]interface{}{}
   166  	for key, value := range fake.invocations {
   167  		copiedInvocations[key] = value
   168  	}
   169  	return copiedInvocations
   170  }
   171  
   172  func (fake *Chaincode) recordInvocation(key string, args []interface{}) {
   173  	fake.invocationsMutex.Lock()
   174  	defer fake.invocationsMutex.Unlock()
   175  	if fake.invocations == nil {
   176  		fake.invocations = map[string][][]interface{}{}
   177  	}
   178  	if fake.invocations[key] == nil {
   179  		fake.invocations[key] = [][]interface{}{}
   180  	}
   181  	fake.invocations[key] = append(fake.invocations[key], args)
   182  }