github.com/jasonkeene/cli@v6.14.1-0.20160816203908-ca5715166dfb+incompatible/cf/api/securitygroups/defaults/running/runningfakes/fake_security_groups_repo.go (about) 1 // This file was generated by counterfeiter 2 package runningfakes 3 4 import ( 5 "sync" 6 7 . "github.com/cloudfoundry/cli/cf/api/securitygroups/defaults" 8 "github.com/cloudfoundry/cli/cf/api/securitygroups/defaults/running" 9 "github.com/cloudfoundry/cli/cf/models" 10 ) 11 12 type FakeSecurityGroupsRepo struct { 13 BindToRunningSetStub func(string) error 14 bindToRunningSetMutex sync.RWMutex 15 bindToRunningSetArgsForCall []struct { 16 arg1 string 17 } 18 bindToRunningSetReturns struct { 19 result1 error 20 } 21 ListStub func() ([]models.SecurityGroupFields, error) 22 listMutex sync.RWMutex 23 listArgsForCall []struct{} 24 listReturns struct { 25 result1 []models.SecurityGroupFields 26 result2 error 27 } 28 UnbindFromRunningSetStub func(string) error 29 unbindFromRunningSetMutex sync.RWMutex 30 unbindFromRunningSetArgsForCall []struct { 31 arg1 string 32 } 33 unbindFromRunningSetReturns struct { 34 result1 error 35 } 36 invocations map[string][][]interface{} 37 invocationsMutex sync.RWMutex 38 } 39 40 func (fake *FakeSecurityGroupsRepo) BindToRunningSet(arg1 string) error { 41 fake.bindToRunningSetMutex.Lock() 42 fake.bindToRunningSetArgsForCall = append(fake.bindToRunningSetArgsForCall, struct { 43 arg1 string 44 }{arg1}) 45 fake.recordInvocation("BindToRunningSet", []interface{}{arg1}) 46 fake.bindToRunningSetMutex.Unlock() 47 if fake.BindToRunningSetStub != nil { 48 return fake.BindToRunningSetStub(arg1) 49 } else { 50 return fake.bindToRunningSetReturns.result1 51 } 52 } 53 54 func (fake *FakeSecurityGroupsRepo) BindToRunningSetCallCount() int { 55 fake.bindToRunningSetMutex.RLock() 56 defer fake.bindToRunningSetMutex.RUnlock() 57 return len(fake.bindToRunningSetArgsForCall) 58 } 59 60 func (fake *FakeSecurityGroupsRepo) BindToRunningSetArgsForCall(i int) string { 61 fake.bindToRunningSetMutex.RLock() 62 defer fake.bindToRunningSetMutex.RUnlock() 63 return fake.bindToRunningSetArgsForCall[i].arg1 64 } 65 66 func (fake *FakeSecurityGroupsRepo) BindToRunningSetReturns(result1 error) { 67 fake.BindToRunningSetStub = nil 68 fake.bindToRunningSetReturns = struct { 69 result1 error 70 }{result1} 71 } 72 73 func (fake *FakeSecurityGroupsRepo) List() ([]models.SecurityGroupFields, error) { 74 fake.listMutex.Lock() 75 fake.listArgsForCall = append(fake.listArgsForCall, struct{}{}) 76 fake.recordInvocation("List", []interface{}{}) 77 fake.listMutex.Unlock() 78 if fake.ListStub != nil { 79 return fake.ListStub() 80 } else { 81 return fake.listReturns.result1, fake.listReturns.result2 82 } 83 } 84 85 func (fake *FakeSecurityGroupsRepo) ListCallCount() int { 86 fake.listMutex.RLock() 87 defer fake.listMutex.RUnlock() 88 return len(fake.listArgsForCall) 89 } 90 91 func (fake *FakeSecurityGroupsRepo) ListReturns(result1 []models.SecurityGroupFields, result2 error) { 92 fake.ListStub = nil 93 fake.listReturns = struct { 94 result1 []models.SecurityGroupFields 95 result2 error 96 }{result1, result2} 97 } 98 99 func (fake *FakeSecurityGroupsRepo) UnbindFromRunningSet(arg1 string) error { 100 fake.unbindFromRunningSetMutex.Lock() 101 fake.unbindFromRunningSetArgsForCall = append(fake.unbindFromRunningSetArgsForCall, struct { 102 arg1 string 103 }{arg1}) 104 fake.recordInvocation("UnbindFromRunningSet", []interface{}{arg1}) 105 fake.unbindFromRunningSetMutex.Unlock() 106 if fake.UnbindFromRunningSetStub != nil { 107 return fake.UnbindFromRunningSetStub(arg1) 108 } else { 109 return fake.unbindFromRunningSetReturns.result1 110 } 111 } 112 113 func (fake *FakeSecurityGroupsRepo) UnbindFromRunningSetCallCount() int { 114 fake.unbindFromRunningSetMutex.RLock() 115 defer fake.unbindFromRunningSetMutex.RUnlock() 116 return len(fake.unbindFromRunningSetArgsForCall) 117 } 118 119 func (fake *FakeSecurityGroupsRepo) UnbindFromRunningSetArgsForCall(i int) string { 120 fake.unbindFromRunningSetMutex.RLock() 121 defer fake.unbindFromRunningSetMutex.RUnlock() 122 return fake.unbindFromRunningSetArgsForCall[i].arg1 123 } 124 125 func (fake *FakeSecurityGroupsRepo) UnbindFromRunningSetReturns(result1 error) { 126 fake.UnbindFromRunningSetStub = nil 127 fake.unbindFromRunningSetReturns = struct { 128 result1 error 129 }{result1} 130 } 131 132 func (fake *FakeSecurityGroupsRepo) Invocations() map[string][][]interface{} { 133 fake.invocationsMutex.RLock() 134 defer fake.invocationsMutex.RUnlock() 135 fake.bindToRunningSetMutex.RLock() 136 defer fake.bindToRunningSetMutex.RUnlock() 137 fake.listMutex.RLock() 138 defer fake.listMutex.RUnlock() 139 fake.unbindFromRunningSetMutex.RLock() 140 defer fake.unbindFromRunningSetMutex.RUnlock() 141 return fake.invocations 142 } 143 144 func (fake *FakeSecurityGroupsRepo) recordInvocation(key string, args []interface{}) { 145 fake.invocationsMutex.Lock() 146 defer fake.invocationsMutex.Unlock() 147 if fake.invocations == nil { 148 fake.invocations = map[string][][]interface{}{} 149 } 150 if fake.invocations[key] == nil { 151 fake.invocations[key] = [][]interface{}{} 152 } 153 fake.invocations[key] = append(fake.invocations[key], args) 154 } 155 156 var _ running.SecurityGroupsRepo = new(FakeSecurityGroupsRepo)