github.com/lukasheimann/cloudfoundrycli@v7.1.0+incompatible/actor/pluginaction/pluginactionfakes/fake_plugin_metadata.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package pluginactionfakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/actor/pluginaction" 8 "code.cloudfoundry.org/cli/util/configv3" 9 ) 10 11 type FakePluginMetadata struct { 12 GetMetadataStub func(string) (configv3.Plugin, error) 13 getMetadataMutex sync.RWMutex 14 getMetadataArgsForCall []struct { 15 arg1 string 16 } 17 getMetadataReturns struct { 18 result1 configv3.Plugin 19 result2 error 20 } 21 getMetadataReturnsOnCall map[int]struct { 22 result1 configv3.Plugin 23 result2 error 24 } 25 invocations map[string][][]interface{} 26 invocationsMutex sync.RWMutex 27 } 28 29 func (fake *FakePluginMetadata) GetMetadata(arg1 string) (configv3.Plugin, error) { 30 fake.getMetadataMutex.Lock() 31 ret, specificReturn := fake.getMetadataReturnsOnCall[len(fake.getMetadataArgsForCall)] 32 fake.getMetadataArgsForCall = append(fake.getMetadataArgsForCall, struct { 33 arg1 string 34 }{arg1}) 35 fake.recordInvocation("GetMetadata", []interface{}{arg1}) 36 fake.getMetadataMutex.Unlock() 37 if fake.GetMetadataStub != nil { 38 return fake.GetMetadataStub(arg1) 39 } 40 if specificReturn { 41 return ret.result1, ret.result2 42 } 43 fakeReturns := fake.getMetadataReturns 44 return fakeReturns.result1, fakeReturns.result2 45 } 46 47 func (fake *FakePluginMetadata) GetMetadataCallCount() int { 48 fake.getMetadataMutex.RLock() 49 defer fake.getMetadataMutex.RUnlock() 50 return len(fake.getMetadataArgsForCall) 51 } 52 53 func (fake *FakePluginMetadata) GetMetadataCalls(stub func(string) (configv3.Plugin, error)) { 54 fake.getMetadataMutex.Lock() 55 defer fake.getMetadataMutex.Unlock() 56 fake.GetMetadataStub = stub 57 } 58 59 func (fake *FakePluginMetadata) GetMetadataArgsForCall(i int) string { 60 fake.getMetadataMutex.RLock() 61 defer fake.getMetadataMutex.RUnlock() 62 argsForCall := fake.getMetadataArgsForCall[i] 63 return argsForCall.arg1 64 } 65 66 func (fake *FakePluginMetadata) GetMetadataReturns(result1 configv3.Plugin, result2 error) { 67 fake.getMetadataMutex.Lock() 68 defer fake.getMetadataMutex.Unlock() 69 fake.GetMetadataStub = nil 70 fake.getMetadataReturns = struct { 71 result1 configv3.Plugin 72 result2 error 73 }{result1, result2} 74 } 75 76 func (fake *FakePluginMetadata) GetMetadataReturnsOnCall(i int, result1 configv3.Plugin, result2 error) { 77 fake.getMetadataMutex.Lock() 78 defer fake.getMetadataMutex.Unlock() 79 fake.GetMetadataStub = nil 80 if fake.getMetadataReturnsOnCall == nil { 81 fake.getMetadataReturnsOnCall = make(map[int]struct { 82 result1 configv3.Plugin 83 result2 error 84 }) 85 } 86 fake.getMetadataReturnsOnCall[i] = struct { 87 result1 configv3.Plugin 88 result2 error 89 }{result1, result2} 90 } 91 92 func (fake *FakePluginMetadata) Invocations() map[string][][]interface{} { 93 fake.invocationsMutex.RLock() 94 defer fake.invocationsMutex.RUnlock() 95 fake.getMetadataMutex.RLock() 96 defer fake.getMetadataMutex.RUnlock() 97 copiedInvocations := map[string][][]interface{}{} 98 for key, value := range fake.invocations { 99 copiedInvocations[key] = value 100 } 101 return copiedInvocations 102 } 103 104 func (fake *FakePluginMetadata) recordInvocation(key string, args []interface{}) { 105 fake.invocationsMutex.Lock() 106 defer fake.invocationsMutex.Unlock() 107 if fake.invocations == nil { 108 fake.invocations = map[string][][]interface{}{} 109 } 110 if fake.invocations[key] == nil { 111 fake.invocations[key] = [][]interface{}{} 112 } 113 fake.invocations[key] = append(fake.invocations[key], args) 114 } 115 116 var _ pluginaction.PluginMetadata = new(FakePluginMetadata)