public void test_error_validateConnection_2() throws Exception {
    DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);

    conn.getConnection().close();

    {
      Exception error = null;
      try {
        dataSource.validateConnection(conn);
      } catch (SQLException ex) {
        error = ex;
      }
      Assert.assertNotNull(error);
    }
  }
  public void test_releaseSavepoint_1() throws Exception {
    DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);

    conn.getConnection().close();
    {
      SQLException error = null;
      try {
        conn.releaseSavepoint(null);
      } catch (SQLException ex) {
        error = ex;
      }
      Assert.assertNotNull(error);
    }

    conn.close();
  }
  public void test_create_2() throws Exception {
    DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);

    conn.getConnection().close();
    {
      SQLException error = null;
      try {
        conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
      } catch (SQLException ex) {
        error = ex;
      }
      Assert.assertNotNull(error);
    }

    conn.close();
  }
  public void test_create() throws Exception {
    DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);

    conn.getConnection().close();
    {
      SQLException error = null;
      try {
        conn.createStatement();
      } catch (SQLException ex) {
        error = ex;
      }
      Assert.assertNotNull(error);
    }

    conn.close();
  }
  public void test_preCall_error_2() throws Exception {
    DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);

    conn.getConnection().close();
    {
      SQLException error = null;
      try {
        conn.prepareCall("SELECT 1");
      } catch (SQLException ex) {
        error = ex;
      }
      Assert.assertNotNull(error);
    }

    conn.close();
  }
  public void test_preCall_error_1() throws Exception {
    DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);

    conn.getConnection().close();
    {
      SQLException error = null;
      try {
        conn.prepareCall("SELECT 1", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
      } catch (SQLException ex) {
        error = ex;
      }
      Assert.assertNotNull(error);
    }

    conn.close();
  }
  public void test_handleException_2() throws Exception {
    DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
    conn.getConnection().close();

    {
      SQLException error = null;
      try {
        conn.handleException(new RuntimeException());
      } catch (SQLException ex) {
        error = ex;
      }
      Assert.assertNotNull(error);
    }

    conn.close();
  }
  public void test_handleException_4() throws Exception {
    DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
    conn.getConnection().close();

    {
      SQLException error = null;
      try {
        conn.prepareStatement("SELECT 1");
      } catch (SQLException ex) {
        error = ex;
      }
      Assert.assertNotNull(error);
    }

    Assert.assertEquals(true, conn.isClosed());
  }
  public void test_setAutoCommit() throws Exception {
    DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);

    conn.getAutoCommit();
    conn.setAutoCommit(true);
    conn.getConnection().close();
    {
      SQLException error = null;
      try {
        conn.setAutoCommit(false);
      } catch (SQLException ex) {
        error = ex;
      }
      Assert.assertNotNull(error);
    }

    conn.close();
  }
Beispiel #10
0
  public void test_basic() throws Exception {
    DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);

    Assert.assertEquals(null, conn.unwrap(Date.class));
    Assert.assertEquals(null, conn.unwrap(null));
    Assert.assertEquals(
        ((ConnectionProxy) conn.getConnection()).getRawObject(), conn.unwrap(Connection.class));

    Assert.assertEquals(false, conn.isWrapperFor(null));
    Assert.assertEquals(true, conn.isWrapperFor(DruidPooledConnection.class));
    Assert.assertEquals(true, conn.isWrapperFor(Connection.class));

    Assert.assertEquals("SELECT 1", conn.nativeSQL("SELECT 1"));

    conn.toString();

    conn.close();
    conn.toString();
  }
Beispiel #11
0
  public void test_rollback() throws Exception {
    DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);

    conn.setAutoCommit(false);
    Statement stmt = conn.createStatement();
    stmt.execute("SELECT 1");

    conn.getConnection().close();
    {
      SQLException error = null;
      try {
        conn.rollback();
      } catch (SQLException ex) {
        error = ex;
      }
      Assert.assertNotNull(error);
    }

    conn.close();
  }