author | fyuan |
Mon, 08 Aug 2016 12:50:00 +0800 | |
changeset 40223 | 64662417aa2d |
parent 32156 | 8def5917a696 |
child 40829 | ad509d5baa06 |
permissions | -rw-r--r-- |
32156
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
1 |
/* |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
2 |
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
4 |
* |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
8 |
* |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
13 |
* accompanied this code). |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
14 |
* |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
18 |
* |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
21 |
* questions. |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
22 |
*/ |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
23 |
|
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
24 |
package stream.XMLStreamWriterTest; |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
25 |
|
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
26 |
import java.io.StringWriter; |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
27 |
|
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
28 |
import javax.xml.stream.XMLOutputFactory; |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
29 |
import javax.xml.stream.XMLStreamWriter; |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
30 |
|
40223
64662417aa2d
8067170: Enable security manager on JAXP unit tests and make some improvement
fyuan
parents:
32156
diff
changeset
|
31 |
import org.testng.annotations.Listeners; |
32156
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
32 |
import org.testng.annotations.Test; |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
33 |
|
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
34 |
/* |
40223
64662417aa2d
8067170: Enable security manager on JAXP unit tests and make some improvement
fyuan
parents:
32156
diff
changeset
|
35 |
* @test |
32156
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
36 |
* @bug 6391922 |
40223
64662417aa2d
8067170: Enable security manager on JAXP unit tests and make some improvement
fyuan
parents:
32156
diff
changeset
|
37 |
* @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest |
64662417aa2d
8067170: Enable security manager on JAXP unit tests and make some improvement
fyuan
parents:
32156
diff
changeset
|
38 |
* @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.NullUriDetectionTest |
64662417aa2d
8067170: Enable security manager on JAXP unit tests and make some improvement
fyuan
parents:
32156
diff
changeset
|
39 |
* @run testng/othervm stream.XMLStreamWriterTest.NullUriDetectionTest |
32156
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
40 |
* @summary Test XMLStreamWriter can writeDefaultNamespace(null). |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
41 |
*/ |
40223
64662417aa2d
8067170: Enable security manager on JAXP unit tests and make some improvement
fyuan
parents:
32156
diff
changeset
|
42 |
@Listeners({jaxp.library.BasePolicy.class}) |
32156
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
43 |
public class NullUriDetectionTest { |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
44 |
@Test |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
45 |
public void test1() throws Exception { |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
46 |
XMLOutputFactory xof = XMLOutputFactory.newInstance(); |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
47 |
xof.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE); |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
48 |
|
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
49 |
StringWriter sw = new StringWriter(); |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
50 |
XMLStreamWriter w = xof.createXMLStreamWriter(sw); |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
51 |
w.writeStartDocument(); |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
52 |
w.writeStartElement("foo", "bar", "zot"); |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
53 |
w.writeDefaultNamespace(null); |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
54 |
w.writeCharacters("---"); |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
55 |
} |
8def5917a696
8132660: Change jaxp unit test package name to be different with jaxp api
joehw
parents:
diff
changeset
|
56 |
} |
40223
64662417aa2d
8067170: Enable security manager on JAXP unit tests and make some improvement
fyuan
parents:
32156
diff
changeset
|
57 |