Search in sources :

Example 1 with PacketTooBigException

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);
}
Also used : DatabaseInterface(org.pentaho.di.core.database.DatabaseInterface) PacketTooBigException(com.mysql.jdbc.PacketTooBigException) KettleDatabaseException(org.pentaho.di.core.exception.KettleDatabaseException) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) MySQLDatabaseMeta(org.pentaho.di.core.database.MySQLDatabaseMeta) MariaDBDatabaseMeta(org.pentaho.di.core.database.MariaDBDatabaseMeta) MySQLDatabaseMeta(org.pentaho.di.core.database.MySQLDatabaseMeta) Test(org.junit.Test)

Example 2 with PacketTooBigException

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);
}
Also used : DatabaseInterface(org.pentaho.di.core.database.DatabaseInterface) PacketTooBigException(com.mysql.jdbc.PacketTooBigException) KettleDatabaseException(org.pentaho.di.core.exception.KettleDatabaseException) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) MySQLDatabaseMeta(org.pentaho.di.core.database.MySQLDatabaseMeta) MariaDBDatabaseMeta(org.pentaho.di.core.database.MariaDBDatabaseMeta) MySQLDatabaseMeta(org.pentaho.di.core.database.MySQLDatabaseMeta) Test(org.junit.Test)

Aggregations

PacketTooBigException (com.mysql.jdbc.PacketTooBigException)2 Test (org.junit.Test)2 DatabaseInterface (org.pentaho.di.core.database.DatabaseInterface)2 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)2 MariaDBDatabaseMeta (org.pentaho.di.core.database.MariaDBDatabaseMeta)2 MySQLDatabaseMeta (org.pentaho.di.core.database.MySQLDatabaseMeta)2 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)2