public static InetAddress getLocalhostInetAddress() { return BrooklynNetworkUtils.getLocalhostInetAddress(); }
private void assertTemplateValues(File template) throws IOException { String expectedHostname = BrooklynNetworkUtils.getLocalhostInetAddress().getHostName(); String expectedIp = BrooklynNetworkUtils.getLocalhostInetAddress().getHostAddress(); Map<?,?> data = (Map) Iterables.getOnlyElement(Yamls.parseAll(Files.toString(template, Charsets.UTF_8))); Assert.assertEquals(data.size(), 3); Assert.assertEquals(data.get("entity.hostname"), expectedHostname); Assert.assertEquals(data.get("entity.address"), expectedIp); Assert.assertEquals(data.get("frogs"), 12); }
@Test public void defaultInvocationCanProvisionALocalhostInstance() throws Exception { LocalhostMachineProvisioningLocation provisioner = mgmt.getLocationManager().createLocation(LocationSpec.create(LocalhostMachineProvisioningLocation.class)); SshMachineLocation machine = provisioner.obtain(); assertNotNull(machine); assertEquals(machine.getAddress(), BrooklynNetworkUtils.getLocalhostInetAddress()); }