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

import (
	"sync"
)

type PortAllocator struct {
	AllocatePortStub        func(string, uint32) (uint32, error)
	allocatePortMutex       sync.RWMutex
	allocatePortArgsForCall []struct {
		arg1 string
		arg2 uint32
	}
	allocatePortReturns struct {
		result1 uint32
		result2 error
	}
	allocatePortReturnsOnCall map[int]struct {
		result1 uint32
		result2 error
	}
	ReleaseAllPortsStub        func(string) error
	releaseAllPortsMutex       sync.RWMutex
	releaseAllPortsArgsForCall []struct {
		arg1 string
	}
	releaseAllPortsReturns struct {
		result1 error
	}
	releaseAllPortsReturnsOnCall map[int]struct {
		result1 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *PortAllocator) AllocatePort(arg1 string, arg2 uint32) (uint32, error) {
	fake.allocatePortMutex.Lock()
	ret, specificReturn := fake.allocatePortReturnsOnCall[len(fake.allocatePortArgsForCall)]
	fake.allocatePortArgsForCall = append(fake.allocatePortArgsForCall, struct {
		arg1 string
		arg2 uint32
	}{arg1, arg2})
	stub := fake.AllocatePortStub
	fakeReturns := fake.allocatePortReturns
	fake.recordInvocation("AllocatePort", []interface{}{arg1, arg2})
	fake.allocatePortMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *PortAllocator) AllocatePortCallCount() int {
	fake.allocatePortMutex.RLock()
	defer fake.allocatePortMutex.RUnlock()
	return len(fake.allocatePortArgsForCall)
}

func (fake *PortAllocator) AllocatePortCalls(stub func(string, uint32) (uint32, error)) {
	fake.allocatePortMutex.Lock()
	defer fake.allocatePortMutex.Unlock()
	fake.AllocatePortStub = stub
}

func (fake *PortAllocator) AllocatePortArgsForCall(i int) (string, uint32) {
	fake.allocatePortMutex.RLock()
	defer fake.allocatePortMutex.RUnlock()
	argsForCall := fake.allocatePortArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2
}

func (fake *PortAllocator) AllocatePortReturns(result1 uint32, result2 error) {
	fake.allocatePortMutex.Lock()
	defer fake.allocatePortMutex.Unlock()
	fake.AllocatePortStub = nil
	fake.allocatePortReturns = struct {
		result1 uint32
		result2 error
	}{result1, result2}
}

func (fake *PortAllocator) AllocatePortReturnsOnCall(i int, result1 uint32, result2 error) {
	fake.allocatePortMutex.Lock()
	defer fake.allocatePortMutex.Unlock()
	fake.AllocatePortStub = nil
	if fake.allocatePortReturnsOnCall == nil {
		fake.allocatePortReturnsOnCall = make(map[int]struct {
			result1 uint32
			result2 error
		})
	}
	fake.allocatePortReturnsOnCall[i] = struct {
		result1 uint32
		result2 error
	}{result1, result2}
}

func (fake *PortAllocator) ReleaseAllPorts(arg1 string) error {
	fake.releaseAllPortsMutex.Lock()
	ret, specificReturn := fake.releaseAllPortsReturnsOnCall[len(fake.releaseAllPortsArgsForCall)]
	fake.releaseAllPortsArgsForCall = append(fake.releaseAllPortsArgsForCall, struct {
		arg1 string
	}{arg1})
	stub := fake.ReleaseAllPortsStub
	fakeReturns := fake.releaseAllPortsReturns
	fake.recordInvocation("ReleaseAllPorts", []interface{}{arg1})
	fake.releaseAllPortsMutex.Unlock()
	if stub != nil {
		return stub(arg1)
	}
	if specificReturn {
		return ret.result1
	}
	return fakeReturns.result1
}

func (fake *PortAllocator) ReleaseAllPortsCallCount() int {
	fake.releaseAllPortsMutex.RLock()
	defer fake.releaseAllPortsMutex.RUnlock()
	return len(fake.releaseAllPortsArgsForCall)
}

func (fake *PortAllocator) ReleaseAllPortsCalls(stub func(string) error) {
	fake.releaseAllPortsMutex.Lock()
	defer fake.releaseAllPortsMutex.Unlock()
	fake.ReleaseAllPortsStub = stub
}

func (fake *PortAllocator) ReleaseAllPortsArgsForCall(i int) string {
	fake.releaseAllPortsMutex.RLock()
	defer fake.releaseAllPortsMutex.RUnlock()
	argsForCall := fake.releaseAllPortsArgsForCall[i]
	return argsForCall.arg1
}

func (fake *PortAllocator) ReleaseAllPortsReturns(result1 error) {
	fake.releaseAllPortsMutex.Lock()
	defer fake.releaseAllPortsMutex.Unlock()
	fake.ReleaseAllPortsStub = nil
	fake.releaseAllPortsReturns = struct {
		result1 error
	}{result1}
}

func (fake *PortAllocator) ReleaseAllPortsReturnsOnCall(i int, result1 error) {
	fake.releaseAllPortsMutex.Lock()
	defer fake.releaseAllPortsMutex.Unlock()
	fake.ReleaseAllPortsStub = nil
	if fake.releaseAllPortsReturnsOnCall == nil {
		fake.releaseAllPortsReturnsOnCall = make(map[int]struct {
			result1 error
		})
	}
	fake.releaseAllPortsReturnsOnCall[i] = struct {
		result1 error
	}{result1}
}

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

func (fake *PortAllocator) 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)
}
