cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1496744 - in /cxf/trunk: rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/ tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/ tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/
Date Wed, 26 Jun 2013 05:52:01 GMT
Author: ema
Date: Wed Jun 26 05:52:00 2013
New Revision: 1496744

URL: http://svn.apache.org/r1496744
Log:
[CXF-5089]:java2ws generate both ref and nillabe attributes in a schema element

Added:
    cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Echo3.java
  (with props)
    cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Echo3Impl.java
  (with props)
    cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/OrderException2.java
  (with props)
    cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/OrderItem.java
  (with props)
Modified:
    cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
    cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java

Modified: cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java?rev=1496744&r1=1496743&r2=1496744&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
(original)
+++ cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
Wed Jun 26 05:52:00 2013
@@ -626,6 +626,7 @@ class JAXBSchemaInitializer extends Serv
             QName ename = new QName(beanInfo.getElementNamespaceURI(null),
                                    beanInfo.getElementLocalName(null));
             XmlSchemaElement el2 = schemas.getElementByQName(ename);
+            el.setNillable(false);
             el.getRef().setTargetQName(el2.getQName());
         } else {
             el.setName(name.getLocalPart());

Added: cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Echo3.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Echo3.java?rev=1496744&view=auto
==============================================================================
--- cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Echo3.java
(added)
+++ cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Echo3.java
Wed Jun 26 05:52:00 2013
@@ -0,0 +1,27 @@
+/**
+ * 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.cxf.tools.fortest.exception;
+
+import javax.jws.WebService;
+
+@WebService(targetNamespace = "http://cxf.apache.org/test/HelloService", name = "HelloService")
+public interface Echo3 {
+    String echo(OrderItem request) throws OrderException2;
+}
+

Propchange: cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Echo3.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Echo3.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Echo3Impl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Echo3Impl.java?rev=1496744&view=auto
==============================================================================
--- cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Echo3Impl.java
(added)
+++ cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Echo3Impl.java
Wed Jun 26 05:52:00 2013
@@ -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.cxf.tools.fortest.exception;
+
+import javax.jws.WebService;
+
+@WebService(serviceName = "HelloService", portName = "HelloPort", 
+            endpointInterface = "org.apache.cxf.tools.fortest.exception.Echo3", 
+            targetNamespace = "http://cxf.apache.org/test/HelloService")
+public class Echo3Impl implements Echo3 {
+    public String echo(OrderItem request) throws OrderException2 {
+        return "Response";
+
+    }
+
+}
+

Propchange: cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Echo3Impl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/Echo3Impl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/OrderException2.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/OrderException2.java?rev=1496744&view=auto
==============================================================================
--- cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/OrderException2.java
(added)
+++ cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/OrderException2.java
Wed Jun 26 05:52:00 2013
@@ -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.cxf.tools.fortest.exception;
+public class OrderException2 extends Exception {
+    private static final long serialVersionUID = 1L;
+    private OrderItem data;
+
+    public OrderException2(String message) {
+        super(message);
+    }
+
+    public void setData(OrderItem data) {
+        this.data = data;
+    }
+
+    public OrderItem getData() {
+        return this.data;
+    }
+
+}
\ No newline at end of file

Propchange: cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/OrderException2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/OrderException2.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/OrderItem.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/OrderItem.java?rev=1496744&view=auto
==============================================================================
--- cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/OrderItem.java
(added)
+++ cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/OrderItem.java
Wed Jun 26 05:52:00 2013
@@ -0,0 +1,73 @@
+/**
+ * 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.cxf.tools.fortest.exception;
+
+import java.math.BigDecimal;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "item")
+public class OrderItem {
+    Long sku;
+    Integer count;
+    Double pricePerUnit;
+
+    public OrderItem() {
+    }
+
+    public OrderItem(Long sku, Integer count, Double pricePerUnit) {
+        super();
+        this.sku = sku;
+        this.count = count;
+        this.pricePerUnit = pricePerUnit;
+    }
+
+    @XmlAttribute
+    public Long getSku() {
+        return sku;
+    }
+
+    public void setSku(Long sku) {
+        this.sku = sku;
+    }
+
+    @XmlElement
+    public Integer getCount() {
+        return count;
+    }
+
+    public void setCount(Integer count) {
+        this.count = count;
+    }
+
+    @XmlElement
+    public Double getPricePerUnit() {
+        return pricePerUnit;
+    }
+
+    public void setPricePerUnit(Double pricePerUnit) {
+        this.pricePerUnit = pricePerUnit;
+    }
+
+    public BigDecimal getTotalPrice() {
+        return new BigDecimal(pricePerUnit).multiply(new BigDecimal(count));
+    }
+}

Propchange: cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/OrderItem.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/fortest/exception/OrderItem.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java?rev=1496744&r1=1496743&r2=1496744&view=diff
==============================================================================
--- cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
(original)
+++ cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
Wed Jun 26 05:52:00 2013
@@ -779,6 +779,27 @@ public class JavaToProcessorTest extends
     }
     
     @Test
+    public void testExceptionRefNillable() throws Exception {
+        env.put(ToolConstants.CFG_OUTPUTFILE, output.getPath() + "/exception-ref-nillable.wsdl");
+        env.put(ToolConstants.CFG_CLASSNAME, "org.apache.cxf.tools.fortest.exception.Echo3Impl");
+        env.put(ToolConstants.CFG_VERBOSE, ToolConstants.CFG_VERBOSE);
+        try {
+            processor.setEnvironment(env);
+            processor.process();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        
+        File wsdlFile = new File(output, "exception-ref-nillable.wsdl");
+        assertTrue(wsdlFile.exists());
+        String wsdlContent = getStringFromFile(wsdlFile).replaceAll("  ", " ");
+        int refElement = wsdlContent.indexOf("<xs:element ref=\"tns:item\"/>");
+        assertTrue(refElement > -1);
+
+    }
+    
+    
+    @Test
     public void testCXF4877() throws Exception {
         env.put(ToolConstants.CFG_OUTPUTFILE, output.getPath() + "/testwsdl.wsdl");
         env.put(ToolConstants.CFG_CLASSNAME, "org.apache.cxf.tools.fortest.cxf4877.HelloImpl");
@@ -792,6 +813,4 @@ public class JavaToProcessorTest extends
         //if the test works, this won't throw an exception.  CXF-4877 generated bad XML at
this point
         StaxUtils.read(new FileInputStream(wsdlFile));
     }
-    
-    
 }



Mime
View raw message