diff --git a/org.springframework.jdbc/src/test/java/org/springframework/jdbc/Customer.java b/org.springframework.jdbc/src/test/java/org/springframework/jdbc/Customer.java index 7c804be1d82..e4fedc60ec5 100644 --- a/org.springframework.jdbc/src/test/java/org/springframework/jdbc/Customer.java +++ b/org.springframework.jdbc/src/test/java/org/springframework/jdbc/Customer.java @@ -47,4 +47,4 @@ public class Customer { return "Customer: id=" + id + "; forename=" + forename; } -} +} \ No newline at end of file diff --git a/org.springframework.jdbc/src/test/java/org/springframework/jdbc/core/SimpleRowCountCallbackHandler.java b/org.springframework.jdbc/src/test/java/org/springframework/jdbc/core/SimpleRowCountCallbackHandler.java index ae4d9737026..0589540ca0a 100644 --- a/org.springframework.jdbc/src/test/java/org/springframework/jdbc/core/SimpleRowCountCallbackHandler.java +++ b/org.springframework.jdbc/src/test/java/org/springframework/jdbc/core/SimpleRowCountCallbackHandler.java @@ -39,4 +39,4 @@ public class SimpleRowCountCallbackHandler implements RowCallbackHandler { return count; } -} +} \ No newline at end of file diff --git a/org.springframework.jdbc/src/test/java/org/springframework/jdbc/support/CustomErrorCodeException.java b/org.springframework.jdbc/src/test/java/org/springframework/jdbc/support/CustomErrorCodeException.java new file mode 100644 index 00000000000..3931fe84ce7 --- /dev/null +++ b/org.springframework.jdbc/src/test/java/org/springframework/jdbc/support/CustomErrorCodeException.java @@ -0,0 +1,34 @@ +/* + * Copyright 2002-2005 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.jdbc.support; + +import org.springframework.dao.DataAccessException; + +/** + * @author Thomas Risberg + */ +public class CustomErrorCodeException extends DataAccessException { + + public CustomErrorCodeException(String msg) { + super(msg); + } + + public CustomErrorCodeException(String msg, Throwable ex) { + super(msg, ex); + } + +} \ No newline at end of file diff --git a/org.springframework.testsuite/src/test/java/org/springframework/jdbc/support/DataFieldMaxValueIncrementerTests.java b/org.springframework.jdbc/src/test/java/org/springframework/jdbc/support/DataFieldMaxValueIncrementerTests.java similarity index 100% rename from org.springframework.testsuite/src/test/java/org/springframework/jdbc/support/DataFieldMaxValueIncrementerTests.java rename to org.springframework.jdbc/src/test/java/org/springframework/jdbc/support/DataFieldMaxValueIncrementerTests.java diff --git a/org.springframework.testsuite/src/test/java/org/springframework/jdbc/support/DefaultLobHandlerTests.java b/org.springframework.jdbc/src/test/java/org/springframework/jdbc/support/DefaultLobHandlerTests.java similarity index 100% rename from org.springframework.testsuite/src/test/java/org/springframework/jdbc/support/DefaultLobHandlerTests.java rename to org.springframework.jdbc/src/test/java/org/springframework/jdbc/support/DefaultLobHandlerTests.java diff --git a/org.springframework.testsuite/src/test/java/org/springframework/jdbc/support/JdbcUtilsTests.java b/org.springframework.jdbc/src/test/java/org/springframework/jdbc/support/JdbcUtilsTests.java similarity index 100% rename from org.springframework.testsuite/src/test/java/org/springframework/jdbc/support/JdbcUtilsTests.java rename to org.springframework.jdbc/src/test/java/org/springframework/jdbc/support/JdbcUtilsTests.java diff --git a/org.springframework.testsuite/src/test/java/org/springframework/jdbc/support/KeyHolderTests.java b/org.springframework.jdbc/src/test/java/org/springframework/jdbc/support/KeyHolderTests.java similarity index 100% rename from org.springframework.testsuite/src/test/java/org/springframework/jdbc/support/KeyHolderTests.java rename to org.springframework.jdbc/src/test/java/org/springframework/jdbc/support/KeyHolderTests.java diff --git a/org.springframework.testsuite/src/test/java/org/springframework/jdbc/support/NativeJdbcExtractorTests.java b/org.springframework.jdbc/src/test/java/org/springframework/jdbc/support/NativeJdbcExtractorTests.java similarity index 100% rename from org.springframework.testsuite/src/test/java/org/springframework/jdbc/support/NativeJdbcExtractorTests.java rename to org.springframework.jdbc/src/test/java/org/springframework/jdbc/support/NativeJdbcExtractorTests.java diff --git a/org.springframework.testsuite/src/test/java/org/springframework/jdbc/support/SQLErrorCodeSQLExceptionTranslatorTests.java b/org.springframework.jdbc/src/test/java/org/springframework/jdbc/support/SQLErrorCodeSQLExceptionTranslatorTests.java similarity index 100% rename from org.springframework.testsuite/src/test/java/org/springframework/jdbc/support/SQLErrorCodeSQLExceptionTranslatorTests.java rename to org.springframework.jdbc/src/test/java/org/springframework/jdbc/support/SQLErrorCodeSQLExceptionTranslatorTests.java diff --git a/org.springframework.testsuite/src/test/java/org/springframework/jdbc/support/SQLErrorCodesFactoryTests.java b/org.springframework.jdbc/src/test/java/org/springframework/jdbc/support/SQLErrorCodesFactoryTests.java similarity index 100% rename from org.springframework.testsuite/src/test/java/org/springframework/jdbc/support/SQLErrorCodesFactoryTests.java rename to org.springframework.jdbc/src/test/java/org/springframework/jdbc/support/SQLErrorCodesFactoryTests.java diff --git a/org.springframework.jdbc/src/test/java/org/springframework/jdbc/support/SQLExceptionSubclassFactory.java b/org.springframework.jdbc/src/test/java/org/springframework/jdbc/support/SQLExceptionSubclassFactory.java new file mode 100644 index 00000000000..eec10be906c --- /dev/null +++ b/org.springframework.jdbc/src/test/java/org/springframework/jdbc/support/SQLExceptionSubclassFactory.java @@ -0,0 +1,78 @@ +/* + * Copyright 2002-2008 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.jdbc.support; + +import java.sql.SQLDataException; +import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; +import java.sql.SQLIntegrityConstraintViolationException; +import java.sql.SQLInvalidAuthorizationSpecException; +import java.sql.SQLNonTransientConnectionException; +import java.sql.SQLRecoverableException; +import java.sql.SQLSyntaxErrorException; +import java.sql.SQLTimeoutException; +import java.sql.SQLTransactionRollbackException; +import java.sql.SQLTransientConnectionException; + +/** + * Class to generate Java 6 SQLException subclasses for testing purposes. + * + * @author Thomas Risberg + */ +public class SQLExceptionSubclassFactory { + + public static SQLException newSQLDataException(String reason, String SQLState, int vendorCode) { + return new SQLDataException(reason, SQLState, vendorCode); + } + + public static SQLException newSQLFeatureNotSupportedException(String reason, String SQLState, int vendorCode) { + return new SQLFeatureNotSupportedException(reason, SQLState, vendorCode); + } + + public static SQLException newSQLIntegrityConstraintViolationException(String reason, String SQLState, int vendorCode) { + return new SQLIntegrityConstraintViolationException(reason, SQLState, vendorCode); + } + + public static SQLException newSQLInvalidAuthorizationSpecException(String reason, String SQLState, int vendorCode) { + return new SQLInvalidAuthorizationSpecException(reason, SQLState, vendorCode); + } + + public static SQLException newSQLNonTransientConnectionException(String reason, String SQLState, int vendorCode) { + return new SQLNonTransientConnectionException(reason, SQLState, vendorCode); + } + + public static SQLException newSQLSyntaxErrorException(String reason, String SQLState, int vendorCode) { + return new SQLSyntaxErrorException(reason, SQLState, vendorCode); + } + + public static SQLException newSQLTransactionRollbackException(String reason, String SQLState, int vendorCode) { + return new SQLTransactionRollbackException(reason, SQLState, vendorCode); + } + + public static SQLException newSQLTransientConnectionException(String reason, String SQLState, int vendorCode) { + return new SQLTransientConnectionException(reason, SQLState, vendorCode); + } + + public static SQLException newSQLTimeoutException(String reason, String SQLState, int vendorCode) { + return new SQLTimeoutException(reason, SQLState, vendorCode); + } + + public static SQLException newSQLRecoverableException(String reason, String SQLState, int vendorCode) { + return new SQLRecoverableException(reason, SQLState, vendorCode); + } + +} \ No newline at end of file diff --git a/org.springframework.testsuite/src/test/java/org/springframework/jdbc/support/SQLExceptionSubclassTranslatorTests.java b/org.springframework.jdbc/src/test/java/org/springframework/jdbc/support/SQLExceptionSubclassTranslatorTests.java similarity index 100% rename from org.springframework.testsuite/src/test/java/org/springframework/jdbc/support/SQLExceptionSubclassTranslatorTests.java rename to org.springframework.jdbc/src/test/java/org/springframework/jdbc/support/SQLExceptionSubclassTranslatorTests.java diff --git a/org.springframework.testsuite/src/test/java/org/springframework/jdbc/support/SQLStateExceptionTranslatorTests.java b/org.springframework.jdbc/src/test/java/org/springframework/jdbc/support/SQLStateExceptionTranslatorTests.java similarity index 100% rename from org.springframework.testsuite/src/test/java/org/springframework/jdbc/support/SQLStateExceptionTranslatorTests.java rename to org.springframework.jdbc/src/test/java/org/springframework/jdbc/support/SQLStateExceptionTranslatorTests.java diff --git a/org.springframework.testsuite/src/test/java/org/springframework/jdbc/support/rowset/ResultSetWrappingRowSetTests.java b/org.springframework.jdbc/src/test/java/org/springframework/jdbc/support/rowset/ResultSetWrappingRowSetTests.java similarity index 100% rename from org.springframework.testsuite/src/test/java/org/springframework/jdbc/support/rowset/ResultSetWrappingRowSetTests.java rename to org.springframework.jdbc/src/test/java/org/springframework/jdbc/support/rowset/ResultSetWrappingRowSetTests.java diff --git a/org.springframework.jdbc/src/test/resources/org/springframework/jdbc/support/custom-error-codes.xml b/org.springframework.jdbc/src/test/resources/org/springframework/jdbc/support/custom-error-codes.xml new file mode 100644 index 00000000000..a2aa1898320 --- /dev/null +++ b/org.springframework.jdbc/src/test/resources/org/springframework/jdbc/support/custom-error-codes.xml @@ -0,0 +1,24 @@ + + + + + + + + 1,2 + 1,1400,1722 + + + + 999 + + org.springframework.jdbc.support.CustomErrorCodeException + + + + + + + diff --git a/org.springframework.jdbc/src/test/resources/org/springframework/jdbc/support/test-error-codes.xml b/org.springframework.jdbc/src/test/resources/org/springframework/jdbc/support/test-error-codes.xml new file mode 100644 index 00000000000..dd3fc33004b --- /dev/null +++ b/org.springframework.jdbc/src/test/resources/org/springframework/jdbc/support/test-error-codes.xml @@ -0,0 +1,14 @@ + + + + + + + + 1,2 + 1,1400,1722 + + + diff --git a/org.springframework.jdbc/src/test/resources/org/springframework/jdbc/support/wildcard-error-codes.xml b/org.springframework.jdbc/src/test/resources/org/springframework/jdbc/support/wildcard-error-codes.xml new file mode 100644 index 00000000000..b44c0a9c1b8 --- /dev/null +++ b/org.springframework.jdbc/src/test/resources/org/springframework/jdbc/support/wildcard-error-codes.xml @@ -0,0 +1,38 @@ + + + + + + + + 1,2,942 + 1,1400,1722 + + + + *DB0 + -204,1,2 + 3,4 + + + + DB1* + -204,1,2 + 3,4 + + + + *DB2* + -204,1,2 + 3,4 + + + + *DB3* + -204,1,2 + 3,4 + + +