< prev index next >

test/javax/xml/jaxp/unittest/dom/Bug6339023.java

Print this page


   1 /*
   2  * Copyright (c) 2014, 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 dom;
  25 
  26 import javax.xml.parsers.DocumentBuilder;
  27 import javax.xml.parsers.DocumentBuilderFactory;
  28 
  29 import org.testng.Assert;

  30 import org.testng.annotations.Test;
  31 import org.w3c.dom.DOMConfiguration;
  32 import org.w3c.dom.DOMImplementation;
  33 import org.w3c.dom.DOMStringList;
  34 import org.w3c.dom.ls.DOMImplementationLS;
  35 import org.w3c.dom.ls.LSParser;
  36 import org.w3c.dom.ls.LSSerializer;
  37 
  38 /*
  39  * @bug 6339023
  40  * @summary Test normalize-characters.
  41  */

  42 public class Bug6339023 {
  43 
  44     /*
  45      * This test checks DOMConfiguration for DOM Level3 Load and Save
  46      * implementation.
  47      */
  48     @Test
  49     public void testLSSerializer() {
  50         try {
  51             DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
  52             DOMImplementation impln = parser.getDOMImplementation();
  53             DOMImplementationLS lsImpln = (DOMImplementationLS) impln.getFeature("LS", "3.0");
  54             LSSerializer serializer = lsImpln.createLSSerializer();
  55             DOMConfiguration domConfig = serializer.getDomConfig();
  56             System.out.println("DOMConfig: " + domConfig.toString());
  57             Assert.assertTrue(domConfig.getParameter("normalize-characters") == null);
  58             System.out.println("value: " + domConfig.getParameter("normalize-characters"));
  59 
  60             DOMStringList list = domConfig.getParameterNames();
  61             for (int i = 0; i < list.getLength(); i++) {


   1 /*
   2  * Copyright (c) 2014, 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 dom;
  25 
  26 import javax.xml.parsers.DocumentBuilder;
  27 import javax.xml.parsers.DocumentBuilderFactory;
  28 
  29 import org.testng.Assert;
  30 import org.testng.annotations.Listeners;
  31 import org.testng.annotations.Test;
  32 import org.w3c.dom.DOMConfiguration;
  33 import org.w3c.dom.DOMImplementation;
  34 import org.w3c.dom.DOMStringList;
  35 import org.w3c.dom.ls.DOMImplementationLS;
  36 import org.w3c.dom.ls.LSParser;
  37 import org.w3c.dom.ls.LSSerializer;
  38 
  39 /*
  40  * @bug 6339023
  41  * @summary Test normalize-characters.
  42  */
  43 @Listeners({jaxp.library.BasePolicy.class})
  44 public class Bug6339023 {
  45 
  46     /*
  47      * This test checks DOMConfiguration for DOM Level3 Load and Save
  48      * implementation.
  49      */
  50     @Test
  51     public void testLSSerializer() {
  52         try {
  53             DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
  54             DOMImplementation impln = parser.getDOMImplementation();
  55             DOMImplementationLS lsImpln = (DOMImplementationLS) impln.getFeature("LS", "3.0");
  56             LSSerializer serializer = lsImpln.createLSSerializer();
  57             DOMConfiguration domConfig = serializer.getDomConfig();
  58             System.out.println("DOMConfig: " + domConfig.toString());
  59             Assert.assertTrue(domConfig.getParameter("normalize-characters") == null);
  60             System.out.println("value: " + domConfig.getParameter("normalize-characters"));
  61 
  62             DOMStringList list = domConfig.getParameterNames();
  63             for (int i = 0; i < list.getLength(); i++) {


< prev index next >