You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Benoit Xhenseval <be...@yahoo.com> on 2007/10/30 14:18:02 UTC
JUnit/JUnitPerf with EJB.
Hi *,
I'm trying to use JUnitPerf (1.9.1) with an EJB client.
I'm using Maven 1.1 with JDK 5 (latest 013).
Everything seems to go as planned except towards the end of the JUnit test (Even with a SINGLE thread), where I get:
[junit] Exception in thread "main" java.lang.IllegalThreadStateException
[junit] at java.lang.ThreadGroup.add(ThreadGroup.java:856)
[junit] at java.lang.Thread.start(Thread.java:573)
[junit] at java.lang.Shutdown.runHooks(Shutdown.java:128)
[junit] at java.lang.Shutdown.sequence(Shutdown.java:173)
[junit] at java.lang.Shutdown.exit(Shutdown.java:218)
[junit] at java.lang.Runtime.exit(Runtime.java:90)
[junit] at java.lang.System.exit(System.java:869)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:571)
[junit] [ERROR] Test net.objectlab.safemargin.server.ejb.RefDataLoadTest FAILED
Has anyone seen this before? Why is JUnitTestRunner calling System.exit?
Any idea how some hooks got created?
The JUnitPerf test is simple:
public static Test suite() {
final Test testCase = new RefDataTest("testBasicGetAll");
final Test loadTest = new LoadTest(testCase, 10, new ConstantTimer(500));
return loadTest;
}
It is probably something related to the RMI Client, the test case declares one remote object per thread:
If I run a simple local test (i.e. RefDataTest not calling EJB), it all works fine.
private ThreadLocal<RefDataProviderRemote> refDataProvider = new ThreadLocal<RefDataProviderRemote>();
@Override
protected void setUp() throws Exception {
super.setUp();
System.err.println("call to setUp");
refDataProvider.set(ServiceLocator.getInstance().getHome("RefDataProviderBean", RefDataProviderHome.class).create());
}
@Override
protected void tearDown() throws Exception {
if (refDataProvider.get() != null) {
refDataProvider.get().remove();
refDataProvider.set(null);
}
super.tearDown();
System.err.println("called tearDown");
}
Any suggestion? Pointers?
Many thanks
Benoit.