[jboss-cvs] JBossAS SVN: r81697 - in projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous: unit and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Nov 27 00:36:10 EST 2008


Author: ALRubinger
Date: 2008-11-27 00:36:09 -0500 (Thu, 27 Nov 2008)
New Revision: 81697

Removed:
   projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/TxSession.java
   projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/TxSessionBean.java
   projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/TxSessionLocal.java
   projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/TxSessionRemote.java
Modified:
   projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/Tester.java
   projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/TesterMBean.java
   projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/unit/AsynchronousTestCase.java
Log:
[EJBTHREE-1241] Remove support of propagated Tx for "asynchronous" tests

Modified: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/Tester.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/Tester.java	2008-11-27 04:53:44 UTC (rev 81696)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/Tester.java	2008-11-27 05:36:09 UTC (rev 81697)
@@ -91,100 +91,6 @@
       if (ret != 132) throw new RuntimeException("Wrong async return value for service local "+ ret);
    }
 
-   public void testLocalAsynchTransaction() throws Exception
-   {
-      InitialContext ctx = new InitialContext();
-      TxSessionLocal tester = (TxSessionLocal) ctx.lookup("TxSessionBean/local");
-      TxSessionLocal asynchTester = AsyncUtils.mixinAsync(tester);
-      AsyncProvider ap = (AsyncProvider) asynchTester;
-      TransactionManager tx = TransactionManagerLocator.locateTransactionManager();
-
-      //Add some entries in different threads and commit
-      tx.begin();
-      tester.createFruit("apple", false);
-      tester.createFruit("pear", false);
-      tester.createFruit("tomato", false);
-
-      asynchTester.createVeg("Potato", false);
-      waitForProvider(ap);
-      asynchTester.createVeg("Turnip", false);
-      waitForProvider(ap);
-      asynchTester.createVeg("Carrot", false);
-      waitForProvider(ap);
-      tx.commit();
-
-      tx.begin();
-      Collection entries = tester.getEntries();
-      tx.commit();
-      if (entries.size() != 6) throw new RuntimeException("Wrong number of entries, should have been 6, have: " + entries.size());
-
-      //Cleanup synchronously
-      tx.begin();
-      tester.cleanAll();
-      tx.commit();
-
-      tx.begin();
-      entries = tester.getEntries();
-      tx.commit();
-      if (entries.size() != 0) throw new RuntimeException("Wrong number of entries, should have been 0, have: " + entries.size());
-
-      //Add some entries in different threads and rollback
-      tx.begin();
-      tester.createFruit("apple", false);
-      tester.createFruit("pear", false);
-      tester.createFruit("tomato", false);
-
-      asynchTester.createVeg("Potato", false);
-      waitForProvider(ap);
-      asynchTester.createVeg("Turnip", false);
-      waitForProvider(ap);
-      asynchTester.createVeg("Carrot", false);
-      waitForProvider(ap);
-      tx.rollback();
-
-      tx.begin();
-      entries = tester.getEntries();
-      tx.commit();
-
-      if (entries.size() != 0) throw new RuntimeException("Wrong number of entries, should have been 0, have: " + entries.size());
-
-      //Add some entries in different threads and rollback from within Tx
-      tx.begin();
-      tester.createFruit("apple", false);
-      tester.createFruit("pear", false);
-      tester.createFruit("tomato", true);
-
-      asynchTester.createVeg("Potato", false);
-      waitForProvider(ap);
-      asynchTester.createVeg("Turnip", false);
-      waitForProvider(ap);
-      asynchTester.createVeg("Carrot", true);
-      waitForProvider(ap);
-
-      boolean rollbackException = false;
-      try
-      {
-         tx.commit();
-      }
-      catch(RollbackException e)
-      {
-         rollbackException = true;
-      }
-
-      if (!rollbackException) throw new RuntimeException("RollbackException not picked up");
-
-      tx.begin();
-      entries = tester.getEntries();
-      tx.commit();
-      if (entries.size() != 0) throw new RuntimeException("Wrong number of entries, should have been 0, have: " + entries.size());
-   }
-
-   private void waitForProvider(AsyncProvider provider) throws InterruptedException
-   {
-      Future<?> future = provider.getFutureResult();
-      waitForFuture(future);
-   }
-
    private void waitForFuture(Future<?> future) throws InterruptedException
    {
       while (!future.isDone())

Modified: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/TesterMBean.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/TesterMBean.java	2008-11-27 04:53:44 UTC (rev 81696)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/TesterMBean.java	2008-11-27 05:36:09 UTC (rev 81697)
@@ -31,5 +31,4 @@
    void testSLLocalAsynchronous() throws Exception;
    void testSFLocalAsynchronous() throws Exception;
    void testServiceLocalAsynchronous() throws Exception;
-   void testLocalAsynchTransaction() throws Exception;
 }

Deleted: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/TxSession.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/TxSession.java	2008-11-27 04:53:44 UTC (rev 81696)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/TxSession.java	2008-11-27 05:36:09 UTC (rev 81697)
@@ -1,40 +0,0 @@
-/*
- * 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.asynchronous;
-
-import java.util.Collection;
-
-/**
- * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
- * @version $Revision$
- */
-public interface TxSession
-{
-   public void createFruit(String name, boolean rollback);
-
-   public void createVeg(String name, boolean rollback);
-
-   public Collection getEntries();
-
-   public void cleanAll();
-   
-}

Deleted: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/TxSessionBean.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/TxSessionBean.java	2008-11-27 04:53:44 UTC (rev 81696)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/TxSessionBean.java	2008-11-27 05:36:09 UTC (rev 81697)
@@ -1,109 +0,0 @@
-/*
- * 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.asynchronous;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import javax.annotation.Resource;
-import javax.ejb.Remote;
-import javax.ejb.Stateless;
-import javax.ejb.TransactionAttribute;
-import javax.ejb.TransactionAttributeType;
-import javax.ejb.Local;
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContext;
-
-/**
- * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
- * @version $Revision$
- */
- at Stateless
- at Remote(TxSessionRemote.class)
- at Local(TxSessionLocal.class)
-public class TxSessionBean implements TxSessionRemote, TxSessionLocal
-{
-   @PersistenceContext EntityManager manager;
-   @Resource javax.ejb.SessionContext ctx;
-
-   @TransactionAttribute(TransactionAttributeType.REQUIRED)
-   public void createFruit(String name, boolean rollback)
-   {
-      Fruit fruit = new Fruit(name);
-      manager.persist(fruit);
-      if (rollback)ctx.setRollbackOnly();
-   }
-
-   @TransactionAttribute(TransactionAttributeType.REQUIRED)
-   public void createVeg(String name, boolean rollback)
-   {
-      Vegetable veg = new Vegetable(name);
-      manager.persist(veg);
-      if (rollback)ctx.setRollbackOnly();
-   }
-
-   @TransactionAttribute(TransactionAttributeType.REQUIRED)
-   public Collection getEntries()
-   {
-      Query vegQuery = manager.createQuery("SELECT v FROM Vegetable v");
-      List veg = vegQuery.getResultList();
-      Query fruitQuery = manager.createQuery("SELECT f FROM Fruit f");
-      List fruit = fruitQuery.getResultList();
-
-
-      ArrayList list = new ArrayList();
-      for (Iterator it = veg.iterator() ; it.hasNext() ; )
-      {
-         list.add(it.next().toString());
-      }
-
-      for (Iterator it = fruit.iterator() ; it.hasNext() ; )
-      {
-         list.add(it.next().toString());
-      }
-
-
-      return list;
-   }
-
-   @TransactionAttribute(TransactionAttributeType.REQUIRED)
-   public void cleanAll()
-   {
-      Query vegQuery = manager.createQuery("SELECT v FROM Vegetable v");
-      List veg = vegQuery.getResultList();
-      for (Iterator it = veg.iterator() ; it.hasNext() ; )
-      {
-         manager.remove(it.next());
-      }
-
-      Query fruitQuery = manager.createQuery("SELECT f FROM Fruit f");
-      List fruit = fruitQuery.getResultList();
-      for (Iterator it = fruit.iterator() ; it.hasNext() ; )
-      {
-         manager.remove(it.next());
-      }
-   }
-
-}

Deleted: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/TxSessionLocal.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/TxSessionLocal.java	2008-11-27 04:53:44 UTC (rev 81696)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/TxSessionLocal.java	2008-11-27 05:36:09 UTC (rev 81697)
@@ -1,32 +0,0 @@
-/*
- * 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.asynchronous;
-
-
-
-/**
- * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
- * @version $Revision$
- */
-public interface TxSessionLocal extends TxSession
-{
-}

Deleted: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/TxSessionRemote.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/TxSessionRemote.java	2008-11-27 04:53:44 UTC (rev 81696)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/TxSessionRemote.java	2008-11-27 05:36:09 UTC (rev 81697)
@@ -1,33 +0,0 @@
-/*
- * 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.asynchronous;
-
-
-
-/**
- * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
- * @version $Revision$
- */
-public interface TxSessionRemote extends TxSession
-{
-
-}

Modified: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/unit/AsynchronousTestCase.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/unit/AsynchronousTestCase.java	2008-11-27 04:53:44 UTC (rev 81696)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/unit/AsynchronousTestCase.java	2008-11-27 05:36:09 UTC (rev 81697)
@@ -21,14 +21,11 @@
  */
 package org.jboss.ejb3.test.asynchronous.unit;
 
-import java.util.Collection;
 import java.util.concurrent.Future;
 
 import javax.ejb.EJBAccessException;
 import javax.management.MBeanServerConnection;
 import javax.management.ObjectName;
-import javax.transaction.RollbackException;
-import javax.transaction.UserTransaction;
 
 import junit.framework.Test;
 
@@ -40,7 +37,6 @@
 import org.jboss.ejb3.test.asynchronous.StatefulRemote;
 import org.jboss.ejb3.test.asynchronous.StatelessClusteredRemote;
 import org.jboss.ejb3.test.asynchronous.StatelessRemote;
-import org.jboss.ejb3.test.asynchronous.TxSessionRemote;
 import org.jboss.logging.Logger;
 import org.jboss.security.client.SecurityClient;
 import org.jboss.security.client.SecurityClientFactory;
@@ -192,104 +188,7 @@
       ret = getReturnOrException(ap);
       assertTrue("SecurityException not thrown: " + ret, ret instanceof EJBAccessException);
    }
-
-   public void testRemoteAsynchTransaction() throws Exception
-   {
-      TxSessionRemote tester = (TxSessionRemote) getInitialContext().lookup("TxSessionBean/remote");
-      TxSessionRemote asynchTester = AsyncUtils.mixinAsync(tester);
-      AsyncProvider ap = (AsyncProvider) asynchTester;
-      UserTransaction tx = (UserTransaction)getInitialContext().lookup("UserTransaction");
-
-      //Add some entries in different threads and commit
-      tx.begin();
-      tester.createFruit("apple", false);
-      tester.createFruit("pear", false);
-      tester.createFruit("tomato", false);
-
-      asynchTester.createVeg("Potato", false);
-      waitForProvider(ap);
-      asynchTester.createVeg("Turnip", false);
-      waitForProvider(ap);
-      asynchTester.createVeg("Carrot", false);
-      waitForProvider(ap);
-      tx.commit();
-
-      tx.begin();
-      Collection entries = tester.getEntries();
-      tx.commit();
-      assertEquals("Wrong number of entries", 6, entries.size());
-
-      //Cleanup synchronously
-      tx.begin();
-      tester.cleanAll();
-      tx.commit();
-
-      tx.begin();
-      entries = tester.getEntries();
-      tx.commit();
-      assertEquals("Wrong number of entries", 0, entries.size());
-
-      //Add some entries in different threads and rollback
-      tx.begin();
-      tester.createFruit("apple", false);
-      tester.createFruit("pear", false);
-      tester.createFruit("tomato", false);
-
-      asynchTester.createVeg("Potato", false);
-      waitForProvider(ap);
-      asynchTester.createVeg("Turnip", false);
-      waitForProvider(ap);
-      asynchTester.createVeg("Carrot", false);
-      waitForProvider(ap);
-      tx.rollback();
-
-      tx.begin();
-      entries = tester.getEntries();
-      tx.commit();
-
-      assertEquals("Wrong number of entries", 0, entries.size());
-
-      //Add some entries in different threads and rollback from within Tx
-      tx.begin();
-      tester.createFruit("apple", false);
-      tester.createFruit("pear", false);
-      tester.createFruit("tomato", true);
-
-      asynchTester.createVeg("Potato", false);
-      waitForProvider(ap);
-      asynchTester.createVeg("Turnip", false);
-      waitForProvider(ap);
-      asynchTester.createVeg("Carrot", true);
-      waitForProvider(ap);
-
-      boolean rollbackException = false;
-      try
-      {
-         tx.commit();
-      }
-      catch(RollbackException e)
-      {
-         rollbackException = true;
-      }
-
-      assertTrue("RollbackException not picked up", rollbackException);
-
-      tx.begin();
-      entries = tester.getEntries();
-      tx.commit();
-      assertEquals("Wrong number of entries", 0, entries.size());
-   }
-
-   public void testLocalAsynchTransaction() throws Exception
-   {
-	  MBeanServerConnection server = getServer();
-      ObjectName testerName = new ObjectName("jboss.ejb3:service=Tester,test=asynchronous");
-      Object[] params = {};
-      String[] sig = {};
-      server.invoke(testerName, "testLocalAsynchTransaction", params, sig);
-
-   }
-
+   
    private Object getReturnOrException(AsyncProvider provider) throws Exception
    {
       Future<?> future = provider.getFutureResult();
@@ -298,12 +197,6 @@
       return future.get();
    }
 
-   private void waitForProvider(AsyncProvider provider) throws InterruptedException
-   {
-      Future<?> future = provider.getFutureResult();
-      waitForFuture(future);
-   }
-
    private void waitForFuture(Future<?> future) throws InterruptedException
    {
       while (!future.isDone())




More information about the jboss-cvs-commits mailing list