0 Replies Latest reply on Sep 14, 2005 1:45 PM by Dustin Hunter

    Testing with Embedded container

    Dustin Hunter Newbie

      I'm trying to write a unit test in TestNG using jboss-4.0.3RC2 with jboss-EJB-3.0_Embeddable_ALPHA. I'm running into a problem with the first step. Simply put, I'm trying to get this to run:

      public void setup() throws Exception {
       EJB3StandaloneBootstrap.boot("");
      }
      
      public void testFoo() {
       ...
      }
      


      When this is compiled and run, with this ant script:

      <target name="foo">
      
       <path id="test.classpath">
       <fileset dir="${jboss.embeddable.dir}/lib">
       <include name="**/*.jar" />
       </fileset>
       <pathelement location="${jboss.embeddable.dir}/conf" />
       <path refid="testng.compile.classpath" />
       <path refid="compile.classpath" />
       <pathelement location="${classes.dir}" />
       </path>
      
       <java dir="${classes.dir}" fork="true" classname="org.testng.TestNG">
       <classpath refid="test.classpath"/>
       <arg line="-d ${unittest.report.dir} -target 1.5 -groups unit -testclass C:\dev\classes\com\foo\MyTest.class"/>
       </java>
       </target>
      


      I get the following exception:

      [java] ERROR 14-09 10:27:16,362 (XsdBinder.java:getXSImplementation:956) -Failed to create schema loader.
       [java] java.lang.ClassCastException: org.apache.xerces.dom.DOMXSImplementationSourceImpl
       [java] at org.w3c.dom.bootstrap.DOMImplementationRegistry.newInstance(DOMImplementationRegistry.java:144)
       [java] at org.jboss.xb.binding.sunday.unmarshalling.XsdBinder.getXSImplementation(XsdBinder.java:951)
       [java] at org.jboss.xb.binding.sunday.unmarshalling.XsdBinder.loadSchema(XsdBinder.java:886)
       [java] at org.jboss.xb.binding.sunday.unmarshalling.XsdBinder.bind(XsdBinder.java:85)
       [java] at org.jboss.kernel.plugins.deployment.xml.BeanSchemaBinding.readXsd(BeanSchemaBinding.java:982)
       [java] at org.jboss.kernel.plugins.deployment.xml.BeanSchemaBinding.getSchemaBinding(BeanSchemaBinding.java:211)
       [java] at org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer.<init>(BeanXMLDeployer.java:34)
       [java] at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.boot(EJB3StandaloneBootstrap.java:107)
       [java] at com.foo.MyTest.setup(MyTest.java:13)
       [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       [java] at java.lang.reflect.Method.invoke(Method.java:585)
       [java] at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:294)
       [java] at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:282)
       [java] at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:151)
       [java] at org.testng.TestRunner.invokeClassConfigurations(TestRunner.java:669)
       [java] at org.testng.TestRunner.privateRun(TestRunner.java:503)
       [java] at org.testng.TestRunner.run(TestRunner.java:479)
       [java] at org.testng.SuiteRunner.privateRun(SuiteRunner.java:191)
       [java] at org.testng.SuiteRunner.run(SuiteRunner.java:117)
       [java] at org.testng.TestNG.run(TestNG.java:277)
       [java] at org.testng.TestNG.privateMain(TestNG.java:364)
       [java] at org.testng.TestNG.main(TestNG.java:313)


      I assumed this was a problem with multiple versions of Xerces being on the classpath, the only other Xerces package I can find is in Ant 1.6.x itself. So I fork the running of the test, but I still get the same result. I then replaced the xerces package in Ant to be the same as the one in the jboss embedded lib. I still get the same exception.

      So obviously I'm going down the wrong path. I've tried to look at TestCases in the cvs head and the build-test.xml but I'm not seeing a solution.

      Can anyone point me in the right direction here?