Package java.sql

Examples of java.sql.SQLNonTransientException


    assertFalse(this.dialect.indicatesFailure(new SQLException()));
    assertFalse(this.dialect.indicatesFailure(new BatchUpdateException()));
    assertFalse(this.dialect.indicatesFailure(new RowSetWarning()));
    assertFalse(this.dialect.indicatesFailure(new SerialException()));
    assertFalse(this.dialect.indicatesFailure(new SQLClientInfoException()));
    assertFalse(this.dialect.indicatesFailure(new SQLNonTransientException()));
    assertFalse(this.dialect.indicatesFailure(new SQLDataException()));
    assertFalse(this.dialect.indicatesFailure(new SQLFeatureNotSupportedException()));
    assertFalse(this.dialect.indicatesFailure(new SQLIntegrityConstraintViolationException()));
    assertFalse(this.dialect.indicatesFailure(new SQLInvalidAuthorizationSpecException()));
    assertFalse(this.dialect.indicatesFailure(new SQLSyntaxErrorException()));
View Full Code Here


   * Converts {@link com.google.protobuf.ServiceException} into {@link java.sql.SQLException}.
   */
  public static SQLException getSqlException(ServiceException e) {
    String detail = e.getMessage();
    if (detail == null) {
      return new SQLNonTransientException("Unknown Vtocc exception", e);
    } else if (detail.startsWith("retry")) {
      return new SQLTransientException("Retriable Vtocc exception: " + detail, e);
    } else if (detail.startsWith("fatal")) {
      return new SQLNonTransientException("Fatal Vtocc exception: " + detail, e);
    } else if (detail.startsWith("tx_pool_full")) {
      return new SQLTransientConnectionException(
          "Pool exhausted Vtocc exception: " + detail, e);
    }
    Matcher errNoMatcher = Pattern.compile("\\(errno (\\d+)\\)").matcher(detail);
View Full Code Here

    /**
     * @test java.sql.SQLNonTransientException(Throwable)
     */
    public void test_Constructor_LThrowable() {
        Throwable cause = new Exception("MYTHROWABLE");
        SQLNonTransientException sQLNonTransientException = new SQLNonTransientException(
                cause);
        assertNotNull(sQLNonTransientException);
        assertEquals(
                "The reason of SQLNonTransientException should be equals to cause.toString()",
                "java.lang.Exception: MYTHROWABLE", sQLNonTransientException
                        .getMessage());
        assertNull("The SQLState of SQLNonTransientException should be null",
                sQLNonTransientException.getSQLState());
        assertEquals("The error code of SQLNonTransientException should be 0",
                sQLNonTransientException.getErrorCode(), 0);
        assertEquals(
                "The cause of SQLNonTransientException set and get should be equivalent",
                cause, sQLNonTransientException.getCause());
    }
View Full Code Here

    /**
     * @test java.sql.SQLNonTransientException(Throwable)
     */
    public void test_Constructor_LThrowable_1() {
        SQLNonTransientException sQLNonTransientException = new SQLNonTransientException(
                (Throwable) null);
        assertNotNull(sQLNonTransientException);
        assertNull("The SQLState of SQLNonTransientException should be null",
                sQLNonTransientException.getSQLState());
        assertNull("The reason of SQLNonTransientException should be null",
                sQLNonTransientException.getMessage());
        assertEquals("The error code of SQLNonTransientException should be 0",
                sQLNonTransientException.getErrorCode(), 0);
        assertNull("The cause of SQLNonTransientException should be null",
                sQLNonTransientException.getCause());
    }
View Full Code Here

    /**
     * @test java.sql.SQLNonTransientException(String, Throwable)
     */
    public void test_Constructor_LStringLThrowable() {
        Throwable cause = new Exception("MYTHROWABLE");
        SQLNonTransientException sQLNonTransientException = new SQLNonTransientException(
                "MYTESTSTRING", cause);
        assertNotNull(sQLNonTransientException);
        assertEquals(
                "The reason of SQLNonTransientException set and get should be equivalent",
                "MYTESTSTRING", sQLNonTransientException.getMessage());
        assertNull("The SQLState of SQLNonTransientException should be null",
                sQLNonTransientException.getSQLState());
        assertEquals("The error code of SQLNonTransientException should be 0",
                sQLNonTransientException.getErrorCode(), 0);
        assertEquals(
                "The cause of SQLNonTransientException set and get should be equivalent",
                cause, sQLNonTransientException.getCause());
    }
View Full Code Here

    /**
     * @test java.sql.SQLNonTransientException(String, Throwable)
     */
    public void test_Constructor_LStringLThrowable_1() {
        SQLNonTransientException sQLNonTransientException = new SQLNonTransientException(
                "MYTESTSTRING", (Throwable) null);
        assertNotNull(sQLNonTransientException);
        assertEquals(
                "The reason of SQLNonTransientException set and get should be equivalent",
                "MYTESTSTRING", sQLNonTransientException.getMessage());
        assertNull("The SQLState of SQLNonTransientException should be null",
                sQLNonTransientException.getSQLState());
        assertEquals("The error code of SQLNonTransientException should be 0",
                sQLNonTransientException.getErrorCode(), 0);
        assertNull("The cause of SQLNonTransientException should be null",
                sQLNonTransientException.getCause());
    }
View Full Code Here

    /**
     * @test java.sql.SQLNonTransientException(String, Throwable)
     */
    public void test_Constructor_LStringLThrowable_2() {
        Throwable cause = new Exception("MYTHROWABLE");
        SQLNonTransientException sQLNonTransientException = new SQLNonTransientException(
                null, cause);
        assertNotNull(sQLNonTransientException);
        assertNull("The reason of SQLNonTransientException should be null",
                sQLNonTransientException.getMessage());
        assertNull("The SQLState of SQLNonTransientException should be null",
                sQLNonTransientException.getSQLState());
        assertEquals("The error code of SQLNonTransientException should be 0",
                sQLNonTransientException.getErrorCode(), 0);
    }
View Full Code Here

    /**
     * @test java.sql.SQLNonTransientException(String, Throwable)
     */
    public void test_Constructor_LStringLThrowable_3() {
        SQLNonTransientException sQLNonTransientException = new SQLNonTransientException(
                (String) null, (Throwable) null);
        assertNotNull(sQLNonTransientException);
        assertNull("The SQLState of SQLNonTransientException should be null",
                sQLNonTransientException.getSQLState());
        assertNull("The reason of SQLNonTransientException should be null",
                sQLNonTransientException.getMessage());
        assertEquals("The error code of SQLNonTransientException should be 0",
                sQLNonTransientException.getErrorCode(), 0);
        assertNull("The cause of SQLNonTransientException should be null",
                sQLNonTransientException.getCause());
    }
View Full Code Here

    /**
     * @test java.sql.SQLNonTransientException(String, String, Throwable)
     */
    public void test_Constructor_LStringLStringLThrowable() {
        Throwable cause = new Exception("MYTHROWABLE");
        SQLNonTransientException sQLNonTransientException = new SQLNonTransientException(
                "MYTESTSTRING1", "MYTESTSTRING2", cause);
        assertNotNull(sQLNonTransientException);
        assertEquals(
                "The SQLState of SQLNonTransientException set and get should be equivalent",
                "MYTESTSTRING2", sQLNonTransientException.getSQLState());
        assertEquals(
                "The reason of SQLNonTransientException set and get should be equivalent",
                "MYTESTSTRING1", sQLNonTransientException.getMessage());
        assertEquals("The error code of SQLNonTransientException should be 0",
                sQLNonTransientException.getErrorCode(), 0);
        assertEquals(
                "The cause of SQLNonTransientException set and get should be equivalent",
                cause, sQLNonTransientException.getCause());
    }
View Full Code Here

    /**
     * @test java.sql.SQLNonTransientException(String, String, Throwable)
     */
    public void test_Constructor_LStringLStringLThrowable_1() {
        SQLNonTransientException sQLNonTransientException = new SQLNonTransientException(
                "MYTESTSTRING1", "MYTESTSTRING2", null);
        assertNotNull(sQLNonTransientException);
        assertEquals(
                "The SQLState of SQLNonTransientException set and get should be equivalent",
                "MYTESTSTRING2", sQLNonTransientException.getSQLState());
        assertEquals(
                "The reason of SQLNonTransientException set and get should be equivalent",
                "MYTESTSTRING1", sQLNonTransientException.getMessage());
        assertEquals("The error code of SQLNonTransientException should be 0",
                sQLNonTransientException.getErrorCode(), 0);
        assertNull("The cause of SQLNonTransientException should be null",
                sQLNonTransientException.getCause());
    }
View Full Code Here

TOP

Related Classes of java.sql.SQLNonTransientException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.