github.com/true-sqn/fabric@v2.1.1+incompatible/core/chaincode/mock/transaction_registry.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package mock
     3  
     4  import (
     5  	"sync"
     6  )
     7  
     8  type TransactionRegistry struct {
     9  	AddStub        func(string, string) bool
    10  	addMutex       sync.RWMutex
    11  	addArgsForCall []struct {
    12  		arg1 string
    13  		arg2 string
    14  	}
    15  	addReturns struct {
    16  		result1 bool
    17  	}
    18  	addReturnsOnCall map[int]struct {
    19  		result1 bool
    20  	}
    21  	RemoveStub        func(string, string)
    22  	removeMutex       sync.RWMutex
    23  	removeArgsForCall []struct {
    24  		arg1 string
    25  		arg2 string
    26  	}
    27  	invocations      map[string][][]interface{}
    28  	invocationsMutex sync.RWMutex
    29  }
    30  
    31  func (fake *TransactionRegistry) Add(arg1 string, arg2 string) bool {
    32  	fake.addMutex.Lock()
    33  	ret, specificReturn := fake.addReturnsOnCall[len(fake.addArgsForCall)]
    34  	fake.addArgsForCall = append(fake.addArgsForCall, struct {
    35  		arg1 string
    36  		arg2 string
    37  	}{arg1, arg2})
    38  	fake.recordInvocation("Add", []interface{}{arg1, arg2})
    39  	fake.addMutex.Unlock()
    40  	if fake.AddStub != nil {
    41  		return fake.AddStub(arg1, arg2)
    42  	}
    43  	if specificReturn {
    44  		return ret.result1
    45  	}
    46  	fakeReturns := fake.addReturns
    47  	return fakeReturns.result1
    48  }
    49  
    50  func (fake *TransactionRegistry) AddCallCount() int {
    51  	fake.addMutex.RLock()
    52  	defer fake.addMutex.RUnlock()
    53  	return len(fake.addArgsForCall)
    54  }
    55  
    56  func (fake *TransactionRegistry) AddCalls(stub func(string, string) bool) {
    57  	fake.addMutex.Lock()
    58  	defer fake.addMutex.Unlock()
    59  	fake.AddStub = stub
    60  }
    61  
    62  func (fake *TransactionRegistry) AddArgsForCall(i int) (string, string) {
    63  	fake.addMutex.RLock()
    64  	defer fake.addMutex.RUnlock()
    65  	argsForCall := fake.addArgsForCall[i]
    66  	return argsForCall.arg1, argsForCall.arg2
    67  }
    68  
    69  func (fake *TransactionRegistry) AddReturns(result1 bool) {
    70  	fake.addMutex.Lock()
    71  	defer fake.addMutex.Unlock()
    72  	fake.AddStub = nil
    73  	fake.addReturns = struct {
    74  		result1 bool
    75  	}{result1}
    76  }
    77  
    78  func (fake *TransactionRegistry) AddReturnsOnCall(i int, result1 bool) {
    79  	fake.addMutex.Lock()
    80  	defer fake.addMutex.Unlock()
    81  	fake.AddStub = nil
    82  	if fake.addReturnsOnCall == nil {
    83  		fake.addReturnsOnCall = make(map[int]struct {
    84  			result1 bool
    85  		})
    86  	}
    87  	fake.addReturnsOnCall[i] = struct {
    88  		result1 bool
    89  	}{result1}
    90  }
    91  
    92  func (fake *TransactionRegistry) Remove(arg1 string, arg2 string) {
    93  	fake.removeMutex.Lock()
    94  	fake.removeArgsForCall = append(fake.removeArgsForCall, struct {
    95  		arg1 string
    96  		arg2 string
    97  	}{arg1, arg2})
    98  	fake.recordInvocation("Remove", []interface{}{arg1, arg2})
    99  	fake.removeMutex.Unlock()
   100  	if fake.RemoveStub != nil {
   101  		fake.RemoveStub(arg1, arg2)
   102  	}
   103  }
   104  
   105  func (fake *TransactionRegistry) RemoveCallCount() int {
   106  	fake.removeMutex.RLock()
   107  	defer fake.removeMutex.RUnlock()
   108  	return len(fake.removeArgsForCall)
   109  }
   110  
   111  func (fake *TransactionRegistry) RemoveCalls(stub func(string, string)) {
   112  	fake.removeMutex.Lock()
   113  	defer fake.removeMutex.Unlock()
   114  	fake.RemoveStub = stub
   115  }
   116  
   117  func (fake *TransactionRegistry) RemoveArgsForCall(i int) (string, string) {
   118  	fake.removeMutex.RLock()
   119  	defer fake.removeMutex.RUnlock()
   120  	argsForCall := fake.removeArgsForCall[i]
   121  	return argsForCall.arg1, argsForCall.arg2
   122  }
   123  
   124  func (fake *TransactionRegistry) Invocations() map[string][][]interface{} {
   125  	fake.invocationsMutex.RLock()
   126  	defer fake.invocationsMutex.RUnlock()
   127  	fake.addMutex.RLock()
   128  	defer fake.addMutex.RUnlock()
   129  	fake.removeMutex.RLock()
   130  	defer fake.removeMutex.RUnlock()
   131  	copiedInvocations := map[string][][]interface{}{}
   132  	for key, value := range fake.invocations {
   133  		copiedInvocations[key] = value
   134  	}
   135  	return copiedInvocations
   136  }
   137  
   138  func (fake *TransactionRegistry) recordInvocation(key string, args []interface{}) {
   139  	fake.invocationsMutex.Lock()
   140  	defer fake.invocationsMutex.Unlock()
   141  	if fake.invocations == nil {
   142  		fake.invocations = map[string][][]interface{}{}
   143  	}
   144  	if fake.invocations[key] == nil {
   145  		fake.invocations[key] = [][]interface{}{}
   146  	}
   147  	fake.invocations[key] = append(fake.invocations[key], args)
   148  }