< prev index next >

test/javax/xml/jaxp/unittest/dom/Bug6582545Test.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 java.io.File;
  27 import java.io.IOException;
  28 
  29 import javax.xml.parsers.DocumentBuilder;
  30 import javax.xml.parsers.DocumentBuilderFactory;
  31 import javax.xml.parsers.ParserConfigurationException;
  32 


  33 import org.testng.Assert;

  34 import org.testng.annotations.Test;
  35 import org.w3c.dom.Document;
  36 import org.w3c.dom.NamedNodeMap;
  37 import org.w3c.dom.NodeList;
  38 import org.xml.sax.SAXException;
  39 
  40 /*
  41  * @bug 6582545
  42  * @summary Test the value is correct when iterating attributes.
  43  */

  44 public class Bug6582545Test {
  45     private DocumentBuilder xmlParser = null;
  46     private Document document = null;
  47     private String FWS1 = "FWS1";
  48     private String KEY_ARROW_UP = "KEY_ARROW_UP";
  49     private String VALUE_ARROW_UP = "root%LRM%Tmp_CPIOM-C1%VLIN_For_ECP%ECP_IN_Port_1%IOM-A7_Msg_cd30%FDS_1_ECP_to_FWS-1%A31_ECP_ARROW_UP";
  50 
  51     @Test
  52     public void testAttributeCaching() {
  53 
  54         File xmlFile = new File(getClass().getResource("Bug6582545.xml").getFile());
  55 
  56         try {
  57             DocumentBuilderFactory aDocumentBuilderFactory = DocumentBuilderFactory.newInstance();
  58             xmlParser = aDocumentBuilderFactory.newDocumentBuilder();
  59 
  60             // works fine with JDK 1.4.2, 1.5
  61             // does not work with JDK 1.6
  62             document = xmlParser.parse(xmlFile);
  63             printNode(FWS1);


   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 java.io.File;
  27 import java.io.IOException;
  28 
  29 import javax.xml.parsers.DocumentBuilder;
  30 import javax.xml.parsers.DocumentBuilderFactory;
  31 import javax.xml.parsers.ParserConfigurationException;
  32 
  33 import jaxp.library.JAXPTestUtilities;
  34 
  35 import org.testng.Assert;
  36 import org.testng.annotations.Listeners;
  37 import org.testng.annotations.Test;
  38 import org.w3c.dom.Document;
  39 import org.w3c.dom.NamedNodeMap;
  40 import org.w3c.dom.NodeList;
  41 import org.xml.sax.SAXException;
  42 
  43 /*
  44  * @bug 6582545
  45  * @summary Test the value is correct when iterating attributes.
  46  */
  47 @Listeners({jaxp.library.FilePolicy.class})
  48 public class Bug6582545Test {
  49     private DocumentBuilder xmlParser = null;
  50     private Document document = null;
  51     private String FWS1 = "FWS1";
  52     private String KEY_ARROW_UP = "KEY_ARROW_UP";
  53     private String VALUE_ARROW_UP = "root%LRM%Tmp_CPIOM-C1%VLIN_For_ECP%ECP_IN_Port_1%IOM-A7_Msg_cd30%FDS_1_ECP_to_FWS-1%A31_ECP_ARROW_UP";
  54 
  55     @Test
  56     public void testAttributeCaching() {
  57 
  58         File xmlFile = new File(getClass().getResource("Bug6582545.xml").getFile());
  59 
  60         try {
  61             DocumentBuilderFactory aDocumentBuilderFactory = DocumentBuilderFactory.newInstance();
  62             xmlParser = aDocumentBuilderFactory.newDocumentBuilder();
  63 
  64             // works fine with JDK 1.4.2, 1.5
  65             // does not work with JDK 1.6
  66             document = xmlParser.parse(xmlFile);
  67             printNode(FWS1);


< prev index next >