[jboss-cvs] JBossAS SVN: r70876 - in trunk/testsuite/src/main/org/jboss/test/refs: ejbs and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Mar 14 11:38:07 EDT 2008


Author: scott.stark at jboss.org
Date: 2008-03-14 11:38:07 -0400 (Fri, 14 Mar 2008)
New Revision: 70876

Added:
   trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatelessIFExt.java
   trunk/testsuite/src/main/org/jboss/test/refs/ejbs2/
   trunk/testsuite/src/main/org/jboss/test/refs/ejbs2/StatelessBean2.java
   trunk/testsuite/src/main/org/jboss/test/refs/ejbs2/StatelessTest.java
   trunk/testsuite/src/main/org/jboss/test/refs/ejbs2x/
   trunk/testsuite/src/main/org/jboss/test/refs/ejbs2x/Ejb2xStatelessBean.java
   trunk/testsuite/src/main/org/jboss/test/refs/ejbs2x/interfaces/
   trunk/testsuite/src/main/org/jboss/test/refs/ejbs2x/interfaces/Session.java
   trunk/testsuite/src/main/org/jboss/test/refs/ejbs2x/interfaces/SessionHome.java
   trunk/testsuite/src/main/org/jboss/test/refs/ejbs2x/package.html
Modified:
   trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatefulBean.java
   trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatelessBean.java
   trunk/testsuite/src/main/org/jboss/test/refs/test/RefResolutionUnitTestCase.java
Log:
Expand refs tests

Modified: trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatefulBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatefulBean.java	2008-03-14 15:27:25 UTC (rev 70875)
+++ trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatefulBean.java	2008-03-14 15:38:07 UTC (rev 70876)
@@ -30,7 +30,7 @@
  * @author Scott.Stark at jboss.org
  * @version $Revision$
  */
- at Stateful(name="StatefulBean", mappedName="refs/StatefulBean")
+ at Stateful(name="StatefulBean", mappedName="refs/ejbs/StatefulBean")
 @Remote({StatefulIF.class})
 public class StatefulBean implements StatefulIF
 {

Modified: trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatelessBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatelessBean.java	2008-03-14 15:27:25 UTC (rev 70875)
+++ trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatelessBean.java	2008-03-14 15:38:07 UTC (rev 70876)
@@ -32,20 +32,21 @@
  * @author Scott.Stark at jboss.org
  * @version $Revision$
  */
- at Stateless(name="StatelessBean", mappedName="refs/StatelessBean")
- at Remote({StatelessIF.class})
+ at Stateless(name="StatelessBean", mappedName="refs/ejbs/StatelessBean")
+ at Remote({StatelessIF.class, StatelessIFExt.class})
 @TransactionManagement(TransactionManagementType.CONTAINER)
-public class StatelessBean implements StatelessIF
+public class StatelessBean implements StatelessIF, StatelessIFExt
 {
    public void init(Properties prop) throws Exception
    {
    }
    public void test1() throws Exception
    {
-      
    }
    public void test2() throws Exception
    {
-      
    }
+   public void test3()
+   {
+   }
 }

Added: trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatelessIFExt.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatelessIFExt.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatelessIFExt.java	2008-03-14 15:38:07 UTC (rev 70876)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.refs.ejbs;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface StatelessIFExt extends StatelessIF
+{
+   public void test3();
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatelessIFExt.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: trunk/testsuite/src/main/org/jboss/test/refs/ejbs2/StatelessBean2.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/refs/ejbs2/StatelessBean2.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/refs/ejbs2/StatelessBean2.java	2008-03-14 15:38:07 UTC (rev 70876)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.refs.ejbs2;
+
+import javax.annotation.Resource;
+import javax.ejb.EJB;
+import javax.ejb.Remote;
+import javax.ejb.SessionContext;
+import javax.ejb.Stateless;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import org.jboss.test.refs.ejbs.StatelessIF;
+import org.jboss.test.refs.ejbs.StatelessIFExt;
+
+/**
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+ at Stateless(mappedName="refs/ejbs2/StatelessBean")
+ at Remote(StatelessTest.class)
+public class StatelessBean2
+{
+   @Resource SessionContext ctx;
+   @EJB
+   StatelessIF bean1;
+   @EJB(beanName="StatelessBean")
+   StatelessIF bean2;
+   @EJB(beanInterface=StatelessIFExt.class)
+   StatelessIF bean3;
+   @EJB(beanInterface=StatelessIFExt.class, beanName="StatelessBean")
+   StatelessIF bean4;
+   @EJB(beanInterface=StatelessIFExt.class, beanName="StatelessBean#refs-ejb.jar")
+   StatelessIF bean5;
+
+   public void validate()
+      throws Exception
+   {
+      if(bean1 == null)
+         throw new IllegalStateException("bean1 is null");
+      if(bean2 == null)
+         throw new IllegalStateException("bean2 is null");
+      if(bean3 == null)
+         throw new IllegalStateException("bean3 is null");
+      validateENCLookup();
+   }
+   private void validateSessionContextLookup()
+   {
+      if(ctx == null)
+         throw new IllegalStateException("SessionContext is null");
+      StatelessIF bean = (StatelessIF) ctx.lookup("bean1");
+      if(bean == null)
+         throw new IllegalStateException("SessionContext.lookup(bean1) is null");
+   }
+   private void validateENCLookup()
+      throws Exception
+   {
+      InitialContext ic = new InitialContext();
+      Context enc = (Context) ic.lookup("java:comp/env");
+      StatelessIF bean = (StatelessIF) enc.lookup("bean1");
+      if(bean == null)
+         throw new IllegalStateException("java:comp/env/bean1 is null");         
+   }
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/refs/ejbs2/StatelessBean2.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: trunk/testsuite/src/main/org/jboss/test/refs/ejbs2/StatelessTest.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/refs/ejbs2/StatelessTest.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/refs/ejbs2/StatelessTest.java	2008-03-14 15:38:07 UTC (rev 70876)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.refs.ejbs2;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface StatelessTest
+{
+   public void validate();
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/refs/ejbs2/StatelessTest.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: trunk/testsuite/src/main/org/jboss/test/refs/ejbs2x/Ejb2xStatelessBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/refs/ejbs2x/Ejb2xStatelessBean.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/refs/ejbs2x/Ejb2xStatelessBean.java	2008-03-14 15:38:07 UTC (rev 70876)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.refs.ejbs2x;
+
+import javax.ejb.CreateException;
+import javax.ejb.SessionContext;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class Ejb2xStatelessBean implements javax.ejb.SessionBean
+{
+   private static final long serialVersionUID = 1L;
+
+   public void setSessionContext(SessionContext context)
+   {
+   }
+   public void ejbCreate() throws CreateException
+   {
+   }
+   public void ejbRemove()
+   {
+   }
+   public void ejbActivate()
+   {
+   }
+   public void ejbPassivate()
+   {
+   }
+
+   public void checkRefs(String[] encNames) throws Exception
+   {
+      
+   }
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/refs/ejbs2x/Ejb2xStatelessBean.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: trunk/testsuite/src/main/org/jboss/test/refs/ejbs2x/interfaces/Session.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/refs/ejbs2x/interfaces/Session.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/refs/ejbs2x/interfaces/Session.java	2008-03-14 15:38:07 UTC (rev 70876)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.refs.ejbs2x.interfaces;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface Session extends javax.ejb.EJBObject
+{
+   public void checkRefs(String[] encNames) throws Exception;
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/refs/ejbs2x/interfaces/Session.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: trunk/testsuite/src/main/org/jboss/test/refs/ejbs2x/interfaces/SessionHome.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/refs/ejbs2x/interfaces/SessionHome.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/refs/ejbs2x/interfaces/SessionHome.java	2008-03-14 15:38:07 UTC (rev 70876)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.refs.ejbs2x.interfaces;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface SessionHome extends javax.ejb.EJBHome
+{
+   Session create(String entityName)
+     throws java.rmi.RemoteException, javax.ejb.CreateException;
+
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/refs/ejbs2x/interfaces/SessionHome.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: trunk/testsuite/src/main/org/jboss/test/refs/ejbs2x/package.html
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/refs/ejbs2x/package.html	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/refs/ejbs2x/package.html	2008-03-14 15:38:07 UTC (rev 70876)
@@ -0,0 +1,50 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+  <head>
+    <!--
+    	$Id:$
+      JBoss, Home of Professional Open Source
+      Copyright 2007, Red Hat Middleware LLC, and individual contributors
+      by the @authors tag. See the copyright.txt 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
+    -->
+  </head>
+
+  <body bgcolor="white">
+    <p><em>2.x EJBs</em> used to test references via xml.
+
+    <h2>Package Specification</h2>
+    <ul>
+      <li><a href="javascript: alert('not available')">Not Available</a>
+    </ul>
+      
+    <h2>Related Documentation</h2>
+    <ul>
+      <li><a href="javascript: alert('not available')">Not Available</a>
+    </ul>
+
+    <h2>Package Status</h2>
+    <ul>
+      <li><font color="green"><b>STABLE</b></font>
+    </ul>
+
+    <!-- Put @see and @since tags down here. -->
+
+  </body>
+</html>
+

Modified: trunk/testsuite/src/main/org/jboss/test/refs/test/RefResolutionUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/refs/test/RefResolutionUnitTestCase.java	2008-03-14 15:27:25 UTC (rev 70875)
+++ trunk/testsuite/src/main/org/jboss/test/refs/test/RefResolutionUnitTestCase.java	2008-03-14 15:38:07 UTC (rev 70876)
@@ -23,13 +23,41 @@
 
 import java.util.Date;
 
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+import javax.naming.InitialContext;
+
 import junit.framework.Test;
 
 import org.jboss.ejb3.client.ClientLauncher;
 import org.jboss.test.JBossTestCase;
 import org.jboss.test.refs.client.Client;
+import org.jboss.test.refs.ejbs2.StatelessTest;
 
 /**
+ * Tests of reference resolution. The ear consists of:
+ * 
+   refs.ear
+    + refs-client.jar
+      - @EJB(name = "ejb/StatefulBean", beanInterface = StatefulIF.class)
+        -> StatefulBean
+    + refs-ejb.jar
+      - StatefulBean
+         + @Stateful(name="StatefulBean", mappedName="refs/ejbs/StatefulBean")
+         + @Remote({StatefulIF.class})
+       - StatelessBean
+         + @Stateless(name="StatelessBean", mappedName="refs/ejbs/StatelessBean")
+         + @Remote({StatelessIF.class})
+    + refs-ejb2.jar
+      - StatelessBean2
+        + @Stateless(mappedName="refs/ejbs2/StatelessBean")
+        + @Remote(StatelessTest.class)
+        + @EJB
+          -> refs-ejb.jar#StatelessBean
+        + @EJB(beanName="StatelessBean")
+          -> refs-ejb.jar#StatelessBean
+        + @EJB(beanInterface=StatelessIFExt.class)
+          -> refs-ejb.jar#StatelessBean
  * @author Scott.Stark at jboss.org
  * @version $Revision$
  */
@@ -47,7 +75,20 @@
       super(name);
    }
 
-   public void testSessionRefByInterface()
+   public void testSessionEJBRefs()
+      throws Exception
+   {
+      InitialContext ctx = getInitialContext();
+      Object ref = ctx.lookup("refs/StatelessBean2/remote");
+      StatelessTest test = (StatelessTest) ref;
+      test.validate();
+   }
+
+   /**
+    * 
+    * @throws Throwable
+    */
+   public void testClientSessionRefByInterface()
       throws Throwable
    {
       String mainClassName = Client.class.getName();




More information about the jboss-cvs-commits mailing list