Change to remove dependence of the page flow actions dialog on JSP pages. Also added a safe delete method to JSFTestUtil.
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.ui.test/src/org/eclipse/jst/jsf/facesconfig/ui/test/FacesConfigEditorTest.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.ui.test/src/org/eclipse/jst/jsf/facesconfig/ui/test/FacesConfigEditorTest.java
index d735891..34ba2ce 100644
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.ui.test/src/org/eclipse/jst/jsf/facesconfig/ui/test/FacesConfigEditorTest.java
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.ui.test/src/org/eclipse/jst/jsf/facesconfig/ui/test/FacesConfigEditorTest.java
@@ -95,8 +95,8 @@
super.tearDown();
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.closeEditor(editor, false);
+ JSFTestUtil.safeDelete(project, 10, 200);
project.delete(IProject.FORCE | IProject.ALWAYS_DELETE_PROJECT_CONTENT,
null);
}
-
}
diff --git a/jsf/tests/org.eclipse.jst.jsf.test.util/src/org/eclipse/jst/jsf/test/util/JSFTestUtil.java b/jsf/tests/org.eclipse.jst.jsf.test.util/src/org/eclipse/jst/jsf/test/util/JSFTestUtil.java
index 9c492e2..d913cd5 100644
--- a/jsf/tests/org.eclipse.jst.jsf.test.util/src/org/eclipse/jst/jsf/test/util/JSFTestUtil.java
+++ b/jsf/tests/org.eclipse.jst.jsf.test.util/src/org/eclipse/jst/jsf/test/util/JSFTestUtil.java
@@ -25,6 +25,8 @@
import junit.framework.Assert;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
@@ -320,6 +322,49 @@
return null;
}
+
+ /**
+ * Attempts to delete resource. If the delete operation throws a
+ * CoreException, the call will sleep the thread for backOffInMs
+ * before trying again. Will try a maximum of 'maxTries' times. If at that
+ * point the resource still exists, an error will be logged and the method
+ * will return.
+ *
+ * @param resource
+ * @param maxTries
+ * @param backInMs
+ * @return true if the delete was successful.
+ */
+ public static boolean safeDelete(final IResource resource, final int maxTries, final int backOffInMs)
+ {
+ boolean success = false;
+
+ DELETE_LOOP: for (int attempt = 0; attempt < maxTries; attempt++)
+ {
+ try
+ {
+ resource.delete(true, null);
+ success = true;
+ break DELETE_LOOP;
+ }
+ catch (CoreException e)
+ {
+ try
+ {
+ Thread.sleep(backOffInMs);
+ }
+ catch (InterruptedException e1)
+ {
+ // do nothing, just continue
+ }
+ }
+ }
+ if (!success)
+ {
+ System.err.println("Could not delete resource: "+resource.getLocation().toOSString());
+ }
+ return success;
+ }
private JSFTestUtil()
{