< prev index next >

test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java

Print this page


   1 /*
   2  * Copyright (c) 2003, 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 package javax.xml.transform.ptests;
  24 
  25 import java.io.*;
  26 
  27 import javax.xml.parsers.*;
  28 import javax.xml.transform.*;
  29 import javax.xml.transform.dom.*;
  30 
  31 import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
  32 import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
  33 
  34 import javax.xml.transform.stream.*;
  35 
  36 import jaxp.library.JAXPDataProvider;
  37 import jaxp.library.JAXPFileBaseTest;
  38 import static jaxp.library.JAXPTestUtilities.USER_DIR;
  39 import static jaxp.library.JAXPTestUtilities.compareWithGold;
  40 import static org.testng.Assert.assertNotNull;
  41 import static org.testng.Assert.assertTrue;
  42 















  43 import org.testng.annotations.DataProvider;

  44 import org.testng.annotations.Test;
  45 import org.w3c.dom.*;
  46 
  47 /**
  48  * Class containing the test cases for TransformerFactory API's
  49  * getAssociatedStyleSheet method and TransformerFactory.newInstance(factoryClassName , classLoader).
  50  */
  51 public class TransformerFactoryTest extends JAXPFileBaseTest {

  52     /**
  53      * TransformerFactory implementation class name.
  54      */
  55     private static final String TRANSFORMER_FACTORY_CLASSNAME = "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl";
  56 
  57     /**
  58      * Provide valid TransformerFactory instantiation parameters.
  59      *
  60      * @return a data provider contains TransformerFactory instantiation parameters.
  61      */
  62     @DataProvider(name = "parameters")
  63     public Object[][] getValidateParameters() {
  64         return new Object[][] { { TRANSFORMER_FACTORY_CLASSNAME, null }, { TRANSFORMER_FACTORY_CLASSNAME, this.getClass().getClassLoader() } };
  65     }
  66 
  67     /**
  68      * Test for TransformerFactory.newInstance(java.lang.String
  69      * factoryClassName, java.lang.ClassLoader classLoader) factoryClassName
  70      * points to correct implementation of
  71      * javax.xml.transform.TransformerFactory , should return newInstance of


   1 /*
   2  * Copyright (c) 2003, 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 package javax.xml.transform.ptests;
  24 






  25 import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
  26 import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;





  27 import static jaxp.library.JAXPTestUtilities.USER_DIR;
  28 import static jaxp.library.JAXPTestUtilities.compareWithGold;
  29 import static org.testng.Assert.assertNotNull;
  30 import static org.testng.Assert.assertTrue;
  31 
  32 import java.io.FileInputStream;
  33 import java.io.FileOutputStream;
  34 
  35 import javax.xml.parsers.DocumentBuilder;
  36 import javax.xml.parsers.DocumentBuilderFactory;
  37 import javax.xml.transform.Source;
  38 import javax.xml.transform.Transformer;
  39 import javax.xml.transform.TransformerConfigurationException;
  40 import javax.xml.transform.TransformerFactory;
  41 import javax.xml.transform.TransformerFactoryConfigurationError;
  42 import javax.xml.transform.dom.DOMSource;
  43 import javax.xml.transform.stream.StreamResult;
  44 
  45 import jaxp.library.JAXPDataProvider;
  46 
  47 import org.testng.annotations.DataProvider;
  48 import org.testng.annotations.Listeners;
  49 import org.testng.annotations.Test;
  50 import org.w3c.dom.Document;
  51 
  52 /**
  53  * Class containing the test cases for TransformerFactory API's
  54  * getAssociatedStyleSheet method and TransformerFactory.newInstance(factoryClassName , classLoader).
  55  */
  56 @Listeners({jaxp.library.FilePolicy.class})
  57 public class TransformerFactoryTest {
  58     /**
  59      * TransformerFactory implementation class name.
  60      */
  61     private static final String TRANSFORMER_FACTORY_CLASSNAME = "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl";
  62 
  63     /**
  64      * Provide valid TransformerFactory instantiation parameters.
  65      *
  66      * @return a data provider contains TransformerFactory instantiation parameters.
  67      */
  68     @DataProvider(name = "parameters")
  69     public Object[][] getValidateParameters() {
  70         return new Object[][] { { TRANSFORMER_FACTORY_CLASSNAME, null }, { TRANSFORMER_FACTORY_CLASSNAME, this.getClass().getClassLoader() } };
  71     }
  72 
  73     /**
  74      * Test for TransformerFactory.newInstance(java.lang.String
  75      * factoryClassName, java.lang.ClassLoader classLoader) factoryClassName
  76      * points to correct implementation of
  77      * javax.xml.transform.TransformerFactory , should return newInstance of


< prev index next >