github.com/true-sqn/fabric@v2.1.1+incompatible/core/container/mock/package_provider.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 PackageProvider struct {
    13  	GetChaincodePackageStub        func(string) (*persistence.ChaincodePackageMetadata, []byte, io.ReadCloser, error)
    14  	getChaincodePackageMutex       sync.RWMutex
    15  	getChaincodePackageArgsForCall []struct {
    16  		arg1 string
    17  	}
    18  	getChaincodePackageReturns struct {
    19  		result1 *persistence.ChaincodePackageMetadata
    20  		result2 []byte
    21  		result3 io.ReadCloser
    22  		result4 error
    23  	}
    24  	getChaincodePackageReturnsOnCall map[int]struct {
    25  		result1 *persistence.ChaincodePackageMetadata
    26  		result2 []byte
    27  		result3 io.ReadCloser
    28  		result4 error
    29  	}
    30  	invocations      map[string][][]interface{}
    31  	invocationsMutex sync.RWMutex
    32  }
    33  
    34  func (fake *PackageProvider) GetChaincodePackage(arg1 string) (*persistence.ChaincodePackageMetadata, []byte, io.ReadCloser, error) {
    35  	fake.getChaincodePackageMutex.Lock()
    36  	ret, specificReturn := fake.getChaincodePackageReturnsOnCall[len(fake.getChaincodePackageArgsForCall)]
    37  	fake.getChaincodePackageArgsForCall = append(fake.getChaincodePackageArgsForCall, struct {
    38  		arg1 string
    39  	}{arg1})
    40  	fake.recordInvocation("GetChaincodePackage", []interface{}{arg1})
    41  	fake.getChaincodePackageMutex.Unlock()
    42  	if fake.GetChaincodePackageStub != nil {
    43  		return fake.GetChaincodePackageStub(arg1)
    44  	}
    45  	if specificReturn {
    46  		return ret.result1, ret.result2, ret.result3, ret.result4
    47  	}
    48  	fakeReturns := fake.getChaincodePackageReturns
    49  	return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3, fakeReturns.result4
    50  }
    51  
    52  func (fake *PackageProvider) GetChaincodePackageCallCount() int {
    53  	fake.getChaincodePackageMutex.RLock()
    54  	defer fake.getChaincodePackageMutex.RUnlock()
    55  	return len(fake.getChaincodePackageArgsForCall)
    56  }
    57  
    58  func (fake *PackageProvider) GetChaincodePackageCalls(stub func(string) (*persistence.ChaincodePackageMetadata, []byte, io.ReadCloser, error)) {
    59  	fake.getChaincodePackageMutex.Lock()
    60  	defer fake.getChaincodePackageMutex.Unlock()
    61  	fake.GetChaincodePackageStub = stub
    62  }
    63  
    64  func (fake *PackageProvider) GetChaincodePackageArgsForCall(i int) string {
    65  	fake.getChaincodePackageMutex.RLock()
    66  	defer fake.getChaincodePackageMutex.RUnlock()
    67  	argsForCall := fake.getChaincodePackageArgsForCall[i]
    68  	return argsForCall.arg1
    69  }
    70  
    71  func (fake *PackageProvider) GetChaincodePackageReturns(result1 *persistence.ChaincodePackageMetadata, result2 []byte, result3 io.ReadCloser, result4 error) {
    72  	fake.getChaincodePackageMutex.Lock()
    73  	defer fake.getChaincodePackageMutex.Unlock()
    74  	fake.GetChaincodePackageStub = nil
    75  	fake.getChaincodePackageReturns = struct {
    76  		result1 *persistence.ChaincodePackageMetadata
    77  		result2 []byte
    78  		result3 io.ReadCloser
    79  		result4 error
    80  	}{result1, result2, result3, result4}
    81  }
    82  
    83  func (fake *PackageProvider) GetChaincodePackageReturnsOnCall(i int, result1 *persistence.ChaincodePackageMetadata, result2 []byte, result3 io.ReadCloser, result4 error) {
    84  	fake.getChaincodePackageMutex.Lock()
    85  	defer fake.getChaincodePackageMutex.Unlock()
    86  	fake.GetChaincodePackageStub = nil
    87  	if fake.getChaincodePackageReturnsOnCall == nil {
    88  		fake.getChaincodePackageReturnsOnCall = make(map[int]struct {
    89  			result1 *persistence.ChaincodePackageMetadata
    90  			result2 []byte
    91  			result3 io.ReadCloser
    92  			result4 error
    93  		})
    94  	}
    95  	fake.getChaincodePackageReturnsOnCall[i] = struct {
    96  		result1 *persistence.ChaincodePackageMetadata
    97  		result2 []byte
    98  		result3 io.ReadCloser
    99  		result4 error
   100  	}{result1, result2, result3, result4}
   101  }
   102  
   103  func (fake *PackageProvider) Invocations() map[string][][]interface{} {
   104  	fake.invocationsMutex.RLock()
   105  	defer fake.invocationsMutex.RUnlock()
   106  	fake.getChaincodePackageMutex.RLock()
   107  	defer fake.getChaincodePackageMutex.RUnlock()
   108  	copiedInvocations := map[string][][]interface{}{}
   109  	for key, value := range fake.invocations {
   110  		copiedInvocations[key] = value
   111  	}
   112  	return copiedInvocations
   113  }
   114  
   115  func (fake *PackageProvider) recordInvocation(key string, args []interface{}) {
   116  	fake.invocationsMutex.Lock()
   117  	defer fake.invocationsMutex.Unlock()
   118  	if fake.invocations == nil {
   119  		fake.invocations = map[string][][]interface{}{}
   120  	}
   121  	if fake.invocations[key] == nil {
   122  		fake.invocations[key] = [][]interface{}{}
   123  	}
   124  	fake.invocations[key] = append(fake.invocations[key], args)
   125  }
   126  
   127  var _ container.PackageProvider = new(PackageProvider)