Coverage Report - org.mule.transport.jms.xa.XAResourceWrapper
 
Classes in this File Line Coverage Branch Coverage Complexity
XAResourceWrapper
74%
17/23
100%
2/2
1.083
 
 1  
 /*
 2  
  * $Id: XAResourceWrapper.java 10590 2008-01-29 01:39:47Z tcarlson $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 package org.mule.transport.jms.xa;
 11  
 
 12  
 import javax.transaction.xa.XAException;
 13  
 import javax.transaction.xa.XAResource;
 14  
 import javax.transaction.xa.Xid;
 15  
 
 16  
 /**
 17  
  * Arjuna can't serialize proxy
 18  
  */
 19  
 public class XAResourceWrapper implements XAResource
 20  
 {
 21  
 
 22  
     private XAResource xaResource;
 23  
     private SessionInvocationHandler sessionInvocationHandler;
 24  
 
 25  
     public XAResourceWrapper(XAResource xaResource, SessionInvocationHandler sessionInvocationHandler)
 26  65
     {
 27  66
         this.xaResource = xaResource;
 28  65
         this.sessionInvocationHandler = sessionInvocationHandler;
 29  63
     }
 30  
 
 31  
     public int getTransactionTimeout() throws XAException
 32  
     {
 33  0
         return xaResource.getTransactionTimeout();
 34  
     }
 35  
 
 36  
     public boolean setTransactionTimeout(int i) throws XAException
 37  
     {
 38  65
         return xaResource.setTransactionTimeout(i);
 39  
     }
 40  
 
 41  
     public boolean isSameRM(XAResource xaResource) throws XAException
 42  
     {
 43  6
         if (xaResource instanceof XAResourceWrapper)
 44  
         {
 45  2
             xaResource = ((XAResourceWrapper) xaResource).xaResource;
 46  
         }
 47  6
         return this.xaResource.isSameRM(xaResource);
 48  
     }
 49  
 
 50  
     public Xid[] recover(int i) throws XAException
 51  
     {
 52  0
         return xaResource.recover(i);
 53  
     }
 54  
 
 55  
     public int prepare(Xid xid) throws XAException
 56  
     {
 57  0
         return xaResource.prepare(xid);
 58  
     }
 59  
 
 60  
     public void forget(Xid xid) throws XAException
 61  
     {
 62  0
         xaResource.forget(xid);
 63  0
     }
 64  
 
 65  
     public void rollback(Xid xid) throws XAException
 66  
     {
 67  12
         xaResource.rollback(xid);
 68  7
     }
 69  
 
 70  
     public void end(Xid xid, int i) throws XAException
 71  
     {
 72  67
         xaResource.end(xid, i);
 73  46
         sessionInvocationHandler.setEnlisted(false);
 74  46
     }
 75  
 
 76  
     public void start(Xid xid, int i) throws XAException
 77  
     {
 78  66
         xaResource.start(xid, i);
 79  67
     }
 80  
 
 81  
     public void commit(Xid xid, boolean b) throws XAException
 82  
     {
 83  32
         xaResource.commit(xid, b);
 84  32
     }
 85  
 
 86  
     public String toString()
 87  
     {
 88  0
         return xaResource.toString();
 89  
     }
 90  
 }