github.com/cloudfoundry-incubator/stembuild@v0.0.0-20211223202937-5b61d62226c6/commandparser/commandparserfakes/fake_packager_factory.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package commandparserfakes 3 4 import ( 5 "sync" 6 7 "github.com/cloudfoundry-incubator/stembuild/commandparser" 8 "github.com/cloudfoundry-incubator/stembuild/package_stemcell/config" 9 ) 10 11 type FakePackagerFactory struct { 12 PackagerStub func(config.SourceConfig, config.OutputConfig, int, bool) (commandparser.Packager, error) 13 packagerMutex sync.RWMutex 14 packagerArgsForCall []struct { 15 arg1 config.SourceConfig 16 arg2 config.OutputConfig 17 arg3 int 18 arg4 bool 19 } 20 packagerReturns struct { 21 result1 commandparser.Packager 22 result2 error 23 } 24 packagerReturnsOnCall map[int]struct { 25 result1 commandparser.Packager 26 result2 error 27 } 28 invocations map[string][][]interface{} 29 invocationsMutex sync.RWMutex 30 } 31 32 func (fake *FakePackagerFactory) Packager(arg1 config.SourceConfig, arg2 config.OutputConfig, arg3 int, arg4 bool) (commandparser.Packager, error) { 33 fake.packagerMutex.Lock() 34 ret, specificReturn := fake.packagerReturnsOnCall[len(fake.packagerArgsForCall)] 35 fake.packagerArgsForCall = append(fake.packagerArgsForCall, struct { 36 arg1 config.SourceConfig 37 arg2 config.OutputConfig 38 arg3 int 39 arg4 bool 40 }{arg1, arg2, arg3, arg4}) 41 fake.recordInvocation("Packager", []interface{}{arg1, arg2, arg3, arg4}) 42 fake.packagerMutex.Unlock() 43 if fake.PackagerStub != nil { 44 return fake.PackagerStub(arg1, arg2, arg3, arg4) 45 } 46 if specificReturn { 47 return ret.result1, ret.result2 48 } 49 fakeReturns := fake.packagerReturns 50 return fakeReturns.result1, fakeReturns.result2 51 } 52 53 func (fake *FakePackagerFactory) PackagerCallCount() int { 54 fake.packagerMutex.RLock() 55 defer fake.packagerMutex.RUnlock() 56 return len(fake.packagerArgsForCall) 57 } 58 59 func (fake *FakePackagerFactory) PackagerCalls(stub func(config.SourceConfig, config.OutputConfig, int, bool) (commandparser.Packager, error)) { 60 fake.packagerMutex.Lock() 61 defer fake.packagerMutex.Unlock() 62 fake.PackagerStub = stub 63 } 64 65 func (fake *FakePackagerFactory) PackagerArgsForCall(i int) (config.SourceConfig, config.OutputConfig, int, bool) { 66 fake.packagerMutex.RLock() 67 defer fake.packagerMutex.RUnlock() 68 argsForCall := fake.packagerArgsForCall[i] 69 return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4 70 } 71 72 func (fake *FakePackagerFactory) PackagerReturns(result1 commandparser.Packager, result2 error) { 73 fake.packagerMutex.Lock() 74 defer fake.packagerMutex.Unlock() 75 fake.PackagerStub = nil 76 fake.packagerReturns = struct { 77 result1 commandparser.Packager 78 result2 error 79 }{result1, result2} 80 } 81 82 func (fake *FakePackagerFactory) PackagerReturnsOnCall(i int, result1 commandparser.Packager, result2 error) { 83 fake.packagerMutex.Lock() 84 defer fake.packagerMutex.Unlock() 85 fake.PackagerStub = nil 86 if fake.packagerReturnsOnCall == nil { 87 fake.packagerReturnsOnCall = make(map[int]struct { 88 result1 commandparser.Packager 89 result2 error 90 }) 91 } 92 fake.packagerReturnsOnCall[i] = struct { 93 result1 commandparser.Packager 94 result2 error 95 }{result1, result2} 96 } 97 98 func (fake *FakePackagerFactory) Invocations() map[string][][]interface{} { 99 fake.invocationsMutex.RLock() 100 defer fake.invocationsMutex.RUnlock() 101 fake.packagerMutex.RLock() 102 defer fake.packagerMutex.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 *FakePackagerFactory) 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 _ commandparser.PackagerFactory = new(FakePackagerFactory)