github.com/true-sqn/fabric@v2.1.1+incompatible/core/chaincode/mock/results_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/common/ledger" 8 ) 9 10 type QueryResultsIterator struct { 11 CloseStub func() 12 closeMutex sync.RWMutex 13 closeArgsForCall []struct { 14 } 15 GetBookmarkAndCloseStub func() string 16 getBookmarkAndCloseMutex sync.RWMutex 17 getBookmarkAndCloseArgsForCall []struct { 18 } 19 getBookmarkAndCloseReturns struct { 20 result1 string 21 } 22 getBookmarkAndCloseReturnsOnCall map[int]struct { 23 result1 string 24 } 25 NextStub func() (ledger.QueryResult, error) 26 nextMutex sync.RWMutex 27 nextArgsForCall []struct { 28 } 29 nextReturns struct { 30 result1 ledger.QueryResult 31 result2 error 32 } 33 nextReturnsOnCall map[int]struct { 34 result1 ledger.QueryResult 35 result2 error 36 } 37 invocations map[string][][]interface{} 38 invocationsMutex sync.RWMutex 39 } 40 41 func (fake *QueryResultsIterator) Close() { 42 fake.closeMutex.Lock() 43 fake.closeArgsForCall = append(fake.closeArgsForCall, struct { 44 }{}) 45 fake.recordInvocation("Close", []interface{}{}) 46 fake.closeMutex.Unlock() 47 if fake.CloseStub != nil { 48 fake.CloseStub() 49 } 50 } 51 52 func (fake *QueryResultsIterator) CloseCallCount() int { 53 fake.closeMutex.RLock() 54 defer fake.closeMutex.RUnlock() 55 return len(fake.closeArgsForCall) 56 } 57 58 func (fake *QueryResultsIterator) CloseCalls(stub func()) { 59 fake.closeMutex.Lock() 60 defer fake.closeMutex.Unlock() 61 fake.CloseStub = stub 62 } 63 64 func (fake *QueryResultsIterator) GetBookmarkAndClose() string { 65 fake.getBookmarkAndCloseMutex.Lock() 66 ret, specificReturn := fake.getBookmarkAndCloseReturnsOnCall[len(fake.getBookmarkAndCloseArgsForCall)] 67 fake.getBookmarkAndCloseArgsForCall = append(fake.getBookmarkAndCloseArgsForCall, struct { 68 }{}) 69 fake.recordInvocation("GetBookmarkAndClose", []interface{}{}) 70 fake.getBookmarkAndCloseMutex.Unlock() 71 if fake.GetBookmarkAndCloseStub != nil { 72 return fake.GetBookmarkAndCloseStub() 73 } 74 if specificReturn { 75 return ret.result1 76 } 77 fakeReturns := fake.getBookmarkAndCloseReturns 78 return fakeReturns.result1 79 } 80 81 func (fake *QueryResultsIterator) GetBookmarkAndCloseCallCount() int { 82 fake.getBookmarkAndCloseMutex.RLock() 83 defer fake.getBookmarkAndCloseMutex.RUnlock() 84 return len(fake.getBookmarkAndCloseArgsForCall) 85 } 86 87 func (fake *QueryResultsIterator) GetBookmarkAndCloseCalls(stub func() string) { 88 fake.getBookmarkAndCloseMutex.Lock() 89 defer fake.getBookmarkAndCloseMutex.Unlock() 90 fake.GetBookmarkAndCloseStub = stub 91 } 92 93 func (fake *QueryResultsIterator) GetBookmarkAndCloseReturns(result1 string) { 94 fake.getBookmarkAndCloseMutex.Lock() 95 defer fake.getBookmarkAndCloseMutex.Unlock() 96 fake.GetBookmarkAndCloseStub = nil 97 fake.getBookmarkAndCloseReturns = struct { 98 result1 string 99 }{result1} 100 } 101 102 func (fake *QueryResultsIterator) GetBookmarkAndCloseReturnsOnCall(i int, result1 string) { 103 fake.getBookmarkAndCloseMutex.Lock() 104 defer fake.getBookmarkAndCloseMutex.Unlock() 105 fake.GetBookmarkAndCloseStub = nil 106 if fake.getBookmarkAndCloseReturnsOnCall == nil { 107 fake.getBookmarkAndCloseReturnsOnCall = make(map[int]struct { 108 result1 string 109 }) 110 } 111 fake.getBookmarkAndCloseReturnsOnCall[i] = struct { 112 result1 string 113 }{result1} 114 } 115 116 func (fake *QueryResultsIterator) Next() (ledger.QueryResult, error) { 117 fake.nextMutex.Lock() 118 ret, specificReturn := fake.nextReturnsOnCall[len(fake.nextArgsForCall)] 119 fake.nextArgsForCall = append(fake.nextArgsForCall, struct { 120 }{}) 121 fake.recordInvocation("Next", []interface{}{}) 122 fake.nextMutex.Unlock() 123 if fake.NextStub != nil { 124 return fake.NextStub() 125 } 126 if specificReturn { 127 return ret.result1, ret.result2 128 } 129 fakeReturns := fake.nextReturns 130 return fakeReturns.result1, fakeReturns.result2 131 } 132 133 func (fake *QueryResultsIterator) NextCallCount() int { 134 fake.nextMutex.RLock() 135 defer fake.nextMutex.RUnlock() 136 return len(fake.nextArgsForCall) 137 } 138 139 func (fake *QueryResultsIterator) NextCalls(stub func() (ledger.QueryResult, error)) { 140 fake.nextMutex.Lock() 141 defer fake.nextMutex.Unlock() 142 fake.NextStub = stub 143 } 144 145 func (fake *QueryResultsIterator) NextReturns(result1 ledger.QueryResult, result2 error) { 146 fake.nextMutex.Lock() 147 defer fake.nextMutex.Unlock() 148 fake.NextStub = nil 149 fake.nextReturns = struct { 150 result1 ledger.QueryResult 151 result2 error 152 }{result1, result2} 153 } 154 155 func (fake *QueryResultsIterator) NextReturnsOnCall(i int, result1 ledger.QueryResult, result2 error) { 156 fake.nextMutex.Lock() 157 defer fake.nextMutex.Unlock() 158 fake.NextStub = nil 159 if fake.nextReturnsOnCall == nil { 160 fake.nextReturnsOnCall = make(map[int]struct { 161 result1 ledger.QueryResult 162 result2 error 163 }) 164 } 165 fake.nextReturnsOnCall[i] = struct { 166 result1 ledger.QueryResult 167 result2 error 168 }{result1, result2} 169 } 170 171 func (fake *QueryResultsIterator) Invocations() map[string][][]interface{} { 172 fake.invocationsMutex.RLock() 173 defer fake.invocationsMutex.RUnlock() 174 fake.closeMutex.RLock() 175 defer fake.closeMutex.RUnlock() 176 fake.getBookmarkAndCloseMutex.RLock() 177 defer fake.getBookmarkAndCloseMutex.RUnlock() 178 fake.nextMutex.RLock() 179 defer fake.nextMutex.RUnlock() 180 copiedInvocations := map[string][][]interface{}{} 181 for key, value := range fake.invocations { 182 copiedInvocations[key] = value 183 } 184 return copiedInvocations 185 } 186 187 func (fake *QueryResultsIterator) recordInvocation(key string, args []interface{}) { 188 fake.invocationsMutex.Lock() 189 defer fake.invocationsMutex.Unlock() 190 if fake.invocations == nil { 191 fake.invocations = map[string][][]interface{}{} 192 } 193 if fake.invocations[key] == nil { 194 fake.invocations[key] = [][]interface{}{} 195 } 196 fake.invocations[key] = append(fake.invocations[key], args) 197 }