[jboss-cvs] JBossAS SVN: r63564 - in branches/Branch_4_2/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 Jun 18 18:32:47 EDT 2007
Author: wolfc
Date: 2007-06-18 18:32:47 -0400 (Mon, 18 Jun 2007)
New Revision: 63564
Added:
branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/jbas4489/
branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/jbas4489/BMTCleanUp.java
branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/jbas4489/BMTCleanUpBean.java
branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/jbas4489/unit/
branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/jbas4489/unit/BMTCleanUpUnitTestCase.java
Modified:
branches/Branch_4_2/ejb3/build-test.xml
Log:
JBAS-4489: unit test
Modified: branches/Branch_4_2/ejb3/build-test.xml
===================================================================
--- branches/Branch_4_2/ejb3/build-test.xml 2007-06-18 18:11:34 UTC (rev 63563)
+++ branches/Branch_4_2/ejb3/build-test.xml 2007-06-18 22:32:47 UTC (rev 63564)
@@ -1823,6 +1823,13 @@
<build-simple-jar name="ejbthree963"/>
</target>
+ <target name="jbas4489"
+ description="Builds a simple jar files."
+ depends="compile-classes">
+
+ <build-simple-jar name="jbas4489"/>
+ </target>
+
<target name="jaxws"
description="Builds a simple jar."
depends="compile-classes">
@@ -3215,6 +3222,7 @@
circulardependency, jsp, timerdependency, servicedependency, servlet, stateless14, webservices, ear, ejbthree440,
ejbthree454, ejbthree653, ejbthree670, ejbthree712, ejbthree724, ejbthree751, ejbthree832, ejbthree921,
ejbthree959, ejbthree963,
+ jbas4489,
aspectdomain, ejbcontext, schema, mail, scopedclassloader, dependency, jaxws,
pkg, securitydomain, enventry,
jms/managed, naming, bmt, jca/inflowmdb, pool, jms, security, reference21_30, factory, dd/web, txexceptions,
@@ -3744,6 +3752,9 @@
<antcall target="test" inheritRefs="true">
<param name="test" value="ejbthree963"/>
</antcall>
+ <antcall target="test" inheritRefs="true">
+ <param name="test" value="jbas4489"/>
+ </antcall>
</target>
<target name="entity-tests" depends="init" description="Execute all tests">
Added: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/jbas4489/BMTCleanUp.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/jbas4489/BMTCleanUp.java (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/jbas4489/BMTCleanUp.java 2007-06-18 22:32:47 UTC (rev 63564)
@@ -0,0 +1,41 @@
+/*
+ * 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.jbas4489;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface BMTCleanUp
+{
+ void doNormal();
+
+ void testIncomplete();
+
+ void doIncomplete();
+
+ void testTxTimeout();
+
+ void doTimeout();
+}
Property changes on: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/jbas4489/BMTCleanUp.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/jbas4489/BMTCleanUpBean.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/jbas4489/BMTCleanUpBean.java (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/jbas4489/BMTCleanUpBean.java 2007-06-18 22:32:47 UTC (rev 63564)
@@ -0,0 +1,143 @@
+/*
+ * 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.jbas4489;
+
+import javax.annotation.Resource;
+import javax.ejb.EJBException;
+import javax.ejb.Remote;
+import javax.ejb.SessionContext;
+import javax.ejb.Stateless;
+import javax.ejb.TransactionManagement;
+import javax.ejb.TransactionManagementType;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import javax.transaction.UserTransaction;
+
+import org.jboss.tm.TransactionManagerLocator;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Stateless
+ at Remote(BMTCleanUp.class)
+ at TransactionManagement(TransactionManagementType.BEAN)
+public class BMTCleanUpBean implements BMTCleanUp
+{
+ @Resource
+ private SessionContext sessionCtx;
+
+ private void checkTransaction()
+ {
+ TransactionManager tm = TransactionManagerLocator.getInstance().locate();
+ try
+ {
+ Transaction tx = tm.getTransaction();
+ if (tx != null)
+ throw new IllegalStateException("There should be no transaction context: " + tx);
+ }
+ catch (Exception e)
+ {
+ throw new EJBException("Error", e);
+ }
+ }
+
+ public void doIncomplete()
+ {
+ UserTransaction ut = sessionCtx.getUserTransaction();
+ try
+ {
+ ut.begin();
+ }
+ catch (Exception e)
+ {
+ throw new EJBException("Error", e);
+ }
+ }
+
+ public void doNormal()
+ {
+ UserTransaction ut = sessionCtx.getUserTransaction();
+ try
+ {
+ ut.begin();
+ ut.commit();
+ }
+ catch (Exception e)
+ {
+ throw new EJBException("Error", e);
+ }
+ }
+
+ public void doTimeout()
+ {
+ UserTransaction ut = sessionCtx.getUserTransaction();
+ try
+ {
+ ut.setTransactionTimeout(5);
+ ut.begin();
+ Thread.sleep(10000);
+ }
+ catch (InterruptedException ignored)
+ {
+ }
+ catch (Exception e)
+ {
+ throw new EJBException("Error", e);
+ }
+ }
+
+ public void testIncomplete()
+ {
+ BMTCleanUp remote = (BMTCleanUp) sessionCtx.getEJBObject();
+ try
+ {
+ remote.doIncomplete();
+ }
+ catch (EJBException expected)
+ {
+ // expected
+ expected.printStackTrace();
+ }
+ checkTransaction();
+ remote.doNormal();
+ }
+
+ public void testTxTimeout()
+ {
+ BMTCleanUp remote = (BMTCleanUp) sessionCtx.getEJBObject();
+ try
+ {
+ remote.doTimeout();
+ }
+ catch (EJBException expected)
+ {
+ // expected
+ expected.printStackTrace();
+ }
+ checkTransaction();
+ remote.doNormal();
+ }
+
+}
Property changes on: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/jbas4489/BMTCleanUpBean.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/jbas4489/unit/BMTCleanUpUnitTestCase.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/jbas4489/unit/BMTCleanUpUnitTestCase.java (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/jbas4489/unit/BMTCleanUpUnitTestCase.java 2007-06-18 22:32:47 UTC (rev 63564)
@@ -0,0 +1,63 @@
+/*
+ * 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.jbas4489.unit;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.jbas4489.BMTCleanUp;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class BMTCleanUpUnitTestCase extends JBossTestCase
+{
+ public BMTCleanUpUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite() throws Exception
+ {
+ return getDeploySetup(BMTCleanUpUnitTestCase.class, "jbas4489.jar");
+ }
+
+ public void testIncomplete() throws Exception
+ {
+ BMTCleanUp bean = getBean();
+ bean.testIncomplete();
+ }
+
+ public void testTxTimeout() throws Exception
+ {
+ BMTCleanUp bean = getBean();
+ bean.testTxTimeout();
+ }
+
+ private BMTCleanUp getBean() throws Exception
+ {
+ return (BMTCleanUp) getInitialContext().lookup("BMTCleanUpBean/remote");
+ }
+}
Property changes on: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/jbas4489/unit/BMTCleanUpUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
More information about the jboss-cvs-commits
mailing list