[jboss-cvs] JBossAS SVN: r62708 - in trunk/ejb3/src/test/org/jboss/ejb3/test/servlet: servlets and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue May 1 17:33:40 EDT 2007


Author: bdecoste
Date: 2007-05-01 17:33:39 -0400 (Tue, 01 May 2007)
New Revision: 62708

Added:
   trunk/ejb3/src/test/org/jboss/ejb3/test/servlet/StatelessBean.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/servlet/StatelessLocal.java
Modified:
   trunk/ejb3/src/test/org/jboss/ejb3/test/servlet/servlets/EJBServlet.java
Log:
test for injecting Local SFSB into servlet

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/servlet/StatelessBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/servlet/StatelessBean.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/servlet/StatelessBean.java	2007-05-01 21:33:39 UTC (rev 62708)
@@ -0,0 +1,47 @@
+/*
+ * 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.servlet;
+
+import javax.ejb.Local;
+import javax.ejb.Stateless;
+import javax.ejb.Stateful;
+
+import org.jboss.logging.Logger;
+
+/**
+ * @version <tt>$Revision: 61136 $</tt>
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+ at Stateful
+ at Local(StatelessLocal.class)
+public class StatelessBean implements StatelessLocal
+{
+   private static final Logger log = Logger.getLogger(StatelessBean.class);
+   
+   public void hello()
+   {
+   }
+   
+   public void goodbye()
+   {
+   }
+}

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/servlet/StatelessLocal.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/servlet/StatelessLocal.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/servlet/StatelessLocal.java	2007-05-01 21:33:39 UTC (rev 62708)
@@ -0,0 +1,34 @@
+/*
+ * 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.servlet;
+
+/**
+ * @version <tt>$Revision: 61136 $</tt>
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public interface StatelessLocal
+{
+   void hello();
+   
+   void goodbye();
+}
+

Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/servlet/servlets/EJBServlet.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/servlet/servlets/EJBServlet.java	2007-05-01 21:28:27 UTC (rev 62707)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/servlet/servlets/EJBServlet.java	2007-05-01 21:33:39 UTC (rev 62708)
@@ -23,20 +23,18 @@
 
 import java.io.IOException;
 import java.io.PrintWriter;
-import java.net.URL;
+import javax.ejb.EJB;
 import javax.naming.InitialContext;
 import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.servlet.ServletConfig;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.jboss.ejb3.Container;
 import org.jboss.ejb3.test.servlet.Session30;
 import org.jboss.ejb3.test.servlet.Session30LocalHome;
 import org.jboss.ejb3.test.servlet.Session30Home;
+import org.jboss.ejb3.test.servlet.StatelessLocal;
 import org.jboss.ejb3.test.servlet.TestObject;
 import org.jboss.ejb3.test.servlet.WarTestObject;
 import org.jboss.logging.Logger;
@@ -53,6 +51,12 @@
 {
    private static final Logger log = Logger.getLogger(EJBServlet.class);
    
+   @EJB
+   Session30 injectedSession;
+   
+   @EJB
+   StatelessLocal injectedStateful;
+   
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
          throws ServletException, IOException
    {
@@ -61,6 +65,12 @@
          SecurityAssociation.setPrincipal(new SimplePrincipal("somebody"));
          SecurityAssociation.setCredential("password".toCharArray());
          
+         injectedSession.hello();
+         injectedSession.goodbye();
+         
+         injectedStateful.hello();
+         injectedStateful.goodbye();
+           
          InitialContext ctx = new InitialContext();
         
          Session30 session = (Session30)ctx.lookup("ejb/Session30");




More information about the jboss-cvs-commits mailing list