github.com/true-sqn/fabric@v2.1.1+incompatible/core/common/privdata/mock/chaincode_info_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-protos-go/peer"
     8  	"github.com/hyperledger/fabric/core/ledger"
     9  )
    10  
    11  type ChaincodeInfoProvider struct {
    12  	AllCollectionsConfigPkgStub        func(string, string, ledger.SimpleQueryExecutor) (*peer.CollectionConfigPackage, error)
    13  	allCollectionsConfigPkgMutex       sync.RWMutex
    14  	allCollectionsConfigPkgArgsForCall []struct {
    15  		arg1 string
    16  		arg2 string
    17  		arg3 ledger.SimpleQueryExecutor
    18  	}
    19  	allCollectionsConfigPkgReturns struct {
    20  		result1 *peer.CollectionConfigPackage
    21  		result2 error
    22  	}
    23  	allCollectionsConfigPkgReturnsOnCall map[int]struct {
    24  		result1 *peer.CollectionConfigPackage
    25  		result2 error
    26  	}
    27  	ChaincodeInfoStub        func(string, string, ledger.SimpleQueryExecutor) (*ledger.DeployedChaincodeInfo, error)
    28  	chaincodeInfoMutex       sync.RWMutex
    29  	chaincodeInfoArgsForCall []struct {
    30  		arg1 string
    31  		arg2 string
    32  		arg3 ledger.SimpleQueryExecutor
    33  	}
    34  	chaincodeInfoReturns struct {
    35  		result1 *ledger.DeployedChaincodeInfo
    36  		result2 error
    37  	}
    38  	chaincodeInfoReturnsOnCall map[int]struct {
    39  		result1 *ledger.DeployedChaincodeInfo
    40  		result2 error
    41  	}
    42  	CollectionInfoStub        func(string, string, string, ledger.SimpleQueryExecutor) (*peer.StaticCollectionConfig, error)
    43  	collectionInfoMutex       sync.RWMutex
    44  	collectionInfoArgsForCall []struct {
    45  		arg1 string
    46  		arg2 string
    47  		arg3 string
    48  		arg4 ledger.SimpleQueryExecutor
    49  	}
    50  	collectionInfoReturns struct {
    51  		result1 *peer.StaticCollectionConfig
    52  		result2 error
    53  	}
    54  	collectionInfoReturnsOnCall map[int]struct {
    55  		result1 *peer.StaticCollectionConfig
    56  		result2 error
    57  	}
    58  	invocations      map[string][][]interface{}
    59  	invocationsMutex sync.RWMutex
    60  }
    61  
    62  func (fake *ChaincodeInfoProvider) AllCollectionsConfigPkg(arg1 string, arg2 string, arg3 ledger.SimpleQueryExecutor) (*peer.CollectionConfigPackage, error) {
    63  	fake.allCollectionsConfigPkgMutex.Lock()
    64  	ret, specificReturn := fake.allCollectionsConfigPkgReturnsOnCall[len(fake.allCollectionsConfigPkgArgsForCall)]
    65  	fake.allCollectionsConfigPkgArgsForCall = append(fake.allCollectionsConfigPkgArgsForCall, struct {
    66  		arg1 string
    67  		arg2 string
    68  		arg3 ledger.SimpleQueryExecutor
    69  	}{arg1, arg2, arg3})
    70  	fake.recordInvocation("AllCollectionsConfigPkg", []interface{}{arg1, arg2, arg3})
    71  	fake.allCollectionsConfigPkgMutex.Unlock()
    72  	if fake.AllCollectionsConfigPkgStub != nil {
    73  		return fake.AllCollectionsConfigPkgStub(arg1, arg2, arg3)
    74  	}
    75  	if specificReturn {
    76  		return ret.result1, ret.result2
    77  	}
    78  	fakeReturns := fake.allCollectionsConfigPkgReturns
    79  	return fakeReturns.result1, fakeReturns.result2
    80  }
    81  
    82  func (fake *ChaincodeInfoProvider) AllCollectionsConfigPkgCallCount() int {
    83  	fake.allCollectionsConfigPkgMutex.RLock()
    84  	defer fake.allCollectionsConfigPkgMutex.RUnlock()
    85  	return len(fake.allCollectionsConfigPkgArgsForCall)
    86  }
    87  
    88  func (fake *ChaincodeInfoProvider) AllCollectionsConfigPkgCalls(stub func(string, string, ledger.SimpleQueryExecutor) (*peer.CollectionConfigPackage, error)) {
    89  	fake.allCollectionsConfigPkgMutex.Lock()
    90  	defer fake.allCollectionsConfigPkgMutex.Unlock()
    91  	fake.AllCollectionsConfigPkgStub = stub
    92  }
    93  
    94  func (fake *ChaincodeInfoProvider) AllCollectionsConfigPkgArgsForCall(i int) (string, string, ledger.SimpleQueryExecutor) {
    95  	fake.allCollectionsConfigPkgMutex.RLock()
    96  	defer fake.allCollectionsConfigPkgMutex.RUnlock()
    97  	argsForCall := fake.allCollectionsConfigPkgArgsForCall[i]
    98  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
    99  }
   100  
   101  func (fake *ChaincodeInfoProvider) AllCollectionsConfigPkgReturns(result1 *peer.CollectionConfigPackage, result2 error) {
   102  	fake.allCollectionsConfigPkgMutex.Lock()
   103  	defer fake.allCollectionsConfigPkgMutex.Unlock()
   104  	fake.AllCollectionsConfigPkgStub = nil
   105  	fake.allCollectionsConfigPkgReturns = struct {
   106  		result1 *peer.CollectionConfigPackage
   107  		result2 error
   108  	}{result1, result2}
   109  }
   110  
   111  func (fake *ChaincodeInfoProvider) AllCollectionsConfigPkgReturnsOnCall(i int, result1 *peer.CollectionConfigPackage, result2 error) {
   112  	fake.allCollectionsConfigPkgMutex.Lock()
   113  	defer fake.allCollectionsConfigPkgMutex.Unlock()
   114  	fake.AllCollectionsConfigPkgStub = nil
   115  	if fake.allCollectionsConfigPkgReturnsOnCall == nil {
   116  		fake.allCollectionsConfigPkgReturnsOnCall = make(map[int]struct {
   117  			result1 *peer.CollectionConfigPackage
   118  			result2 error
   119  		})
   120  	}
   121  	fake.allCollectionsConfigPkgReturnsOnCall[i] = struct {
   122  		result1 *peer.CollectionConfigPackage
   123  		result2 error
   124  	}{result1, result2}
   125  }
   126  
   127  func (fake *ChaincodeInfoProvider) ChaincodeInfo(arg1 string, arg2 string, arg3 ledger.SimpleQueryExecutor) (*ledger.DeployedChaincodeInfo, error) {
   128  	fake.chaincodeInfoMutex.Lock()
   129  	ret, specificReturn := fake.chaincodeInfoReturnsOnCall[len(fake.chaincodeInfoArgsForCall)]
   130  	fake.chaincodeInfoArgsForCall = append(fake.chaincodeInfoArgsForCall, struct {
   131  		arg1 string
   132  		arg2 string
   133  		arg3 ledger.SimpleQueryExecutor
   134  	}{arg1, arg2, arg3})
   135  	fake.recordInvocation("ChaincodeInfo", []interface{}{arg1, arg2, arg3})
   136  	fake.chaincodeInfoMutex.Unlock()
   137  	if fake.ChaincodeInfoStub != nil {
   138  		return fake.ChaincodeInfoStub(arg1, arg2, arg3)
   139  	}
   140  	if specificReturn {
   141  		return ret.result1, ret.result2
   142  	}
   143  	fakeReturns := fake.chaincodeInfoReturns
   144  	return fakeReturns.result1, fakeReturns.result2
   145  }
   146  
   147  func (fake *ChaincodeInfoProvider) ChaincodeInfoCallCount() int {
   148  	fake.chaincodeInfoMutex.RLock()
   149  	defer fake.chaincodeInfoMutex.RUnlock()
   150  	return len(fake.chaincodeInfoArgsForCall)
   151  }
   152  
   153  func (fake *ChaincodeInfoProvider) ChaincodeInfoCalls(stub func(string, string, ledger.SimpleQueryExecutor) (*ledger.DeployedChaincodeInfo, error)) {
   154  	fake.chaincodeInfoMutex.Lock()
   155  	defer fake.chaincodeInfoMutex.Unlock()
   156  	fake.ChaincodeInfoStub = stub
   157  }
   158  
   159  func (fake *ChaincodeInfoProvider) ChaincodeInfoArgsForCall(i int) (string, string, ledger.SimpleQueryExecutor) {
   160  	fake.chaincodeInfoMutex.RLock()
   161  	defer fake.chaincodeInfoMutex.RUnlock()
   162  	argsForCall := fake.chaincodeInfoArgsForCall[i]
   163  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
   164  }
   165  
   166  func (fake *ChaincodeInfoProvider) ChaincodeInfoReturns(result1 *ledger.DeployedChaincodeInfo, result2 error) {
   167  	fake.chaincodeInfoMutex.Lock()
   168  	defer fake.chaincodeInfoMutex.Unlock()
   169  	fake.ChaincodeInfoStub = nil
   170  	fake.chaincodeInfoReturns = struct {
   171  		result1 *ledger.DeployedChaincodeInfo
   172  		result2 error
   173  	}{result1, result2}
   174  }
   175  
   176  func (fake *ChaincodeInfoProvider) ChaincodeInfoReturnsOnCall(i int, result1 *ledger.DeployedChaincodeInfo, result2 error) {
   177  	fake.chaincodeInfoMutex.Lock()
   178  	defer fake.chaincodeInfoMutex.Unlock()
   179  	fake.ChaincodeInfoStub = nil
   180  	if fake.chaincodeInfoReturnsOnCall == nil {
   181  		fake.chaincodeInfoReturnsOnCall = make(map[int]struct {
   182  			result1 *ledger.DeployedChaincodeInfo
   183  			result2 error
   184  		})
   185  	}
   186  	fake.chaincodeInfoReturnsOnCall[i] = struct {
   187  		result1 *ledger.DeployedChaincodeInfo
   188  		result2 error
   189  	}{result1, result2}
   190  }
   191  
   192  func (fake *ChaincodeInfoProvider) CollectionInfo(arg1 string, arg2 string, arg3 string, arg4 ledger.SimpleQueryExecutor) (*peer.StaticCollectionConfig, error) {
   193  	fake.collectionInfoMutex.Lock()
   194  	ret, specificReturn := fake.collectionInfoReturnsOnCall[len(fake.collectionInfoArgsForCall)]
   195  	fake.collectionInfoArgsForCall = append(fake.collectionInfoArgsForCall, struct {
   196  		arg1 string
   197  		arg2 string
   198  		arg3 string
   199  		arg4 ledger.SimpleQueryExecutor
   200  	}{arg1, arg2, arg3, arg4})
   201  	fake.recordInvocation("CollectionInfo", []interface{}{arg1, arg2, arg3, arg4})
   202  	fake.collectionInfoMutex.Unlock()
   203  	if fake.CollectionInfoStub != nil {
   204  		return fake.CollectionInfoStub(arg1, arg2, arg3, arg4)
   205  	}
   206  	if specificReturn {
   207  		return ret.result1, ret.result2
   208  	}
   209  	fakeReturns := fake.collectionInfoReturns
   210  	return fakeReturns.result1, fakeReturns.result2
   211  }
   212  
   213  func (fake *ChaincodeInfoProvider) CollectionInfoCallCount() int {
   214  	fake.collectionInfoMutex.RLock()
   215  	defer fake.collectionInfoMutex.RUnlock()
   216  	return len(fake.collectionInfoArgsForCall)
   217  }
   218  
   219  func (fake *ChaincodeInfoProvider) CollectionInfoCalls(stub func(string, string, string, ledger.SimpleQueryExecutor) (*peer.StaticCollectionConfig, error)) {
   220  	fake.collectionInfoMutex.Lock()
   221  	defer fake.collectionInfoMutex.Unlock()
   222  	fake.CollectionInfoStub = stub
   223  }
   224  
   225  func (fake *ChaincodeInfoProvider) CollectionInfoArgsForCall(i int) (string, string, string, ledger.SimpleQueryExecutor) {
   226  	fake.collectionInfoMutex.RLock()
   227  	defer fake.collectionInfoMutex.RUnlock()
   228  	argsForCall := fake.collectionInfoArgsForCall[i]
   229  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
   230  }
   231  
   232  func (fake *ChaincodeInfoProvider) CollectionInfoReturns(result1 *peer.StaticCollectionConfig, result2 error) {
   233  	fake.collectionInfoMutex.Lock()
   234  	defer fake.collectionInfoMutex.Unlock()
   235  	fake.CollectionInfoStub = nil
   236  	fake.collectionInfoReturns = struct {
   237  		result1 *peer.StaticCollectionConfig
   238  		result2 error
   239  	}{result1, result2}
   240  }
   241  
   242  func (fake *ChaincodeInfoProvider) CollectionInfoReturnsOnCall(i int, result1 *peer.StaticCollectionConfig, result2 error) {
   243  	fake.collectionInfoMutex.Lock()
   244  	defer fake.collectionInfoMutex.Unlock()
   245  	fake.CollectionInfoStub = nil
   246  	if fake.collectionInfoReturnsOnCall == nil {
   247  		fake.collectionInfoReturnsOnCall = make(map[int]struct {
   248  			result1 *peer.StaticCollectionConfig
   249  			result2 error
   250  		})
   251  	}
   252  	fake.collectionInfoReturnsOnCall[i] = struct {
   253  		result1 *peer.StaticCollectionConfig
   254  		result2 error
   255  	}{result1, result2}
   256  }
   257  
   258  func (fake *ChaincodeInfoProvider) Invocations() map[string][][]interface{} {
   259  	fake.invocationsMutex.RLock()
   260  	defer fake.invocationsMutex.RUnlock()
   261  	fake.allCollectionsConfigPkgMutex.RLock()
   262  	defer fake.allCollectionsConfigPkgMutex.RUnlock()
   263  	fake.chaincodeInfoMutex.RLock()
   264  	defer fake.chaincodeInfoMutex.RUnlock()
   265  	fake.collectionInfoMutex.RLock()
   266  	defer fake.collectionInfoMutex.RUnlock()
   267  	copiedInvocations := map[string][][]interface{}{}
   268  	for key, value := range fake.invocations {
   269  		copiedInvocations[key] = value
   270  	}
   271  	return copiedInvocations
   272  }
   273  
   274  func (fake *ChaincodeInfoProvider) recordInvocation(key string, args []interface{}) {
   275  	fake.invocationsMutex.Lock()
   276  	defer fake.invocationsMutex.Unlock()
   277  	if fake.invocations == nil {
   278  		fake.invocations = map[string][][]interface{}{}
   279  	}
   280  	if fake.invocations[key] == nil {
   281  		fake.invocations[key] = [][]interface{}{}
   282  	}
   283  	fake.invocations[key] = append(fake.invocations[key], args)
   284  }