github.com/true-sqn/fabric@v2.1.1+incompatible/core/container/mock/docker_builder.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package mock
     3  
     4  import (
     5  	"io"
     6  	"sync"
     7  
     8  	"github.com/hyperledger/fabric/core/chaincode/persistence"
     9  	"github.com/hyperledger/fabric/core/container"
    10  )
    11  
    12  type DockerBuilder struct {
    13  	BuildStub        func(string, *persistence.ChaincodePackageMetadata, io.Reader) (container.Instance, error)
    14  	buildMutex       sync.RWMutex
    15  	buildArgsForCall []struct {
    16  		arg1 string
    17  		arg2 *persistence.ChaincodePackageMetadata
    18  		arg3 io.Reader
    19  	}
    20  	buildReturns struct {
    21  		result1 container.Instance
    22  		result2 error
    23  	}
    24  	buildReturnsOnCall map[int]struct {
    25  		result1 container.Instance
    26  		result2 error
    27  	}
    28  	invocations      map[string][][]interface{}
    29  	invocationsMutex sync.RWMutex
    30  }
    31  
    32  func (fake *DockerBuilder) Build(arg1 string, arg2 *persistence.ChaincodePackageMetadata, arg3 io.Reader) (container.Instance, error) {
    33  	fake.buildMutex.Lock()
    34  	ret, specificReturn := fake.buildReturnsOnCall[len(fake.buildArgsForCall)]
    35  	fake.buildArgsForCall = append(fake.buildArgsForCall, struct {
    36  		arg1 string
    37  		arg2 *persistence.ChaincodePackageMetadata
    38  		arg3 io.Reader
    39  	}{arg1, arg2, arg3})
    40  	fake.recordInvocation("Build", []interface{}{arg1, arg2, arg3})
    41  	fake.buildMutex.Unlock()
    42  	if fake.BuildStub != nil {
    43  		return fake.BuildStub(arg1, arg2, arg3)
    44  	}
    45  	if specificReturn {
    46  		return ret.result1, ret.result2
    47  	}
    48  	fakeReturns := fake.buildReturns
    49  	return fakeReturns.result1, fakeReturns.result2
    50  }
    51  
    52  func (fake *DockerBuilder) BuildCallCount() int {
    53  	fake.buildMutex.RLock()
    54  	defer fake.buildMutex.RUnlock()
    55  	return len(fake.buildArgsForCall)
    56  }
    57  
    58  func (fake *DockerBuilder) BuildCalls(stub func(string, *persistence.ChaincodePackageMetadata, io.Reader) (container.Instance, error)) {
    59  	fake.buildMutex.Lock()
    60  	defer fake.buildMutex.Unlock()
    61  	fake.BuildStub = stub
    62  }
    63  
    64  func (fake *DockerBuilder) BuildArgsForCall(i int) (string, *persistence.ChaincodePackageMetadata, io.Reader) {
    65  	fake.buildMutex.RLock()
    66  	defer fake.buildMutex.RUnlock()
    67  	argsForCall := fake.buildArgsForCall[i]
    68  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
    69  }
    70  
    71  func (fake *DockerBuilder) BuildReturns(result1 container.Instance, result2 error) {
    72  	fake.buildMutex.Lock()
    73  	defer fake.buildMutex.Unlock()
    74  	fake.BuildStub = nil
    75  	fake.buildReturns = struct {
    76  		result1 container.Instance
    77  		result2 error
    78  	}{result1, result2}
    79  }
    80  
    81  func (fake *DockerBuilder) BuildReturnsOnCall(i int, result1 container.Instance, result2 error) {
    82  	fake.buildMutex.Lock()
    83  	defer fake.buildMutex.Unlock()
    84  	fake.BuildStub = nil
    85  	if fake.buildReturnsOnCall == nil {
    86  		fake.buildReturnsOnCall = make(map[int]struct {
    87  			result1 container.Instance
    88  			result2 error
    89  		})
    90  	}
    91  	fake.buildReturnsOnCall[i] = struct {
    92  		result1 container.Instance
    93  		result2 error
    94  	}{result1, result2}
    95  }
    96  
    97  func (fake *DockerBuilder) Invocations() map[string][][]interface{} {
    98  	fake.invocationsMutex.RLock()
    99  	defer fake.invocationsMutex.RUnlock()
   100  	fake.buildMutex.RLock()
   101  	defer fake.buildMutex.RUnlock()
   102  	copiedInvocations := map[string][][]interface{}{}
   103  	for key, value := range fake.invocations {
   104  		copiedInvocations[key] = value
   105  	}
   106  	return copiedInvocations
   107  }
   108  
   109  func (fake *DockerBuilder) recordInvocation(key string, args []interface{}) {
   110  	fake.invocationsMutex.Lock()
   111  	defer fake.invocationsMutex.Unlock()
   112  	if fake.invocations == nil {
   113  		fake.invocations = map[string][][]interface{}{}
   114  	}
   115  	if fake.invocations[key] == nil {
   116  		fake.invocations[key] = [][]interface{}{}
   117  	}
   118  	fake.invocations[key] = append(fake.invocations[key], args)
   119  }
   120  
   121  var _ container.DockerBuilder = new(DockerBuilder)