github.com/hyperledger-labs/bdls@v2.1.1+incompatible/core/chaincode/lifecycle/mock/chaincode_builder.go (about)

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