github.com/geofffranks/garden-linux@v0.0.0-20160715111146-26c893169cfa/network/bridgemgr/fake_bridge_manager/FakeBridgeManager.go (about)

     1  // This file was generated by counterfeiter
     2  package fake_bridge_manager
     3  
     4  import (
     5  	"net"
     6  	"sync"
     7  
     8  	"code.cloudfoundry.org/garden-linux/network/bridgemgr"
     9  )
    10  
    11  type FakeBridgeManager struct {
    12  	ReserveStub        func(subnet *net.IPNet, containerId string) (string, error)
    13  	reserveMutex       sync.RWMutex
    14  	reserveArgsForCall []struct {
    15  		subnet      *net.IPNet
    16  		containerId string
    17  	}
    18  	reserveReturns struct {
    19  		result1 string
    20  		result2 error
    21  	}
    22  	RereserveStub        func(bridgeName string, subnet *net.IPNet, containerId string) error
    23  	rereserveMutex       sync.RWMutex
    24  	rereserveArgsForCall []struct {
    25  		bridgeName  string
    26  		subnet      *net.IPNet
    27  		containerId string
    28  	}
    29  	rereserveReturns struct {
    30  		result1 error
    31  	}
    32  	ReleaseStub        func(bridgeName string, containerId string) error
    33  	releaseMutex       sync.RWMutex
    34  	releaseArgsForCall []struct {
    35  		bridgeName  string
    36  		containerId string
    37  	}
    38  	releaseReturns struct {
    39  		result1 error
    40  	}
    41  	PruneStub        func() error
    42  	pruneMutex       sync.RWMutex
    43  	pruneArgsForCall []struct{}
    44  	pruneReturns     struct {
    45  		result1 error
    46  	}
    47  }
    48  
    49  func (fake *FakeBridgeManager) Reserve(subnet *net.IPNet, containerId string) (string, error) {
    50  	fake.reserveMutex.Lock()
    51  	fake.reserveArgsForCall = append(fake.reserveArgsForCall, struct {
    52  		subnet      *net.IPNet
    53  		containerId string
    54  	}{subnet, containerId})
    55  	fake.reserveMutex.Unlock()
    56  	if fake.ReserveStub != nil {
    57  		return fake.ReserveStub(subnet, containerId)
    58  	} else {
    59  		return fake.reserveReturns.result1, fake.reserveReturns.result2
    60  	}
    61  }
    62  
    63  func (fake *FakeBridgeManager) ReserveCallCount() int {
    64  	fake.reserveMutex.RLock()
    65  	defer fake.reserveMutex.RUnlock()
    66  	return len(fake.reserveArgsForCall)
    67  }
    68  
    69  func (fake *FakeBridgeManager) ReserveArgsForCall(i int) (*net.IPNet, string) {
    70  	fake.reserveMutex.RLock()
    71  	defer fake.reserveMutex.RUnlock()
    72  	return fake.reserveArgsForCall[i].subnet, fake.reserveArgsForCall[i].containerId
    73  }
    74  
    75  func (fake *FakeBridgeManager) ReserveReturns(result1 string, result2 error) {
    76  	fake.ReserveStub = nil
    77  	fake.reserveReturns = struct {
    78  		result1 string
    79  		result2 error
    80  	}{result1, result2}
    81  }
    82  
    83  func (fake *FakeBridgeManager) Rereserve(bridgeName string, subnet *net.IPNet, containerId string) error {
    84  	fake.rereserveMutex.Lock()
    85  	fake.rereserveArgsForCall = append(fake.rereserveArgsForCall, struct {
    86  		bridgeName  string
    87  		subnet      *net.IPNet
    88  		containerId string
    89  	}{bridgeName, subnet, containerId})
    90  	fake.rereserveMutex.Unlock()
    91  	if fake.RereserveStub != nil {
    92  		return fake.RereserveStub(bridgeName, subnet, containerId)
    93  	} else {
    94  		return fake.rereserveReturns.result1
    95  	}
    96  }
    97  
    98  func (fake *FakeBridgeManager) RereserveCallCount() int {
    99  	fake.rereserveMutex.RLock()
   100  	defer fake.rereserveMutex.RUnlock()
   101  	return len(fake.rereserveArgsForCall)
   102  }
   103  
   104  func (fake *FakeBridgeManager) RereserveArgsForCall(i int) (string, *net.IPNet, string) {
   105  	fake.rereserveMutex.RLock()
   106  	defer fake.rereserveMutex.RUnlock()
   107  	return fake.rereserveArgsForCall[i].bridgeName, fake.rereserveArgsForCall[i].subnet, fake.rereserveArgsForCall[i].containerId
   108  }
   109  
   110  func (fake *FakeBridgeManager) RereserveReturns(result1 error) {
   111  	fake.RereserveStub = nil
   112  	fake.rereserveReturns = struct {
   113  		result1 error
   114  	}{result1}
   115  }
   116  
   117  func (fake *FakeBridgeManager) Release(bridgeName string, containerId string) error {
   118  	fake.releaseMutex.Lock()
   119  	fake.releaseArgsForCall = append(fake.releaseArgsForCall, struct {
   120  		bridgeName  string
   121  		containerId string
   122  	}{bridgeName, containerId})
   123  	fake.releaseMutex.Unlock()
   124  	if fake.ReleaseStub != nil {
   125  		return fake.ReleaseStub(bridgeName, containerId)
   126  	} else {
   127  		return fake.releaseReturns.result1
   128  	}
   129  }
   130  
   131  func (fake *FakeBridgeManager) ReleaseCallCount() int {
   132  	fake.releaseMutex.RLock()
   133  	defer fake.releaseMutex.RUnlock()
   134  	return len(fake.releaseArgsForCall)
   135  }
   136  
   137  func (fake *FakeBridgeManager) ReleaseArgsForCall(i int) (string, string) {
   138  	fake.releaseMutex.RLock()
   139  	defer fake.releaseMutex.RUnlock()
   140  	return fake.releaseArgsForCall[i].bridgeName, fake.releaseArgsForCall[i].containerId
   141  }
   142  
   143  func (fake *FakeBridgeManager) ReleaseReturns(result1 error) {
   144  	fake.ReleaseStub = nil
   145  	fake.releaseReturns = struct {
   146  		result1 error
   147  	}{result1}
   148  }
   149  
   150  func (fake *FakeBridgeManager) Prune() error {
   151  	fake.pruneMutex.Lock()
   152  	fake.pruneArgsForCall = append(fake.pruneArgsForCall, struct{}{})
   153  	fake.pruneMutex.Unlock()
   154  	if fake.PruneStub != nil {
   155  		return fake.PruneStub()
   156  	} else {
   157  		return fake.pruneReturns.result1
   158  	}
   159  }
   160  
   161  func (fake *FakeBridgeManager) PruneCallCount() int {
   162  	fake.pruneMutex.RLock()
   163  	defer fake.pruneMutex.RUnlock()
   164  	return len(fake.pruneArgsForCall)
   165  }
   166  
   167  func (fake *FakeBridgeManager) PruneReturns(result1 error) {
   168  	fake.PruneStub = nil
   169  	fake.pruneReturns = struct {
   170  		result1 error
   171  	}{result1}
   172  }
   173  
   174  var _ bridgemgr.BridgeManager = new(FakeBridgeManager)