github.com/schwarzm/garden-linux@v0.0.0-20150507151835-33bca2147c47/container_pool/fake_subnet_pool/FakeSubnetPool.go (about)

     1  // This file was generated by counterfeiter
     2  package fake_subnet_pool
     3  
     4  import (
     5  	"sync"
     6  
     7  	"github.com/cloudfoundry-incubator/garden-linux/container_pool"
     8  	"github.com/cloudfoundry-incubator/garden-linux/linux_backend"
     9  	"github.com/cloudfoundry-incubator/garden-linux/network/subnets"
    10  )
    11  
    12  type FakeSubnetPool struct {
    13  	AcquireStub        func(subnet subnets.SubnetSelector, ip subnets.IPSelector) (*linux_backend.Network, error)
    14  	acquireMutex       sync.RWMutex
    15  	acquireArgsForCall []struct {
    16  		subnet subnets.SubnetSelector
    17  		ip     subnets.IPSelector
    18  	}
    19  	acquireReturns struct {
    20  		result1 *linux_backend.Network
    21  		result2 error
    22  	}
    23  	ReleaseStub        func(*linux_backend.Network) error
    24  	releaseMutex       sync.RWMutex
    25  	releaseArgsForCall []struct {
    26  		arg1 *linux_backend.Network
    27  	}
    28  	releaseReturns struct {
    29  		result1 error
    30  	}
    31  	RemoveStub        func(*linux_backend.Network) error
    32  	removeMutex       sync.RWMutex
    33  	removeArgsForCall []struct {
    34  		arg1 *linux_backend.Network
    35  	}
    36  	removeReturns struct {
    37  		result1 error
    38  	}
    39  	CapacityStub        func() int
    40  	capacityMutex       sync.RWMutex
    41  	capacityArgsForCall []struct{}
    42  	capacityReturns     struct {
    43  		result1 int
    44  	}
    45  }
    46  
    47  func (fake *FakeSubnetPool) Acquire(subnet subnets.SubnetSelector, ip subnets.IPSelector) (*linux_backend.Network, error) {
    48  	fake.acquireMutex.Lock()
    49  	fake.acquireArgsForCall = append(fake.acquireArgsForCall, struct {
    50  		subnet subnets.SubnetSelector
    51  		ip     subnets.IPSelector
    52  	}{subnet, ip})
    53  	fake.acquireMutex.Unlock()
    54  	if fake.AcquireStub != nil {
    55  		return fake.AcquireStub(subnet, ip)
    56  	} else {
    57  		return fake.acquireReturns.result1, fake.acquireReturns.result2
    58  	}
    59  }
    60  
    61  func (fake *FakeSubnetPool) AcquireCallCount() int {
    62  	fake.acquireMutex.RLock()
    63  	defer fake.acquireMutex.RUnlock()
    64  	return len(fake.acquireArgsForCall)
    65  }
    66  
    67  func (fake *FakeSubnetPool) AcquireArgsForCall(i int) (subnets.SubnetSelector, subnets.IPSelector) {
    68  	fake.acquireMutex.RLock()
    69  	defer fake.acquireMutex.RUnlock()
    70  	return fake.acquireArgsForCall[i].subnet, fake.acquireArgsForCall[i].ip
    71  }
    72  
    73  func (fake *FakeSubnetPool) AcquireReturns(result1 *linux_backend.Network, result2 error) {
    74  	fake.AcquireStub = nil
    75  	fake.acquireReturns = struct {
    76  		result1 *linux_backend.Network
    77  		result2 error
    78  	}{result1, result2}
    79  }
    80  
    81  func (fake *FakeSubnetPool) Release(arg1 *linux_backend.Network) error {
    82  	fake.releaseMutex.Lock()
    83  	fake.releaseArgsForCall = append(fake.releaseArgsForCall, struct {
    84  		arg1 *linux_backend.Network
    85  	}{arg1})
    86  	fake.releaseMutex.Unlock()
    87  	if fake.ReleaseStub != nil {
    88  		return fake.ReleaseStub(arg1)
    89  	} else {
    90  		return fake.releaseReturns.result1
    91  	}
    92  }
    93  
    94  func (fake *FakeSubnetPool) ReleaseCallCount() int {
    95  	fake.releaseMutex.RLock()
    96  	defer fake.releaseMutex.RUnlock()
    97  	return len(fake.releaseArgsForCall)
    98  }
    99  
   100  func (fake *FakeSubnetPool) ReleaseArgsForCall(i int) *linux_backend.Network {
   101  	fake.releaseMutex.RLock()
   102  	defer fake.releaseMutex.RUnlock()
   103  	return fake.releaseArgsForCall[i].arg1
   104  }
   105  
   106  func (fake *FakeSubnetPool) ReleaseReturns(result1 error) {
   107  	fake.ReleaseStub = nil
   108  	fake.releaseReturns = struct {
   109  		result1 error
   110  	}{result1}
   111  }
   112  
   113  func (fake *FakeSubnetPool) Remove(arg1 *linux_backend.Network) error {
   114  	fake.removeMutex.Lock()
   115  	fake.removeArgsForCall = append(fake.removeArgsForCall, struct {
   116  		arg1 *linux_backend.Network
   117  	}{arg1})
   118  	fake.removeMutex.Unlock()
   119  	if fake.RemoveStub != nil {
   120  		return fake.RemoveStub(arg1)
   121  	} else {
   122  		return fake.removeReturns.result1
   123  	}
   124  }
   125  
   126  func (fake *FakeSubnetPool) RemoveCallCount() int {
   127  	fake.removeMutex.RLock()
   128  	defer fake.removeMutex.RUnlock()
   129  	return len(fake.removeArgsForCall)
   130  }
   131  
   132  func (fake *FakeSubnetPool) RemoveArgsForCall(i int) *linux_backend.Network {
   133  	fake.removeMutex.RLock()
   134  	defer fake.removeMutex.RUnlock()
   135  	return fake.removeArgsForCall[i].arg1
   136  }
   137  
   138  func (fake *FakeSubnetPool) RemoveReturns(result1 error) {
   139  	fake.RemoveStub = nil
   140  	fake.removeReturns = struct {
   141  		result1 error
   142  	}{result1}
   143  }
   144  
   145  func (fake *FakeSubnetPool) Capacity() int {
   146  	fake.capacityMutex.Lock()
   147  	fake.capacityArgsForCall = append(fake.capacityArgsForCall, struct{}{})
   148  	fake.capacityMutex.Unlock()
   149  	if fake.CapacityStub != nil {
   150  		return fake.CapacityStub()
   151  	} else {
   152  		return fake.capacityReturns.result1
   153  	}
   154  }
   155  
   156  func (fake *FakeSubnetPool) CapacityCallCount() int {
   157  	fake.capacityMutex.RLock()
   158  	defer fake.capacityMutex.RUnlock()
   159  	return len(fake.capacityArgsForCall)
   160  }
   161  
   162  func (fake *FakeSubnetPool) CapacityReturns(result1 int) {
   163  	fake.CapacityStub = nil
   164  	fake.capacityReturns = struct {
   165  		result1 int
   166  	}{result1}
   167  }
   168  
   169  var _ container_pool.SubnetPool = new(FakeSubnetPool)