From db7943857bbf56812d606a5a204067cd1df40889 Mon Sep 17 00:00:00 2001 From: Sauli Tähkäpää Date: Tue, 4 Mar 2014 11:03:45 +0200 Subject: Refactored TB3 test ip address whitelisting. Change-Id: I7f9aae8ed3ea163b19d92caa652313dfc2c4a159 --- .../com/vaadin/tests/tb3/PrivateTB3Configuration.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'uitest/src/com/vaadin') diff --git a/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java b/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java index 543484fc14..400a2fe429 100644 --- a/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java +++ b/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java @@ -120,20 +120,19 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test { Enumeration interfaces = NetworkInterface .getNetworkInterfaces(); while (interfaces.hasMoreElements()) { - NetworkInterface current = interfaces.nextElement(); - if (!current.isUp() || current.isLoopback() - || current.isVirtual()) { + NetworkInterface nwInterface = interfaces.nextElement(); + if (!nwInterface.isUp() || nwInterface.isLoopback() + || nwInterface.isVirtual()) { continue; } - Enumeration addresses = current.getInetAddresses(); + Enumeration addresses = nwInterface.getInetAddresses(); while (addresses.hasMoreElements()) { - InetAddress current_addr = addresses.nextElement(); - if (current_addr.isLoopbackAddress()) { + InetAddress address = addresses.nextElement(); + if (address.isLoopbackAddress()) { continue; } - String hostAddress = current_addr.getHostAddress(); - if (hostAddress.startsWith("192.168.")) { - return hostAddress; + if (address.isSiteLocalAddress()) { + return address.getHostAddress(); } } } @@ -142,7 +141,7 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test { } throw new RuntimeException( - "No compatible (192.168.*) ip address found."); + "No compatible (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) ip address found."); } /* -- cgit v1.2.3