github.com/true-sqn/fabric@v2.1.1+incompatible/core/common/privdata/mock/query_executor_factory.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/ledger"
     8  )
     9  
    10  type QueryExecutorFactory struct {
    11  	NewQueryExecutorStub        func() (ledger.QueryExecutor, error)
    12  	newQueryExecutorMutex       sync.RWMutex
    13  	newQueryExecutorArgsForCall []struct {
    14  	}
    15  	newQueryExecutorReturns struct {
    16  		result1 ledger.QueryExecutor
    17  		result2 error
    18  	}
    19  	newQueryExecutorReturnsOnCall map[int]struct {
    20  		result1 ledger.QueryExecutor
    21  		result2 error
    22  	}
    23  	invocations      map[string][][]interface{}
    24  	invocationsMutex sync.RWMutex
    25  }
    26  
    27  func (fake *QueryExecutorFactory) NewQueryExecutor() (ledger.QueryExecutor, error) {
    28  	fake.newQueryExecutorMutex.Lock()
    29  	ret, specificReturn := fake.newQueryExecutorReturnsOnCall[len(fake.newQueryExecutorArgsForCall)]
    30  	fake.newQueryExecutorArgsForCall = append(fake.newQueryExecutorArgsForCall, struct {
    31  	}{})
    32  	fake.recordInvocation("NewQueryExecutor", []interface{}{})
    33  	fake.newQueryExecutorMutex.Unlock()
    34  	if fake.NewQueryExecutorStub != nil {
    35  		return fake.NewQueryExecutorStub()
    36  	}
    37  	if specificReturn {
    38  		return ret.result1, ret.result2
    39  	}
    40  	fakeReturns := fake.newQueryExecutorReturns
    41  	return fakeReturns.result1, fakeReturns.result2
    42  }
    43  
    44  func (fake *QueryExecutorFactory) NewQueryExecutorCallCount() int {
    45  	fake.newQueryExecutorMutex.RLock()
    46  	defer fake.newQueryExecutorMutex.RUnlock()
    47  	return len(fake.newQueryExecutorArgsForCall)
    48  }
    49  
    50  func (fake *QueryExecutorFactory) NewQueryExecutorCalls(stub func() (ledger.QueryExecutor, error)) {
    51  	fake.newQueryExecutorMutex.Lock()
    52  	defer fake.newQueryExecutorMutex.Unlock()
    53  	fake.NewQueryExecutorStub = stub
    54  }
    55  
    56  func (fake *QueryExecutorFactory) NewQueryExecutorReturns(result1 ledger.QueryExecutor, result2 error) {
    57  	fake.newQueryExecutorMutex.Lock()
    58  	defer fake.newQueryExecutorMutex.Unlock()
    59  	fake.NewQueryExecutorStub = nil
    60  	fake.newQueryExecutorReturns = struct {
    61  		result1 ledger.QueryExecutor
    62  		result2 error
    63  	}{result1, result2}
    64  }
    65  
    66  func (fake *QueryExecutorFactory) NewQueryExecutorReturnsOnCall(i int, result1 ledger.QueryExecutor, result2 error) {
    67  	fake.newQueryExecutorMutex.Lock()
    68  	defer fake.newQueryExecutorMutex.Unlock()
    69  	fake.NewQueryExecutorStub = nil
    70  	if fake.newQueryExecutorReturnsOnCall == nil {
    71  		fake.newQueryExecutorReturnsOnCall = make(map[int]struct {
    72  			result1 ledger.QueryExecutor
    73  			result2 error
    74  		})
    75  	}
    76  	fake.newQueryExecutorReturnsOnCall[i] = struct {
    77  		result1 ledger.QueryExecutor
    78  		result2 error
    79  	}{result1, result2}
    80  }
    81  
    82  func (fake *QueryExecutorFactory) Invocations() map[string][][]interface{} {
    83  	fake.invocationsMutex.RLock()
    84  	defer fake.invocationsMutex.RUnlock()
    85  	fake.newQueryExecutorMutex.RLock()
    86  	defer fake.newQueryExecutorMutex.RUnlock()
    87  	copiedInvocations := map[string][][]interface{}{}
    88  	for key, value := range fake.invocations {
    89  		copiedInvocations[key] = value
    90  	}
    91  	return copiedInvocations
    92  }
    93  
    94  func (fake *QueryExecutorFactory) recordInvocation(key string, args []interface{}) {
    95  	fake.invocationsMutex.Lock()
    96  	defer fake.invocationsMutex.Unlock()
    97  	if fake.invocations == nil {
    98  		fake.invocations = map[string][][]interface{}{}
    99  	}
   100  	if fake.invocations[key] == nil {
   101  		fake.invocations[key] = [][]interface{}{}
   102  	}
   103  	fake.invocations[key] = append(fake.invocations[key], args)
   104  }