Clover coverage report -
Coverage timestamp: Thu Jul 5 2007 20:02:32 EDT
file stats: LOC: 73   Methods: 3
NCLOC: 55   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
DummyTransactionManager.java 75% 85.7% 100% 85.7%
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.naming.Context;
 7    import javax.naming.InitialContext;
 8    import javax.naming.NamingException;
 9    import java.util.Properties;
 10   
 11    /**
 12    * Simple transaction manager implementation that maintains transaction state
 13    * in memory only.
 14    *
 15    * @author bela
 16    * @version $Revision: 1.5 $
 17    * Date: May 15, 2003
 18    * Time: 4:11:37 PM
 19    */
 20    public class DummyTransactionManager extends DummyBaseTransactionManager
 21    {
 22    static DummyTransactionManager instance = null;
 23   
 24    static Log log = LogFactory.getLog(DummyTransactionManager.class);
 25   
 26    private static final long serialVersionUID = 4396695354693176535L;
 27   
 28  342 public DummyTransactionManager()
 29    {
 30    }
 31   
 32  3399 public static DummyTransactionManager getInstance()
 33    {
 34  3399 if (instance == null)
 35    {
 36  338 instance = new DummyTransactionManager();
 37  338 try
 38    {
 39  338 Properties p = new Properties();
 40  338 p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.cache.transaction.DummyContextFactory");
 41  338 Context ctx = new InitialContext(p);
 42  338 ctx.bind("java:/TransactionManager", instance);
 43  338 ctx.bind("UserTransaction", new DummyUserTransaction(instance));
 44    }
 45    catch (NamingException e)
 46    {
 47  0 log.error("binding of DummyTransactionManager failed", e);
 48    }
 49    }
 50  3399 return instance;
 51    }
 52   
 53  135 public static void destroy()
 54    {
 55  135 if (instance == null)
 56  0 return;
 57  135 try
 58    {
 59  135 Properties p = new Properties();
 60  135 p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.cache.transaction.DummyContextFactory");
 61  135 Context ctx = new InitialContext(p);
 62  135 ctx.unbind("java:/TransactionManager");
 63  135 ctx.unbind("UserTransaction");
 64    }
 65    catch (NamingException e)
 66    {
 67  0 log.error("unbinding of DummyTransactionManager failed", e);
 68    }
 69  135 instance.setTransaction(null);
 70  135 instance = null;
 71    }
 72   
 73    }