Author: veithen
Date: Sat Jul  9 19:06:55 2016
New Revision: 1752039

URL: http://svn.apache.org/viewvc?rev=1752039&view=rev
Log:
AXIS2-5799: Fix attribute handling in ADB.

Added:
    
axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5799/
    
axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5799/ServiceTest.java
   (with props)
    
axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5799/service/
    
axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5799/service/EchoImpl.java
   (with props)
    axis/axis2/java/core/trunk/modules/adb-tests/src/test/wsdl/AXIS2-5799.wsdl
Modified:
    
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
    
axis/axis2/java/core/trunk/modules/adb-codegen/test/org/apache/axis2/schema/extension/SimpleExtensionTest.java
    axis/axis2/java/core/trunk/modules/adb-tests/pom.xml

Modified: 
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java?rev=1752039&r1=1752038&r2=1752039&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
 Sat Jul  9 19:06:55 2016
@@ -1833,17 +1833,17 @@ public class SchemaCompiler {
 
         QName schemaTypeName = att.getSchemaTypeName();
         if (schemaTypeName != null) {
-            if (att.getQName() != null) {
+            if (att.getWireName() != null) {
                 if (baseSchemaTypeMap.containsKey(schemaTypeName)) {
 
-                    metainf.registerMapping(att.getQName(), schemaTypeName,
+                    metainf.registerMapping(att.getWireName(), schemaTypeName,
                                             
baseSchemaTypeMap.get(schemaTypeName).toString(),
                                             SchemaConstants.ATTRIBUTE_TYPE);
 
                     // add optional attribute status if set
                     String use = att.getUse().toString();
                     if (USE_NONE.equals(use) || USE_OPTIONAL.equals(use)) {
-                        metainf.addtStatus(att.getQName(), 
SchemaConstants.OPTIONAL_TYPE);
+                        metainf.addtStatus(att.getWireName(), 
SchemaConstants.OPTIONAL_TYPE);
                     }
 
                     String className = findClassName(schemaTypeName, false);
@@ -1853,11 +1853,11 @@ public class SchemaCompiler {
                             className);
                     // set the default value
                     if (att.getDefaultValue() != null) {
-                        metainf.registerDefaultValue(att.getQName(), 
att.getDefaultValue());
+                        metainf.registerDefaultValue(att.getWireName(), 
att.getDefaultValue());
                     }
                     if (att.getFixedValue() != null) {
-                        metainf.registerDefaultValue(att.getQName(), 
att.getFixedValue());
-                        metainf.registerFixedQName(att.getQName());
+                        metainf.registerDefaultValue(att.getWireName(), 
att.getFixedValue());
+                        metainf.registerFixedQName(att.getWireName());
                     }
                     // after
                 } else {
@@ -1878,14 +1878,14 @@ public class SchemaCompiler {
                                     //process simple type
                                     processSimpleSchemaType(simpleType, null, 
resolvedSchema, null);
                                 }
-                                metainf.registerMapping(att.getQName(),
+                                metainf.registerMapping(att.getWireName(),
                                                         schemaTypeName,
                                                         
processedTypemap.get(schemaTypeName).toString(),
                                                         
SchemaConstants.ATTRIBUTE_TYPE);
                                 // add optional attribute status if set
                                 String use = att.getUse().toString();
                                 if (USE_NONE.equals(use) || 
USE_OPTIONAL.equals(use)) {
-                                    metainf.addtStatus(att.getQName(), 
SchemaConstants.OPTIONAL_TYPE);
+                                    metainf.addtStatus(att.getWireName(), 
SchemaConstants.OPTIONAL_TYPE);
                                 }
                             }
 
@@ -1920,7 +1920,7 @@ public class SchemaCompiler {
         } else {
             // this attribute refers to a custom type, probably one of the 
extended simple types.
             // with the inline schema definition
-            QName attributeQName = att.getQName();
+            QName attributeQName = att.getWireName();
             if (attributeQName != null) {
                 XmlSchemaSimpleType attributeSimpleType = att.getSchemaType();
                 XmlSchema resolvedSchema = parentSchema;
@@ -1960,14 +1960,14 @@ public class SchemaCompiler {
                         processSimpleSchemaType(attributeSimpleType, null, 
resolvedSchema,
                                                 schemaTypeQName);
                     }
-                    metainf.registerMapping(att.getQName(),
+                    metainf.registerMapping(att.getWireName(),
                                             schemaTypeQName,
                                             
processedTypemap.get(schemaTypeQName).toString(),
                                             SchemaConstants.ATTRIBUTE_TYPE);
                     // add optional attribute status if set
                     String use = att.getUse().toString();
                     if (USE_NONE.equals(use) || USE_OPTIONAL.equals(use)) {
-                        metainf.addtStatus(att.getQName(), 
SchemaConstants.OPTIONAL_TYPE);
+                        metainf.addtStatus(att.getWireName(), 
SchemaConstants.OPTIONAL_TYPE);
                     }
                 } else {
                     // TODO: handle the case when no attribute type specifed

Modified: 
axis/axis2/java/core/trunk/modules/adb-codegen/test/org/apache/axis2/schema/extension/SimpleExtensionTest.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/adb-codegen/test/org/apache/axis2/schema/extension/SimpleExtensionTest.java?rev=1752039&r1=1752038&r2=1752039&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/adb-codegen/test/org/apache/axis2/schema/extension/SimpleExtensionTest.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/adb-codegen/test/org/apache/axis2/schema/extension/SimpleExtensionTest.java
 Sat Jul  9 19:06:55 2016
@@ -58,8 +58,7 @@ public class SimpleExtensionTest extends
         OMFactory factory = OMAbstractFactory.getOMFactory();
         OMElement element = factory.createOMElement(new QName(
                 "http://apache.org/axis2/schema/extension";, 
"SimpleAmmountElement"));
-        element.addAttribute("currency", "SLR",
-                             
factory.createOMNamespace("http://apache.org/axis2/schema/extension";, null));
+        element.addAttribute("currency", "SLR", null);
         element.setText("1000");
         SimpleAmmountElement ammountElement = 
SimpleAmmountElement.Factory.parse(element
                 .getXMLStreamReader());
@@ -82,8 +81,7 @@ public class SimpleExtensionTest extends
         OMFactory factory = OMAbstractFactory.getOMFactory();
         OMElement element = factory.createOMElement(new QName(
                 "http://apache.org/axis2/schema/extension";, 
"PaymentAmountElement"));
-        element.addAttribute("currency", "SLR",
-                             
factory.createOMNamespace("http://apache.org/axis2/schema/extension";, null));
+        element.addAttribute("currency", "SLR", null);
         element.setText("2000");
         PaymentAmountElement ammountElement = 
PaymentAmountElement.Factory.parse(element
                 .getXMLStreamReader());
@@ -156,8 +154,7 @@ public class SimpleExtensionTest extends
         OMFactory factory = OMAbstractFactory.getOMFactory();
         OMElement element = factory.createOMElement(new QName(
                 "http://apache.org/axis2/schema/extension";, 
"ReproStringTypeElement"));
-        element.addAttribute("lang", "EN",
-                             
factory.createOMNamespace("http://apache.org/axis2/schema/extension";, null));
+        element.addAttribute("lang", "EN", null);
         element.setText("Value");
        
         ReproStringTypeElement reproStringTypeElement = 
ReproStringTypeElement.Factory.parse(element

Modified: axis/axis2/java/core/trunk/modules/adb-tests/pom.xml
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/adb-tests/pom.xml?rev=1752039&r1=1752038&r2=1752039&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/adb-tests/pom.xml (original)
+++ axis/axis2/java/core/trunk/modules/adb-tests/pom.xml Sat Jul  9 19:06:55 
2016
@@ -159,6 +159,25 @@
                             
<outputDirectory>${project.build.directory}/wsdl2code/AXIS2-5758</outputDirectory>
                         </configuration>
                     </execution>
+                    <execution>
+                        <id>wsdl2code-axis2-5799</id>
+                        <goals>
+                            <goal>generate-test-sources</goal>
+                        </goals>
+                        <configuration>
+                            <wsdlFile>src/test/wsdl/AXIS2-5799.wsdl</wsdlFile>
+                            <syncMode>sync</syncMode>
+                            <unpackClasses>true</unpackClasses>
+                            <namespaceURIs>
+                                <namespaceURI>
+                                    <uri>urn:echo</uri>
+                                    
<packageName>org.apache.axis2.databinding.axis2_5799.client</packageName>
+                                </namespaceURI>
+                            </namespaceURIs>
+                            
<packageName>org.apache.axis2.databinding.axis2_5799.client</packageName>
+                            
<outputDirectory>${project.build.directory}/wsdl2code/AXIS2-5799</outputDirectory>
+                        </configuration>
+                    </execution>
                 </executions>
                 <configuration>
                     <databindingName>adb</databindingName>
@@ -261,6 +280,18 @@
                             
<packageName>org.apache.axis2.databinding.axis2_5758.service</packageName>
                         </configuration>
                     </execution>
+                    <execution>
+                        <id>wsimport-axis2-5799</id>
+                        <goals>
+                            <goal>wsimport-test</goal>
+                        </goals>
+                        <configuration>
+                            <wsdlFiles>
+                                
<wsdlFile>${basedir}/src/test/wsdl/AXIS2-5799.wsdl</wsdlFile>
+                            </wsdlFiles>
+                            
<packageName>org.apache.axis2.databinding.axis2_5799.service</packageName>
+                        </configuration>
+                    </execution>
                 </executions>
                 <dependencies>
                     <dependency>

Added: 
axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5799/ServiceTest.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5799/ServiceTest.java?rev=1752039&view=auto
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5799/ServiceTest.java
 (added)
+++ 
axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5799/ServiceTest.java
 Sat Jul  9 19:06:55 2016
@@ -0,0 +1,46 @@
+/*
+ * 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.databinding.axis2_5799;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import javax.xml.ws.Endpoint;
+
+import org.apache.axiom.testutils.PortAllocator;
+import org.apache.axis2.databinding.axis2_5799.client.ComplexTypeWithAttribute;
+import org.apache.axis2.databinding.axis2_5799.client.EchoServiceStub;
+import org.apache.axis2.databinding.axis2_5799.service.EchoImpl;
+import org.junit.Test;
+
+public class ServiceTest {
+    @Test
+    public void test() throws Exception {
+        int port = PortAllocator.allocatePort();
+        String address = "http://localhost:"; + port + "/service";
+        Endpoint endpoint = Endpoint.publish(address, new EchoImpl());
+        try {
+            EchoServiceStub stub = new EchoServiceStub(address);
+            ComplexTypeWithAttribute request = new ComplexTypeWithAttribute();
+            request.setAttr("value");
+            assertThat(stub.echo(request).getAttr()).isEqualTo("value");
+        } finally {
+            endpoint.stop();
+        }
+    }
+}

Propchange: 
axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5799/ServiceTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5799/service/EchoImpl.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5799/service/EchoImpl.java?rev=1752039&view=auto
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5799/service/EchoImpl.java
 (added)
+++ 
axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5799/service/EchoImpl.java
 Sat Jul  9 19:06:55 2016
@@ -0,0 +1,29 @@
+/*
+ * 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.databinding.axis2_5799.service;
+
+import javax.jws.WebService;
+import javax.xml.ws.Holder;
+
+@WebService(endpointInterface="org.apache.axis2.databinding.axis2_5799.service.EchoPortType")
+public class EchoImpl implements EchoPortType {
+    @Override
+    public void echo(Holder<ComplexTypeWithAttribute> body) {
+    }
+}

Propchange: 
axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5799/service/EchoImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
axis/axis2/java/core/trunk/modules/adb-tests/src/test/wsdl/AXIS2-5799.wsdl
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/adb-tests/src/test/wsdl/AXIS2-5799.wsdl?rev=1752039&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/adb-tests/src/test/wsdl/AXIS2-5799.wsdl 
(added)
+++ axis/axis2/java/core/trunk/modules/adb-tests/src/test/wsdl/AXIS2-5799.wsdl 
Sat Jul  9 19:06:55 2016
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<definitions name="Echo"
+          targetNamespace="urn:echo"
+          xmlns:tns="urn:echo"
+          xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
+          xmlns="http://schemas.xmlsoap.org/wsdl/";>
+
+    <types>
+        <schema targetNamespace="urn:echo" 
xmlns="http://www.w3.org/2001/XMLSchema";>
+            <element name="ComplexTypeWithAttribute">
+                <complexType>
+                    <attribute name="attr" type="string" use="required"/>
+                </complexType>
+            </element>
+        </schema>
+    </types>
+
+    <message name="Echo">
+        <part name="body" element="tns:ComplexTypeWithAttribute"/>
+    </message>
+
+    <portType name="EchoPortType">
+        <operation name="Echo">
+           <input message="tns:Echo"/>
+           <output message="tns:Echo"/>
+        </operation>
+    </portType>
+
+    <binding name="EchoSoapBinding" type="tns:EchoPortType">
+        <soap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>
+        <operation name="Echo">
+           <soap:operation soapAction="urn:echo:Echo"/>
+           <input>
+               <soap:body use="literal"/>
+           </input>
+           <output>
+               <soap:body use="literal"/>
+           </output>
+        </operation>
+    </binding>
+
+    <service name="EchoService">
+        <port name="EchoPort" binding="tns:EchoSoapBinding">
+           <soap:address location="REPLACE_WITH_ACTUAL_URL"/>
+        </port>
+    </service>
+</definitions>


Reply via email to