Author: scabanovich
Date: 2011-06-01 17:45:38 -0400 (Wed, 01 Jun 2011)
New Revision: 31758
Modified:
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/validation/BuilderOrderMarkerResolutionTest.java
Log:
JBIDE-9028
https://issues.jboss.org/browse/JBIDE-9028
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-06-01
21:30:31 UTC (rev 31757)
+++
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/validation/BuilderOrderMarkerResolutionTest.java 2011-06-01
21:45:38 UTC (rev 31758)
@@ -12,15 +12,19 @@
import junit.framework.TestCase;
+import org.eclipse.core.internal.preferences.EclipsePreferences;
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.eclipse.wst.validation.internal.plugin.ValidationPlugin;
+import org.jboss.tools.common.preferences.SeverityPreferences;
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;
public class BuilderOrderMarkerResolutionTest extends TestCase {
@@ -34,7 +38,8 @@
private void checkResolution(IProject project, String markerType, String
resolutionClassName) throws CoreException {
try{
- IMarker[] markers = project.findMarkers(ValidationPlugin.VALIDATION_BUILDER_ID, true,
IResource.DEPTH_ZERO);
+ IMarker[] markers = getBuilderOrderMarkers();
+ assertTrue(markers.length > 0);
for (int i = 0; i < markers.length; i++) {
IMarker marker = markers[i];
IMarkerResolution[] resolutions =
IDE.getMarkerHelpRegistry().getResolutions(marker);
@@ -56,6 +61,38 @@
}
}
+ private IMarker[] getBuilderOrderMarkers() throws CoreException {
+ return project.findMarkers(ValidatorManager.ORDER_PROBLEM_MARKER_TYPE, true,
IResource.DEPTH_ZERO);
+ }
+
+ public void testWrongBuildOrderPreference() throws CoreException {
+ IMarker[] markers = getBuilderOrderMarkers();
+ assertEquals(1, markers.length);
+ assertEquals(IMarker.SEVERITY_ERROR, markers[0].getAttribute(IMarker.SEVERITY, -1));
+
+ modifyPreference(SeverityPreferences.IGNORE);
+ markers = getBuilderOrderMarkers();
+ assertEquals(0, markers.length);
+
+ modifyPreference(SeverityPreferences.WARNING);
+ markers = getBuilderOrderMarkers();
+ assertEquals(1, markers.length);
+ assertEquals(IMarker.SEVERITY_WARNING, markers[0].getAttribute(IMarker.SEVERITY, -1));
+
+ modifyPreference(SeverityPreferences.ERROR);
+ markers = getBuilderOrderMarkers();
+ assertEquals(1, markers.length);
+ assertEquals(IMarker.SEVERITY_ERROR, markers[0].getAttribute(IMarker.SEVERITY, -1));
+ }
+
+ 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();
+ }
+
public void testBuilderOrderResolution() throws CoreException {
checkResolution(project,
ValidatorManager.ORDER_PROBLEM_MARKER_TYPE,