github.com/kaituanwang/hyperledger@v2.0.1+incompatible/core/container/dockercontroller/mock/platform_builder.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package mock 3 4 import ( 5 "io" 6 "sync" 7 ) 8 9 type PlatformBuilder struct { 10 GenerateDockerBuildStub func(string, string, io.Reader) (io.Reader, error) 11 generateDockerBuildMutex sync.RWMutex 12 generateDockerBuildArgsForCall []struct { 13 arg1 string 14 arg2 string 15 arg3 io.Reader 16 } 17 generateDockerBuildReturns struct { 18 result1 io.Reader 19 result2 error 20 } 21 generateDockerBuildReturnsOnCall map[int]struct { 22 result1 io.Reader 23 result2 error 24 } 25 invocations map[string][][]interface{} 26 invocationsMutex sync.RWMutex 27 } 28 29 func (fake *PlatformBuilder) GenerateDockerBuild(arg1 string, arg2 string, arg3 io.Reader) (io.Reader, error) { 30 fake.generateDockerBuildMutex.Lock() 31 ret, specificReturn := fake.generateDockerBuildReturnsOnCall[len(fake.generateDockerBuildArgsForCall)] 32 fake.generateDockerBuildArgsForCall = append(fake.generateDockerBuildArgsForCall, struct { 33 arg1 string 34 arg2 string 35 arg3 io.Reader 36 }{arg1, arg2, arg3}) 37 fake.recordInvocation("GenerateDockerBuild", []interface{}{arg1, arg2, arg3}) 38 fake.generateDockerBuildMutex.Unlock() 39 if fake.GenerateDockerBuildStub != nil { 40 return fake.GenerateDockerBuildStub(arg1, arg2, arg3) 41 } 42 if specificReturn { 43 return ret.result1, ret.result2 44 } 45 fakeReturns := fake.generateDockerBuildReturns 46 return fakeReturns.result1, fakeReturns.result2 47 } 48 49 func (fake *PlatformBuilder) GenerateDockerBuildCallCount() int { 50 fake.generateDockerBuildMutex.RLock() 51 defer fake.generateDockerBuildMutex.RUnlock() 52 return len(fake.generateDockerBuildArgsForCall) 53 } 54 55 func (fake *PlatformBuilder) GenerateDockerBuildCalls(stub func(string, string, io.Reader) (io.Reader, error)) { 56 fake.generateDockerBuildMutex.Lock() 57 defer fake.generateDockerBuildMutex.Unlock() 58 fake.GenerateDockerBuildStub = stub 59 } 60 61 func (fake *PlatformBuilder) GenerateDockerBuildArgsForCall(i int) (string, string, io.Reader) { 62 fake.generateDockerBuildMutex.RLock() 63 defer fake.generateDockerBuildMutex.RUnlock() 64 argsForCall := fake.generateDockerBuildArgsForCall[i] 65 return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 66 } 67 68 func (fake *PlatformBuilder) GenerateDockerBuildReturns(result1 io.Reader, result2 error) { 69 fake.generateDockerBuildMutex.Lock() 70 defer fake.generateDockerBuildMutex.Unlock() 71 fake.GenerateDockerBuildStub = nil 72 fake.generateDockerBuildReturns = struct { 73 result1 io.Reader 74 result2 error 75 }{result1, result2} 76 } 77 78 func (fake *PlatformBuilder) GenerateDockerBuildReturnsOnCall(i int, result1 io.Reader, result2 error) { 79 fake.generateDockerBuildMutex.Lock() 80 defer fake.generateDockerBuildMutex.Unlock() 81 fake.GenerateDockerBuildStub = nil 82 if fake.generateDockerBuildReturnsOnCall == nil { 83 fake.generateDockerBuildReturnsOnCall = make(map[int]struct { 84 result1 io.Reader 85 result2 error 86 }) 87 } 88 fake.generateDockerBuildReturnsOnCall[i] = struct { 89 result1 io.Reader 90 result2 error 91 }{result1, result2} 92 } 93 94 func (fake *PlatformBuilder) Invocations() map[string][][]interface{} { 95 fake.invocationsMutex.RLock() 96 defer fake.invocationsMutex.RUnlock() 97 fake.generateDockerBuildMutex.RLock() 98 defer fake.generateDockerBuildMutex.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 *PlatformBuilder) 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 }