[jboss-cvs] JBossAS SVN: r84085 - in projects/ejb3/trunk/profile3_1/src: main/resources/conf/deployers and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Feb 11 02:49:24 EST 2009


Author: jaikiran
Date: 2009-02-11 02:49:24 -0500 (Wed, 11 Feb 2009)
New Revision: 84085

Added:
   projects/ejb3/trunk/profile3_1/src/main/java/org/jboss/ejb3/profile3_1/Ejb3ComponentRegistry.java
   projects/ejb3/trunk/profile3_1/src/test/java/org/jboss/ejb3/profile3_1/test/deployment/SimpleSLSBRemote.java
Modified:
   projects/ejb3/trunk/profile3_1/src/main/resources/conf/deployers/ejb3-deployers-jboss-beans.xml
   projects/ejb3/trunk/profile3_1/src/test/java/org/jboss/ejb3/profile3_1/test/deployment/SimpleSLSB.java
   projects/ejb3/trunk/profile3_1/src/test/java/org/jboss/ejb3/profile3_1/test/deployment/unit/Profile3_1_DeploymentTestCase.java
   projects/ejb3/trunk/profile3_1/src/test/resources/log4j.xml
Log:
EJBTHREE-1711 Added support for @Remote business interface beans and also updated the test case to work on these remote business interfaces

Copied: projects/ejb3/trunk/profile3_1/src/main/java/org/jboss/ejb3/profile3_1/Ejb3ComponentRegistry.java (from rev 84047, projects/ejb3/trunk/embedded/src/main/java/org/jboss/ejb3/embedded/Ejb3ComponentRegistry.java)
===================================================================
--- projects/ejb3/trunk/profile3_1/src/main/java/org/jboss/ejb3/profile3_1/Ejb3ComponentRegistry.java	                        (rev 0)
+++ projects/ejb3/trunk/profile3_1/src/main/java/org/jboss/ejb3/profile3_1/Ejb3ComponentRegistry.java	2009-02-11 07:49:24 UTC (rev 84085)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.ejb3.profile3_1;
+
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.ejb3.Ejb3Registry;
+import org.jboss.logging.Logger;
+
+/**
+ * Ejb3ComponentRegistry
+ *
+ * Temporary workaround to an issue where MC does not allow
+ * static methods (of {@link Ejb3Registry}) to act as callbacks.
+ * Ejb3ComponentRegistry acts as an indirection to {@link Ejb3Registry}
+ * which maintains a registry of deployed EJB containers.
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class Ejb3ComponentRegistry
+{
+
+   /**
+    * Logger
+    */
+   private static Logger logger = Logger.getLogger(Ejb3ComponentRegistry.class);
+
+   /**
+    * Adds the <code>container</code> to the {@link Ejb3Registry}
+    *
+    * @param container
+    */
+   public void addContainer(EJBContainer container)
+   {
+      // We need the Ejb3Registry to hold these references, since that's where
+      // the IsLocalInterceptor looks for.
+      Ejb3Registry.register(container);
+      logger.debug("Container " + container + " added to registry");
+   }
+
+   /**
+    * Unregisters (an registered) <code>container</code> from {@link Ejb3Registry}
+    *
+    * @param container
+    */
+   public void removeContainer(EJBContainer container)
+   {
+      // unregsiter the container
+      // Bug in hasContainer implementation - The implementation uses the objectName of the container
+      // instead of guid to check the internal map of containers. Effectively always returns false.
+      // So let's skip this hasContainer check for now (risky, might throw exception if the container
+      // wasn't registered)
+      //         if (Ejb3Registry.hasContainer(container))
+      //         {
+      Ejb3Registry.unregister(container);
+      logger.debug("Container " + container + " removed from registry");
+   }
+}

Modified: projects/ejb3/trunk/profile3_1/src/main/resources/conf/deployers/ejb3-deployers-jboss-beans.xml
===================================================================
--- projects/ejb3/trunk/profile3_1/src/main/resources/conf/deployers/ejb3-deployers-jboss-beans.xml	2009-02-11 05:05:33 UTC (rev 84084)
+++ projects/ejb3/trunk/profile3_1/src/main/resources/conf/deployers/ejb3-deployers-jboss-beans.xml	2009-02-11 07:49:24 UTC (rev 84085)
@@ -141,5 +141,10 @@
       </constructor>
    </bean>
 
+    <bean name="EJB3ComponentRegistry" class="org.jboss.ejb3.profile3_1.Ejb3ComponentRegistry">
+      <!-- Accept any implementor of org.jboss.ejb3.EJBContainer -->
+      <incallback method="addContainer"/>
+      <uncallback method="removeContainer"/>
+    </bean>
 
 </deployment>
\ No newline at end of file

Modified: projects/ejb3/trunk/profile3_1/src/test/java/org/jboss/ejb3/profile3_1/test/deployment/SimpleSLSB.java
===================================================================
--- projects/ejb3/trunk/profile3_1/src/test/java/org/jboss/ejb3/profile3_1/test/deployment/SimpleSLSB.java	2009-02-11 05:05:33 UTC (rev 84084)
+++ projects/ejb3/trunk/profile3_1/src/test/java/org/jboss/ejb3/profile3_1/test/deployment/SimpleSLSB.java	2009-02-11 07:49:24 UTC (rev 84085)
@@ -22,10 +22,11 @@
 package org.jboss.ejb3.profile3_1.test.deployment;
 
 import javax.ejb.Local;
+import javax.ejb.Remote;
 import javax.ejb.Stateless;
 
 /**
- * 
+ *
  * SimpleSLSB
  *
  * @author Jaikiran Pai
@@ -33,6 +34,7 @@
  */
 @Stateless
 @Local(SimpleSLSBLocal.class)
+ at Remote (SimpleSLSBRemote.class)
 public class SimpleSLSB implements SimpleSLSBLocal
 {
 

Added: projects/ejb3/trunk/profile3_1/src/test/java/org/jboss/ejb3/profile3_1/test/deployment/SimpleSLSBRemote.java
===================================================================
--- projects/ejb3/trunk/profile3_1/src/test/java/org/jboss/ejb3/profile3_1/test/deployment/SimpleSLSBRemote.java	                        (rev 0)
+++ projects/ejb3/trunk/profile3_1/src/test/java/org/jboss/ejb3/profile3_1/test/deployment/SimpleSLSBRemote.java	2009-02-11 07:49:24 UTC (rev 84085)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.ejb3.profile3_1.test.deployment;
+
+/**
+ * SimpleSLSBRemote
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public interface SimpleSLSBRemote extends SimpleSLSBLocal
+{
+
+}

Modified: projects/ejb3/trunk/profile3_1/src/test/java/org/jboss/ejb3/profile3_1/test/deployment/unit/Profile3_1_DeploymentTestCase.java
===================================================================
--- projects/ejb3/trunk/profile3_1/src/test/java/org/jboss/ejb3/profile3_1/test/deployment/unit/Profile3_1_DeploymentTestCase.java	2009-02-11 05:05:33 UTC (rev 84084)
+++ projects/ejb3/trunk/profile3_1/src/test/java/org/jboss/ejb3/profile3_1/test/deployment/unit/Profile3_1_DeploymentTestCase.java	2009-02-11 07:49:24 UTC (rev 84085)
@@ -29,6 +29,7 @@
 
 import org.jboss.ejb3.profile3_1.test.common.AbstractProfile3_1_TestCase;
 import org.jboss.ejb3.profile3_1.test.deployment.SimpleSLSBLocal;
+import org.jboss.ejb3.profile3_1.test.deployment.SimpleSLSBRemote;
 import org.jboss.logging.Logger;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -36,7 +37,7 @@
 
 /**
  * Profile3_1_DeploymentTestCase
- * 
+ *
  * Testcase to ensure that the profile3_1 bootstrap loads properly
  *
  * @author Jaikiran Pai
@@ -65,7 +66,7 @@
    /**
     * This test ensures that the basic deployment support provided by
     * profile3_1 component is working
-    * 
+    *
     * @throws Throwable
     */
    @Test
@@ -77,16 +78,28 @@
 
       // lookup the bean
       Context ctx = new InitialContext();
-      SimpleSLSBLocal bean = (SimpleSLSBLocal) ctx.lookup("SimpleSLSB/local");
-      logger.debug("Successfully looked up bean " + bean);
+      SimpleSLSBLocal localBean = (SimpleSLSBLocal) ctx.lookup("SimpleSLSB/local");
+      logger.debug("Successfully looked up local bean " + localBean);
 
       // invoke a method
       String message = "hello";
-      String returnedMessage = bean.echo(message);
-      logger.debug("Client sent message = " + message + " ; Bean returned message = " + returnedMessage );
-      
-      assertNotNull("Bean returned null message",returnedMessage);
-      assertEquals("Bean returned incorrect message",message,returnedMessage);
+      String returnedMessage = localBean.echo(message);
+      logger.debug("Client sent message = " + message + " ; Local bean returned message = " + returnedMessage );
 
+      assertNotNull("Local bean returned null message",returnedMessage);
+      assertEquals("Local bean returned incorrect message",message,returnedMessage);
+
+      // now let's check the remote business interface
+      SimpleSLSBRemote remoteBean = (SimpleSLSBRemote) ctx.lookup("SimpleSLSB/remote");
+      logger.debug("Successfully looked up remote bean " + remoteBean);
+
+      String messageFromRemoteBean = remoteBean.echo(message);
+      logger.debug("Client sent message = " + message + " ; remote bean returned = " + messageFromRemoteBean);
+
+      assertNotNull("Local bean returned null message",messageFromRemoteBean);
+      assertEquals("Local bean returned incorrect message",message,messageFromRemoteBean);
+
+
+
    }
 }

Modified: projects/ejb3/trunk/profile3_1/src/test/resources/log4j.xml
===================================================================
--- projects/ejb3/trunk/profile3_1/src/test/resources/log4j.xml	2009-02-11 05:05:33 UTC (rev 84084)
+++ projects/ejb3/trunk/profile3_1/src/test/resources/log4j.xml	2009-02-11 07:49:24 UTC (rev 84085)
@@ -23,7 +23,7 @@
   <!-- A time/date based rolling appender -->
   <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
     <param name="File" value="target/test.log"/>
-    <param name="Threshold" value="TRACE"/>
+    <param name="Threshold" value="DEBUG"/>
     <param name="Append" value="false"/>
 
     <!-- Rollover at midnight each day -->
@@ -40,7 +40,7 @@
       <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
       <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
        -->
-    </layout>	    
+    </layout>
   </appender>
 
   <!-- ============================== -->
@@ -60,19 +60,19 @@
   <!-- ================ -->
   <!-- Limit categories -->
   <!-- ================ -->
-  
+
   <category name="org.jboss">
-    <priority value="DEBUG"/>
-  </category>  
-  
+    <priority value="INFO"/>
+  </category>
+
   <category name="org.jnp">
     <priority value="INFO"/>
   </category>
-  
+
   <category name="org.jboss.ejb3">
     <priority value="ALL"/>
   </category>
-  
+
   <!-- ======================= -->
   <!-- Setup the Root category -->
   <!-- ======================= -->
@@ -81,5 +81,5 @@
     <appender-ref ref="CONSOLE"/>
     <appender-ref ref="FILE"/>
   </root>
-  
+
 </log4j:configuration>




More information about the jboss-cvs-commits mailing list