use of com.mysql.cj.jdbc.SuspendableXAConnection in project JavaSegundasQuintas by ecteruel.
the class ConnectionRegressionTest method testBug62452.
/**
* Tests fix for BUG#62452 - NPE thrown in JDBC4MySQLPooledException when statement is closed.
*
* @throws Exception
*/
@Test
public void testBug62452() throws Exception {
PooledConnection con = null;
MysqlConnectionPoolDataSource pds = new MysqlConnectionPoolDataSource();
pds.setUrl(dbUrl);
pds.getStringProperty(PropertyKey.sslMode.getKeyName()).setValue("DISABLED");
pds.getBooleanProperty(PropertyKey.allowPublicKeyRetrieval.getKeyName()).setValue(true);
con = pds.getPooledConnection();
assertTrue(con instanceof MysqlPooledConnection);
testBug62452WithConnection(con);
MysqlXADataSource xads = new MysqlXADataSource();
xads.setUrl(dbUrl);
xads.getStringProperty(PropertyKey.sslMode.getKeyName()).setValue("DISABLED");
xads.getBooleanProperty(PropertyKey.allowPublicKeyRetrieval.getKeyName()).setValue(true);
xads.getProperty(PropertyKey.pinGlobalTxToPhysicalConnection).setValue(false);
con = xads.getXAConnection();
assertTrue(con instanceof MysqlXAConnection);
testBug62452WithConnection(con);
xads.getProperty(PropertyKey.pinGlobalTxToPhysicalConnection).setValue(true);
con = xads.getXAConnection();
assertTrue(con instanceof SuspendableXAConnection);
testBug62452WithConnection(con);
}
use of com.mysql.cj.jdbc.SuspendableXAConnection in project JavaSegundasQuintas by ecteruel.
the class ConnectionRegressionTest method testBug46925.
@Test
public void testBug46925() throws Exception {
MysqlXADataSource xads1 = new MysqlXADataSource();
MysqlXADataSource xads2 = new MysqlXADataSource();
Xid txid = new MysqlXid(new byte[] { 0x1 }, new byte[] { 0xf }, 3306);
xads1.getStringProperty(PropertyKey.sslMode.getKeyName()).setValue("DISABLED");
xads1.getBooleanProperty(PropertyKey.allowPublicKeyRetrieval.getKeyName()).setValue(true);
xads1.getProperty(PropertyKey.pinGlobalTxToPhysicalConnection).setValue(true);
xads1.setUrl(dbUrl);
xads2.getStringProperty(PropertyKey.sslMode.getKeyName()).setValue("DISABLED");
xads2.getBooleanProperty(PropertyKey.allowPublicKeyRetrieval.getKeyName()).setValue(true);
xads2.getProperty(PropertyKey.pinGlobalTxToPhysicalConnection).setValue(true);
xads2.setUrl(dbUrl);
XAConnection c1 = xads1.getXAConnection();
assertTrue(c1 instanceof SuspendableXAConnection);
// start a transaction on one connection
c1.getXAResource().start(txid, XAResource.TMNOFLAGS);
c1.getXAResource().end(txid, XAResource.TMSUCCESS);
XAConnection c2 = xads2.getXAConnection();
assertTrue(c2 instanceof SuspendableXAConnection);
// prepare on another one. Since we are using a "pinned" connection we should have the same "currentXAConnection" for both SuspendableXAConnection
// this will fail without the fix.
c2.getXAResource().prepare(txid);
c2.getXAResource().commit(txid, false);
}
use of com.mysql.cj.jdbc.SuspendableXAConnection in project ABC by RuiPinto96274.
the class ConnectionRegressionTest method testBug62452.
/**
* Tests fix for BUG#62452 - NPE thrown in JDBC4MySQLPooledException when statement is closed.
*
* @throws Exception
*/
@Test
public void testBug62452() throws Exception {
PooledConnection con = null;
MysqlConnectionPoolDataSource pds = new MysqlConnectionPoolDataSource();
pds.setUrl(dbUrl);
pds.getStringProperty(PropertyKey.sslMode.getKeyName()).setValue("DISABLED");
pds.getBooleanProperty(PropertyKey.allowPublicKeyRetrieval.getKeyName()).setValue(true);
con = pds.getPooledConnection();
assertTrue(con instanceof MysqlPooledConnection);
testBug62452WithConnection(con);
MysqlXADataSource xads = new MysqlXADataSource();
xads.setUrl(dbUrl);
xads.getStringProperty(PropertyKey.sslMode.getKeyName()).setValue("DISABLED");
xads.getBooleanProperty(PropertyKey.allowPublicKeyRetrieval.getKeyName()).setValue(true);
xads.getProperty(PropertyKey.pinGlobalTxToPhysicalConnection).setValue(false);
con = xads.getXAConnection();
assertTrue(con instanceof MysqlXAConnection);
testBug62452WithConnection(con);
xads.getProperty(PropertyKey.pinGlobalTxToPhysicalConnection).setValue(true);
con = xads.getXAConnection();
assertTrue(con instanceof SuspendableXAConnection);
testBug62452WithConnection(con);
}
use of com.mysql.cj.jdbc.SuspendableXAConnection in project ABC by RuiPinto96274.
the class ConnectionRegressionTest method testBug46925.
@Test
public void testBug46925() throws Exception {
MysqlXADataSource xads1 = new MysqlXADataSource();
MysqlXADataSource xads2 = new MysqlXADataSource();
Xid txid = new MysqlXid(new byte[] { 0x1 }, new byte[] { 0xf }, 3306);
xads1.getStringProperty(PropertyKey.sslMode.getKeyName()).setValue("DISABLED");
xads1.getBooleanProperty(PropertyKey.allowPublicKeyRetrieval.getKeyName()).setValue(true);
xads1.getProperty(PropertyKey.pinGlobalTxToPhysicalConnection).setValue(true);
xads1.setUrl(dbUrl);
xads2.getStringProperty(PropertyKey.sslMode.getKeyName()).setValue("DISABLED");
xads2.getBooleanProperty(PropertyKey.allowPublicKeyRetrieval.getKeyName()).setValue(true);
xads2.getProperty(PropertyKey.pinGlobalTxToPhysicalConnection).setValue(true);
xads2.setUrl(dbUrl);
XAConnection c1 = xads1.getXAConnection();
assertTrue(c1 instanceof SuspendableXAConnection);
// start a transaction on one connection
c1.getXAResource().start(txid, XAResource.TMNOFLAGS);
c1.getXAResource().end(txid, XAResource.TMSUCCESS);
XAConnection c2 = xads2.getXAConnection();
assertTrue(c2 instanceof SuspendableXAConnection);
// prepare on another one. Since we are using a "pinned" connection we should have the same "currentXAConnection" for both SuspendableXAConnection
// this will fail without the fix.
c2.getXAResource().prepare(txid);
c2.getXAResource().commit(txid, false);
}
use of com.mysql.cj.jdbc.SuspendableXAConnection in project aws-mysql-jdbc by awslabs.
the class ConnectionRegressionTest method testBug62452.
/**
* Tests fix for BUG#62452 - NPE thrown in JDBC4MySQLPooledException when statement is closed.
*
* @throws Exception
*/
@Test
public void testBug62452() throws Exception {
PooledConnection con = null;
MysqlConnectionPoolDataSource pds = new MysqlConnectionPoolDataSource();
pds.setUrl(dbUrl);
pds.getStringProperty(PropertyKey.sslMode.getKeyName()).setValue("DISABLED");
pds.getBooleanProperty(PropertyKey.allowPublicKeyRetrieval.getKeyName()).setValue(true);
con = pds.getPooledConnection();
assertTrue(con instanceof MysqlPooledConnection);
testBug62452WithConnection(con);
MysqlXADataSource xads = new MysqlXADataSource();
xads.setUrl(dbUrl);
xads.getStringProperty(PropertyKey.sslMode.getKeyName()).setValue("DISABLED");
xads.getBooleanProperty(PropertyKey.allowPublicKeyRetrieval.getKeyName()).setValue(true);
xads.getProperty(PropertyKey.pinGlobalTxToPhysicalConnection).setValue(false);
con = xads.getXAConnection();
assertTrue(con instanceof MysqlXAConnection);
testBug62452WithConnection(con);
xads.getProperty(PropertyKey.pinGlobalTxToPhysicalConnection).setValue(true);
con = xads.getXAConnection();
assertTrue(con instanceof SuspendableXAConnection);
testBug62452WithConnection(con);
}
Aggregations