Clover coverage report -
Coverage timestamp: Thu Jul 5 2007 20:02:32 EDT
file stats: LOC: 67   Methods: 4
NCLOC: 40   Classes: 2
 
 Source file Conditionals Statements Methods TOTAL
NotifyingTransactionManager.java - 75% 75% 75%
coverage coverage
 1    /*
 2    * JBoss, Home of Professional Open Source
 3    *
 4    * Distributable under LGPL license.
 5    * See terms of license at gnu.org.
 6    */
 7    package org.jboss.cache.transaction;
 8   
 9   
 10    import javax.transaction.NotSupportedException;
 11    import javax.transaction.RollbackException;
 12    import javax.transaction.SystemException;
 13    import javax.transaction.Transaction;
 14    import javax.transaction.TransactionManager;
 15   
 16    /**
 17    * A dummy transaction manager that notifies registered listeners of the various phases of a 2PC so exceptions, etc. can be injected.
 18    *
 19    * @author <a href="mailto:manik@jboss.org">Manik Surtani (manik@jboss.org)</a>
 20    */
 21    public class NotifyingTransactionManager extends DummyTransactionManager implements TransactionManagerLookup
 22    {
 23   
 24    private static final long serialVersionUID = -2994163352889758708L;
 25   
 26    private Notification notification;
 27   
 28  3 public void begin() throws SystemException, NotSupportedException
 29    {
 30  3 super.begin();
 31  3 try
 32    {
 33  3 System.out.println("Calling notification.notify()");
 34  3 notification.notify(getTransaction());
 35    }
 36    catch (RollbackException e)
 37    {
 38  0 e.printStackTrace();
 39    }
 40    }
 41   
 42  3 public TransactionManager getTransactionManager() throws Exception
 43    {
 44  3 return this;
 45    }
 46   
 47    public interface Notification
 48    {
 49    public void notify(Transaction tx) throws SystemException, RollbackException;
 50    }
 51   
 52   
 53  0 public Notification getNotification()
 54    {
 55  0 return notification;
 56    }
 57   
 58   
 59  3 public void setNotification(Notification notification)
 60    {
 61  3 this.notification = notification;
 62    }
 63   
 64    }
 65   
 66   
 67