github.com/yacovm/fabric@v2.0.0-alpha.0.20191128145320-c5d4087dc723+incompatible/core/scc/lscc/mock/chaincode_builder.go (about)

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