1 package tests;
2
3 import junit.framework.TestCase;
4 import org.apache.ws.commons.schema.XmlSchema;
5 import org.apache.ws.commons.schema.XmlSchemaCollection;
6 import org.apache.ws.commons.schema.constants.Constants;
7 import org.w3c.dom.Document;
8
9 import javax.xml.parsers.DocumentBuilderFactory;
10 import java.util.Map;
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 public class ExternalAttTest extends TestCase {
28
29
30 public void testExternalAtt() throws Exception{
31
32 DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
33 documentBuilderFactory.setNamespaceAware(true);
34 Document doc = documentBuilderFactory.newDocumentBuilder().
35 parse(Resources.asURI("externalAttributes.xsd"));
36
37 XmlSchemaCollection schemaCol = new XmlSchemaCollection();
38 XmlSchema s = schemaCol.read(doc.getDocumentElement());
39
40
41 Map metaInfoMap = s.getMetaInfoMap();
42 assertNotNull(metaInfoMap);
43
44 Map extenalAttributeMap = (Map)metaInfoMap.get(Constants.MetaDataConstants.EXTERNAL_ATTRIBUTES);
45 assertNotNull(extenalAttributeMap);
46
47 assertEquals(1,extenalAttributeMap.size());
48
49
50 }
51
52 }