[jboss-cvs] JBossAS SVN: r59976 - in branches/Branch_4_2/testsuite: imports/sections and 12 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jan 24 11:31:06 EST 2007


Author: kabir.khan at jboss.com
Date: 2007-01-24 11:31:05 -0500 (Wed, 24 Jan 2007)
New Revision: 59976

Added:
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/ejb/
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/ejb/ExampleSession.java
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/ejb/ExampleSessionBean.java
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/ejb/ExampleSessionHome.java
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/interceptor/
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/interceptor/EJBInterceptor.java
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/interceptor/WebInterceptor.java
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/servlet/
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/servlet/EarExampleServlet.java
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/webinf/
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/webinf/classes/
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/webinf/classes/ClassesClass.java
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/webinf/lib/
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/webinf/lib/LibClass.java
   branches/Branch_4_2/testsuite/src/resources/aop/earwithwebinf/
   branches/Branch_4_2/testsuite/src/resources/aop/earwithwebinf/META-INF/
   branches/Branch_4_2/testsuite/src/resources/aop/earwithwebinf/META-INF/application.xml
   branches/Branch_4_2/testsuite/src/resources/aop/earwithwebinf/META-INF/ejb-jar.xml
   branches/Branch_4_2/testsuite/src/resources/aop/earwithwebinf/META-INF/jboss-aop.xml
   branches/Branch_4_2/testsuite/src/resources/aop/earwithwebinf/WEB-INF/
   branches/Branch_4_2/testsuite/src/resources/aop/earwithwebinf/WEB-INF/web.xml
Modified:
   branches/Branch_4_2/testsuite/build.xml
   branches/Branch_4_2/testsuite/imports/sections/aop.xml
Log:
[JBAOP-350] Verify that classes existing in WEB-INF/lib and WEB-INF/classes can be intercepted

Modified: branches/Branch_4_2/testsuite/build.xml
===================================================================
--- branches/Branch_4_2/testsuite/build.xml	2007-01-24 16:17:16 UTC (rev 59975)
+++ branches/Branch_4_2/testsuite/build.xml	2007-01-24 16:31:05 UTC (rev 59976)
@@ -679,7 +679,7 @@
     <exclude name="org/jboss/test/aop/test/Scoped*.class"/>
   </patternset>
   <patternset id="aop-with-classloader.includes">
-    <include name="org/jboss/test/aop/test/ScopedUnitTestCase.class"/>
+    <include name="org/jboss/test/aop/test/Scoped*TestCase.class"/>
   </patternset>
   
   <!-- The union of the excludes -->

Modified: branches/Branch_4_2/testsuite/imports/sections/aop.xml
===================================================================
--- branches/Branch_4_2/testsuite/imports/sections/aop.xml	2007-01-24 16:17:16 UTC (rev 59975)
+++ branches/Branch_4_2/testsuite/imports/sections/aop.xml	2007-01-24 16:31:05 UTC (rev 59976)
@@ -302,6 +302,54 @@
        </fileset>
     </jar>
 
+    
+    
+     <!-- Create jars for earwithwebinf test -->
+     <jar destfile="${build.lib}/aop-classesinwebinf.aop">
+        <fileset dir="${build.classes}">
+           <include name="org/jboss/test/aop/earwithwebinf/interceptor/EJBInterceptor.class"/>
+           <include name="org/jboss/test/aop/earwithwebinf/interceptor/WebInterceptor.class"/>
+        </fileset>
+        <fileset dir="${build.resources}/aop/earwithwebinf/">
+           <include name="META-INF/jboss-aop.xml"/>
+        </fileset>
+     </jar>
+     <jar destfile="${build.lib}/aop-classesinwebinf-lib.jar">
+        <fileset dir="${build.classes}">
+           <include name="org/jboss/test/aop/earwithwebinf/webinf/lib/*.class"/>
+        </fileset>
+     </jar>
+     <jar destfile="${build.lib}/aop-classesinwebinf.war">
+        <fileset dir="${build.resources}/aop/earwithwebinf/">
+           <include name="WEB-INF/web.xml"/>
+        </fileset>
+        <zipfileset dir="${build.classes}" prefix="WEB-INF/classes">
+           <include name="org/jboss/test/aop/earwithwebinf/webinf/classes/*.class"/>
+           <include name="org/jboss/test/aop/earwithwebinf/servlet/*.class"/>
+        </zipfileset>
+        <zipfileset dir="${build.lib}" prefix="WEB-INF/lib">
+           <include name="aop-classesinwebinf-lib.jar"/>
+        </zipfileset>
+     </jar>
+     <jar destfile="${build.lib}/aop-classesinwebinf-ejb.jar">
+        <fileset dir="${build.classes}">
+           <include name="org/jboss/test/aop/earwithwebinf/ejb/*.class"/>
+        </fileset>
+        <fileset dir="${build.resources}/aop/earwithwebinf/">
+           <include name="META-INF/ejb-jar.xml"/>
+        </fileset>
+     </jar>
+     <jar destfile="${build.lib}/aop-classesinwebinf.ear">
+        <fileset dir="${build.lib}">
+           <include name="aop-classesinwebinf.aop"/>
+           <include name="aop-classesinwebinf.war"/>
+           <include name="aop-classesinwebinf-ejb.jar"/>
+        </fileset>
+        <fileset dir="${build.resources}/aop/earwithwebinf/">
+           <include name="META-INF/application.xml"/>
+        </fileset>
+     </jar>
+
     <!-- ok, we have created the loadtime jars, let us now precompile the classes for standalone test  -->
 
     <!--

Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/ejb/ExampleSession.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/ejb/ExampleSession.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/ejb/ExampleSession.java	2007-01-24 16:31:05 UTC (rev 59976)
@@ -0,0 +1,35 @@
+/*
+* 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.test.aop.earwithwebinf.ejb;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.EJBObject;
+
+/** 
+ *  
+ * @author <a href="mailto:kabirkhan at bigfoot.com">Kabir Khan</a>
+ *
+ */
+public interface ExampleSession extends EJBObject {
+   String getValue(String s) throws RemoteException;
+}

Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/ejb/ExampleSessionBean.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/ejb/ExampleSessionBean.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/ejb/ExampleSessionBean.java	2007-01-24 16:31:05 UTC (rev 59976)
@@ -0,0 +1,51 @@
+/*
+* 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.test.aop.earwithwebinf.ejb;
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBException;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+
+/** 
+ *  
+ * @author <a href="mailto:kabirkhan at bigfoot.com">Kabir Khan</a>
+ *
+ */
+public class ExampleSessionBean implements SessionBean {
+
+   public void ejbCreate() throws CreateException{}
+   
+   public String getValue(String s)
+   {
+      System.out.println("ExampleSessionBean.getValue() " + s);
+      return "#" + s + "#";
+   }
+   
+
+   public void setSessionContext(SessionContext ctx) throws EJBException{}
+   public void ejbRemove() throws EJBException, RemoteException {}
+   public void ejbActivate() throws EJBException, RemoteException {}
+   public void ejbPassivate() throws EJBException, RemoteException {}
+    
+}

Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/ejb/ExampleSessionHome.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/ejb/ExampleSessionHome.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/ejb/ExampleSessionHome.java	2007-01-24 16:31:05 UTC (rev 59976)
@@ -0,0 +1,36 @@
+/*
+* 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.test.aop.earwithwebinf.ejb;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBHome;
+
+/** 
+ *  
+ * @author <a href="mailto:kabirkhan at bigfoot.com">Kabir Khan</a>
+ *
+ */
+public interface ExampleSessionHome extends EJBHome {
+   ExampleSession create() throws CreateException, RemoteException;
+}

Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/interceptor/EJBInterceptor.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/interceptor/EJBInterceptor.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/interceptor/EJBInterceptor.java	2007-01-24 16:31:05 UTC (rev 59976)
@@ -0,0 +1,45 @@
+/*
+* 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.test.aop.earwithwebinf.interceptor;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class EJBInterceptor implements Interceptor
+{
+   public static boolean invoked; 
+   public String getName()
+   {
+      return this.getClass().getName();
+   }
+
+   public Object invoke(Invocation invocation) throws Throwable
+   {
+      invoked = true;
+      return invocation.invokeNext();
+   }
+}

Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/interceptor/WebInterceptor.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/interceptor/WebInterceptor.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/interceptor/WebInterceptor.java	2007-01-24 16:31:05 UTC (rev 59976)
@@ -0,0 +1,45 @@
+/*
+* 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.test.aop.earwithwebinf.interceptor;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class WebInterceptor implements Interceptor
+{
+   public static boolean invoked; 
+   public String getName()
+   {
+      return this.getClass().getName();
+   }
+
+   public Object invoke(Invocation invocation) throws Throwable
+   {
+      invoked = true;
+      return invocation.invokeNext();
+   }
+}

Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/servlet/EarExampleServlet.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/servlet/EarExampleServlet.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/servlet/EarExampleServlet.java	2007-01-24 16:31:05 UTC (rev 59976)
@@ -0,0 +1,99 @@
+/*
+* 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.test.aop.earwithwebinf.servlet;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.test.aop.earwithwebinf.interceptor.EJBInterceptor;
+import org.jboss.test.aop.earwithwebinf.interceptor.WebInterceptor;
+import org.jboss.test.aop.earwithwebinf.webinf.classes.ClassesClass;
+import org.jboss.test.aop.earwithwebinf.webinf.lib.LibClass;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class EarExampleServlet extends HttpServlet
+{
+   public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+      try 
+      {
+         EJBInterceptor.invoked = false;
+         WebInterceptor.invoked = false;
+         ClassesClass classesClass = new ClassesClass();
+         if (EJBInterceptor.invoked) throw new RuntimeException("Should not have invoked EJBInterceptor");
+         if (!WebInterceptor.invoked) throw new RuntimeException("Should have invoked WebInterceptor");
+         
+         EJBInterceptor.invoked = false;
+         WebInterceptor.invoked = false;
+         String ret = classesClass.invokeEjb("Test");
+         if (!EJBInterceptor.invoked) throw new RuntimeException("Should have invoked EJBInterceptor");
+         if (!WebInterceptor.invoked) throw new RuntimeException("Should have invoked WebInterceptor");
+         if (!ret.equals("#Test#")) throw new RuntimeException("Did not reach EJBLayer");
+         
+         EJBInterceptor.invoked = false;
+         WebInterceptor.invoked = false;
+         LibClass libClass = new LibClass();
+         if (EJBInterceptor.invoked) throw new RuntimeException("Should not have invoked EJBInterceptor");
+         if (!WebInterceptor.invoked) throw new RuntimeException("Should have invoked WebInterceptor");
+         
+         EJBInterceptor.invoked = false;
+         WebInterceptor.invoked = false;
+         ret = libClass.invokeEjb("Test");
+         if (!EJBInterceptor.invoked) throw new RuntimeException("Should have invoked EJBInterceptor");
+         if (!WebInterceptor.invoked) throw new RuntimeException("Should have invoked WebInterceptor");
+         if (!ret.equals("#Test#")) throw new RuntimeException("Did not reach EJBLayer");
+         
+         //It worked
+         response.setContentType("text/html");
+         PrintWriter out = response.getWriter();
+         out.println("<html>");
+         out.println("<head><title>EarExampleServlet</title></head>");
+         out.println("<body>Tests passed<br></body>");
+         out.println("</html>");
+         out.close();
+      } 
+      catch (Exception e) 
+      {
+         e.printStackTrace();
+         
+         StringBuffer err = new StringBuffer(e.getClass().getName() + "\n");
+         err.append(e.getMessage() + "\n");
+         
+         StackTraceElement[] elements = e.getStackTrace();
+         for (int i = 0 ; i < elements.length ; i++)
+         {
+            err.append(elements[i].toString() + "\n");
+         }
+         
+         response.sendError(500, err.toString());
+      } 
+   }
+   
+}

Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/webinf/classes/ClassesClass.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/webinf/classes/ClassesClass.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/webinf/classes/ClassesClass.java	2007-01-24 16:31:05 UTC (rev 59976)
@@ -0,0 +1,45 @@
+/*
+* 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.test.aop.earwithwebinf.webinf.classes;
+
+import javax.naming.InitialContext;
+import javax.rmi.PortableRemoteObject;
+
+import org.jboss.test.aop.earwithwebinf.ejb.ExampleSessionHome;
+import org.jboss.test.aop.earwithwebinf.ejb.ExampleSession;;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassesClass
+{
+   public String invokeEjb(String s) throws Exception
+   {
+      InitialContext ctx = new InitialContext();
+      Object obj = ctx.lookup("ExampleSession");
+      ExampleSessionHome home = (ExampleSessionHome)PortableRemoteObject.narrow(obj, ExampleSessionHome.class);
+      ExampleSession exSess = home.create();
+      return exSess.getValue(s);
+   }
+}

Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/webinf/lib/LibClass.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/webinf/lib/LibClass.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/aop/earwithwebinf/webinf/lib/LibClass.java	2007-01-24 16:31:05 UTC (rev 59976)
@@ -0,0 +1,46 @@
+/*
+* 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.test.aop.earwithwebinf.webinf.lib;
+
+import javax.naming.InitialContext;
+import javax.rmi.PortableRemoteObject;
+
+import org.jboss.test.aop.earwithwebinf.ejb.ExampleSession;
+import org.jboss.test.aop.earwithwebinf.ejb.ExampleSessionHome;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class LibClass
+{
+   public String invokeEjb(String s) throws Exception
+   {
+      InitialContext ctx = new InitialContext();
+      Object obj = ctx.lookup("ExampleSession");
+      ExampleSessionHome home = (ExampleSessionHome)PortableRemoteObject.narrow(obj, ExampleSessionHome.class);
+      ExampleSession exSess = home.create();
+      return exSess.getValue(s);
+   }
+
+}

Added: branches/Branch_4_2/testsuite/src/resources/aop/earwithwebinf/META-INF/application.xml
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/aop/earwithwebinf/META-INF/application.xml	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/resources/aop/earwithwebinf/META-INF/application.xml	2007-01-24 16:31:05 UTC (rev 59976)
@@ -0,0 +1,18 @@
+<?xml version='1.0'  encoding='UTF-8'?>
+<!DOCTYPE application PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN'
+                             'http://java.sun.com/j2ee/dtds/application_1_2.dtd'>
+<application>
+    <display-name>AOP in JBoss example</display-name>
+    <module>
+        <java>aop-classesinwebinf.aop</java>
+    </module>
+    <module>
+        <ejb>aop-classesinwebinf-ejb.jar</ejb>
+    </module>
+    <module>
+        <web>
+           <web-uri>aop-classesinwebinf.war</web-uri>
+          <context-root>/classesinwebinf</context-root>
+       </web>
+   </module>
+</application>

Added: branches/Branch_4_2/testsuite/src/resources/aop/earwithwebinf/META-INF/ejb-jar.xml
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/aop/earwithwebinf/META-INF/ejb-jar.xml	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/resources/aop/earwithwebinf/META-INF/ejb-jar.xml	2007-01-24 16:31:05 UTC (rev 59976)
@@ -0,0 +1,23 @@
+<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
+    "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
+<ejb-jar>
+   <enterprise-beans>
+      <session>
+         <ejb-name>ExampleSession</ejb-name>
+         <home>org.jboss.test.aop.earwithwebinf.ejb.ExampleSessionHome</home>
+         <remote>org.jboss.test.aop.earwithwebinf.ejb.ExampleSession</remote>
+         <ejb-class>org.jboss.test.aop.earwithwebinf.ejb.ExampleSessionBean</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+      </session>
+    </enterprise-beans>
+    <assembly-descriptor>
+        <container-transaction>
+            <method>
+                <ejb-name>ExampleSession</ejb-name>
+                <method-name>*</method-name>
+            </method>
+            <trans-attribute>Required</trans-attribute>
+        </container-transaction>
+    </assembly-descriptor>
+</ejb-jar>

Added: branches/Branch_4_2/testsuite/src/resources/aop/earwithwebinf/META-INF/jboss-aop.xml
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/aop/earwithwebinf/META-INF/jboss-aop.xml	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/resources/aop/earwithwebinf/META-INF/jboss-aop.xml	2007-01-24 16:31:05 UTC (rev 59976)
@@ -0,0 +1,12 @@
+<aop>
+   <interceptor class="org.jboss.test.aop.earwithwebinf.interceptor.EJBInterceptor"/>
+   <interceptor class="org.jboss.test.aop.earwithwebinf.interceptor.WebInterceptor"/>
+   
+   <bind pointcut="all(org.jboss.test.aop.earwithwebinf.webinf.*)">
+	   <interceptor-ref name="org.jboss.test.aop.earwithwebinf.interceptor.WebInterceptor"/>
+   </bind>
+   
+   <bind pointcut="all(org.jboss.test.aop.earwithwebinf.ejb.*)">
+	   <interceptor-ref name="org.jboss.test.aop.earwithwebinf.interceptor.EJBInterceptor"/>
+   </bind>
+</aop>
\ No newline at end of file

Added: branches/Branch_4_2/testsuite/src/resources/aop/earwithwebinf/WEB-INF/web.xml
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/aop/earwithwebinf/WEB-INF/web.xml	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/resources/aop/earwithwebinf/WEB-INF/web.xml	2007-01-24 16:31:05 UTC (rev 59976)
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<!DOCTYPE web-app PUBLIC
+   "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+   "http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app>
+
+   <description>AOP in JBoss example, with some intercepted classes in the WEB-INF folder</description>
+
+   <servlet>
+      <servlet-name>EarExampleServlet</servlet-name>
+      <servlet-class>org.jboss.test.aop.earwithwebinf.servlet.EarExampleServlet</servlet-class>
+   </servlet>
+
+   <servlet-mapping>
+      <servlet-name>EarExampleServlet</servlet-name>
+      <url-pattern>/srv/*</url-pattern>
+   </servlet-mapping>
+</web-app>




More information about the jboss-cvs-commits mailing list