You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ve...@apache.org on 2009/06/24 19:00:41 UTC

svn commit: r788084 - in /webservices/axis2/trunk/java/modules/adb-codegen: ./ src/org/apache/axis2/schema/ test-resources/testsuite/ test/org/apache/axis2/schema/chameleon/

Author: veithen
Date: Wed Jun 24 17:00:40 2009
New Revision: 788084

URL: http://svn.apache.org/viewvc?rev=788084&view=rev
Log:
AXIS2-4251: Fixed SchemaCompiler#isComponetExists to work correctly with included schemas without targetNamespace.

Added:
    webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/chameleon.xsd
    webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/chameleon_include.xsd   (with props)
    webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/chameleon/
    webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/chameleon/ChameleonTest.java   (with props)
Modified:
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
    webservices/axis2/trunk/java/modules/adb-codegen/sub-build.xml

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java?rev=788084&r1=788083&r2=788084&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java Wed Jun 24 17:00:40 2009
@@ -2720,16 +2720,13 @@
                                      QName componentQName,
                                      int componetType) {
         boolean isExists = false;
-        if (!schema.getTargetNamespace().equals(componentQName.getNamespaceURI())){
-             return false;
-        }
         switch (componetType) {
             case COMPONENT_TYPE : {
-                isExists = (schema.getTypeByName(componentQName.getLocalPart()) != null);
+                isExists = (schema.getTypeByName(componentQName) != null);
                 break;
             }
             case COMPONENT_ELEMENT : {
-                isExists = (schema.getElementByName(componentQName.getLocalPart()) != null);
+                isExists = (schema.getElementByName(componentQName) != null);
                 break;
             }
             case COMPONENT_ATTRIBUTE : {

Modified: webservices/axis2/trunk/java/modules/adb-codegen/sub-build.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/sub-build.xml?rev=788084&r1=788083&r2=788084&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/sub-build.xml (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/sub-build.xml Wed Jun 24 17:00:40 2009
@@ -80,6 +80,7 @@
 			<arg file="${testsuite.source.dir}/default_value.xsd"/>
 			<arg file="${testsuite.source.dir}/complexExtension.xsd"/>
 			<arg file="${testsuite.source.dir}/soapencoding.xsd"/>
+			<arg file="${testsuite.source.dir}/chameleon.xsd"/>
 			<arg file="${schema.generated.src.dir}"/>
 		</java>
     </target>

Added: webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/chameleon.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/chameleon.xsd?rev=788084&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/chameleon.xsd (added)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/chameleon.xsd Wed Jun 24 17:00:40 2009
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<!--
+  ~ 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.
+  -->
+
+<!--
+  Test schema for the "chameleon" namespace design described in [1].
+  See also AXIS2-4251.
+  
+  [1] http://www.xfront.com/ZeroOneOrManyNamespaces.html
+-->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            targetNamespace="http://apache.org/axis2/schema/chameleon"
+            xmlns="http://apache.org/axis2/schema/chameleon"
+            elementFormDefault="qualified">
+    <xsd:include schemaLocation="chameleon_include.xsd"/>
+    <xsd:element name="MainSchemaElement">
+        <xsd:complexType>
+            <xsd:sequence>
+                <xsd:element name="param" type="SupportingSchemaType"/>
+            </xsd:sequence>
+        </xsd:complexType>
+    </xsd:element>
+</xsd:schema>
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/chameleon_include.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/chameleon_include.xsd?rev=788084&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/chameleon_include.xsd (added)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/chameleon_include.xsd Wed Jun 24 17:00:40 2009
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+  ~ 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.
+  -->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            elementFormDefault="qualified">
+    <xsd:complexType name="SupportingSchemaType">
+        <xsd:sequence>
+           <xsd:element name="param" type="xsd:string"/>
+        </xsd:sequence>
+    </xsd:complexType>
+</xsd:schema>
\ No newline at end of file

Propchange: webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/chameleon_include.xsd
------------------------------------------------------------------------------
    svn:mergeinfo = 

Added: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/chameleon/ChameleonTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/chameleon/ChameleonTest.java?rev=788084&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/chameleon/ChameleonTest.java (added)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/chameleon/ChameleonTest.java Wed Jun 24 17:00:40 2009
@@ -0,0 +1,36 @@
+/*
+ * 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 org.apache.axis2.schema.chameleon;
+
+import org.apache.axis2.schema.AbstractTestCase;
+
+/**
+ * Test case for the <a href="http://www.xfront.com/ZeroOneOrManyNamespaces.html#mixed">"chameleon"
+ * namespace design</a>. See also AXIS2-4251.
+ */
+public class ChameleonTest extends AbstractTestCase {
+    public void test() throws Exception {
+        SupportingSchemaType supp = new SupportingSchemaType();
+        supp.setParam("test");
+        MainSchemaElement main = new MainSchemaElement();
+        main.setParam(supp);
+        testSerializeDeserialize(main);
+    }
+}

Propchange: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/chameleon/ChameleonTest.java
------------------------------------------------------------------------------
    svn:eol-style = native