You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by aj...@apache.org on 2007/10/22 20:43:54 UTC

svn commit: r587189 - in /webservices/commons/trunk/modules/XmlSchema/src/test: java/tests/MultipleExternalAttTest.java test-resources/multipleExternalAttributes.xsd

Author: ajith
Date: Mon Oct 22 11:43:44 2007
New Revision: 587189

URL: http://svn.apache.org/viewvc?rev=587189&view=rev
Log:
Adding a test case for issue 261

Added:
    webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/MultipleExternalAttTest.java
    webservices/commons/trunk/modules/XmlSchema/src/test/test-resources/multipleExternalAttributes.xsd

Added: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/MultipleExternalAttTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/MultipleExternalAttTest.java?rev=587189&view=auto
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/MultipleExternalAttTest.java (added)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/MultipleExternalAttTest.java Mon Oct 22 11:43:44 2007
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package tests;
+
+import junit.framework.TestCase;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.constants.Constants;
+import org.w3c.dom.Document;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import java.util.Map;
+
+public class MultipleExternalAttTest extends TestCase {
+
+
+    public void testExternalAtt() throws Exception{
+             //create a DOM document
+           DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+           documentBuilderFactory.setNamespaceAware(true);
+           Document doc = documentBuilderFactory.newDocumentBuilder().
+                   parse(Resources.asURI("multipleExternalAttributes.xsd"));
+
+           XmlSchemaCollection schemaCol = new XmlSchemaCollection();
+           XmlSchema s = schemaCol.read(doc.getDocumentElement());
+
+           //check the meta data
+           Map metaInfoMap = s.getMetaInfoMap();
+           assertNotNull(metaInfoMap);
+
+           Map extenalAttributeMap = (Map)metaInfoMap.get(Constants.MetaDataConstants.EXTERNAL_ATTRIBUTES);
+           assertNotNull(extenalAttributeMap);
+           
+                    
+           assertEquals(3,extenalAttributeMap.size());
+
+
+       }
+
+}

Added: webservices/commons/trunk/modules/XmlSchema/src/test/test-resources/multipleExternalAttributes.xsd
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/test-resources/multipleExternalAttributes.xsd?rev=587189&view=auto
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/test-resources/multipleExternalAttributes.xsd (added)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/test-resources/multipleExternalAttributes.xsd Mon Oct 22 11:43:44 2007
@@ -0,0 +1,42 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<schema
+    xmlns="http://www.w3.org/2001/XMLSchema"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:tns="http://unqualified-elements.example.com"
+    xmlns:test="http://test-namespace"
+    test:level="1"
+    xmlns:test2="http://test-namespace2"
+    targetNamespace="http://unqualified-elements.example.com"
+    test2:category="test_cat"
+    test:item="unknown">
+
+    <element name="AnyAttContainer" test:level="2">
+        <complexType>
+            <sequence>
+                <element name="chileValue" type="xsd:string"/>
+            </sequence>
+            <anyAttribute namespace="##other" processContents="lax"></anyAttribute>
+        </complexType>
+    </element>
+
+    <element name="global" type="xsd:int"/>
+
+</schema>



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org