Author: ron.sigal(a)jboss.com
Date: 2008-04-24 03:59:35 -0400 (Thu, 24 Apr 2008)
New Revision: 4060
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/ipv6/IPv6TestCase.java
Log:
JBREM-930: Skips tests if IPv6 is unavailable.
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/ipv6/IPv6TestCase.java
===================================================================
---
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/ipv6/IPv6TestCase.java 2008-04-24
06:56:24 UTC (rev 4059)
+++
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/ipv6/IPv6TestCase.java 2008-04-24
07:59:35 UTC (rev 4060)
@@ -64,6 +64,7 @@
private static Logger log = Logger.getLogger(IPv6TestCase.class);
private static boolean firstTime = true;
+ private static boolean ipv6IsAvailable = true;
// remoting server connector
private Connector connector;
@@ -83,6 +84,21 @@
ConsoleAppender consoleAppender = new ConsoleAppender(layout);
Logger.getRootLogger().addAppender(consoleAppender);
log.info("java.version: " +
System.getProperty("java.version"));
+
+ try
+ {
+ InetAddress addr = InetAddress.getByName("[::1]");
+ new ServerSocket(3333, 200, addr);
+ }
+ catch (Exception e)
+ {
+ if ("Protocol family unavailable".equalsIgnoreCase(e.getMessage())
||
+ "Protocol family not
supported".equalsIgnoreCase(e.getMessage()))
+ {
+ ipv6IsAvailable = false;
+ log.info("ipV6 is not available");
+ }
+ }
}
}
@@ -95,6 +111,8 @@
public void testRawIPv6() throws Throwable
{
log.info("entering " + getName());
+ if (!ipv6IsAvailable) return;
+
final InetAddress addr = InetAddress.getByName("[::1]");
new Thread()
@@ -136,6 +154,8 @@
public void testRemotingIPv6Loopback() throws Throwable
{
log.info("entering " + getName());
+ if (!ipv6IsAvailable) return;
+
doRemotingTest("[::1]");
log.info(getName() + " PASSES");
}
@@ -144,6 +164,7 @@
public void testRemotingIPv6Any() throws Throwable
{
log.info("entering " + getName());
+ if (!ipv6IsAvailable) return;
doRemotingTest("[::]");
log.info(getName() + " PASSES");
}
@@ -151,6 +172,7 @@
public void testRemotingIPv4Mapped() throws Throwable
{
+ if (!ipv6IsAvailable) return;
doRemotingTest("[::ffff:127.0.0.1]");
}
Show replies by date