[jboss-cvs] JBossAS SVN: r66743 - 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
Mon Nov 5 11:28:17 EST 2007
Author: ALRubinger
Date: 2007-11-05 11:28:17 -0500 (Mon, 05 Nov 2007)
New Revision: 66743
Added:
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1082/
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1082/ABean.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1082/BBean.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1082/BusinessLocalB.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1082/BusinessRemoteA.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1082/unit/
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1082/unit/EJBExceptionFromTxNotSupportedInTxContextTestCase.java
Modified:
trunk/ejb3/build-test.xml
Log:
[EJBTHREE-1082] Added Unit Test
Modified: trunk/ejb3/build-test.xml
===================================================================
--- trunk/ejb3/build-test.xml 2007-11-05 16:00:53 UTC (rev 66742)
+++ trunk/ejb3/build-test.xml 2007-11-05 16:28:17 UTC (rev 66743)
@@ -2182,6 +2182,10 @@
</fileset>
</jar>
</target>
+
+ <target name="ejbthree1082" depends="compile-classes">
+ <build-simple-jar name="ejbthree1082"/>
+ </target>
<target name="jbas4489"
description="Builds a simple jar files."
@@ -3716,7 +3720,7 @@
ejbthree989, ejbthree1020, ejbthree1023, ejbthree1025, ejbthree1040,
ejbthree1057, ejbthree1060,
ejbthree1062,
- ejbthree1066, ejbthree1071, ejbthree1075,
+ ejbthree1066, ejbthree1071, ejbthree1075, ejbthree1082,
jaxws,
aspectdomain, ejbcontext, schema, mail, scopedclassloader, dependency,
securitydomain, enventry, security5,
@@ -4684,6 +4688,9 @@
<param name="test" value="ejbthree1075"/>
</antcall>
<antcall target="test" inheritRefs="true">
+ <param name="test" value="ejbthree1082"/>
+ </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/ejbthree1082/ABean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1082/ABean.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1082/ABean.java 2007-11-05 16:28:17 UTC (rev 66743)
@@ -0,0 +1,75 @@
+/*
+ * 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.ejbthree1082;
+
+import javax.ejb.EJB;
+import javax.ejb.EJBException;
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+
+import org.jboss.annotation.ejb.RemoteBinding;
+import org.jboss.logging.Logger;
+
+/**
+ * Delegate bean used to test a method in Bean B that
+ * does not support Tx, invoked from a
+ * transactional context
+ *
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision: $
+ */
+ at Stateless
+ at Remote(BusinessRemoteA.class)
+ at RemoteBinding(jndiBinding=BusinessRemoteA.JNDI_NAME)
+public class ABean implements BusinessRemoteA
+{
+ // Class Members
+ private static final Logger log = Logger.getLogger(ABean.class);
+
+ // Instance Members
+ @EJB
+ private BusinessLocalB b;
+
+ // Required Implementations
+ @TransactionAttribute(TransactionAttributeType.REQUIRED)
+ public boolean doesTransactionNotSupportedInvokedFromTxContextThrowEJBException()
+ {
+ try{
+ // Invoke upon Tx not supported from transactional context
+ b.test();
+ }
+ // Expected
+ catch(EJBException e){
+ return true;
+ }
+ catch(Exception e)
+ {
+ log.error(e);
+ }
+
+ // Proper exception not encountered
+ return false;
+ }
+
+}
Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1082/ABean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1082/BBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1082/BBean.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1082/BBean.java 2007-11-05 16:28:17 UTC (rev 66743)
@@ -0,0 +1,56 @@
+/*
+ * 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.ejbthree1082;
+
+import javax.ejb.Local;
+import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+
+import org.jboss.annotation.ejb.LocalBinding;
+import org.jboss.logging.Logger;
+
+/**
+ * Bean specifying a method that does not support a transactional context
+ *
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision: $
+ */
+ at Stateless
+ at Local(BusinessLocalB.class)
+ at LocalBinding(jndiBinding=BusinessLocalB.JNDI_NAME)
+public class BBean implements BusinessLocalB
+{
+ // Class Members
+ private static final Logger log = Logger.getLogger(BBean.class);
+
+ // Instance Members
+ private BusinessLocalB b;
+
+ // Required Implementations
+ @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
+ public void test()
+ {
+ throw new RuntimeException("Test Exception");
+ }
+
+}
Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1082/BBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1082/BusinessLocalB.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1082/BusinessLocalB.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1082/BusinessLocalB.java 2007-11-05 16:28:17 UTC (rev 66743)
@@ -0,0 +1,35 @@
+/*
+ * 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.ejbthree1082;
+
+/**
+ * Business Local interface of EJB B
+ *
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision: $
+ */
+public interface BusinessLocalB
+{
+ String JNDI_NAME = "BBean/local";
+
+ void test();
+}
Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1082/BusinessLocalB.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1082/BusinessRemoteA.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1082/BusinessRemoteA.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1082/BusinessRemoteA.java 2007-11-05 16:28:17 UTC (rev 66743)
@@ -0,0 +1,35 @@
+/*
+ * 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.ejbthree1082;
+
+/**
+ * Business Remote interface of EJB A
+ *
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision: $
+ */
+public interface BusinessRemoteA
+{
+ String JNDI_NAME = "ABean/remote";
+
+ boolean doesTransactionNotSupportedInvokedFromTxContextThrowEJBException();
+}
Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1082/BusinessRemoteA.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1082/unit/EJBExceptionFromTxNotSupportedInTxContextTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1082/unit/EJBExceptionFromTxNotSupportedInTxContextTestCase.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1082/unit/EJBExceptionFromTxNotSupportedInTxContextTestCase.java 2007-11-05 16:28:17 UTC (rev 66743)
@@ -0,0 +1,67 @@
+/*
+ * 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.ejbthree1082.unit;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.ejbthree1082.BusinessRemoteA;
+import org.jboss.test.JBossTestCase;
+
+import com.sun.corba.se.impl.javax.rmi.PortableRemoteObject;
+
+/**
+ * Test Case ensuring that a method invocation marked as Transaction
+ * NOT_SUPPORTED in a Transactional Context throws an EJBException
+ *
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision: $
+ */
+public class EJBExceptionFromTxNotSupportedInTxContextTestCase extends JBossTestCase
+{
+
+ // Constructor
+
+ public EJBExceptionFromTxNotSupportedInTxContextTestCase(String name)
+ {
+ super(name);
+ }
+
+ // Suite
+
+ public static Test suite() throws Exception
+ {
+ return getDeploySetup(EJBExceptionFromTxNotSupportedInTxContextTestCase.class, "ejbthree1082.jar");
+ }
+
+ // Test Case
+
+ public void testInvocationOnTransactionNotSupportedFromTxThrowsEJBException() throws Exception
+ {
+ // Obtain test bean
+ BusinessRemoteA bean = (BusinessRemoteA) new PortableRemoteObject().narrow(this.getInitialContext().lookup(
+ BusinessRemoteA.JNDI_NAME), BusinessRemoteA.class);
+
+ // Ensure exception is of type expected
+ JBossTestCase.assertTrue(bean.doesTransactionNotSupportedInvokedFromTxContextThrowEJBException());
+ }
+
+}
Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1082/unit/EJBExceptionFromTxNotSupportedInTxContextTestCase.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
More information about the jboss-cvs-commits
mailing list