1 /* 2 * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 package javax.xml.parsers.ptests; 25 import static org.testng.Assert.assertFalse; 26 import static org.testng.Assert.assertTrue; 27 import javax.xml.parsers.SAXParserFactory; 28 import jaxp.library.JAXPBaseTest; 29 import org.testng.annotations.Test; 30 31 /** 32 * Class containing the test cases for SAXParserFactory API. 33 */ 34 public class SAXParserFactTest extends JAXPBaseTest { 35 36 private static final String NAMESPACES = "http://xml.org/sax/features/namespaces"; 37 private static final String NAMESPACE_PREFIXES = "http://xml.org/sax/features/namespace-prefixes"; 38 private static final String STRING_INTERNING = "http://xml.org/sax/features/string-interning"; 39 private static final String VALIDATION = "http://xml.org/sax/features/validation"; 40 private static final String EXTERNAL_G_ENTITIES = "http://xml.org/sax/features/external-general-entities"; 41 private static final String EXTERNAL_P_ENTITIES = "http://xml.org/sax/features/external-parameter-entities"; 42 43 /** 44 * Test if newSAXParser() method returns SAXParser. 45 * @throws Exception If any errors occur. 46 */ 47 @Test 48 public void testParser01() throws Exception { 49 SAXParserFactory spf = SAXParserFactory.newInstance(); 50 spf.newSAXParser(); 51 } 52 53 /** 54 * Test the default functionality (No validation) of the parser. | 1 /* 2 * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 package javax.xml.parsers.ptests; 25 import static org.testng.Assert.assertFalse; 26 import static org.testng.Assert.assertTrue; 27 28 import javax.xml.parsers.SAXParserFactory; 29 30 import org.testng.annotations.Listeners; 31 import org.testng.annotations.Test; 32 33 /** 34 * Class containing the test cases for SAXParserFactory API. 35 */ 36 @Listeners({jaxp.library.BasePolicy.class}) 37 public class SAXParserFactTest { 38 39 private static final String NAMESPACES = "http://xml.org/sax/features/namespaces"; 40 private static final String NAMESPACE_PREFIXES = "http://xml.org/sax/features/namespace-prefixes"; 41 private static final String STRING_INTERNING = "http://xml.org/sax/features/string-interning"; 42 private static final String VALIDATION = "http://xml.org/sax/features/validation"; 43 private static final String EXTERNAL_G_ENTITIES = "http://xml.org/sax/features/external-general-entities"; 44 private static final String EXTERNAL_P_ENTITIES = "http://xml.org/sax/features/external-parameter-entities"; 45 46 /** 47 * Test if newSAXParser() method returns SAXParser. 48 * @throws Exception If any errors occur. 49 */ 50 @Test 51 public void testParser01() throws Exception { 52 SAXParserFactory spf = SAXParserFactory.newInstance(); 53 spf.newSAXParser(); 54 } 55 56 /** 57 * Test the default functionality (No validation) of the parser. |