Search in sources :

Example 86 with SQLWarning

use of java.sql.SQLWarning in project jdk8u_jdk by JetBrains.

the class SQLWarningTests method test2.

/**
     * Create SQLWarning with message
     */
@Test
public void test2() {
    SQLWarning ex = new SQLWarning(reason);
    assertTrue(ex.getMessage().equals(reason) && ex.getSQLState() == null && ex.getCause() == null && ex.getErrorCode() == 0);
}
Also used : SQLWarning(java.sql.SQLWarning) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 87 with SQLWarning

use of java.sql.SQLWarning in project jdk8u_jdk by JetBrains.

the class SQLWarningTests method test12.

/**
     * Validate that the ordering of the returned Exceptions is correct using
     * traditional while loop
     */
@Test
public void test12() {
    SQLWarning ex = new SQLWarning("Exception 1", t1);
    SQLWarning ex1 = new SQLWarning("Exception 2");
    SQLWarning ex2 = new SQLWarning("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    SQLException sqe = ex;
    while (sqe != null) {
        assertTrue(msgs[num++].equals(sqe.getMessage()));
        Throwable c = sqe.getCause();
        while (c != null) {
            assertTrue(msgs[num++].equals(c.getMessage()));
            c = c.getCause();
        }
        sqe = sqe.getNextException();
    }
}
Also used : SQLWarning(java.sql.SQLWarning) SQLException(java.sql.SQLException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 88 with SQLWarning

use of java.sql.SQLWarning in project jdk8u_jdk by JetBrains.

the class SQLWarningTests method test.

/**
     * Create SQLWarning and setting all objects to null
     */
@Test
public void test() {
    SQLWarning e = new SQLWarning(null, null, errorCode, null);
    assertTrue(e.getMessage() == null && e.getSQLState() == null && e.getCause() == null && e.getErrorCode() == errorCode);
}
Also used : SQLWarning(java.sql.SQLWarning) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 89 with SQLWarning

use of java.sql.SQLWarning in project jdk8u_jdk by JetBrains.

the class SQLWarningTests method test3.

/**
     * Create SQLWarning with message, and SQLState
     */
@Test
public void test3() {
    SQLWarning ex = new SQLWarning(reason, state);
    assertTrue(ex.getMessage().equals(reason) && ex.getSQLState().equals(state) && ex.getCause() == null && ex.getErrorCode() == 0);
}
Also used : SQLWarning(java.sql.SQLWarning) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 90 with SQLWarning

use of java.sql.SQLWarning in project jdk8u_jdk by JetBrains.

the class SQLWarningTests method test11.

/**
     * Validate that the ordering of the returned Exceptions is correct using
     * for-each loop
     */
@Test
public void test11() {
    SQLWarning ex = new SQLWarning("Exception 1", t1);
    SQLWarning ex1 = new SQLWarning("Exception 2");
    SQLWarning ex2 = new SQLWarning("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(msgs[num++].equals(e.getMessage()));
    }
}
Also used : SQLWarning(java.sql.SQLWarning) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Aggregations

SQLWarning (java.sql.SQLWarning)153 SQLException (java.sql.SQLException)49 Statement (java.sql.Statement)37 PreparedStatement (java.sql.PreparedStatement)30 Connection (java.sql.Connection)26 ResultSet (java.sql.ResultSet)23 Test (org.testng.annotations.Test)19 Test (org.junit.Test)17 BaseTest (util.BaseTest)15 CallableStatement (java.sql.CallableStatement)13 ArrayList (java.util.ArrayList)9 JDBCStatement (org.jkiss.dbeaver.model.exec.jdbc.JDBCStatement)8 ResultSetMetaData (java.sql.ResultSetMetaData)6 Expectations (org.jmock.Expectations)6 IOException (java.io.IOException)4 FilterChainImpl (com.alibaba.druid.filter.FilterChainImpl)3 PrestoWarning (com.facebook.presto.spi.PrestoWarning)3 Properties (java.util.Properties)3 LanguageConnectionContext (org.apache.derby.iapi.sql.conn.LanguageConnectionContext)3 StatementContext (org.apache.derby.iapi.sql.conn.StatementContext)3