use of org.eclipse.wst.validation.internal.provisional.core.IReporter in project webtools.sourceediting by eclipse.
the class JSPJavaValidatorTest method test_530968_ExpressionInCustomTagInComment2.
public void test_530968_ExpressionInCustomTagInComment2() throws Exception {
JSPJavaValidator validator = new JSPJavaValidator();
ProjectUtil.createProject("bug_530968-2", null, null);
BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/bug_530968-2", "/bug_530968-2");
IReporter reporter = new ReporterForTest();
ValidationContextForTest helper = new ValidationContextForTest();
String filePath = "/bug_530968-2/WebContent/bug530968-2.jsp";
helper.setURI(filePath);
validator.validate(helper, reporter);
String strings = "";
for (int i = 0; i < reporter.getMessages().size(); i++) {
strings = strings + ((IMessage) reporter.getMessages().get(i)).getText() + "\n";
}
assertTrue(strings, reporter.getMessages().isEmpty());
}
use of org.eclipse.wst.validation.internal.provisional.core.IReporter in project webtools.sourceediting by eclipse.
the class JSPJavaTranslatorCustomTagTest method test_326193.
/**
* Tests jsp translation when custom tag used
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=326193
*
* @throws Exception
*/
public void test_326193() throws Exception {
// $NON-NLS-1$
String projectName = "bug_326193";
// Create new project
IProject project = BundleResourceUtil.createJavaWebProject(projectName);
assertTrue(project.exists());
// $NON-NLS-1$ //$NON-NLS-2$
BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + projectName, "/" + projectName);
// $NON-NLS-1$
IFile file = project.getFile("WebContent/test326193.jsp");
assertTrue(file.exists());
JSPValidator validator = new JSPJavaValidator();
IReporter reporter = new ReporterForTest();
ValidationContextForTest helper = new ValidationContextForTest();
helper.setURI(file.getFullPath().toOSString());
validator.validate(helper, reporter);
String strings = "";
for (int i = 0; i < reporter.getMessages().size(); i++) {
strings = strings + ((IMessage) reporter.getMessages().get(i)).getText() + "\n";
}
assertTrue("found jsp java error for empty end tag in xml comment in script:" + strings, reporter.getMessages().isEmpty());
}
use of org.eclipse.wst.validation.internal.provisional.core.IReporter in project webtools.sourceediting by eclipse.
the class JSPActionValidatorTest method testUknownAttribute.
/**
* Tests if unknown attributes are detected
*
* @throws Exception
*/
public void testUknownAttribute() throws Exception {
JSPActionValidator validator = new JSPActionValidator();
IReporter reporter = new ReporterForTest();
ValidationContextForTest helper = new ValidationContextForTest();
String filePath = "/" + PROJECT_NAME + "/WebContent/undefinedattribute.jsp";
assertTrue("unable to find file: " + filePath, ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filePath)).exists());
helper.setURI(filePath);
validator.validate(helper, reporter);
boolean foundError1 = errorMessageFound(reporter, NLS.bind(JSPCoreMessages.JSPDirectiveValidator_6, UNDEFINED_ATTR_IDONT), 4);
if (foundError1)
foundError1 = errorMessageFound(reporter, NLS.bind(JSPCoreMessages.JSPDirectiveValidator_6, UNDEFINED_ATTR_IDONT), 12);
if (foundError1)
foundError1 = errorMessageFound(reporter, NLS.bind(JSPCoreMessages.JSPDirectiveValidator_6, UNDEFINED_ATTR_IDONT), 13);
assertTrue("jsp action validator did not detect undefined attributes", foundError1);
}
use of org.eclipse.wst.validation.internal.provisional.core.IReporter in project webtools.sourceediting by eclipse.
the class JSPActionValidatorTest method testNonEmptyInlineTag.
/**
* Tests if non-empty inline tags are flagged as warnings
*
* @throws Exception
*/
public void testNonEmptyInlineTag() throws Exception {
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=203254
JSPActionValidator validator = new JSPActionValidator();
IReporter reporter = new ReporterForTest();
ValidationContextForTest helper = new ValidationContextForTest();
String filePath = "/" + PROJECT_NAME + "/WebContent/nonemptyinlinetag.jsp";
assertTrue("unable to find file: " + filePath, ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filePath)).exists());
helper.setURI(filePath);
validator.validate(helper, reporter);
boolean foundError = errorMessageFound(reporter, NLS.bind(JSPCoreMessages.JSPActionValidator_0, NONEMPTY_INLINE_TAG_NAME), 10);
assertTrue("jsp action validator had problems detecting an error with content in an inline tag", foundError);
}
use of org.eclipse.wst.validation.internal.provisional.core.IReporter in project webtools.sourceediting by eclipse.
the class JSPDirectiveValidatorTest method testBug265710Expression.
public void testBug265710Expression() throws Exception {
JSPDirectiveValidator validator = new JSPDirectiveValidator();
IReporter reporter = new ReporterForTest();
ValidationContextForTest helper = new ValidationContextForTest();
String filePath = "/" + PROJECT_NAME + "/WebContent/bug265710expression.jsp";
assertTrue("unable to find file: " + filePath, ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filePath)).exists());
helper.setURI(filePath);
validator.validate(helper, reporter);
if (reporter.getMessages().size() > 0) {
Iterator it = reporter.getMessages().iterator();
while (it.hasNext()) {
IMessage message = (IMessage) it.next();
if (message.getLineNumber() == 14 && message.getSeverity() == IMessage.HIGH_SEVERITY) {
fail("JSP Directive Validator flagged a JSP expression in the import directive");
}
}
}
}
Aggregations