LocalhostMachineProvisioningLocation extends FixedListMachineProvisioningLocation<SshMachineLocation> implements AddressableLocation, LocationWithObjectStore { @Override public InetAddress getAddress() { return address; } LocalhostMachineProvisioningLocation(); @Deprecated  LocalhostMachineProvisioningLocation(Map<?,?> properties);  LocalhostMachineProvisioningLocation(String name);  LocalhostMachineProvisioningLocation(String name, int count); @VisibleForTesting static void clearStaticData(); static LocationSpec<LocalhostMachineProvisioningLocation> spec(); @Override LocalhostMachineProvisioningLocation configure(Map<?,?> flags); static InetAddress getLocalhostInetAddress(); @Override InetAddress getAddress(); @Override boolean canProvisionMore(); static boolean obtainSpecificPort(InetAddress localAddress, int portNumber); static synchronized boolean obtainSpecificPort(InetAddress localAddress, int portNumber, Boolean reuseAddr); static boolean checkPortAvailable(InetAddress localAddress, int portNumber); static boolean checkPortAvailable(InetAddress localAddress, int portNumber, Boolean reuseAddr); static int obtainPort(PortRange range); static int obtainPort(PortRange range, Boolean reuseAddr); static int obtainPort(InetAddress localAddress, PortRange range); static int obtainPort(InetAddress localAddress, PortRange range, Boolean reuseAddr); static synchronized void releasePort(InetAddress localAddress, int portNumber); @Override void release(SshMachineLocation machine); static boolean isSudoAllowed(); @Override PersistenceObjectStore newPersistenceObjectStore(String container); static final ConfigKey<Boolean> SKIP_ON_BOX_BASE_DIR_RESOLUTION; }
@Test public void testUsesLocationNameProvided() throws Exception { LocalhostMachineProvisioningLocation provisioner = newLocalhostProvisionerWithAddress("localhost"); assertEquals(provisioner.obtain().getAddress().getHostName(), "localhost"); LocalhostMachineProvisioningLocation provisioner2 = newLocalhostProvisionerWithAddress("1.2.3.4"); assertEquals(provisioner2.obtain().getAddress().getHostName(), "1.2.3.4"); LocalhostMachineProvisioningLocation provisioner3 = newLocalhostProvisionerWithAddress("127.0.0.1"); assertEquals(provisioner3.obtain().getAddress().getHostName(), "127.0.0.1"); }