[jboss-cvs] JBossAS SVN: r81596 - in projects/ejb3/trunk/testsuite: 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
Tue Nov 25 22:05:06 EST 2008


Author: ALRubinger
Date: 2008-11-25 22:05:06 -0500 (Tue, 25 Nov 2008)
New Revision: 81596

Added:
   projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1603/
   projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1603/SelfDependencyBase.java
   projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1603/SelfDependencyBean.java
   projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1603/SelfDependencyLocalBusiness.java
   projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1603/SelfDependencyRemoteBusiness.java
   projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1603/unit/
   projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1603/unit/SelfDependencyTestCase.java
Modified:
   projects/ejb3/trunk/testsuite/build-test.xml
Log:
[EJBTHREE-1603] Added Unit Tests exposing failure

Modified: projects/ejb3/trunk/testsuite/build-test.xml
===================================================================
--- projects/ejb3/trunk/testsuite/build-test.xml	2008-11-26 03:01:21 UTC (rev 81595)
+++ projects/ejb3/trunk/testsuite/build-test.xml	2008-11-26 03:05:06 UTC (rev 81596)
@@ -2454,6 +2454,10 @@
    <target name="ejbthree1504">
       <build-simple-jar name="ejbthree1504"/>
    </target>  
+	
+  <target name="ejbthree1603">
+     <build-simple-jar name="ejbthree1603"/>
+  </target>
   
    <target name="jbas4489"
       description="Builds a simple jar files."
@@ -4237,7 +4241,7 @@
       ejbthree1066, ejbthree1071, ejbthree1075, ejbthree1082, ejbthree1090, ejbthree1092, ejbthree1116, ejbthree1119, ejbthree1122, ejbthree1123, ejbthree1127,
       ejbthree1130, 
       ejbthree1146, ejbthree1148, ejbthree1154, ejbthree1157, ejbthree1222, ejbthree1271, ejbthree1339,
-      ejbthree1504,
+      ejbthree1504, ejbthree1603,
    	  jaxws, jbas4489, epcpropagation, aspectdomain, ejbcontext, schema, mail, scopedclassloader, dependency,
       securitydomain, enventry, security5,
       jms/managed, naming, bmt, jca/inflowmdb, pool, jms, security, reference21_30, factory, dd/web, txexceptions,
@@ -5045,6 +5049,9 @@
          <param name="test" value="ejbthree1339"/>
       </antcall>
       <antcall target="test" inheritRefs="true">
+         <param name="test" value="ejbthree1603"/>
+      </antcall>
+      <antcall target="test" inheritRefs="true">
          <param name="test" value="statelesscreation"/>
       </antcall>
       <antcall target="test" inheritRefs="true">

Added: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1603/SelfDependencyBase.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1603/SelfDependencyBase.java	                        (rev 0)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1603/SelfDependencyBase.java	2008-11-26 03:05:06 UTC (rev 81596)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 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.ejbthree1603;
+
+/**
+ * SelfDependencyBase
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface SelfDependencyBase
+{
+   // --------------------------------------------------------------------------------||
+   // Contracts ----------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   public static final String RETURN_VALUE = "The Return Value";
+
+   // --------------------------------------------------------------------------------||
+   // Contracts ----------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /**
+    * Returns the contracted return value
+    */
+   String getReturnValue();
+}

Added: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1603/SelfDependencyBean.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1603/SelfDependencyBean.java	                        (rev 0)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1603/SelfDependencyBean.java	2008-11-26 03:05:06 UTC (rev 81596)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 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.ejbthree1603;
+
+import javax.ejb.EJB;
+import javax.ejb.Local;
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+
+/**
+ * SelfDependencyBean
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+ at Stateless
+ at Remote(SelfDependencyRemoteBusiness.class)
+ at Local(SelfDependencyLocalBusiness.class)
+public class SelfDependencyBean implements SelfDependencyLocalBusiness, SelfDependencyRemoteBusiness
+{
+
+   // --------------------------------------------------------------------------------||
+   // Instance Members ---------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   @EJB
+   private SelfDependencyLocalBusiness local;
+
+   // --------------------------------------------------------------------------------||
+   // Required Implementations -------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /**
+    * Returns the contracted return value
+    */
+   public String getReturnValue()
+   {
+      return SelfDependencyBase.RETURN_VALUE;
+   }
+
+   /**
+    * Returns the contracted return value
+    * from the local view
+    */
+   public String getReturnValueFromLocal()
+   {
+      return local.getReturnValue();
+   }
+
+}

Added: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1603/SelfDependencyLocalBusiness.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1603/SelfDependencyLocalBusiness.java	                        (rev 0)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1603/SelfDependencyLocalBusiness.java	2008-11-26 03:05:06 UTC (rev 81596)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 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.ejbthree1603;
+
+/**
+ * SelfDependencyLocalBusiness
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface SelfDependencyLocalBusiness extends SelfDependencyBase
+{
+
+}

Added: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1603/SelfDependencyRemoteBusiness.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1603/SelfDependencyRemoteBusiness.java	                        (rev 0)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1603/SelfDependencyRemoteBusiness.java	2008-11-26 03:05:06 UTC (rev 81596)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 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.ejbthree1603;
+
+/**
+ * SelfDependencyRemoteBusiness
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface SelfDependencyRemoteBusiness extends SelfDependencyBase
+{
+   // --------------------------------------------------------------------------------||
+   // Contracts ----------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /**
+    * Returns the contracted return value
+    * from the local view
+    */
+   String getReturnValueFromLocal();
+}

Added: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1603/unit/SelfDependencyTestCase.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1603/unit/SelfDependencyTestCase.java	                        (rev 0)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1603/unit/SelfDependencyTestCase.java	2008-11-26 03:05:06 UTC (rev 81596)
@@ -0,0 +1,106 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 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.ejbthree1603.unit;
+
+import javax.naming.InitialContext;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+
+import org.jboss.ejb3.test.ejbthree1603.SelfDependencyBean;
+import org.jboss.ejb3.test.ejbthree1603.SelfDependencyRemoteBusiness;
+import org.jboss.logging.Logger;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * SelfDependencyTestCase
+ * 
+ * Test Cases to ensure an EJB with 
+ * dependencies upon its own views succeeds
+ * deployment and invocation.
+ * 
+ * EJBTHREE-1603
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class SelfDependencyTestCase extends JBossTestCase
+{
+   // --------------------------------------------------------------------------------||
+   // Class Members ------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   private static final Logger log = Logger.getLogger(SelfDependencyTestCase.class);
+
+   // --------------------------------------------------------------------------------||
+   // Constructor --------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   public SelfDependencyTestCase(String name)
+   {
+      super(name);
+   }
+
+   // --------------------------------------------------------------------------------||
+   // Harness ------------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(SelfDependencyTestCase.class, "ejbthree1603.jar");
+   }
+
+   // --------------------------------------------------------------------------------||
+   // Tests --------------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /**
+    * Tests that an EJB with dependencies upon its own views
+    * succeeds deployment and invocation
+    */
+   public void testSelfDependencyInvocationsSucceed() throws Exception
+   {
+      // Define JNDI Name
+      String jndiName = SelfDependencyBean.class.getSimpleName() + "/remote";
+
+      // Get a naming Context
+      InitialContext context = this.getInitialContext();
+
+      // Lookup the bean
+      SelfDependencyRemoteBusiness ejb = (SelfDependencyRemoteBusiness) context.lookup(jndiName);
+
+      // Define the expected return value
+      String expected = SelfDependencyRemoteBusiness.RETURN_VALUE;
+      log.info("Expected value: " + expected);
+
+      // Obtain the return value from both remote and local invocations
+      String fromRemote = ejb.getReturnValue();
+      log.info("From remote: " + fromRemote);
+      String fromLocal = ejb.getReturnValueFromLocal();
+      log.info("From local: " + fromLocal);
+
+      // Test
+      TestCase.assertEquals("The remote invocation did not return as expected", expected, fromRemote);
+      TestCase.assertEquals("The local invocation did not return as expected", expected, fromLocal);
+   }
+
+}




More information about the jboss-cvs-commits mailing list