< prev index next >

test/javax/xml/jaxp/unittest/transform/Bug6206491.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 transform;
  25 
  26 import java.io.File;
  27 import java.io.IOException;
  28 import java.io.StringWriter;
  29 
  30 import javax.xml.parsers.DocumentBuilder;
  31 import javax.xml.parsers.DocumentBuilderFactory;
  32 import javax.xml.parsers.ParserConfigurationException;
  33 import javax.xml.transform.Transformer;
  34 import javax.xml.transform.TransformerConfigurationException;
  35 import javax.xml.transform.TransformerException;
  36 import javax.xml.transform.TransformerFactory;
  37 import javax.xml.transform.dom.DOMSource;
  38 import javax.xml.transform.stream.StreamResult;
  39 import javax.xml.transform.stream.StreamSource;
  40 
  41 import org.testng.Assert;

  42 import org.testng.annotations.Test;
  43 import org.w3c.dom.Document;
  44 import org.xml.sax.SAXException;
  45 import org.xml.sax.SAXParseException;
  46 
  47 /*
  48  * @bug 6206491
  49  * @summary Test key searches over more than one document.
  50  */

  51 public class Bug6206491 {
  52 
  53     private String getResource(String s) {
  54         return getClass().getResource(s).toString();
  55 
  56     }
  57 
  58     @Test
  59     public void test() {
  60         try {
  61             Document document = getNewXmlDoc(new File(getClass().getResource("Bug6206491.xml").getFile()));
  62 
  63             xmlxsl2html(TransformerFactory.newInstance(), new File(getClass().getResource("Bug6206491.xsl").getFile()), document);
  64         } catch (Exception ex) {
  65             System.err.println(ex.getMessage());
  66             ex.printStackTrace(System.err);
  67             Assert.fail(ex.toString());
  68         }
  69     }
  70 


   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 transform;
  25 
  26 import java.io.File;
  27 import java.io.IOException;
  28 import java.io.StringWriter;
  29 
  30 import javax.xml.parsers.DocumentBuilder;
  31 import javax.xml.parsers.DocumentBuilderFactory;
  32 import javax.xml.parsers.ParserConfigurationException;
  33 import javax.xml.transform.Transformer;
  34 import javax.xml.transform.TransformerConfigurationException;
  35 import javax.xml.transform.TransformerException;
  36 import javax.xml.transform.TransformerFactory;
  37 import javax.xml.transform.dom.DOMSource;
  38 import javax.xml.transform.stream.StreamResult;
  39 import javax.xml.transform.stream.StreamSource;
  40 
  41 import org.testng.Assert;
  42 import org.testng.annotations.Listeners;
  43 import org.testng.annotations.Test;
  44 import org.w3c.dom.Document;
  45 import org.xml.sax.SAXException;
  46 import org.xml.sax.SAXParseException;
  47 
  48 /*
  49  * @bug 6206491
  50  * @summary Test key searches over more than one document.
  51  */
  52 @Listeners({jaxp.library.FilePolicy.class})
  53 public class Bug6206491 {
  54 
  55     private String getResource(String s) {
  56         return getClass().getResource(s).toString();
  57 
  58     }
  59 
  60     @Test
  61     public void test() {
  62         try {
  63             Document document = getNewXmlDoc(new File(getClass().getResource("Bug6206491.xml").getFile()));
  64 
  65             xmlxsl2html(TransformerFactory.newInstance(), new File(getClass().getResource("Bug6206491.xsl").getFile()), document);
  66         } catch (Exception ex) {
  67             System.err.println(ex.getMessage());
  68             ex.printStackTrace(System.err);
  69             Assert.fail(ex.toString());
  70         }
  71     }
  72 


< prev index next >