[hibernate-commits] Hibernate SVN: r11617 - branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ant.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Mon Jun 4 08:54:11 EDT 2007


Author: max.andersen at jboss.com
Date: 2007-06-04 08:54:11 -0400 (Mon, 04 Jun 2007)
New Revision: 11617

Modified:
   branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ant/JavaFormatterTest.java
Log:
workaround for linux that does not flush or update lastModified time as quickly/reliable as windows for the sake of speed. 

Modified: branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ant/JavaFormatterTest.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ant/JavaFormatterTest.java	2007-06-04 12:52:34 UTC (rev 11616)
+++ branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ant/JavaFormatterTest.java	2007-06-04 12:54:11 UTC (rev 11617)
@@ -40,7 +40,9 @@
 		File file = new File(project.getProperty( "build.dir" ), "formatting/SimpleOne.java");
 		assertFileAndExists( file );
 		long before = file.lastModified();	
-				
+		
+		waitASec();
+		
 		JavaFormatter formatter = new JavaFormatter(null);
 		formatter.formatFile( file );
 		
@@ -61,19 +63,26 @@
 		
 		assertTrue( before==file.lastModified() );
 		
+		waitASec();
+		
 		executeTarget("prepare");
+		
+		
 		formatter = new JavaFormatter(null);
+		assertTrue("formatting should pass when using default settings", formatter.formatFile( file ));
+		
+		
+		assertTrue( before<file.lastModified() );
+	}
+
+	private void waitASec() {
 		try {
-			Thread.sleep(10);
+			Thread.sleep(1000);
 		}
 		catch (InterruptedException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		}
-		assertTrue("formatting should pass when using default settings", formatter.formatFile( file ));
-		
-		
-		assertTrue( before<file.lastModified() );
 	}
 	public void testAntxDestDir() {
 		
@@ -81,7 +90,8 @@
 		
 		File file = new File(project.getProperty( "build.dir" ), "formatting/SimpleOne.java");
 		assertFileAndExists( file );
-		long before = file.lastModified();	
+		long before = file.lastModified();
+		waitASec();
 		executeTarget("fileset");
 		System.out.println(getLog());
 		assertTrue( before!=file.lastModified() );
@@ -98,7 +108,7 @@
 		assertFileAndExists( jdkfile );
 		long jdk5before = jdk5file.lastModified();
 		long before = jdkfile.lastModified();	
-		
+		waitASec();
 		executeTarget("configtest");
 		System.out.println(getLog());
 		assertEquals("jdk5 should fail since config is not specifying jdk5",jdk5before, jdk5file.lastModified() );




More information about the hibernate-commits mailing list