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 java.io.ByteArrayOutputStream;
22
23 import javax.xml.parsers.DocumentBuilderFactory;
24
25 import junit.framework.TestCase;
26
27 import org.apache.ws.commons.schema.XmlSchema;
28 import org.apache.ws.commons.schema.XmlSchemaCollection;
29 import org.w3c.dom.Document;
30
31 import tests.Resources;
32
33
34
35
36 public class PlainExtensionSerializerTest extends TestCase {
37
38 public void testSerialization() throws Exception {
39
40
41 DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
42 documentBuilderFactory.setNamespaceAware(true);
43 Document doc = documentBuilderFactory.newDocumentBuilder().
44 parse(Resources.asURI("/external/externalAnnotations.xsd"));
45
46 XmlSchemaCollection schemaCol = new XmlSchemaCollection();
47 XmlSchema schema = schemaCol.read(doc,null);
48 assertNotNull(schema);
49
50 schema.write(new ByteArrayOutputStream());
51 }
52
53
54 public void testSerialization1() throws Exception {
55
56
57 DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
58 documentBuilderFactory.setNamespaceAware(true);
59 Document doc = documentBuilderFactory.newDocumentBuilder().
60 parse(Resources.asURI("/external/externalElementAnnotations.xsd"));
61
62 XmlSchemaCollection schemaCol = new XmlSchemaCollection();
63 XmlSchema schema = schemaCol.read(doc,null);
64 assertNotNull(schema);
65
66 schema.write(new ByteArrayOutputStream());
67 }
68 }