in-container test with JbossTestCase
susi33 Sep 1, 2006 7:58 AMHi
I would like to run in-container tests with the jboss testsuite. I'm using
a simple JbossTestCase class and an ant script to build it.
I'm using:
Java 1.5, Jboss 4.0.4GA, Ant 1.6.5, Junit 3.8.1,
Eclipse 3.12, Fedora Core 5.
My build.xml looks like this (only the test target):
<target name="test-run" depends="jar">
 <delete dir="${test_classes.dir}"/>
 <mkdir dir="${test_classes.dir}" />
 <javac srcdir="${test.src.dir}"
 destdir="${test_classes.dir}">
 <classpath refid="compile.classpath" />
 <classpath>
 <pathelement location="${classes.dir}" />
 </classpath>
 </javac>
 <jar jarfile="${jarfile_test}/JbossTest.jar">
 <fileset dir="${test_classes.dir}/">
 <include name="testing/*.class" />
 </fileset>
 </jar>
 <delete file="${jboss.deploy.dir}/JbossTest.jar" />
 <copy todir="${jboss.deploy.dir}"
 file="${jarfile_test}/JbossTest.jar" />
 <!-- Jboss Config -->
 <config javaHome="${java_home}" jbossHome="${jboss.base.dir}">
 <server name="default" host="${node0}">
 <jvmarg value="${jpda.cmdline}" />
 <jvmarg value="-Xmx256m" />
 <sysproperty key="java.endorsed.dirs" value="${jboss.base.dir}/lib/endorsed" />
 </server>
 </config>
 <!-- Jboss Start -->
 <start name="default"/>
 <junit fork="yes"
 printsummary="yes"
 haltonfailure="yes">
 <sysproperty key="java.naming.provider.url" value="${node0.jndi.url}"/>
 <classpath>
 <pathelement path="${jboss-test}"/>
 <pathelement path="${jboss_testcase}" />
 <path refid="compile.classpath" />
 </classpath>
 <sysproperty key="jboss-junit-configuration" value="${jboss-junit-configuration}"/>
 <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter"
 usefile="${junit.formatter.usefile}"
 extension="-${jboss-junit-configuration}.xml" />
 <formatter type="xml"/>
 <test fork="yes"
 name="testing.SimpleUnitTestCase"
 haltonfailure="no">
 </test>
 </junit>
 <!-- Jboss Stop -->
 <stop name="default"/>
 </target>
My JbossTestCase is the SimpleUnitTestCase.class within the
jboss-test-1.0.0.CR1.
The error stack:
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.addToEnvironment(InitialContext.java:474)
at testing.SimpleUnitTestCase.testCreateSubcontext(Unknown Source)
Its the same for all 5 test cases...
For me it looks like this JbossTestCase is not executed inside the ejb container.
Where do i have to set the link between the jboss container and the test cases??
Or how do i get the test code in my container?
I didn't find anything about this specific problem, so i started a new topic.
I would be grateful for some help.
