[jboss-cvs] JBossAS SVN: r64440 - in trunk/ejb3/src: resources/test and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Aug 2 19:42:34 EDT 2007


Author: bdecoste
Date: 2007-08-02 19:42:33 -0400 (Thu, 02 Aug 2007)
New Revision: 64440

Added:
   trunk/ejb3/src/resources/test/defaultremotebindings/
   trunk/ejb3/src/resources/test/defaultremotebindings/default-ejb3-interceptors-aop.xml
   trunk/ejb3/src/test/org/jboss/ejb3/test/defaultremotebindings/
   trunk/ejb3/src/test/org/jboss/ejb3/test/defaultremotebindings/StatelessBean.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/defaultremotebindings/StatelessRemote.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/defaultremotebindings/unit/
   trunk/ejb3/src/test/org/jboss/ejb3/test/defaultremotebindings/unit/DefaultRemoteBindingsTestCase.java
Modified:
   trunk/ejb3/src/main/org/jboss/ejb3/session/SessionContainer.java
Log:
[EJBTHREE-942] fix and test for default RemoteBinding in ejb3-interceptors-aop.xml. Moved binding metadata processing from init to create

Modified: trunk/ejb3/src/main/org/jboss/ejb3/session/SessionContainer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/session/SessionContainer.java	2007-08-02 23:27:17 UTC (rev 64439)
+++ trunk/ejb3/src/main/org/jboss/ejb3/session/SessionContainer.java	2007-08-02 23:42:33 UTC (rev 64440)
@@ -187,8 +187,8 @@
    public void processMetadata()
    {
       super.processMetadata();
-      proxyDeployer.initializeRemoteBindingMetadata();
-      proxyDeployer.initializeLocalBindingMetadata();
+      //proxyDeployer.initializeRemoteBindingMetadata();
+      //proxyDeployer.initializeLocalBindingMetadata();
    }
 
    protected List<Class<?>> resolveBusinessInterfaces()
@@ -199,6 +199,15 @@
       return list;
    }
    
+   public void create() throws Exception
+   {
+      super.create();
+      
+      // moved from processMetadata so AspectDomain is processed before proxy metadata
+      proxyDeployer.initializeRemoteBindingMetadata();
+      proxyDeployer.initializeLocalBindingMetadata();
+   }
+   
    public void start() throws Exception
    {
       super.start();

Added: trunk/ejb3/src/resources/test/defaultremotebindings/default-ejb3-interceptors-aop.xml
===================================================================
--- trunk/ejb3/src/resources/test/defaultremotebindings/default-ejb3-interceptors-aop.xml	                        (rev 0)
+++ trunk/ejb3/src/resources/test/defaultremotebindings/default-ejb3-interceptors-aop.xml	2007-08-02 23:42:33 UTC (rev 64440)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE aop PUBLIC
+   "-//JBoss//DTD JBOSS AOP 1.0//EN"
+   "http://labs.jboss.com/portal/jbossaop/dtd/jboss-aop_1_0.dtd">
+
+<aop>
+   <!--interceptor class="org.jboss.ejb3.asynchronous.AsynchronousInterceptor" scope="PER_CLASS"/>
+   <interceptor class="org.jboss.ejb3.ENCPropagationInterceptor" scope="PER_VM"/>
+   <interceptor factory="org.jboss.ejb3.security.AuthenticationInterceptorFactory" scope="PER_CLASS"/>
+   <interceptor name="Basic Authorization" factory="org.jboss.ejb3.security.RoleBasedAuthorizationInterceptorFactory" scope="PER_CLASS"/>
+   <interceptor factory="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory" scope="PER_CLASS"/>
+   <interceptor factory="org.jboss.ejb3.remoting.ReplicantsManagerInterceptorFactory" scope="PER_CLASS"/>
+   <interceptor class="org.jboss.ejb3.stateless.StatelessInstanceInterceptor" scope="PER_VM"/>
+   <interceptor class="org.jboss.aspects.tx.ClientTxPropagationInterceptor" scope="PER_VM"/>
+   <interceptor factory="org.jboss.ejb3.tx.TxInterceptorFactory" scope="PER_CLASS_JOINPOINT"/>
+   <interceptor class="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor" scope="PER_VM"/>
+   <interceptor factory="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory" scope="PER_CLASS_JOINPOINT"/-->
+   
+   <domain name="Test Stateless Bean">
+      <bind pointcut="execution(public * *->*(..))">
+         <interceptor-ref name="org.jboss.ejb3.asynchronous.AsynchronousInterceptor"/>
+         <interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/>
+         <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/>
+      </bind>
+      <bind pointcut="execution(public * @org.jboss.annotation.security.SecurityDomain->*(..))">
+         <interceptor-ref name="Basic Authorization"/>
+      </bind>
+      <bind pointcut="execution(public * @javax.annotation.security.RunAs->*(..))">
+         <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
+      </bind>
+      <bind pointcut="execution(public * @org.jboss.annotation.ejb.Clustered->*(..))">
+         <interceptor-ref name="org.jboss.ejb3.remoting.ReplicantsManagerInterceptorFactory"/>
+      </bind>
+      <bind pointcut="execution(public * *->*(..))">
+         <interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
+         <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
+         <interceptor-ref name="org.jboss.ejb3.tx.TxInterceptorFactory"/>
+         <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
+         <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
+         <interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/>
+      </bind>
+      <annotation expr="!class(@org.jboss.annotation.ejb.PoolClass)">
+         @org.jboss.annotation.ejb.PoolClass (value=org.jboss.ejb3.ThreadlocalPool.class, maxSize=30, timeout=10000)
+      </annotation>
+      <annotation expr="!class(@org.jboss.annotation.ejb.RemoteBinding)">
+         @org.jboss.annotation.ejb.RemoteBinding (jndiBinding="DefaultedStateless", factory = org.jboss.ejb3.remoting.RemoteProxyFactory.class, interceptorStack="", clientBindUrl = "")
+      </annotation>
+   </domain>
+</aop>
\ No newline at end of file

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/defaultremotebindings/StatelessBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/defaultremotebindings/StatelessBean.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/defaultremotebindings/StatelessBean.java	2007-08-02 23:42:33 UTC (rev 64440)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.defaultremotebindings;
+
+import javax.ejb.Stateless;
+import javax.ejb.Remote;
+
+import org.jboss.annotation.ejb.AspectDomain;
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+ at Stateless
+ at Remote(StatelessRemote.class)
+ at AspectDomain("Test Stateless Bean")
+public class StatelessBean implements StatelessRemote
+{
+   private static final Logger log = Logger.getLogger(StatelessBean.class);
+   
+   public void test()
+   {
+   }
+}

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/defaultremotebindings/StatelessRemote.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/defaultremotebindings/StatelessRemote.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/defaultremotebindings/StatelessRemote.java	2007-08-02 23:42:33 UTC (rev 64440)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.defaultremotebindings;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public interface StatelessRemote
+{
+   void test();
+}

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/defaultremotebindings/unit/DefaultRemoteBindingsTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/defaultremotebindings/unit/DefaultRemoteBindingsTestCase.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/defaultremotebindings/unit/DefaultRemoteBindingsTestCase.java	2007-08-02 23:42:33 UTC (rev 64440)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.defaultremotebindings.unit;
+
+import javax.ejb.EJBAccessException;
+
+import org.jboss.ejb3.test.defaultremotebindings.StatelessRemote;
+import org.jboss.logging.Logger;
+import org.jboss.test.JBossTestCase;
+import junit.framework.Test;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public class DefaultRemoteBindingsTestCase extends JBossTestCase
+{
+   private static final Logger log = Logger.getLogger(DefaultRemoteBindingsTestCase.class);
+
+   static boolean deployed = false;
+   static int test = 0;
+
+   public DefaultRemoteBindingsTestCase(String name)
+   {
+      super(name);
+   }
+ 
+   public void testDefault() throws Exception
+   {
+      try
+      {
+         StatelessRemote slsb = (StatelessRemote) getInitialContext().lookup("StatelessBean/remote");
+         fail("Default binding not used");
+      }
+      catch (javax.naming.NamingException e)
+      {
+         
+      }
+      
+      StatelessRemote slsb = (StatelessRemote) getInitialContext().lookup("DefaultedStateless");
+      assertNotNull(slsb);
+      
+      slsb.test();
+   }
+   
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(DefaultRemoteBindingsTestCase.class, "defaultremotebindings-test.jar");
+   }
+}
\ No newline at end of file




More information about the jboss-cvs-commits mailing list