1 /*
2 * Copyright (c) 2014, 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
24 package dom.ls;
25
26 import java.io.IOException;
27 import java.io.StringBufferInputStream;
28
29 import javax.xml.parsers.DocumentBuilder;
30 import javax.xml.parsers.DocumentBuilderFactory;
31 import javax.xml.parsers.ParserConfigurationException;
32
33 import org.testng.Assert;
34 import org.testng.annotations.Test;
35 import org.w3c.dom.Attr;
36 import org.w3c.dom.DOMImplementation;
37 import org.w3c.dom.Document;
38 import org.w3c.dom.Element;
39 import org.w3c.dom.NamedNodeMap;
40 import org.w3c.dom.Node;
41 import org.w3c.dom.NodeList;
42 import org.w3c.dom.ls.DOMImplementationLS;
43 import org.w3c.dom.ls.LSInput;
44 import org.w3c.dom.ls.LSParser;
45 import org.w3c.dom.ls.LSParserFilter;
46 import org.w3c.dom.traversal.NodeFilter;
47 import org.xml.sax.SAXException;
48
49 /*
50 * @summary Test Specifications and Descriptions for LSParser.
51 */
52 public class LSParserTCKTest {
53
54 DOMImplementationLS implLS = null;
55 public String xml1 = "<?xml version=\"1.0\"?><ROOT><ELEMENT1><CHILD1/><CHILD1><COC1/></CHILD1></ELEMENT1><ELEMENT2>test1<CHILD2/></ELEMENT2></ROOT>";
56
57 /**
58 * Equivalence class partitioning
59 * with state, input and output values orientation
60 * for public Document parse(LSInput is),
61 * <br><b>pre-conditions</b>: set filter that REJECTs any CHILD* node,
62 * <br><b>is</b>: xml1
63 * <br><b>output</b>: XML document with ELEMNENT1 and ELEMENT2 only.
64 */
65 @Test
66 public void testfilter0001() {
67 LSParser parser = createLSParser();
68 if (parser == null) {
69 Assert.fail("Unable to create LSParser!");
70 }
71 // set filter
|
1 /*
2 * Copyright (c) 2014, 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
24 package dom.ls;
25
26 import java.io.IOException;
27 import java.io.StringBufferInputStream;
28
29 import javax.xml.parsers.DocumentBuilder;
30 import javax.xml.parsers.DocumentBuilderFactory;
31 import javax.xml.parsers.ParserConfigurationException;
32
33 import org.testng.Assert;
34 import org.testng.annotations.Listeners;
35 import org.testng.annotations.Test;
36 import org.w3c.dom.Attr;
37 import org.w3c.dom.DOMImplementation;
38 import org.w3c.dom.Document;
39 import org.w3c.dom.Element;
40 import org.w3c.dom.NamedNodeMap;
41 import org.w3c.dom.Node;
42 import org.w3c.dom.NodeList;
43 import org.w3c.dom.ls.DOMImplementationLS;
44 import org.w3c.dom.ls.LSInput;
45 import org.w3c.dom.ls.LSParser;
46 import org.w3c.dom.ls.LSParserFilter;
47 import org.w3c.dom.traversal.NodeFilter;
48 import org.xml.sax.SAXException;
49
50 /*
51 * @summary Test Specifications and Descriptions for LSParser.
52 */
53 @Listeners({jaxp.library.BasePolicy.class})
54 public class LSParserTCKTest {
55
56 DOMImplementationLS implLS = null;
57 public String xml1 = "<?xml version=\"1.0\"?><ROOT><ELEMENT1><CHILD1/><CHILD1><COC1/></CHILD1></ELEMENT1><ELEMENT2>test1<CHILD2/></ELEMENT2></ROOT>";
58
59 /**
60 * Equivalence class partitioning
61 * with state, input and output values orientation
62 * for public Document parse(LSInput is),
63 * <br><b>pre-conditions</b>: set filter that REJECTs any CHILD* node,
64 * <br><b>is</b>: xml1
65 * <br><b>output</b>: XML document with ELEMNENT1 and ELEMENT2 only.
66 */
67 @Test
68 public void testfilter0001() {
69 LSParser parser = createLSParser();
70 if (parser == null) {
71 Assert.fail("Unable to create LSParser!");
72 }
73 // set filter
|