Large checkin for alternative handling and dt view construction.
diff --git a/jsf/tests/org.eclipse.jst.jsf.common.runtime.tests/META-INF/MANIFEST.MF b/jsf/tests/org.eclipse.jst.jsf.common.runtime.tests/META-INF/MANIFEST.MF
index b66ad99..b2fe93c 100644
--- a/jsf/tests/org.eclipse.jst.jsf.common.runtime.tests/META-INF/MANIFEST.MF
+++ b/jsf/tests/org.eclipse.jst.jsf.common.runtime.tests/META-INF/MANIFEST.MF
@@ -8,6 +8,6 @@
org.eclipse.core.runtime,
org.eclipse.jst.jsf.common.runtime,
org.junit
-Eclipse-LazyStart: true
+Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.eclipse.jst.jsf.common.runtime.tests.model
diff --git a/jsf/tests/org.eclipse.jst.jsf.contentassist.tests/META-INF/MANIFEST.MF b/jsf/tests/org.eclipse.jst.jsf.contentassist.tests/META-INF/MANIFEST.MF
index 7a956c7..dde037d 100644
--- a/jsf/tests/org.eclipse.jst.jsf.contentassist.tests/META-INF/MANIFEST.MF
+++ b/jsf/tests/org.eclipse.jst.jsf.contentassist.tests/META-INF/MANIFEST.MF
@@ -21,7 +21,7 @@
org.eclipse.wst.html.core;bundle-version="[1.1.0,1.2.0)",
org.eclipse.jdt.core;bundle-version="[3.2.0,4.0.0)",
org.eclipse.emf.ecore
-Eclipse-LazyStart: true
+Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.eclipse.jst.jsf.contentassist.tests;x-internal:=true
Bundle-Vendor: %Bundle-Vendor.0
diff --git a/jsf/tests/org.eclipse.jst.jsf.context.symbol.tests/META-INF/MANIFEST.MF b/jsf/tests/org.eclipse.jst.jsf.context.symbol.tests/META-INF/MANIFEST.MF
index 20ed885..8d2eb01 100644
--- a/jsf/tests/org.eclipse.jst.jsf.context.symbol.tests/META-INF/MANIFEST.MF
+++ b/jsf/tests/org.eclipse.jst.jsf.context.symbol.tests/META-INF/MANIFEST.MF
@@ -18,6 +18,6 @@
org.eclipse.jface.text;bundle-version="[3.2.0,4.0.0)",
org.eclipse.jst.jsf.common;bundle-version="[1.0.0,1.1.0)",
org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)"
-Eclipse-LazyStart: true
+Bundle-ActivationPolicy: lazy
Bundle-Activator: org.eclipse.jst.jsf.context.symbol.tests.ContextSymbolTestPlugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/jsf/tests/org.eclipse.jst.jsf.core.tests/META-INF/MANIFEST.MF b/jsf/tests/org.eclipse.jst.jsf.core.tests/META-INF/MANIFEST.MF
index eee18ce..966ac8d 100644
--- a/jsf/tests/org.eclipse.jst.jsf.core.tests/META-INF/MANIFEST.MF
+++ b/jsf/tests/org.eclipse.jst.jsf.core.tests/META-INF/MANIFEST.MF
@@ -28,8 +28,9 @@
org.eclipse.core.net,
org.eclipse.jst.jsp.core,
org.eclipse.wst.html.core,
+ org.eclipse.ui.ide;bundle-version="3.4.0",
org.eclipse.jst.common.frameworks;bundle-version="1.1.102"
-Eclipse-LazyStart: true
+Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.jst.jsf.core.tests;x-friends:="org.eclipse.jst.jsf.ui.tests,org.eclipse.jst.jsf.context.symbol.tests,org.eclipse.jst.jsf.designtime.tests",
org.eclipse.jst.jsf.core.tests.appconfig.provider;x-internal:=true,
org.eclipse.jst.jsf.core.tests.appconfig.validation;x-internal:=true,
@@ -42,6 +43,12 @@
org.eclipse.jst.jsf.core.tests.set;x-internal:=true,
org.eclipse.jst.jsf.core.tests.tagmatcher;x-internal:=true,
org.eclipse.jst.jsf.core.tests.types;x-internal:=true,
- org.eclipse.jst.jsf.core.tests.util;x-friends:="org.eclipse.jst.jsf.contentassist.tests,org.eclipse.jst.jsf.designtime.tests,org.eclipse.jst.jsf.validation.el.tests,org.eclipse.jst.jsf.ui.tests,org.eclipse.jst.pagedesigner.tests"
+ org.eclipse.jst.jsf.core.tests.util;
+ x-friends:="org.eclipse.jst.jsf.contentassist.tests,
+ org.eclipse.jst.jsf.designtime.tests,
+ org.eclipse.jst.jsf.validation.el.tests,
+ org.eclipse.jst.jsf.ui.tests,
+ org.eclipse.jst.pagedesigner.tests",
+ org.eclipse.jst.jsf.core.tests.validation
Plugin-Class: org.eclipse.jst.jsf.core.tests.TestsPlugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/jsf/tests/org.eclipse.jst.jsf.core.tests/src/org/eclipse/jst/jsf/core/tests/AllTests.java b/jsf/tests/org.eclipse.jst.jsf.core.tests/src/org/eclipse/jst/jsf/core/tests/AllTests.java
index 8871bcc..14a7992 100644
--- a/jsf/tests/org.eclipse.jst.jsf.core.tests/src/org/eclipse/jst/jsf/core/tests/AllTests.java
+++ b/jsf/tests/org.eclipse.jst.jsf.core.tests/src/org/eclipse/jst/jsf/core/tests/AllTests.java
@@ -37,6 +37,7 @@
import org.eclipse.jst.jsf.core.tests.util.TestJDTBeanIntrospector;
import org.eclipse.jst.jsf.core.tests.util.TestJDTBeanPropertyWorkingCopy;
import org.eclipse.jst.jsf.core.tests.util.TestTypeUtil;
+import org.eclipse.jst.jsf.core.tests.validation.TestJSPSemanticsValidator_AttributeValues;
import org.eclipse.jst.jsf.core.tests.validation.TestJSPSemanticsValidator_Containment;
/**
@@ -79,6 +80,7 @@
suite.addTestSuite(JSFLibraryRegistryUtilTestCases.class);
suite.addTestSuite(TestJSPSemanticsValidator_Containment.class);
+ suite.addTestSuite(TestJSPSemanticsValidator_AttributeValues.class);
suite.addTestSuite(AppConfigValidationUtilTestCase.class);
suite.addTestSuite(TestMemberConstraint.class);
suite.addTestSuite(TestXPathValidation.class);
diff --git a/jsf/tests/org.eclipse.jst.jsf.core.tests/src/org/eclipse/jst/jsf/core/tests/region/TestRegion2ElementAdapter.java b/jsf/tests/org.eclipse.jst.jsf.core.tests/src/org/eclipse/jst/jsf/core/tests/region/TestRegion2ElementAdapter.java
new file mode 100644
index 0000000..d2133b8
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.core.tests/src/org/eclipse/jst/jsf/core/tests/region/TestRegion2ElementAdapter.java
@@ -0,0 +1,516 @@
+package org.eclipse.jst.jsf.core.tests.region;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jst.jsf.common.dom.AttrDOMAdapter;
+import org.eclipse.jst.jsf.common.dom.AttributeIdentifier;
+import org.eclipse.jst.jsf.common.dom.TagIdentifier;
+import org.eclipse.jst.jsf.core.internal.region.Region2AttrAdapter;
+import org.eclipse.jst.jsf.core.internal.region.Region2ElementAdapter;
+import org.eclipse.jst.jsf.core.internal.tld.IJSFConstants;
+import org.eclipse.jst.jsf.core.internal.tld.ITLDConstants;
+import org.eclipse.jst.jsf.core.tests.TestsPlugin;
+import org.eclipse.jst.jsf.test.util.JSFTestUtil;
+import org.eclipse.jst.jsf.test.util.WebProjectTestEnvironment;
+import org.eclipse.jst.jsp.core.internal.domdocument.DOMModelForJSP;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.w3c.dom.Node;
+
+public class TestRegion2ElementAdapter extends TestCase
+{
+
+ private final static int OFFSET_OUTPUT_TEXT_WITH_EL =
+ 883;
+ private final static int OFFSET_PANELGRID_WITH_NO_EL =
+ 958;
+ private final static int OFFSET_OUTPUTLABEL_WITH_NO_EL =
+ 990;
+ private final static int OFFSET_INPUTTEXT_WITH_BOTH =
+ 1044;
+ private final static int OFFSET_COMMANDBUTTON_WITH_TWO_EL =
+ 1255;
+
+ private final static Map<String, String> OUTPUTLABEL_ATTRIBUTES;
+ private final static Map<String, String> INPUTTEXT_ATTRIBUTES;
+ private final static Map<String, String> COMMANDBUTTON_ATTRIBUTES;
+
+ private WebProjectTestEnvironment _webProjectTestEnv;
+ private IResource _res1;
+ private IStructuredModel _model;
+ private IStructuredDocument _sdoc;
+
+ static
+ {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("for", "userId");
+ map.put("value", "Username:");
+ OUTPUTLABEL_ATTRIBUTES = Collections.unmodifiableMap(map);
+
+ map = new HashMap<String, String>();
+ map.put("id", "userId");
+ map.put("value", "#{loginRequest.id}");
+ INPUTTEXT_ATTRIBUTES = Collections.unmodifiableMap(map);
+
+ map = new HashMap<String, String>();
+ map.put("action", "#{appController.loginActions}");
+ map.put("value", "#{bundle['login.button.value']}");
+ COMMANDBUTTON_ATTRIBUTES = Collections.unmodifiableMap(map);
+
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ JSFTestUtil.setValidationEnabled(false);
+
+ _webProjectTestEnv =
+ new WebProjectTestEnvironment(getClass().getName()
+ + "_" + getName());
+ _webProjectTestEnv.createProject(false);
+ assertNotNull(_webProjectTestEnv);
+ assertNotNull(_webProjectTestEnv.getTestProject());
+ assertTrue(_webProjectTestEnv.getTestProject().isAccessible());
+
+ _res1 =
+ _webProjectTestEnv.loadResourceInWebRoot(TestsPlugin
+ .getDefault().getBundle(),
+ "/testfiles/jsps/testdata1.jsp.data", "/testdata1.jsp");
+ _model =
+ StructuredModelManager.getModelManager().getModelForRead(
+ (IFile) _res1);
+ assert (_model instanceof DOMModelForJSP);
+ _sdoc = _model.getStructuredDocument();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ try
+ {
+ super.tearDown();
+ }
+ finally
+ {
+ _model.releaseFromRead();
+ }
+
+ }
+
+ public void testSanity()
+ {
+ assertExpectedTag(OFFSET_OUTPUT_TEXT_WITH_EL, "h", "outputText",
+ ITLDConstants.URI_JSF_HTML);
+ final Map<String, String> expectedMap = new HashMap<String, String>();
+ expectedMap.put("value", "#{bundle['page.header']}");
+ assertExpectedAttributes(OFFSET_OUTPUT_TEXT_WITH_EL, expectedMap);
+
+ assertExpectedTag(OFFSET_PANELGRID_WITH_NO_EL, "h", "panelGrid",
+ ITLDConstants.URI_JSF_HTML);
+ expectedMap.clear();
+ expectedMap.put("columns", "2");
+ assertExpectedAttributes(OFFSET_PANELGRID_WITH_NO_EL, expectedMap);
+
+ assertExpectedTag(OFFSET_OUTPUTLABEL_WITH_NO_EL, "h", "outputLabel",
+ ITLDConstants.URI_JSF_HTML);
+ assertExpectedAttributes(OFFSET_OUTPUTLABEL_WITH_NO_EL,
+ OUTPUTLABEL_ATTRIBUTES);
+
+ assertExpectedTag(OFFSET_INPUTTEXT_WITH_BOTH, "h", "inputText",
+ ITLDConstants.URI_JSF_HTML);
+ assertExpectedAttributes(OFFSET_INPUTTEXT_WITH_BOTH,
+ INPUTTEXT_ATTRIBUTES);
+
+ assertExpectedTag(OFFSET_COMMANDBUTTON_WITH_TWO_EL, "h",
+ "commandButton", ITLDConstants.URI_JSF_HTML);
+ assertExpectedAttributes(OFFSET_COMMANDBUTTON_WITH_TWO_EL,
+ COMMANDBUTTON_ATTRIBUTES);
+
+ }
+
+ /**
+ * Single attribute, EL only
+ *
+ * @throws Exception
+ */
+ public void testOutputTextWithEL() throws Exception
+ {
+ final IndexedRegion region =
+ JSFTestUtil.getIndexedRegion(_sdoc,
+ OFFSET_OUTPUT_TEXT_WITH_EL);
+ final IDOMNode domNode = (IDOMNode) region;
+
+ final ITextRegion textRegion =
+ domNode
+ .getFirstStructuredDocumentRegion();
+ final Region2ElementAdapter adapter =
+ new Region2ElementAdapter(
+ textRegion);
+
+ // verify element
+ assertEquals("h:outputText", adapter.getNodeName());
+ assertEquals("outputText", adapter.getLocalName());
+ assertEquals("h", adapter.getPrefix());
+ assertEquals(ITLDConstants.URI_JSF_HTML, adapter.getNamespace());
+ assertEquals(1, adapter.getAttributes().size());
+
+ // verify the TagIdentifier
+ final TagIdentifier tagId = adapter.getTagId();
+ assertNotNull(tagId);
+ assertEquals(ITLDConstants.URI_JSF_HTML, tagId.getUri());
+ assertEquals(IJSFConstants.TAG_OUTPUTTEXT, tagId.getTagName());
+ assertEquals(IJSFConstants.TAG_IDENTIFIER_OUTPUTTEXT, tagId);
+
+ // verify only attribute
+ assertTrue(adapter.getAttributes().containsKey("value"));
+ final AttrDOMAdapter attr = adapter.getAttributes().get("value");
+ assertEquals("value", attr.getLocalName());
+ assertEquals("value", attr.getNodeName());
+ assertEquals("#{bundle['page.header']}", attr.getValue());
+
+ // verify the AttributeIdentifier
+ final AttributeIdentifier attrId = attr.getAttributeIdentifier();
+ assertNotNull(attrId);
+ assertEquals(tagId, attrId.getTagIdentifier());
+ assertEquals(attr.getNodeName(), attrId.getName());
+ }
+
+ /**
+ * Single attribute No EL
+ *
+ * @throws Exception
+ */
+ public void testPanelGridWithNoEL() throws Exception
+ {
+ final IndexedRegion region =
+ JSFTestUtil.getIndexedRegion(_sdoc,
+ OFFSET_PANELGRID_WITH_NO_EL);
+ final IDOMNode domNode = (IDOMNode) region;
+
+ final ITextRegion textRegion =
+ domNode
+ .getFirstStructuredDocumentRegion();
+ final Region2ElementAdapter adapter =
+ new Region2ElementAdapter(
+ textRegion);
+
+ // verify element
+ assertEquals("h:panelGrid", adapter.getNodeName());
+ assertEquals("panelGrid", adapter.getLocalName());
+ assertEquals("h", adapter.getPrefix());
+ assertEquals(ITLDConstants.URI_JSF_HTML, adapter.getNamespace());
+ assertEquals(1, adapter.getAttributes().size());
+
+ // verify the TagIdentifier
+ final TagIdentifier tagId = adapter.getTagId();
+ assertNotNull(tagId);
+ assertEquals(ITLDConstants.URI_JSF_HTML, tagId.getUri());
+ assertEquals(IJSFConstants.TAG_PANELGRID, tagId.getTagName());
+ assertEquals(IJSFConstants.TAG_IDENTIFIER_PANEL_GRID, tagId);
+
+ // verify only attribute
+ assertTrue(adapter.getAttributes().containsKey("columns"));
+ final AttrDOMAdapter attr = adapter.getAttributes().get("columns");
+ assertEquals("columns", attr.getLocalName());
+ assertEquals("columns", attr.getNodeName());
+ assertEquals("2", attr.getValue());
+
+ // verify the AttributeIdentifier
+ final AttributeIdentifier attrId = attr.getAttributeIdentifier();
+ assertNotNull(attrId);
+ assertEquals(tagId, attrId.getTagIdentifier());
+ assertEquals(attr.getNodeName(), attrId.getName());
+ }
+
+ /**
+ * Two non-EL attributes
+ *
+ * @throws Exception
+ */
+ public void testOutputLabelWithNoEL() throws Exception
+ {
+ final IndexedRegion region =
+ JSFTestUtil.getIndexedRegion(_sdoc,
+ OFFSET_OUTPUTLABEL_WITH_NO_EL);
+ final IDOMNode domNode = (IDOMNode) region;
+
+ final ITextRegion textRegion =
+ domNode
+ .getFirstStructuredDocumentRegion();
+ final Region2ElementAdapter adapter =
+ new Region2ElementAdapter(
+ textRegion);
+
+ // verify element
+ assertEquals("h:outputLabel", adapter.getNodeName());
+ assertEquals("outputLabel", adapter.getLocalName());
+ assertEquals("h", adapter.getPrefix());
+ assertEquals(ITLDConstants.URI_JSF_HTML, adapter.getNamespace());
+
+ // verify the TagIdentifier
+ final TagIdentifier tagId = adapter.getTagId();
+ assertNotNull(tagId);
+ assertEquals(ITLDConstants.URI_JSF_HTML, tagId.getUri());
+ assertEquals(IJSFConstants.TAG_OUTPUTLABEL, tagId.getTagName());
+ assertEquals(IJSFConstants.TAG_IDENTIFIER_OUTPUTLABEL, tagId);
+
+ assertEquals(OUTPUTLABEL_ATTRIBUTES.size(), adapter.getAttributes()
+ .size());
+ for (final Map.Entry<String, String> entry : OUTPUTLABEL_ATTRIBUTES
+ .entrySet())
+ {
+ AttrDOMAdapter attrAdapter =
+ adapter.getAttributes().get(
+ entry.getKey());
+ assertNotNull(attrAdapter);
+ assertEquals(entry.getKey(), attrAdapter.getNodeName());
+ assertEquals(entry.getValue(), attrAdapter.getValue());
+ // verify the AttributeIdentifier
+ final AttributeIdentifier attrId =
+ attrAdapter
+ .getAttributeIdentifier();
+ assertNotNull(attrId);
+ assertEquals(tagId, attrId.getTagIdentifier());
+ assertEquals(attrAdapter.getNodeName(), attrId.getName());
+ }
+
+ }
+
+ /**
+ * One non-EL attribute, One EL attribute
+ *
+ * @throws Exception
+ */
+ public void testInputTextWithBoth() throws Exception
+ {
+ final IndexedRegion region =
+ JSFTestUtil.getIndexedRegion(_sdoc,
+ OFFSET_INPUTTEXT_WITH_BOTH);
+ final IDOMNode domNode = (IDOMNode) region;
+
+ final ITextRegion textRegion =
+ domNode
+ .getFirstStructuredDocumentRegion();
+ final Region2ElementAdapter adapter =
+ new Region2ElementAdapter(
+ textRegion);
+
+ // verify element
+ assertEquals("h:inputText", adapter.getNodeName());
+ assertEquals("inputText", adapter.getLocalName());
+ assertEquals("h", adapter.getPrefix());
+ assertEquals(ITLDConstants.URI_JSF_HTML, adapter.getNamespace());
+
+ // verify the TagIdentifier
+ final TagIdentifier tagId = adapter.getTagId();
+ assertNotNull(tagId);
+ assertEquals(ITLDConstants.URI_JSF_HTML, tagId.getUri());
+ assertEquals(IJSFConstants.TAG_INPUTTEXT, tagId.getTagName());
+ assertEquals(IJSFConstants.TAG_IDENTIFIER_INPUTTEXT, tagId);
+
+ assertEquals(INPUTTEXT_ATTRIBUTES.size(), adapter.getAttributes()
+ .size());
+ for (final Map.Entry<String, String> entry : INPUTTEXT_ATTRIBUTES
+ .entrySet())
+ {
+ AttrDOMAdapter attrAdapter =
+ adapter.getAttributes().get(
+ entry.getKey());
+ assertNotNull(attrAdapter);
+ assertEquals(entry.getKey(), attrAdapter.getNodeName());
+ assertEquals(entry.getValue(), attrAdapter.getValue());
+ // verify the AttributeIdentifier
+ final AttributeIdentifier attrId =
+ attrAdapter
+ .getAttributeIdentifier();
+ assertNotNull(attrId);
+ assertEquals(tagId, attrId.getTagIdentifier());
+ assertEquals(attrAdapter.getNodeName(), attrId.getName());
+ }
+
+ }
+
+ /**
+ * Two EL, no non-EL
+ *
+ * @throws Exception
+ */
+ public void testCommandButtonWithTwoEL() throws Exception
+ {
+ final IndexedRegion region =
+ JSFTestUtil.getIndexedRegion(_sdoc,
+ OFFSET_COMMANDBUTTON_WITH_TWO_EL);
+ final IDOMNode domNode = (IDOMNode) region;
+
+ final ITextRegion textRegion =
+ domNode
+ .getFirstStructuredDocumentRegion();
+ final Region2ElementAdapter adapter =
+ new Region2ElementAdapter(
+ textRegion);
+
+ // verify element
+ assertEquals("h:commandButton", adapter.getNodeName());
+ assertEquals("commandButton", adapter.getLocalName());
+ assertEquals("h", adapter.getPrefix());
+ assertEquals(ITLDConstants.URI_JSF_HTML, adapter.getNamespace());
+
+ // verify the TagIdentifier
+ final TagIdentifier tagId = adapter.getTagId();
+ assertNotNull(tagId);
+ assertEquals(ITLDConstants.URI_JSF_HTML, tagId.getUri());
+ assertEquals(IJSFConstants.TAG_COMMANDBUTTON, tagId.getTagName());
+ assertEquals(IJSFConstants.TAG_IDENTIFIER_COMMANDBUTTON, tagId);
+
+ assertEquals(COMMANDBUTTON_ATTRIBUTES.size(), adapter.getAttributes()
+ .size());
+ for (final Map.Entry<String, String> entry : COMMANDBUTTON_ATTRIBUTES
+ .entrySet())
+ {
+ AttrDOMAdapter attrAdapter =
+ adapter.getAttributes().get(
+ entry.getKey());
+ assertNotNull(attrAdapter);
+ assertEquals(entry.getKey(), attrAdapter.getNodeName());
+ assertEquals(entry.getValue(), attrAdapter.getValue());
+ // verify the AttributeIdentifier
+ final AttributeIdentifier attrId =
+ attrAdapter
+ .getAttributeIdentifier();
+ assertNotNull(attrId);
+ assertEquals(tagId, attrId.getTagIdentifier());
+ assertEquals(attrAdapter.getNodeName(), attrId.getName());
+ }
+ }
+
+ /**
+ * Ensure that we can pass the element or attribute adapter back and get the
+ * corresponding region
+ */
+ public void testAdapterToRegionMappings() throws Exception
+ {
+ final IndexedRegion region =
+ JSFTestUtil.getIndexedRegion(_sdoc,
+ OFFSET_INPUTTEXT_WITH_BOTH);
+ final IDOMNode domNode = (IDOMNode) region;
+
+ final ITextRegion textRegion =
+ domNode
+ .getFirstStructuredDocumentRegion();
+ final Region2ElementAdapter adapter =
+ new Region2ElementAdapter(
+ textRegion);
+
+ assertEquals(OFFSET_INPUTTEXT_WITH_BOTH, adapter.getTextRegion()
+ .getStart());
+
+ assertEquals(textRegion, adapter.getTextRegion());
+
+ Region2AttrAdapter attrAdapter = adapter.getAttributes().get("id");
+ assertEquals(OFFSET_INPUTTEXT_WITH_BOTH+13, attrAdapter.getStartOffset());
+ assertExpectedAttributeName(attrAdapter, 13, 2);
+ // length is 9 instead of 8 because of trailing whitespace
+ assertExpectedAttributeValue(attrAdapter, 16, 9);
+
+ attrAdapter = adapter.getAttributes().get("value");
+ assertEquals(OFFSET_INPUTTEXT_WITH_BOTH+25, attrAdapter.getStartOffset());
+ assertExpectedAttributeName(attrAdapter, 25, 5);
+ // length is 9 instead of 8 because of trailing whitespace
+ assertExpectedAttributeValue(attrAdapter, 31, 20);
+ }
+
+ private void assertExpectedAttributeName(
+ final Region2AttrAdapter attrAdapter, final int expectedStart,
+ final int expectedLength)
+ {
+ final ITextRegion nameRegion = attrAdapter.getAttributeNameRegion();
+ assertEquals(expectedStart, nameRegion.getStart());
+ assertEquals(expectedLength, nameRegion.getLength());
+ }
+
+ private void assertExpectedAttributeValue(
+ final Region2AttrAdapter attrAdapter, final int expectedStart,
+ final int expectedLength)
+ {
+ final ITextRegion valueRegion = attrAdapter.getAttributeValueRegion();
+ assertEquals(expectedStart, valueRegion.getStart());
+ assertEquals(expectedLength, valueRegion.getLength());
+
+ }
+
+ private void assertExpectedTag(final int offset, final String prefix,
+ final String tagName, final String uri)
+ {
+ final IndexedRegion region =
+ JSFTestUtil
+ .getIndexedRegion(_sdoc, offset);
+ assertTrue(region instanceof IDOMElement);
+
+ assertEquals(prefix + ":" + tagName, ((IDOMElement) region)
+ .getNodeName());
+ assertEquals(tagName, ((IDOMElement) region).getLocalName());
+ assertEquals(prefix, ((IDOMElement) region).getPrefix());
+ }
+
+ private void assertExpectedAttributes(final int offset,
+ final Map<String, String> attributes)
+ {
+ final IndexedRegion region =
+ JSFTestUtil
+ .getIndexedRegion(_sdoc, offset);
+ assertTrue(region instanceof IDOMElement);
+
+ final IDOMElement domElement = (IDOMElement) region;
+
+ assertExpectedAttributes(new Iterator<Node>()
+ {
+ int curElement = 0;
+
+ public boolean hasNext()
+ {
+ return (curElement < domElement.getAttributes().getLength());
+ }
+
+ public Node next()
+ {
+ return domElement.getAttributes().item(curElement++);
+ }
+
+ public void remove()
+ {
+ throw new UnsupportedOperationException("");
+
+ }
+
+ }, attributes);
+ }
+
+ private void assertExpectedAttributes(final Iterator<Node> check,
+ final Map<String, String> expectedAttributes)
+ {
+ int count = 0;
+ for (; check.hasNext();)
+ {
+ Node node = check.next();
+ assertTrue(expectedAttributes.containsKey(node.getNodeName()));
+ assertEquals(expectedAttributes.get(node.getNodeName()), node
+ .getNodeValue());
+ count++;
+ }
+ assertEquals(expectedAttributes.size(), count);
+ }
+}
diff --git a/jsf/tests/org.eclipse.jst.jsf.core.tests/src/org/eclipse/jst/jsf/core/tests/validation/MockIReporter.java b/jsf/tests/org.eclipse.jst.jsf.core.tests/src/org/eclipse/jst/jsf/core/tests/validation/MockIReporter.java
index 601fda1..80cf72f 100644
--- a/jsf/tests/org.eclipse.jst.jsf.core.tests/src/org/eclipse/jst/jsf/core/tests/validation/MockIReporter.java
+++ b/jsf/tests/org.eclipse.jst.jsf.core.tests/src/org/eclipse/jst/jsf/core/tests/validation/MockIReporter.java
@@ -14,58 +14,59 @@
class MockIReporter implements IReporter
{
- List<IMessage> _messages = new ArrayList<IMessage>();
- Map<Integer, List<IMessage>> _messagesByOffset = new TreeMap<Integer, List<IMessage>>();
-
- public void addMessage(IValidator origin, IMessage message)
- {
- _messages.add(message);
-
- // index the message by offset
- getMessageListForOffset(message.getOffset()).add(message);
- }
+ private List<IMessage> _messages = new ArrayList<IMessage>();
+ private Map<Integer, List<IMessage>> _messagesByOffset =
+ new TreeMap<Integer, List<IMessage>>();
- public void displaySubtask(IValidator validator, IMessage message) {
- // do nothing, might eventually want to log this
- }
+ public void addMessage(final IValidator origin, final IMessage message)
+ {
+ _messages.add(message);
- public List<IMessage> getMessageListForOffset(int offset)
- {
- List<IMessage> messages = _messagesByOffset.get(offset);
-
- if (messages == null)
- {
- messages = new ArrayList<IMessage>();
- _messagesByOffset.put(offset, messages);
- }
-
- return messages;
- }
-
- @SuppressWarnings("unchecked")
+ // index the message by offset
+ getMessageListForOffset(message.getOffset()).add(message);
+ }
+
+ public void displaySubtask(final IValidator validator, final IMessage message) {
+ // do nothing, might eventually want to log this
+ }
+
+ public List<IMessage> getMessageListForOffset(final int offset)
+ {
+ List<IMessage> messages = _messagesByOffset.get(offset);
+
+ if (messages == null)
+ {
+ messages = new ArrayList<IMessage>();
+ _messagesByOffset.put(offset, messages);
+ }
+
+ return messages;
+ }
+
+ @SuppressWarnings("unchecked")
public List getMessages() {
- return _messages;
- }
+ return _messages;
+ }
- public boolean isCancelled() {
- // do nothing; unused.
- return false;
- }
+ public boolean isCancelled() {
+ // do nothing; unused.
+ return false;
+ }
- public void removeAllMessages(IValidator origin)
- {
- throw new UnsupportedOperationException("This reporter is for specific test purposes only");
- }
+ public void removeAllMessages(final IValidator origin)
+ {
+ throw new UnsupportedOperationException("This reporter is for specific test purposes only");
+ }
- public void removeAllMessages(IValidator origin, Object object)
- {
- throw new UnsupportedOperationException("This reporter is for specific test purposes only");
- }
+ public void removeAllMessages(final IValidator origin, final Object object)
+ {
+ throw new UnsupportedOperationException("This reporter is for specific test purposes only");
+ }
- public void removeMessageSubset(IValidator validator, Object obj,
- String groupName)
- {
- throw new UnsupportedOperationException("This reporter is for specific test purposes only");
- }
-
+ public void removeMessageSubset(final IValidator validator, final Object obj,
+ final String groupName)
+ {
+ throw new UnsupportedOperationException("This reporter is for specific test purposes only");
+ }
+
}
\ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.core.tests/src/org/eclipse/jst/jsf/core/tests/validation/MockValidationReporter.java b/jsf/tests/org.eclipse.jst.jsf.core.tests/src/org/eclipse/jst/jsf/core/tests/validation/MockValidationReporter.java
new file mode 100644
index 0000000..a32b039
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.core.tests/src/org/eclipse/jst/jsf/core/tests/validation/MockValidationReporter.java
@@ -0,0 +1,141 @@
+package org.eclipse.jst.jsf.core.tests.validation;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.jst.jsf.validation.internal.IJSFViewValidator.ReporterAdapter;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class MockValidationReporter extends ReporterAdapter
+{
+ private final List<ReportedProblem> _reportedProblems;
+ private Map<Integer, List<ReportedProblem>> _messagesByOffset =
+ new TreeMap<Integer, List<ReportedProblem>>();
+
+ public MockValidationReporter()
+ {
+ _reportedProblems = new ArrayList<ReportedProblem>();
+ }
+
+ @Override
+ public void report(Diagnostic diagnostic, int start, int length)
+ {
+ ReportedProblem problem = new ReportedProblem(diagnostic,start,length);
+ _reportedProblems.add(problem);
+
+ // index the message by offset
+ getMessageListForOffset(start).add(problem);
+ }
+
+ @Override
+ public void report(IMessage message)
+ {
+ final ReportedProblem problem = new ReportedProblem(message);
+ _reportedProblems.add(problem);
+
+ // index the message by offset
+ getMessageListForOffset(message.getOffset()).add(problem);
+ }
+
+ public void reset()
+ {
+ _reportedProblems.clear();
+ _messagesByOffset.clear();
+ }
+
+ public List<ReportedProblem> getReportedProblems()
+ {
+ return Collections.unmodifiableList(_reportedProblems);
+ }
+
+ public List<ReportedProblem> getMessageListForOffset(final int offset)
+ {
+ List<ReportedProblem> messages = _messagesByOffset.get(offset);
+
+ if (messages == null)
+ {
+ messages = new ArrayList<ReportedProblem>();
+ _messagesByOffset.put(offset, messages);
+ }
+
+ return messages;
+ }
+
+
+ public static class ReportedProblem
+ {
+ private final int _offset;
+ private final int _length;
+ private final int _severity;
+ private final String _text;
+ private final int _errorCode;
+
+ public ReportedProblem(final Diagnostic problem, final int start, final int length)
+ {
+ _severity = convertSeverity(problem);
+ _offset = start;
+ _length = length;
+ _text = problem.getMessage();
+ _errorCode = problem.getCode();
+ }
+
+ private ReportedProblem(final IMessage message)
+ {
+ _severity = message.getSeverity();
+ _offset = message.getOffset();
+ _length = message.getLength();
+ _text = message.getText();
+ _errorCode = -1;
+ }
+
+ /**
+ * @param severity
+ * @return a Message severity equivilent to diagnostic.getSeverity()
+ */
+ private static int convertSeverity(final Diagnostic problem)
+ {
+ switch (problem.getSeverity())
+ {
+ case Diagnostic.ERROR:
+ return IMessage.HIGH_SEVERITY;
+ case Diagnostic.WARNING:
+ return IMessage.NORMAL_SEVERITY;
+ case Diagnostic.INFO:
+ return IMessage.LOW_SEVERITY;
+ case Diagnostic.OK:
+ default:
+ // no bits set
+ return 0;
+ }
+ }
+
+ public int getOffset()
+ {
+ return _offset;
+ }
+
+ public int getLength()
+ {
+ return _length;
+ }
+
+ public int getSeverity()
+ {
+ return _severity;
+ }
+
+ public String getText()
+ {
+ return _text;
+ }
+
+ public int getErrorCode()
+ {
+ return _errorCode;
+ }
+ }
+}
diff --git a/jsf/tests/org.eclipse.jst.jsf.core.tests/src/org/eclipse/jst/jsf/core/tests/validation/TestJSPSemanticsValidator_AttributeValues.java b/jsf/tests/org.eclipse.jst.jsf.core.tests/src/org/eclipse/jst/jsf/core/tests/validation/TestJSPSemanticsValidator_AttributeValues.java
index ebc00ac..14370ab 100644
--- a/jsf/tests/org.eclipse.jst.jsf.core.tests/src/org/eclipse/jst/jsf/core/tests/validation/TestJSPSemanticsValidator_AttributeValues.java
+++ b/jsf/tests/org.eclipse.jst.jsf.core.tests/src/org/eclipse/jst/jsf/core/tests/validation/TestJSPSemanticsValidator_AttributeValues.java
@@ -1,7 +1,6 @@
package org.eclipse.jst.jsf.core.tests.validation;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import java.util.zip.ZipFile;
@@ -12,16 +11,17 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.jst.common.project.facet.JavaFacetUtils;
import org.eclipse.jst.jsf.core.tests.TestsPlugin;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.test.util.JSFTestUtil;
import org.eclipse.jst.jsf.test.util.WebProjectTestEnvironment;
-import org.eclipse.jst.jsf.validation.internal.JSPSemanticsValidator;
+import org.eclipse.jst.jsf.validation.internal.XMLViewDefnValidator;
import org.eclipse.jst.jsp.core.internal.domdocument.DOMModelForJSP;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.eclipse.wst.sse.core.StructuredModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-public class TestJSPSemanticsValidator_AttributeValues extends TestCase
+public class TestJSPSemanticsValidator_AttributeValues extends TestCase
{
private WebProjectTestEnvironment _webProject;
@@ -32,7 +32,7 @@
JSFTestUtil.setValidationEnabled(false);
JSFTestUtil.setInternetProxyPreferences(true, "www-proxy.uk.oracle.com", "80");
-
+
final ZipFile zipFile = JSFTestUtil.createZipFile(TestsPlugin.getDefault().getBundle()
, "/testfiles/testzips/ValidationTestProject1.zip");
@@ -42,114 +42,110 @@
public void testSanity() throws Exception
{
- final IProject project = _webProject.getTestProject();
- assertNotNull(project);
- assertTrue(project.isAccessible());
-
- final IFile jspFile = project.getFile(new Path("WebContent/NonELValidation.jsp"));
- assertTrue(jspFile.isAccessible());
+ final IProject project = _webProject.getTestProject();
+ assertNotNull(project);
+ assertTrue(project.isAccessible());
- IStructuredModel jspModel = null;
- try
- {
- jspModel = StructuredModelManager.getModelManager().getModelForRead(jspFile);
- assert(jspModel instanceof DOMModelForJSP);
- }
- finally
- {
- if (jspModel != null)
- {
- jspModel.releaseFromRead();
- }
- }
+ final IFile jspFile = project.getFile(new Path("WebContent/NonELValidation.jsp"));
+ assertTrue(jspFile.isAccessible());
+
+ IStructuredModel jspModel = null;
+ try
+ {
+ jspModel = StructuredModelManager.getModelManager().getModelForRead(jspFile);
+ assert(jspModel instanceof DOMModelForJSP);
+ }
+ finally
+ {
+ if (jspModel != null)
+ {
+ jspModel.releaseFromRead();
+ }
+ }
}
-
+
public void testNonELValidation() throws Exception
{
- final IProject project = _webProject.getTestProject();
- assertNotNull(project);
- assertTrue(project.isAccessible());
-
- final IFile jspFile = project.getFile(new Path("WebContent/NonELValidation.jsp"));
- assertTrue(jspFile.isAccessible());
+ final IProject project = _webProject.getTestProject();
+ assertNotNull(project);
+ assertTrue(project.isAccessible());
- final MockIReporter mockReporter = new MockIReporter();
- final MockIValidationContext validationContext =
- new MockIValidationContext(Collections.singletonList(jspFile));
- JSPSemanticsValidator validator = new JSPSemanticsValidator();
- validator.validate(validationContext, mockReporter);
-
- // there should only be 3, but because we don't want to have the jars
- // in the path, we trigger a containment warning on the loadBundle
- // since the f:view in the doc can't be fully resolved.
- assertEquals(4, mockReporter.getMessages().size());
-
- assertExpectedMessage(mockReporter, 591, 25, IMessage.HIGH_SEVERITY);
- assertExpectedMessage(mockReporter, 936, 1, IMessage.NORMAL_SEVERITY);
- assertExpectedMessage(mockReporter, 969, 9, IMessage.NORMAL_SEVERITY);
+ final IFile jspFile = project.getFile(new Path("WebContent/NonELValidation.jsp"));
+ assertTrue(jspFile.isAccessible());
+
+ final MockValidationReporter mockReporter = new MockValidationReporter();
+ final XMLViewDefnValidator validator = new XMLViewDefnValidator();
+ validator.validateView(jspFile, mockReporter);
+
+ // there should only be 3, but because we don't want to have the jars
+ // in the path, we trigger a containment warning on the loadBundle
+ // since the f:view in the doc can't be fully resolved.
+ assertEquals(4, mockReporter.getReportedProblems().size());
+
+ assertExpectedMessage(mockReporter, 591, 25, IMessage.HIGH_SEVERITY);
+ assertExpectedMessage(mockReporter, 936, 1, IMessage.NORMAL_SEVERITY);
+ assertExpectedMessage(mockReporter, 969, 9, IMessage.NORMAL_SEVERITY);
}
-
+
public void testELValidation() throws Exception
{
- final IProject project = _webProject.getTestProject();
- assertNotNull(project);
- assertTrue(project.isAccessible());
-
- final IFile jspFile = project.getFile(new Path("WebContent/ELValidation.jsp"));
- assertTrue(jspFile.isAccessible());
+ final IProject project = _webProject.getTestProject();
+ assertNotNull(project);
+ assertTrue(project.isAccessible());
- final MockIReporter mockReporter = new MockIReporter();
- final MockIValidationContext validationContext =
- new MockIValidationContext(Collections.singletonList(jspFile));
- JSPSemanticsValidator validator = new JSPSemanticsValidator();
- validator.validate(validationContext, mockReporter);
-
- // there should only be 5, but because we don't want to have the jars
- // in the path, we trigger a containment warning on the loadBundle
- // since the f:view in the doc can't be fully resolved.
- // at 845 we also get two, one for syntax error and one for missing bracket
- assertEquals(9, mockReporter.getMessages().size());
-
- assertExpectedMessage(mockReporter, 603, 2, IMessage.NORMAL_SEVERITY);
- assertExpectedMessage(mockReporter, 649, 1, IMessage.NORMAL_SEVERITY);
- assertExpectedMessage(mockReporter, 696, 5, IMessage.NORMAL_SEVERITY);
- assertExpectedMessage(mockReporter, 753, 6, IMessage.NORMAL_SEVERITY);
- assertExpectedMessage(mockReporter, 801, 4, IMessage.HIGH_SEVERITY);
+ final IFile jspFile = project.getFile(new Path("WebContent/ELValidation.jsp"));
+ assertTrue(jspFile.isAccessible());
- // two on this one: syntax error and missing bracket
- assertExpectedMessage(mockReporter, 845, 5, IMessage.HIGH_SEVERITY);
- assertExpectedMessage(mockReporter, 848, 1, IMessage.NORMAL_SEVERITY);
-
- assertExpectedMessage(mockReporter, 963, 40, IMessage.HIGH_SEVERITY);
+ final MockValidationReporter mockReporter = new MockValidationReporter();
+ final XMLViewDefnValidator validator = new XMLViewDefnValidator();
+ validator.validateView(jspFile, mockReporter);
+
+ // there should only be 5, but because we don't want to have the jars
+ // in the path, we trigger a containment warning on the loadBundle
+ // since the f:view in the doc can't be fully resolved.
+ // at 845 we also get two, one for syntax error and one for missing bracket
+ assertEquals(9, mockReporter.getReportedProblems().size());
+
+ assertExpectedMessage(mockReporter, 603, 2, IMessage.NORMAL_SEVERITY);
+ assertExpectedMessage(mockReporter, 649, 1, IMessage.NORMAL_SEVERITY);
+ assertExpectedMessage(mockReporter, 696, 5, IMessage.NORMAL_SEVERITY);
+ assertExpectedMessage(mockReporter, 753, 6, IMessage.NORMAL_SEVERITY);
+ assertExpectedMessage(mockReporter, 802, 4, IMessage.HIGH_SEVERITY);
+
+ // two on this one: syntax error and missing bracket
+ assertExpectedMessage(mockReporter, 846, 5, IMessage.HIGH_SEVERITY);
+ assertExpectedMessage(mockReporter, 848, 1, IMessage.NORMAL_SEVERITY);
+
+ assertExpectedMessage(mockReporter, 963, 40, IMessage.HIGH_SEVERITY);
}
- private void assertExpectedMessage(final MockIReporter reporter,
- final int offset, final int length, final int severity)
+ private void assertExpectedMessage(final MockValidationReporter reporter,
+ final int offset, final int length, final int severity)
{
- final List<IMessage> messages = reporter.getMessageListForOffset(offset);
- final List<IMessage> messagesNotMatching = new ArrayList<IMessage>();
-
- assertTrue(messages.size() > 0);
+ final List<ReportedProblem> reportedProblems = reporter.getMessageListForOffset(offset);
+ final List<ReportedProblem> reportedProblemsNotMatching = new ArrayList<ReportedProblem>();
- for (final IMessage message : messages)
- {
- if (message.getLength() == length && message.getSeverity() == severity)
- {
- // we found the expected message
- return;
- }
- else
- {
- messagesNotMatching.add(message);
- }
- }
+ assertTrue(reportedProblems.size() > 0);
- String failMessage = "";
+ for (final ReportedProblem problem : reportedProblems)
+ {
+ if (problem.getLength() == length && problem.getSeverity() == severity)
+ {
+ // we found the expected message
+ return;
+ }
+ else
+ {
+ reportedProblemsNotMatching.add(problem);
+ }
+ }
- for (final IMessage message : messages)
- {
- failMessage += "\n" + message.getText();
- }
- fail(String.format("Failed to find expected message at offset %d, found instead %s", offset, failMessage));
+ String failMessage = "";
+
+ for (final ReportedProblem problem : reportedProblems)
+ {
+ failMessage += "\n" + problem.getText();
+ }
+ fail(String.format("Failed to find expected message at offset %d, found instead %s", offset, failMessage));
}
}
diff --git a/jsf/tests/org.eclipse.jst.jsf.core.tests/src/org/eclipse/jst/jsf/core/tests/validation/TestJSPSemanticsValidator_Containment.java b/jsf/tests/org.eclipse.jst.jsf.core.tests/src/org/eclipse/jst/jsf/core/tests/validation/TestJSPSemanticsValidator_Containment.java
index 140b6b2..1f8468e 100644
--- a/jsf/tests/org.eclipse.jst.jsf.core.tests/src/org/eclipse/jst/jsf/core/tests/validation/TestJSPSemanticsValidator_Containment.java
+++ b/jsf/tests/org.eclipse.jst.jsf.core.tests/src/org/eclipse/jst/jsf/core/tests/validation/TestJSPSemanticsValidator_Containment.java
@@ -4,22 +4,29 @@
import junit.framework.TestCase;
import org.eclipse.core.resources.IFile;
-import org.eclipse.jst.jsf.context.resolver.structureddocument.IDOMContextResolver;
-import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory;
import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext;
import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory;
import org.eclipse.jst.jsf.core.IJSFCoreConstants;
+import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
+import org.eclipse.jst.jsf.core.internal.region.Region2ElementAdapter;
import org.eclipse.jst.jsf.core.internal.tld.CMUtil;
import org.eclipse.jst.jsf.core.internal.tld.IJSFConstants;
-import org.eclipse.jst.jsf.core.internal.tld.ITLDConstants;
import org.eclipse.jst.jsf.core.tests.TestsPlugin;
import org.eclipse.jst.jsf.core.tests.util.JSFFacetedTestEnvironment;
+import org.eclipse.jst.jsf.designtime.DTAppManagerUtil;
+import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler;
+import org.eclipse.jst.jsf.test.util.JSFTestUtil;
import org.eclipse.jst.jsf.test.util.WebProjectTestEnvironment;
-import org.eclipse.jst.jsf.validation.internal.IJSPSemanticValidatorTest;
-import org.eclipse.jst.jsf.validation.internal.JSPSemanticsValidator;
+import org.eclipse.jst.jsf.validation.internal.JSFValidationContext;
+import org.eclipse.jst.jsf.validation.internal.ValidationPreferences;
+import org.eclipse.jst.jsf.validation.internal.IJSFViewValidator.IValidationReporter;
+import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
+import org.eclipse.jst.jsf.validation.internal.strategy.ContainmentValidatingStrategy;
import org.eclipse.wst.sse.core.StructuredModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -32,13 +39,13 @@
*/
public class TestJSPSemanticsValidator_Containment extends TestCase
{
- private WebProjectTestEnvironment _testEnv;
- private IFile _jspFile;
- private IFile _jspFragmentFile;
- private IStructuredModel _jspStructuredModel;
- private IStructuredDocument _jspStructuredDocument;
- private IStructuredModel _jspFragStructuredModel;
- private IStructuredDocument _jspFragStructuredDocument;
+ private WebProjectTestEnvironment _testEnv;
+ private IFile _jspFile;
+ private IFile _jspFragmentFile;
+ private IStructuredModel _jspStructuredModel;
+ private IStructuredDocument _jspStructuredDocument;
+ private IStructuredModel _jspFragStructuredModel;
+ private IStructuredDocument _jspFragStructuredDocument;
@Override
@@ -92,77 +99,109 @@
}
}
- public void testContainmentInJSP()
+ public void testContainmentInJSP() throws Exception
{
// instantiate the validator once since this is how it would
// called against a single file. This is critical to test
// that only the first instance of improper containment
// gets flagged.
- final IJSPSemanticValidatorTest validator =
- new JSPSemanticsValidator().getTestInterface();
+ final MockValidationReporter reporter = new MockValidationReporter();
+ final ContainmentValidatingStrategy validator =
+ createContainmentValidator(_jspFile, reporter);
final IStructuredDocumentContext correctlyNested =
IStructuredDocumentContextFactory.INSTANCE
- .getContext(_jspStructuredDocument, 487);
+ .getContext(_jspStructuredDocument, 487);
+ checkTag(correctlyNested, validator, reporter, 0);
+ reporter.reset();
final IStructuredDocumentContext firstIncorrectlyNested =
IStructuredDocumentContextFactory.INSTANCE
- .getContext(_jspStructuredDocument, 538);
+ .getContext(_jspStructuredDocument, 538);
+ checkTag(firstIncorrectlyNested, validator, reporter, 1);
+ reporter.reset();
final IStructuredDocumentContext secondIncorrectlyNested =
IStructuredDocumentContextFactory.INSTANCE
- .getContext(_jspStructuredDocument, 568);
- checkTag(correctlyNested, validator, _jspFile, 0);
- checkTag(firstIncorrectlyNested, validator, _jspFile, 1);
- checkTag(secondIncorrectlyNested, validator, _jspFile, 0);
+ .getContext(_jspStructuredDocument, 568);
+ checkTag(secondIncorrectlyNested, validator, reporter, 0);
+ reporter.reset();
}
- public void testContainmentInJSPFrag()
+ public void testContainmentInJSPFrag() throws Exception
{
// instantiate the validator once since this is how it would
// called against a single file. This is critical to test
// that only the first instance of improper containment
// gets flagged.
- final IJSPSemanticValidatorTest validator =
- new JSPSemanticsValidator().getTestInterface();
+ final MockValidationReporter reporter = new MockValidationReporter();
+ final ContainmentValidatingStrategy validator =
+ createContainmentValidator(_jspFragmentFile, reporter);
- final IStructuredDocumentContext correctlyNested =
- IStructuredDocumentContextFactory.INSTANCE
- .getContext(_jspFragStructuredDocument, 487);
+ { // should all be zero, since no contain validation in jsp frags
+ final IStructuredDocumentContext correctlyNested =
+ IStructuredDocumentContextFactory.INSTANCE
+ .getContext(_jspFragStructuredDocument, 487);
+ checkTag(correctlyNested, validator, reporter, 0);
+ reporter.reset();
+ }
- final IStructuredDocumentContext firstIncorrectlyNested =
- IStructuredDocumentContextFactory.INSTANCE
- .getContext(_jspFragStructuredDocument, 538);
-
- final IStructuredDocumentContext secondIncorrectlyNested =
- IStructuredDocumentContextFactory.INSTANCE
- .getContext(_jspFragStructuredDocument, 568);
-
- // should all be zero, since no contain validation in jsp frags
- checkTag(correctlyNested, validator, _jspFragmentFile, 0);
- checkTag(firstIncorrectlyNested, validator, _jspFragmentFile, 0);
- checkTag(secondIncorrectlyNested, validator, _jspFragmentFile, 0);
+ { // should all be zero, since no contain validation in jsp frags
+ final IStructuredDocumentContext firstIncorrectlyNested =
+ IStructuredDocumentContextFactory.INSTANCE
+ .getContext(_jspFragStructuredDocument, 538);
+ checkTag(firstIncorrectlyNested, validator, reporter, 0);
+ reporter.reset();
+ }
+
+ { // should all be zero, since no contain validation in jsp frags
+ final IStructuredDocumentContext secondIncorrectlyNested =
+ IStructuredDocumentContextFactory.INSTANCE
+ .getContext(_jspFragStructuredDocument, 568);
+ checkTag(secondIncorrectlyNested, validator, reporter, 0);
+ reporter.reset();
+ }
}
private void checkTag(final IStructuredDocumentContext context
- , final IJSPSemanticValidatorTest validator
- , final IFile file
- , final int expectedCount)
+ , final ContainmentValidatingStrategy validator
+ , MockValidationReporter reporter
+ , final int expectedCount) throws Exception
{
- final IDOMContextResolver resolver =
- IStructuredDocumentContextResolverFactory.INSTANCE
- .getDOMContextResolver(context);
+ final IndexedRegion region = JSFTestUtil.getIndexedRegion
+ ((IStructuredDocument) context.getStructuredDocument()
+ , context.getDocumentPosition());
- final Node node = resolver.getNode();
+ final IDOMNode domNode = (IDOMNode) region;
+ final Node node = (Node) region;
assertTrue(node instanceof Element);
final Element elem = (Element) node;
assertEquals(IJSFConstants.TAG_INPUTTEXT, elem.getLocalName());
System.out.println(CMUtil.getElementNamespaceURI(elem));
- final MockIReporter reporter = new MockIReporter();
- validator.validateContainment(elem, ITLDConstants.URI_JSF_HTML
- , IJSFConstants.TAG_INPUTTEXT, reporter, file, context);
+ validator.validate(
+ new Region2ElementAdapter(domNode.getFirstStructuredDocumentRegion()));
- assertEquals(expectedCount, reporter.getMessages().size());
+ assertEquals(expectedCount, reporter.getReportedProblems().size());
+ }
+
+ private ContainmentValidatingStrategy createContainmentValidator(final IFile file,
+ IValidationReporter reporter)
+ {
+ final ValidationPreferences prefs = new ValidationPreferences(
+ JSFCorePlugin.getDefault().getPreferenceStore());
+ prefs.load();
+ final DiagnosticFactory diagnosticFactory = new DiagnosticFactory();
+
+ final IDTViewHandler viewHandler = DTAppManagerUtil
+ .getViewHandler(file.getProject());
+
+ final JSFValidationContext validationContext =
+ new JSFValidationContext(
+ false, prefs, viewHandler,
+ diagnosticFactory, file, reporter,
+ null);
+
+ return new ContainmentValidatingStrategy(validationContext);
}
}
diff --git a/jsf/tests/org.eclipse.jst.jsf.core.tests/testfiles/jsps/NonELAttributeValues.jsp.data b/jsf/tests/org.eclipse.jst.jsf.core.tests/testfiles/jsps/NonELAttributeValues.jsp.data
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.core.tests/testfiles/jsps/NonELAttributeValues.jsp.data
diff --git a/jsf/tests/org.eclipse.jst.jsf.designtime.tests/META-INF/MANIFEST.MF b/jsf/tests/org.eclipse.jst.jsf.designtime.tests/META-INF/MANIFEST.MF
index 8121979..8b2d11e 100644
--- a/jsf/tests/org.eclipse.jst.jsf.designtime.tests/META-INF/MANIFEST.MF
+++ b/jsf/tests/org.eclipse.jst.jsf.designtime.tests/META-INF/MANIFEST.MF
@@ -30,7 +30,7 @@
org.eclipse.jst.jsp.core,
org.eclipse.wst.xml.core,
org.eclipse.jst.jsf.common.runtime.tests
-Eclipse-LazyStart: true
+Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.eclipse.jst.jsf.designtime.tests;x-internal:=true
Bundle-Vendor: %Bundle-Vendor.0
diff --git a/jsf/tests/org.eclipse.jst.jsf.designtime.tests/src/org/eclipse/jst/jsf/designtime/tests/AllTests.java b/jsf/tests/org.eclipse.jst.jsf.designtime.tests/src/org/eclipse/jst/jsf/designtime/tests/AllTests.java
index b641353..d0068c0 100644
--- a/jsf/tests/org.eclipse.jst.jsf.designtime.tests/src/org/eclipse/jst/jsf/designtime/tests/AllTests.java
+++ b/jsf/tests/org.eclipse.jst.jsf.designtime.tests/src/org/eclipse/jst/jsf/designtime/tests/AllTests.java
@@ -11,6 +11,8 @@
********************************************************************************/
package org.eclipse.jst.jsf.designtime.tests;
+import org.eclipse.jst.jsf.designtime.tests.views.TestJSPViewDefnAdapter;
+
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -70,6 +72,7 @@
suite.addTestSuite(TestJSPModelProcessor.class);
suite.addTestSuite(TestStartupHandler.class);
suite.addTestSuite(TestDesignTimeApplicationManager.class);
+ suite.addTestSuite(TestJSPViewDefnAdapter.class);
//addTestSuite(suite, JSPViewSuite.class);
diff --git a/jsf/tests/org.eclipse.jst.jsf.designtime.tests/src/org/eclipse/jst/jsf/designtime/tests/TestStartupHandler.java b/jsf/tests/org.eclipse.jst.jsf.designtime.tests/src/org/eclipse/jst/jsf/designtime/tests/TestStartupHandler.java
index 0183522..d99c331 100644
--- a/jsf/tests/org.eclipse.jst.jsf.designtime.tests/src/org/eclipse/jst/jsf/designtime/tests/TestStartupHandler.java
+++ b/jsf/tests/org.eclipse.jst.jsf.designtime.tests/src/org/eclipse/jst/jsf/designtime/tests/TestStartupHandler.java
@@ -117,7 +117,7 @@
// close project with with user action
final CloseResourceAction action =
new CloseResourceAction(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell())
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow())
{
public void superRun()
{
diff --git a/jsf/tests/org.eclipse.jst.jsf.designtime.tests/src/org/eclipse/jst/jsf/designtime/tests/views/TestJSPViewDefnAdapter.java b/jsf/tests/org.eclipse.jst.jsf.designtime.tests/src/org/eclipse/jst/jsf/designtime/tests/views/TestJSPViewDefnAdapter.java
new file mode 100644
index 0000000..4410b83
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.designtime.tests/src/org/eclipse/jst/jsf/designtime/tests/views/TestJSPViewDefnAdapter.java
@@ -0,0 +1,221 @@
+package org.eclipse.jst.jsf.designtime.tests.views;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jst.common.project.facet.JavaFacetUtils;
+import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory;
+import org.eclipse.jst.jsf.context.resolver.structureddocument.internal.ITextRegionContextResolver;
+import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext;
+import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory;
+import org.eclipse.jst.jsf.core.JSFVersion;
+import org.eclipse.jst.jsf.core.tests.util.JSFFacetedTestEnvironment;
+import org.eclipse.jst.jsf.designtime.DesignTimeApplicationManager;
+import org.eclipse.jst.jsf.designtime.context.DTFacesContext;
+import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler;
+import org.eclipse.jst.jsf.designtime.internal.view.XMLViewDefnAdapter;
+import org.eclipse.jst.jsf.designtime.internal.view.XMLViewDefnAdapter.DTELExpression;
+import org.eclipse.jst.jsf.designtime.tests.DesignTimeTestsPlugin;
+import org.eclipse.jst.jsf.test.util.JSFTestUtil;
+import org.eclipse.jst.jsf.test.util.WebProjectTestEnvironment;
+import org.eclipse.jst.jsp.core.internal.regions.DOMJSPRegionContexts;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
+
+public class TestJSPViewDefnAdapter extends TestCase
+{
+ private final String ENV_JSF_VERSION = "jsfRuntimeVersion";
+
+ private JSFVersion _jsfVersion;
+
+ private WebProjectTestEnvironment _webProjectTestEnv;
+
+ private IFile _jspFile;
+
+ private IStructuredModel _structuredModel;
+
+ private final static ELData EMPTY_EXPR =
+ new ELData(
+ " ",
+ 566);
+ private final static ELData VAR_EXPR =
+ new ELData(
+ "myBean",
+ 599);
+ private final static ELData BEAN_PROP_EXPR =
+ new ELData(
+ "myBean.property",
+ 635);
+ private final static ELData BUILTIN_PROP_EXPR =
+ new ELData(
+ "paramValues.foo",
+ 680);
+ private final static ELData METHOD_EXPR =
+ new ELData(
+ "myBean.actionMethod",
+ 729);
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ JSFTestUtil.setValidationEnabled(false);
+
+ final String version = System.getProperty(ENV_JSF_VERSION);
+
+ if (version == null)
+ {
+ _jsfVersion = JSFVersion.V1_1;
+ }
+ else
+ {
+ _jsfVersion = JSFVersion.valueOfString(version);
+ }
+ // only 1.1 and 1.2 are supported
+ assertTrue(_jsfVersion == JSFVersion.V1_1
+ || _jsfVersion == JSFVersion.V1_2);
+
+ // assertNotNull(JSFCoreUtilHelper.getJSFRuntimeJarsDirectory(_jsfVersion));
+ //
+ final String jst_web_version =
+ (_jsfVersion == JSFVersion.V1_1) ? "2.4"
+ : ((_jsfVersion == JSFVersion.V1_2) ? "2.5" : null);
+ assertNotNull(jst_web_version);
+
+ final String jst_jsf_version = _jsfVersion.toString();
+
+ _webProjectTestEnv =
+ new WebProjectTestEnvironment(getClass().getName() + "_"
+ + getName(), JavaFacetUtils.JAVA_50,
+ ProjectFacetsManager.getProjectFacet("jst.web")
+ .getVersion(jst_web_version));
+
+ _webProjectTestEnv.createProject(false);
+ assertNotNull(_webProjectTestEnv);
+ assertNotNull(_webProjectTestEnv.getTestProject());
+ assertTrue(_webProjectTestEnv.getTestProject().isAccessible());
+
+ final JSFFacetedTestEnvironment jsfFacetedTestEnv =
+ new JSFFacetedTestEnvironment(_webProjectTestEnv);
+ jsfFacetedTestEnv.initialize(jst_jsf_version);
+
+ _jspFile =
+ (IFile) _webProjectTestEnv.loadResourceInWebRoot(
+ DesignTimeTestsPlugin.getDefault().getBundle(),
+ "/testdata/testdata2.jsp.data", "testdata2.jsp");
+
+ _structuredModel =
+ StructuredModelManager.getModelManager().getModelForRead(
+ _jspFile);
+
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+
+ _structuredModel.releaseFromRead();
+ }
+
+ public final void testSanity()
+ {
+ final IStructuredDocument sdoc =
+ _structuredModel.getStructuredDocument();
+ assertNotNull(sdoc);
+
+ EMPTY_EXPR.assertELText(sdoc);
+ VAR_EXPR.assertELText(sdoc);
+ BEAN_PROP_EXPR.assertELText(sdoc);
+ BUILTIN_PROP_EXPR.assertELText(sdoc);
+ METHOD_EXPR.assertELText(sdoc);
+ }
+
+ public final void testGetELExpressionIModelContext() throws Exception
+ {
+ assertTrue(DesignTimeApplicationManager
+ .hasJSFDesignTime(_webProjectTestEnv.getTestProject()));
+
+ final DesignTimeApplicationManager manager =
+ DesignTimeApplicationManager.getInstance(_webProjectTestEnv
+ .getTestProject());
+ assertNotNull(manager);
+
+ IDTViewHandler handler = manager.getViewHandler();
+ DTFacesContext facesContext = manager.getFacesContext(_jspFile);
+ assertNotNull(facesContext);
+ assertTrue(handler.supportsViewDefinition(_jspFile));
+
+ XMLViewDefnAdapter adapter =
+ (XMLViewDefnAdapter) handler.getViewMetadataAdapterFactory(
+ facesContext).createAdapter(facesContext, "");
+ final IStructuredDocument sdoc = _structuredModel.getStructuredDocument();
+
+ checkELExpression(adapter, sdoc, EMPTY_EXPR);
+ checkELExpression(adapter, sdoc, VAR_EXPR);
+ checkELExpression(adapter, sdoc, BEAN_PROP_EXPR);
+ checkELExpression(adapter, sdoc, BUILTIN_PROP_EXPR);
+ checkELExpression(adapter, sdoc, METHOD_EXPR);
+ }
+
+ private void checkELExpression(final XMLViewDefnAdapter adapter,
+ final IStructuredDocument sdoc, final ELData elData)
+ throws Exception
+ {
+ final String expectedText = elData._expectedText;
+ final int offset = elData._offset;
+
+ // ensure that at ever valid offset in the EL expression, we get a
+ // valid el text back with it's sdoc's offset set to the start offset
+ // of the region.
+ for (int i = 0; i < expectedText.length(); i++)
+ {
+ final IStructuredDocumentContext context =
+ IStructuredDocumentContextFactory.INSTANCE.getContext(sdoc,offset+i);
+ final DTELExpression elExpr = adapter.getELExpression(context);
+
+ assertEquals(expectedText.trim(), elExpr.getText().trim());
+ assertEquals(offset, elExpr.getDocumentContext().getDocumentPosition());
+ }
+ }
+
+ private static class ELData
+ {
+ private final String _expectedText;
+ private final int _offset;
+
+ ELData(final String expectedText, int offset)
+ {
+ _expectedText = expectedText;
+ _offset = offset;
+ }
+
+ IStructuredDocumentContext getContext(IStructuredDocument sdoc)
+ {
+ final IStructuredDocumentContext context =
+ IStructuredDocumentContextFactory.INSTANCE.getContext(sdoc,
+ _offset);
+ assertNotNull(context);
+ return context;
+ }
+
+ String getELText(IStructuredDocument sdoc)
+ {
+ final ITextRegionContextResolver resolver =
+ IStructuredDocumentContextResolverFactory.INSTANCE
+ .getTextRegionResolver(getContext(sdoc));
+
+ assertEquals(DOMJSPRegionContexts.JSP_VBL_CONTENT, resolver
+ .getRegionType());
+ return resolver.getRegionText();
+ }
+
+ void assertELText(IStructuredDocument sdoc)
+ {
+ assertEquals(_expectedText, getELText(sdoc));
+ }
+ }
+}
diff --git a/jsf/tests/org.eclipse.jst.jsf.designtime.tests/src/org/eclipse/jst/jsf/designtime/tests/views/model/jsp/TestTLDNamespace.java b/jsf/tests/org.eclipse.jst.jsf.designtime.tests/src/org/eclipse/jst/jsf/designtime/tests/views/model/jsp/TestTLDNamespace.java
index 2a49d2e..eb9120e 100644
--- a/jsf/tests/org.eclipse.jst.jsf.designtime.tests/src/org/eclipse/jst/jsf/designtime/tests/views/model/jsp/TestTLDNamespace.java
+++ b/jsf/tests/org.eclipse.jst.jsf.designtime.tests/src/org/eclipse/jst/jsf/designtime/tests/views/model/jsp/TestTLDNamespace.java
@@ -4,12 +4,12 @@
import java.util.List;
import java.util.Map;
+import org.eclipse.jst.jsf.common.internal.policy.IdentifierOrderedIteratorPolicy;
import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement;
import org.eclipse.jst.jsf.core.JSFVersion;
import org.eclipse.jst.jsf.core.internal.tld.ITLDConstants;
import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.CompositeTagResolvingStrategy;
import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.DefaultJSPTagResolver;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.IdentifierOrderedIteratorPolicy;
import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDNamespace;
import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TagIntrospectingStrategy;
import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDDocument;
diff --git a/jsf/tests/org.eclipse.jst.jsf.designtime.tests/testdata/testdata2.jsp.data b/jsf/tests/org.eclipse.jst.jsf.designtime.tests/testdata/testdata2.jsp.data
new file mode 100644
index 0000000..d9dc5ea
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.designtime.tests/testdata/testdata2.jsp.data
@@ -0,0 +1,29 @@
+<%@page contentType="text/html"%>
+<%@page pageEncoding="UTF-8"%>
+
+<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>JSP Page</title>
+ </head>
+ <body>
+ <f:view>
+ <h1>JSP Page</h1>
+ <!-- no errors -->
+ <h:outputText value="#{}"/>
+ <h:outputText value="#{ }"/>
+ <h:outputText value="#{myBean}"/>
+ <h:outputText value="#{myBean.property}"/>
+ <h:outputText value="#{paramValues.foo}"/>
+ <h:commandButton action="#{myBean.actionMethod}"/>
+ </f:view>
+ </body>
+</html>
+
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/META-INF/MANIFEST.MF b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/META-INF/MANIFEST.MF
index fba886c..cda141f 100644
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/META-INF/MANIFEST.MF
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/META-INF/MANIFEST.MF
@@ -17,7 +17,7 @@
org.eclipse.jst.jsf.facesconfig;bundle-version="[1.0.0,1.1.0)",
org.eclipse.jst.jsf.test.util;bundle-version="[1.0.0,1.1.0)",
org.eclipse.jst.jsf.core;bundle-version="[1.0.0,1.1.0)"
-Eclipse-LazyStart: true
+Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.eclipse.jst.jsf.facesconfig.tests;x-internal:=true,
org.eclipse.jst.jsf.facesconfig.tests.read;x-internal:=true,
diff --git a/jsf/tests/org.eclipse.jst.jsf.metadata.tests/META-INF/MANIFEST.MF b/jsf/tests/org.eclipse.jst.jsf.metadata.tests/META-INF/MANIFEST.MF
index 735fbae..6cbf1d0 100644
--- a/jsf/tests/org.eclipse.jst.jsf.metadata.tests/META-INF/MANIFEST.MF
+++ b/jsf/tests/org.eclipse.jst.jsf.metadata.tests/META-INF/MANIFEST.MF
@@ -27,7 +27,7 @@
org.eclipse.wst.validation,
org.eclipse.jst.pagedesigner.jsf.ui,
org.eclipse.ui.views.properties.tabbed;bundle-version="[3.2.0,4.0.0)"
-Eclipse-LazyStart: true
+Bundle-ActivationPolicy: lazy
Export-Package: com.foobar;x-internal:=true,
org.eclipse.jst.jsf.common.metadata.tests;x-internal:=true,
org.eclipse.jst.jsf.metadata.tests;x-internal:=true,
diff --git a/jsf/tests/org.eclipse.jst.jsf.metadataprocessingtests2/META-INF/MANIFEST.MF b/jsf/tests/org.eclipse.jst.jsf.metadataprocessingtests2/META-INF/MANIFEST.MF
index e3370a0..a097ed0 100644
--- a/jsf/tests/org.eclipse.jst.jsf.metadataprocessingtests2/META-INF/MANIFEST.MF
+++ b/jsf/tests/org.eclipse.jst.jsf.metadataprocessingtests2/META-INF/MANIFEST.MF
@@ -8,7 +8,7 @@
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
org.eclipse.jst.jsf.core;bundle-version="[1.0.0,1.1.0)",
org.eclipse.jst.jsf.common;bundle-version="[1.0.0,1.1.0)"
-Eclipse-LazyStart: true
+Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.eclipse.jst.jsf.metadataprocessingtests2;x-internal:=true
Bundle-Vendor: %Bundle-Vendor.0
diff --git a/jsf/tests/org.eclipse.jst.jsf.ui.tests/META-INF/MANIFEST.MF b/jsf/tests/org.eclipse.jst.jsf.ui.tests/META-INF/MANIFEST.MF
index 7dc0cd1..c6e8c55 100644
--- a/jsf/tests/org.eclipse.jst.jsf.ui.tests/META-INF/MANIFEST.MF
+++ b/jsf/tests/org.eclipse.jst.jsf.ui.tests/META-INF/MANIFEST.MF
@@ -23,7 +23,7 @@
org.eclipse.core.resources,
org.eclipse.jdt.ui,
org.eclipse.ui.ide
-Eclipse-LazyStart: true
+Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.jst.jsf.ui.tests;x-internal:=true,
org.eclipse.jst.jsf.ui.tests.classpath;x-internal:=true,
org.eclipse.jst.jsf.ui.tests.util;x-internal:=true
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/META-INF/MANIFEST.MF b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/META-INF/MANIFEST.MF
index 93a00b0..b440bce 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/META-INF/MANIFEST.MF
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/META-INF/MANIFEST.MF
@@ -22,8 +22,9 @@
org.eclipse.jdt.core;bundle-version="[3.2.0,4.0.0)",
org.eclipse.jst.common.frameworks;bundle-version="[1.1.0,1.2.0)",
org.eclipse.wst.common.project.facet.core;bundle-version="[1.2.0,1.3.0)",
- org.eclipse.emf.common;bundle-version="[2.2.0,3.0.0)"
-Eclipse-LazyStart: true
+ org.eclipse.emf.common;bundle-version="[2.2.0,3.0.0)",
+ org.eclipse.wst.common.frameworks;bundle-version="1.1.102"
+Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.eclipse.jst.jsf.validation.el.tests;x-internal:=true,
org.eclipse.jst.jsf.validation.el.tests.base;x-internal:=true,
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/base/BaseTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/base/BaseTestCase.java
index 017ddef..a8e05b0 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/base/BaseTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/base/BaseTestCase.java
@@ -28,6 +28,7 @@
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jst.common.project.facet.JavaFacetUtils;
+import org.eclipse.jst.jsf.context.IModelContext;
import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory;
import org.eclipse.jst.jsf.context.resolver.structureddocument.internal.ITextRegionContextResolver;
import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext;
@@ -36,6 +37,11 @@
import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager;
import org.eclipse.jst.jsf.core.tests.util.JSFFacetedTestEnvironment;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
+import org.eclipse.jst.jsf.designtime.resolver.AbstractStructuredDocumentSymbolResolverFactory;
+import org.eclipse.jst.jsf.designtime.resolver.CachingSymbolContextResolver;
+import org.eclipse.jst.jsf.designtime.resolver.IStructuredDocumentSymbolResolverFactory;
+import org.eclipse.jst.jsf.designtime.resolver.ISymbolContextResolver;
import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanType;
import org.eclipse.jst.jsf.test.util.ConfigurableTestCase;
import org.eclipse.jst.jsf.test.util.JDTTestEnvironment;
@@ -45,7 +51,6 @@
import org.eclipse.jst.jsf.validation.el.tests.ELValidationTestPlugin;
import org.eclipse.jst.jsf.validation.internal.ValidationPreferences;
import org.eclipse.jst.jsf.validation.internal.el.ELExpressionValidator;
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.IELLocalizedMessage;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
@@ -60,10 +65,12 @@
{
public static final String PROXY_SETTING_HOST = "proxySettings_Host";
public static final String PROXY_SETTING_PORT = "proxySettings_Port";
- public static final String JSF_FACET_VERSION = "jsfFacetVersion";
+ public static final String JSF_FACET_VERSION = "jsfFacetVersion";
private final JSFVersion _defaultJSFVersion;
-
+ private IStructuredDocumentSymbolResolverFactory _symbolResolverFactory
+ = new MySymbolResolverFactory();;
+
/**
* Default constructor
*/
@@ -92,7 +99,6 @@
private MyConfiguration _configuration;
-
protected void doStandaloneSetup()
{
super.doStandaloneSetup();
@@ -309,7 +315,8 @@
* @param file
* @return a new expression validator for docPos in the document
*/
- protected ELExpressionValidator createELValidator(IStructuredDocument document, int docPos, IFile file)
+ protected ELExpressionValidator createELValidator(
+ IStructuredDocument document, int docPos, IFile file, MockELValidationReporter reporter)
{
final String elText = getELText(document, docPos);
final IStructuredDocumentContext context =
@@ -317,8 +324,31 @@
final ValidationPreferences prefs =
new ValidationPreferences(JSFCorePlugin.getDefault().getPreferenceStore());
prefs.load();
+
+ return new ELExpressionValidator(context, elText, _symbolResolverFactory, reporter);
+ }
+
+ private static class MySymbolResolverFactory extends AbstractStructuredDocumentSymbolResolverFactory
+ {
+ private ISymbolContextResolver _resolver;
- return new ELExpressionValidator(context, elText, file, prefs.getElPrefs());
+ @Override
+ public ISymbolContextResolver getSymbolContextResolver(
+ IModelContext context)
+ {
+ if (_resolver == null)
+ {
+ _resolver = new CachingSymbolContextResolver((IStructuredDocumentContext) context);
+ }
+ else
+ {
+ if (!_resolver.hasSameResolution(context))
+ {
+ _resolver = new CachingSymbolContextResolver((IStructuredDocumentContext) context);
+ }
+ }
+ return _resolver;
+ }
}
/**
@@ -330,7 +360,7 @@
* @param expectedProblems
* @return the list of found syntax problems
*/
- protected List<IMessage> assertSyntaxError(IStructuredDocument document,
+ protected List<ReportedProblem> assertSyntaxError(IStructuredDocument document,
int docPos,
IFile file,
int expectedProblems)
@@ -348,7 +378,7 @@
* @param expectedProblems
* @return the list of syntax problems
*/
- protected List<IMessage> assertSyntaxWarning(IStructuredDocument document,
+ protected List<ReportedProblem> assertSyntaxWarning(IStructuredDocument document,
int docPos,
IFile file,
int expectedProblems)
@@ -369,27 +399,27 @@
* @param expectedMaxSeverity
* @return the (possibly empty) list of problems
*/
- protected List<IMessage> assertSyntaxProblems(IStructuredDocument document,
+ protected List<ReportedProblem> assertSyntaxProblems(IStructuredDocument document,
int docPos,
IFile file,
int expectedProblems,
int expectedMaxSeverity)
{
+ final MockELValidationReporter reporter = new MockELValidationReporter();
+
final ELExpressionValidator validator =
- createELValidator(document, docPos, file);
+ createELValidator(document, docPos, file, reporter);
validator.validateXMLNode();
-
- final List<IMessage> problems = validator.getSyntaxProblems();
+
+ final List<ReportedProblem> problems = reporter.getSyntaxProblems();
assertEquals(expectedProblems, problems.size());
int worstSeverity = 0;
-
- for (final Iterator<IMessage> it = problems.iterator(); it.hasNext();)
+
+ for (final ReportedProblem problem : problems)
{
- IMessage message = it.next();
-
// for some reason, the number values are lower for higher severity
// constants
- worstSeverity = maxSeverity(worstSeverity, message.getSeverity());
+ worstSeverity = maxSeverity(worstSeverity, problem.getSeverity());
}
@@ -425,10 +455,12 @@
*/
protected void assertNoError(IStructuredDocument document, int docPos, IFile file, String expectedSignature, int assignability)
{
- ELExpressionValidator validator = createELValidator(document, docPos, file);
+ final MockELValidationReporter reporter = new MockELValidationReporter();
+
+ ELExpressionValidator validator = createELValidator(document, docPos, file, reporter);
validator.validateXMLNode();
- assertEquals(0, validator.getSyntaxProblems().size());
- assertEquals(0, validator.getSemanticValidator().getMessages().size());
+ assertEquals(0, reporter.getSyntaxProblems().size());
+ assertEquals(0, reporter.getSemanticProblems().size());
if (expectedSignature != null)
{
@@ -455,7 +487,7 @@
* @param expectedProblems
* @return the list of semantic warnings
*/
- protected List<IMessage> assertSemanticError(IStructuredDocument document, int docPos, IFile file, String expectedSignature, int expectedProblems)
+ protected List<ReportedProblem> assertSemanticError(IStructuredDocument document, int docPos, IFile file, String expectedSignature, int expectedProblems)
{
return assertSemanticProblems(document, docPos, file, expectedSignature, expectedProblems, IMessage.HIGH_SEVERITY/* "high" is Error for some reason*/);
}
@@ -473,7 +505,7 @@
* @param expectedProblems
* @return the list of semantic warnings
*/
- protected List<IMessage> assertSemanticWarning(IStructuredDocument document, int docPos, IFile file, String expectedSignature, int expectedProblems)
+ protected List<ReportedProblem> assertSemanticWarning(IStructuredDocument document, int docPos, IFile file, String expectedSignature, int expectedProblems)
{
return assertSemanticProblems(document, docPos, file, expectedSignature, expectedProblems, IMessage.NORMAL_SEVERITY/* "normal" is Warning for some reason*/);
}
@@ -487,15 +519,17 @@
* @param expectedMaxSeverity
* @return the list of semantic problems found
*/
- protected List<IMessage> assertSemanticProblems(final IStructuredDocument document,
+ protected List<ReportedProblem> assertSemanticProblems(final IStructuredDocument document,
final int docPos,
final IFile file,
final String expectedSignature,
final int expectedProblems,
final int expectedMaxSeverity)
{
+ final MockELValidationReporter reporter = new MockELValidationReporter();
+
final ELExpressionValidator validator =
- createELValidator(document, docPos, file);
+ createELValidator(document, docPos, file, reporter);
validator.validateXMLNode();
if (expectedSignature != null
@@ -504,18 +538,16 @@
assertEquals(expectedSignature, validator.getExpressionType().getSignatures()[0]);
}
- assertEquals(0, validator.getSyntaxProblems().size());
- final List<IMessage> problems = validator.getSemanticValidator().getMessages();
+ assertEquals(0, reporter.getSyntaxProblems().size());
+ final List<ReportedProblem> problems = reporter.getSemanticProblems();
assertEquals(expectedProblems, problems.size());
int worstSeverity = 0;
- for (final Iterator<IMessage> it = problems.iterator(); it.hasNext();)
+ for (final ReportedProblem problem : problems)
{
- IMessage message = it.next();
-
// for some reason, the number values are lower for higher severity
// constants
- worstSeverity = maxSeverity(worstSeverity, message.getSeverity());
+ worstSeverity = maxSeverity(worstSeverity, problem.getSeverity());
}
assertEquals(expectedMaxSeverity, worstSeverity);
@@ -529,7 +561,7 @@
* @param problems
* @param code
*/
- protected void assertContainsProblem(List<IMessage> problems, int code)
+ protected void assertContainsProblem(List<ReportedProblem> problems, int code)
{
assertContainsProblem(problems, code, -1, -1);
}
@@ -544,33 +576,27 @@
* @param startPos
* @param length
*/
- protected void assertContainsProblem(List<IMessage> problems, int code, int startPos, int length)
+ protected void assertContainsProblem(List<ReportedProblem> problems, int code, int startPos, int length)
{
- Set<Integer> probsFound = new HashSet<Integer>();
+ final Set<Integer> probsFound = new HashSet<Integer>();
- for (final Iterator<IMessage> it = problems.iterator(); it.hasNext();)
+ for (final ReportedProblem problem : problems)
{
- IMessage probObj = it.next();
-
- if (probObj instanceof IELLocalizedMessage)
+ probsFound.add(new Integer(problem.getErrorCode()));
+ if (problem.getErrorCode() == code)
{
- final IELLocalizedMessage localizedMsg = (IELLocalizedMessage) probObj;
- probsFound.add(new Integer(localizedMsg.getErrorCode()));
- if (localizedMsg.getErrorCode() == code)
+ assertTrue("Offset of message must be >= 0", problem.getOffset()>=0);
+ assertTrue("Length of message marker must be >=0", problem.getLength()>=0);
+
+ if (startPos >= 0)
{
- assertTrue("Offset of message must be >= 0", localizedMsg.getOffset()>=0);
- assertTrue("Length of message marker must be >=0", localizedMsg.getLength()>=0);
-
- if (startPos >= 0)
- {
- assertEquals("Offset must be == startPos", startPos, localizedMsg.getOffset());
- assertEquals("Length must be == length", localizedMsg.getLength(), length);
- }
-
- // found the required code, so exit without throwing
- // any error assertions
- return;
+ assertEquals("Offset must be == startPos", startPos, problem.getOffset());
+ assertEquals("Length must be == length", problem.getLength(), length);
}
+
+ // found the required code, so exit without throwing
+ // any error assertions
+ return;
}
}
// if we reach this point then we have not found the asserted
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/base/MockELValidationReporter.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/base/MockELValidationReporter.java
new file mode 100644
index 0000000..111925e
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/base/MockELValidationReporter.java
@@ -0,0 +1,57 @@
+/**
+ *
+ */
+package org.eclipse.jst.jsf.validation.el.tests.base;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
+import org.eclipse.jst.jsf.validation.internal.IJSFViewValidator.IValidationReporter;
+import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class MockELValidationReporter implements IValidationReporter
+{
+ final List<ReportedProblem> _syntaxProblems;
+ final List<ReportedProblem> _semanticProblems;
+
+ public MockELValidationReporter()
+ {
+ _syntaxProblems = new ArrayList<ReportedProblem>();
+ _semanticProblems = new ArrayList<ReportedProblem>();
+ }
+
+ public void report(Diagnostic problem, int start, int length)
+ {
+ if (isASyntaxError(problem))
+ {
+ _syntaxProblems.add(new ReportedProblem(problem, start, length));
+ }
+ else
+ {
+ _semanticProblems.add(new ReportedProblem(problem, start, length));
+ }
+ }
+
+ public List<ReportedProblem> getSyntaxProblems()
+ {
+ return _syntaxProblems;
+ }
+
+ public List<ReportedProblem> getSemanticProblems()
+ {
+ return _semanticProblems;
+ }
+
+ private boolean isASyntaxError(final Diagnostic problem)
+ {
+ return problem.getCode() == DiagnosticFactory.GENERAL_SYNTAX_ERROR_ID;
+ }
+
+ public void report(IMessage message)
+ {
+ throw new UnsupportedOperationException();
+ }
+}
\ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/base/SingleJSPTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/base/SingleJSPTestCase.java
index 164bbc1..b76c8e7 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/base/SingleJSPTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/base/SingleJSPTestCase.java
@@ -15,10 +15,10 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.jst.jsf.core.JSFVersion;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.wst.sse.core.StructuredModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
public abstract class SingleJSPTestCase extends JSPTestCase
{
@@ -126,7 +126,7 @@
* @param expectedProblems
* @return the list of syntax errors (may be empty)
*/
- protected List<IMessage> assertSyntaxError(int docPos, int expectedProblems)
+ protected List<ReportedProblem> assertSyntaxError(int docPos, int expectedProblems)
{
return super.assertSyntaxError(_structuredDocument, docPos, _testJSP,
expectedProblems);
@@ -140,7 +140,7 @@
* @param expectedProblems
* @return the list of syntax warnings found (may be empty)
*/
- protected List<IMessage> assertSyntaxWarning(int docPos, int expectedProblems)
+ protected List<ReportedProblem> assertSyntaxWarning(int docPos, int expectedProblems)
{
return super.assertSyntaxWarning(_structuredDocument, docPos, _testJSP,
expectedProblems);
@@ -155,7 +155,7 @@
* @param expectedProblems
* @return the list of errors found
*/
- protected List<IMessage> assertSemanticError(int docPos, String expectedSignature, int expectedProblems) {
+ protected List<ReportedProblem> assertSemanticError(int docPos, String expectedSignature, int expectedProblems) {
return super.assertSemanticError(_structuredDocument, docPos, _testJSP, expectedSignature,
expectedProblems);
}
@@ -169,7 +169,7 @@
* @param expectedProblems
* @return the list of errors found
*/
- protected List<IMessage> assertSemanticWarning(int docPos, String expectedSignature, int expectedProblems) {
+ protected List<ReportedProblem> assertSemanticWarning(int docPos, String expectedSignature, int expectedProblems) {
return super.assertSemanticWarning(_structuredDocument, docPos, _testJSP, expectedSignature,
expectedProblems);
}
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/ArithmeticAddTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/ArithmeticAddTestCase.java
index 8916a7d..6688ac7 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/ArithmeticAddTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/ArithmeticAddTestCase.java
@@ -6,9 +6,9 @@
import org.eclipse.jdt.core.Signature;
import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
import org.eclipse.jst.jsf.core.JSFVersion;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* Test suite for testing validation of arithmetic add
@@ -71,7 +71,7 @@
@Override
public void testWarningExprs()
{
- List<IMessage> list = assertSemanticWarning(1343, Signature.SIG_LONG, 1);
+ List<ReportedProblem> list = assertSemanticWarning(1343, Signature.SIG_LONG, 1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME_ID);
list = assertSemanticWarning(1378, Signature.SIG_DOUBLE, 1);
@@ -93,7 +93,7 @@
@Override
public void testErrorExprs()
{
- List<IMessage> list = assertSemanticError(1605, null, 1);
+ List<ReportedProblem> list = assertSemanticError(1605, null, 1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID);
list = assertSemanticError(1643, null, 1);
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/ArithmeticDivideTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/ArithmeticDivideTestCase.java
index 3f6304a..bd6c0f9 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/ArithmeticDivideTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/ArithmeticDivideTestCase.java
@@ -5,9 +5,9 @@
import org.eclipse.jdt.core.Signature;
import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
import org.eclipse.jst.jsf.core.JSFVersion;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
@@ -90,7 +90,7 @@
@Override
public void testWarningExprs()
{
- List<IMessage> list = assertSemanticWarning(1505, Signature.SIG_DOUBLE, 1);
+ List<ReportedProblem> list = assertSemanticWarning(1505, Signature.SIG_DOUBLE, 1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME_ID);
list = assertSemanticWarning(1540, Signature.SIG_DOUBLE, 1);
@@ -121,7 +121,7 @@
@Override
public void testErrorExprs()
{
- List<IMessage> list = assertSemanticError(1897, null, 1);
+ List<ReportedProblem> list = assertSemanticError(1897, null, 1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID);
list = assertSemanticError(1935, null, 1);
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/ArithmeticMinusTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/ArithmeticMinusTestCase.java
index ae96830..546d8f6 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/ArithmeticMinusTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/ArithmeticMinusTestCase.java
@@ -5,9 +5,9 @@
import org.eclipse.jdt.core.Signature;
import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
import org.eclipse.jst.jsf.core.JSFVersion;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* Test suite for arithmetic subtract.
@@ -71,7 +71,7 @@
@Override
public void testWarningExprs()
{
- List<IMessage> list = assertSemanticWarning(1302, Signature.SIG_LONG, 1);
+ List<ReportedProblem> list = assertSemanticWarning(1302, Signature.SIG_LONG, 1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME_ID);
list = assertSemanticWarning(1337, Signature.SIG_DOUBLE, 1);
@@ -93,7 +93,7 @@
@Override
public void testErrorExprs()
{
- List<IMessage> list = assertSemanticError(1564, null, 1);
+ List<ReportedProblem> list = assertSemanticError(1564, null, 1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID);
list = assertSemanticError(1602, null, 1);
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/ArithmeticModuloTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/ArithmeticModuloTestCase.java
index 12b2395..319fce1 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/ArithmeticModuloTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/ArithmeticModuloTestCase.java
@@ -5,9 +5,9 @@
import org.eclipse.jdt.core.Signature;
import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
import org.eclipse.jst.jsf.core.JSFVersion;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* Test suite for arithmetic remainder (mod, %)
@@ -87,7 +87,7 @@
@Override
public void testWarningExprs()
{
- List<IMessage> list = assertSemanticWarning(1437, Signature.SIG_LONG, 1);
+ List<ReportedProblem> list = assertSemanticWarning(1437, Signature.SIG_LONG, 1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME_ID);
list = assertSemanticWarning(1472, Signature.SIG_LONG, 1);
@@ -116,7 +116,7 @@
@Override
public void testErrorExprs()
{
- List<IMessage> list = assertSemanticError(1784, null, 1);
+ List<ReportedProblem> list = assertSemanticError(1784, null, 1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID);
list = assertSemanticError(1822, null, 1);
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/ArithmeticMultiplyTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/ArithmeticMultiplyTestCase.java
index dab4e7c..6fb36f8 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/ArithmeticMultiplyTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/ArithmeticMultiplyTestCase.java
@@ -5,9 +5,9 @@
import org.eclipse.jdt.core.Signature;
import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
import org.eclipse.jst.jsf.core.JSFVersion;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* Test cases for arithmetic multiply
@@ -70,7 +70,7 @@
@Override
public void testWarningExprs()
{
- List<IMessage> list = assertSemanticWarning(1302, Signature.SIG_LONG, 1);
+ List<ReportedProblem> list = assertSemanticWarning(1302, Signature.SIG_LONG, 1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME_ID);
list = assertSemanticWarning(1337, Signature.SIG_DOUBLE, 1);
@@ -92,7 +92,7 @@
@Override
public void testErrorExprs()
{
- List<IMessage> list = assertSemanticError(1567, null, 1);
+ List<ReportedProblem> list = assertSemanticError(1567, null, 1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID);
list = assertSemanticError(1605, null, 1);
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/BadSyntaxTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/BadSyntaxTestCase.java
index 78fa0f2..0c978c2 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/BadSyntaxTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/BadSyntaxTestCase.java
@@ -3,9 +3,9 @@
import java.util.List;
import org.eclipse.jst.jsf.core.JSFVersion;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* Test cases for syntax error testing
@@ -45,7 +45,7 @@
@Override
public void testWarningExprs()
{
- List<IMessage> list = assertSyntaxWarning(870,1);
+ List<ReportedProblem> list = assertSyntaxWarning(870,1);
assertContainsProblem(list, DiagnosticFactory.GENERAL_SYNTAX_ERROR_ID);
list = assertSyntaxWarning(902,1);
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/BeanPropertyResolutionTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/BeanPropertyResolutionTestCase.java
index 22d50f1..4315ec9 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/BeanPropertyResolutionTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/BeanPropertyResolutionTestCase.java
@@ -6,9 +6,9 @@
import org.eclipse.jst.jsf.common.internal.types.IAssignable;
import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
import org.eclipse.jst.jsf.core.JSFVersion;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* Test cases for bean property resolution
@@ -151,7 +151,7 @@
@Override
public void testWarningExprs()
{
- List<IMessage> list = assertSemanticWarning(3398,null,1);
+ List<ReportedProblem> list = assertSemanticWarning(3398,null,1);
assertContainsProblem(list, DiagnosticFactory.MEMBER_NOT_FOUND_ID);
list = assertSemanticWarning(3460,null,1);
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/BeanVariableResolutionTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/BeanVariableResolutionTestCase.java
index 59202a7..a96d7df 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/BeanVariableResolutionTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/BeanVariableResolutionTestCase.java
@@ -3,9 +3,9 @@
import java.util.List;
import org.eclipse.jst.jsf.core.JSFVersion;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* Test cases for bean variable resolution
@@ -55,7 +55,7 @@
@Override
public void testWarningExprs()
{
- List<IMessage> list = assertSemanticWarning(851, null, 1);
+ List<ReportedProblem> list = assertSemanticWarning(851, null, 1);
assertContainsProblem(list,DiagnosticFactory.VARIABLE_NOT_FOUND_ID);
list = assertSemanticWarning(891, null, 1);
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/BracketOperatorTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/BracketOperatorTestCase.java
index 31e72a3..b4c66fd 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/BracketOperatorTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/BracketOperatorTestCase.java
@@ -15,9 +15,9 @@
import org.eclipse.jdt.core.Signature;
import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
import org.eclipse.jst.jsf.core.JSFVersion;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* Main test cases for the bracket operator -- x['y']
@@ -148,7 +148,7 @@
@Override
public void testWarningExprs()
{
- List<IMessage> list = assertSemanticWarning(3093, null, 1);
+ List<ReportedProblem> list = assertSemanticWarning(3093, null, 1);
assertContainsProblem(list, DiagnosticFactory.MEMBER_NOT_FOUND_ID);
list = assertSemanticWarning(3137, null, 1);
@@ -208,7 +208,7 @@
assertEquals("listBean['a']", getELText(_structuredDocument,4468));
assertEquals("listBean[true]", getELText(_structuredDocument,4511));
- List<IMessage> list = assertSemanticError(4175, null, 1);
+ List<ReportedProblem> list = assertSemanticError(4175, null, 1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID);
list = assertSemanticError(4256, null, 1);
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/BuiltInSymbolsTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/BuiltInSymbolsTestCase.java
index 172a917..ac8fdf5 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/BuiltInSymbolsTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/BuiltInSymbolsTestCase.java
@@ -5,9 +5,9 @@
import org.eclipse.jdt.core.Signature;
import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
import org.eclipse.jst.jsf.core.JSFVersion;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* Test cases for built-in (implicit) symbol resolution
@@ -147,7 +147,7 @@
@Override
public void testWarningExprs()
{
- List<IMessage> list = assertSemanticWarning(3572,null,1);
+ List<ReportedProblem> list = assertSemanticWarning(3572,null,1);
assertContainsProblem(list, DiagnosticFactory.MEMBER_NOT_FOUND_ID);
list = assertSemanticWarning(3632,null,1);
@@ -193,7 +193,7 @@
@Override
public void testErrorExprs()
{
- final List<IMessage> list = assertSemanticError(4400,null,1);
+ final List<ReportedProblem> list = assertSemanticError(4400,null,1);
assertContainsProblem(list, DiagnosticFactory.UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN_ID);
}
}
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/DataTableResolutionTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/DataTableResolutionTestCase.java
index 563c2ea..fbb5da8 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/DataTableResolutionTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/DataTableResolutionTestCase.java
@@ -4,9 +4,9 @@
import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
import org.eclipse.jst.jsf.core.JSFVersion;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
public class DataTableResolutionTestCase extends SingleJSPTestCase
{
@@ -45,7 +45,7 @@
@Override
public void testWarningExprs()
{
- List<IMessage> problems = assertSemanticWarning(1554, null, 1);
+ List<ReportedProblem> problems = assertSemanticWarning(1554, null, 1);
assertContainsProblem(problems, DiagnosticFactory.VARIABLE_NOT_FOUND_ID);
problems = assertSemanticWarning(1687, null, 1);
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/GreaterThanEqTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/GreaterThanEqTestCase.java
index f7ff58e..3837594 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/GreaterThanEqTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/GreaterThanEqTestCase.java
@@ -4,9 +4,9 @@
import org.eclipse.jdt.core.Signature;
import org.eclipse.jst.jsf.core.JSFVersion;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* Test cases for greater than or equal (ge, >=)
@@ -107,7 +107,7 @@
@Override
public void testWarningExprs()
{
- List<IMessage> list = assertSemanticWarning(2026, Signature.SIG_BOOLEAN, 1);
+ List<ReportedProblem> list = assertSemanticWarning(2026, Signature.SIG_BOOLEAN, 1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME_ID);
list = assertSemanticWarning(2062, Signature.SIG_BOOLEAN, 1);
@@ -154,7 +154,7 @@
@Override
public void testErrorExprs()
{
- List<IMessage> list = assertSemanticError(2629, null, 1);
+ List<ReportedProblem> list = assertSemanticError(2629, null, 1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID);
list = assertSemanticError(2668, null, 1);
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/GreaterThanTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/GreaterThanTestCase.java
index e9512f0..717bfe5 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/GreaterThanTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/GreaterThanTestCase.java
@@ -4,9 +4,9 @@
import org.eclipse.jdt.core.Signature;
import org.eclipse.jst.jsf.core.JSFVersion;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* Test cases for greater than (gt, >)
@@ -108,7 +108,7 @@
@Override
public void testWarningExprs()
{
- List<IMessage> list = assertSemanticWarning(2010, Signature.SIG_BOOLEAN, 1);
+ List<ReportedProblem> list = assertSemanticWarning(2010, Signature.SIG_BOOLEAN, 1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME_ID);
list = assertSemanticWarning(2045, Signature.SIG_BOOLEAN, 1);
@@ -154,7 +154,7 @@
@Override
public void testErrorExprs()
{
- List<IMessage> list = assertSemanticError(2606, null, 1);
+ List<ReportedProblem> list = assertSemanticError(2606, null, 1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID);
list = assertSemanticError(2644, null, 1);
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/JSPFunctionsTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/JSPFunctionsTestCase.java
index a692c1a..79f0e2c 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/JSPFunctionsTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/JSPFunctionsTestCase.java
@@ -3,9 +3,9 @@
import java.util.List;
import org.eclipse.jst.jsf.core.JSFVersion;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* Test cases for functions
@@ -49,7 +49,7 @@
{
// note: this will change to non-error when functions are properly supported
// by the parser
- List<IMessage> list = assertSyntaxWarning(1226, 1);
+ List<ReportedProblem> list = assertSyntaxWarning(1226, 1);
assertContainsProblem(list, DiagnosticFactory.GENERAL_SYNTAX_ERROR_ID);
list = assertSyntaxWarning(1274, 1);
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LessThanEqTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LessThanEqTestCase.java
index 3d3e919..0631193 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LessThanEqTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LessThanEqTestCase.java
@@ -4,9 +4,9 @@
import org.eclipse.jdt.core.Signature;
import org.eclipse.jst.jsf.core.JSFVersion;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* Test cases for less than or equal (<=, le)
@@ -107,7 +107,7 @@
@Override
public void testWarningExprs()
{
- List<IMessage> list = assertSemanticWarning(2022, Signature.SIG_BOOLEAN, 1);
+ List<ReportedProblem> list = assertSemanticWarning(2022, Signature.SIG_BOOLEAN, 1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME_ID);
list = assertSemanticWarning(2058, Signature.SIG_BOOLEAN, 1);
@@ -153,7 +153,7 @@
@Override
public void testErrorExprs()
{
- List<IMessage> list = assertSemanticError(2625, null, 1);
+ List<ReportedProblem> list = assertSemanticError(2625, null, 1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID);
list = assertSemanticError(2664, null, 1);
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LessThanTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LessThanTestCase.java
index 60cde0e..3fc2245 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LessThanTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LessThanTestCase.java
@@ -4,9 +4,9 @@
import org.eclipse.jdt.core.Signature;
import org.eclipse.jst.jsf.core.JSFVersion;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* Test cases for less than (<, lt)
@@ -108,7 +108,7 @@
@Override
public void testWarningExprs()
{
- List<IMessage> list = assertSemanticWarning(2010, Signature.SIG_BOOLEAN, 1);
+ List<ReportedProblem> list = assertSemanticWarning(2010, Signature.SIG_BOOLEAN, 1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME_ID);
list = assertSemanticWarning(2045, Signature.SIG_BOOLEAN, 1);
@@ -155,7 +155,7 @@
@Override
public void testErrorExprs()
{
- List<IMessage> list = assertSemanticError(2606, null, 1);
+ List<ReportedProblem> list = assertSemanticError(2606, null, 1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID);
list = assertSemanticError(2644, null, 1);
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LoadBundleResolutionTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LoadBundleResolutionTestCase.java
index ac2135e..302c874 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LoadBundleResolutionTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LoadBundleResolutionTestCase.java
@@ -13,13 +13,13 @@
import org.eclipse.jst.jsf.core.JSFVersion;
import org.eclipse.jst.jsf.core.internal.tld.IJSFConstants;
import org.eclipse.jst.jsf.core.internal.tld.ITLDConstants;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.metadataprocessors.MetaDataEnabledProcessingFactory;
import org.eclipse.jst.jsf.metadataprocessors.features.IValidValues;
import org.eclipse.jst.jsf.test.util.TestFileResource;
import org.eclipse.jst.jsf.validation.el.tests.ELValidationTestPlugin;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.w3c.dom.Attr;
/**
@@ -86,7 +86,7 @@
@Override
public void testWarningExprs()
{
- List<IMessage> list = assertSemanticWarning(1496, Signature.SIG_LONG, 1);
+ List<ReportedProblem> list = assertSemanticWarning(1496, Signature.SIG_LONG, 1);
assertContainsProblem(list, DiagnosticFactory.UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED_ID);
list = assertSemanticWarning(1548, null, 1);
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LogicalAndTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LogicalAndTestCase.java
index 3c434e6..c40f985 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LogicalAndTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LogicalAndTestCase.java
@@ -4,9 +4,9 @@
import org.eclipse.jdt.core.Signature;
import org.eclipse.jst.jsf.core.JSFVersion;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* Test cases for logical AND (and, &&)
@@ -70,7 +70,7 @@
@Override
public void testWarningExprs()
{
- List<IMessage> list = assertSemanticWarning(1269, Signature.SIG_BOOLEAN, 1);
+ List<ReportedProblem> list = assertSemanticWarning(1269, Signature.SIG_BOOLEAN, 1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS_ID);
list = assertSemanticWarning(1333, Signature.SIG_BOOLEAN, 1);
@@ -110,7 +110,7 @@
@Override
public void testErrorExprs()
{
- List<IMessage> list = assertSemanticError(2037, null, 1);
+ List<ReportedProblem> list = assertSemanticError(2037, null, 1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN_ID);
list = assertSemanticError(2100, null, 1);
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LogicalEqualsTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LogicalEqualsTestCase.java
index 17ecaf8..7485715 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LogicalEqualsTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LogicalEqualsTestCase.java
@@ -4,9 +4,9 @@
import org.eclipse.jdt.core.Signature;
import org.eclipse.jst.jsf.core.JSFVersion;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* Test cases for logical equals (eq, ==)
@@ -112,7 +112,7 @@
@Override
public void testWarningExprs()
{
- List<IMessage> list = assertSemanticWarning(2128, Signature.SIG_BOOLEAN, 1);
+ List<ReportedProblem> list = assertSemanticWarning(2128, Signature.SIG_BOOLEAN, 1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME_ID);
list = assertSemanticWarning(2164, Signature.SIG_BOOLEAN, 1);
@@ -178,7 +178,7 @@
@Override
public void testErrorExprs()
{
- List<IMessage> list = assertSemanticError(3188, null, 1);
+ List<ReportedProblem> list = assertSemanticError(3188, null, 1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID);
list = assertSemanticError(3227, null, 1);
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LogicalNotEqualsTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LogicalNotEqualsTestCase.java
index 91d5068..174a696 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LogicalNotEqualsTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LogicalNotEqualsTestCase.java
@@ -4,9 +4,9 @@
import org.eclipse.jdt.core.Signature;
import org.eclipse.jst.jsf.core.JSFVersion;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* Test cases for logical not equals (ne, !=)
@@ -109,7 +109,7 @@
@Override
public void testWarningExprs()
{
- List<IMessage> list = assertSemanticWarning(2128, Signature.SIG_BOOLEAN, 1);
+ List<ReportedProblem> list = assertSemanticWarning(2128, Signature.SIG_BOOLEAN, 1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME_ID);
list = assertSemanticWarning(2164, Signature.SIG_BOOLEAN, 1);
@@ -166,7 +166,7 @@
@Override
public void testErrorExprs()
{
- List<IMessage> list = assertSemanticError(3012, null, 1);
+ List<ReportedProblem> list = assertSemanticError(3012, null, 1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID);
list = assertSemanticError(3051, null, 1);
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LogicalNotTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LogicalNotTestCase.java
index 0df3540..30abeaf 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LogicalNotTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LogicalNotTestCase.java
@@ -4,9 +4,9 @@
import org.eclipse.jdt.core.Signature;
import org.eclipse.jst.jsf.core.JSFVersion;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* Test cases for logical not (not, !)
@@ -67,7 +67,7 @@
@Override
public void testWarningExprs()
{
- List<IMessage> list = assertSemanticWarning(1075, Signature.SIG_BOOLEAN, 1);
+ List<ReportedProblem> list = assertSemanticWarning(1075, Signature.SIG_BOOLEAN, 1);
assertContainsProblem(list, DiagnosticFactory.UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME_ID);
list = assertSemanticWarning(1113, Signature.SIG_BOOLEAN, 1);
@@ -95,7 +95,7 @@
@Override
public void testErrorExprs()
{
- List<IMessage> list = assertSemanticError(1430, null, 1);
+ List<ReportedProblem> list = assertSemanticError(1430, null, 1);
assertContainsProblem(list, DiagnosticFactory.UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN_ID);
list = assertSemanticError(1462, null, 1);
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LogicalOrTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LogicalOrTestCase.java
index cdb892e..25bb225 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LogicalOrTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LogicalOrTestCase.java
@@ -4,9 +4,9 @@
import org.eclipse.jdt.core.Signature;
import org.eclipse.jst.jsf.core.JSFVersion;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* Test cases for logical OR (or, ||)
@@ -77,7 +77,7 @@
@Override
public void testWarningExprs()
{
- List<IMessage> list = assertSemanticWarning(1738, Signature.SIG_BOOLEAN, 1);
+ List<ReportedProblem> list = assertSemanticWarning(1738, Signature.SIG_BOOLEAN, 1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS_ID);
list = assertSemanticWarning(1804, Signature.SIG_BOOLEAN, 1);
@@ -102,7 +102,7 @@
@Override
public void testErrorExprs()
{
- final List<IMessage> list = assertSemanticError(2161, null,1);
+ final List<ReportedProblem> list = assertSemanticError(2161, null,1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN_ID);
assertSemanticError(2225, null,1);
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/MarkerOffsetsTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/MarkerOffsetsTestCase.java
index c52a2f9..3f6b02c 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/MarkerOffsetsTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/MarkerOffsetsTestCase.java
@@ -3,9 +3,9 @@
import java.util.List;
import org.eclipse.jst.jsf.core.JSFVersion;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* Used to verify that marker offset/lengths are calculated correctly
@@ -73,7 +73,7 @@
// UPDATE REMINDER! The third argument in assertContainsProblem is the start
// offset (absolute) of the marker expected. Before updating the assertSemanticWarning
// make a note to the difference
- List<IMessage> list = assertSemanticWarning(880, null, 1);
+ List<ReportedProblem> list = assertSemanticWarning(880, null, 1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME_ID, 880, 5);
list = assertSemanticWarning(915, null, 1);
@@ -133,7 +133,7 @@
// UPDATE REMINDER! The third argument in assertContainsProblem is the start
// offset (absolute) of the marker expected. Before updating the assertSemanticWarning
// make a note to the difference
- List<IMessage> list = assertSemanticError(1978, null, 1);
+ List<ReportedProblem> list = assertSemanticError(1978, null, 1);
assertContainsProblem(list, DiagnosticFactory.BINARY_OP_POSSIBLE_DIVISION_BY_ZERO_ID, 1978, 26);
list = assertSemanticError(2034, null, 1);
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/MethodBindingTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/MethodBindingTestCase.java
index 6f6d9fd..840e60f 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/MethodBindingTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/MethodBindingTestCase.java
@@ -5,9 +5,9 @@
import org.eclipse.jdt.core.Signature;
import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
import org.eclipse.jst.jsf.core.JSFVersion;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* Test cases for method bindings
@@ -124,7 +124,7 @@
@Override
public void testErrorExprs()
{
- List<IMessage> list = assertSemanticError(3272, null, 1);
+ List<ReportedProblem> list = assertSemanticError(3272, null, 1);
assertContainsProblem(list, DiagnosticFactory.CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING_ID);
list = assertSemanticError(3320, null, 2);
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/ResourceBundleTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/ResourceBundleTestCase.java
index 7480e4b..7ce0f0b 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/ResourceBundleTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/ResourceBundleTestCase.java
@@ -6,11 +6,11 @@
import org.eclipse.jdt.core.Signature;
import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
import org.eclipse.jst.jsf.core.JSFVersion;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.test.util.TestFileResource;
import org.eclipse.jst.jsf.validation.el.tests.ELValidationTestPlugin;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* Tests the introduction of symbols through resource-bundle element the
@@ -99,7 +99,7 @@
@Override
public void testWarningExprs()
{
- List<IMessage> problems = assertSemanticWarning(1530, null, 1);
+ List<ReportedProblem> problems = assertSemanticWarning(1530, null, 1);
assertContainsProblem(problems, DiagnosticFactory.UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED_ID);
problems = assertSemanticWarning(1590, null, 1);
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/SyntaxCheckTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/SyntaxCheckTestCase.java
deleted file mode 100644
index 88d7e71..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/SyntaxCheckTestCase.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.jst.jsf.validation.el.tests.jsp;
-
-import org.eclipse.jst.jsf.core.JSFVersion;
-import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
-import org.eclipse.jst.jsf.validation.internal.JSPSemanticsValidator;
-
-public class SyntaxCheckTestCase extends SingleJSPTestCase
-{
- private final JSPSemanticsValidator validator;
-
- protected SyntaxCheckTestCase(final String srcFileName, final String destFileName,
- final String defaultJSFVersion, final String defaultFacesConfigFile)
- {
- super("/testdata/jsps/syntaxCheck.jsp.data", "/syntaxCheck.jsp", JSFVersion.V1_1, FACES_CONFIG_FILE_NAME_1_1);
- validator = new JSPSemanticsValidator();
- validator.connect(_structuredDocument);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- @Override
- public void testWarningExprs()
- {
- // IStructuredDocumentContext context =
- // IStructuredDocumentContextFactory.INSTANCE.getContext(_structuredDocument, 877);
- // ITextRegionContextResolver resolver =
- // IStructuredDocumentContextResolverFactory.INSTANCE.getTextRegionResolver(context);
-
-
- }
-
- @Override
- public void testErrorExprs() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void testNoErrorExprs()
- {
- // do nothing
-
- }
-
-
-}
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/UnaryEmptyTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/UnaryEmptyTestCase.java
index a538eaf..7825dd6 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/UnaryEmptyTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/UnaryEmptyTestCase.java
@@ -4,9 +4,9 @@
import org.eclipse.jdt.core.Signature;
import org.eclipse.jst.jsf.core.JSFVersion;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* Test cases for unary empty
@@ -65,7 +65,7 @@
@Override
public void testWarningExprs()
{
- List<IMessage> list = assertSemanticWarning(1250, Signature.SIG_BOOLEAN, 1);
+ List<ReportedProblem> list = assertSemanticWarning(1250, Signature.SIG_BOOLEAN, 1);
assertContainsProblem(list, DiagnosticFactory.UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE_ID);
list = assertSemanticWarning(1287, Signature.SIG_BOOLEAN, 1);
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/UnaryMinusTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/UnaryMinusTestCase.java
index 37f8523..83b85d7 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/UnaryMinusTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/UnaryMinusTestCase.java
@@ -5,9 +5,9 @@
import org.eclipse.jdt.core.Signature;
import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
import org.eclipse.jst.jsf.core.JSFVersion;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* Test cases for unary minus
@@ -68,7 +68,7 @@
@Override
public void testWarningExprs()
{
- List<IMessage> list = assertSemanticWarning(1072, Signature.SIG_LONG, 1);
+ List<ReportedProblem> list = assertSemanticWarning(1072, Signature.SIG_LONG, 1);
assertContainsProblem(list, DiagnosticFactory.UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED_ID);
list = assertSemanticWarning(1275, Signature.SIG_LONG, 1);
@@ -78,7 +78,7 @@
@Override
public void testErrorExprs()
{
- List<IMessage> list = assertSemanticError(1332, null, 1);
+ List<ReportedProblem> list = assertSemanticError(1332, null, 1);
assertContainsProblem(list, DiagnosticFactory.UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID);
list = assertSemanticError(1368, null, 1);
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/perf/StressTest.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/perf/StressTest.java
index 1d13284..72ce1ca 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/perf/StressTest.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/perf/StressTest.java
@@ -10,6 +10,7 @@
import org.eclipse.jst.jsf.designtime.el.AbstractDTVariableResolver;
import org.eclipse.jst.jsf.test.util.PerfTracker;
import org.eclipse.jst.jsf.validation.el.tests.base.JSPTestCase;
+import org.eclipse.jst.jsf.validation.el.tests.base.MockELValidationReporter;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.ELExpressionValidator;
import org.eclipse.wst.sse.core.StructuredModelManager;
@@ -114,7 +115,7 @@
public void testStressSimpleValueBindingValidation()
{
final int numTimes = 1000;
- final int elOffset = 819;
+ final int elOffset = 795;
assertEquals("myBean.stringProperty", getELText(_structuredDocument,elOffset));
final PerfTracker perfTracker =
@@ -123,8 +124,10 @@
// resolve the same variable 100K times
for (int x = 0; x < numTimes; x++)
{
+ final MockELValidationReporter reporter =
+ new MockELValidationReporter();
final ELExpressionValidator validator =
- createELValidator(_structuredDocument, elOffset, _testJSP);
+ createELValidator(_structuredDocument, elOffset, _testJSP, reporter);
final long startTime = System.nanoTime();
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/preferences/EndToEndTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/preferences/EndToEndTestCase.java
index 526b632..34b8169 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/preferences/EndToEndTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/preferences/EndToEndTestCase.java
@@ -13,12 +13,15 @@
import java.util.List;
import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.util.BasicDiagnostic;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.jface.preference.IPersistentPreferenceStore;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jst.jsf.core.JSFVersion;
import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
+import org.eclipse.jst.jsf.core.tests.validation.MockValidationReporter.ReportedProblem;
import org.eclipse.jst.jsf.validation.el.tests.base.JSPTestCase;
+import org.eclipse.jst.jsf.validation.el.tests.base.MockELValidationReporter;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.ELValidationPreferences;
import org.eclipse.jst.jsf.validation.internal.ELValidationPreferences.Severity;
@@ -144,19 +147,49 @@
private void assertErrorLevel(final int docPos, final int severity)
{
- final ELExpressionValidator validator = createELValidator(_structuredDocument, docPos, _testJSP);
+ final MyMockValidationReporter reporter = new MyMockValidationReporter();
+ final ELExpressionValidator validator =
+ createELValidator(_structuredDocument, docPos, _testJSP, reporter);
validator.validateXMLNode();
- final List<IMessage> syntaxProblems = validator.getSyntaxProblems();
+ final List<ReportedProblem> syntaxProblems = reporter.getSyntaxProblems();
- for (final IMessage message : syntaxProblems)
+ for (final ReportedProblem message : syntaxProblems)
{
assertEquals(severity, message.getSeverity());
}
- final List<IMessage> semanticProblems = validator.getSemanticValidator().getMessages();
- for (final IMessage message : semanticProblems)
+ final List<ReportedProblem> semanticProblems = reporter.getSemanticProblems();
+ for (final ReportedProblem message : semanticProblems)
{
assertEquals(severity, message.getSeverity());
}
}
+
+ private class MyMockValidationReporter extends MockELValidationReporter
+ {
+ @Override
+ public void report(Diagnostic problem, int start, int length)
+ {
+ Diagnostic modifiedProblem =
+ new SeverityModifiableDiagnostic(problem);
+ super.report(modifiedProblem, start, length);
+ }
+
+ private class SeverityModifiableDiagnostic extends BasicDiagnostic
+ {
+
+ /**
+ * @param severity
+ * @param source
+ * @param code
+ * @param message
+ * @param data
+ */
+ private SeverityModifiableDiagnostic(final Diagnostic sourceDiag)
+ {
+ super(_prefs.getDiagnosticSeverity(sourceDiag.getCode()), sourceDiag.getSource(),
+ sourceDiag.getCode(), sourceDiag.getMessage(), sourceDiag.getData().toArray());
+ }
+ }
+ }
}
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/preferences/ValidationMessageFactory.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/preferences/ValidationMessageFactory.java
new file mode 100644
index 0000000..588cb85
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/preferences/ValidationMessageFactory.java
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * Copyright (c) 2006 Oracle Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * Cameron Bateman/Oracle - initial API and implementation
+ *
+ ********************************************************************************/
+
+package org.eclipse.jst.jsf.validation.el.tests.preferences;
+
+import java.util.Locale;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
+import org.eclipse.jst.jsf.validation.internal.ELValidationPreferences;
+import org.eclipse.jst.jsf.validation.internal.ValidationPreferences;
+import org.eclipse.wst.validation.internal.core.Message;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+/**
+ * Creates configured validation Message objects.
+ *
+ * TODO: This is duplicated from jsf.ui because I didn't want to cause a dependency
+ * on that plugin. Should this logic really be in UI? IMessage is not an SSE
+ * framework.
+ *
+ * @author cbateman
+ *
+ */
+public final class ValidationMessageFactory
+{
+ /**
+ * @param diagnostic
+ * @param offset
+ * @param length
+ * @param file
+ * @param prefs
+ * @return a configured message
+ */
+ public static Message createFromDiagnostic(final Diagnostic diagnostic, final int offset, final int length, final IFile file, final ValidationPreferences prefs)
+ {
+ final ELValidationPreferences elPrefs =
+ prefs.getElPrefs();
+
+ final int severity =
+ elPrefs.getDiagnosticSeverity(diagnostic.getCode());
+
+ final Message message =
+ new MyLocalizedMessage(
+ convertSeverity(severity),
+ diagnostic.getMessage(),
+ file,
+ diagnostic.getCode());
+
+ message.setOffset(offset);
+ message.setLength(length);
+
+ return message;
+ }
+
+ /**
+ * @param severity
+ * @return a Message severity equivilent to diagnostic.getSeverity()
+ */
+ private static int convertSeverity(final int severity)
+ {
+ switch (severity)
+ {
+ case Diagnostic.ERROR:
+ return IMessage.HIGH_SEVERITY;
+ case Diagnostic.WARNING:
+ return IMessage.NORMAL_SEVERITY;
+ case Diagnostic.INFO:
+ return IMessage.LOW_SEVERITY;
+ case Diagnostic.OK:
+ default:
+ // no bits set
+ return 0;
+ }
+ }
+
+ private ValidationMessageFactory()
+ {
+ // no external instantiation
+ }
+
+ /**
+ * EL customized localizable validation message
+ * @author cbateman
+ *
+ */
+ static class MyLocalizedMessage extends Message
+ {
+ private final String _message;
+ private final int _errorCode;
+
+ /**
+ * @param severity
+ * @param messageText
+ * @param targetObject
+ * @param errorCode
+ */
+ public MyLocalizedMessage(int severity, String messageText, IResource targetObject, int errorCode) {
+ this(severity, messageText, (Object) targetObject, errorCode);
+ }
+
+ /**
+ * @param severity
+ * @param messageText
+ * @param targetObject
+ * @param errorCode
+ */
+ private MyLocalizedMessage(int severity, String messageText, Object targetObject, int errorCode) {
+ super(JSFCorePlugin.getDefault().getBundle().getSymbolicName(), severity,
+ messageText);
+ _message = messageText;
+ setTargetObject(targetObject);
+ _errorCode = errorCode;
+ }
+
+ /**
+ * @return the localized message
+ */
+ public String getLocalizedMessage() {
+ return _message;
+ }
+
+ /**
+ * @see org.eclipse.wst.validation.internal.core.Message#getText()
+ */
+ public String getText() {
+ return getLocalizedMessage();
+ }
+
+ /**
+ * @see org.eclipse.wst.validation.internal.core.Message#getText(java.lang.ClassLoader)
+ */
+ public String getText(ClassLoader cl) {
+ return getLocalizedMessage();
+ }
+
+ /**
+ * @see org.eclipse.wst.validation.internal.core.Message#getText(java.util.Locale)
+ */
+ public String getText(Locale l) {
+ return getLocalizedMessage();
+ }
+
+ public String getText(Locale l, ClassLoader cl) {
+ return getLocalizedMessage();
+ }
+
+ /**
+ * @return the error code related to this message
+ */
+ public int getErrorCode() {
+ return _errorCode;
+ }
+
+
+ /**
+ * @param offset
+ * @return true if this message applies to document offset
+ */
+ public boolean appliesTo(int offset)
+ {
+ return (offset >= getOffset() && offset < getOffset()+getLength());
+ }
+ }
+
+}
+
diff --git a/jsf/tests/org.eclipse.jst.pagedesigner.tests/META-INF/MANIFEST.MF b/jsf/tests/org.eclipse.jst.pagedesigner.tests/META-INF/MANIFEST.MF
index 843f565..ef2b228 100644
--- a/jsf/tests/org.eclipse.jst.pagedesigner.tests/META-INF/MANIFEST.MF
+++ b/jsf/tests/org.eclipse.jst.pagedesigner.tests/META-INF/MANIFEST.MF
@@ -30,4 +30,4 @@
Export-Package: org.eclipse.jst.pagedesigner.tests;x-internal:=true
Bundle-ClassPath: pagedesignertests.jar
Bundle-Activator: org.eclipse.jst.pagedesigner.tests.PageDesignerTestsPlugin
-Eclipse-LazyStart: true
+Bundle-ActivationPolicy: lazy