test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/CustomImplTest.java
changeset 57915 8570f22b9b6a
equal deleted inserted replaced
57914:9c98f8788762 57915:8570f22b9b6a
       
     1 /*
       
     2  * Copyright (c) 2019, 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 stream.XMLStreamWriterTest;
       
    25 
       
    26 import javax.xml.namespace.NamespaceContext;
       
    27 import javax.xml.stream.XMLOutputFactory;
       
    28 import javax.xml.stream.XMLStreamWriter;
       
    29 import javax.xml.stream.XMLStreamException;
       
    30 import javax.xml.transform.stax.StAXResult;
       
    31 import org.testng.annotations.Test;
       
    32 
       
    33 /*
       
    34  * @test
       
    35  * @bug 8230094
       
    36  * @run testng stream.XMLStreamWriterTest.CustomImplTest
       
    37  * @summary Verifies custom implementation of the XMLStreamWriter.
       
    38  */
       
    39 public class CustomImplTest {
       
    40 
       
    41     @Test
       
    42     public void testEventReader() throws Exception {
       
    43         XMLOutputFactory.newFactory()
       
    44                 .createXMLEventWriter(new StAXResult(new StreamWriterFilter()));
       
    45     }
       
    46 
       
    47     static class StreamWriterFilter implements XMLStreamWriter
       
    48     {
       
    49         @Override
       
    50         public void writeStartElement(String localName)
       
    51                 throws XMLStreamException
       
    52         {
       
    53         }
       
    54 
       
    55         @Override
       
    56         public void writeStartElement(String namespaceURI, String localName)
       
    57                 throws XMLStreamException
       
    58         {
       
    59         }
       
    60 
       
    61         @Override
       
    62         public void writeStartElement(
       
    63                 String prefix, String localName, String namespaceURI)
       
    64                 throws XMLStreamException
       
    65         {
       
    66         }
       
    67 
       
    68         @Override
       
    69         public void writeEmptyElement(String namespaceURI, String localName)
       
    70                 throws XMLStreamException
       
    71         {
       
    72         }
       
    73 
       
    74         @Override
       
    75         public void writeEmptyElement(
       
    76                 String prefix, String localName, String namespaceURI)
       
    77                 throws XMLStreamException
       
    78         {
       
    79         }
       
    80 
       
    81         @Override
       
    82         public void writeEmptyElement(String localName)
       
    83                 throws XMLStreamException
       
    84         {
       
    85         }
       
    86 
       
    87         @Override
       
    88         public void writeEndElement() throws XMLStreamException
       
    89         {
       
    90         }
       
    91 
       
    92         @Override
       
    93         public void writeEndDocument() throws XMLStreamException
       
    94         {
       
    95         }
       
    96 
       
    97         @Override
       
    98         public void close() throws XMLStreamException
       
    99         {
       
   100         }
       
   101 
       
   102         @Override
       
   103         public void flush() throws XMLStreamException
       
   104         {
       
   105         }
       
   106 
       
   107         @Override
       
   108         public void writeAttribute(String localName, String value)
       
   109                 throws XMLStreamException
       
   110         {
       
   111         }
       
   112 
       
   113         @Override
       
   114         public void writeAttribute(
       
   115                 String prefix, String namespaceURI, String localName, String value)
       
   116                 throws XMLStreamException
       
   117         {
       
   118         }
       
   119 
       
   120         @Override
       
   121         public void writeAttribute(
       
   122                 String namespaceURI, String localName, String value)
       
   123                 throws XMLStreamException
       
   124         {
       
   125         }
       
   126 
       
   127         @Override
       
   128         public void writeNamespace(String prefix, String namespaceURI)
       
   129                 throws XMLStreamException
       
   130         {
       
   131         }
       
   132 
       
   133         @Override
       
   134         public void writeDefaultNamespace(String namespaceURI)
       
   135                 throws XMLStreamException
       
   136         {
       
   137         }
       
   138 
       
   139         @Override
       
   140         public void writeComment(String data) throws XMLStreamException
       
   141         {
       
   142         }
       
   143 
       
   144         @Override
       
   145         public void writeProcessingInstruction(String target)
       
   146                 throws XMLStreamException
       
   147         {
       
   148         }
       
   149 
       
   150         @Override
       
   151         public void writeProcessingInstruction(String target, String data)
       
   152                 throws XMLStreamException
       
   153         {
       
   154         }
       
   155 
       
   156         @Override
       
   157         public void writeCData(String data) throws XMLStreamException
       
   158         {
       
   159         }
       
   160 
       
   161         @Override
       
   162         public void writeDTD(String dtd) throws XMLStreamException
       
   163         {
       
   164         }
       
   165 
       
   166         @Override
       
   167         public void writeEntityRef(String name) throws XMLStreamException
       
   168         {
       
   169         }
       
   170 
       
   171         @Override
       
   172         public void writeStartDocument() throws XMLStreamException
       
   173         {
       
   174         }
       
   175 
       
   176         @Override
       
   177         public void writeStartDocument(String version) throws XMLStreamException
       
   178         {
       
   179         }
       
   180 
       
   181         @Override
       
   182         public void writeStartDocument(String encoding, String version)
       
   183                 throws XMLStreamException
       
   184         {
       
   185         }
       
   186 
       
   187         @Override
       
   188         public void writeCharacters(String text) throws XMLStreamException
       
   189         {
       
   190         }
       
   191 
       
   192         @Override
       
   193         public void writeCharacters(char[] text, int start, int len)
       
   194                 throws XMLStreamException
       
   195         {
       
   196         }
       
   197 
       
   198         @Override
       
   199         public String getPrefix(String uri) throws XMLStreamException
       
   200         {
       
   201             return null;
       
   202         }
       
   203 
       
   204         @Override
       
   205         public void setPrefix(String prefix, String uri)
       
   206                 throws XMLStreamException
       
   207         {
       
   208         }
       
   209 
       
   210         @Override
       
   211         public void setDefaultNamespace(String uri) throws XMLStreamException
       
   212         {
       
   213         }
       
   214 
       
   215         @Override
       
   216         public void setNamespaceContext(NamespaceContext context)
       
   217                 throws XMLStreamException
       
   218         {
       
   219         }
       
   220 
       
   221         @Override
       
   222         public NamespaceContext getNamespaceContext()
       
   223         {
       
   224             throw new UnsupportedOperationException();
       
   225         }
       
   226 
       
   227         @Override
       
   228         public Object getProperty(String name) throws IllegalArgumentException
       
   229         {
       
   230             throw new UnsupportedOperationException();
       
   231         }
       
   232     }
       
   233 
       
   234 }