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   * Copyright 2004,2007 The Apache Software Foundation.
13   *
14   * Licensed under the Apache License, Version 2.0 (the "License");
15   * you may not use this file except in compliance with the License.
16   * You may obtain a copy of the License at
17   *
18   *      http://www.apache.org/licenses/LICENSE-2.0
19   *
20   * Unless required by applicable law or agreed to in writing, software
21   * distributed under the License is distributed on an "AS IS" BASIS,
22   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23   * See the License for the specific language governing permissions and
24   * limitations under the License.
25   */
26  
27  public class ExternalAttTest extends TestCase {
28  
29  
30      public void testExternalAtt() throws Exception{
31               //create a DOM document
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             //check the meta data
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  }