Log In | Sign Up   View a printable version of the current page.
  Dashboard > flexive > ... > Checking out and working with the sources > Embedded EJB3 Container Unit Tests

Added by Markus Plesser, last edited by Markus Plesser on Dec 29, 2008  (view change)
Labels: 
(None)

[fleXive] EJB tests can be run without deployment to an application server by using the JBoss embeddable EJB3 container

This page is now obsololete and only kept for reference since [fleXive] can now be unit tested using the bundled OpenEJB container

Instructions:

  • Download and install the embeddable EJB3 container
  • Configure the container (installed in EMBEDDED_DIR):
    • Add the datasources to EMBEDDED_DIR/conf/embedded-jboss-beans.xml (assuming MySQL is running on localhost:3306):
      <bean name="FlexiveConfigBootstrap" class="org.jboss.resource.adapter.jdbc.local.LocalTxDataSource">
             <property name="driverClass">com.mysql.jdbc.Driver</property>
             <property name="connectionURL">jdbc:mysql://localhost:3306/flexiveConfiguration</property>
             <property name="userName">root</property>
             <property name="password">a</property>
             <property name="jndiName">java:jdbc/flexiveConfiguration</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="flexiveConfiguration" class="java.lang.Object">
             <constructor factoryMethod="getDatasource">
                 <factory bean="FlexiveConfigBootstrap"/>
             </constructor>
         </bean>
         
         <bean name="FlexiveTestBootstrap" class="org.jboss.resource.adapter.jdbc.local.LocalTxDataSource">
             <property name="driverClass">com.mysql.jdbc.Driver</property>
             <property name="connectionURL">jdbc:mysql://localhost:3306/flexiveTest</property>
             <property name="userName">root</property>
             <property name="password">a</property>
             <property name="jndiName">java:jdbc/flexiveTest</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="flexiveTest" class="java.lang.Object">
             <constructor factoryMethod="getDatasource">
                 <factory bean="FlexiveTestBootstrap"/>
             </constructor>
         </bean>
    • Add the flexive security manager to EMBEDDED_DIR/conf/login-config.xml:
      <application-policy name = "FlexiveLogin">
            <authentication>
                <login-module code="com.flexive.core.security.FlexiveDefaultLogin" flag="required"></login-module>
            </authentication>
         </application-policy>
  • Adjust the path to your embedded server jboss.embedded.path in flexive.properties
  • Change to the [fleXive] root directory and run ant tests.all or any test as described in Build Targets.
Site running on a free Atlassian Confluence Open Source Project License granted to [fleXive] . Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.6.1 Build:#916 Nov 09, 2007) - Bug/feature request - Contact Administrators