[jboss-cvs] JBossAS SVN: r70807 - in projects/ejb3/trunk/core: src/test/java/org/jboss/ejb3/test and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Mar 13 06:29:03 EDT 2008


Author: wolfc
Date: 2008-03-13 06:29:03 -0400 (Thu, 13 Mar 2008)
New Revision: 70807

Added:
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/A.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/ABean.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/B.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/BBean.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/Client.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/Intercept.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/unit/
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/unit/SuperInterceptUnitTestCase.java
Modified:
   projects/ejb3/trunk/core/build-test.xml
Log:
EJBTHREE-471: unit test

Modified: projects/ejb3/trunk/core/build-test.xml
===================================================================
--- projects/ejb3/trunk/core/build-test.xml	2008-03-13 09:35:50 UTC (rev 70806)
+++ projects/ejb3/trunk/core/build-test.xml	2008-03-13 10:29:03 UTC (rev 70807)
@@ -1932,6 +1932,10 @@
       </ear>
    </target>
 
+   <target name="ejbthree471" >
+      <build-simple-jar name="ejbthree471"/>
+   </target>
+
    <target name="ejbthree485"
       description="Builds all jar files."
       >
@@ -4144,7 +4148,8 @@
    
    <target name="jars" depends="statefulproxyfactoryoverride, mdbsessionpoolclear, removedislocal, statelesscreation, defaultremotebindings, localfromremote, clusteredjms, entityoptimisticlocking, concurrentnaming, propertyreplacement, persistenceunits, appclient, tck5sec, invalidtxmdb, descriptortypo, libdeployment, homeinterface, arjuna, mdbtransactions, unauthenticatedprincipal, clusteredservice, invoker, classloader,
       circulardependency, jsp, timerdependency, servicedependency, servlet, stateless14, webservices, ear, ejbthree440,
-      ejbthree454, ejbthree653, ejbthree670, ejbthree712, ejbthree724, ejbthree751,
+      ejbthree454, ejbthree471, 
+   	  ejbthree653, ejbthree670, ejbthree712, ejbthree724, ejbthree751,
       ejbthree785, 
       ejbthree786, 
       ejbthree832, ejbthree921, ejbthree936,
@@ -5069,6 +5074,9 @@
          <param name="test" value="microbench"/>
       </antcall>
       <antcall target="test" inheritRefs="true">
+         <param name="test" value="ejbthree471"/>
+      </antcall>
+      <antcall target="test" inheritRefs="true">
          <param name="test" value="ejbthree712"/>
       </antcall>
       <antcall target="test" inheritRefs="true">

Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/A.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/A.java	                        (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/A.java	2008-03-13 10:29:03 UTC (rev 70807)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007-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.ejbthree471;
+
+/**
+ * @author <a href="mailto:amay at ingenta.com">Andrew May</a>
+ * @version $Revision: $
+ */
+public interface A
+{
+   public String getMessage();
+}


Property changes on: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/A.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/ABean.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/ABean.java	                        (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/ABean.java	2008-03-13 10:29:03 UTC (rev 70807)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007-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.ejbthree471;
+
+/**
+ * @author <a href="mailto:amay at ingenta.com">Andrew May</a>
+ * @version $Revision: $
+ */
+abstract public class ABean implements A
+{
+   public String getMessage()
+   {
+      return "The Message";
+   }
+}


Property changes on: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/ABean.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/B.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/B.java	                        (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/B.java	2008-03-13 10:29:03 UTC (rev 70807)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007-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.ejbthree471;
+
+/**
+ * @author <a href="mailto:amay at ingenta.com">Andrew May</a>
+ * @version $Revision: $
+ */
+public interface B extends A
+{
+   String getOtherMessage();
+}


Property changes on: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/B.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/BBean.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/BBean.java	                        (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/BBean.java	2008-03-13 10:29:03 UTC (rev 70807)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007-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.ejbthree471;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+import javax.interceptor.Interceptors;
+
+/**
+ * @author <a href="mailto:amay at ingenta.com">Andrew May</a>
+ * @version $Revision: $
+ */
+ at Stateless
+ at Remote(B.class)
+ at Interceptors({Intercept.class})
+public class BBean extends ABean implements B
+{
+   public String getOtherMessage()
+   {
+      return "The Other Message";
+   }
+}


Property changes on: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/BBean.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/Client.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/Client.java	                        (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/Client.java	2008-03-13 10:29:03 UTC (rev 70807)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007-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.ejbthree471;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+/**
+ * @author <a href="mailto:amay at ingenta.com">Andrew May</a>
+ * @version $Revision: $
+ */
+public class Client
+{
+   public static void main(String[] args) throws Exception
+   {
+      Hashtable<String, String> props = new Hashtable<String, String>();
+      props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
+      props.put(Context.PROVIDER_URL, "localhost:1099");
+      Context ctx = new InitialContext(props);
+      
+      B b = (B)ctx.lookup("BBean/remote");
+      System.out.println(b.getMessage());
+      System.out.println(b.getOtherMessage());
+   }
+}


Property changes on: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/Client.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/Intercept.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/Intercept.java	                        (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/Intercept.java	2008-03-13 10:29:03 UTC (rev 70807)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007-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.ejbthree471;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+/**
+ * @author <a href="mailto:amay at ingenta.com">Andrew May</a>
+ * @version $Revision: $
+ */
+public class Intercept
+{
+   @AroundInvoke
+   Object audit(InvocationContext ctx) throws Exception
+   {
+      String message = (String)ctx.proceed();
+      //System.out.println("Interceptor called for "+ctx.getMethod().getName());
+      return "Intercepted: "+message;
+   }
+}


Property changes on: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/Intercept.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/unit/SuperInterceptUnitTestCase.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/unit/SuperInterceptUnitTestCase.java	                        (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/unit/SuperInterceptUnitTestCase.java	2008-03-13 10:29:03 UTC (rev 70807)
@@ -0,0 +1,62 @@
+/*
+ * 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.ejbthree471.unit;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.ejbthree471.B;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * Interceptor must also apply to super-methods.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class SuperInterceptUnitTestCase extends JBossTestCase
+{
+   public SuperInterceptUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testHasBeenIntercepted() throws Exception
+   {
+      B b = (B) getInitialContext().lookup("BBean/remote");
+      
+      String result = b.getOtherMessage();
+      assertEquals("Intercepted: The Other Message", result);
+   }
+   
+   public void testHasSuperBeenIntercepted() throws Exception
+   {
+      B b = (B) getInitialContext().lookup("BBean/remote");
+      
+      String result = b.getMessage();
+      assertEquals("Intercepted: The Message", result);
+   }
+   
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(SuperInterceptUnitTestCase.class, "ejbthree471.jar");
+   }
+}


Property changes on: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/ejbthree471/unit/SuperInterceptUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native




More information about the jboss-cvs-commits mailing list