Package java.sql

Examples of java.sql.Connection.unwrap()


      config.setDataSourceClassName("com.zaxxer.hikari.mocks.StubDataSource");

      HikariDataSource ds = new HikariDataSource(config);
      try {
         Connection conn = ds.getConnection();
         StubConnection stubConnection = conn.unwrap(StubConnection.class);
         stubConnection.throwException = true;

         try {
            conn.createStatement();
            Assert.fail();
View Full Code Here


      config.setDataSourceClassName("com.zaxxer.hikari.mocks.StubDataSource");

      HikariDataSource ds = new HikariDataSource(config);
      try {
         Connection conn = ds.getConnection();
         StubConnection stubConnection = conn.unwrap(StubConnection.class);
         stubConnection.throwException = true;

         try {
            conn.setTransactionIsolation(Connection.TRANSACTION_NONE);
            Assert.fail();
View Full Code Here

         catch (SQLException e) {
            // pass
         }

         try {
            conn.unwrap(getClass());
            Assert.fail();
         }
         catch (SQLException e) {
            // pass
         }
View Full Code Here

         connection.close();

         Assert.assertSame("Idle connections not as expected", 1, TestElf.getPool(ds).getIdleConnections());

         Connection connection2 = ds.getConnection();
         Assert.assertSame(connection.unwrap(Connection.class), connection2.unwrap(Connection.class));
         Assert.assertSame("Second total connections not as expected", 1, TestElf.getPool(ds).getTotalConnections());
         Assert.assertSame("Second idle connections not as expected", 0, TestElf.getPool(ds).getIdleConnections());
         connection2.close();

         Thread.sleep(2000);
View Full Code Here

         connection.close();

         Assert.assertSame("Idle connections not as expected", 1, TestElf.getPool(ds).getIdleConnections());

         Connection connection2 = ds.getConnection();
         Assert.assertSame(connection.unwrap(Connection.class), connection2.unwrap(Connection.class));
         Assert.assertSame("Second total connections not as expected", 1, TestElf.getPool(ds).getTotalConnections());
         Assert.assertSame("Second idle connections not as expected", 0, TestElf.getPool(ds).getIdleConnections());
         connection2.close();

         Thread.sleep(800);
View Full Code Here

         connection1.close();

         Connection connection2 = ds.getConnection("foo", "bar");
         connection2.close();

         Assert.assertSame(connection1.unwrap(Connection.class), connection2.unwrap(Connection.class));

         Connection connection3 = ds.getConnection("faz", "baf");
         connection3.close();

         HashMap<Object, HikariPool> multiPool = TestElf.getMultiPool(ds);
View Full Code Here

         connection.close();

         PoolUtilities.quietlySleep(1100L);

         Connection connection2 = ds.getConnection();
         Assert.assertSame(connection.unwrap(Connection.class), connection2.unwrap(Connection.class));
         Assert.assertTrue(connection2.getAutoCommit());
         connection2.close();
      }
      finally {
         ds.close();
View Full Code Here

         Connection connection = ds.getConnection();
         connection.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
         connection.close();

         Connection connection2 = ds.getConnection();
         Assert.assertSame(connection.unwrap(Connection.class), connection2.unwrap(Connection.class));
         Assert.assertEquals(Connection.TRANSACTION_READ_COMMITTED, connection2.getTransactionIsolation());
         connection2.close();
      }
      finally {
         ds.close();
View Full Code Here

         Connection connection = ds.getConnection();
         connection.setReadOnly(true);
         connection.close();

         Connection connection2 = ds.getConnection();
         Assert.assertSame(connection.unwrap(Connection.class), connection2.unwrap(Connection.class));
         Assert.assertFalse(connection2.isReadOnly());
         connection2.close();
      }
      finally {
         ds.close();
View Full Code Here

         Connection connection = ds.getConnection();
         connection.setCatalog("other");
         connection.close();

         Connection connection2 = ds.getConnection();
         Assert.assertSame(connection.unwrap(Connection.class), connection2.unwrap(Connection.class));
         Assert.assertEquals("test", connection2.getCatalog());
         connection2.close();
      }
      finally {
         ds.close();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.