[jboss-cvs] JBossAS SVN: r66026 - in trunk/ejb3: src/resources/test and 5 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Oct 11 09:35:06 EDT 2007


Author: wolfc
Date: 2007-10-11 09:35:05 -0400 (Thu, 11 Oct 2007)
New Revision: 66026

Added:
   trunk/ejb3/src/resources/test/ejbthree1066/
   trunk/ejb3/src/resources/test/ejbthree1066/META-INF/
   trunk/ejb3/src/resources/test/ejbthree1066/META-INF/ejb-jar.xml
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1066/
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1066/Adder.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1066/CalculatorBean.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1066/Subtractor.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1066/unit/
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1066/unit/MultiBusinessDescriptorUnitTestCase.java
Modified:
   trunk/ejb3/build-test.xml
Log:
EJBTHREE-1066: unit test

Modified: trunk/ejb3/build-test.xml
===================================================================
--- trunk/ejb3/build-test.xml	2007-10-11 12:36:57 UTC (rev 66025)
+++ trunk/ejb3/build-test.xml	2007-10-11 13:35:05 UTC (rev 66026)
@@ -2160,6 +2160,10 @@
       <build-simple-jar name="ejbthree1062"/>
    </target>
    
+   <target name="ejbthree1066" depends="compile-classes">
+      <build-simple-jar name="ejbthree1066"/>
+   </target>
+   
    <target name="jbas4489"
       description="Builds a simple jar files."
       depends="compile-classes">
@@ -3693,6 +3697,7 @@
       ejbthree989, ejbthree1020, ejbthree1023, ejbthree1025, ejbthree1040, ejbthree1058,
       ejbthree1060,
       ejbthree1062,
+      ejbthree1066,
       jaxws,
       aspectdomain, ejbcontext, schema, mail, scopedclassloader, dependency,
       securitydomain, enventry, security5,
@@ -4652,6 +4657,9 @@
          <param name="test" value="ejbthree1062"/>
       </antcall>
       <antcall target="test" inheritRefs="true">
+         <param name="test" value="ejbthree1066"/>
+      </antcall>
+      <antcall target="test" inheritRefs="true">
          <param name="test" value="statelesscreation"/>
       </antcall>
       <antcall target="test" inheritRefs="true">

Added: trunk/ejb3/src/resources/test/ejbthree1066/META-INF/ejb-jar.xml
===================================================================
--- trunk/ejb3/src/resources/test/ejbthree1066/META-INF/ejb-jar.xml	                        (rev 0)
+++ trunk/ejb3/src/resources/test/ejbthree1066/META-INF/ejb-jar.xml	2007-10-11 13:35:05 UTC (rev 66026)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" 
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+   version="3.0" 
+   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
+   <enterprise-beans>
+      <session>
+         <ejb-name>CalculatorBean</ejb-name>
+         <business-remote>org.jboss.ejb3.test.ejbthree1066.Adder</business-remote>
+         <business-remote>org.jboss.ejb3.test.ejbthree1066.Subtractor</business-remote>
+         <ejb-class>org.jboss.ejb3.test.ejbthree1066.CalculatorBean</ejb-class>
+         <session-type>Stateless</session-type>
+      </session>
+   </enterprise-beans>
+</ejb-jar>
\ No newline at end of file


Property changes on: trunk/ejb3/src/resources/test/ejbthree1066/META-INF/ejb-jar.xml
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1066/Adder.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1066/Adder.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1066/Adder.java	2007-10-11 13:35:05 UTC (rev 66026)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated
+ * 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.ejb3.test.ejbthree1066;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface Adder
+{
+   int add(int a, int b);
+}


Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1066/Adder.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1066/CalculatorBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1066/CalculatorBean.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1066/CalculatorBean.java	2007-10-11 13:35:05 UTC (rev 66026)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated
+ * 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.ejb3.test.ejbthree1066;
+
+/**
+ * The bean is described in the descriptor as having two
+ * remote interfaces:
+ * - Adder
+ * - Subtractor 
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class CalculatorBean implements Adder, Subtractor
+{
+   public int add(int a, int b)
+   {
+      return a + b;
+   }
+
+   public int subtract(int a, int b)
+   {
+      return a - b;
+   }
+}


Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1066/CalculatorBean.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1066/Subtractor.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1066/Subtractor.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1066/Subtractor.java	2007-10-11 13:35:05 UTC (rev 66026)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated
+ * 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.ejb3.test.ejbthree1066;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface Subtractor
+{
+   int subtract(int a, int b);
+}


Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1066/Subtractor.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1066/unit/MultiBusinessDescriptorUnitTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1066/unit/MultiBusinessDescriptorUnitTestCase.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1066/unit/MultiBusinessDescriptorUnitTestCase.java	2007-10-11 13:35:05 UTC (rev 66026)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated
+ * 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.ejb3.test.ejbthree1066.unit;
+
+import javax.naming.NameNotFoundException;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.ejbthree1066.Adder;
+import org.jboss.ejb3.test.ejbthree1066.Subtractor;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * Business interfaces in the deployment descriptor are totally ignored.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision$
+ */
+public class MultiBusinessDescriptorUnitTestCase extends JBossTestCase
+{
+   public MultiBusinessDescriptorUnitTestCase(String name)
+   {
+      super(name);
+   }
+   
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(MultiBusinessDescriptorUnitTestCase.class, "ejbthree1066.jar");
+   }
+   
+   public void testCalculator() throws Exception
+   {
+      try
+      {
+         Object bean = getInitialContext().lookup("CalculatorBean/remote");
+         
+         assertTrue("bean must have Adder as business interface", bean instanceof Adder);
+         assertTrue("bean must have Adder as business interface", bean instanceof Subtractor);
+         
+         int actual;
+         
+         actual = ((Adder) bean).add(1, 2);
+         assertEquals(3, actual);
+         
+         actual = ((Subtractor) bean).subtract(5, 1);
+         assertEquals(4, actual);
+      }
+      catch(NameNotFoundException e)
+      {
+         fail("CalculatorBean was not deployed properly");
+      }
+   }
+}


Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1066/unit/MultiBusinessDescriptorUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native




More information about the jboss-cvs-commits mailing list