github.com/hyperledger-labs/bdls@v2.1.1+incompatible/core/chaincode/lifecycle/mock/metadata_handler.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/chaincode" 8 ) 9 10 type MetadataHandler struct { 11 InitializeMetadataStub func(string, chaincode.MetadataSet) 12 initializeMetadataMutex sync.RWMutex 13 initializeMetadataArgsForCall []struct { 14 arg1 string 15 arg2 chaincode.MetadataSet 16 } 17 UpdateMetadataStub func(string, chaincode.MetadataSet) 18 updateMetadataMutex sync.RWMutex 19 updateMetadataArgsForCall []struct { 20 arg1 string 21 arg2 chaincode.MetadataSet 22 } 23 invocations map[string][][]interface{} 24 invocationsMutex sync.RWMutex 25 } 26 27 func (fake *MetadataHandler) InitializeMetadata(arg1 string, arg2 chaincode.MetadataSet) { 28 fake.initializeMetadataMutex.Lock() 29 fake.initializeMetadataArgsForCall = append(fake.initializeMetadataArgsForCall, struct { 30 arg1 string 31 arg2 chaincode.MetadataSet 32 }{arg1, arg2}) 33 fake.recordInvocation("InitializeMetadata", []interface{}{arg1, arg2}) 34 fake.initializeMetadataMutex.Unlock() 35 if fake.InitializeMetadataStub != nil { 36 fake.InitializeMetadataStub(arg1, arg2) 37 } 38 } 39 40 func (fake *MetadataHandler) InitializeMetadataCallCount() int { 41 fake.initializeMetadataMutex.RLock() 42 defer fake.initializeMetadataMutex.RUnlock() 43 return len(fake.initializeMetadataArgsForCall) 44 } 45 46 func (fake *MetadataHandler) InitializeMetadataCalls(stub func(string, chaincode.MetadataSet)) { 47 fake.initializeMetadataMutex.Lock() 48 defer fake.initializeMetadataMutex.Unlock() 49 fake.InitializeMetadataStub = stub 50 } 51 52 func (fake *MetadataHandler) InitializeMetadataArgsForCall(i int) (string, chaincode.MetadataSet) { 53 fake.initializeMetadataMutex.RLock() 54 defer fake.initializeMetadataMutex.RUnlock() 55 argsForCall := fake.initializeMetadataArgsForCall[i] 56 return argsForCall.arg1, argsForCall.arg2 57 } 58 59 func (fake *MetadataHandler) UpdateMetadata(arg1 string, arg2 chaincode.MetadataSet) { 60 fake.updateMetadataMutex.Lock() 61 fake.updateMetadataArgsForCall = append(fake.updateMetadataArgsForCall, struct { 62 arg1 string 63 arg2 chaincode.MetadataSet 64 }{arg1, arg2}) 65 fake.recordInvocation("UpdateMetadata", []interface{}{arg1, arg2}) 66 fake.updateMetadataMutex.Unlock() 67 if fake.UpdateMetadataStub != nil { 68 fake.UpdateMetadataStub(arg1, arg2) 69 } 70 } 71 72 func (fake *MetadataHandler) UpdateMetadataCallCount() int { 73 fake.updateMetadataMutex.RLock() 74 defer fake.updateMetadataMutex.RUnlock() 75 return len(fake.updateMetadataArgsForCall) 76 } 77 78 func (fake *MetadataHandler) UpdateMetadataCalls(stub func(string, chaincode.MetadataSet)) { 79 fake.updateMetadataMutex.Lock() 80 defer fake.updateMetadataMutex.Unlock() 81 fake.UpdateMetadataStub = stub 82 } 83 84 func (fake *MetadataHandler) UpdateMetadataArgsForCall(i int) (string, chaincode.MetadataSet) { 85 fake.updateMetadataMutex.RLock() 86 defer fake.updateMetadataMutex.RUnlock() 87 argsForCall := fake.updateMetadataArgsForCall[i] 88 return argsForCall.arg1, argsForCall.arg2 89 } 90 91 func (fake *MetadataHandler) Invocations() map[string][][]interface{} { 92 fake.invocationsMutex.RLock() 93 defer fake.invocationsMutex.RUnlock() 94 fake.initializeMetadataMutex.RLock() 95 defer fake.initializeMetadataMutex.RUnlock() 96 fake.updateMetadataMutex.RLock() 97 defer fake.updateMetadataMutex.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 *MetadataHandler) 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 }