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