[491313] Allow user to ignore 'Referenced file contains errors' validation errors
Correct regression in o.e.w.xml.validation.tests.internal.HonourAllSchemaLocationsTest.testCanTurnOffHonourAllSchemaLocations()
diff --git a/tests/org.eclipse.wst.xml.validation.tests/src/org/eclipse/wst/xml/validation/tests/internal/HonourAllSchemaLocationsTest.java b/tests/org.eclipse.wst.xml.validation.tests/src/org/eclipse/wst/xml/validation/tests/internal/HonourAllSchemaLocationsTest.java
index 29e6b8b..e332d2e 100644
--- a/tests/org.eclipse.wst.xml.validation.tests/src/org/eclipse/wst/xml/validation/tests/internal/HonourAllSchemaLocationsTest.java
+++ b/tests/org.eclipse.wst.xml.validation.tests/src/org/eclipse/wst/xml/validation/tests/internal/HonourAllSchemaLocationsTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2016 IBM Corporation and others.
* 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
@@ -15,7 +15,11 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.wst.xml.core.internal.XMLCorePlugin;
+import org.eclipse.wst.xml.core.internal.preferences.XMLCorePreferenceNames;
import org.eclipse.wst.xml.core.internal.validation.XMLValidationConfiguration;
+import org.eclipse.wst.xml.core.internal.validation.core.ValidationMessage;
/**
@@ -57,12 +61,35 @@
List keys = new ArrayList();
keys.add(null);
keys.add("cvc-complex-type.2.4.d"); //$NON-NLS-1$
- int numErrors = 2;
+ int numErrors = 1;
int numWarnings = 0;
runTest(testFile, keys, numErrors, numWarnings);
}
+ public void testCanTurnOnReferencedFileErrors() {
+ String qualifier = XMLCorePlugin.getDefault().getBundle().getSymbolicName();
+ InstanceScope.INSTANCE.getNode(qualifier).putInt(XMLCorePreferenceNames.INDICATE_REFERENCED_FILE_CONTAINS_ERRORS, ValidationMessage.SEV_NORMAL);
+ try {
+ try {
+ configuration.setFeature(XMLValidationConfiguration.HONOUR_ALL_SCHEMA_LOCATIONS, false);
+ } catch (Exception e) {
+ fail();
+ }
+
+ String testFile = getTestFile();
+ List keys = new ArrayList();
+ keys.add(null);
+ keys.add("cvc-complex-type.2.4.d"); //$NON-NLS-1$
+ int numErrors = 2;
+ int numWarnings = 0;
+
+ runTest(testFile, keys, numErrors, numWarnings);
+ } finally {
+ InstanceScope.INSTANCE.getNode(qualifier).remove(XMLCorePreferenceNames.INDICATE_REFERENCED_FILE_CONTAINS_ERRORS);
+ }
+ }
+
private String getTestFile()
{
return FILE_PROTOCOL + PLUGIN_ABSOLUTE_PATH + SAMPLES_DIR + "XMLExamples/HonourAllSchemaLocations/A-instance.xml"; //$NON-NLS-1$