github.com/yimialmonte/fabric@v2.1.1+incompatible/common/grpclogging/fakes/echo_service.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package fakes
     3  
     4  import (
     5  	"context"
     6  	"sync"
     7  
     8  	"github.com/hyperledger/fabric/common/grpclogging/testpb"
     9  )
    10  
    11  type EchoServiceServer struct {
    12  	EchoStub        func(context.Context, *testpb.Message) (*testpb.Message, error)
    13  	echoMutex       sync.RWMutex
    14  	echoArgsForCall []struct {
    15  		arg1 context.Context
    16  		arg2 *testpb.Message
    17  	}
    18  	echoReturns struct {
    19  		result1 *testpb.Message
    20  		result2 error
    21  	}
    22  	echoReturnsOnCall map[int]struct {
    23  		result1 *testpb.Message
    24  		result2 error
    25  	}
    26  	EchoStreamStub        func(testpb.EchoService_EchoStreamServer) error
    27  	echoStreamMutex       sync.RWMutex
    28  	echoStreamArgsForCall []struct {
    29  		arg1 testpb.EchoService_EchoStreamServer
    30  	}
    31  	echoStreamReturns struct {
    32  		result1 error
    33  	}
    34  	echoStreamReturnsOnCall map[int]struct {
    35  		result1 error
    36  	}
    37  	invocations      map[string][][]interface{}
    38  	invocationsMutex sync.RWMutex
    39  }
    40  
    41  func (fake *EchoServiceServer) Echo(arg1 context.Context, arg2 *testpb.Message) (*testpb.Message, error) {
    42  	fake.echoMutex.Lock()
    43  	ret, specificReturn := fake.echoReturnsOnCall[len(fake.echoArgsForCall)]
    44  	fake.echoArgsForCall = append(fake.echoArgsForCall, struct {
    45  		arg1 context.Context
    46  		arg2 *testpb.Message
    47  	}{arg1, arg2})
    48  	fake.recordInvocation("Echo", []interface{}{arg1, arg2})
    49  	fake.echoMutex.Unlock()
    50  	if fake.EchoStub != nil {
    51  		return fake.EchoStub(arg1, arg2)
    52  	}
    53  	if specificReturn {
    54  		return ret.result1, ret.result2
    55  	}
    56  	fakeReturns := fake.echoReturns
    57  	return fakeReturns.result1, fakeReturns.result2
    58  }
    59  
    60  func (fake *EchoServiceServer) EchoCallCount() int {
    61  	fake.echoMutex.RLock()
    62  	defer fake.echoMutex.RUnlock()
    63  	return len(fake.echoArgsForCall)
    64  }
    65  
    66  func (fake *EchoServiceServer) EchoCalls(stub func(context.Context, *testpb.Message) (*testpb.Message, error)) {
    67  	fake.echoMutex.Lock()
    68  	defer fake.echoMutex.Unlock()
    69  	fake.EchoStub = stub
    70  }
    71  
    72  func (fake *EchoServiceServer) EchoArgsForCall(i int) (context.Context, *testpb.Message) {
    73  	fake.echoMutex.RLock()
    74  	defer fake.echoMutex.RUnlock()
    75  	argsForCall := fake.echoArgsForCall[i]
    76  	return argsForCall.arg1, argsForCall.arg2
    77  }
    78  
    79  func (fake *EchoServiceServer) EchoReturns(result1 *testpb.Message, result2 error) {
    80  	fake.echoMutex.Lock()
    81  	defer fake.echoMutex.Unlock()
    82  	fake.EchoStub = nil
    83  	fake.echoReturns = struct {
    84  		result1 *testpb.Message
    85  		result2 error
    86  	}{result1, result2}
    87  }
    88  
    89  func (fake *EchoServiceServer) EchoReturnsOnCall(i int, result1 *testpb.Message, result2 error) {
    90  	fake.echoMutex.Lock()
    91  	defer fake.echoMutex.Unlock()
    92  	fake.EchoStub = nil
    93  	if fake.echoReturnsOnCall == nil {
    94  		fake.echoReturnsOnCall = make(map[int]struct {
    95  			result1 *testpb.Message
    96  			result2 error
    97  		})
    98  	}
    99  	fake.echoReturnsOnCall[i] = struct {
   100  		result1 *testpb.Message
   101  		result2 error
   102  	}{result1, result2}
   103  }
   104  
   105  func (fake *EchoServiceServer) EchoStream(arg1 testpb.EchoService_EchoStreamServer) error {
   106  	fake.echoStreamMutex.Lock()
   107  	ret, specificReturn := fake.echoStreamReturnsOnCall[len(fake.echoStreamArgsForCall)]
   108  	fake.echoStreamArgsForCall = append(fake.echoStreamArgsForCall, struct {
   109  		arg1 testpb.EchoService_EchoStreamServer
   110  	}{arg1})
   111  	fake.recordInvocation("EchoStream", []interface{}{arg1})
   112  	fake.echoStreamMutex.Unlock()
   113  	if fake.EchoStreamStub != nil {
   114  		return fake.EchoStreamStub(arg1)
   115  	}
   116  	if specificReturn {
   117  		return ret.result1
   118  	}
   119  	fakeReturns := fake.echoStreamReturns
   120  	return fakeReturns.result1
   121  }
   122  
   123  func (fake *EchoServiceServer) EchoStreamCallCount() int {
   124  	fake.echoStreamMutex.RLock()
   125  	defer fake.echoStreamMutex.RUnlock()
   126  	return len(fake.echoStreamArgsForCall)
   127  }
   128  
   129  func (fake *EchoServiceServer) EchoStreamCalls(stub func(testpb.EchoService_EchoStreamServer) error) {
   130  	fake.echoStreamMutex.Lock()
   131  	defer fake.echoStreamMutex.Unlock()
   132  	fake.EchoStreamStub = stub
   133  }
   134  
   135  func (fake *EchoServiceServer) EchoStreamArgsForCall(i int) testpb.EchoService_EchoStreamServer {
   136  	fake.echoStreamMutex.RLock()
   137  	defer fake.echoStreamMutex.RUnlock()
   138  	argsForCall := fake.echoStreamArgsForCall[i]
   139  	return argsForCall.arg1
   140  }
   141  
   142  func (fake *EchoServiceServer) EchoStreamReturns(result1 error) {
   143  	fake.echoStreamMutex.Lock()
   144  	defer fake.echoStreamMutex.Unlock()
   145  	fake.EchoStreamStub = nil
   146  	fake.echoStreamReturns = struct {
   147  		result1 error
   148  	}{result1}
   149  }
   150  
   151  func (fake *EchoServiceServer) EchoStreamReturnsOnCall(i int, result1 error) {
   152  	fake.echoStreamMutex.Lock()
   153  	defer fake.echoStreamMutex.Unlock()
   154  	fake.EchoStreamStub = nil
   155  	if fake.echoStreamReturnsOnCall == nil {
   156  		fake.echoStreamReturnsOnCall = make(map[int]struct {
   157  			result1 error
   158  		})
   159  	}
   160  	fake.echoStreamReturnsOnCall[i] = struct {
   161  		result1 error
   162  	}{result1}
   163  }
   164  
   165  func (fake *EchoServiceServer) Invocations() map[string][][]interface{} {
   166  	fake.invocationsMutex.RLock()
   167  	defer fake.invocationsMutex.RUnlock()
   168  	fake.echoMutex.RLock()
   169  	defer fake.echoMutex.RUnlock()
   170  	fake.echoStreamMutex.RLock()
   171  	defer fake.echoStreamMutex.RUnlock()
   172  	copiedInvocations := map[string][][]interface{}{}
   173  	for key, value := range fake.invocations {
   174  		copiedInvocations[key] = value
   175  	}
   176  	return copiedInvocations
   177  }
   178  
   179  func (fake *EchoServiceServer) recordInvocation(key string, args []interface{}) {
   180  	fake.invocationsMutex.Lock()
   181  	defer fake.invocationsMutex.Unlock()
   182  	if fake.invocations == nil {
   183  		fake.invocations = map[string][][]interface{}{}
   184  	}
   185  	if fake.invocations[key] == nil {
   186  		fake.invocations[key] = [][]interface{}{}
   187  	}
   188  	fake.invocations[key] = append(fake.invocations[key], args)
   189  }