[jboss-cvs] JBossAS SVN: r70457 - in projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/stateless: unit and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Mar 5 20:39:42 EST 2008
Author: bdecoste
Date: 2008-03-05 20:39:42 -0500 (Wed, 05 Mar 2008)
New Revision: 70457
Added:
projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/stateless/TemplatedStateless.java
Modified:
projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/stateless/UnsecuredStateless.java
projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/stateless/UnsecuredStatelessBean.java
projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/stateless/unit/StatelessTestCase.java
Log:
[EJBTHREE-1201] don't invoke bridge methods - they don't override class level annotations
Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/stateless/TemplatedStateless.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/stateless/TemplatedStateless.java (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/stateless/TemplatedStateless.java 2008-03-06 01:39:42 UTC (rev 70457)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.stateless;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public interface TemplatedStateless<T>
+{
+ T testMandatoryTx(T t) throws javax.transaction.SystemException;
+}
Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/stateless/UnsecuredStateless.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/stateless/UnsecuredStateless.java 2008-03-05 23:45:33 UTC (rev 70456)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/stateless/UnsecuredStateless.java 2008-03-06 01:39:42 UTC (rev 70457)
@@ -27,7 +27,7 @@
* @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
* @version $Revision$
*/
-public interface UnsecuredStateless
+public interface UnsecuredStateless extends TemplatedStateless<String>
{
int method(int i) throws NamingException;
}
Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/stateless/UnsecuredStatelessBean.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/stateless/UnsecuredStatelessBean.java 2008-03-05 23:45:33 UTC (rev 70456)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/stateless/UnsecuredStatelessBean.java 2008-03-06 01:39:42 UTC (rev 70457)
@@ -24,7 +24,12 @@
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.ejb.Remote;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
import javax.naming.NamingException;
+import javax.transaction.TransactionManager;
+
+import org.jboss.ejb3.annotation.JndiInject;
import org.jboss.logging.Logger;
/**
@@ -33,14 +38,25 @@
*/
@Stateless
@Remote(UnsecuredStateless.class)
+ at TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public class UnsecuredStatelessBean implements UnsecuredStateless
{
private static final Logger log = Logger.getLogger(UnsecuredStatelessBean.class);
+ @JndiInject(jndiName="java:/TransactionManager") private TransactionManager tm;
+
@EJB CheckedStateless stateless;
public int method(int i) throws NamingException
{
return stateless.method(i);
}
+
+ @TransactionAttribute(value = TransactionAttributeType.MANDATORY)
+ public String testMandatoryTx(String string) throws javax.transaction.SystemException
+ {
+ log.info("**** Should never get here testMandatoryTx " + tm.getTransaction());
+ new Exception().printStackTrace();
+ return string;
+ }
}
Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/stateless/unit/StatelessTestCase.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/stateless/unit/StatelessTestCase.java 2008-03-05 23:45:33 UTC (rev 70456)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/stateless/unit/StatelessTestCase.java 2008-03-06 01:39:42 UTC (rev 70457)
@@ -171,6 +171,21 @@
// okay
}
}
+
+ public void testTemplateInterfaceTx() throws Exception
+ {
+ UnsecuredStateless stateful = (UnsecuredStateless)getInitialContext().lookup("UnsecuredStatelessBean/remote");
+ assertNotNull(stateful);
+
+ try
+ {
+ stateful.testMandatoryTx("123");
+ fail("should have caught exception");
+ }
+ catch (javax.ejb.EJBTransactionRequiredException e)
+ {
+ }
+ }
public static Test suite() throws Exception
{
More information about the jboss-cvs-commits
mailing list