< prev index next >
test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -20,47 +20,51 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javax.xml.transform.ptests;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
import java.io.File;
import java.io.FileInputStream;
import java.util.Properties;
+
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.ErrorListener;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
/**
* Basic test cases for Transformer API
*/
-public class TransformerTest extends JAXPFileReadOnlyBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class TransformerTest {
/**
* XSLT file serves every test method.
*/
private final static String TEST_XSL = XML_DIR + "cities.xsl";
/**
* This tests if newTransformer(StreamSource) method returns Transformer.
* @throws TransformerConfigurationException If for some reason the
* TransformerHandler can not be created.
*/
- @Test (groups = {"readLocalFiles"})
+ @Test
public void transformer01() throws TransformerConfigurationException {
TransformerFactory tfactory = TransformerFactory.newInstance();
StreamSource streamSource = new StreamSource(
new File(TEST_XSL));
Transformer transformer = tfactory.newTransformer(streamSource);
@@ -69,11 +73,11 @@
/**
* This tests if newTransformer(SAXSource) method returns Transformer.
* @throws Exception If any errors occur.
*/
- @Test (groups = {"readLocalFiles"})
+ @Test
public void transformer02() throws Exception {
try (FileInputStream fis = new FileInputStream(TEST_XSL)) {
TransformerFactory tfactory = TransformerFactory.newInstance();
SAXSource saxSource = new SAXSource(new InputSource(fis));
Transformer transformer = tfactory.newTransformer(saxSource);
@@ -84,11 +88,11 @@
/**
* This tests if newTransformer(DOMSource) method returns Transformer.
*
* @throws Exception If any errors occur.
*/
- @Test (groups = {"readLocalFiles"})
+ @Test
public void transformer03() throws Exception {
TransformerFactory tfactory = TransformerFactory.newInstance();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
@@ -103,11 +107,11 @@
/**
* This tests set/get ErrorListener methods of Transformer.
*
* @throws Exception If any errors occur.
*/
- @Test (groups = {"readLocalFiles"})
+ @Test
public void transformer04() throws Exception {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
DocumentBuilder db = dbf.newDocumentBuilder();
Document document = db.parse(new File(TEST_XSL));
@@ -123,11 +127,11 @@
/**
* This tests getOutputProperties() method of Transformer.
*
* @throws Exception If any errors occur.
*/
- @Test (groups = {"readLocalFiles"})
+ @Test
public void transformer05() throws Exception {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
DocumentBuilder db = dbf.newDocumentBuilder();
Document document = db.parse(new File(TEST_XSL));
@@ -148,11 +152,11 @@
/**
* This tests getOutputProperty() method of Transformer.
*
* @throws Exception If any errors occur.
*/
- @Test (groups = {"readLocalFiles"})
+ @Test
public void transformer06() throws Exception {
TransformerFactory tfactory = TransformerFactory.newInstance();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
< prev index next >