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