Author: snjeza
Date: 2008-10-17 18:40:46 -0400 (Fri, 17 Oct 2008)
New Revision: 10946
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HQLQueryValidatorTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HibernateErrorsTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HibernateErrorsTest2.java
Log:
Checking the hibernate tests.
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HQLQueryValidatorTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HQLQueryValidatorTest.java 2008-10-17
20:14:28 UTC (rev 10945)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HQLQueryValidatorTest.java 2008-10-17
22:40:46 UTC (rev 10946)
@@ -127,6 +127,7 @@
protected void tearDown() throws Exception {
ccfg.reset();
super.tearDown();
+ waitForJobs();
}
public void testHQLDetector() throws JavaModelException {
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HibernateErrorsTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HibernateErrorsTest.java 2008-10-17
20:14:28 UTC (rev 10945)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HibernateErrorsTest.java 2008-10-17
22:40:46 UTC (rev 10946)
@@ -173,9 +173,9 @@
private void deleteFile(File file) {
try {
if (!file.delete())
- throw new RuntimeException("Cannot remove the " + file.getAbsolutePath() +
" file. (" + Platform.getOS() + ")");
+ throw new RuntimeException("Cannot remove the " + file.getAbsolutePath() +
" file.");
} catch (Throwable e) {
- throw new RuntimeException("Cannot remove the " + file.getAbsolutePath() +
" file. (" + Platform.getOS() + ")",e);
+ throw new RuntimeException("Cannot remove the " + file.getAbsolutePath() +
" file.",e);
}
}
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HibernateErrorsTest2.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HibernateErrorsTest2.java 2008-10-17
20:14:28 UTC (rev 10945)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/HibernateErrorsTest2.java 2008-10-17
22:40:46 UTC (rev 10946)
@@ -5,10 +5,12 @@
import java.io.File;
import java.io.IOException;
+import org.eclipse.core.internal.resources.ResourceException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
@@ -153,8 +155,16 @@
IProject proj = getProject().getIProject();
String projRoot = proj.getLocation().toFile().getAbsolutePath();
File file = new File(projRoot);
-
- getProject().getIProject().delete(false, true, null);
+ boolean deleted = true;
+ int nTrys = 0;
+ while (!deleted && nTrys++ < 5)
+ try {
+ proj.delete(true, true, null);
+ deleted = true;
+ } catch (ResourceException re) {
+ waitForJobs();
+ Thread.sleep(100);
+ }
waitForJobs();
delete(file);
}
@@ -179,12 +189,25 @@
private void deleteFile(File file) {
try {
- if (!file.delete())
- throw new RuntimeException("Cannot remove the " + file.getAbsolutePath() +
" file. (" + Platform.getOS() + ")");
+ if (!file.delete()) {
+ throw new RuntimeException(getMessage(file));
+ }
} catch (Throwable e) {
- throw new RuntimeException("Cannot remove the " + file.getAbsolutePath() +
" file. (" + Platform.getOS() + ")",e);
+ throw new RuntimeException(getMessage(file),e);
}
}
+
+ private String getMessage(File file) {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("Cannot remove the ");
+ buffer.append(file.getAbsolutePath());
+ buffer.append(" file. ");
+ if (file.exists() && file.isDirectory()) {
+ buffer.append("List=");
+ buffer.append(file.list());
+ }
+ return buffer.toString();
+ }
protected SimpleTestProject getProject() {
return this.project;