github.com/cloudfoundry-incubator/stembuild@v0.0.0-20211223202937-5b61d62226c6/commandparser/commandparserfakes/fake_vmpreparer_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/construct/config" 9 ) 10 11 type FakeVMPreparerFactory struct { 12 VMPreparerStub func(config.SourceConfig, commandparser.VCenterManager) (commandparser.VmConstruct, error) 13 vMPreparerMutex sync.RWMutex 14 vMPreparerArgsForCall []struct { 15 arg1 config.SourceConfig 16 arg2 commandparser.VCenterManager 17 } 18 vMPreparerReturns struct { 19 result1 commandparser.VmConstruct 20 result2 error 21 } 22 vMPreparerReturnsOnCall map[int]struct { 23 result1 commandparser.VmConstruct 24 result2 error 25 } 26 invocations map[string][][]interface{} 27 invocationsMutex sync.RWMutex 28 } 29 30 func (fake *FakeVMPreparerFactory) VMPreparer(arg1 config.SourceConfig, arg2 commandparser.VCenterManager) (commandparser.VmConstruct, error) { 31 fake.vMPreparerMutex.Lock() 32 ret, specificReturn := fake.vMPreparerReturnsOnCall[len(fake.vMPreparerArgsForCall)] 33 fake.vMPreparerArgsForCall = append(fake.vMPreparerArgsForCall, struct { 34 arg1 config.SourceConfig 35 arg2 commandparser.VCenterManager 36 }{arg1, arg2}) 37 fake.recordInvocation("VMPreparer", []interface{}{arg1, arg2}) 38 fake.vMPreparerMutex.Unlock() 39 if fake.VMPreparerStub != nil { 40 return fake.VMPreparerStub(arg1, arg2) 41 } 42 if specificReturn { 43 return ret.result1, ret.result2 44 } 45 fakeReturns := fake.vMPreparerReturns 46 return fakeReturns.result1, fakeReturns.result2 47 } 48 49 func (fake *FakeVMPreparerFactory) VMPreparerCallCount() int { 50 fake.vMPreparerMutex.RLock() 51 defer fake.vMPreparerMutex.RUnlock() 52 return len(fake.vMPreparerArgsForCall) 53 } 54 55 func (fake *FakeVMPreparerFactory) VMPreparerCalls(stub func(config.SourceConfig, commandparser.VCenterManager) (commandparser.VmConstruct, error)) { 56 fake.vMPreparerMutex.Lock() 57 defer fake.vMPreparerMutex.Unlock() 58 fake.VMPreparerStub = stub 59 } 60 61 func (fake *FakeVMPreparerFactory) VMPreparerArgsForCall(i int) (config.SourceConfig, commandparser.VCenterManager) { 62 fake.vMPreparerMutex.RLock() 63 defer fake.vMPreparerMutex.RUnlock() 64 argsForCall := fake.vMPreparerArgsForCall[i] 65 return argsForCall.arg1, argsForCall.arg2 66 } 67 68 func (fake *FakeVMPreparerFactory) VMPreparerReturns(result1 commandparser.VmConstruct, result2 error) { 69 fake.vMPreparerMutex.Lock() 70 defer fake.vMPreparerMutex.Unlock() 71 fake.VMPreparerStub = nil 72 fake.vMPreparerReturns = struct { 73 result1 commandparser.VmConstruct 74 result2 error 75 }{result1, result2} 76 } 77 78 func (fake *FakeVMPreparerFactory) VMPreparerReturnsOnCall(i int, result1 commandparser.VmConstruct, result2 error) { 79 fake.vMPreparerMutex.Lock() 80 defer fake.vMPreparerMutex.Unlock() 81 fake.VMPreparerStub = nil 82 if fake.vMPreparerReturnsOnCall == nil { 83 fake.vMPreparerReturnsOnCall = make(map[int]struct { 84 result1 commandparser.VmConstruct 85 result2 error 86 }) 87 } 88 fake.vMPreparerReturnsOnCall[i] = struct { 89 result1 commandparser.VmConstruct 90 result2 error 91 }{result1, result2} 92 } 93 94 func (fake *FakeVMPreparerFactory) Invocations() map[string][][]interface{} { 95 fake.invocationsMutex.RLock() 96 defer fake.invocationsMutex.RUnlock() 97 fake.vMPreparerMutex.RLock() 98 defer fake.vMPreparerMutex.RUnlock() 99 copiedInvocations := map[string][][]interface{}{} 100 for key, value := range fake.invocations { 101 copiedInvocations[key] = value 102 } 103 return copiedInvocations 104 } 105 106 func (fake *FakeVMPreparerFactory) recordInvocation(key string, args []interface{}) { 107 fake.invocationsMutex.Lock() 108 defer fake.invocationsMutex.Unlock() 109 if fake.invocations == nil { 110 fake.invocations = map[string][][]interface{}{} 111 } 112 if fake.invocations[key] == nil { 113 fake.invocations[key] = [][]interface{}{} 114 } 115 fake.invocations[key] = append(fake.invocations[key], args) 116 } 117 118 var _ commandparser.VMPreparerFactory = new(FakeVMPreparerFactory)