< prev index next >

test/javax/xml/jaxp/unittest/catalog/CatalogSupport2.java

Print this page

        

@@ -28,10 +28,12 @@
 import static jaxp.library.JAXPTestUtilities.setSystemProperty;
 
 import java.io.File;
 import java.io.IOException;
 import java.io.StringReader;
+import javax.xml.stream.XMLResolver;
+import javax.xml.stream.XMLStreamException;
 import javax.xml.transform.Source;
 import javax.xml.transform.TransformerException;
 import javax.xml.transform.URIResolver;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.sax.SAXSource;

@@ -48,11 +50,11 @@
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 
 /*
  * @test
- * @bug 8158084 8162438 8162442 8163535
+ * @bug 8158084 8162438 8162442 8163535 8166220
  * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
  * @run testng/othervm -DrunSecMngr=true catalog.CatalogSupport2
  * @run testng/othervm catalog.CatalogSupport2
  * @summary extends CatalogSupport tests, verifies that the use of the Catalog may
  * be disabled through the System property.

@@ -127,10 +129,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_StAXC")
+    public void testStAXC(boolean setUseCatalog, boolean useCatalog, String catalog,
+            String xml, XMLResolver resolver, String expected) throws Exception {
+        testStAXNegative(setUseCatalog, useCatalog, catalog, xml, resolver, expected);
+    }
+
+    /*
        Verifies the Catalog support on resolving DTD, xsd import and include in
     Schema files.
     */
     @Test(dataProvider = "data_SchemaC", expectedExceptions = SAXParseException.class)
     public void testValidationC(boolean setUseCatalog, boolean useCatalog, String catalog,

@@ -203,10 +214,21 @@
             {false, 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_StAXC")
+    public Object[][] getDataStAX() {
+        return new Object[][]{
+            {false, true, xml_catalog, xml_system, null, "null"},
+        };
+    }
+
+    /*
        DataProvider: for testing Schema validation
        Data: set use_catalog, use_catalog, catalog file, xsd file, a LSResourceResolver
      */
     @DataProvider(name = "data_SchemaC")
     public Object[][] getDataSchemaC() {

@@ -231,12 +253,12 @@
         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, false, true, xml_catalog);
+        StAXSource stax1 = getStaxSource(xml_val_test, xml_val_test_id, false, true, xml_catalog);
 
         StreamSource source = new StreamSource(new File(xml_val_test));
 
         return new Object[][]{
             // use catalog
< prev index next >