github.com/yacovm/fabric@v2.0.0-alpha.0.20191128145320-c5d4087dc723+incompatible/core/scc/cscc/mocks/policy_checker.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package mocks
     3  
     4  import (
     5  	"sync"
     6  
     7  	"github.com/hyperledger/fabric-protos-go/peer"
     8  	"github.com/hyperledger/fabric/protoutil"
     9  )
    10  
    11  type PolicyChecker struct {
    12  	CheckPolicyStub        func(string, string, *peer.SignedProposal) error
    13  	checkPolicyMutex       sync.RWMutex
    14  	checkPolicyArgsForCall []struct {
    15  		arg1 string
    16  		arg2 string
    17  		arg3 *peer.SignedProposal
    18  	}
    19  	checkPolicyReturns struct {
    20  		result1 error
    21  	}
    22  	checkPolicyReturnsOnCall map[int]struct {
    23  		result1 error
    24  	}
    25  	CheckPolicyBySignedDataStub        func(string, string, []*protoutil.SignedData) error
    26  	checkPolicyBySignedDataMutex       sync.RWMutex
    27  	checkPolicyBySignedDataArgsForCall []struct {
    28  		arg1 string
    29  		arg2 string
    30  		arg3 []*protoutil.SignedData
    31  	}
    32  	checkPolicyBySignedDataReturns struct {
    33  		result1 error
    34  	}
    35  	checkPolicyBySignedDataReturnsOnCall map[int]struct {
    36  		result1 error
    37  	}
    38  	CheckPolicyNoChannelStub        func(string, *peer.SignedProposal) error
    39  	checkPolicyNoChannelMutex       sync.RWMutex
    40  	checkPolicyNoChannelArgsForCall []struct {
    41  		arg1 string
    42  		arg2 *peer.SignedProposal
    43  	}
    44  	checkPolicyNoChannelReturns struct {
    45  		result1 error
    46  	}
    47  	checkPolicyNoChannelReturnsOnCall map[int]struct {
    48  		result1 error
    49  	}
    50  	invocations      map[string][][]interface{}
    51  	invocationsMutex sync.RWMutex
    52  }
    53  
    54  func (fake *PolicyChecker) CheckPolicy(arg1 string, arg2 string, arg3 *peer.SignedProposal) error {
    55  	fake.checkPolicyMutex.Lock()
    56  	ret, specificReturn := fake.checkPolicyReturnsOnCall[len(fake.checkPolicyArgsForCall)]
    57  	fake.checkPolicyArgsForCall = append(fake.checkPolicyArgsForCall, struct {
    58  		arg1 string
    59  		arg2 string
    60  		arg3 *peer.SignedProposal
    61  	}{arg1, arg2, arg3})
    62  	fake.recordInvocation("CheckPolicy", []interface{}{arg1, arg2, arg3})
    63  	fake.checkPolicyMutex.Unlock()
    64  	if fake.CheckPolicyStub != nil {
    65  		return fake.CheckPolicyStub(arg1, arg2, arg3)
    66  	}
    67  	if specificReturn {
    68  		return ret.result1
    69  	}
    70  	fakeReturns := fake.checkPolicyReturns
    71  	return fakeReturns.result1
    72  }
    73  
    74  func (fake *PolicyChecker) CheckPolicyCallCount() int {
    75  	fake.checkPolicyMutex.RLock()
    76  	defer fake.checkPolicyMutex.RUnlock()
    77  	return len(fake.checkPolicyArgsForCall)
    78  }
    79  
    80  func (fake *PolicyChecker) CheckPolicyCalls(stub func(string, string, *peer.SignedProposal) error) {
    81  	fake.checkPolicyMutex.Lock()
    82  	defer fake.checkPolicyMutex.Unlock()
    83  	fake.CheckPolicyStub = stub
    84  }
    85  
    86  func (fake *PolicyChecker) CheckPolicyArgsForCall(i int) (string, string, *peer.SignedProposal) {
    87  	fake.checkPolicyMutex.RLock()
    88  	defer fake.checkPolicyMutex.RUnlock()
    89  	argsForCall := fake.checkPolicyArgsForCall[i]
    90  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
    91  }
    92  
    93  func (fake *PolicyChecker) CheckPolicyReturns(result1 error) {
    94  	fake.checkPolicyMutex.Lock()
    95  	defer fake.checkPolicyMutex.Unlock()
    96  	fake.CheckPolicyStub = nil
    97  	fake.checkPolicyReturns = struct {
    98  		result1 error
    99  	}{result1}
   100  }
   101  
   102  func (fake *PolicyChecker) CheckPolicyReturnsOnCall(i int, result1 error) {
   103  	fake.checkPolicyMutex.Lock()
   104  	defer fake.checkPolicyMutex.Unlock()
   105  	fake.CheckPolicyStub = nil
   106  	if fake.checkPolicyReturnsOnCall == nil {
   107  		fake.checkPolicyReturnsOnCall = make(map[int]struct {
   108  			result1 error
   109  		})
   110  	}
   111  	fake.checkPolicyReturnsOnCall[i] = struct {
   112  		result1 error
   113  	}{result1}
   114  }
   115  
   116  func (fake *PolicyChecker) CheckPolicyBySignedData(arg1 string, arg2 string, arg3 []*protoutil.SignedData) error {
   117  	var arg3Copy []*protoutil.SignedData
   118  	if arg3 != nil {
   119  		arg3Copy = make([]*protoutil.SignedData, len(arg3))
   120  		copy(arg3Copy, arg3)
   121  	}
   122  	fake.checkPolicyBySignedDataMutex.Lock()
   123  	ret, specificReturn := fake.checkPolicyBySignedDataReturnsOnCall[len(fake.checkPolicyBySignedDataArgsForCall)]
   124  	fake.checkPolicyBySignedDataArgsForCall = append(fake.checkPolicyBySignedDataArgsForCall, struct {
   125  		arg1 string
   126  		arg2 string
   127  		arg3 []*protoutil.SignedData
   128  	}{arg1, arg2, arg3Copy})
   129  	fake.recordInvocation("CheckPolicyBySignedData", []interface{}{arg1, arg2, arg3Copy})
   130  	fake.checkPolicyBySignedDataMutex.Unlock()
   131  	if fake.CheckPolicyBySignedDataStub != nil {
   132  		return fake.CheckPolicyBySignedDataStub(arg1, arg2, arg3)
   133  	}
   134  	if specificReturn {
   135  		return ret.result1
   136  	}
   137  	fakeReturns := fake.checkPolicyBySignedDataReturns
   138  	return fakeReturns.result1
   139  }
   140  
   141  func (fake *PolicyChecker) CheckPolicyBySignedDataCallCount() int {
   142  	fake.checkPolicyBySignedDataMutex.RLock()
   143  	defer fake.checkPolicyBySignedDataMutex.RUnlock()
   144  	return len(fake.checkPolicyBySignedDataArgsForCall)
   145  }
   146  
   147  func (fake *PolicyChecker) CheckPolicyBySignedDataCalls(stub func(string, string, []*protoutil.SignedData) error) {
   148  	fake.checkPolicyBySignedDataMutex.Lock()
   149  	defer fake.checkPolicyBySignedDataMutex.Unlock()
   150  	fake.CheckPolicyBySignedDataStub = stub
   151  }
   152  
   153  func (fake *PolicyChecker) CheckPolicyBySignedDataArgsForCall(i int) (string, string, []*protoutil.SignedData) {
   154  	fake.checkPolicyBySignedDataMutex.RLock()
   155  	defer fake.checkPolicyBySignedDataMutex.RUnlock()
   156  	argsForCall := fake.checkPolicyBySignedDataArgsForCall[i]
   157  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
   158  }
   159  
   160  func (fake *PolicyChecker) CheckPolicyBySignedDataReturns(result1 error) {
   161  	fake.checkPolicyBySignedDataMutex.Lock()
   162  	defer fake.checkPolicyBySignedDataMutex.Unlock()
   163  	fake.CheckPolicyBySignedDataStub = nil
   164  	fake.checkPolicyBySignedDataReturns = struct {
   165  		result1 error
   166  	}{result1}
   167  }
   168  
   169  func (fake *PolicyChecker) CheckPolicyBySignedDataReturnsOnCall(i int, result1 error) {
   170  	fake.checkPolicyBySignedDataMutex.Lock()
   171  	defer fake.checkPolicyBySignedDataMutex.Unlock()
   172  	fake.CheckPolicyBySignedDataStub = nil
   173  	if fake.checkPolicyBySignedDataReturnsOnCall == nil {
   174  		fake.checkPolicyBySignedDataReturnsOnCall = make(map[int]struct {
   175  			result1 error
   176  		})
   177  	}
   178  	fake.checkPolicyBySignedDataReturnsOnCall[i] = struct {
   179  		result1 error
   180  	}{result1}
   181  }
   182  
   183  func (fake *PolicyChecker) CheckPolicyNoChannel(arg1 string, arg2 *peer.SignedProposal) error {
   184  	fake.checkPolicyNoChannelMutex.Lock()
   185  	ret, specificReturn := fake.checkPolicyNoChannelReturnsOnCall[len(fake.checkPolicyNoChannelArgsForCall)]
   186  	fake.checkPolicyNoChannelArgsForCall = append(fake.checkPolicyNoChannelArgsForCall, struct {
   187  		arg1 string
   188  		arg2 *peer.SignedProposal
   189  	}{arg1, arg2})
   190  	fake.recordInvocation("CheckPolicyNoChannel", []interface{}{arg1, arg2})
   191  	fake.checkPolicyNoChannelMutex.Unlock()
   192  	if fake.CheckPolicyNoChannelStub != nil {
   193  		return fake.CheckPolicyNoChannelStub(arg1, arg2)
   194  	}
   195  	if specificReturn {
   196  		return ret.result1
   197  	}
   198  	fakeReturns := fake.checkPolicyNoChannelReturns
   199  	return fakeReturns.result1
   200  }
   201  
   202  func (fake *PolicyChecker) CheckPolicyNoChannelCallCount() int {
   203  	fake.checkPolicyNoChannelMutex.RLock()
   204  	defer fake.checkPolicyNoChannelMutex.RUnlock()
   205  	return len(fake.checkPolicyNoChannelArgsForCall)
   206  }
   207  
   208  func (fake *PolicyChecker) CheckPolicyNoChannelCalls(stub func(string, *peer.SignedProposal) error) {
   209  	fake.checkPolicyNoChannelMutex.Lock()
   210  	defer fake.checkPolicyNoChannelMutex.Unlock()
   211  	fake.CheckPolicyNoChannelStub = stub
   212  }
   213  
   214  func (fake *PolicyChecker) CheckPolicyNoChannelArgsForCall(i int) (string, *peer.SignedProposal) {
   215  	fake.checkPolicyNoChannelMutex.RLock()
   216  	defer fake.checkPolicyNoChannelMutex.RUnlock()
   217  	argsForCall := fake.checkPolicyNoChannelArgsForCall[i]
   218  	return argsForCall.arg1, argsForCall.arg2
   219  }
   220  
   221  func (fake *PolicyChecker) CheckPolicyNoChannelReturns(result1 error) {
   222  	fake.checkPolicyNoChannelMutex.Lock()
   223  	defer fake.checkPolicyNoChannelMutex.Unlock()
   224  	fake.CheckPolicyNoChannelStub = nil
   225  	fake.checkPolicyNoChannelReturns = struct {
   226  		result1 error
   227  	}{result1}
   228  }
   229  
   230  func (fake *PolicyChecker) CheckPolicyNoChannelReturnsOnCall(i int, result1 error) {
   231  	fake.checkPolicyNoChannelMutex.Lock()
   232  	defer fake.checkPolicyNoChannelMutex.Unlock()
   233  	fake.CheckPolicyNoChannelStub = nil
   234  	if fake.checkPolicyNoChannelReturnsOnCall == nil {
   235  		fake.checkPolicyNoChannelReturnsOnCall = make(map[int]struct {
   236  			result1 error
   237  		})
   238  	}
   239  	fake.checkPolicyNoChannelReturnsOnCall[i] = struct {
   240  		result1 error
   241  	}{result1}
   242  }
   243  
   244  func (fake *PolicyChecker) Invocations() map[string][][]interface{} {
   245  	fake.invocationsMutex.RLock()
   246  	defer fake.invocationsMutex.RUnlock()
   247  	fake.checkPolicyMutex.RLock()
   248  	defer fake.checkPolicyMutex.RUnlock()
   249  	fake.checkPolicyBySignedDataMutex.RLock()
   250  	defer fake.checkPolicyBySignedDataMutex.RUnlock()
   251  	fake.checkPolicyNoChannelMutex.RLock()
   252  	defer fake.checkPolicyNoChannelMutex.RUnlock()
   253  	copiedInvocations := map[string][][]interface{}{}
   254  	for key, value := range fake.invocations {
   255  		copiedInvocations[key] = value
   256  	}
   257  	return copiedInvocations
   258  }
   259  
   260  func (fake *PolicyChecker) recordInvocation(key string, args []interface{}) {
   261  	fake.invocationsMutex.Lock()
   262  	defer fake.invocationsMutex.Unlock()
   263  	if fake.invocations == nil {
   264  		fake.invocations = map[string][][]interface{}{}
   265  	}
   266  	if fake.invocations[key] == nil {
   267  		fake.invocations[key] = [][]interface{}{}
   268  	}
   269  	fake.invocations[key] = append(fake.invocations[key], args)
   270  }