[hibernate-commits] Hibernate SVN: r20873 - tools/trunk/src/test/org/hibernate/tool/ant.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Fri Dec 3 04:26:07 EST 2010


Author: dgeraskov
Date: 2010-12-03 04:26:07 -0500 (Fri, 03 Dec 2010)
New Revision: 20873

Modified:
   tools/trunk/src/test/org/hibernate/tool/ant/AntHibernateToolTest.java
Log:
https://jira.jboss.org/browse/JBIDE-7730
Removed infinite attempt to delete test-db directory

Modified: tools/trunk/src/test/org/hibernate/tool/ant/AntHibernateToolTest.java
===================================================================
--- tools/trunk/src/test/org/hibernate/tool/ant/AntHibernateToolTest.java	2010-11-29 07:23:24 UTC (rev 20872)
+++ tools/trunk/src/test/org/hibernate/tool/ant/AntHibernateToolTest.java	2010-12-03 09:26:07 UTC (rev 20873)
@@ -34,18 +34,33 @@
 		configureProject("src/testsupport/anttest-build.xml");
 	}
 	
+	/**
+	 * Maximum number of attempts to make a clean.
+	 */
+	private final short ATTEMPT_COUNT = 20;
+	
 	private void cleanup(){
 		executeTarget("afterCfg2hbm");
 		boolean removed = false;
-		do{
+		
+		short attempt = 1;
+		do {
 			try {
 				executeTarget("removeDirs");
 				removed = true;
 			} catch (BuildException be){
+				try {
+					Thread.currentThread().sleep(500);
+				} catch (InterruptedException e) {
+				}
 				//Unable to delete file ...\testdb\hsqldb.log
 				//if isn't removed calls
-				//User SA not fount for all the next tests.
+				//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.");
+			}
 		} while (!removed);
 	}
 



More information about the hibernate-commits mailing list