IronJacamar 1.0.0.Beta2 is out

Posted by    |      

I'm happy to announce the second beta release of IronJacamar 1.0 which implements the Java EE Connector Architecture 1.6 specification.

Full release notes are here.

Deployment descriptors

We have added support for our deployment descriptors

  • ironjacamar.xml -- Our vendor specific extension to the standard ra.xml descriptor
  • -ra.xml -- Deployment profile for a resource adapter
  • -ds.xml -- Deployment profile of a datasource

An example of an ironjacamar.xml file:

<ironjacamar>
  <connection-definitions>
    <connection-definition jndi-name="java:/eis/MyCF"
                           class-name="org.jboss.jca.test.deployers.spec.rars.ra15out.TestManagedConnectionFactory">
       <config-property name="MyProperty">Override</config-property>
    </connection-definition>
  </connection-definitions>
</ironjacamar>

These formats are set to be ones used in JBoss Application Server 7, so be sure to check out the XSDs and send your feedback.

Datasources

Since we now have support for deploying datasources based on the -ds.xml format we can also deploy datasources in our embedded setup, and thereby help testing applications that requires a datasource. These deployments will use our JDBC resource adapter which provides the JDBC4 API and connection pooling.

An example deploying a H2 datasource:

package org.jboss.jca.adapters.jdbc.unit;

import org.jboss.jca.embedded.EmbeddedJCA;

import java.io.File;
import java.net.URL;
import java.sql.Connection;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;

import org.jboss.logging.Logger;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 * Test cases for getting a connection from the H2 database
 * 
 * @author <a href="mailto:jesper.pedersen@jboss.org">Jesper Pedersen</a>
 * @version $Revision: $
 */
public class H2TestCase
{

   // --------------------------------------------------------------------------------||
   // Class Members ------------------------------------------------------------------||
   // --------------------------------------------------------------------------------||

   private static Logger log = Logger.getLogger(H2TestCase.class);

   private static final String JNDI_NAME = "java:/H2DS";

   /*
    * Embedded
    */
   private static EmbeddedJCA embedded;

   // --------------------------------------------------------------------------------||
   // Tests --------------------------------------------------------------------------||
   // --------------------------------------------------------------------------------||

   /**
    * Get a connection from the database
    * @exception Throwable Thrown if case of an error
    */
   @Test
   public void testConnection() throws Throwable
   {
      Context context = null;

      try
      {
         context = new InitialContext();
         
         DataSource ds = (DataSource)context.lookup(JNDI_NAME);
         assertNotNull(ds);

         Connection c = ds.getConnection();
         assertNotNull(c);
      }
      catch (Throwable t)
      {
         log.error(t.getMessage(), t);
         fail(t.getMessage());
      }
      finally
      {
         if (context != null)
         {
            try
            {
               context.close();
            }
            catch (NamingException ne)
            {
               // Ignore
            }
         }
      }
   }

   // --------------------------------------------------------------------------------||
   // Helper Methods -----------------------------------------------------------------||
   // --------------------------------------------------------------------------------||

   /**
    * Get the URL for a test archive
    * @param archive The name of the test archive
    * @return The URL to the archive
    * @throws Throwable throwable exception
    */
   private static URL getURL(String archive) throws Throwable
   {
      File f = new File(System.getProperty("archives.dir") + File.separator + archive);
      return f.toURI().toURL();
   }

   // --------------------------------------------------------------------------------||
   // Lifecycle Methods --------------------------------------------------------------||
   // --------------------------------------------------------------------------------||

   /**
    * Lifecycle start, before the suite is executed
    * @throws Throwable throwable exception 
    */
   @BeforeClass
   public static void beforeClass() throws Throwable
   {
      // Create and set an embedded JCA instance
      embedded = new EmbeddedJCA();

      // Startup
      embedded.startup();

      // Deploy jdbc-local.rar
      embedded.deploy(getURL("jdbc-local.rar"));

      // Deploy H2 datasource
      embedded.deploy(getURL("test/h2-ds.xml"));
   }

   /**
    * Lifecycle stop, after the suite is executed
    * @throws Throwable throwable exception 
    */
   @AfterClass
   public static void afterClass() throws Throwable
   {
      // Undeploy H2 datasource
      embedded.undeploy(getURL("test/h2-ds.xml"));

      // Undeploy jdbc-local.rar
      embedded.undeploy(getURL("jdbc-local.rar"));

      // Shutdown embedded
      embedded.shutdown();

      // Set embedded to null
      embedded = null;
   }
}

Of course there will be Arquillian support for this in an upcoming release.

Tools

Our tools saw several enhancements.

Our validator tool now has a Maven plugins, so you can use it directly from your POM files. And the code generator is now able to generate a complete build environment based on Ant+Ivy or Maven.

We hope that you like these improvements.

The Road Ahead

We will continue with our JBoss Application Server 7 integration and of course keep enhancing the container based on your feedback.

For Those About to Rock, We Salute You !

[WebSite] [Download] [Documentation] [JIRA] [Forum]


Back to top