< prev index next >
test/javax/xml/jaxp/unittest/catalog/CatalogSupport4.java
Print this page
@@ -26,11 +26,11 @@
import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
import static jaxp.library.JAXPTestUtilities.setSystemProperty;
import java.io.File;
import java.io.StringReader;
-
+import javax.xml.stream.XMLResolver;
import javax.xml.transform.Source;
import javax.xml.transform.URIResolver;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stax.StAXSource;
@@ -44,11 +44,11 @@
import org.w3c.dom.ls.LSResourceResolver;
import org.xml.sax.InputSource;
/**
* @test
- * @bug 8158084 8162438 8162442
+ * @bug 8158084 8162438 8162442 8166220
* @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
* @run testng/othervm -DrunSecMngr=true catalog.CatalogSupport4
* @run testng/othervm catalog.CatalogSupport4
* @summary verifies the overriding over of the USE_CATALOG feature. Extending
* CatalogSupport tests, the USE_CATALOG is turned off system-wide, however,
@@ -116,10 +116,19 @@
String xml, MyHandler handler, String expected) throws Exception {
testDOM(setUseCatalog, useCatalog, catalog, xml, handler, expected);
}
/*
+ Verifies the Catalog support on XMLStreamReader.
+ */
+ @Test(dataProvider = "data_StAXA")
+ public void testStAXA(boolean setUseCatalog, boolean useCatalog, String catalog,
+ String xml, XMLResolver resolver, String expected) throws Exception {
+ testStAX(setUseCatalog, useCatalog, catalog, xml, resolver, expected);
+ }
+
+ /*
Verifies the Catalog support on resolving DTD, xsd import and include in
Schema files.
*/
@Test(dataProvider = "data_SchemaA")
public void testValidationA(boolean setUseCatalog, boolean useCatalog,
@@ -197,10 +206,22 @@
return new Object[][]{
{true, true, xml_catalog, xml_system, new MyHandler(elementInSystem), expectedWCatalog},
};
}
+ /*
+ DataProvider: for testing the StAX parser
+ Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
+ */
+ @DataProvider(name = "data_StAXA")
+ public Object[][] getDataStAX() {
+
+ return new Object[][]{
+ {true, true, xml_catalog, xml_system, null, expectedWCatalog},
+ };
+ }
+
MyEntityHandler getMyEntityHandler(String elementName, String[] systemIds, InputSource... returnValues) {
return new MyEntityHandler(systemIds, returnValues, elementName);
}
/*
@@ -228,23 +249,23 @@
DOMSource ds = getDOMSource(xml_val_test, xml_val_test_id, true, true, xml_catalog);
SAXSource ss = new SAXSource(new InputSource(xml_val_test));
ss.setSystemId(xml_val_test_id);
- StAXSource stax = getStaxSource(xml_val_test, xml_val_test_id);
- StAXSource stax1 = getStaxSource(xml_val_test, xml_val_test_id);
+ StAXSource stax = getStaxSource(xml_val_test, xml_val_test_id, true, true, xml_catalog);
+ StAXSource stax1 = getStaxSource(xml_val_test, xml_val_test_id, true, true, xml_catalog);
StreamSource source = new StreamSource(new File(xml_val_test));
return new Object[][]{
// use catalog
{true, false, true, ds, null, null, xml_catalog, null},
{false, true, true, ds, null, null, null, xml_catalog},
{true, false, true, ss, null, null, xml_catalog, null},
{false, true, true, ss, null, null, null, xml_catalog},
- {true, false, true, stax, null, null, xml_catalog, null},
- {false, true, true, stax1, null, null, null, xml_catalog},
+ {true, false, true, stax, null, null, xml_catalog, xml_catalog},
+ {false, true, true, stax1, null, null, xml_catalog, xml_catalog},
{true, false, true, source, null, null, xml_catalog, null},
{false, true, true, source, null, null, null, xml_catalog},
};
}
< prev index next >