Skip to content

Commit

Permalink
polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoeller committed Aug 15, 2010
1 parent 5c3cf5f commit 0aec5ef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* Copyright 2002-2010 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.
Expand Down Expand Up @@ -261,7 +261,7 @@ public SessionFactory getObject() {
}

public Class<? extends SessionFactory> getObjectType() {
return (this.sessionFactory != null) ? this.sessionFactory.getClass() : SessionFactory.class;
return (this.sessionFactory != null ? this.sessionFactory.getClass() : SessionFactory.class);
}

public boolean isSingleton() {
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* Copyright 2002-2010 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.
Expand Down Expand Up @@ -82,8 +82,7 @@
public abstract class AbstractTransactionalJUnit4SpringContextTests extends AbstractJUnit4SpringContextTests {

/**
* The SimpleJdbcTemplate that this base class manages, available to
* subclasses.
* The SimpleJdbcTemplate that this base class manages, available to subclasses.
*/
protected SimpleJdbcTemplate simpleJdbcTemplate;

Expand All @@ -99,9 +98,7 @@ public void setDataSource(DataSource dataSource) {
}

/**
* Specify the encoding for SQL scripts, if different from the platform
* encoding.
*
* Specify the encoding for SQL scripts, if different from the platform encoding.
* @see #executeSqlScript
*/
public void setSqlScriptEncoding(String sqlScriptEncoding) {
Expand All @@ -110,7 +107,6 @@ public void setSqlScriptEncoding(String sqlScriptEncoding) {

/**
* Count the rows in the given table.
*
* @param tableName table name to count rows in
* @return the number of rows in the table
*/
Expand All @@ -121,7 +117,6 @@ protected int countRowsInTable(String tableName) {
/**
* Convenience method for deleting all rows from the specified tables. Use
* with caution outside of a transaction!
*
* @param names the names of the tables from which to delete
* @return the total number of rows deleted from all specified tables
*/
Expand All @@ -131,19 +126,16 @@ protected int deleteFromTables(String... names) {

/**
* Execute the given SQL script. Use with caution outside of a transaction!
* <p>
* The script will normally be loaded by classpath. There should be one
* <p>The script will normally be loaded by classpath. There should be one
* statement per line. Any semicolons will be removed. <b>Do not use this
* method to execute DDL if you expect rollback.</b>
*
* @param sqlResourcePath the Spring resource path for the SQL script
* @param continueOnError whether or not to continue without throwing an
* exception in the event of an error
* @throws DataAccessException if there is an error executing a statement
* and continueOnError was <code>false</code>
*/
protected void executeSqlScript(String sqlResourcePath, boolean continueOnError) throws DataAccessException {

Resource resource = this.applicationContext.getResource(sqlResourcePath);
SimpleJdbcTestUtils.executeSqlScript(this.simpleJdbcTemplate, new EncodedResource(resource,
this.sqlScriptEncoding), continueOnError);
Expand Down

0 comments on commit 0aec5ef

Please sign in to comment.