Author: veithen
Date: Thu Apr 14 20:38:21 2016
New Revision: 1739186
URL: http://svn.apache.org/viewvc?rev=1739186&view=rev
Log:
AXIS2-5758: Fix a regression in ADB related to nillable elements.
Added:
axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5758/
axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5758/ServiceTest.java
(with props)
axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5758/service/
axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5758/service/StockQuoteServiceImpl.java
(with props)
axis/axis2/java/core/trunk/modules/adb-tests/src/test/wsdl/AXIS2-5758.wsdl
Modified:
axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.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=1739186&r1=1739185&r2=1739186&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
Thu Apr 14 20:38:21 2016
@@ -858,7 +858,7 @@ public class SchemaCompiler {
if (isOuter) {
this.nillableElementList.add(xsElt.getQName());
} else {
- localNillableList.add(xsElt.getQName());
+ localNillableList.add(xsElt.getWireName());
}
}
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=1739186&r1=1739185&r2=1739186&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/adb-tests/pom.xml (original)
+++ axis/axis2/java/core/trunk/modules/adb-tests/pom.xml Thu Apr 14 20:38:21
2016
@@ -134,6 +134,25 @@
<outputDirectory>${project.build.directory}/wsdl2code/AXIS2-5750</outputDirectory>
</configuration>
</execution>
+ <execution>
+ <id>wsdl2code-axis2-5758</id>
+ <goals>
+ <goal>generate-test-sources</goal>
+ </goals>
+ <configuration>
+ <wsdlFile>src/test/wsdl/AXIS2-5758.wsdl</wsdlFile>
+ <syncMode>sync</syncMode>
+ <unpackClasses>true</unpackClasses>
+ <namespaceURIs>
+ <namespaceURI>
+
<uri>http://example.com/stockquote.xsd</uri>
+
<packageName>org.apache.axis2.databinding.axis2_5758.client</packageName>
+ </namespaceURI>
+ </namespaceURIs>
+
<packageName>org.apache.axis2.databinding.axis2_5758.client</packageName>
+
<outputDirectory>${project.build.directory}/wsdl2code/AXIS2-5758</outputDirectory>
+ </configuration>
+ </execution>
</executions>
<configuration>
<databindingName>adb</databindingName>
@@ -225,6 +244,18 @@
<packageName>org.apache.axis2.databinding.axis2_5750.service</packageName>
</configuration>
</execution>
+ <execution>
+ <id>wsimport-axis2-5758</id>
+ <goals>
+ <goal>wsimport-test</goal>
+ </goals>
+ <configuration>
+ <wsdlFiles>
+
<wsdlFile>${basedir}/src/test/wsdl/AXIS2-5758.wsdl</wsdlFile>
+ </wsdlFiles>
+
<packageName>org.apache.axis2.databinding.axis2_5758.service</packageName>
+ </configuration>
+ </execution>
</executions>
<dependencies>
<dependency>
Added:
axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5758/ServiceTest.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5758/ServiceTest.java?rev=1739186&view=auto
==============================================================================
---
axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5758/ServiceTest.java
(added)
+++
axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5758/ServiceTest.java
Thu Apr 14 20:38:21 2016
@@ -0,0 +1,48 @@
+/*
+ * 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_5758;
+
+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_5758.client.StockQuoteServiceStub;
+import org.apache.axis2.databinding.axis2_5758.client.TradePriceRequest;
+import org.apache.axis2.databinding.axis2_5758.service.StockQuoteServiceImpl;
+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
StockQuoteServiceImpl());
+ try {
+ StockQuoteServiceStub stub = new StockQuoteServiceStub(address);
+ TradePriceRequest request = new TradePriceRequest();
+ request.setTickerSymbol(null);
+ assertThat(stub.getLastTradePrice(request).getPrice()).isNaN();
+ request.setTickerSymbol("GOOG");
+
assertThat(stub.getLastTradePrice(request).getPrice()).isWithin(0.001f).of(100.0f);
+ } finally {
+ endpoint.stop();
+ }
+ }
+}
Propchange:
axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5758/ServiceTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5758/service/StockQuoteServiceImpl.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5758/service/StockQuoteServiceImpl.java?rev=1739186&view=auto
==============================================================================
---
axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5758/service/StockQuoteServiceImpl.java
(added)
+++
axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5758/service/StockQuoteServiceImpl.java
Thu Apr 14 20:38:21 2016
@@ -0,0 +1,33 @@
+/*
+ * 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_5758.service;
+
+import javax.jws.WebService;
+
+@WebService(endpointInterface="org.apache.axis2.databinding.axis2_5758.service.StockQuotePortType")
+public class StockQuoteServiceImpl implements StockQuotePortType {
+ @Override
+ public TradePrice getLastTradePrice(TradePriceRequest body) {
+ TradePrice price = new TradePrice();
+ if (body.getTickerSymbol() != null) {
+ price.setPrice(100.0f);
+ }
+ return price;
+ }
+}
Propchange:
axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5758/service/StockQuoteServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
axis/axis2/java/core/trunk/modules/adb-tests/src/test/wsdl/AXIS2-5758.wsdl
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/adb-tests/src/test/wsdl/AXIS2-5758.wsdl?rev=1739186&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/adb-tests/src/test/wsdl/AXIS2-5758.wsdl
(added)
+++ axis/axis2/java/core/trunk/modules/adb-tests/src/test/wsdl/AXIS2-5758.wsdl
Thu Apr 14 20:38:21 2016
@@ -0,0 +1,63 @@
+<definitions name="StockQuote"
+ targetNamespace="http://example.com/stockquote.wsdl"
+ xmlns:tns="http://example.com/stockquote.wsdl"
+ xmlns:xsd1="http://example.com/stockquote.xsd"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+ <schema targetNamespace="http://example.com/stockquote.xsd"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="TradePriceRequest">
+ <complexType>
+ <all>
+ <element name="tickerSymbol" nillable="true"
type="string"/>
+ </all>
+ </complexType>
+ </element>
+ <element name="TradePrice">
+ <complexType>
+ <all>
+ <element name="price" nillable="true" type="float"/>
+ </all>
+ </complexType>
+ </element>
+ </schema>
+ </types>
+
+ <message name="GetLastTradePriceInput">
+ <part name="body" element="xsd1:TradePriceRequest"/>
+ </message>
+
+ <message name="GetLastTradePriceOutput">
+ <part name="body" element="xsd1:TradePrice"/>
+ </message>
+
+ <portType name="StockQuotePortType">
+ <operation name="GetLastTradePrice">
+ <input message="tns:GetLastTradePriceInput"/>
+ <output message="tns:GetLastTradePriceOutput"/>
+ </operation>
+ </portType>
+
+ <binding name="StockQuoteSoapBinding" type="tns:StockQuotePortType">
+ <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="GetLastTradePrice">
+ <soap:operation soapAction="http://example.com/GetLastTradePrice"/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+ </binding>
+
+ <service name="StockQuoteService">
+ <documentation>My first service</documentation>
+ <port name="StockQuotePort" binding="tns:StockQuoteSoapBinding">
+ <soap:address location="http://example.com/stockquote"/>
+ </port>
+ </service>
+
+</definitions>