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