Author: ron.sigal(a)jboss.com
Date: 2008-06-27 21:30:04 -0400 (Fri, 27 Jun 2008)
New Revision: 4330
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/bisocket/timertask/TimerTaskTestCase.java
Log:
JBREM-1005: Tests pass trivially if Timer.purge() doesn't exist.
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/bisocket/timertask/TimerTaskTestCase.java
===================================================================
---
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/bisocket/timertask/TimerTaskTestCase.java 2008-06-28
01:29:29 UTC (rev 4329)
+++
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/bisocket/timertask/TimerTaskTestCase.java 2008-06-28
01:30:04 UTC (rev 4330)
@@ -22,6 +22,7 @@
package org.jboss.test.remoting.transport.bisocket.timertask;
import java.lang.reflect.Field;
+import java.lang.reflect.Method;
import java.net.InetAddress;
import java.util.HashMap;
import java.util.Map;
@@ -52,6 +53,7 @@
import org.jboss.remoting.transport.bisocket.Bisocket;
import org.jboss.remoting.transport.bisocket.BisocketClientInvoker;
import org.jboss.remoting.transport.bisocket.BisocketServerInvoker;
+import org.jboss.remoting.util.SecurityUtility;
/**
@@ -68,6 +70,7 @@
private static Logger log = Logger.getLogger(TimerTaskTestCase.class);
private static boolean firstTime = true;
+ private static boolean purgeMethodAvailable;
protected String host;
protected int port;
@@ -87,7 +90,17 @@
String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
PatternLayout layout = new PatternLayout(pattern);
ConsoleAppender consoleAppender = new ConsoleAppender(layout);
- Logger.getRootLogger().addAppender(consoleAppender);
+ Logger.getRootLogger().addAppender(consoleAppender);
+
+ try
+ {
+ Method purge = SecurityUtility.getDeclaredMethod(Timer.class,
"purge", new Class[]{});
+ purgeMethodAvailable = true;
+ }
+ catch (Exception e)
+ {
+ log.info("Timer.purge() is not available: must be running with jdk
1.4");
+ }
}
}
@@ -101,6 +114,12 @@
{
log.info("entering " + getName());
+ if (!purgeMethodAvailable)
+ {
+ log.info(getName() + " PASSES (trivially)");
+ return;
+ }
+
// Start server.
setupServer("0");
@@ -159,6 +178,12 @@
{
log.info("entering " + getName());
+ if (!purgeMethodAvailable)
+ {
+ log.info(getName() + " PASSES (trivially)");
+ return;
+ }
+
// Start server.
setupServer("20");
Show replies by date