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

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