1 Reply Latest reply on Dec 17, 2005 8:55 PM by Gavin King

    Problem with running tests for SEAM-BOOKING example

    Wojciech B. Newbie

      Hi,

      I have a problem running tests for the "booking" example shipped with Seam.

      When I want to run the tests basing on the tutorial (
      http://docs.jboss.com/seam/reference/en/html/configuration.html#d0e1542
      "Configuring Seam with the JBoss Embeddable EJB3 container" ) I get problems.

      I use Eclipse 3.1 with TestNG plugin. When I run the tests I get:

      [RunInfo] Adding method selector: org.testng.internal.XmlMethodSelector@1bfc93a priority: 10
      [TestClass] Creating TestClass for [ClassImpl org.jboss.seam.example.booking.test.LoginTest]
      [TestClass] Adding method org.jboss.seam.example.booking.test.LoginTest.testLogin() on TestClass class org.jboss.seam.example.booking.test.LoginTest
      [TestRunner] Running test org.jboss.seam.example.booking.test.LoginTest on 1 classes, included groups:[] excluded groups:[]
      [TestClass]
      ======
      TESTCLASS: org.jboss.seam.example.booking.test.LoginTest
      [TestClass] BeforeClass : org.jboss.seam.mock.SeamTest.init()
      [TestClass] BeforeMethod: org.jboss.seam.mock.SeamTest.begin()
      [TestClass] Test : org.jboss.seam.example.booking.test.LoginTest.testLogin()
      [TestClass] AfterMethod : org.jboss.seam.mock.SeamTest.end()
      [TestClass] AfterClass : org.jboss.seam.mock.SeamTest.cleanup()
      [TestClass]
      ======
      
      [TestRunner] PARALLEL LIST:
      [TestRunner] org.jboss.seam.example.booking.test.LoginTest.testLogin()
      [TestRunner] SEQUENTIAL LIST:
      [TestRunner] ===
      [TestRunner] Found 1 applicable methods
      [Invoker 5210326] Keeping method org.jboss.seam.mock.SeamTest.init() for class [TestClass class org.jboss.seam.example.booking.test.LoginTest]
      [Invoker 5210326] Invoking org.jboss.seam.mock.SeamTest.init()
      [Invoker 5210326] Keeping method org.jboss.seam.mock.SeamTest.begin() for class [TestClass class org.jboss.seam.example.booking.test.LoginTest]
      [Invoker 5210326] Keeping method org.jboss.seam.mock.SeamTest.end() for class [TestClass class org.jboss.seam.example.booking.test.LoginTest]
      [Invoker 5210326] Keeping method org.jboss.seam.mock.SeamTest.begin() for class [TestClass class org.jboss.seam.example.booking.test.LoginTest]
      [Invoker 5210326] Invoking org.jboss.seam.example.booking.test.LoginTest.testLogin
      [Invoker 5210326] Keeping method org.jboss.seam.mock.SeamTest.end() for class [TestClass class org.jboss.seam.example.booking.test.LoginTest]
      [Invoker 5210326] Keeping method org.jboss.seam.mock.SeamTest.cleanup() for class [TestClass class org.jboss.seam.example.booking.test.LoginTest]
      
      *********** INVOKED METHODS
      
       org.jboss.seam.mock.SeamTest.init() 5998631
       org.jboss.seam.example.booking.test.LoginTest.testLogin() 5998631
      
      ***********
      
      FAILED: org.jboss.seam.mock.SeamTest.init()
      java.lang.RuntimeException: java.lang.IllegalArgumentException: Null kernel
       at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.deployXmlResource(EJB3StandaloneBootstrap.java:59)
       at org.jboss.seam.core.Ejb.deploy(Unknown Source)
       at org.jboss.seam.core.Ejb.startup(Unknown Source)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.jboss.seam.util.Reflections.invoke(Unknown Source)
       at org.jboss.seam.util.Reflections.invokeAndWrap(Unknown Source)
       at org.jboss.seam.Component.callCreateMethod(Unknown Source)
       at org.jboss.seam.Component.newInstance(Unknown Source)
       at org.jboss.seam.Component.getInstance(Unknown Source)
       at org.jboss.seam.contexts.Lifecycle.startup(Unknown Source)
       at org.jboss.seam.contexts.Lifecycle.endInitialization(Unknown Source)
       at org.jboss.seam.init.Initialization.init(Unknown Source)
       at org.jboss.seam.mock.SeamTest.init(Unknown Source)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:379)
       at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:280)
       at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:147)
       at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:78)
       at org.testng.TestRunner.privateRun(TestRunner.java:620)
       at org.testng.TestRunner.run(TestRunner.java:503)
       at org.testng.SuiteRunner.privateRun(SuiteRunner.java:200)
       at org.testng.SuiteRunner.run(SuiteRunner.java:126)
       at org.testng.eclipse.runner.RemoteTestNG.run(RemoteTestNG.java:99)
       at org.testng.eclipse.runner.RemoteTestNG.main(RemoteTestNG.java:138)
      Caused by: java.lang.IllegalArgumentException: Null kernel
       at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.<init>(AbstractKernelDeployer.java:67)
       at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.<init>(AbstractKernelDeployer.java:56)
       at org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer.<init>(BeanXMLDeployer.java:44)
       at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.deployXmlResource(EJB3StandaloneBootstrap.java:50)
       ... 29 more
      
      FAILED: org.jboss.seam.example.booking.test.LoginTest.testLogin()
      java.lang.NullPointerException
       at org.jboss.seam.mock.SeamTest$Script.run(Unknown Source)
       at org.jboss.seam.example.booking.test.LoginTest.testLogin(LoginTest.java:45)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:379)
       at org.testng.internal.Invoker.invokeMethod(Invoker.java:356)
       at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:530)
       at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:89)
       at org.testng.TestRunner.privateRun(TestRunner.java:620)
       at org.testng.TestRunner.run(TestRunner.java:503)
       at org.testng.SuiteRunner.privateRun(SuiteRunner.java:200)
       at org.testng.SuiteRunner.run(SuiteRunner.java:126)
       at org.testng.eclipse.runner.RemoteTestNG.run(RemoteTestNG.java:99)
       at org.testng.eclipse.runner.RemoteTestNG.main(RemoteTestNG.java:138)
      
      SKIPPED: begin
      SKIPPED: end
      SKIPPED: cleanup
      
      ===============================================
       org.jboss.seam.example.booking.test.LoginTest
       Tests run: 5, Failures: 2, Skips: 3
      ===============================================
      
      Creating C:\Program Files\jboss-4.0.3SP1\jboss-seam-1.0beta1\examples\booking\test\testng-failures.xml
      
      ===============================================
      org.jboss.seam.example.booking.test.LoginTest
      Total tests run: 5, Failures: 2, Skips: 3
      ===============================================
      
      



      Does anobody have any idea what do I do wrong?

      I did not modify the code of the example.
      The only thing that I did is added the "org.jboss.seam.init.componentClasses org.jboss.seam.core.Ejb" line to seam.propetties and changed the jboss-beans.xml to

      <?xml version="1.0" encoding="UTF-8"?>
      
      <deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
       xmlns="urn:jboss:bean-deployer">
      
       <bean name="bookingDatasourceBootstrap"
       class="org.jboss.resource.adapter.jdbc.local.LocalTxDataSource">
       <property name="driverClass">org.hsqldb.jdbcDriver</property>
       <property name="connectionURL">jdbc:hsqldb:.</property>
       <property name="userName">sa</property>
       <property name="jndiName">java:/bookingDatasource</property>
       <property name="minSize">0</property>
       <property name="maxSize">10</property>
       <property name="blockingTimeout">1000</property>
       <property name="idleTimeout">100000</property>
       <property name="transactionManager">
       <inject bean="TransactionManager"/>
       </property>
       <property name="cachedConnectionManager">
       <inject bean="CachedConnectionManager"/>
       </property>
       <property name="initialContextProperties">
       <inject bean="InitialContextProperties"/>
       </property>
       </bean>
      
       <bean name="bookingDatasource" class="java.lang.Object">
       <constructor factoryMethod="getDatasource">
       <factory bean="bookingDatasourceBootstrap"/>
       </constructor>
       </bean>
      
      </deployment>


      I built it and run the tests (for test running in the classpath I include folder embedded-ejb/conf and embedded-ejb/lib with all jars, and META_INF folder).