1/*
2 * Copyright (c) 2012, 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/*
25 * @test
26 * @bug 6559064 6942504
27 *
28 * @summary Verify DOM L3 Node APIs behave as per Image I/O spec.
29 *
30 * @run main DOML3Node
31 */
32
33import javax.imageio.metadata.IIOMetadataNode;
34import org.w3c.dom.Attr;
35import org.w3c.dom.Node;
36import org.w3c.dom.DOMException;
37import org.w3c.dom.UserDataHandler;
38
39
40public class DOML3Node {
41
42    public static void main(String args[]) {
43        IIOMetadataNode node = new IIOMetadataNode("node");
44
45        try {
46            node.setIdAttribute("name", true);
47            throw new RuntimeException("No expected DOM exception");
48        } catch (DOMException e) {
49        }
50
51        try {
52            node.setIdAttributeNS("namespaceURI", "localName", true);
53            throw new RuntimeException("No expected DOM exception");
54        } catch (DOMException e) {
55        }
56
57        try {
58            node.setIdAttributeNode((Attr)null, true);
59            throw new RuntimeException("No expected DOM exception");
60        } catch (DOMException e) {
61        }
62
63        try {
64            node.getSchemaTypeInfo();
65            throw new RuntimeException("No expected DOM exception");
66        } catch (DOMException e) {
67        }
68
69        try {
70            node.setUserData("key", null, (UserDataHandler)null);
71            throw new RuntimeException("No expected DOM exception");
72        } catch (DOMException e) {
73        }
74
75        try {
76            node.getUserData("key");
77            throw new RuntimeException("No expected DOM exception");
78        } catch (DOMException e) {
79        }
80
81        try {
82            node.getFeature("feature", "version");
83            throw new RuntimeException("No expected DOM exception");
84        } catch (DOMException e) {
85        }
86
87        try {
88            node.isSameNode((Node)null);
89            throw new RuntimeException("No expected DOM exception");
90        } catch (DOMException e) {
91        }
92
93        try {
94            node.isEqualNode((Node)null);
95            throw new RuntimeException("No expected DOM exception");
96        } catch (DOMException e) {
97        }
98
99        try {
100            node.lookupNamespaceURI("prefix");
101            throw new RuntimeException("No expected DOM exception");
102        } catch (DOMException e) {
103        }
104
105        try {
106            node.isDefaultNamespace("namespaceURI");
107            throw new RuntimeException("No expected DOM exception");
108        } catch (DOMException e) {
109        }
110
111        try {
112            node.lookupPrefix("namespaceURI");
113            throw new RuntimeException("No expected DOM exception");
114        } catch (DOMException e) {
115        }
116
117        try {
118            node.getTextContent();
119            throw new RuntimeException("No expected DOM exception");
120        } catch (DOMException e) {
121        }
122
123        try {
124            node.setTextContent("textContent");
125            throw new RuntimeException("No expected DOM exception");
126        } catch (DOMException e) {
127        }
128
129        try {
130            node.compareDocumentPosition((Node)null);
131            throw new RuntimeException("No expected DOM exception");
132        } catch (DOMException e) {
133        }
134
135        try {
136            node.getBaseURI();
137            throw new RuntimeException("No expected DOM exception");
138        } catch (DOMException e) {
139        }
140    }
141}
142