Package de.hybris.platform.jdbcwrapper
Class JUnitConnectionErrorCheckingJDBCConnectionPool
java.lang.Object
de.hybris.platform.jdbcwrapper.JDBCConnectionPool
de.hybris.platform.jdbcwrapper.ConnectionErrorCheckingJDBCConnectionPool
de.hybris.platform.jdbcwrapper.JUnitConnectionErrorCheckingJDBCConnectionPool
- All Implemented Interfaces:
JUnitJDBCConnectionPool
public class JUnitConnectionErrorCheckingJDBCConnectionPool
extends ConnectionErrorCheckingJDBCConnectionPool
implements JUnitJDBCConnectionPool
For testing error handling when
- all connections fail
- single connections fail
- the pool reports connection errors in general
-
Constructor Summary
ConstructorsConstructorDescriptionJUnitConnectionErrorCheckingJDBCConnectionPool(JUnitJDBCConnectionFactory factory, org.apache.commons.pool2.impl.GenericObjectPoolConfig cfg, JUnitConnectionStatus connectionStatus) -
Method Summary
Modifier and TypeMethodDescriptionvoidAllows manually marking a connection to fail validation upon nextJDBCConnectionPool.returnConnection(Connection).longprotected booleanmayTestAgain(int intervalSeconds) Don't wait for testing.booleanmustValidate(Connection con) voidRemoves a connection from failing set.voidvoidvoidsetAllConnectionsFail(boolean allFail) Allows to manually cause all connections to fail upon validate.voidsetPoolHasConnectionErrors(boolean hasErrors) Allows manual activating / deActivating of connection error flag held by his pool.voidMethods inherited from class de.hybris.platform.jdbcwrapper.ConnectionErrorCheckingJDBCConnectionPool
borrowConnection, cannotConnect, doBorrowConnection, getConnectRetries, setConnectRetriesMethods inherited from class de.hybris.platform.jdbcwrapper.JDBCConnectionPool
close, disableOracleStatementCaching, enableOracleStatementCaching, getMaxActive, getMaxPhysicalOpen, getNumActive, getNumIdle, getNumPhysicalOpen, getNumReadOnlyOpen, invalidateConnection, isPoolClosed, resetOracleStatementCaching, resetStats, returnConnection, setDumpStackOnConnectionError, toString
-
Constructor Details
-
JUnitConnectionErrorCheckingJDBCConnectionPool
public JUnitConnectionErrorCheckingJDBCConnectionPool(JUnitJDBCConnectionFactory factory, org.apache.commons.pool2.impl.GenericObjectPoolConfig cfg, JUnitConnectionStatus connectionStatus)
-
-
Method Details
-
mustValidate
-
setPoolHasConnectionErrors
public void setPoolHasConnectionErrors(boolean hasErrors) Allows manual activating / deActivating of connection error flag held by his pool.- Parameters:
hasErrors-
-
addFailingConnection
Allows manually marking a connection to fail validation upon nextJDBCConnectionPool.returnConnection(Connection).- Specified by:
addFailingConnectionin interfaceJUnitJDBCConnectionPool- Parameters:
con-
-
removeFailingConnection
Removes a connection from failing set.- Specified by:
removeFailingConnectionin interfaceJUnitJDBCConnectionPool- Parameters:
con-- See Also:
-
setAllConnectionsFail
public void setAllConnectionsFail(boolean allFail) Allows to manually cause all connections to fail upon validate.- Specified by:
setAllConnectionsFailin interfaceJUnitJDBCConnectionPool- Parameters:
allFail-
-
resetTestMode
public void resetTestMode()- Specified by:
resetTestModein interfaceJUnitJDBCConnectionPool
-
mayTestAgain
protected boolean mayTestAgain(int intervalSeconds) Don't wait for testing. Otherwise we have hard times testing.- Overrides:
mayTestAgainin classConnectionErrorCheckingJDBCConnectionPool
-
resumeConnectionBorrowing
public void resumeConnectionBorrowing()- Specified by:
resumeConnectionBorrowingin interfaceJUnitJDBCConnectionPool
-
suspendConnectionBorrowing
public void suspendConnectionBorrowing()- Specified by:
suspendConnectionBorrowingin interfaceJUnitJDBCConnectionPool
-
borrowConnection
- Overrides:
borrowConnectionin classConnectionErrorCheckingJDBCConnectionPool- Throws:
Exception
-
getConnectionStatusErrorCounter
public long getConnectionStatusErrorCounter()
-