Author: ron.sigal(a)jboss.com
Date: 2008-06-27 21:39:06 -0400 (Fri, 27 Jun 2008)
New Revision: 4333
Modified:
remoting2/branches/2.2/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.2/src/tests/org/jboss/test/remoting/transport/bisocket/timertask/TimerTaskTestCase.java
===================================================================
---
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bisocket/timertask/TimerTaskTestCase.java 2008-06-28
01:35:55 UTC (rev 4332)
+++
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bisocket/timertask/TimerTaskTestCase.java 2008-06-28
01:39:06 UTC (rev 4333)
@@ -68,6 +68,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 +88,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
+ {
+ Timer.class.getDeclaredMethod("purge", new Class[]{});
+ purgeMethodAvailable = true;
+ }
+ catch (Exception e)
+ {
+ log.info("Timer.purge() is not available: must be running with jdk
1.4");
+ }
}
}
@@ -101,6 +112,12 @@
{
log.info("entering " + getName());
+ if (!purgeMethodAvailable)
+ {
+ log.info(getName() + " PASSES (trivially)");
+ return;
+ }
+
// Start server.
setupServer("0");
@@ -159,6 +176,12 @@
{
log.info("entering " + getName());
+ if (!purgeMethodAvailable)
+ {
+ log.info(getName() + " PASSES (trivially)");
+ return;
+ }
+
// Start server.
setupServer("20");