Package org.teiid.test.framework.datasource

Examples of org.teiid.test.framework.datasource.DataSource


    // }

    public synchronized Connection createDriverConnection(String identifier)
      throws QueryTestFailedException {

  DataSource ds = null;
  if (identifier != null) {
      ds = DataSourceMgr.getInstance().getDataSource(identifier);
  }
  if (ds == null) {
      throw new TransactionRuntimeException(
        "Program Error: DataSource is not mapped to Identifier "
          + identifier);
  }

  Connection conn = ds.getConnection();

  if (conn != null)
      return conn;

  ConnectionStrategy cs = null;
  if (identifier == null) {
      cs = new DriverConnection(ds.getProperties());

  } else {
      cs = new DriverConnection(ds.getProperties());
  }

//  conn = cs.getConnection();
//
//  conn = (Connection) Proxy.newProxyInstance(Thread.currentThread()
//    .getContextClassLoader(),
//    new Class[] { java.sql.Connection.class },
//    new CloseInterceptor(conn));

  ds.setConnection(cs.getConnection());

  return ds.getConnection();

    }
View Full Code Here


    }

    public synchronized XAConnection createDataSourceConnection(
      String identifier) throws QueryTestFailedException {

  DataSource ds = null;
  if (identifier != null) {
      ds = DataSourceMgr.getInstance().getDataSource(identifier);
  }
  if (ds == null) {
      throw new TransactionRuntimeException(
        "Program Error: DataSource is not mapped to Identifier "
          + identifier);
  }

  XAConnection conn = ds.getXAConnection();

  if (conn != null)
      return conn;

  ConnectionStrategy cs = null;
  if (identifier == null) {
      cs = new DataSourceConnection(ds.getProperties());
  } else {
      cs = new DataSourceConnection(ds.getProperties());
  }

//  conn = cs.getXAConnection();
//
//  conn = (XAConnection) Proxy.newProxyInstance(Thread.currentThread()
//    .getContextClassLoader(),
//    new Class[] { javax.sql.XAConnection.class },
//    new CloseInterceptor(conn));

  ds.setXAConnection(cs.getXAConnection());

  return ds.getXAConnection();

    }
View Full Code Here

TOP

Related Classes of org.teiid.test.framework.datasource.DataSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.