Permalink
Browse files

HBX-1178 Cleanup pom-xml

log4j/hibernate properties is now properly filtered and used instead
of encoded in 100 lines of xml in pom.xml
System.out's been removed.
Added more rigid exceptions when test fails to cleanup.
Make delete sql continue to delete even after errors.
  • Loading branch information...
maxandersen committed Mar 15, 2011
1 parent 82fde8e commit 9e32dc52329274b3ce48e3a4caee4277370aa06f
View
460 pom.xml

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -53,30 +53,6 @@ protected Throwable handleSQLException(SQLException e) {
}
}
-
- private void dumpHeader(ResultSet columnRs) throws SQLException {
- ResultSetMetaData md2 = columnRs.getMetaData();
-
- int columnCount = md2.getColumnCount();
- for (int i = 1; i <= columnCount; i++) {
- System.out.print(md2.getColumnName(i) + "|");
- }
- System.out.println();
- }
-
- private void dumpRow(ResultSet columnRs) throws SQLException {
- ResultSetMetaData md2 = columnRs.getMetaData();
-
- int columnCount = md2.getColumnCount();
- for (int i = 1; i <= columnCount; i++) {
- System.out.print(columnRs.getObject(i) + "|");
- }
- System.out.println();
- }
-
-
-
-
public Iterator getIndexInfo(final String xcatalog, final String xschema, final String xtable) {
try {
final String catalog = caseForSearch( xcatalog );
@@ -105,7 +105,8 @@ public BaseTestCase(String name, String out) {
}
protected void setUp() throws Exception {
- super.setUp();
+ assertNoTables();
+
if(getOutputDir()!=null) {
getOutputDir().mkdirs();
}
@@ -120,7 +121,9 @@ protected void tearDown() throws Exception {
}
protected void cleanupOutputDir() {
- if (getOutputDir()!=null) TestHelper.deleteDir(getOutputDir());
+ if (getOutputDir()!=null) {
+ TestHelper.deleteDir(getOutputDir());
+ }
}
@@ -144,7 +144,7 @@ protected void setUp() throws Exception {
}
protected void tearDown() throws Exception {
- executeDDL(getDropSQL(), false);
+ executeDDL(getDropSQL(), true);
super.tearDown();
}
@@ -9,6 +9,8 @@
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.tools.ant.BuildException;
import org.hibernate.tool.test.TestHelper;
@@ -18,6 +20,9 @@
*/
public class AntHibernateToolTest extends BuildFileTestCase {
+
+ private static final Log log = LogFactory.getLog(AntHibernateToolTest.class);
+
private String property;
public AntHibernateToolTest(String name) {
@@ -46,6 +51,7 @@ private void cleanup(){
short attempt = 1;
do {
try {
+ log.debug("Attempt " + attempt + " for calling 'remmoveDirs'");
executeTarget("removeDirs");
removed = true;
} catch (BuildException be){
@@ -58,6 +64,7 @@ private void cleanup(){
//User SA not found for all the next tests.
}
attempt++;
+
if (attempt > ATTEMPT_COUNT && !removed){
fail("Could not complete cleanup. Next tests behaviour is unpredictable.");
}
@@ -120,7 +120,6 @@ public void testInheritedProperties()
private void testHtml(final Tidy tidy, File dir) {
try {
- System.out.println("*****Parsing " + dir);
tidy.parse( new FileInputStream(dir), (OutputStream)null );
assertEquals(dir + "has errors ", 0, tidy.getParseErrors());
assertEquals(dir + "has warnings ", 0, tidy.getParseWarnings());
@@ -41,8 +41,6 @@ public void testValidateCache() {
List result = analyzer.getResults();
assertEquals(1,result.size());
-
- System.out.println(result);
}
@@ -60,7 +58,6 @@ public void testValidateIdentifier() {
assertEquals(1,result.size());
- System.out.println(result);
}
@@ -78,7 +75,6 @@ public void testBytecodeRestrictions() {
assertEquals(2,result.size());
- System.out.println(result);
}
@@ -20,7 +20,10 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.eclipse.jdt.internal.compiler.batch.Main;
+import org.hibernate.cfg.reveng.JDBCReader;
import org.hibernate.util.StringHelper;
import org.xml.sax.SAXException;
@@ -30,6 +33,8 @@
*/
public final class TestHelper {
+ private static final Log log = LogFactory.getLog(TestHelper.class);
+
private TestHelper() {
// noop
}
@@ -160,15 +165,17 @@ public static boolean deleteDir(File dir) {
if ( dir.isDirectory() ) {
String[] children = dir.list();
for (int i = 0; i < children.length; i++) {
- boolean success = deleteDir( new File( dir, children[i] ) );
+ File childFile = new File( dir, children[i] );
+ boolean success = deleteDir( childFile );
if ( !success ) {
- return false;
+ throw new RuntimeException("Could not delete " + childFile);
+ //return false;
}
}
}
// The directory is now empty so delete it
- System.out.println("deleting: " + dir);
+ log.debug("deleting: " + dir);
return dir.delete();
}
@@ -33,12 +33,12 @@ hibernate.query.substitutions true 1, false 0, yes 'Y', no 'N'
## HypersonicSQL
-hibernate.dialect org.hibernate.dialect.HSQLDialect
-hibernate.connection.driver_class org.hsqldb.jdbcDriver
-hibernate.connection.username sa
-hibernate.connection.password
+hibernate.dialect @db.dialect@
+hibernate.connection.driver_class @jdbc.driver@
+hibernate.connection.username @jdbc.user@
+hibernate.connection.password @jdbc.pass@
#hibernate.connection.url jdbc:hsqldb:hsql://localhost
-hibernate.connection.url jdbc:hsqldb:testdb/hsqldb;shutdown=true
+hibernate.connection.url @jdbc.url@
#hibernate.connection.url jdbc:hsqldb:.
#hibernate.connection.shutdown=true
@@ -19,6 +19,8 @@ log4j.logger.org.hibernate.cfg.SettingsFactory=warn
log4j.logger.org.hibernate.cfg.reveng=debug
log4j.logger.org.hibernate.cfg.JDBCMetaDataConfiguration=debug
log4j.logger.org.hibernate.cfg.JDBCBinder=debug
+log4j.logger.org.hibernate.tool.BaseTestCase=debug
+log4j.logger.org.hibernate.tool=debug
#log4j.logger.freemarker=debug
### log just the SQL
@@ -27,7 +27,7 @@
<path location="${testlibs.dir}/javaassist.jar" />
<path location="${test-classes}" />
<path location="${target.dir}/classes" />
- <path location="./etc" />
+ <path location="${target.dir}/test-classes" />
<path location="${jdbc.lib}" />
</path>

0 comments on commit 9e32dc5

Please sign in to comment.