[jboss-cvs] JBossAS SVN: r97625 - projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Dec 9 12:31:31 EST 2009


Author: jesper.pedersen
Date: 2009-12-09 12:31:31 -0500 (Wed, 09 Dec 2009)
New Revision: 97625

Added:
   projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestConnectionFactory.java
   projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestConnectionManager.java
Modified:
   projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestManagedConnectionFactory.java
Log:
Add simple connection factory

Added: projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestConnectionFactory.java
===================================================================
--- projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestConnectionFactory.java	                        (rev 0)
+++ projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestConnectionFactory.java	2009-12-09 17:31:31 UTC (rev 97625)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.embedded.rars.simple;
+
+import java.io.Serializable;
+
+import javax.naming.Reference;
+import javax.resource.Referenceable;
+import javax.resource.spi.ConnectionManager;
+
+import org.jboss.logging.Logger;
+
+/**
+ * TestConnectionFactory
+ *
+ * @author  <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ * @version $Revision: $
+ */
+public class TestConnectionFactory implements Serializable, Referenceable
+{
+   private static final long serialVersionUID = 1L;
+   private static Logger log = Logger.getLogger(TestConnectionFactory.class);
+
+   private ConnectionManager cm;
+   private Reference reference;
+
+   /**
+    * Constructor
+    * @param cm The connection manager
+    */
+   public TestConnectionFactory(ConnectionManager cm)
+   {
+      this.cm = cm;
+      this.reference = null;
+   }
+
+   /**
+    * Get the naming reference
+    * @return The value
+    */
+   public Reference getReference()
+   {
+      return reference;
+   }
+
+   /**
+    * Set the naming reference
+    * @param reference The value
+    */
+   public void setReference(Reference reference)
+   {
+      this.reference = reference;
+   }
+
+   /**
+    * Hash code
+    * @return The hash
+    */
+   @Override
+   public int hashCode()
+   {
+      return 42;
+   }
+
+   /**
+    * Equals
+    * @param other The other object
+    * @return True if equal; otherwise false
+    */
+   public boolean equals(Object other)
+   {
+      if (other == null)
+         return false;
+
+      return getClass().equals(other.getClass());
+   }
+}

Added: projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestConnectionManager.java
===================================================================
--- projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestConnectionManager.java	                        (rev 0)
+++ projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestConnectionManager.java	2009-12-09 17:31:31 UTC (rev 97625)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.embedded.rars.simple;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionManager;
+
+import org.jboss.logging.Logger;
+
+/**
+ * TestConnectionManager
+ *
+ * @author  <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ * @version $Revision: $
+ */
+public class TestConnectionManager implements ConnectionManager
+{
+   private static final long serialVersionUID = 1L;
+   private static Logger log = Logger.getLogger(TestConnectionManager.class);
+
+   /**
+    * Constructor
+    */
+   public TestConnectionManager()
+   {
+   }
+
+   /**
+    * Allocate connection
+    * @param mcf The managed connection factory
+    * @param cri The connection request information
+    * @return The connection
+    * @exception ResourceException Thrown if an error occurs
+    */
+   public Object allocateConnection(ManagedConnectionFactory mcf,
+                                    ConnectionRequestInfo cri)
+      throws ResourceException
+   {
+      return null;
+   }
+
+   /**
+    * Hash code
+    * @return The hash
+    */
+   @Override
+   public int hashCode()
+   {
+      return 42;
+   }
+
+   /**
+    * Equals
+    * @param other The other object
+    * @return True if equal; otherwise false
+    */
+   public boolean equals(Object other)
+   {
+      if (other == null)
+         return false;
+
+      return getClass().equals(other.getClass());
+   }
+}

Modified: projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestManagedConnectionFactory.java
===================================================================
--- projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestManagedConnectionFactory.java	2009-12-09 17:00:40 UTC (rev 97624)
+++ projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestManagedConnectionFactory.java	2009-12-09 17:31:31 UTC (rev 97625)
@@ -37,6 +37,7 @@
  * TestManagedConnectionFactory
  *
  * @author  <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>.
+ * @author  <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>.
  * @version $Revision: $
  */
 public class TestManagedConnectionFactory implements
@@ -54,8 +55,8 @@
     */
    public Object createConnectionFactory(ConnectionManager cxManager) throws ResourceException
    {
-      log.debug("call createConnectionFactory");
-      return null;
+      log.debug("call createConnectionFactory(" + cmManager + ")");
+      return new TestConnectionFactory(cxManager);
    }
 
    /**
@@ -67,7 +68,7 @@
    public Object createConnectionFactory() throws ResourceException
    {
       log.debug("call createConnectionFactory");
-      return null;
+      return new TestConnectionFactory(new TestConnectionManager());
    }
 
    /** 




More information about the jboss-cvs-commits mailing list