Author: akazakov
Date: 2011-08-10 21:53:46 -0400 (Wed, 10 Aug 2011)
New Revision: 33799
Added:
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/KBProjectTestSetup.java
Modified:
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/META-INF/MANIFEST.MF
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/JstWebKbAllTests.java
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/validation/BuilderOrderMarkerResolutionTest.java
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/validation/KBValidationTest.java
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/test/util/ProjectImportTestSetup.java
Log:
https://issues.jboss.org/browse/JBIDE-9505
Modified: trunk/jst/tests/org.jboss.tools.jst.web.kb.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.kb.test/META-INF/MANIFEST.MF 2011-08-11
01:33:20 UTC (rev 33798)
+++ trunk/jst/tests/org.jboss.tools.jst.web.kb.test/META-INF/MANIFEST.MF 2011-08-11
01:53:46 UTC (rev 33799)
@@ -16,7 +16,8 @@
org.jboss.tools.common,
org.eclipse.jst.standard.schemas,
org.eclipse.wst.validation,
- org.eclipse.ui.ide
+ org.eclipse.ui.ide,
+ org.jboss.tools.jst.jsp.test
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: %Bundle-Vendor.0
Modified:
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/JstWebKbAllTests.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/JstWebKbAllTests.java 2011-08-11
01:33:20 UTC (rev 33798)
+++
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/JstWebKbAllTests.java 2011-08-11
01:53:46 UTC (rev 33799)
@@ -48,7 +48,7 @@
suiteAll.addTestSuite(KBValidationTest.class);
suite = new TestSuite(BuilderOrderMarkerResolutionTest.class.getName());
suite.addTestSuite(BuilderOrderMarkerResolutionTest.class);
- testSetup = new XProjectImportTestSetUp(suite,
+ testSetup = new KBProjectTestSetup(suite,
"org.jboss.tools.jst.web.kb.test",
new String[]{"projects/TestBrokenBuilderOrder"},
new String[]{"TestBrokenBuilderOrder"});
Added:
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/KBProjectTestSetup.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/KBProjectTestSetup.java
(rev 0)
+++
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/KBProjectTestSetup.java 2011-08-11
01:53:46 UTC (rev 33799)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.jst.web.kb.test;
+
+import junit.framework.Test;
+
+import org.eclipse.core.resources.IProject;
+import org.jboss.tools.common.model.util.test.XProjectImportTestSetUp;
+import org.jboss.tools.jst.jsp.test.TestUtil;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class KBProjectTestSetup extends XProjectImportTestSetUp {
+
+ public KBProjectTestSetup(Test test, String bundleName, String projectPath, String
projectName) {
+ super(test,bundleName, projectPath, projectName);
+ }
+
+ public KBProjectTestSetup(Test test, String bundleName, String[] projectPaths, String[]
projectNames) {
+ super(test, bundleName, projectPaths, projectNames);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.common.model.util.test.XProjectImportTestSetUp#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ for (IProject project : projects) {
+ TestUtil._waitForValidation(project);
+ }
+ }
+}
\ No newline at end of file
Property changes on:
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/KBProjectTestSetup.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/validation/BuilderOrderMarkerResolutionTest.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/validation/BuilderOrderMarkerResolutionTest.java 2011-08-11
01:33:20 UTC (rev 33798)
+++
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/validation/BuilderOrderMarkerResolutionTest.java 2011-08-11
01:53:46 UTC (rev 33799)
@@ -16,13 +16,12 @@
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.ide.IDE;
import org.jboss.tools.common.preferences.SeverityPreferences;
+import org.jboss.tools.jst.jsp.test.TestUtil;
import org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager;
import org.jboss.tools.jst.web.kb.preferences.ELSeverityPreferences;
import org.jboss.tools.test.util.JobUtils;
@@ -47,7 +46,7 @@
IMarkerResolution resolution = resolutions[j];
if (resolution.getClass().getName().equals(resolutionClassName)) {
resolution.run(marker);
- JobUtils.waitForIdle();
+ TestUtil._waitForValidation(project);
IMarker[] newMarkers = project.findMarkers(markerType,
true, IResource.DEPTH_INFINITE);
assertTrue("Marker resolution did not decrease number of problems. was:
"+markers.length+" now: "+newMarkers.length, newMarkers.length <
markers.length);
return;
@@ -88,9 +87,7 @@
void modifyPreference(String value) throws CoreException {
EclipsePreferences ps =
(EclipsePreferences)ELSeverityPreferences.getInstance().getProjectPreferences(project);
ps.put(ELSeverityPreferences.WRONG_BUILDER_ORDER_PREFERENCE_NAME, value);
- JobUtils.waitForIdle();
- project.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
- JobUtils.waitForIdle();
+ TestUtil._waitForValidation(project);
}
public void testBuilderOrderResolution() throws CoreException {
@@ -98,5 +95,4 @@
ValidatorManager.ORDER_PROBLEM_MARKER_TYPE,
"org.jboss.tools.jst.web.kb.internal.validation.BuilderOrderResolution");
}
-
-}
+}
\ No newline at end of file
Modified:
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/validation/KBValidationTest.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/validation/KBValidationTest.java 2011-08-11
01:33:20 UTC (rev 33798)
+++
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/validation/KBValidationTest.java 2011-08-11
01:53:46 UTC (rev 33799)
@@ -9,11 +9,11 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
+import org.jboss.tools.jst.jsp.test.TestUtil;
import org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper;
import org.jboss.tools.jst.web.kb.internal.validation.ValidationResourceRegister;
import org.jboss.tools.jst.web.kb.validation.IValidatingProjectTree;
@@ -38,8 +38,7 @@
if(project==null || !project.exists()) {
project = ResourcesUtils.importProject(b, PROJECT_PATH);
}
- project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
- JobUtils.waitForIdle();
+ TestUtil._waitForValidation(project);
return project;
}
Modified:
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/test/util/ProjectImportTestSetup.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/test/util/ProjectImportTestSetup.java 2011-08-11
01:33:20 UTC (rev 33798)
+++
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/test/util/ProjectImportTestSetup.java 2011-08-11
01:53:46 UTC (rev 33799)
@@ -25,8 +25,9 @@
public class ProjectImportTestSetup extends TestSetup {
private String bundleName;
- private String[] projectPaths;
- private String[] projectNames;
+ protected String[] projectPaths;
+ protected String[] projectNames;
+ protected IProject[] projects;
/**
* @param test
@@ -50,14 +51,14 @@
}
public IProject[] importProjects() throws Exception {
- IProject[] projects = new IProject[projectPaths.length];
+ projects = new IProject[projectPaths.length];
JobUtils.waitForIdle();
for (int i = 0; i < projectPaths.length; i++) {
projects[i] = ResourcesUtils.importProject(bundleName, projectPaths[i]);
- JobUtils.waitForIdle();
+ projects[i].build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null);
}
return projects;
- }
+ }
public static IProject loadProject(String projectName) throws CoreException {
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
@@ -79,14 +80,13 @@
@Override
protected void tearDown() throws Exception {
boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
- JobUtils.waitForIdle();
for (int i = 0; i < projectNames.length; i++) {
ResourcesUtils.deleteProject(projectNames[i]);
JobUtils.waitForIdle();
}
ResourcesUtils.setBuildAutomatically(saveAutoBuild);
}
-
+
public void deleteProjects() throws Exception {
tearDown();
}