ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <davidjen...@directvinternet.com>
Subject Re: Running Junit tests inside the same VM
Date Thu, 26 Sep 2002 12:30:09 GMT
Dain has a more ejb-oriented way (compared to cactus) of running this sort
of test inside jboss, I think he calls it ejbunit.  Look at the cmp2 tests
in the jboss testsuite which all use it.

thanks
david jencks

On 2002.09.26 02:53:27 -0400 Dushyant Shrivastava wrote:
> Hi,
> I am trying to run a simple JUnit test inside JBoss server
> 
> My environment:
> JBoss : 3.0.2
> Ant    : 1.5
> JDK  : 1.4.0_01
> JUnit :3.8.1
> 
> 
> Now my testcase has a simple test which tries to talk to the local
> interface of a session bean running inside JBoss. I am aware of the fact
> that to be able to do this, the test has to be running in the same VM as
> the server! Hence i set the "fork" option in the Junit task to "off". And
> tried running the test. Test.jar gets successfully deployed into jboss,
> but then i get the following error message when it tries to run the
> actual test.
> 
> test:
>     [junit] Running com.yambay.nps.istesting.MessagingTestCase
> 
> BUILD FAILED
> java.lang.LinkageError: loader constraints violated when linking
> org/w3c/dom/Document class
>         at org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(DocumentBuilderFactoryImpl.java:88)
>         at org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter.getDocumentBuilder(XMLJUnitResultFormatter.java:93)
>         at org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter.startTestSuite(XMLJUnitResultFormatter.java:138)
>         at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.fireStartTestSuite(JUnitTestRunner.java:433)
>         at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:279)
>         at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeInVM(JUnitTask.java:804)
>         at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:551)
>         at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:527)
>         at org.apache.tools.ant.Task.perform(Task.java:317)
>         at org.apache.tools.ant.Target.execute(Target.java:309)
>         at org.apache.tools.ant.Target.performTasks(Target.java:334)
>         at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
>         at org.apache.tools.ant.Project.executeTargets(Project.java:1250)
>         at org.apache.tools.ant.Main.runBuild(Main.java:610)
>         at org.apache.tools.ant.Main.start(Main.java:196)
>         at org.apache.tools.ant.Main.main(Main.java:235)
> 
> Has anyone seen this error before? Almost seems like the Junit task does
> not like the fork option set to "off".If i set this option to true,
> everything works fine. If the fork option is set to off, it dosen't even
> get to the point of running the test.
> 
> 
> This is what my test looks like!
> 
> public void testSendMessageToClient()
> 	{
> 		try
> 		{
> 			System.out.println("Hello!");
> 			Context context = new InitialContext();
> 			MessageProducerBeanLocalHome lHome =
> 				(MessageProducerBeanLocalHome) context.lookup("session/MessageProducerBeanLocal");
> 			MessageProducerBeanLocal lSession =
> (MessageProducerBeanLocal) lHome.create();
> 			System.out.println("MessageProducerBean lookup
> successful");
> 
> 		}
> 
> 
> How can i make sure that my test runs inside the same VM as the App
> server? or is this something to do with the versions that I am using. Any
> help would be much appreciated.
> 
> TIA
> 
> Dushy	
> ______________________
> DUSHYANT SHRIVASTAVA
> Software Engineer
> 
> YAMBAY
> 
> tel      +61 (0) 8 9323 6999
> mob  +61 (0) 402 902 652
> fax     +61 (0) 8 9325 2688
> web   www.yambay.com
> 
> Yambay Technologies Pty Ltd
> 7th Floor, The Victoria, 14-16 Victoria Ave, Perth. WA, 6000, Australia
> _________________________________________________________________________________________________
> 
> This message and any files transmitted with it are confidential and are
> intended solely for the use of those persons to
> whom the message is addressed. If you have received this message in
> error, please destroy and delete this
> message from your computer. Any unauthorised form of reproduction of this
> message or any files transmitted with
> it is strictly prohibited. yambay does not make any warranty concerning
> the security of any information electronically
> transmitted and disclaims all liability for the proper and complete
> transmission of any information contained or purportedly
> contained in this message, nor for any delay in its receipt. If you
> receive this message in error please notify the sender.
> _________________________________________________________________________________________________
> 
> 
> 

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message