github.com/lzy4123/fabric@v2.1.1+incompatible/bccsp/idemix/handlers/mock/nymsignature_scheme.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package mock
     3  
     4  import (
     5  	"sync"
     6  
     7  	"github.com/hyperledger/fabric/bccsp/idemix/handlers"
     8  )
     9  
    10  type NymSignatureScheme struct {
    11  	SignStub        func(handlers.Big, handlers.Ecp, handlers.Big, handlers.IssuerPublicKey, []byte) ([]byte, error)
    12  	signMutex       sync.RWMutex
    13  	signArgsForCall []struct {
    14  		arg1 handlers.Big
    15  		arg2 handlers.Ecp
    16  		arg3 handlers.Big
    17  		arg4 handlers.IssuerPublicKey
    18  		arg5 []byte
    19  	}
    20  	signReturns struct {
    21  		result1 []byte
    22  		result2 error
    23  	}
    24  	signReturnsOnCall map[int]struct {
    25  		result1 []byte
    26  		result2 error
    27  	}
    28  	VerifyStub        func(handlers.IssuerPublicKey, handlers.Ecp, []byte, []byte) error
    29  	verifyMutex       sync.RWMutex
    30  	verifyArgsForCall []struct {
    31  		arg1 handlers.IssuerPublicKey
    32  		arg2 handlers.Ecp
    33  		arg3 []byte
    34  		arg4 []byte
    35  	}
    36  	verifyReturns struct {
    37  		result1 error
    38  	}
    39  	verifyReturnsOnCall map[int]struct {
    40  		result1 error
    41  	}
    42  	invocations      map[string][][]interface{}
    43  	invocationsMutex sync.RWMutex
    44  }
    45  
    46  func (fake *NymSignatureScheme) Sign(arg1 handlers.Big, arg2 handlers.Ecp, arg3 handlers.Big, arg4 handlers.IssuerPublicKey, arg5 []byte) ([]byte, error) {
    47  	var arg5Copy []byte
    48  	if arg5 != nil {
    49  		arg5Copy = make([]byte, len(arg5))
    50  		copy(arg5Copy, arg5)
    51  	}
    52  	fake.signMutex.Lock()
    53  	ret, specificReturn := fake.signReturnsOnCall[len(fake.signArgsForCall)]
    54  	fake.signArgsForCall = append(fake.signArgsForCall, struct {
    55  		arg1 handlers.Big
    56  		arg2 handlers.Ecp
    57  		arg3 handlers.Big
    58  		arg4 handlers.IssuerPublicKey
    59  		arg5 []byte
    60  	}{arg1, arg2, arg3, arg4, arg5Copy})
    61  	fake.recordInvocation("Sign", []interface{}{arg1, arg2, arg3, arg4, arg5Copy})
    62  	fake.signMutex.Unlock()
    63  	if fake.SignStub != nil {
    64  		return fake.SignStub(arg1, arg2, arg3, arg4, arg5)
    65  	}
    66  	if specificReturn {
    67  		return ret.result1, ret.result2
    68  	}
    69  	fakeReturns := fake.signReturns
    70  	return fakeReturns.result1, fakeReturns.result2
    71  }
    72  
    73  func (fake *NymSignatureScheme) SignCallCount() int {
    74  	fake.signMutex.RLock()
    75  	defer fake.signMutex.RUnlock()
    76  	return len(fake.signArgsForCall)
    77  }
    78  
    79  func (fake *NymSignatureScheme) SignCalls(stub func(handlers.Big, handlers.Ecp, handlers.Big, handlers.IssuerPublicKey, []byte) ([]byte, error)) {
    80  	fake.signMutex.Lock()
    81  	defer fake.signMutex.Unlock()
    82  	fake.SignStub = stub
    83  }
    84  
    85  func (fake *NymSignatureScheme) SignArgsForCall(i int) (handlers.Big, handlers.Ecp, handlers.Big, handlers.IssuerPublicKey, []byte) {
    86  	fake.signMutex.RLock()
    87  	defer fake.signMutex.RUnlock()
    88  	argsForCall := fake.signArgsForCall[i]
    89  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4, argsForCall.arg5
    90  }
    91  
    92  func (fake *NymSignatureScheme) SignReturns(result1 []byte, result2 error) {
    93  	fake.signMutex.Lock()
    94  	defer fake.signMutex.Unlock()
    95  	fake.SignStub = nil
    96  	fake.signReturns = struct {
    97  		result1 []byte
    98  		result2 error
    99  	}{result1, result2}
   100  }
   101  
   102  func (fake *NymSignatureScheme) SignReturnsOnCall(i int, result1 []byte, result2 error) {
   103  	fake.signMutex.Lock()
   104  	defer fake.signMutex.Unlock()
   105  	fake.SignStub = nil
   106  	if fake.signReturnsOnCall == nil {
   107  		fake.signReturnsOnCall = make(map[int]struct {
   108  			result1 []byte
   109  			result2 error
   110  		})
   111  	}
   112  	fake.signReturnsOnCall[i] = struct {
   113  		result1 []byte
   114  		result2 error
   115  	}{result1, result2}
   116  }
   117  
   118  func (fake *NymSignatureScheme) Verify(arg1 handlers.IssuerPublicKey, arg2 handlers.Ecp, arg3 []byte, arg4 []byte) error {
   119  	var arg3Copy []byte
   120  	if arg3 != nil {
   121  		arg3Copy = make([]byte, len(arg3))
   122  		copy(arg3Copy, arg3)
   123  	}
   124  	var arg4Copy []byte
   125  	if arg4 != nil {
   126  		arg4Copy = make([]byte, len(arg4))
   127  		copy(arg4Copy, arg4)
   128  	}
   129  	fake.verifyMutex.Lock()
   130  	ret, specificReturn := fake.verifyReturnsOnCall[len(fake.verifyArgsForCall)]
   131  	fake.verifyArgsForCall = append(fake.verifyArgsForCall, struct {
   132  		arg1 handlers.IssuerPublicKey
   133  		arg2 handlers.Ecp
   134  		arg3 []byte
   135  		arg4 []byte
   136  	}{arg1, arg2, arg3Copy, arg4Copy})
   137  	fake.recordInvocation("Verify", []interface{}{arg1, arg2, arg3Copy, arg4Copy})
   138  	fake.verifyMutex.Unlock()
   139  	if fake.VerifyStub != nil {
   140  		return fake.VerifyStub(arg1, arg2, arg3, arg4)
   141  	}
   142  	if specificReturn {
   143  		return ret.result1
   144  	}
   145  	fakeReturns := fake.verifyReturns
   146  	return fakeReturns.result1
   147  }
   148  
   149  func (fake *NymSignatureScheme) VerifyCallCount() int {
   150  	fake.verifyMutex.RLock()
   151  	defer fake.verifyMutex.RUnlock()
   152  	return len(fake.verifyArgsForCall)
   153  }
   154  
   155  func (fake *NymSignatureScheme) VerifyCalls(stub func(handlers.IssuerPublicKey, handlers.Ecp, []byte, []byte) error) {
   156  	fake.verifyMutex.Lock()
   157  	defer fake.verifyMutex.Unlock()
   158  	fake.VerifyStub = stub
   159  }
   160  
   161  func (fake *NymSignatureScheme) VerifyArgsForCall(i int) (handlers.IssuerPublicKey, handlers.Ecp, []byte, []byte) {
   162  	fake.verifyMutex.RLock()
   163  	defer fake.verifyMutex.RUnlock()
   164  	argsForCall := fake.verifyArgsForCall[i]
   165  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
   166  }
   167  
   168  func (fake *NymSignatureScheme) VerifyReturns(result1 error) {
   169  	fake.verifyMutex.Lock()
   170  	defer fake.verifyMutex.Unlock()
   171  	fake.VerifyStub = nil
   172  	fake.verifyReturns = struct {
   173  		result1 error
   174  	}{result1}
   175  }
   176  
   177  func (fake *NymSignatureScheme) VerifyReturnsOnCall(i int, result1 error) {
   178  	fake.verifyMutex.Lock()
   179  	defer fake.verifyMutex.Unlock()
   180  	fake.VerifyStub = nil
   181  	if fake.verifyReturnsOnCall == nil {
   182  		fake.verifyReturnsOnCall = make(map[int]struct {
   183  			result1 error
   184  		})
   185  	}
   186  	fake.verifyReturnsOnCall[i] = struct {
   187  		result1 error
   188  	}{result1}
   189  }
   190  
   191  func (fake *NymSignatureScheme) Invocations() map[string][][]interface{} {
   192  	fake.invocationsMutex.RLock()
   193  	defer fake.invocationsMutex.RUnlock()
   194  	fake.signMutex.RLock()
   195  	defer fake.signMutex.RUnlock()
   196  	fake.verifyMutex.RLock()
   197  	defer fake.verifyMutex.RUnlock()
   198  	copiedInvocations := map[string][][]interface{}{}
   199  	for key, value := range fake.invocations {
   200  		copiedInvocations[key] = value
   201  	}
   202  	return copiedInvocations
   203  }
   204  
   205  func (fake *NymSignatureScheme) recordInvocation(key string, args []interface{}) {
   206  	fake.invocationsMutex.Lock()
   207  	defer fake.invocationsMutex.Unlock()
   208  	if fake.invocations == nil {
   209  		fake.invocations = map[string][][]interface{}{}
   210  	}
   211  	if fake.invocations[key] == nil {
   212  		fake.invocations[key] = [][]interface{}{}
   213  	}
   214  	fake.invocations[key] = append(fake.invocations[key], args)
   215  }
   216  
   217  var _ handlers.NymSignatureScheme = new(NymSignatureScheme)