use of com.mysql.jdbc.PacketTooBigException in project pentaho-kettle by pentaho.
the class DatabaseLogExceptionFactoryTest method testExceptionStrategyWithPacketTooBigExceptionPropSetY.
/**
* Property value has priority
*/
@Test
public void testExceptionStrategyWithPacketTooBigExceptionPropSetY() {
System.setProperty(DatabaseLogExceptionFactory.KETTLE_GLOBAL_PROP_NAME, PROPERTY_VALUE_TRUE);
DatabaseMeta databaseMeta = mock(DatabaseMeta.class);
DatabaseInterface databaseInterface = new MySQLDatabaseMeta();
PacketTooBigException e = new PacketTooBigException();
when(logTable.getDatabaseMeta()).thenReturn(databaseMeta);
when(databaseMeta.getDatabaseInterface()).thenReturn(databaseInterface);
LogExceptionBehaviourInterface exceptionStrategy = DatabaseLogExceptionFactory.getExceptionStrategy(logTable, new KettleDatabaseException(e));
String strategyName = exceptionStrategy.getClass().getName();
assertEquals(THROWABLE, strategyName);
}
use of com.mysql.jdbc.PacketTooBigException in project pentaho-kettle by pentaho.
the class DatabaseLogExceptionFactoryTest method testExceptionStrategyWithPacketTooBigException.
/**
* PDI-5153
* Test that in case of PacketTooBigException exception there will be no stack trace in log
*/
@Test
public void testExceptionStrategyWithPacketTooBigException() {
DatabaseMeta databaseMeta = mock(DatabaseMeta.class);
DatabaseInterface databaseInterface = new MySQLDatabaseMeta();
PacketTooBigException e = new PacketTooBigException();
when(logTable.getDatabaseMeta()).thenReturn(databaseMeta);
when(databaseMeta.getDatabaseInterface()).thenReturn(databaseInterface);
LogExceptionBehaviourInterface exceptionStrategy = DatabaseLogExceptionFactory.getExceptionStrategy(logTable, new KettleDatabaseException(e));
String strategyName = exceptionStrategy.getClass().getName();
assertEquals(SUPPRESSABLE_WITH_SHORT_MESSAGE, strategyName);
}
Aggregations