Author: dazarov
Date: 2010-10-06 11:50:46 -0400 (Wed, 06 Oct 2010)
New Revision: 25524
Added:
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSFKickStartOldFormat/WebContent/WEB-INF/faces-config.1
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSFKickStartOldFormat/WebContent/WEB-INF/faces-config.original
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSFKickStartOldFormat/WebContent/testElRevalidation.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/ELValidatorTest.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSFKickStartOldFormat/.project
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/JsfAllTests.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java
Log:
https://jira.jboss.org/browse/JBIDE-6264
testRevalidationUnresolvedELs() moved from org.jboss.tools.seam.core.test to
org.jboss.tools.jsf.test
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSFKickStartOldFormat/.project
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSFKickStartOldFormat/.project 2010-10-06
13:52:08 UTC (rev 25523)
+++
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSFKickStartOldFormat/.project 2010-10-06
15:50:46 UTC (rev 25524)
@@ -15,6 +15,11 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.jboss.tools.jst.web.kb.kbbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
@@ -22,5 +27,6 @@
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.jboss.tools.jsf.jsfnature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>org.jboss.tools.jst.web.kb.kbnature</nature>
</natures>
</projectDescription>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSFKickStartOldFormat/WebContent/WEB-INF/faces-config.1
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSFKickStartOldFormat/WebContent/WEB-INF/faces-config.1
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSFKickStartOldFormat/WebContent/WEB-INF/faces-config.1 2010-10-06
15:50:46 UTC (rev 25524)
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces
Config 1.1//EN"
+
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
+<faces-config>
+ <component>
+ <description>Component Example.</description>
+ <display-name>Component c1</display-name>
+ <component-type>c1</component-type>
+ <component-class>javax.faces.component.UICommand</component-class>
+ <facet>
+ <description>Facet Example.</description>
+ <display-name>Facet f1</display-name>
+ <facet-name>f1</facet-name>
+ </facet>
+ <attribute>
+ <description>Attribute Example.</description>
+ <display-name>Attribute a1</display-name>
+ <attribute-name>a1</attribute-name>
+ <attribute-class>java.lang.String</attribute-class>
+ <default-value>v1</default-value>
+ <suggested-value>v2</suggested-value>
+ </attribute>
+ <property>
+ <description>Property Example.</description>
+ <display-name>Property p1</display-name>
+ <property-name>p1</property-name>
+ <property-class>java.lang.Integer</property-class>
+ <default-value>1</default-value>
+ <suggested-value>2</suggested-value>
+ </property>
+ </component>
+ <converter>
+ <description>Converter Example.</description>
+ <converter-id>c1</converter-id>
+ <converter-class>javax.faces.convert.LongConverter</converter-class>
+ <attribute>
+ <attribute-name>a2</attribute-name>
+ <attribute-class/>
+ </attribute>
+ <property>
+ <property-name>p2</property-name>
+ <property-class/>
+ </property>
+ </converter>
+ <converter>
+ <converter-for-class>demo.B</converter-for-class>
+ <converter-class>javax.faces.convert.LongConverter</converter-class>
+ </converter>
+ <managed-bean>
+ <description>Input Value Holder</description>
+ <managed-bean-name>user2</managed-bean-name>
+ <managed-bean-class>demo.User</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ <managed-property>
+ <property-name>name</property-name>
+ <property-class>java.lang.String</property-class>
+ <value/>
+ </managed-property>
+ <managed-property>
+ <property-name>aliases</property-name>
+ <property-class>java.util.List</property-class>
+ <list-entries>
+ <value-class>java.lang.String</value-class>
+ <null-value/>
+ <value>Red Hat</value>
+ </list-entries>
+ </managed-property>
+ </managed-bean>
+ <navigation-rule>
+ <from-view-id>/pages/inputname.jsp</from-view-id>
+ <navigation-case>
+ <from-outcome>greeting</from-outcome>
+ <to-view-id>/pages/greeting.jsp</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <render-kit>
+ <description>Render Kit Example.</description>
+ <display-name>Render Kit myRenderKit</display-name>
+ <render-kit-id>myRenderKit</render-kit-id>
+ <render-kit-class>com.sun.faces.renderkit.RenderKitImpl</render-kit-class>
+ <renderer>
+ <description>Renderer Example.</description>
+ <display-name>Renderer r1</display-name>
+ <component-family>command</component-family>
+ <renderer-type>r1</renderer-type>
+
<renderer-class>com.sun.faces.renderkit.html_basic.ButtonRenderer</renderer-class>
+ <facet>
+ <facet-name>f3</facet-name>
+ </facet>
+ <attribute>
+ <attribute-name>a3</attribute-name>
+ <attribute-class>java.lang.String</attribute-class>
+ </attribute>
+ </renderer>
+ </render-kit>
+ <validator>
+ <description>Validator Example.</description>
+ <display-name>Validator v1</display-name>
+ <validator-id>v1</validator-id>
+ <validator-class>javax.faces.validator.LengthValidator</validator-class>
+ <attribute>
+ <attribute-name>a4</attribute-name>
+ <attribute-class>java.lang.String</attribute-class>
+ </attribute>
+ <property>
+ <property-name>p4</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ </validator>
+ <application>
+ <action-listener>demo.ActionListenerImpl</action-listener>
+ <default-render-kit-id>myRenderKit</default-render-kit-id>
+
<navigation-handler>com.sun.faces.application.NavigationHandlerImpl</navigation-handler>
+ <view-handler>com.sun.faces.application.ViewHandlerImpl</view-handler>
+ <state-manager>com.sun.faces.application.StateManagerImpl</state-manager>
+ <message-bundle>demo.bundle.Messages</message-bundle>
+
<property-resolver>com.sun.faces.el.PropertyResolverImpl</property-resolver>
+
<variable-resolver>com.sun.faces.el.VariableResolverImpl</variable-resolver>
+ <locale-config>
+ <default-locale>en_US</default-locale>
+ <supported-locale>ru</supported-locale>
+ </locale-config>
+ </application>
+</faces-config>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSFKickStartOldFormat/WebContent/WEB-INF/faces-config.original
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSFKickStartOldFormat/WebContent/WEB-INF/faces-config.original
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSFKickStartOldFormat/WebContent/WEB-INF/faces-config.original 2010-10-06
15:50:46 UTC (rev 25524)
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces
Config 1.1//EN"
+
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
+<faces-config>
+ <component>
+ <description>Component Example.</description>
+ <display-name>Component c1</display-name>
+ <component-type>c1</component-type>
+ <component-class>javax.faces.component.UICommand</component-class>
+ <facet>
+ <description>Facet Example.</description>
+ <display-name>Facet f1</display-name>
+ <facet-name>f1</facet-name>
+ </facet>
+ <attribute>
+ <description>Attribute Example.</description>
+ <display-name>Attribute a1</display-name>
+ <attribute-name>a1</attribute-name>
+ <attribute-class>java.lang.String</attribute-class>
+ <default-value>v1</default-value>
+ <suggested-value>v2</suggested-value>
+ </attribute>
+ <property>
+ <description>Property Example.</description>
+ <display-name>Property p1</display-name>
+ <property-name>p1</property-name>
+ <property-class>java.lang.Integer</property-class>
+ <default-value>1</default-value>
+ <suggested-value>2</suggested-value>
+ </property>
+ </component>
+ <converter>
+ <description>Converter Example.</description>
+ <converter-id>c1</converter-id>
+ <converter-class>javax.faces.convert.LongConverter</converter-class>
+ <attribute>
+ <attribute-name>a2</attribute-name>
+ <attribute-class/>
+ </attribute>
+ <property>
+ <property-name>p2</property-name>
+ <property-class/>
+ </property>
+ </converter>
+ <converter>
+ <converter-for-class>demo.B</converter-for-class>
+ <converter-class>javax.faces.convert.LongConverter</converter-class>
+ </converter>
+ <managed-bean>
+ <description>Input Value Holder</description>
+ <managed-bean-name>user</managed-bean-name>
+ <managed-bean-class>demo.User</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ <managed-property>
+ <property-name>name</property-name>
+ <property-class>java.lang.String</property-class>
+ <value/>
+ </managed-property>
+ <managed-property>
+ <property-name>aliases</property-name>
+ <property-class>java.util.List</property-class>
+ <list-entries>
+ <value-class>java.lang.String</value-class>
+ <null-value/>
+ <value>Red Hat</value>
+ </list-entries>
+ </managed-property>
+ </managed-bean>
+ <navigation-rule>
+ <from-view-id>/pages/inputname.jsp</from-view-id>
+ <navigation-case>
+ <from-outcome>greeting</from-outcome>
+ <to-view-id>/pages/greeting.jsp</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <render-kit>
+ <description>Render Kit Example.</description>
+ <display-name>Render Kit myRenderKit</display-name>
+ <render-kit-id>myRenderKit</render-kit-id>
+ <render-kit-class>com.sun.faces.renderkit.RenderKitImpl</render-kit-class>
+ <renderer>
+ <description>Renderer Example.</description>
+ <display-name>Renderer r1</display-name>
+ <component-family>command</component-family>
+ <renderer-type>r1</renderer-type>
+
<renderer-class>com.sun.faces.renderkit.html_basic.ButtonRenderer</renderer-class>
+ <facet>
+ <facet-name>f3</facet-name>
+ </facet>
+ <attribute>
+ <attribute-name>a3</attribute-name>
+ <attribute-class>java.lang.String</attribute-class>
+ </attribute>
+ </renderer>
+ </render-kit>
+ <validator>
+ <description>Validator Example.</description>
+ <display-name>Validator v1</display-name>
+ <validator-id>v1</validator-id>
+ <validator-class>javax.faces.validator.LengthValidator</validator-class>
+ <attribute>
+ <attribute-name>a4</attribute-name>
+ <attribute-class>java.lang.String</attribute-class>
+ </attribute>
+ <property>
+ <property-name>p4</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ </validator>
+ <application>
+ <action-listener>demo.ActionListenerImpl</action-listener>
+ <default-render-kit-id>myRenderKit</default-render-kit-id>
+
<navigation-handler>com.sun.faces.application.NavigationHandlerImpl</navigation-handler>
+ <view-handler>com.sun.faces.application.ViewHandlerImpl</view-handler>
+ <state-manager>com.sun.faces.application.StateManagerImpl</state-manager>
+ <message-bundle>demo.bundle.Messages</message-bundle>
+
<property-resolver>com.sun.faces.el.PropertyResolverImpl</property-resolver>
+
<variable-resolver>com.sun.faces.el.VariableResolverImpl</variable-resolver>
+ <locale-config>
+ <default-locale>en_US</default-locale>
+ <supported-locale>ru</supported-locale>
+ </locale-config>
+ </application>
+</faces-config>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSFKickStartOldFormat/WebContent/testElRevalidation.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSFKickStartOldFormat/WebContent/testElRevalidation.xhtml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSFKickStartOldFormat/WebContent/testElRevalidation.xhtml 2010-10-06
15:50:46 UTC (rev 25524)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:rich="http://richfaces.org/rich">
+ <rich:componentControl for="loginModalPanel" />
+ <rich:modalPanel id="loginModalPanel">
+ <f:facet name="controls">
+ <rich:componentControl for="loginModalPanel" />
+ </f:facet>
+ <ui:define name="body">
+ #{user}
+ </ui:define>
+ </rich:modalPanel>
+</ui:composition>
\ No newline at end of file
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSFKickStartOldFormat/WebContent/testElRevalidation.xhtml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/JsfAllTests.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/JsfAllTests.java 2010-10-06
13:52:08 UTC (rev 25523)
+++
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/JsfAllTests.java 2010-10-06
15:50:46 UTC (rev 25524)
@@ -14,12 +14,22 @@
import junit.framework.Test;
import junit.framework.TestSuite;
+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.NullProgressMonitor;
import org.eclipse.jdt.internal.core.JavaModelManager;
+import org.eclipse.wst.validation.ValidationFramework;
+import org.eclipse.wst.validation.Validator;
+import org.eclipse.wst.validation.internal.operations.ValidatorManager;
import org.jboss.tools.jsf.model.pv.test.JSFPromptingProviderTest;
import org.jboss.tools.jsf.test.refactoring.ELVariableRefactoringTest;
import org.jboss.tools.jsf.test.refactoring.JSF2RefactoringTest;
import org.jboss.tools.jsf.test.refactoring.MessagePropertyRefactoringTest;
+import org.jboss.tools.jsf.test.validation.ELValidatorTest;
import org.jboss.tools.jsf.test.validation.JSF2ComponentsValidatorTest;
+import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ProjectImportTestSetup;
public class JsfAllTests {
@@ -56,6 +66,17 @@
JSF2RefactoringTest.class), "org.jboss.tools.jsf.test", //$NON-NLS-1$
new String[] { "projects/JSF2ComponentsValidator" }, //$NON-NLS-1$
new String[] { "JSF2ComponentsValidator" })); //$NON-NLS-1$
+ suite.addTest(new ProjectImportTestSetup(new
TestSuite(ELValidatorTest.class),"org.jboss.tools.jsf.test","projects/JSFKickStartOldFormat","JSFKickStartOldFormat")
{
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ IProject project =
(IProject)ResourcesPlugin.getWorkspace().getRoot().findMember("JSFKickStartOldFormat");
+ project.refreshLocal(IResource.DEPTH_INFINITE, null);
+ JobUtils.waitForIdle();
+
+ ValidatorManager.addProjectBuildValidationSupport(project);
+ }
+ } );
return new DisableJavaIndexingSetup(suite);
}
Added:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/ELValidatorTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/ELValidatorTest.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/ELValidatorTest.java 2010-10-06
15:50:46 UTC (rev 25524)
@@ -0,0 +1,122 @@
+package org.jboss.tools.jsf.test.validation;
+
+import java.io.IOException;
+import java.text.MessageFormat;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+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.jface.preference.IPreferenceStore;
+import org.eclipse.wst.validation.ValidationFramework;
+import org.eclipse.wst.validation.internal.core.ValidationException;
+import org.jboss.tools.jsf.JSFModelPlugin;
+import org.jboss.tools.jsf.preferences.JSFSeverityPreferences;
+import org.jboss.tools.jsf.web.validation.JSFValidationMessages;
+import org.jboss.tools.test.util.JobUtils;
+import org.jboss.tools.tests.AbstractResourceMarkerTest;
+
+public class ELValidatorTest extends AbstractResourceMarkerTest{
+ public static final String MARKER_TYPE =
"org.eclipse.wst.validation.problemmarker";
+
+ protected void setUp() throws Exception {
+ JobUtils.waitForIdle();
+ IResource project =
ResourcesPlugin.getWorkspace().getRoot().findMember("JSFKickStartOldFormat");
+ this.project = project.getProject();
+
+ this.project.build(IncrementalProjectBuilder.CLEAN_BUILD,
+ new NullProgressMonitor());
+
+ JobUtils.waitForIdle();
+ }
+
+ public void testUnknownELVariable() throws CoreException, ValidationException {
+
+ IPreferenceStore store = JSFModelPlugin.getDefault().getPreferenceStore();
+ store.setValue(JSFSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL,
JSFSeverityPreferences.ENABLE);
+ store.setValue(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME,
JSFSeverityPreferences.ERROR);
+
+ copyContentsFile("WebContent/WEB-INF/faces-config.xml",
"WebContent/WEB-INF/faces-config.1");
+
+ assertMarkerIsCreatedForLine(
+ "WebContent/testElRevalidation.xhtml",
+ JSFValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
+ new Object[] {"user"},
+ 13);
+
+ // Check if the validator was not invoked.
+ copyContentsFile("WebContent/WEB-INF/faces-config.xml",
"WebContent/WEB-INF/faces-config.original");
+
+ assertMarkerIsNotCreatedForLine(
+ "WebContent/testElRevalidation.xhtml",
+ JSFValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
+ new Object[] {"user"},
+ 13);
+
+ store.setValue(JSFSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL,
JSFSeverityPreferences.ENABLE);
+ store.setValue(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME,
JSFSeverityPreferences.IGNORE);
+ }
+
+ public void testRevalidationUnresolvedELs() throws CoreException, ValidationException{
+ IPreferenceStore store = JSFModelPlugin.getDefault().getPreferenceStore();
+ store.setValue(JSFSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL,
JSFSeverityPreferences.DISABLE);
+ store.setValue(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME,
JSFSeverityPreferences.ERROR);
+
+ copyContentsFile("WebContent/WEB-INF/faces-config.xml",
"WebContent/WEB-INF/faces-config.1");
+
+ assertMarkerIsCreatedForLine(
+ "WebContent/testElRevalidation.xhtml",
+ JSFValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
+ new Object[] {"user"},
+ 13);
+
+ // Check if the validator was not invoked.
+ copyContentsFile("WebContent/WEB-INF/faces-config.xml",
"WebContent/WEB-INF/faces-config.original");
+
+ assertMarkerIsNotCreatedForLine(
+ "WebContent/testElRevalidation.xhtml",
+ JSFValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
+ new Object[] {"user"},
+ 13);
+
+ store.setValue(JSFSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL,
JSFSeverityPreferences.ENABLE);
+ store.setValue(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME,
JSFSeverityPreferences.IGNORE);
+ }
+
+ private void assertMarkerIsCreatedForLine(String fileName, String template, Object[]
parameters, int lineNumber) throws CoreException{
+ String messagePattern = MessageFormat.format(template, parameters);
+ IFile file = project.getFile(fileName);
+
+ ValidationFramework.getDefault().validate(file, new NullProgressMonitor());
+
+ IMarker[] markers = file.findMarkers(null, true, IResource.DEPTH_INFINITE);
+ for (int i = 0; i < markers.length; i++) {
+ String message = markers[i].getAttribute(IMarker.MESSAGE, "");
//$NON-NLS-1$
+ int line = markers[i].getAttribute(IMarker.LINE_NUMBER, -1); //$NON-NLS-1$
+ if(message.equals(messagePattern) && line == lineNumber)
+ return;
+ }
+ fail("Marker "+messagePattern+" for line - "+lineNumber+" not
found");
+ }
+
+ private void assertMarkerIsNotCreatedForLine(String fileName, String template, Object[]
parameters, int lineNumber) throws CoreException{
+ String messagePattern = MessageFormat.format(template, parameters);
+ IFile file = project.getFile(fileName);
+
+ ValidationFramework.getDefault().validate(file, new NullProgressMonitor());
+
+ IMarker[] markers = file.findMarkers(null, true, IResource.DEPTH_INFINITE);
+ for (int i = 0; i < markers.length; i++) {
+ String message = markers[i].getAttribute(IMarker.MESSAGE, "");
//$NON-NLS-1$
+ int line = markers[i].getAttribute(IMarker.LINE_NUMBER, -1); //$NON-NLS-1$
+ if(message.equals(messagePattern) && line == lineNumber){
+ fail("Marker "+messagePattern+" for line - "+lineNumber+"
has been found");
+ }
+ }
+
+ }
+
+}
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/ELValidatorTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java 2010-10-06
13:52:08 UTC (rev 25523)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java 2010-10-06
15:50:46 UTC (rev 25524)
@@ -51,8 +51,6 @@
public class SeamValidatorsTest extends AbstractResourceMarkerTest {
- IProject project = null;
-
public static SeamMarkerFilter SEAM_MARKER_FILTER = new SeamMarkerFilter();
public SeamValidatorsTest() {
@@ -83,42 +81,6 @@
}
- private void copyContentsFile(String originalName, String newContentName) throws
CoreException{
- IFile originalFile = project.getFile(originalName);
- IFile newContentFile = project.getFile(newContentName);
-
- copyContentsFile(originalFile, newContentFile);
- }
-
- private void copyContentsFile(IFile originalFile, String newContentName) throws
CoreException{
- IFile newContentFile = project.getFile(newContentName);
- copyContentsFile(originalFile, newContentFile);
- }
-
- private void copyContentsFile(IFile originalFile, IFile newContentFile) throws
CoreException{
- PageContextFactory.getInstance().cleanUp(originalFile);
- InputStream is = null;
- try{
- is = newContentFile.getContents();
- originalFile.setContents(is, true, false, null);
- } finally {
- if(is!=null) {
- try {
- is.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
- JobUtils.waitForIdle();
- originalFile.getProject().build(IncrementalProjectBuilder.INCREMENTAL_BUILD,
"org.eclipse.jdt.internal.core.builder.JavaBuilder", null, null);
- JobUtils.waitForIdle();
- originalFile.getProject().build(IncrementalProjectBuilder.INCREMENTAL_BUILD,
SeamCoreBuilder.BUILDER_ID, null, null);
-// originalFile.getProject().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null);
- JobUtils.waitForIdle();
- }
-
private ISeamProject getSeamProject(IProject project) {
refreshProject(project);
@@ -806,36 +768,6 @@
}
- // See
https://jira.jboss.org/jira/browse/JBIDE-4515
- public void testRevalidationUnresolvedELs() throws CoreException, ValidationException {
- JSFModelPlugin.getDefault().getPreferenceStore().setValue(JSFSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL,
SeamPreferences.ENABLE);
- JSFModelPlugin.getDefault().getPreferenceStore().setValue(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME,
SeamPreferences.ERROR);
-
- copyContentsFile("src/action/org/domain/SeamWebWarTestProject/entity/TestElRevalidation.java",
"src/action/org/domain/SeamWebWarTestProject/entity/TestElRevalidation.new");
-
- assertMarkerIsCreatedForLine(
- new ELValidatorWrapper(project),
- "WebContent/testElRevalidation.xhtml",
- JSFValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
- new Object[] {"testElRevalidation"},
- 6);
-
- JSFModelPlugin.getDefault().getPreferenceStore().setValue(JSFSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL,
SeamPreferences.DISABLE);
-
- // Check if the validator was not invoked.
- copyContentsFile("src/action/org/domain/SeamWebWarTestProject/entity/TestElRevalidation.java",
"src/action/org/domain/SeamWebWarTestProject/entity/TestElRevalidation.original");
-
- assertMarkerIsCreatedForLine(
- new ELValidatorWrapper(project),
- "WebContent/testElRevalidation.xhtml",
- JSFValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
- new Object[] {"testElRevalidation"},
- 6);
-
- JSFModelPlugin.getDefault().getPreferenceStore().setValue(JSFSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL,
SeamPreferences.ENABLE);
- JSFModelPlugin.getDefault().getPreferenceStore().setValue(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME,
SeamPreferences.IGNORE);
- }
-
// See
https://jira.jboss.org/browse/JBIDE-6352
public void testErrorMarkerForEL() throws CoreException, ValidationException{
assertMarkerIsCreatedForLine(
Modified:
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java 2010-10-06
13:52:08 UTC (rev 25523)
+++
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java 2010-10-06
15:50:46 UTC (rev 25524)
@@ -10,15 +10,21 @@
******************************************************************************/
package org.jboss.tools.tests;
+import java.io.IOException;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import junit.framework.TestCase;
+import org.eclipse.core.resources.IFile;
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.runtime.CoreException;
import org.jboss.tools.test.util.JUnitUtils;
+import org.jboss.tools.test.util.JobUtils;
/**
* @author eskimo
@@ -27,6 +33,8 @@
public class AbstractResourceMarkerTest extends TestCase {
public static final String MARKER_TYPE =
"org.eclipse.wst.validation.problemmarker";
+
+ protected IProject project = null;
/**
*
@@ -40,7 +48,38 @@
public AbstractResourceMarkerTest(String name) {
super(name);
}
+
+ protected void copyContentsFile(String originalName, String newContentName) throws
CoreException{
+ IFile originalFile = project.getFile(originalName);
+ IFile newContentFile = project.getFile(newContentName);
+
+ copyContentsFile(originalFile, newContentFile);
+ }
+
+ protected void copyContentsFile(IFile originalFile, String newContentName) throws
CoreException{
+ IFile newContentFile = project.getFile(newContentName);
+ copyContentsFile(originalFile, newContentFile);
+ }
+ protected void copyContentsFile(IFile originalFile, IFile newContentFile) throws
CoreException{
+ InputStream is = null;
+ try{
+ is = newContentFile.getContents();
+ originalFile.setContents(is, true, false, null);
+ } finally {
+ if(is!=null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ originalFile.getProject().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null);
+ JobUtils.waitForIdle();
+ }
+
+
public static int findMarkerLine(IResource resource, String type, String errorMessage,
boolean pattern)
throws CoreException {
int number = -1;