Search in sources :

Example 1 with MariaDBDatabaseMeta

use of org.pentaho.di.core.database.MariaDBDatabaseMeta in project pentaho-kettle by pentaho.

the class DatabaseLogExceptionFactoryTest method testExceptionStrategyWithMaxAllowedPacketException.

/**
 * PDI-5153
 * Test that in case of MaxAllowedPacketException exception there will be no stack trace in log (MariaDB)
 */
@Test
public void testExceptionStrategyWithMaxAllowedPacketException() {
    DatabaseMeta databaseMeta = mock(DatabaseMeta.class);
    DatabaseInterface databaseInterface = new MariaDBDatabaseMeta();
    MaxAllowedPacketException e = new MaxAllowedPacketException();
    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) MariaDBDatabaseMeta(org.pentaho.di.core.database.MariaDBDatabaseMeta) KettleDatabaseException(org.pentaho.di.core.exception.KettleDatabaseException) MaxAllowedPacketException(org.mariadb.jdbc.internal.stream.MaxAllowedPacketException) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) MySQLDatabaseMeta(org.pentaho.di.core.database.MySQLDatabaseMeta) MariaDBDatabaseMeta(org.pentaho.di.core.database.MariaDBDatabaseMeta) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 MaxAllowedPacketException (org.mariadb.jdbc.internal.stream.MaxAllowedPacketException)1 DatabaseInterface (org.pentaho.di.core.database.DatabaseInterface)1 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)1 MariaDBDatabaseMeta (org.pentaho.di.core.database.MariaDBDatabaseMeta)1 MySQLDatabaseMeta (org.pentaho.di.core.database.MySQLDatabaseMeta)1 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)1