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

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