[jboss-cvs] JBossAS SVN: r62726 - 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
Wed May 2 10:13:01 EDT 2007


Author: wolfc
Date: 2007-05-02 10:13:00 -0400 (Wed, 02 May 2007)
New Revision: 62726

Added:
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree953/
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree953/MyStateless.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree953/MyStatelessBean.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree953/unit/
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree953/unit/TXNeverExceptionTestCase.java
Modified:
   trunk/ejb3/build-test.xml
Log:
EJBTHREE-953: unit test

Modified: trunk/ejb3/build-test.xml
===================================================================
--- trunk/ejb3/build-test.xml	2007-05-02 13:58:02 UTC (rev 62725)
+++ trunk/ejb3/build-test.xml	2007-05-02 14:13:00 UTC (rev 62726)
@@ -1897,6 +1897,20 @@
       </copy>
    </target>
    
+   <target name="ejbthree953"
+      description="Builds all jar files."
+      depends="compile-classes">
+
+      <mkdir dir="${build.lib}"/>
+
+      <jar jarfile="${build.lib}/ejbthree953.jar">
+         <fileset dir="${build.classes}">
+            <include name="org/jboss/ejb3/test/ejbthree953/*.class"/>
+         </fileset>
+         <!--fileset dir="${resources}/test/ejbthree953" includes="META-INF/*"/-->
+      </jar>
+   </target>
+   
    <target name="jaxws"
       description="Builds a simple jar."
       depends="compile-classes">
@@ -1917,6 +1931,9 @@
       <mkdir dir="${build.lib}"/>
 
       <jar jarfile="${build.lib}/wolfc.jar">
+         <zipfileset prefix="META-INF" dir="${build.resources}/test/wolfc">
+            <include name="persistence.xml"/>
+         </zipfileset>
          <fileset dir="${build.classes}">
             <include name="org/jboss/ejb3/test/wolfc/*.class"/>
          </fileset>
@@ -3212,6 +3229,7 @@
    <target name="jars" depends="appclient, tck5sec, invalidtxmdb, descriptortypo, libdeployment, homeinterface, timestampentity, arjuna, mdbtransactions, unauthenticatedprincipal, clusteredservice, invoker, classloader, 
       circulardependency, jsp, timerdependency, servicedependency, servlet, stateless14, webservices, ear, ejbthree440, 
       ejbthree454, ejbthree653, ejbthree670, ejbthree712, ejbthree751, ejbthree921, ejbthree936, ejbthree939,
+      ejbthree953,
       aspectdomain, ejbcontext, schema, mail, scopedclassloader, dependency, 
       securitydomain, enventry, 
       jms/managed, naming, bmt, jca/inflowmdb, pool, jms, security, reference21_30, factory, dd/web, txexceptions, 
@@ -3792,7 +3810,7 @@
    </target>
 
    <target name="no-start-jboss-tests" depends="init" description="Execute all tests">
-      <antcall target="standalone-tests" inheritRefs="true"/>
+      <!--antcall target="standalone-tests" inheritRefs="true"/-->
       <antcall target="no-start-jboss-ejb-tests" inheritRefs="true"/>
       <antcall target="no-start-jboss-entity-tests" inheritRefs="true"/>
       <antcall target="no-start-jboss-iiop-tests" inheritRefs="true"/>
@@ -4056,6 +4074,9 @@
       <antcall target="test" inheritRefs="true">
          <param name="test" value="ejbthree939"/>
       </antcall>
+      <antcall target="test" inheritRefs="true">
+         <param name="test" value="ejbthree953"/>
+      </antcall>
    </target>
 
    <target name="entity-tests" depends="init" description="Execute all tests">

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree953/MyStateless.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree953/MyStateless.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree953/MyStateless.java	2007-05-02 14:13:00 UTC (rev 62726)
@@ -0,0 +1,34 @@
+/*
+ * 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.ejbthree953;
+
+import javax.ejb.Remote;
+
+/**
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Remote
+public interface MyStateless
+{
+   void check();
+}

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree953/MyStatelessBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree953/MyStatelessBean.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree953/MyStatelessBean.java	2007-05-02 14:13:00 UTC (rev 62726)
@@ -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.ejbthree953;
+
+import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+import static javax.ejb.TransactionAttributeType.*;
+
+/**
+ * A method on an EJB3 bean with transaction attribute NEVER must throw an EJBException (13.6.2.6)
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Stateless
+public class MyStatelessBean implements MyStateless
+{
+
+   @TransactionAttribute(NEVER)
+   public void check()
+   {
+      throw new IllegalStateException("Should not come here");
+   }
+
+}

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree953/unit/TXNeverExceptionTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree953/unit/TXNeverExceptionTestCase.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree953/unit/TXNeverExceptionTestCase.java	2007-05-02 14:13:00 UTC (rev 62726)
@@ -0,0 +1,77 @@
+/*
+ * 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.ejbthree953.unit;
+
+import javax.ejb.EJBException;
+import javax.transaction.UserTransaction;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.ejbthree953.MyStateless;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * Test exception type on a method with transaction attribute NEVER.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class TXNeverExceptionTestCase extends JBossTestCase
+{
+
+   public TXNeverExceptionTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void test1() throws Exception
+   {
+      UserTransaction tx = (UserTransaction) this.getInitialContext().lookup("UserTransaction");
+      tx.begin();
+      try
+      {
+         MyStateless test = (MyStateless) this.getInitialContext().lookup("MyStatelessBean/remote");
+         try
+         {
+            test.check();
+         }
+         catch(EJBException e)
+         {
+            // good
+         }
+         catch(IllegalStateException e)
+         {
+            fail("Should have caught an EJBException, not an IllegalStateException");
+         }
+      }
+      finally
+      {
+         tx.rollback();
+      }
+   }
+   
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(TXNeverExceptionTestCase.class, "ejbthree953.jar");
+   }
+
+}




More information about the jboss-cvs-commits mailing list