Package org.apache.rave.persistence.impl

Examples of org.apache.rave.persistence.impl.TranslatedH2Exception


    @Test
    public void testTranslateExceptionIfPossible_unknownJdbcSQLExceptionError() {                
        JdbcSQLException jdbcEx = new JdbcSQLException("message", "sql statement", "state", ErrorCode.CANNOT_DROP_CURRENT_USER, null, "stacktrace");
        RuntimeException re = new RuntimeException("dummy runtime exception", jdbcEx);    
       
        TranslatedH2Exception translatedException = (TranslatedH2Exception) dialect.translateExceptionIfPossible(re);            
        assertThat(translatedException.getErrorCode(), is(ErrorCode.CANNOT_DROP_CURRENT_USER));       
    }
View Full Code Here


   
    @Test
    public void testTranslateExceptionIfPossible_unknownRuntimeError() {                        
        RuntimeException re = new RuntimeException("dummy runtime exception", new NullPointerException("bad"));    
       
        TranslatedH2Exception translatedException = (TranslatedH2Exception) dialect.translateExceptionIfPossible(re);            
        assertThat(translatedException.getErrorCode(), is(TranslatedH2Exception.UNKNOWN_ERROR_CODE));       
    }   
View Full Code Here

                    e = new DuplicateItemException("DUPLICATE_ITEM", rootException);
                    break;
                }

                default: {
                    e = new TranslatedH2Exception(rootException.getErrorCode(), "ERROR", "Unknown Database Error");
                    break;
                }
            }
        } else {           
            // we got a RuntimeException that wasn't an org.h2.jdbc.JdbcSQLException
            e = new TranslatedH2Exception(TranslatedH2Exception.UNKNOWN_ERROR_CODE, "ERROR", "Unknown Runtime Exception");
        }
       
        return e;               
    }   
View Full Code Here

                    e = new DuplicateItemException("DUPLICATE_ITEM", rootException);
                    break;
                }

                default: {
                    e = new TranslatedH2Exception(rootException.getErrorCode(), "ERROR", "Unknown Database Error");
                    break;
                }
            }
        } else {           
            // we got a RuntimeException that wasn't an org.h2.jdbc.JdbcSQLException
            e = new TranslatedH2Exception(TranslatedH2Exception.UNKNOWN_ERROR_CODE, "ERROR", "Unknown Runtime Exception");
        }
       
        return e;               
    }   
View Full Code Here

    @Test
    public void testTranslateExceptionIfPossible_unknownJdbcSQLExceptionError() {                
        JdbcSQLException jdbcEx = new JdbcSQLException("message", "sql statement", "state", ErrorCode.CANNOT_DROP_CURRENT_USER, null, "stacktrace");
        RuntimeException re = new RuntimeException("dummy runtime exception", jdbcEx);    
       
        TranslatedH2Exception translatedException = (TranslatedH2Exception) dialect.translateExceptionIfPossible(re);            
        assertThat(translatedException.getErrorCode(), is(ErrorCode.CANNOT_DROP_CURRENT_USER));       
    }
View Full Code Here

   
    @Test
    public void testTranslateExceptionIfPossible_unknownRuntimeError() {                        
        RuntimeException re = new RuntimeException("dummy runtime exception", new NullPointerException("bad"));    
       
        TranslatedH2Exception translatedException = (TranslatedH2Exception) dialect.translateExceptionIfPossible(re);            
        assertThat(translatedException.getErrorCode(), is(TranslatedH2Exception.UNKNOWN_ERROR_CODE));       
    }   
View Full Code Here

TOP

Related Classes of org.apache.rave.persistence.impl.TranslatedH2Exception

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.