1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package tests.ext;
20
21 import junit.framework.TestCase;
22
23 import java.util.Map;
24 import java.util.Iterator;
25
26 import tests.Resources;
27 import org.apache.ws.commons.schema.XmlSchemaCollection;
28 import org.apache.ws.commons.schema.XmlSchema;
29 import org.apache.ws.commons.schema.XmlSchemaElement;
30 import org.w3c.dom.Document;
31
32 import javax.xml.parsers.DocumentBuilderFactory;
33
34
35
36
37
38 public class PlainExtensionDeserializerTest extends TestCase {
39
40 public void testDeserialization() throws Exception {
41
42
43 DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
44 documentBuilderFactory.setNamespaceAware(true);
45 Document doc = documentBuilderFactory.newDocumentBuilder().
46 parse(Resources.asURI("/external/externalAnnotations.xsd"));
47
48 XmlSchemaCollection schemaCol = new XmlSchemaCollection();
49 XmlSchema schema = schemaCol.read(doc,null);
50 assertNotNull(schema);
51
52
53
54 Iterator values = schema.getElements().getValues();
55 while (values.hasNext()) {
56 XmlSchemaElement elt = (XmlSchemaElement) values.next();
57 assertNotNull(elt);
58 Map metaInfoMap = elt.getMetaInfoMap();
59 assertNotNull(metaInfoMap);
60
61 }
62 }
63
64
65 public void testDeserialization1() throws Exception {
66
67
68 DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
69 documentBuilderFactory.setNamespaceAware(true);
70 Document doc = documentBuilderFactory.newDocumentBuilder().
71 parse(Resources.asURI("/external/externalElementAnnotations.xsd"));
72
73 XmlSchemaCollection schemaCol = new XmlSchemaCollection();
74 XmlSchema schema = schemaCol.read(doc,null);
75 assertNotNull(schema);
76
77
78
79 Iterator values = schema.getElements().getValues();
80 while (values.hasNext()) {
81 XmlSchemaElement elt = (XmlSchemaElement) values.next();
82 assertNotNull(elt);
83 Map metaInfoMap = elt.getMetaInfoMap();
84 assertNotNull(metaInfoMap);
85
86 }
87 }
88 }