github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/core/scc/lscc/mock/system_chaincode_provider.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package mock
     3  
     4  import (
     5  	"sync"
     6  
     7  	"github.com/hechain20/hechain/common/channelconfig"
     8  	"github.com/hechain20/hechain/common/policies"
     9  	"github.com/hechain20/hechain/core/ledger"
    10  )
    11  
    12  type SystemChaincodeProvider struct {
    13  	GetApplicationConfigStub        func(string) (channelconfig.Application, bool)
    14  	getApplicationConfigMutex       sync.RWMutex
    15  	getApplicationConfigArgsForCall []struct {
    16  		arg1 string
    17  	}
    18  	getApplicationConfigReturns struct {
    19  		result1 channelconfig.Application
    20  		result2 bool
    21  	}
    22  	getApplicationConfigReturnsOnCall map[int]struct {
    23  		result1 channelconfig.Application
    24  		result2 bool
    25  	}
    26  	GetQueryExecutorForLedgerStub        func(string) (ledger.QueryExecutor, error)
    27  	getQueryExecutorForLedgerMutex       sync.RWMutex
    28  	getQueryExecutorForLedgerArgsForCall []struct {
    29  		arg1 string
    30  	}
    31  	getQueryExecutorForLedgerReturns struct {
    32  		result1 ledger.QueryExecutor
    33  		result2 error
    34  	}
    35  	getQueryExecutorForLedgerReturnsOnCall map[int]struct {
    36  		result1 ledger.QueryExecutor
    37  		result2 error
    38  	}
    39  	PolicyManagerStub        func(string) (policies.Manager, bool)
    40  	policyManagerMutex       sync.RWMutex
    41  	policyManagerArgsForCall []struct {
    42  		arg1 string
    43  	}
    44  	policyManagerReturns struct {
    45  		result1 policies.Manager
    46  		result2 bool
    47  	}
    48  	policyManagerReturnsOnCall map[int]struct {
    49  		result1 policies.Manager
    50  		result2 bool
    51  	}
    52  	invocations      map[string][][]interface{}
    53  	invocationsMutex sync.RWMutex
    54  }
    55  
    56  func (fake *SystemChaincodeProvider) GetApplicationConfig(arg1 string) (channelconfig.Application, bool) {
    57  	fake.getApplicationConfigMutex.Lock()
    58  	ret, specificReturn := fake.getApplicationConfigReturnsOnCall[len(fake.getApplicationConfigArgsForCall)]
    59  	fake.getApplicationConfigArgsForCall = append(fake.getApplicationConfigArgsForCall, struct {
    60  		arg1 string
    61  	}{arg1})
    62  	fake.recordInvocation("GetApplicationConfig", []interface{}{arg1})
    63  	fake.getApplicationConfigMutex.Unlock()
    64  	if fake.GetApplicationConfigStub != nil {
    65  		return fake.GetApplicationConfigStub(arg1)
    66  	}
    67  	if specificReturn {
    68  		return ret.result1, ret.result2
    69  	}
    70  	fakeReturns := fake.getApplicationConfigReturns
    71  	return fakeReturns.result1, fakeReturns.result2
    72  }
    73  
    74  func (fake *SystemChaincodeProvider) GetApplicationConfigCallCount() int {
    75  	fake.getApplicationConfigMutex.RLock()
    76  	defer fake.getApplicationConfigMutex.RUnlock()
    77  	return len(fake.getApplicationConfigArgsForCall)
    78  }
    79  
    80  func (fake *SystemChaincodeProvider) GetApplicationConfigCalls(stub func(string) (channelconfig.Application, bool)) {
    81  	fake.getApplicationConfigMutex.Lock()
    82  	defer fake.getApplicationConfigMutex.Unlock()
    83  	fake.GetApplicationConfigStub = stub
    84  }
    85  
    86  func (fake *SystemChaincodeProvider) GetApplicationConfigArgsForCall(i int) string {
    87  	fake.getApplicationConfigMutex.RLock()
    88  	defer fake.getApplicationConfigMutex.RUnlock()
    89  	argsForCall := fake.getApplicationConfigArgsForCall[i]
    90  	return argsForCall.arg1
    91  }
    92  
    93  func (fake *SystemChaincodeProvider) GetApplicationConfigReturns(result1 channelconfig.Application, result2 bool) {
    94  	fake.getApplicationConfigMutex.Lock()
    95  	defer fake.getApplicationConfigMutex.Unlock()
    96  	fake.GetApplicationConfigStub = nil
    97  	fake.getApplicationConfigReturns = struct {
    98  		result1 channelconfig.Application
    99  		result2 bool
   100  	}{result1, result2}
   101  }
   102  
   103  func (fake *SystemChaincodeProvider) GetApplicationConfigReturnsOnCall(i int, result1 channelconfig.Application, result2 bool) {
   104  	fake.getApplicationConfigMutex.Lock()
   105  	defer fake.getApplicationConfigMutex.Unlock()
   106  	fake.GetApplicationConfigStub = nil
   107  	if fake.getApplicationConfigReturnsOnCall == nil {
   108  		fake.getApplicationConfigReturnsOnCall = make(map[int]struct {
   109  			result1 channelconfig.Application
   110  			result2 bool
   111  		})
   112  	}
   113  	fake.getApplicationConfigReturnsOnCall[i] = struct {
   114  		result1 channelconfig.Application
   115  		result2 bool
   116  	}{result1, result2}
   117  }
   118  
   119  func (fake *SystemChaincodeProvider) GetQueryExecutorForLedger(arg1 string) (ledger.QueryExecutor, error) {
   120  	fake.getQueryExecutorForLedgerMutex.Lock()
   121  	ret, specificReturn := fake.getQueryExecutorForLedgerReturnsOnCall[len(fake.getQueryExecutorForLedgerArgsForCall)]
   122  	fake.getQueryExecutorForLedgerArgsForCall = append(fake.getQueryExecutorForLedgerArgsForCall, struct {
   123  		arg1 string
   124  	}{arg1})
   125  	fake.recordInvocation("GetQueryExecutorForLedger", []interface{}{arg1})
   126  	fake.getQueryExecutorForLedgerMutex.Unlock()
   127  	if fake.GetQueryExecutorForLedgerStub != nil {
   128  		return fake.GetQueryExecutorForLedgerStub(arg1)
   129  	}
   130  	if specificReturn {
   131  		return ret.result1, ret.result2
   132  	}
   133  	fakeReturns := fake.getQueryExecutorForLedgerReturns
   134  	return fakeReturns.result1, fakeReturns.result2
   135  }
   136  
   137  func (fake *SystemChaincodeProvider) GetQueryExecutorForLedgerCallCount() int {
   138  	fake.getQueryExecutorForLedgerMutex.RLock()
   139  	defer fake.getQueryExecutorForLedgerMutex.RUnlock()
   140  	return len(fake.getQueryExecutorForLedgerArgsForCall)
   141  }
   142  
   143  func (fake *SystemChaincodeProvider) GetQueryExecutorForLedgerCalls(stub func(string) (ledger.QueryExecutor, error)) {
   144  	fake.getQueryExecutorForLedgerMutex.Lock()
   145  	defer fake.getQueryExecutorForLedgerMutex.Unlock()
   146  	fake.GetQueryExecutorForLedgerStub = stub
   147  }
   148  
   149  func (fake *SystemChaincodeProvider) GetQueryExecutorForLedgerArgsForCall(i int) string {
   150  	fake.getQueryExecutorForLedgerMutex.RLock()
   151  	defer fake.getQueryExecutorForLedgerMutex.RUnlock()
   152  	argsForCall := fake.getQueryExecutorForLedgerArgsForCall[i]
   153  	return argsForCall.arg1
   154  }
   155  
   156  func (fake *SystemChaincodeProvider) GetQueryExecutorForLedgerReturns(result1 ledger.QueryExecutor, result2 error) {
   157  	fake.getQueryExecutorForLedgerMutex.Lock()
   158  	defer fake.getQueryExecutorForLedgerMutex.Unlock()
   159  	fake.GetQueryExecutorForLedgerStub = nil
   160  	fake.getQueryExecutorForLedgerReturns = struct {
   161  		result1 ledger.QueryExecutor
   162  		result2 error
   163  	}{result1, result2}
   164  }
   165  
   166  func (fake *SystemChaincodeProvider) GetQueryExecutorForLedgerReturnsOnCall(i int, result1 ledger.QueryExecutor, result2 error) {
   167  	fake.getQueryExecutorForLedgerMutex.Lock()
   168  	defer fake.getQueryExecutorForLedgerMutex.Unlock()
   169  	fake.GetQueryExecutorForLedgerStub = nil
   170  	if fake.getQueryExecutorForLedgerReturnsOnCall == nil {
   171  		fake.getQueryExecutorForLedgerReturnsOnCall = make(map[int]struct {
   172  			result1 ledger.QueryExecutor
   173  			result2 error
   174  		})
   175  	}
   176  	fake.getQueryExecutorForLedgerReturnsOnCall[i] = struct {
   177  		result1 ledger.QueryExecutor
   178  		result2 error
   179  	}{result1, result2}
   180  }
   181  
   182  func (fake *SystemChaincodeProvider) PolicyManager(arg1 string) (policies.Manager, bool) {
   183  	fake.policyManagerMutex.Lock()
   184  	ret, specificReturn := fake.policyManagerReturnsOnCall[len(fake.policyManagerArgsForCall)]
   185  	fake.policyManagerArgsForCall = append(fake.policyManagerArgsForCall, struct {
   186  		arg1 string
   187  	}{arg1})
   188  	fake.recordInvocation("PolicyManager", []interface{}{arg1})
   189  	fake.policyManagerMutex.Unlock()
   190  	if fake.PolicyManagerStub != nil {
   191  		return fake.PolicyManagerStub(arg1)
   192  	}
   193  	if specificReturn {
   194  		return ret.result1, ret.result2
   195  	}
   196  	fakeReturns := fake.policyManagerReturns
   197  	return fakeReturns.result1, fakeReturns.result2
   198  }
   199  
   200  func (fake *SystemChaincodeProvider) PolicyManagerCallCount() int {
   201  	fake.policyManagerMutex.RLock()
   202  	defer fake.policyManagerMutex.RUnlock()
   203  	return len(fake.policyManagerArgsForCall)
   204  }
   205  
   206  func (fake *SystemChaincodeProvider) PolicyManagerCalls(stub func(string) (policies.Manager, bool)) {
   207  	fake.policyManagerMutex.Lock()
   208  	defer fake.policyManagerMutex.Unlock()
   209  	fake.PolicyManagerStub = stub
   210  }
   211  
   212  func (fake *SystemChaincodeProvider) PolicyManagerArgsForCall(i int) string {
   213  	fake.policyManagerMutex.RLock()
   214  	defer fake.policyManagerMutex.RUnlock()
   215  	argsForCall := fake.policyManagerArgsForCall[i]
   216  	return argsForCall.arg1
   217  }
   218  
   219  func (fake *SystemChaincodeProvider) PolicyManagerReturns(result1 policies.Manager, result2 bool) {
   220  	fake.policyManagerMutex.Lock()
   221  	defer fake.policyManagerMutex.Unlock()
   222  	fake.PolicyManagerStub = nil
   223  	fake.policyManagerReturns = struct {
   224  		result1 policies.Manager
   225  		result2 bool
   226  	}{result1, result2}
   227  }
   228  
   229  func (fake *SystemChaincodeProvider) PolicyManagerReturnsOnCall(i int, result1 policies.Manager, result2 bool) {
   230  	fake.policyManagerMutex.Lock()
   231  	defer fake.policyManagerMutex.Unlock()
   232  	fake.PolicyManagerStub = nil
   233  	if fake.policyManagerReturnsOnCall == nil {
   234  		fake.policyManagerReturnsOnCall = make(map[int]struct {
   235  			result1 policies.Manager
   236  			result2 bool
   237  		})
   238  	}
   239  	fake.policyManagerReturnsOnCall[i] = struct {
   240  		result1 policies.Manager
   241  		result2 bool
   242  	}{result1, result2}
   243  }
   244  
   245  func (fake *SystemChaincodeProvider) Invocations() map[string][][]interface{} {
   246  	fake.invocationsMutex.RLock()
   247  	defer fake.invocationsMutex.RUnlock()
   248  	fake.getApplicationConfigMutex.RLock()
   249  	defer fake.getApplicationConfigMutex.RUnlock()
   250  	fake.getQueryExecutorForLedgerMutex.RLock()
   251  	defer fake.getQueryExecutorForLedgerMutex.RUnlock()
   252  	fake.policyManagerMutex.RLock()
   253  	defer fake.policyManagerMutex.RUnlock()
   254  	copiedInvocations := map[string][][]interface{}{}
   255  	for key, value := range fake.invocations {
   256  		copiedInvocations[key] = value
   257  	}
   258  	return copiedInvocations
   259  }
   260  
   261  func (fake *SystemChaincodeProvider) recordInvocation(key string, args []interface{}) {
   262  	fake.invocationsMutex.Lock()
   263  	defer fake.invocationsMutex.Unlock()
   264  	if fake.invocations == nil {
   265  		fake.invocations = map[string][][]interface{}{}
   266  	}
   267  	if fake.invocations[key] == nil {
   268  		fake.invocations[key] = [][]interface{}{}
   269  	}
   270  	fake.invocations[key] = append(fake.invocations[key], args)
   271  }