github.com/hyperledger-labs/bdls@v2.1.1+incompatible/core/chaincode/lifecycle/mock/state_iterator.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package mock
     3  
     4  import (
     5  	"sync"
     6  
     7  	"github.com/hyperledger/fabric-protos-go/ledger/queryresult"
     8  )
     9  
    10  type StateIterator struct {
    11  	CloseStub        func() error
    12  	closeMutex       sync.RWMutex
    13  	closeArgsForCall []struct {
    14  	}
    15  	closeReturns struct {
    16  		result1 error
    17  	}
    18  	closeReturnsOnCall map[int]struct {
    19  		result1 error
    20  	}
    21  	HasNextStub        func() bool
    22  	hasNextMutex       sync.RWMutex
    23  	hasNextArgsForCall []struct {
    24  	}
    25  	hasNextReturns struct {
    26  		result1 bool
    27  	}
    28  	hasNextReturnsOnCall map[int]struct {
    29  		result1 bool
    30  	}
    31  	NextStub        func() (*queryresult.KV, error)
    32  	nextMutex       sync.RWMutex
    33  	nextArgsForCall []struct {
    34  	}
    35  	nextReturns struct {
    36  		result1 *queryresult.KV
    37  		result2 error
    38  	}
    39  	nextReturnsOnCall map[int]struct {
    40  		result1 *queryresult.KV
    41  		result2 error
    42  	}
    43  	invocations      map[string][][]interface{}
    44  	invocationsMutex sync.RWMutex
    45  }
    46  
    47  func (fake *StateIterator) Close() error {
    48  	fake.closeMutex.Lock()
    49  	ret, specificReturn := fake.closeReturnsOnCall[len(fake.closeArgsForCall)]
    50  	fake.closeArgsForCall = append(fake.closeArgsForCall, struct {
    51  	}{})
    52  	fake.recordInvocation("Close", []interface{}{})
    53  	fake.closeMutex.Unlock()
    54  	if fake.CloseStub != nil {
    55  		return fake.CloseStub()
    56  	}
    57  	if specificReturn {
    58  		return ret.result1
    59  	}
    60  	fakeReturns := fake.closeReturns
    61  	return fakeReturns.result1
    62  }
    63  
    64  func (fake *StateIterator) CloseCallCount() int {
    65  	fake.closeMutex.RLock()
    66  	defer fake.closeMutex.RUnlock()
    67  	return len(fake.closeArgsForCall)
    68  }
    69  
    70  func (fake *StateIterator) CloseCalls(stub func() error) {
    71  	fake.closeMutex.Lock()
    72  	defer fake.closeMutex.Unlock()
    73  	fake.CloseStub = stub
    74  }
    75  
    76  func (fake *StateIterator) CloseReturns(result1 error) {
    77  	fake.closeMutex.Lock()
    78  	defer fake.closeMutex.Unlock()
    79  	fake.CloseStub = nil
    80  	fake.closeReturns = struct {
    81  		result1 error
    82  	}{result1}
    83  }
    84  
    85  func (fake *StateIterator) CloseReturnsOnCall(i int, result1 error) {
    86  	fake.closeMutex.Lock()
    87  	defer fake.closeMutex.Unlock()
    88  	fake.CloseStub = nil
    89  	if fake.closeReturnsOnCall == nil {
    90  		fake.closeReturnsOnCall = make(map[int]struct {
    91  			result1 error
    92  		})
    93  	}
    94  	fake.closeReturnsOnCall[i] = struct {
    95  		result1 error
    96  	}{result1}
    97  }
    98  
    99  func (fake *StateIterator) HasNext() bool {
   100  	fake.hasNextMutex.Lock()
   101  	ret, specificReturn := fake.hasNextReturnsOnCall[len(fake.hasNextArgsForCall)]
   102  	fake.hasNextArgsForCall = append(fake.hasNextArgsForCall, struct {
   103  	}{})
   104  	fake.recordInvocation("HasNext", []interface{}{})
   105  	fake.hasNextMutex.Unlock()
   106  	if fake.HasNextStub != nil {
   107  		return fake.HasNextStub()
   108  	}
   109  	if specificReturn {
   110  		return ret.result1
   111  	}
   112  	fakeReturns := fake.hasNextReturns
   113  	return fakeReturns.result1
   114  }
   115  
   116  func (fake *StateIterator) HasNextCallCount() int {
   117  	fake.hasNextMutex.RLock()
   118  	defer fake.hasNextMutex.RUnlock()
   119  	return len(fake.hasNextArgsForCall)
   120  }
   121  
   122  func (fake *StateIterator) HasNextCalls(stub func() bool) {
   123  	fake.hasNextMutex.Lock()
   124  	defer fake.hasNextMutex.Unlock()
   125  	fake.HasNextStub = stub
   126  }
   127  
   128  func (fake *StateIterator) HasNextReturns(result1 bool) {
   129  	fake.hasNextMutex.Lock()
   130  	defer fake.hasNextMutex.Unlock()
   131  	fake.HasNextStub = nil
   132  	fake.hasNextReturns = struct {
   133  		result1 bool
   134  	}{result1}
   135  }
   136  
   137  func (fake *StateIterator) HasNextReturnsOnCall(i int, result1 bool) {
   138  	fake.hasNextMutex.Lock()
   139  	defer fake.hasNextMutex.Unlock()
   140  	fake.HasNextStub = nil
   141  	if fake.hasNextReturnsOnCall == nil {
   142  		fake.hasNextReturnsOnCall = make(map[int]struct {
   143  			result1 bool
   144  		})
   145  	}
   146  	fake.hasNextReturnsOnCall[i] = struct {
   147  		result1 bool
   148  	}{result1}
   149  }
   150  
   151  func (fake *StateIterator) Next() (*queryresult.KV, error) {
   152  	fake.nextMutex.Lock()
   153  	ret, specificReturn := fake.nextReturnsOnCall[len(fake.nextArgsForCall)]
   154  	fake.nextArgsForCall = append(fake.nextArgsForCall, struct {
   155  	}{})
   156  	fake.recordInvocation("Next", []interface{}{})
   157  	fake.nextMutex.Unlock()
   158  	if fake.NextStub != nil {
   159  		return fake.NextStub()
   160  	}
   161  	if specificReturn {
   162  		return ret.result1, ret.result2
   163  	}
   164  	fakeReturns := fake.nextReturns
   165  	return fakeReturns.result1, fakeReturns.result2
   166  }
   167  
   168  func (fake *StateIterator) NextCallCount() int {
   169  	fake.nextMutex.RLock()
   170  	defer fake.nextMutex.RUnlock()
   171  	return len(fake.nextArgsForCall)
   172  }
   173  
   174  func (fake *StateIterator) NextCalls(stub func() (*queryresult.KV, error)) {
   175  	fake.nextMutex.Lock()
   176  	defer fake.nextMutex.Unlock()
   177  	fake.NextStub = stub
   178  }
   179  
   180  func (fake *StateIterator) NextReturns(result1 *queryresult.KV, result2 error) {
   181  	fake.nextMutex.Lock()
   182  	defer fake.nextMutex.Unlock()
   183  	fake.NextStub = nil
   184  	fake.nextReturns = struct {
   185  		result1 *queryresult.KV
   186  		result2 error
   187  	}{result1, result2}
   188  }
   189  
   190  func (fake *StateIterator) NextReturnsOnCall(i int, result1 *queryresult.KV, result2 error) {
   191  	fake.nextMutex.Lock()
   192  	defer fake.nextMutex.Unlock()
   193  	fake.NextStub = nil
   194  	if fake.nextReturnsOnCall == nil {
   195  		fake.nextReturnsOnCall = make(map[int]struct {
   196  			result1 *queryresult.KV
   197  			result2 error
   198  		})
   199  	}
   200  	fake.nextReturnsOnCall[i] = struct {
   201  		result1 *queryresult.KV
   202  		result2 error
   203  	}{result1, result2}
   204  }
   205  
   206  func (fake *StateIterator) Invocations() map[string][][]interface{} {
   207  	fake.invocationsMutex.RLock()
   208  	defer fake.invocationsMutex.RUnlock()
   209  	fake.closeMutex.RLock()
   210  	defer fake.closeMutex.RUnlock()
   211  	fake.hasNextMutex.RLock()
   212  	defer fake.hasNextMutex.RUnlock()
   213  	fake.nextMutex.RLock()
   214  	defer fake.nextMutex.RUnlock()
   215  	copiedInvocations := map[string][][]interface{}{}
   216  	for key, value := range fake.invocations {
   217  		copiedInvocations[key] = value
   218  	}
   219  	return copiedInvocations
   220  }
   221  
   222  func (fake *StateIterator) recordInvocation(key string, args []interface{}) {
   223  	fake.invocationsMutex.Lock()
   224  	defer fake.invocationsMutex.Unlock()
   225  	if fake.invocations == nil {
   226  		fake.invocations = map[string][][]interface{}{}
   227  	}
   228  	if fake.invocations[key] == nil {
   229  		fake.invocations[key] = [][]interface{}{}
   230  	}
   231  	fake.invocations[key] = append(fake.invocations[key], args)
   232  }