[jboss-cvs] JBossAS SVN: r79292 - in projects/ejb3/trunk/proxy/src/test: java/org/jboss/ejb3/test/proxy/common and 5 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Oct 9 03:12:06 EDT 2008


Author: ALRubinger
Date: 2008-10-09 03:12:06 -0400 (Thu, 09 Oct 2008)
New Revision: 79292

Added:
   projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/ejbthree1517/
   projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/ejbthree1517/ReturnStaticValueInterceptor.java
   projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/ejbthree1517/TestClientInterceptorStack.java
   projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/ejbthree1517/TestClientInterceptorStackBeanBase.java
   projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/ejbthree1517/TestClientInterceptorStackStatefulBean.java
   projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/ejbthree1517/TestClientInterceptorStackStatelessBean.java
   projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/ejbthree1517/unit/
   projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/ejbthree1517/unit/OverrideClientInterceptorStackUnitTestCase.java
   projects/ejb3/trunk/proxy/src/test/resources/org/jboss/ejb3/test/proxy/ejbthree1517/
   projects/ejb3/trunk/proxy/src/test/resources/org/jboss/ejb3/test/proxy/ejbthree1517/unit/
   projects/ejb3/trunk/proxy/src/test/resources/org/jboss/ejb3/test/proxy/ejbthree1517/unit/ejb3-interceptors-ejbthree1517-aop.xml
Modified:
   projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/SessionTestCaseBase.java
Log:
[EJBTHREE-1517] Added Unit Tests

Modified: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/SessionTestCaseBase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/SessionTestCaseBase.java	2008-10-09 06:00:40 UTC (rev 79291)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/SessionTestCaseBase.java	2008-10-09 07:12:06 UTC (rev 79292)
@@ -28,6 +28,7 @@
 import org.jboss.ejb3.common.registrar.plugin.mc.Ejb3McRegistrar;
 import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
 import org.jboss.ejb3.test.mc.bootstrap.EmbeddedTestMcBootstrap;
+import org.jboss.logging.Logger;
 
 /**
  * SessionTestCaseBase
@@ -44,9 +45,11 @@
    // Class Members ------------------------------------------------------------------||
    // --------------------------------------------------------------------------------||
 
+   private static final Logger log = Logger.getLogger(SessionTestCaseBase.class);
+
    protected static EmbeddedTestMcBootstrap bootstrap;
 
-   public static final String FILENAME_EJB3_INTERCEPTORS_AOP = "ejb3-interceptors-aop.xml";
+   protected static final String FILENAME_EJB3_INTERCEPTORS_AOP = "ejb3-interceptors-aop.xml";
 
    // --------------------------------------------------------------------------------||
    // Lifecycle Methods --------------------------------------------------------------||
@@ -62,12 +65,24 @@
 
       // Load ejb3-interceptors-aop.xml into AspectManager
       ClassLoader cl = Thread.currentThread().getContextClassLoader();
-      URL url = cl.getResource(FILENAME_EJB3_INTERCEPTORS_AOP);
+      String ejb3InterceptorsAopFilename = getEjb3InterceptorsAopFilename();
+      URL url = cl.getResource(ejb3InterceptorsAopFilename);
       if (url == null)
       {
          throw new RuntimeException("Could not load " + AspectManager.class.getSimpleName()
-               + " with definitions from XML as file " + FILENAME_EJB3_INTERCEPTORS_AOP + " could not be found");
+               + " with definitions from XML as file " + ejb3InterceptorsAopFilename + " could not be found");
       }
       AspectXmlLoader.deployXML(url);
+      log.info("Deployed AOP XML: " + ejb3InterceptorsAopFilename);
    }
+
+   // --------------------------------------------------------------------------------||
+   // Accessors ----------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   protected static String getEjb3InterceptorsAopFilename()
+   {
+      return SessionTestCaseBase.FILENAME_EJB3_INTERCEPTORS_AOP;
+   }
+
 }

Added: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/ejbthree1517/ReturnStaticValueInterceptor.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/ejbthree1517/ReturnStaticValueInterceptor.java	                        (rev 0)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/ejbthree1517/ReturnStaticValueInterceptor.java	2008-10-09 07:12:06 UTC (rev 79292)
@@ -0,0 +1,70 @@
+/*
+ * 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.test.proxy.ejbthree1517;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.logging.Logger;
+
+/**
+ * ReturnStaticValueInterceptor
+ * 
+ * A test interceptor which returns a static value
+ * upon every invocation 
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class ReturnStaticValueInterceptor implements Interceptor
+{
+
+   // --------------------------------------------------------------------------------||
+   // Class Members ------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   private static final Logger log = Logger.getLogger(ReturnStaticValueInterceptor.class);
+
+   public static final String RETURN_VALUE = "ALR is better than Carlo.";
+
+   // --------------------------------------------------------------------------------||
+   // Required Implementations -------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /* (non-Javadoc)
+    * @see org.jboss.aop.advice.Interceptor#getName()
+    */
+   public String getName()
+   {
+      return this.getClass().getName();
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.aop.advice.Interceptor#invoke(org.jboss.aop.joinpoint.Invocation)
+    */
+   public Object invoke(Invocation invocation) throws Throwable
+   {
+      // No matter the invocation, return the set value
+      log.info("Going to return static value for invocation " + invocation);
+      return ReturnStaticValueInterceptor.RETURN_VALUE;
+   }
+
+}

Added: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/ejbthree1517/TestClientInterceptorStack.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/ejbthree1517/TestClientInterceptorStack.java	                        (rev 0)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/ejbthree1517/TestClientInterceptorStack.java	2008-10-09 07:12:06 UTC (rev 79292)
@@ -0,0 +1,71 @@
+/*
+ * 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.test.proxy.ejbthree1517;
+
+/**
+ * TestClientInterceptorStack
+ * 
+ * A Remote Business interface to test the remote client 
+ * interceptor stack explicitly defined by @RemoteBinding.interceptorStack
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface TestClientInterceptorStack
+{
+   // --------------------------------------------------------------------------------||
+   // Class Members ------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /*
+    * Default Return Value
+    */
+   String DEFAULT_RETURN_VALUE = "Standard Return Value from the Bean";
+
+   /*
+    * JNDI Bindings
+    */
+
+   String JNDI_BINDING_NORMAL_STACK_SFSB = "SFSB-Normal";
+
+   String JNDI_BINDING_OVERRIDDEN_STACK_SFSB = "SFSB-Overridden";
+
+   String JNDI_BINDING_NORMAL_STACK_SLSB = "SLSB-Normal";
+
+   String JNDI_BINDING_OVERRIDDEN_STACK_SLSB = "SLSB-Overridden";
+
+   /*
+    * Interceptor Stacks
+    */
+
+   String INTERCEPTOR_STACK_OVERRIDE = "OverrideInterceptors_EJBTHREE-1517";
+
+   // --------------------------------------------------------------------------------||
+   // Required Implementations -------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /**
+    * Returns the value, which will either be TestClientInterceptorStack.DEFAULT_RETURN_VALUE
+    * or something defined by an interceptor in an overridden stack
+    */
+   String getValue();
+}

Added: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/ejbthree1517/TestClientInterceptorStackBeanBase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/ejbthree1517/TestClientInterceptorStackBeanBase.java	                        (rev 0)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/ejbthree1517/TestClientInterceptorStackBeanBase.java	2008-10-09 07:12:06 UTC (rev 79292)
@@ -0,0 +1,46 @@
+/*
+ * 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.test.proxy.ejbthree1517;
+
+/**
+ * TestClientInterceptorStackBeanBase
+ * 
+ * Base class for test EJBs 
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class TestClientInterceptorStackBeanBase implements TestClientInterceptorStack
+{
+   // --------------------------------------------------------------------------------||
+   // Required Implementations -------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /**
+    * Returns the value, which will either be TestClientInterceptorStack.DEFAULT_RETURN_VALUE
+    * or something defined by an interceptor in an overridden stack
+    */
+   public String getValue()
+   {
+      return TestClientInterceptorStack.DEFAULT_RETURN_VALUE;
+   }
+}

Added: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/ejbthree1517/TestClientInterceptorStackStatefulBean.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/ejbthree1517/TestClientInterceptorStackStatefulBean.java	                        (rev 0)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/ejbthree1517/TestClientInterceptorStackStatefulBean.java	2008-10-09 07:12:06 UTC (rev 79292)
@@ -0,0 +1,50 @@
+/*
+ * 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.test.proxy.ejbthree1517;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateful;
+
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.annotation.RemoteBindings;
+
+/**
+ * TestClientInterceptorStackStatefulBean
+ * 
+ * A test SFSB with 2 bindings, one for the standard
+ * client interceptor stack and one for an overridden stack
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+ at Stateful
+ at Remote(TestClientInterceptorStack.class)
+ at RemoteBindings(
+{
+      @RemoteBinding(jndiBinding = TestClientInterceptorStack.JNDI_BINDING_NORMAL_STACK_SFSB),
+      @RemoteBinding(jndiBinding = TestClientInterceptorStack.JNDI_BINDING_OVERRIDDEN_STACK_SFSB, interceptorStack = TestClientInterceptorStack.INTERCEPTOR_STACK_OVERRIDE)})
+public class TestClientInterceptorStackStatefulBean extends TestClientInterceptorStackBeanBase
+      implements
+         TestClientInterceptorStack
+{
+
+}

Added: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/ejbthree1517/TestClientInterceptorStackStatelessBean.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/ejbthree1517/TestClientInterceptorStackStatelessBean.java	                        (rev 0)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/ejbthree1517/TestClientInterceptorStackStatelessBean.java	2008-10-09 07:12:06 UTC (rev 79292)
@@ -0,0 +1,50 @@
+/*
+ * 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.test.proxy.ejbthree1517;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.annotation.RemoteBindings;
+
+/**
+ * TestClientInterceptorStackStatelessBean
+ * 
+ * A test SLSB with 2 bindings, one for the standard
+ * client interceptor stack and one for an overridden stack
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+ at Stateless
+ at Remote(TestClientInterceptorStack.class)
+ at RemoteBindings(
+{
+      @RemoteBinding(jndiBinding = TestClientInterceptorStack.JNDI_BINDING_NORMAL_STACK_SLSB),
+      @RemoteBinding(jndiBinding = TestClientInterceptorStack.JNDI_BINDING_OVERRIDDEN_STACK_SLSB, interceptorStack = TestClientInterceptorStack.INTERCEPTOR_STACK_OVERRIDE)})
+public class TestClientInterceptorStackStatelessBean extends TestClientInterceptorStackBeanBase
+      implements
+         TestClientInterceptorStack
+{
+
+}

Added: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/ejbthree1517/unit/OverrideClientInterceptorStackUnitTestCase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/ejbthree1517/unit/OverrideClientInterceptorStackUnitTestCase.java	                        (rev 0)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/ejbthree1517/unit/OverrideClientInterceptorStackUnitTestCase.java	2008-10-09 07:12:06 UTC (rev 79292)
@@ -0,0 +1,201 @@
+/*
+ * 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.test.proxy.ejbthree1517.unit;
+
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import junit.framework.TestCase;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.AspectXmlLoader;
+import org.jboss.ejb3.common.registrar.plugin.mc.Ejb3McRegistrar;
+import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
+import org.jboss.ejb3.test.mc.bootstrap.EmbeddedTestMcBootstrap;
+import org.jboss.ejb3.test.proxy.common.SessionTestCaseBase;
+import org.jboss.ejb3.test.proxy.common.Utils;
+import org.jboss.ejb3.test.proxy.common.container.SessionContainer;
+import org.jboss.ejb3.test.proxy.common.container.StatefulContainer;
+import org.jboss.ejb3.test.proxy.common.container.StatelessContainer;
+import org.jboss.ejb3.test.proxy.ejbthree1517.ReturnStaticValueInterceptor;
+import org.jboss.ejb3.test.proxy.ejbthree1517.TestClientInterceptorStack;
+import org.jboss.ejb3.test.proxy.ejbthree1517.TestClientInterceptorStackStatefulBean;
+import org.jboss.ejb3.test.proxy.ejbthree1517.TestClientInterceptorStackStatelessBean;
+import org.jboss.logging.Logger;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * OverrideClientInterceptorStackUnitTestCase
+ * 
+ * Test Cases to ensure that the client interceptor stack
+ * may be overridden via @RemoteBinding.interceptorStack
+ * 
+ * EJBTHREE-1517
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class OverrideClientInterceptorStackUnitTestCase
+{
+
+   // --------------------------------------------------------------------------------||
+   // Class Members ------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   private static final Logger log = Logger.getLogger(OverrideClientInterceptorStackUnitTestCase.class);
+
+   protected static EmbeddedTestMcBootstrap bootstrap;
+
+   protected static final String FILENAME_EJB3_INTERCEPTORS_AOP = "org/jboss/ejb3/test/proxy/ejbthree1517/unit/ejb3-interceptors-ejbthree1517-aop.xml";
+
+   protected static Context context = null;
+
+   protected static final Set<SessionContainer> containers = new HashSet<SessionContainer>();
+
+   // --------------------------------------------------------------------------------||
+   // Tests --------------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /**
+    * Ensures that SLSB bindings for both a standard interceptor stack
+    * and an overridden one may be made side-by-side, and further that
+    * the overridden stack is applied
+    */
+   @Test
+   public void testSlsbClientInterceptorStackOverride() throws Exception
+   {
+      // Lookup the proxies
+      TestClientInterceptorStack normal = (TestClientInterceptorStack) context
+            .lookup(TestClientInterceptorStack.JNDI_BINDING_NORMAL_STACK_SLSB);
+      TestClientInterceptorStack overridden = (TestClientInterceptorStack) context
+            .lookup(TestClientInterceptorStack.JNDI_BINDING_OVERRIDDEN_STACK_SLSB);
+
+      // Invoke upon the standard
+      String returnValueStandard = normal.getValue();
+      TestCase.assertEquals(TestClientInterceptorStack.DEFAULT_RETURN_VALUE, returnValueStandard);
+      log.info("Got expected result from SLSB Standard Binding: " + returnValueStandard);
+
+      // Invoke upon the overridden
+      String returnValueOverridden = overridden.getValue();
+      TestCase.assertEquals(ReturnStaticValueInterceptor.RETURN_VALUE, returnValueOverridden);
+      log.info("Got expected result from SLSB Overridden Binding: " + returnValueOverridden);
+   }
+
+   /**
+    * Ensures that SFSB bindings for both a standard interceptor stack
+    * and an overridden one may be made side-by-side, and further that
+    * the overridden stack is applied
+    */
+   @Test
+   public void testSfsbClientInterceptorStackOverride() throws Exception
+   {
+      // Lookup the proxies
+      TestClientInterceptorStack normal = (TestClientInterceptorStack) context
+            .lookup(TestClientInterceptorStack.JNDI_BINDING_NORMAL_STACK_SFSB);
+      TestClientInterceptorStack overridden = (TestClientInterceptorStack) context
+            .lookup(TestClientInterceptorStack.JNDI_BINDING_OVERRIDDEN_STACK_SFSB);
+
+      // Invoke upon the standard
+      String returnValueStandard = normal.getValue();
+      TestCase.assertEquals(TestClientInterceptorStack.DEFAULT_RETURN_VALUE, returnValueStandard);
+      log.info("Got expected result from SFSB Standard Binding: " + returnValueStandard);
+
+      // Invoke upon the overridden
+      String returnValueOverridden = overridden.getValue();
+      TestCase.assertEquals(ReturnStaticValueInterceptor.RETURN_VALUE, returnValueOverridden);
+      log.info("Got expected result from SFSB Overridden Binding: " + returnValueOverridden);
+   }
+
+   // --------------------------------------------------------------------------------||
+   // Lifecycle Methods --------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   @BeforeClass
+   public static void setUpBeforeClass() throws Throwable
+   {
+      // Start up MC
+      bootstrap = new EmbeddedTestMcBootstrap();
+      bootstrap.run();
+
+      // Bind the Registrar
+      Ejb3RegistrarLocator.bindRegistrar(new Ejb3McRegistrar(bootstrap.getKernel()));
+
+      // Load ejb3-interceptors-aop.xml into AspectManager
+      ClassLoader cl = Thread.currentThread().getContextClassLoader();
+      String ejb3InterceptorsAopFilename = getEjb3InterceptorsAopFilename();
+      URL url = cl.getResource(ejb3InterceptorsAopFilename);
+      if (url == null)
+      {
+         throw new RuntimeException("Could not load " + AspectManager.class.getSimpleName()
+               + " with definitions from XML as file " + ejb3InterceptorsAopFilename + " could not be found");
+      }
+      AspectXmlLoader.deployXML(url);
+      log.info("Deployed AOP XML: " + ejb3InterceptorsAopFilename);
+
+      // Throw Session EJB Support into MC
+      bootstrap.deploy(SessionTestCaseBase.class);
+
+      // Create the EJBs
+      StatefulContainer sfsb = Utils.createSfsb(TestClientInterceptorStackStatefulBean.class);
+      StatelessContainer slsb = Utils.createSlsb(TestClientInterceptorStackStatelessBean.class);
+
+      // Add the containers for accessing later
+      containers.add(sfsb);
+      containers.add(slsb);
+
+      // Bind the containers
+      for (SessionContainer container : containers)
+      {
+         Ejb3RegistrarLocator.locateRegistrar().bind(container.getName(), container);
+      }
+
+      // Create JNDI Context
+      context = new InitialContext(); // Props from CP jndi.properties
+   }
+
+   @AfterClass
+   public static void tearDownAfterClass() throws Throwable
+   {
+      // For each container
+      for (SessionContainer container : containers)
+      {
+         // Bring down the house
+         Ejb3RegistrarLocator.locateRegistrar().unbind(container.getName());
+      }
+   }
+
+   // --------------------------------------------------------------------------------||
+   // Accessors ----------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   protected static String getEjb3InterceptorsAopFilename()
+   {
+      return OverrideClientInterceptorStackUnitTestCase.FILENAME_EJB3_INTERCEPTORS_AOP;
+   }
+
+}

Added: projects/ejb3/trunk/proxy/src/test/resources/org/jboss/ejb3/test/proxy/ejbthree1517/unit/ejb3-interceptors-ejbthree1517-aop.xml
===================================================================
--- projects/ejb3/trunk/proxy/src/test/resources/org/jboss/ejb3/test/proxy/ejbthree1517/unit/ejb3-interceptors-ejbthree1517-aop.xml	                        (rev 0)
+++ projects/ejb3/trunk/proxy/src/test/resources/org/jboss/ejb3/test/proxy/ejbthree1517/unit/ejb3-interceptors-ejbthree1517-aop.xml	2008-10-09 07:12:06 UTC (rev 79292)
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- 
+  
+  Interceptors definitions for EJBTHREE-1517
+  
+-->
+<aop xmlns="urn:jboss:aop-beans:1.0">
+
+  <!-- 
+    
+    Interceptor Definitions
+    
+  -->
+
+  <interceptor
+    class="org.jboss.aspects.remoting.InvokeRemoteInterceptor"
+    scope="PER_VM" />
+  <interceptor
+    class="org.jboss.ejb3.test.proxy.ejbthree1517.ReturnStaticValueInterceptor"
+    scope="PER_VM" />
+
+  <!-- 
+    
+    Standard Client Interceptor Stack Definitions 
+    
+  -->
+
+  <stack name="StatelessSessionClientInterceptors">
+    <interceptor-ref
+      name="org.jboss.aspects.remoting.InvokeRemoteInterceptor" />
+  </stack>
+
+  <stack name="StatefulSessionClientInterceptors">
+    <interceptor-ref
+      name="org.jboss.aspects.remoting.InvokeRemoteInterceptor" />
+  </stack>
+
+  <!-- 
+    
+    Override Client Interceptor Stack Definitions 
+    
+  -->
+
+  <stack name="OverrideInterceptors_EJBTHREE-1517">
+    <interceptor-ref
+      name="org.jboss.ejb3.test.proxy.ejbthree1517.ReturnStaticValueInterceptor" />
+  </stack>
+
+</aop>
\ No newline at end of file




More information about the jboss-cvs-commits mailing list