Coverage Report - org.mule.transport.jdbc.xa.DataSourceWrapper
 
Classes in this File Line Coverage Branch Coverage Complexity
DataSourceWrapper
0%
0/18
N/A
0
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.transport.jdbc.xa;
 8  
 
 9  
 import java.io.PrintWriter;
 10  
 import java.sql.Connection;
 11  
 import java.sql.SQLException;
 12  
 
 13  
 import javax.sql.DataSource;
 14  
 import javax.sql.XADataSource;
 15  
 import javax.transaction.TransactionManager;
 16  
 
 17  
 /**
 18  
  * Using for unification XADataSource and DataSource
 19  
  */
 20  
 public class DataSourceWrapper implements DataSource
 21  
 {
 22  
 
 23  
     private XADataSource xaDataSource;
 24  
 
 25  
     public DataSourceWrapper()
 26  
     {
 27  0
         super();
 28  0
     }
 29  
 
 30  
     public DataSourceWrapper(XADataSource xaDataSource)
 31  0
     {
 32  0
         this.xaDataSource = xaDataSource;
 33  0
     }
 34  
 
 35  
     public int getLoginTimeout() throws SQLException
 36  
     {
 37  0
         return xaDataSource.getLoginTimeout();
 38  
     }
 39  
 
 40  
     public void setLoginTimeout(int seconds) throws SQLException
 41  
     {
 42  0
         xaDataSource.setLoginTimeout(seconds);
 43  0
     }
 44  
 
 45  
     public PrintWriter getLogWriter() throws SQLException
 46  
     {
 47  0
         return xaDataSource.getLogWriter();
 48  
     }
 49  
 
 50  
     public void setLogWriter(PrintWriter out) throws SQLException
 51  
     {
 52  0
         xaDataSource.setLogWriter(out);
 53  0
     }
 54  
 
 55  
     public Connection getConnection() throws SQLException
 56  
     {
 57  0
         return new ConnectionWrapper(xaDataSource.getXAConnection());
 58  
     }
 59  
 
 60  
     public Connection getConnection(String username, String password) throws SQLException
 61  
     {
 62  0
         return new ConnectionWrapper(xaDataSource.getXAConnection(username, password));    
 63  
     }
 64  
 
 65  
     /**
 66  
      * @return Returns the underlying XADataSource.
 67  
      */
 68  
     public XADataSource getXaDataSource()
 69  
     {
 70  0
         return xaDataSource;
 71  
     }
 72  
 
 73  
     /**
 74  
      * @param xads The XADataSource to set.
 75  
      */
 76  
     public void setXaDataSource(XADataSource xads)
 77  
     {
 78  0
         this.xaDataSource = xads;
 79  0
     }
 80  
 
 81  
     public boolean isWrapperFor(Class<?> iface) throws SQLException
 82  
     {
 83  0
         return false;
 84  
     }
 85  
 
 86  
     public <T> T unwrap(Class<T> iface) throws SQLException
 87  
     {
 88  0
         return null;
 89  
     }
 90  
 
 91  
 }