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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Dec 4 18:57:39 EST 2007


Author: ALRubinger
Date: 2007-12-04 18:57:39 -0500 (Tue, 04 Dec 2007)
New Revision: 67913

Added:
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/Test21WithNoRemoteHomeInterfaceDefinedBean.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/Test21WithNoRemoteInterfaceDefinedBean.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/Test30WithRemoteBusinessInterfaceDefinedBean.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/TestRemote.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/TestRemoteBusiness.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/TestRemoteHome.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/unit/
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/unit/RemoteInterfaceDefinitionsUnitTestCase.java
Modified:
   trunk/ejb3/build-test.xml
Log:
[EJBTHREE-1127] Added Unit Tests

Modified: trunk/ejb3/build-test.xml
===================================================================
--- trunk/ejb3/build-test.xml	2007-12-04 22:49:55 UTC (rev 67912)
+++ trunk/ejb3/build-test.xml	2007-12-04 23:57:39 UTC (rev 67913)
@@ -2221,6 +2221,10 @@
    	
    </target>
 	
+   <target name="ejbthree1127" depends="compile-classes">
+      <build-simple-jar name="ejbthree1127"/>
+   </target>
+
    <target name="jbas4489"
       description="Builds a simple jar files."
       depends="compile-classes">
@@ -3794,7 +3798,7 @@
       ejbthree989, ejbthree1020, ejbthree1023, ejbthree1025, ejbthree1040,
       ejbthree1057, ejbthree1060,
       ejbthree1062,
-      ejbthree1066, ejbthree1071, ejbthree1075, ejbthree1082, ejbthree1119, ejbthree1122, ejbthree1123,
+      ejbthree1066, ejbthree1071, ejbthree1075, ejbthree1082, ejbthree1119, ejbthree1122, ejbthree1123, ejbthree1127,
       jaxws,
       aspectdomain, ejbcontext, schema, mail, scopedclassloader, dependency,
       securitydomain, enventry, security5,
@@ -4778,6 +4782,9 @@
          <param name="test" value="ejbthree1123"/>
       </antcall>
       <antcall target="test" inheritRefs="true">
+         <param name="test" value="ejbthree1127"/>
+      </antcall>
+      <antcall target="test" inheritRefs="true">
          <param name="test" value="statelesscreation"/>
       </antcall>
       <antcall target="test" inheritRefs="true">

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/Test21WithNoRemoteHomeInterfaceDefinedBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/Test21WithNoRemoteHomeInterfaceDefinedBean.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/Test21WithNoRemoteHomeInterfaceDefinedBean.java	2007-12-04 23:57:39 UTC (rev 67913)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.ejbthree1127;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.logging.Logger;
+
+/**
+ * A Test EJB with a 2.1 View denoted only by a Remote interface;
+ * the lack of a Remote Home must lead to deployment failure
+ * 
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision: $
+ */
+ at Stateless
+ at Remote(TestRemote.class)
+ at RemoteBinding(jndiBinding=TestRemote.JNDI_NAME_NO_REMOTE_HOME_DEFINED)
+public class Test21WithNoRemoteHomeInterfaceDefinedBean
+{
+   // Class Members
+   private static final Logger log = Logger.getLogger(Test21WithNoRemoteHomeInterfaceDefinedBean.class);
+
+   // Required Implementations
+
+   public int test()
+   {
+      log.info("Called");
+      return TestRemote.RETURN_VALUE;
+   }
+}


Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/Test21WithNoRemoteHomeInterfaceDefinedBean.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/Test21WithNoRemoteInterfaceDefinedBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/Test21WithNoRemoteInterfaceDefinedBean.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/Test21WithNoRemoteInterfaceDefinedBean.java	2007-12-04 23:57:39 UTC (rev 67913)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.ejbthree1127;
+
+import javax.ejb.RemoteHome;
+import javax.ejb.Stateless;
+
+import org.jboss.ejb3.annotation.RemoteHomeBinding;
+import org.jboss.logging.Logger;
+
+/**
+ * A Test EJB with a 2.1 View denoted only by a Remote Home interface;
+ * the Remote interface must be inferred by the return type of the Remote 
+ * Home's "create" method.
+ * 
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision: $
+ */
+ at Stateless
+ at RemoteHome(TestRemoteHome.class)
+ at RemoteHomeBinding(jndiBinding = TestRemoteHome.JNDI_NAME)
+public class Test21WithNoRemoteInterfaceDefinedBean
+{
+   // Class Members
+   private static final Logger log = Logger.getLogger(Test21WithNoRemoteInterfaceDefinedBean.class);
+
+   // Required Implementations
+
+   public int test()
+   {
+      log.info("Called");
+      return TestRemote.RETURN_VALUE;
+   }
+}


Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/Test21WithNoRemoteInterfaceDefinedBean.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/Test30WithRemoteBusinessInterfaceDefinedBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/Test30WithRemoteBusinessInterfaceDefinedBean.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/Test30WithRemoteBusinessInterfaceDefinedBean.java	2007-12-04 23:57:39 UTC (rev 67913)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.ejbthree1127;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.logging.Logger;
+
+/**
+ * A Test EJB with a 3.0 View denoted only by a Remote Business interface
+ * 
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision: $
+ */
+ at Stateless
+ at Remote(TestRemoteBusiness.class)
+ at RemoteBinding(jndiBinding = TestRemoteBusiness.JNDI_NAME)
+public class Test30WithRemoteBusinessInterfaceDefinedBean implements TestRemoteBusiness
+{
+   // Class Members
+   private static final Logger log = Logger.getLogger(Test30WithRemoteBusinessInterfaceDefinedBean.class);
+
+   // Required Implementations
+
+   public int test()
+   {
+      log.info("Called");
+      return TestRemoteBusiness.RETURN_VALUE;
+   }
+}


Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/Test30WithRemoteBusinessInterfaceDefinedBean.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/TestRemote.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/TestRemote.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/TestRemote.java	2007-12-04 23:57:39 UTC (rev 67913)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.ejbthree1127;
+
+import javax.ejb.EJBObject;
+
+/**
+ * An EJB2.1 Remote Interface
+ * 
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision: $
+ */
+public interface TestRemote extends EJBObject
+{
+   String JNDI_NAME_NO_REMOTE_DEFINED = "Test21BeanNoRemoteDefined/remote";
+   
+   String JNDI_NAME_NO_REMOTE_HOME_DEFINED = "Test21BeanNoRemoteHomeDefined/remote";
+   
+   int RETURN_VALUE = 1;
+   
+   int test();
+}


Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/TestRemote.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/TestRemoteBusiness.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/TestRemoteBusiness.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/TestRemoteBusiness.java	2007-12-04 23:57:39 UTC (rev 67913)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.ejbthree1127;
+
+/**
+ * A Test Remote Business interface
+ * 
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision: $
+ */
+public interface TestRemoteBusiness
+{
+   String JNDI_NAME = "TestRemoteWithBusinessInterfaceDefinedBean/remote";
+
+   int RETURN_VALUE = 1;
+
+   int test();
+}


Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/TestRemoteBusiness.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/TestRemoteHome.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/TestRemoteHome.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/TestRemoteHome.java	2007-12-04 23:57:39 UTC (rev 67913)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.ejbthree1127;
+
+import javax.ejb.EJBHome;
+
+/**
+ * An EJB2.1 Remote Home Interface
+ * 
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision: $
+ */
+public interface TestRemoteHome extends EJBHome
+{
+   String JNDI_NAME = "Test21BeanNoRemoteDefined/home";
+   
+   public TestRemote create() throws java.rmi.RemoteException, javax.ejb.CreateException;
+}
\ No newline at end of file


Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/TestRemoteHome.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/unit/RemoteInterfaceDefinitionsUnitTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/unit/RemoteInterfaceDefinitionsUnitTestCase.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/unit/RemoteInterfaceDefinitionsUnitTestCase.java	2007-12-04 23:57:39 UTC (rev 67913)
@@ -0,0 +1,106 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.ejbthree1127.unit;
+
+import javax.naming.NameNotFoundException;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.ejbthree1127.TestRemote;
+import org.jboss.ejb3.test.ejbthree1127.TestRemoteBusiness;
+import org.jboss.ejb3.test.ejbthree1127.TestRemoteHome;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * Tests that deployments succeed/fail based upon partially-denoted
+ * Remote, Remote Business, and Remote Home interfaces ensuring
+ * Spec-compliant defaults. 
+ * 
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision: $
+ */
+public class RemoteInterfaceDefinitionsUnitTestCase extends JBossTestCase
+{
+   // Constructor
+   public RemoteInterfaceDefinitionsUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   // Suite
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(RemoteInterfaceDefinitionsUnitTestCase.class, "ejbthree1127.jar");
+   }
+
+   // Tests 
+
+   /**
+    * Ensure that the Test EJB with 3.0 View defined only by @Remote to 
+    * Remote Business interface properly deploys
+    */
+   public void test30ViewRemoteBusinessInterfaceDefined() throws Exception
+   {
+      // Lookup EJB 
+      TestRemoteBusiness ejb = (TestRemoteBusiness) this.getInitialContext().lookup(
+            TestRemoteBusiness.JNDI_NAME);
+
+      // Invoke on it
+      assertEquals(ejb.test(), TestRemoteBusiness.RETURN_VALUE);
+   }
+   
+   /**
+    * Ensure that the Test EJB with 2.1 View defined only by @RemoteHome properly deploys
+    */
+   public void test21ViewRemoteInterfaceNotExplicitlyDefined() throws Exception
+   {
+      // Lookup EJB Home
+      TestRemoteHome home = (TestRemoteHome) this.getInitialContext().lookup(TestRemoteHome.JNDI_NAME);
+
+      // Obtain instance of EJB
+      TestRemote ejb = home.create();
+
+      // Invoke on it
+      assertEquals(ejb.test(), TestRemote.RETURN_VALUE);
+   }
+
+   /**
+    * Ensure that the Test EJB with 2.1 View defined only by a Remote interface 
+    * (no Remote Home) fails to deploy
+    */
+   public void test21ViewRemoteHomeInterfaceNotExplicitlyDefined() throws Exception
+   {
+      // Lookup EJB Home
+      try
+      {
+         this.getInitialContext().lookup(TestRemoteHome.JNDI_NAME);
+      }
+      catch (NameNotFoundException nnfe)
+      {
+         // Expected
+         return;
+      }
+
+      // If we've reached this point, the EJB that shouldn't have deployed, did
+      JBossTestCase.fail("Test EJB with 2.1 View defining no Remote Home should not successfully deploy.");
+   }
+}
\ No newline at end of file


Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1127/unit/RemoteInterfaceDefinitionsUnitTestCase.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain




More information about the jboss-cvs-commits mailing list