Version 12

    JBoss AS 5 Microcontainer Deployer

    For JBoss AS 5, you can use the JSFUnit deployer. This allows you to add JSFUnit testing without a single change to any part of your WAR.  This makes using JSFUnit far easier because you don't have to do anything special to your build when you want to use JSFUnit.

     

    To use the JSFUnit Deployer:

    1. Copy jsfunit-microdeployer.jar to <jboss home>/server/default/deployers

    2. Rename your war with a "-jsfunit" suffix (such as "mywar-jsfunit.war")

    3. Add your test classes to the WAR or put them in <jboss home>/server/default/jsfunitTests

    4. Restart JBoss AS 5 and run your tests.

     

    Latest version

    Click Here to get the latest version of jsfunit-microdeployer.jar.

     

    Advanced configuration

    If you explode the jsfunit-microdeployer.jar then you can access the deployment descriptors that allow you to customize JSFUnit.  First create a new directory:

    server/default/deployers/jsfunit.deployer and unjar everything into the jsfunit.deployer directory.

     

    If you look in the META-INF directory you will see jsfunit-deployers-jboss-beans.xml.

     

    Changing how the deployer adds JSFUnit to a WAR

    The JSFUnit deployer will look at the file name of your WAR to decide if it needs the JSFUnit servlets, filters, and classes.  You can set the warSuffixes property to describe one or more WAR names that the deployer will match:

       <!--
          * Specify the case-insensitive war suffixes (excluding .war) that this 
          * deployer will add JSFUnit to. By default, we set <value>-jsfunit</value>
          * so that mywar-jsfunit.war will use JSFUnit but mywar.war would not.  
          * Of course, you could also change this to <value>mywar</value>
          * so that you wouldn't need to modify your war name to add JSFUnit to it.
        -->
        <property name="warSuffixes">
           <collection elementClass="java.lang.String">
              <value>-jsfunit</value>
              <value>mywar</value>
           </collection>
        </property>
    

    The above example will find any WAR ending in "-jsfunit" or "mywar".  So, both "mywar-jsfunit.war" and "mywar.war" would be JSFUnified.

     

    Adding classes to your WAR

    You can specify any directory or jar that you want JSFUnit to add to the classpath of your WAR.  Typically, this is used to point to your test classes so that you don't have to bundle them with the WAR.

       <!-- 
          *  Add any extra jars or directories to the classpath.  Typically, these URLs
          *  will point to your tests.  If you specify a directory, all jar files
          *  under that directory will be recursively added.
        -->
        <property name="classpathURLs">
           <collection elementClass="java.lang.String">
              <value>${jboss.server.home.url}/jsfunitTests</value>
              <value>file:/projects/myjsfproject/target/test-classes/</value>
           </collection>   
        </property>