Dear list,
I have a unit test that uses Java's Runtime.exec() method to start another
VM and execute code in it. I need this to test recovery from simulated power
failure. The code that should run in the VM is a test case itself, from the
same project. I do not know what classpath to pass to the exec command:
Runtime.exec("java -classpath "\"" + System.getProperty("java.class.path")
+ "\" " + MyUnitTest.getCanonicalName());
This works from within Eclipse but not if I do a 'mvn test'.
How can I obtain a classpath from Maven that I can use to start the separate
VM?
Thanks for any pointers,
Kaspar
P.S. What I want to do is write a unit test that runs some code which
simulates a power failure by calling System.exit(). Then the unit test
continues by restarting the app and checking that recovery works. To
accomplish this, I wrote a unit test that uses – as described above
– Runtime.exec() to launch the code that does some work and then exit()'s.
But I don't manage get this to run due to the above classpath issues.
--
View this message in context:
http://www.nabble.com/Mvn-test%3A-how-to-get-classpath-when-starting-another-VM--tp23068442p23068442.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]