github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/cf/actors/pluginrepo/pluginrepofakes/fake_plugin_repo.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package pluginrepofakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/actors/pluginrepo" 8 "code.cloudfoundry.org/cli/cf/models" 9 "code.cloudfoundry.org/cli-plugin-repo/web" 10 ) 11 12 type FakePluginRepo struct { 13 GetPluginsStub func([]models.PluginRepo) (map[string][]web.Plugin, []string) 14 getPluginsMutex sync.RWMutex 15 getPluginsArgsForCall []struct { 16 arg1 []models.PluginRepo 17 } 18 getPluginsReturns struct { 19 result1 map[string][]web.Plugin 20 result2 []string 21 } 22 getPluginsReturnsOnCall map[int]struct { 23 result1 map[string][]web.Plugin 24 result2 []string 25 } 26 invocations map[string][][]interface{} 27 invocationsMutex sync.RWMutex 28 } 29 30 func (fake *FakePluginRepo) GetPlugins(arg1 []models.PluginRepo) (map[string][]web.Plugin, []string) { 31 var arg1Copy []models.PluginRepo 32 if arg1 != nil { 33 arg1Copy = make([]models.PluginRepo, len(arg1)) 34 copy(arg1Copy, arg1) 35 } 36 fake.getPluginsMutex.Lock() 37 ret, specificReturn := fake.getPluginsReturnsOnCall[len(fake.getPluginsArgsForCall)] 38 fake.getPluginsArgsForCall = append(fake.getPluginsArgsForCall, struct { 39 arg1 []models.PluginRepo 40 }{arg1Copy}) 41 fake.recordInvocation("GetPlugins", []interface{}{arg1Copy}) 42 fake.getPluginsMutex.Unlock() 43 if fake.GetPluginsStub != nil { 44 return fake.GetPluginsStub(arg1) 45 } 46 if specificReturn { 47 return ret.result1, ret.result2 48 } 49 fakeReturns := fake.getPluginsReturns 50 return fakeReturns.result1, fakeReturns.result2 51 } 52 53 func (fake *FakePluginRepo) GetPluginsCallCount() int { 54 fake.getPluginsMutex.RLock() 55 defer fake.getPluginsMutex.RUnlock() 56 return len(fake.getPluginsArgsForCall) 57 } 58 59 func (fake *FakePluginRepo) GetPluginsCalls(stub func([]models.PluginRepo) (map[string][]web.Plugin, []string)) { 60 fake.getPluginsMutex.Lock() 61 defer fake.getPluginsMutex.Unlock() 62 fake.GetPluginsStub = stub 63 } 64 65 func (fake *FakePluginRepo) GetPluginsArgsForCall(i int) []models.PluginRepo { 66 fake.getPluginsMutex.RLock() 67 defer fake.getPluginsMutex.RUnlock() 68 argsForCall := fake.getPluginsArgsForCall[i] 69 return argsForCall.arg1 70 } 71 72 func (fake *FakePluginRepo) GetPluginsReturns(result1 map[string][]web.Plugin, result2 []string) { 73 fake.getPluginsMutex.Lock() 74 defer fake.getPluginsMutex.Unlock() 75 fake.GetPluginsStub = nil 76 fake.getPluginsReturns = struct { 77 result1 map[string][]web.Plugin 78 result2 []string 79 }{result1, result2} 80 } 81 82 func (fake *FakePluginRepo) GetPluginsReturnsOnCall(i int, result1 map[string][]web.Plugin, result2 []string) { 83 fake.getPluginsMutex.Lock() 84 defer fake.getPluginsMutex.Unlock() 85 fake.GetPluginsStub = nil 86 if fake.getPluginsReturnsOnCall == nil { 87 fake.getPluginsReturnsOnCall = make(map[int]struct { 88 result1 map[string][]web.Plugin 89 result2 []string 90 }) 91 } 92 fake.getPluginsReturnsOnCall[i] = struct { 93 result1 map[string][]web.Plugin 94 result2 []string 95 }{result1, result2} 96 } 97 98 func (fake *FakePluginRepo) Invocations() map[string][][]interface{} { 99 fake.invocationsMutex.RLock() 100 defer fake.invocationsMutex.RUnlock() 101 fake.getPluginsMutex.RLock() 102 defer fake.getPluginsMutex.RUnlock() 103 copiedInvocations := map[string][][]interface{}{} 104 for key, value := range fake.invocations { 105 copiedInvocations[key] = value 106 } 107 return copiedInvocations 108 } 109 110 func (fake *FakePluginRepo) recordInvocation(key string, args []interface{}) { 111 fake.invocationsMutex.Lock() 112 defer fake.invocationsMutex.Unlock() 113 if fake.invocations == nil { 114 fake.invocations = map[string][][]interface{}{} 115 } 116 if fake.invocations[key] == nil { 117 fake.invocations[key] = [][]interface{}{} 118 } 119 fake.invocations[key] = append(fake.invocations[key], args) 120 } 121 122 var _ pluginrepo.PluginRepo = new(FakePluginRepo)