Clover coverage report -
Coverage timestamp: Thu Jul 5 2007 20:02:32 EDT
file stats: LOC: 138   Methods: 7
NCLOC: 54   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
DummyUserTransaction.java - 80% 71.4% 76.5%
coverage coverage
 1    package org.jboss.cache.transaction;
 2   
 3    import org.apache.commons.logging.Log;
 4    import org.apache.commons.logging.LogFactory;
 5   
 6    import javax.transaction.HeuristicMixedException;
 7    import javax.transaction.HeuristicRollbackException;
 8    import javax.transaction.NotSupportedException;
 9    import javax.transaction.RollbackException;
 10    import javax.transaction.Status;
 11    import javax.transaction.Synchronization;
 12    import javax.transaction.SystemException;
 13    import javax.transaction.UserTransaction;
 14    import java.util.ArrayList;
 15    import java.util.List;
 16   
 17    /**
 18    * @author bela
 19    * @version $Revision: 1.5 $
 20    * Date: May 15, 2003
 21    * Time: 4:20:17 PM
 22    */
 23    public class DummyUserTransaction implements UserTransaction, java.io.Serializable
 24    {
 25    int status = Status.STATUS_UNKNOWN;
 26    static final Log logger_ = LogFactory.getLog(DummyUserTransaction.class);
 27    DummyTransactionManager tm_;
 28    private static final long serialVersionUID = -6568400755677046127L;
 29   
 30    /**
 31    * List<Synchronization>
 32    */
 33    List<Synchronization> l = new ArrayList<Synchronization>();
 34   
 35  339 public DummyUserTransaction(DummyTransactionManager tm)
 36    {
 37  339 tm_ = tm;
 38    }
 39   
 40   
 41    /**
 42    * Starts a new transaction, and associate it with the calling thread.
 43    *
 44    * @throws NotSupportedException If the calling thread is already
 45    * associated with a transaction, and nested transactions are
 46    * not supported.
 47    * @throws SystemException If the transaction service fails in an
 48    * unexpected way.
 49    */
 50  64562 public void begin() throws NotSupportedException, SystemException
 51    {
 52  64562 tm_.begin();
 53  64562 status = Status.STATUS_ACTIVE;
 54    }
 55   
 56    /**
 57    * Attempt to commit this transaction.
 58    *
 59    * @throws RollbackException If the transaction was marked for rollback
 60    * only, the transaction is rolled back and this exception is
 61    * thrown.
 62    * @throws SystemException If the transaction service fails in an
 63    * unexpected way.
 64    * @throws HeuristicMixedException If a heuristic decision was made and
 65    * some some parts of the transaction have been committed while
 66    * other parts have been rolled back.
 67    * @throws HeuristicRollbackException If a heuristic decision to roll
 68    * back the transaction was made.
 69    * @throws SecurityException If the caller is not allowed to commit this
 70    * transaction.
 71    */
 72  64507 public void commit()
 73    throws RollbackException, HeuristicMixedException,
 74    HeuristicRollbackException, SecurityException, SystemException
 75    {
 76   
 77  64507 tm_.commit();
 78  64498 status = Status.STATUS_COMMITTED;
 79    }
 80   
 81    /**
 82    * Rolls back this transaction.
 83    *
 84    * @throws IllegalStateException If the transaction is in a state
 85    * where it cannot be rolled back. This could be because the
 86    * transaction is no longer active, or because it is in the
 87    * {@link Status#STATUS_PREPARED prepared state}.
 88    * @throws SystemException If the transaction service fails in an
 89    * unexpected way.
 90    */
 91  111 public void rollback() throws IllegalStateException, SystemException
 92    {
 93  111 tm_.rollback();
 94  51 status = Status.STATUS_ROLLEDBACK;
 95    }
 96   
 97    /**
 98    * Mark the transaction so that the only possible outcome is a rollback.
 99    *
 100    * @throws IllegalStateException If the transaction is not in an active
 101    * state.
 102    * @throws SystemException If the transaction service fails in an
 103    * unexpected way.
 104    */
 105  14 public void setRollbackOnly() throws IllegalStateException, SystemException
 106    {
 107  14 tm_.setRollbackOnly();
 108    }
 109   
 110    /**
 111    * Get the status of the transaction.
 112    *
 113    * @return The status of the transaction. This is one of the
 114    * {@link Status} constants.
 115    * @throws SystemException If the transaction service fails in an
 116    * unexpected way.
 117    */
 118  0 public int getStatus() throws SystemException
 119    {
 120  0 return tm_.getStatus();
 121    }
 122   
 123    /**
 124    * Change the transaction timeout for transactions started by the calling
 125    * thread with the {@link #begin()} method.
 126    *
 127    * @param seconds The new timeout value, in seconds. If this parameter
 128    * is <code>0</code>, the timeout value is reset to the default
 129    * value.
 130    * @throws SystemException If the transaction service fails in an
 131    * unexpected way.
 132    */
 133  0 public void setTransactionTimeout(int seconds) throws SystemException
 134    {
 135  0 throw new SystemException("not supported");
 136    }
 137   
 138    }