Author: dgolovin
Date: 2008-10-01 13:11:06 -0400 (Wed, 01 Oct 2008)
New Revision: 10608
Added:
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/JobUtils.java
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java
trunk/tests/features/org.jboss.tools.test.feature/feature.xml
trunk/ws/tests/org.jboss.tools.ws.core.test/META-INF/MANIFEST.MF
trunk/ws/tests/org.jboss.tools.ws.core.test/build.properties
trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/AbstractJBossWSCommandTest.java
Log:
ws tests included in build.
ws dearDown() changed to avoid hanging during removing test projects from workspace:
disabling Auto Build and waiting for background activities is ended after removing the
project.
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java 2008-10-01
16:19:23 UTC (rev 10607)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java 2008-10-01
17:11:06 UTC (rev 10608)
@@ -27,6 +27,7 @@
import org.jboss.tools.seam.core.project.facet.SeamVersion;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import
org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDataModelProvider;
+import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ResourcesUtils;
import org.jboss.tools.test.util.xpl.EditorTestHelper;
@@ -107,15 +108,12 @@
try {
oldAutoBuilding = ResourcesUtils.setBuildAutomatically(false);
ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE,
null);
- waitForIdle();
+ JobUtils.waitForIdle();
for (IResource r : this.resourcesToCleanup) {
try {
- //System.out.println("Deleting " + r);
- //r.getProject().close(null);
r.delete(true, null);
- waitForIdle();
+ JobUtils.waitForIdle();
} catch(Exception e) {
- System.out.println("Error deleting " + r);
e.printStackTrace();
last = e;
}
@@ -131,19 +129,6 @@
if(last!=null) throw last;
}
- public static void waitForIdle() {
- long start = System.currentTimeMillis();
- // Job.getJobManager().isIdle() is more efficient than EditorTestHelper.allJobsQuiet()
- // EditorTestHelper.allJobsQuiet() isn't thread-safe
- //
https://bugs.eclipse.org/bugs/show_bug.cgi?id=198241 is fixed
- //while (!EditorTestHelper.allJobsQuiet()) {
- while (!Job.getJobManager().isIdle()) {
- delay(500);
- if ( (System.currentTimeMillis()-start) > MAX_IDLE )
- throw new RuntimeException("A long running task detected"); //$NON-NLS-1$
- }
- }
-
protected final void addResourceToCleanup(final IResource resource) {
this.resourcesToCleanup.add(resource);
}
@@ -270,24 +255,4 @@
}
- public static void delay(long waitTimeMillis) {
- Display display = Display.getCurrent();
- if (display != null) {
- long endTimeMillis = System.currentTimeMillis() + waitTimeMillis;
- while (System.currentTimeMillis() < endTimeMillis) {
- if (!display.readAndDispatch())
- display.sleep();
- }
- display.update();
- }
- // Otherwise, perform a simple sleep.
- else {
- try {
- Thread.sleep(waitTimeMillis);
- } catch (InterruptedException e) {
- // Ignored.
- }
- }
- }
-
}
\ No newline at end of file
Modified: trunk/tests/features/org.jboss.tools.test.feature/feature.xml
===================================================================
--- trunk/tests/features/org.jboss.tools.test.feature/feature.xml 2008-10-01 16:19:23 UTC
(rev 10607)
+++ trunk/tests/features/org.jboss.tools.test.feature/feature.xml 2008-10-01 17:11:06 UTC
(rev 10608)
@@ -381,4 +381,17 @@
install-size="0"
version="0.0.0"/>
+ <plugin
+ id="org.jboss.tools.ws.core.test"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+ <plugin
+ id="org.jboss.tools.ws.ui.test"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
</feature>
Added: trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/JobUtils.java
===================================================================
--- trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/JobUtils.java
(rev 0)
+++
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/JobUtils.java 2008-10-01
17:11:06 UTC (rev 10608)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.test.util;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @author eskimo
+ *
+ */
+public class JobUtils {
+
+ private static final long MAX_IDLE = 30*60*1000L;
+
+ public static void waitForIdle() {
+ long start = System.currentTimeMillis();
+ // Job.getJobManager().isIdle() is more efficient than EditorTestHelper.allJobsQuiet()
+ // EditorTestHelper.allJobsQuiet() isn't thread-safe
+ //
https://bugs.eclipse.org/bugs/show_bug.cgi?id=198241 is fixed
+ //while (!EditorTestHelper.allJobsQuiet()) {
+ while (!Job.getJobManager().isIdle()) {
+ delay(500);
+ if ( (System.currentTimeMillis()-start) > MAX_IDLE )
+ throw new RuntimeException("A long running task detected"); //$NON-NLS-1$
+ }
+ }
+
+ public static void delay(long waitTimeMillis) {
+ Display display = Display.getCurrent();
+ if (display != null) {
+ long endTimeMillis = System.currentTimeMillis() + waitTimeMillis;
+ while (System.currentTimeMillis() < endTimeMillis) {
+ if (!display.readAndDispatch())
+ display.sleep();
+ }
+ display.update();
+ }
+ // Otherwise, perform a simple sleep.
+ else {
+ try {
+ Thread.sleep(waitTimeMillis);
+ } catch (InterruptedException e) {
+ // Ignored.
+ }
+ }
+ }
+}
Property changes on:
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/JobUtils.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/ws/tests/org.jboss.tools.ws.core.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.core.test/META-INF/MANIFEST.MF 2008-10-01 16:19:23
UTC (rev 10607)
+++ trunk/ws/tests/org.jboss.tools.ws.core.test/META-INF/MANIFEST.MF 2008-10-01 17:11:06
UTC (rev 10608)
@@ -1,6 +1,6 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: Test Plug-in
+Bundle-Name: WS Test Plug-in
Bundle-SymbolicName: org.jboss.tools.ws.core.test
Bundle-Version: 1.0.0
Bundle-Activator: org.jboss.tools.ws.core.test.Activator
@@ -31,3 +31,7 @@
org.eclipse.ui.console;bundle-version="3.3.0",
org.eclipse.jface.text;bundle-version="3.4.0"
Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: ws-core-test.jar
+Export-Package: org.jboss.tools.ws.core.test,
+ org.jboss.tools.ws.core.test.classpath,
+ org.jboss.tools.ws.core.test.command
Modified: trunk/ws/tests/org.jboss.tools.ws.core.test/build.properties
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.core.test/build.properties 2008-10-01 16:19:23 UTC
(rev 10607)
+++ trunk/ws/tests/org.jboss.tools.ws.core.test/build.properties 2008-10-01 17:11:06 UTC
(rev 10608)
@@ -1,4 +1,6 @@
-source.. = src/
-output.. = bin/
+source.ws-core-test.jar = src/
+output.ws-core-test.jar = bin/
bin.includes = META-INF/,\
- .
+ ws-core-test.jar,\
+ projects/
+source.ws-core-test.jar = src/
Modified:
trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/AbstractJBossWSCommandTest.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/AbstractJBossWSCommandTest.java 2008-10-01
16:19:23 UTC (rev 10607)
+++
trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/AbstractJBossWSCommandTest.java 2008-10-01
17:11:06 UTC (rev 10608)
@@ -58,6 +58,8 @@
import org.jboss.ide.eclipse.as.core.server.internal.JBossServerBehavior;
import org.jboss.tools.common.test.util.TestProjectProvider;
import org.jboss.tools.test.util.JUnitUtils;
+import org.jboss.tools.test.util.JobUtils;
+import org.jboss.tools.test.util.ResourcesUtils;
import org.jboss.tools.test.util.xpl.EditorTestHelper;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
@@ -69,8 +71,9 @@
protected static final int DEFAULT_SHUTDOWN_TIME = 90000;
protected static final String JBOSSWS_HOME_DEFAULT =
"D:/softinstall/jboss-4.2.2.GA/jboss-4.2.2.GA";
+ public static final String JBOSSWS_42_HOME="jbosstools.test.jboss.home.4.2";
public static final String JBOSS_RUNTIME_42 =
"org.jboss.ide.eclipse.as.runtime.42";
- public static final String JBOSS_AS_42_HOME = System.getProperty(JBOSS_RUNTIME_42,
JBOSSWS_HOME_DEFAULT);
+ public static final String JBOSS_AS_42_HOME = System.getProperty(JBOSSWS_42_HOME,
JBOSSWS_HOME_DEFAULT);
public static final String JBOSS_SERVER_42 = "org.jboss.ide.eclipse.as.42";
protected final Set<IResource> resourcesToCleanup = new
HashSet<IResource>();
@@ -126,20 +129,27 @@
undeployWebProject();
- EditorTestHelper.joinBackgroundActivities();
- EditorTestHelper.runEventQueue(3000);
- Exception last = null;
- for (IResource r : this.resourcesToCleanup) {
- try {
- System.out.println("Deleting " + r);
- r.delete(true, null);
- } catch(Exception e) {
- System.out.println("Error deleting " + r);
- e.printStackTrace();
- last = e;
+ boolean oldAutoBuilding = ResourcesUtils.setBuildAutomatically(false);
+ Exception last = null;
+
+ try {
+ JobUtils.waitForIdle();
+
+ for (IResource r : this.resourcesToCleanup) {
+ try {
+ System.out.println("Deleting " + r);
+ r.delete(true, null);
+ JobUtils.waitForIdle();
+ } catch(Exception e) {
+ System.out.println("Error deleting " + r);
+ e.printStackTrace();
+ last = e;
+ }
}
- }
-
+ } finally {
+ ResourcesUtils.setBuildAutomatically(oldAutoBuilding);
+ }
+
if(last!=null) throw last;
resourcesToCleanup.clear();
@@ -259,9 +269,9 @@
protected File getJBossWSHomeFolder() {
- String jbosshome = System.getProperty(JBOSS_RUNTIME_42, JBOSSWS_HOME_DEFAULT);
+ String jbosshome = System.getProperty(JBOSSWS_42_HOME, JBOSSWS_HOME_DEFAULT);
File runtimelocation = new File(jbosshome);
- assertTrue("Please set JBoss EAP Home in system property:" +
JBOSS_RUNTIME_42, runtimelocation.exists());
+ assertTrue("Please set JBoss EAP Home in system property:" + JBOSSWS_42_HOME,
runtimelocation.exists());
String cmdFileLocation = jbosshome + File.separator + "bin" + File.separator
+ "wsconsume.sh";
assertTrue(jbosshome + " is not a valid jboss EAP home", new
File(cmdFileLocation).exists());