github.com/lzy4123/fabric@v2.1.1+incompatible/bccsp/idemix/handlers/mock/issuer.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 Issuer struct {
    11  	NewKeyStub        func([]string) (handlers.IssuerSecretKey, error)
    12  	newKeyMutex       sync.RWMutex
    13  	newKeyArgsForCall []struct {
    14  		arg1 []string
    15  	}
    16  	newKeyReturns struct {
    17  		result1 handlers.IssuerSecretKey
    18  		result2 error
    19  	}
    20  	newKeyReturnsOnCall map[int]struct {
    21  		result1 handlers.IssuerSecretKey
    22  		result2 error
    23  	}
    24  	NewPublicKeyFromBytesStub        func([]byte, []string) (handlers.IssuerPublicKey, error)
    25  	newPublicKeyFromBytesMutex       sync.RWMutex
    26  	newPublicKeyFromBytesArgsForCall []struct {
    27  		arg1 []byte
    28  		arg2 []string
    29  	}
    30  	newPublicKeyFromBytesReturns struct {
    31  		result1 handlers.IssuerPublicKey
    32  		result2 error
    33  	}
    34  	newPublicKeyFromBytesReturnsOnCall map[int]struct {
    35  		result1 handlers.IssuerPublicKey
    36  		result2 error
    37  	}
    38  	invocations      map[string][][]interface{}
    39  	invocationsMutex sync.RWMutex
    40  }
    41  
    42  func (fake *Issuer) NewKey(arg1 []string) (handlers.IssuerSecretKey, error) {
    43  	var arg1Copy []string
    44  	if arg1 != nil {
    45  		arg1Copy = make([]string, len(arg1))
    46  		copy(arg1Copy, arg1)
    47  	}
    48  	fake.newKeyMutex.Lock()
    49  	ret, specificReturn := fake.newKeyReturnsOnCall[len(fake.newKeyArgsForCall)]
    50  	fake.newKeyArgsForCall = append(fake.newKeyArgsForCall, struct {
    51  		arg1 []string
    52  	}{arg1Copy})
    53  	fake.recordInvocation("NewKey", []interface{}{arg1Copy})
    54  	fake.newKeyMutex.Unlock()
    55  	if fake.NewKeyStub != nil {
    56  		return fake.NewKeyStub(arg1)
    57  	}
    58  	if specificReturn {
    59  		return ret.result1, ret.result2
    60  	}
    61  	fakeReturns := fake.newKeyReturns
    62  	return fakeReturns.result1, fakeReturns.result2
    63  }
    64  
    65  func (fake *Issuer) NewKeyCallCount() int {
    66  	fake.newKeyMutex.RLock()
    67  	defer fake.newKeyMutex.RUnlock()
    68  	return len(fake.newKeyArgsForCall)
    69  }
    70  
    71  func (fake *Issuer) NewKeyCalls(stub func([]string) (handlers.IssuerSecretKey, error)) {
    72  	fake.newKeyMutex.Lock()
    73  	defer fake.newKeyMutex.Unlock()
    74  	fake.NewKeyStub = stub
    75  }
    76  
    77  func (fake *Issuer) NewKeyArgsForCall(i int) []string {
    78  	fake.newKeyMutex.RLock()
    79  	defer fake.newKeyMutex.RUnlock()
    80  	argsForCall := fake.newKeyArgsForCall[i]
    81  	return argsForCall.arg1
    82  }
    83  
    84  func (fake *Issuer) NewKeyReturns(result1 handlers.IssuerSecretKey, result2 error) {
    85  	fake.newKeyMutex.Lock()
    86  	defer fake.newKeyMutex.Unlock()
    87  	fake.NewKeyStub = nil
    88  	fake.newKeyReturns = struct {
    89  		result1 handlers.IssuerSecretKey
    90  		result2 error
    91  	}{result1, result2}
    92  }
    93  
    94  func (fake *Issuer) NewKeyReturnsOnCall(i int, result1 handlers.IssuerSecretKey, result2 error) {
    95  	fake.newKeyMutex.Lock()
    96  	defer fake.newKeyMutex.Unlock()
    97  	fake.NewKeyStub = nil
    98  	if fake.newKeyReturnsOnCall == nil {
    99  		fake.newKeyReturnsOnCall = make(map[int]struct {
   100  			result1 handlers.IssuerSecretKey
   101  			result2 error
   102  		})
   103  	}
   104  	fake.newKeyReturnsOnCall[i] = struct {
   105  		result1 handlers.IssuerSecretKey
   106  		result2 error
   107  	}{result1, result2}
   108  }
   109  
   110  func (fake *Issuer) NewPublicKeyFromBytes(arg1 []byte, arg2 []string) (handlers.IssuerPublicKey, error) {
   111  	var arg1Copy []byte
   112  	if arg1 != nil {
   113  		arg1Copy = make([]byte, len(arg1))
   114  		copy(arg1Copy, arg1)
   115  	}
   116  	var arg2Copy []string
   117  	if arg2 != nil {
   118  		arg2Copy = make([]string, len(arg2))
   119  		copy(arg2Copy, arg2)
   120  	}
   121  	fake.newPublicKeyFromBytesMutex.Lock()
   122  	ret, specificReturn := fake.newPublicKeyFromBytesReturnsOnCall[len(fake.newPublicKeyFromBytesArgsForCall)]
   123  	fake.newPublicKeyFromBytesArgsForCall = append(fake.newPublicKeyFromBytesArgsForCall, struct {
   124  		arg1 []byte
   125  		arg2 []string
   126  	}{arg1Copy, arg2Copy})
   127  	fake.recordInvocation("NewPublicKeyFromBytes", []interface{}{arg1Copy, arg2Copy})
   128  	fake.newPublicKeyFromBytesMutex.Unlock()
   129  	if fake.NewPublicKeyFromBytesStub != nil {
   130  		return fake.NewPublicKeyFromBytesStub(arg1, arg2)
   131  	}
   132  	if specificReturn {
   133  		return ret.result1, ret.result2
   134  	}
   135  	fakeReturns := fake.newPublicKeyFromBytesReturns
   136  	return fakeReturns.result1, fakeReturns.result2
   137  }
   138  
   139  func (fake *Issuer) NewPublicKeyFromBytesCallCount() int {
   140  	fake.newPublicKeyFromBytesMutex.RLock()
   141  	defer fake.newPublicKeyFromBytesMutex.RUnlock()
   142  	return len(fake.newPublicKeyFromBytesArgsForCall)
   143  }
   144  
   145  func (fake *Issuer) NewPublicKeyFromBytesCalls(stub func([]byte, []string) (handlers.IssuerPublicKey, error)) {
   146  	fake.newPublicKeyFromBytesMutex.Lock()
   147  	defer fake.newPublicKeyFromBytesMutex.Unlock()
   148  	fake.NewPublicKeyFromBytesStub = stub
   149  }
   150  
   151  func (fake *Issuer) NewPublicKeyFromBytesArgsForCall(i int) ([]byte, []string) {
   152  	fake.newPublicKeyFromBytesMutex.RLock()
   153  	defer fake.newPublicKeyFromBytesMutex.RUnlock()
   154  	argsForCall := fake.newPublicKeyFromBytesArgsForCall[i]
   155  	return argsForCall.arg1, argsForCall.arg2
   156  }
   157  
   158  func (fake *Issuer) NewPublicKeyFromBytesReturns(result1 handlers.IssuerPublicKey, result2 error) {
   159  	fake.newPublicKeyFromBytesMutex.Lock()
   160  	defer fake.newPublicKeyFromBytesMutex.Unlock()
   161  	fake.NewPublicKeyFromBytesStub = nil
   162  	fake.newPublicKeyFromBytesReturns = struct {
   163  		result1 handlers.IssuerPublicKey
   164  		result2 error
   165  	}{result1, result2}
   166  }
   167  
   168  func (fake *Issuer) NewPublicKeyFromBytesReturnsOnCall(i int, result1 handlers.IssuerPublicKey, result2 error) {
   169  	fake.newPublicKeyFromBytesMutex.Lock()
   170  	defer fake.newPublicKeyFromBytesMutex.Unlock()
   171  	fake.NewPublicKeyFromBytesStub = nil
   172  	if fake.newPublicKeyFromBytesReturnsOnCall == nil {
   173  		fake.newPublicKeyFromBytesReturnsOnCall = make(map[int]struct {
   174  			result1 handlers.IssuerPublicKey
   175  			result2 error
   176  		})
   177  	}
   178  	fake.newPublicKeyFromBytesReturnsOnCall[i] = struct {
   179  		result1 handlers.IssuerPublicKey
   180  		result2 error
   181  	}{result1, result2}
   182  }
   183  
   184  func (fake *Issuer) Invocations() map[string][][]interface{} {
   185  	fake.invocationsMutex.RLock()
   186  	defer fake.invocationsMutex.RUnlock()
   187  	fake.newKeyMutex.RLock()
   188  	defer fake.newKeyMutex.RUnlock()
   189  	fake.newPublicKeyFromBytesMutex.RLock()
   190  	defer fake.newPublicKeyFromBytesMutex.RUnlock()
   191  	copiedInvocations := map[string][][]interface{}{}
   192  	for key, value := range fake.invocations {
   193  		copiedInvocations[key] = value
   194  	}
   195  	return copiedInvocations
   196  }
   197  
   198  func (fake *Issuer) recordInvocation(key string, args []interface{}) {
   199  	fake.invocationsMutex.Lock()
   200  	defer fake.invocationsMutex.Unlock()
   201  	if fake.invocations == nil {
   202  		fake.invocations = map[string][][]interface{}{}
   203  	}
   204  	if fake.invocations[key] == nil {
   205  		fake.invocations[key] = [][]interface{}{}
   206  	}
   207  	fake.invocations[key] = append(fake.invocations[key], args)
   208  }
   209  
   210  var _ handlers.Issuer = new(Issuer)