Search in sources :

Example 61 with BatchUpdateException

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

the class BatchUpdateExceptionTests method test3.

/**
     * Create BatchUpdateException with message and update counts
     */
@Test
public void test3() {
    BatchUpdateException ex = new BatchUpdateException(reason, uc);
    assertTrue(ex.getMessage().equals(reason) && ex.getSQLState() == null && ex.getCause() == null && ex.getErrorCode() == 0 && Arrays.equals(ex.getUpdateCounts(), uc) && Arrays.equals(ex.getLargeUpdateCounts(), luc));
}
Also used : BatchUpdateException(java.sql.BatchUpdateException) SerializedBatchUpdateException(util.SerializedBatchUpdateException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 62 with BatchUpdateException

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

the class BatchUpdateExceptionTests method test1.

/**
     * Create BatchUpdateException with no-arg constructor
     */
@Test
public void test1() {
    BatchUpdateException ex = new BatchUpdateException();
    assertTrue(ex.getMessage() == null && ex.getSQLState() == null && ex.getCause() == null && ex.getErrorCode() == 0 && ex.getUpdateCounts() == null && ex.getLargeUpdateCounts() == null);
}
Also used : BatchUpdateException(java.sql.BatchUpdateException) SerializedBatchUpdateException(util.SerializedBatchUpdateException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 63 with BatchUpdateException

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

the class BatchUpdateExceptionTests method test7.

/**
     * Create BatchUpdateException with message, SQLState, Throwable, and update
     * counts
     */
@Test
public void test7() {
    BatchUpdateException ex = new BatchUpdateException(reason, state, uc, t);
    assertTrue(ex.getMessage().equals(reason) && ex.getSQLState().equals(state) && cause.equals(ex.getCause().toString()) && ex.getErrorCode() == 0 && Arrays.equals(ex.getUpdateCounts(), uc) && Arrays.equals(ex.getLargeUpdateCounts(), luc));
}
Also used : BatchUpdateException(java.sql.BatchUpdateException) SerializedBatchUpdateException(util.SerializedBatchUpdateException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 64 with BatchUpdateException

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

the class BatchUpdateExceptionTests method test10.

/**
     * Validate that a copy of the update counts array is made
     */
@Test
public void test10() {
    int[] uc1 = { 1, 2 };
    BatchUpdateException ex = new BatchUpdateException(uc1);
    assertTrue(Arrays.equals(ex.getUpdateCounts(), uc1));
    uc1[0] = 6689;
    assertFalse(Arrays.equals(ex.getUpdateCounts(), uc1));
}
Also used : BatchUpdateException(java.sql.BatchUpdateException) SerializedBatchUpdateException(util.SerializedBatchUpdateException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 65 with BatchUpdateException

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

the class BatchUpdateExceptionTests method test2.

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

Aggregations

BatchUpdateException (java.sql.BatchUpdateException)103 SQLException (java.sql.SQLException)39 PreparedStatement (java.sql.PreparedStatement)33 Statement (java.sql.Statement)22 ArrayList (java.util.ArrayList)19 Test (org.junit.Test)19 Connection (java.sql.Connection)17 Test (org.testng.annotations.Test)17 BaseTest (util.BaseTest)17 SerializedBatchUpdateException (util.SerializedBatchUpdateException)17 ResultSet (java.sql.ResultSet)13 List (java.util.List)12 CallableStatement (java.sql.CallableStatement)8 HashSet (java.util.HashSet)8 IgniteSQLException (org.apache.ignite.internal.processors.query.IgniteSQLException)7 HashMap (java.util.HashMap)6 Map (java.util.Map)5 CustomChangeException (liquibase.exception.CustomChangeException)5 DatabaseException (liquibase.exception.DatabaseException)5 SetupException (liquibase.exception.SetupException)5