// Code generated by counterfeiter. DO NOT EDIT.
package mocks

import (
	"sync"

	"github.com/hyperledger/fabric/core/comm"
	"google.golang.org/grpc"
)

type ConnectionProducer struct {
	GetEndpointsStub        func() []comm.EndpointCriteria
	getEndpointsMutex       sync.RWMutex
	getEndpointsArgsForCall []struct {
	}
	getEndpointsReturns struct {
		result1 []comm.EndpointCriteria
	}
	getEndpointsReturnsOnCall map[int]struct {
		result1 []comm.EndpointCriteria
	}
	NewConnectionStub        func() (*grpc.ClientConn, string, error)
	newConnectionMutex       sync.RWMutex
	newConnectionArgsForCall []struct {
	}
	newConnectionReturns struct {
		result1 *grpc.ClientConn
		result2 string
		result3 error
	}
	newConnectionReturnsOnCall map[int]struct {
		result1 *grpc.ClientConn
		result2 string
		result3 error
	}
	UpdateEndpointsStub        func([]comm.EndpointCriteria)
	updateEndpointsMutex       sync.RWMutex
	updateEndpointsArgsForCall []struct {
		arg1 []comm.EndpointCriteria
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *ConnectionProducer) GetEndpoints() []comm.EndpointCriteria {
	fake.getEndpointsMutex.Lock()
	ret, specificReturn := fake.getEndpointsReturnsOnCall[len(fake.getEndpointsArgsForCall)]
	fake.getEndpointsArgsForCall = append(fake.getEndpointsArgsForCall, struct {
	}{})
	fake.recordInvocation("GetEndpoints", []interface{}{})
	fake.getEndpointsMutex.Unlock()
	if fake.GetEndpointsStub != nil {
		return fake.GetEndpointsStub()
	}
	if specificReturn {
		return ret.result1
	}
	fakeReturns := fake.getEndpointsReturns
	return fakeReturns.result1
}

func (fake *ConnectionProducer) GetEndpointsCallCount() int {
	fake.getEndpointsMutex.RLock()
	defer fake.getEndpointsMutex.RUnlock()
	return len(fake.getEndpointsArgsForCall)
}

func (fake *ConnectionProducer) GetEndpointsCalls(stub func() []comm.EndpointCriteria) {
	fake.getEndpointsMutex.Lock()
	defer fake.getEndpointsMutex.Unlock()
	fake.GetEndpointsStub = stub
}

func (fake *ConnectionProducer) GetEndpointsReturns(result1 []comm.EndpointCriteria) {
	fake.getEndpointsMutex.Lock()
	defer fake.getEndpointsMutex.Unlock()
	fake.GetEndpointsStub = nil
	fake.getEndpointsReturns = struct {
		result1 []comm.EndpointCriteria
	}{result1}
}

func (fake *ConnectionProducer) GetEndpointsReturnsOnCall(i int, result1 []comm.EndpointCriteria) {
	fake.getEndpointsMutex.Lock()
	defer fake.getEndpointsMutex.Unlock()
	fake.GetEndpointsStub = nil
	if fake.getEndpointsReturnsOnCall == nil {
		fake.getEndpointsReturnsOnCall = make(map[int]struct {
			result1 []comm.EndpointCriteria
		})
	}
	fake.getEndpointsReturnsOnCall[i] = struct {
		result1 []comm.EndpointCriteria
	}{result1}
}

func (fake *ConnectionProducer) NewConnection() (*grpc.ClientConn, string, error) {
	fake.newConnectionMutex.Lock()
	ret, specificReturn := fake.newConnectionReturnsOnCall[len(fake.newConnectionArgsForCall)]
	fake.newConnectionArgsForCall = append(fake.newConnectionArgsForCall, struct {
	}{})
	fake.recordInvocation("NewConnection", []interface{}{})
	fake.newConnectionMutex.Unlock()
	if fake.NewConnectionStub != nil {
		return fake.NewConnectionStub()
	}
	if specificReturn {
		return ret.result1, ret.result2, ret.result3
	}
	fakeReturns := fake.newConnectionReturns
	return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3
}

func (fake *ConnectionProducer) NewConnectionCallCount() int {
	fake.newConnectionMutex.RLock()
	defer fake.newConnectionMutex.RUnlock()
	return len(fake.newConnectionArgsForCall)
}

func (fake *ConnectionProducer) NewConnectionCalls(stub func() (*grpc.ClientConn, string, error)) {
	fake.newConnectionMutex.Lock()
	defer fake.newConnectionMutex.Unlock()
	fake.NewConnectionStub = stub
}

func (fake *ConnectionProducer) NewConnectionReturns(result1 *grpc.ClientConn, result2 string, result3 error) {
	fake.newConnectionMutex.Lock()
	defer fake.newConnectionMutex.Unlock()
	fake.NewConnectionStub = nil
	fake.newConnectionReturns = struct {
		result1 *grpc.ClientConn
		result2 string
		result3 error
	}{result1, result2, result3}
}

func (fake *ConnectionProducer) NewConnectionReturnsOnCall(i int, result1 *grpc.ClientConn, result2 string, result3 error) {
	fake.newConnectionMutex.Lock()
	defer fake.newConnectionMutex.Unlock()
	fake.NewConnectionStub = nil
	if fake.newConnectionReturnsOnCall == nil {
		fake.newConnectionReturnsOnCall = make(map[int]struct {
			result1 *grpc.ClientConn
			result2 string
			result3 error
		})
	}
	fake.newConnectionReturnsOnCall[i] = struct {
		result1 *grpc.ClientConn
		result2 string
		result3 error
	}{result1, result2, result3}
}

func (fake *ConnectionProducer) UpdateEndpoints(arg1 []comm.EndpointCriteria) {
	var arg1Copy []comm.EndpointCriteria
	if arg1 != nil {
		arg1Copy = make([]comm.EndpointCriteria, len(arg1))
		copy(arg1Copy, arg1)
	}
	fake.updateEndpointsMutex.Lock()
	fake.updateEndpointsArgsForCall = append(fake.updateEndpointsArgsForCall, struct {
		arg1 []comm.EndpointCriteria
	}{arg1Copy})
	fake.recordInvocation("UpdateEndpoints", []interface{}{arg1Copy})
	fake.updateEndpointsMutex.Unlock()
	if fake.UpdateEndpointsStub != nil {
		fake.UpdateEndpointsStub(arg1)
	}
}

func (fake *ConnectionProducer) UpdateEndpointsCallCount() int {
	fake.updateEndpointsMutex.RLock()
	defer fake.updateEndpointsMutex.RUnlock()
	return len(fake.updateEndpointsArgsForCall)
}

func (fake *ConnectionProducer) UpdateEndpointsCalls(stub func([]comm.EndpointCriteria)) {
	fake.updateEndpointsMutex.Lock()
	defer fake.updateEndpointsMutex.Unlock()
	fake.UpdateEndpointsStub = stub
}

func (fake *ConnectionProducer) UpdateEndpointsArgsForCall(i int) []comm.EndpointCriteria {
	fake.updateEndpointsMutex.RLock()
	defer fake.updateEndpointsMutex.RUnlock()
	argsForCall := fake.updateEndpointsArgsForCall[i]
	return argsForCall.arg1
}

func (fake *ConnectionProducer) Invocations() map[string][][]interface{} {
	fake.invocationsMutex.RLock()
	defer fake.invocationsMutex.RUnlock()
	fake.getEndpointsMutex.RLock()
	defer fake.getEndpointsMutex.RUnlock()
	fake.newConnectionMutex.RLock()
	defer fake.newConnectionMutex.RUnlock()
	fake.updateEndpointsMutex.RLock()
	defer fake.updateEndpointsMutex.RUnlock()
	copiedInvocations := map[string][][]interface{}{}
	for key, value := range fake.invocations {
		copiedInvocations[key] = value
	}
	return copiedInvocations
}

func (fake *ConnectionProducer) recordInvocation(key string, args []interface{}) {
	fake.invocationsMutex.Lock()
	defer fake.invocationsMutex.Unlock()
	if fake.invocations == nil {
		fake.invocations = map[string][][]interface{}{}
	}
	if fake.invocations[key] == nil {
		fake.invocations[key] = [][]interface{}{}
	}
	fake.invocations[key] = append(fake.invocations[key], args)
}
