Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 295619 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java (-3 / +13 lines)
Lines 2818-2830 Link Here
2818
		return result;
2818
		return result;
2819
	}
2819
	}
2820
	protected void touch(File f) {
2820
	protected void touch(File f) {
2821
		int time = 1000;
2821
		final int time = 1000;
2822
		long lastModified = f.lastModified();
2822
		long lastModified = f.lastModified();
2823
		f.setLastModified(lastModified + time);
2823
		f.setLastModified(lastModified + time);
2824
		org.eclipse.jdt.core.tests.util.Util.waitAtLeast(time);
2824
		org.eclipse.jdt.core.tests.util.Util.waitAtLeast(time);
2825
		// Assertion to track the reason of unexpected failures with tests on external resources
2825
		// Loop until the last modified time has really changed on the file
2826
		// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=295619
2826
		// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=295619
2827
		assertEquals("The file "+f.getAbsolutePath()+" was not touched!", lastModified+time, f.lastModified());
2827
		int n = 1;
2828
		while (n < 10) { // retry 9 times more if necessary
2829
			if (f.lastModified() != lastModified) {
2830
				// We can leave the loop as the file has been really touched
2831
				return;
2832
			}
2833
			f.setLastModified(lastModified + n*time);
2834
			org.eclipse.jdt.core.tests.util.Util.waitAtLeast(time);
2835
			n++;
2836
		}
2837
		assertFalse("The file "+f.getAbsolutePath()+" was not touched!", lastModified == f.lastModified());
2828
	}
2838
	}
2829
2839
2830
	protected String toString(String[] strings) {
2840
	protected String toString(String[] strings) {

Return to bug 295619