github.com/kaituanwang/hyperledger@v2.0.1+incompatible/core/ledger/pvtdatapolicy/mock/coll_info_provider.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/peer" 8 ) 9 10 type CollectionInfoProvider struct { 11 CollectionInfoStub func(string, string) (*peer.StaticCollectionConfig, error) 12 collectionInfoMutex sync.RWMutex 13 collectionInfoArgsForCall []struct { 14 arg1 string 15 arg2 string 16 } 17 collectionInfoReturns struct { 18 result1 *peer.StaticCollectionConfig 19 result2 error 20 } 21 collectionInfoReturnsOnCall map[int]struct { 22 result1 *peer.StaticCollectionConfig 23 result2 error 24 } 25 invocations map[string][][]interface{} 26 invocationsMutex sync.RWMutex 27 } 28 29 func (fake *CollectionInfoProvider) CollectionInfo(arg1 string, arg2 string) (*peer.StaticCollectionConfig, error) { 30 fake.collectionInfoMutex.Lock() 31 ret, specificReturn := fake.collectionInfoReturnsOnCall[len(fake.collectionInfoArgsForCall)] 32 fake.collectionInfoArgsForCall = append(fake.collectionInfoArgsForCall, struct { 33 arg1 string 34 arg2 string 35 }{arg1, arg2}) 36 fake.recordInvocation("CollectionInfo", []interface{}{arg1, arg2}) 37 fake.collectionInfoMutex.Unlock() 38 if fake.CollectionInfoStub != nil { 39 return fake.CollectionInfoStub(arg1, arg2) 40 } 41 if specificReturn { 42 return ret.result1, ret.result2 43 } 44 fakeReturns := fake.collectionInfoReturns 45 return fakeReturns.result1, fakeReturns.result2 46 } 47 48 func (fake *CollectionInfoProvider) CollectionInfoCallCount() int { 49 fake.collectionInfoMutex.RLock() 50 defer fake.collectionInfoMutex.RUnlock() 51 return len(fake.collectionInfoArgsForCall) 52 } 53 54 func (fake *CollectionInfoProvider) CollectionInfoCalls(stub func(string, string) (*peer.StaticCollectionConfig, error)) { 55 fake.collectionInfoMutex.Lock() 56 defer fake.collectionInfoMutex.Unlock() 57 fake.CollectionInfoStub = stub 58 } 59 60 func (fake *CollectionInfoProvider) CollectionInfoArgsForCall(i int) (string, string) { 61 fake.collectionInfoMutex.RLock() 62 defer fake.collectionInfoMutex.RUnlock() 63 argsForCall := fake.collectionInfoArgsForCall[i] 64 return argsForCall.arg1, argsForCall.arg2 65 } 66 67 func (fake *CollectionInfoProvider) CollectionInfoReturns(result1 *peer.StaticCollectionConfig, result2 error) { 68 fake.collectionInfoMutex.Lock() 69 defer fake.collectionInfoMutex.Unlock() 70 fake.CollectionInfoStub = nil 71 fake.collectionInfoReturns = struct { 72 result1 *peer.StaticCollectionConfig 73 result2 error 74 }{result1, result2} 75 } 76 77 func (fake *CollectionInfoProvider) CollectionInfoReturnsOnCall(i int, result1 *peer.StaticCollectionConfig, result2 error) { 78 fake.collectionInfoMutex.Lock() 79 defer fake.collectionInfoMutex.Unlock() 80 fake.CollectionInfoStub = nil 81 if fake.collectionInfoReturnsOnCall == nil { 82 fake.collectionInfoReturnsOnCall = make(map[int]struct { 83 result1 *peer.StaticCollectionConfig 84 result2 error 85 }) 86 } 87 fake.collectionInfoReturnsOnCall[i] = struct { 88 result1 *peer.StaticCollectionConfig 89 result2 error 90 }{result1, result2} 91 } 92 93 func (fake *CollectionInfoProvider) Invocations() map[string][][]interface{} { 94 fake.invocationsMutex.RLock() 95 defer fake.invocationsMutex.RUnlock() 96 fake.collectionInfoMutex.RLock() 97 defer fake.collectionInfoMutex.RUnlock() 98 copiedInvocations := map[string][][]interface{}{} 99 for key, value := range fake.invocations { 100 copiedInvocations[key] = value 101 } 102 return copiedInvocations 103 } 104 105 func (fake *CollectionInfoProvider) recordInvocation(key string, args []interface{}) { 106 fake.invocationsMutex.Lock() 107 defer fake.invocationsMutex.Unlock() 108 if fake.invocations == nil { 109 fake.invocations = map[string][][]interface{}{} 110 } 111 if fake.invocations[key] == nil { 112 fake.invocations[key] = [][]interface{}{} 113 } 114 fake.invocations[key] = append(fake.invocations[key], args) 115 }