use of org.eclipse.wst.validation.internal.operations.WorkbenchContext in project webtools.sourceediting by eclipse.
the class TestDelegatingSourceValidatorForXSL method testXSLFunctionsWithParms.
@Test
public void testXSLFunctionsWithParms() throws Exception {
String fileName = "bug290286.xsl";
WorkbenchContext context = setupFile(getxslTestFilesProjectName(), fileName);
TestReporter reporter = new TestReporter();
sourceValidator.validate(context, reporter);
assertFalse("Errors reported with XSLT 2.0 with Functions: " + fileName + ".", reporter.isMessageReported());
}
use of org.eclipse.wst.validation.internal.operations.WorkbenchContext in project webtools.sourceediting by eclipse.
the class TestDelegatingSourceValidatorForXML method testValidateAgainstDTD.
/**
* Regression test for Bug 276337
*/
public void testValidateAgainstDTD() throws Exception {
String projectName = "TestValidateAgainstDTD";
IProject project = ProjectUtil.createProject(projectName, XMLUITestsPlugin.getDefault().getStateLocation().append(getName()), null);
IFile testFile = null;
try {
// get test file
ProjectUtil.copyBundleEntriesIntoWorkspace("testresources/TestValidateAgainstDTD", projectName);
testFile = project.getFile("simple.xml");
assertTrue("Test file " + testFile + " does not exist", testFile.exists());
// set up for validator
WorkbenchContext context = new WorkbenchContext();
List fileList = new ArrayList();
fileList.add(testFile.getFullPath().toPortableString());
context.setValidationFileURIs(fileList);
// validate file, there should be one error
TestReporter reporter = new TestReporter();
sourceValidator.validate(context, reporter);
assertFalse("There should be an error message reported for not conforming to the DTD " + testFile, !reporter.isMessageReported());
} catch (ValidationException e) {
fail("Could not validate test file " + testFile + ": " + e.getMessage());
}
project.delete(true, null);
}
use of org.eclipse.wst.validation.internal.operations.WorkbenchContext in project webtools.sourceediting by eclipse.
the class TestDelegatingSourceValidatorForXML method testNon8BitChars.
/**
* Test that files that contain non-8bit chars are validated
* correctly. i.e. Do not produce incorrect validation messages.
*/
public void testNon8BitChars() {
String projName = "Project";
String fileName1 = "international-instance.xml";
String fileName2 = "international.xsd";
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projName);
if (!project.isAccessible()) {
IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(projName);
try {
project.create(description, new NullProgressMonitor());
project.open(new NullProgressMonitor());
} catch (CoreException e) {
e.printStackTrace();
}
}
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(projName + "/" + fileName1));
if (file != null && !file.exists()) {
try {
file.create(FileLocator.openStream(XMLUITestsPlugin.getDefault().getBundle(), new Path("/testresources/Non8BitChars/international-instance.xml"), false), true, new NullProgressMonitor());
} catch (Exception e) {
e.printStackTrace();
}
}
file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(projName + "/" + fileName2));
if (file != null && !file.exists()) {
try {
file.create(FileLocator.openStream(XMLUITestsPlugin.getDefault().getBundle(), new Path("/testresources/Non8BitChars/international.xsd"), false), true, new NullProgressMonitor());
} catch (Exception e) {
e.printStackTrace();
}
}
WorkbenchContext context = new WorkbenchContext();
List fileList = new ArrayList();
fileList.add("/" + projName + "/" + fileName1);
context.setValidationFileURIs(fileList);
TestReporter reporter = new TestReporter();
try {
sourceValidator.validate(context, reporter);
} catch (ValidationException e) {
e.printStackTrace();
}
assertFalse("Messages were reported on valid file 1.", reporter.isMessageReported());
WorkbenchContext context2 = new WorkbenchContext();
List fileList2 = new ArrayList();
fileList2.add("/" + projName + "/" + fileName2);
context2.setValidationFileURIs(fileList2);
TestReporter reporter2 = new TestReporter();
try {
sourceValidator.validate(context2, reporter2);
} catch (ValidationException e) {
e.printStackTrace();
}
assertFalse("Messages were reported on valid file 2.", reporter2.isMessageReported());
}
use of org.eclipse.wst.validation.internal.operations.WorkbenchContext in project webtools.sourceediting by eclipse.
the class TestDelegatingSourceValidatorForXSL method testXSLT2_2Passes.
@Test
public void testXSLT2_2Passes() throws Exception {
String fileName1 = "ChangeRequestsByStatus.xsl";
WorkbenchContext context = setupFile(getxslTestFilesProjectName(), fileName1);
TestReporter reporter = new TestReporter();
sourceValidator.validate(context, reporter);
assertFalse("Messages were reported on file with valid XSLT 2.0", reporter.isMessageReported());
}
use of org.eclipse.wst.validation.internal.operations.WorkbenchContext in project webtools.sourceediting by eclipse.
the class TestDelegatingSourceValidatorForXSL method testXSLT2XPathPasses.
@Test
public void testXSLT2XPathPasses() throws Exception {
String fileName1 = "ChangeRequestsByResponsibility.xsl";
WorkbenchContext context = setupFile(getxslTestFilesProjectName(), fileName1);
TestReporter reporter = new TestReporter();
sourceValidator.validate(context, reporter);
assertFalse("Messages were reported on file with valid XPath 2.0", reporter.isMessageReported());
}
Aggregations