cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject svn commit: r533486 - in /incubator/cxf/trunk: rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/ tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/proces...
Date Sun, 29 Apr 2007 08:16:19 GMT
Author: mmao
Date: Sun Apr 29 01:16:18 2007
New Revision: 533486

URL: http://svn.apache.org/viewvc?view=rev&rev=533486
Log:
CXF-610 revert the last commit, which fix the doc-lit-wrapped but broken rpc-lit

Added:
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/jaxws/
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/jaxws/rpc/
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/jaxws/rpc/Greeter.java
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderRPCTest.java
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/rpc_greeter.wsdl
Modified:
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
    incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/JCodeModelFilter.java
    incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WrapperBeanGenerator.java
    incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/Wrapper.java
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/db.wsdl

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?view=diff&rev=533486&r1=533485&r2=533486
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
(original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Sun Apr 29 01:16:18 2007
@@ -594,14 +594,6 @@
         
     }
 
-    private boolean isArrayType(MessagePartInfo part) {
-        Type type = (Type) part.getProperty(GENERIC_TYPE);
-        if (type instanceof Class) {
-            return ((Class<?>)type).isArray();
-        }
-        return false;
-    }
-    
     private void createWrappedMessageSchema(AbstractMessageContainer wrappedMessage,
                                             AbstractMessageContainer unwrappedMessage,
                                             XmlSchema schema) {
@@ -623,15 +615,9 @@
             el.setName(mpi.getName().getLocalPart());
             el.setQName(mpi.getName());
 
-
-            if (isArrayType(mpi)) {
-                el.setMinOccurs(0);
-                el.setMaxOccurs(Long.MAX_VALUE);
-            } else {
-                el.setMinOccurs(1);
-                el.setMaxOccurs(1);
-                el.setNillable(true);
-            }
+            el.setMinOccurs(1);
+            el.setMaxOccurs(1);
+            el.setNillable(true);
 
             if (mpi.isElement()) {
                 el.setRefName(mpi.getElementQName());
@@ -770,9 +756,6 @@
         if (rawClass.equals(Holder.class) && type instanceof ParameterizedType) {
             ParameterizedType paramType = (ParameterizedType)type;
             rawClass = getHolderClass(paramType);
-        }
-        if (rawClass.isArray()) {
-            rawClass = rawClass.getComponentType();
         }
 
         part.setProperty(GENERIC_TYPE, type);

Modified: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/JCodeModelFilter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/JCodeModelFilter.java?view=diff&rev=533486&r1=533485&r2=533486
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/JCodeModelFilter.java
(original)
+++ incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/JCodeModelFilter.java
Sun Apr 29 01:16:18 2007
@@ -45,7 +45,6 @@
             includedPackages.add(clz.getPackageName());
             includedClasses.add(clz.getFullClassName());
         }
-
         for (Iterator<JPackage> iter = this.model.packages(); iter.hasNext();) {
             JPackage pkg = iter.next();
             if (!includedPackages.contains(pkg.name())) {

Modified: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WrapperBeanGenerator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WrapperBeanGenerator.java?view=diff&rev=533486&r1=533485&r2=533486
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WrapperBeanGenerator.java
(original)
+++ incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WrapperBeanGenerator.java
Sun Apr 29 01:16:18 2007
@@ -35,7 +35,6 @@
 import com.sun.tools.xjc.api.S2JJAXBModel;
 import com.sun.tools.xjc.api.XJC;
 import com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl;
-
 import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.service.model.SchemaInfo;
 import org.apache.cxf.service.model.ServiceInfo;
@@ -92,6 +91,7 @@
     private void generateWrapperBeanClasses(final ServiceInfo serviceInfo, final File dir)
{
         List<JavaClass> wrapperClasses = new ArrayList<JavaClass>();
         Map<String, String> nsPkgMapping = new HashMap<String, String>();
+        Map<String, JavaClass> paramClasses = new HashMap<String, JavaClass>();
         
         for (OperationInfo op : serviceInfo.getInterface().getOperations()) {
             if (op.getUnwrappedOperation() != null) {
@@ -101,6 +101,11 @@
                     requestWrapper.setName(wrapperBeanName);
                     requestWrapper.setMethod((Method) op.getProperty(Method.class.getName()));
                     JavaClass jClass = requestWrapper.getJavaClass();
+
+                    paramClasses.putAll(
+                        requestWrapper.getParamtersInDifferentPackage(
+                            op.getUnwrappedOperation().getInput()));
+
                     if (requestWrapper.isWrapperAbsent() || requestWrapper.isToDifferentPackage())
{
                         nsPkgMapping.put(wrapperBeanName.getNamespaceURI(), jClass.getPackageName());
                     }
@@ -116,6 +121,10 @@
                     responseWrapper.setMethod((Method) op.getProperty(Method.class.getName()));
                     JavaClass jClass = responseWrapper.getJavaClass();
 
+//                     paramClasses.putAll(
+//                         requestWrapper.getParamtersInDifferentPackage(
+//                             op.getUnwrappedOperation().getOutput()));
+
                     if (responseWrapper.isWrapperAbsent() || responseWrapper.isToDifferentPackage())
{
                         nsPkgMapping.put(wrapperBeanName.getNamespaceURI(), jClass.getPackageName());
                     }
@@ -129,6 +138,9 @@
 
         if (wrapperClasses.isEmpty()) {
             return;
+        }
+        if (!paramClasses.isEmpty()) {
+            wrapperClasses.addAll(paramClasses.values());
         }
         
         Map<String, Element> schemas = new HashMap<String, Element>();

Modified: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/Wrapper.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/Wrapper.java?view=diff&rev=533486&r1=533485&r2=533486
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/Wrapper.java
(original)
+++ incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/Wrapper.java
Sun Apr 29 01:16:18 2007
@@ -20,6 +20,8 @@
 package org.apache.cxf.tools.java2wsdl.processor.internal.jaxws;
 
 import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import javax.xml.namespace.QName;
@@ -27,6 +29,8 @@
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.service.model.MessageInfo;
+import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.tools.common.ToolException;
 import org.apache.cxf.tools.common.model.JavaClass;
 import org.apache.cxf.tools.util.AnnotationUtil;
@@ -127,5 +131,27 @@
             LOG.log(Level.WARNING, msg.toString());
             throw new ToolException(msg);
         }
+    }
+
+    private boolean isBuiltInTypes(Class<?> clz) {
+        if (clz == null || clz.isPrimitive()) {
+            return true;
+        }
+        return "java.lang".equals(clz.getPackage().getName());
+    }
+    
+    public Map<String, JavaClass> getParamtersInDifferentPackage(final MessageInfo
message) {
+        Map<String, JavaClass> results = new HashMap<String, JavaClass>();
+        for (MessagePartInfo part : message.getMessageParts()) {
+            if (isBuiltInTypes(part.getTypeClass())) {
+                continue;
+            }
+            JavaClass paramClass = new JavaClass();
+            paramClass.setFullClassName(part.getTypeClass().getName());
+            if (!getJavaClass().getPackageName().equals(paramClass.getPackageName())) {
+                results.put(paramClass.getFullClassName(), paramClass);
+            }
+        }
+        return results;
     }
 }

Added: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/jaxws/rpc/Greeter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/jaxws/rpc/Greeter.java?view=auto&rev=533486
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/jaxws/rpc/Greeter.java
(added)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/jaxws/rpc/Greeter.java
Sun Apr 29 01:16:18 2007
@@ -0,0 +1,32 @@
+/**
+ * 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.jaxws.rpc;
+ 
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.jws.soap.SOAPBinding.Style;
+
+@WebService(name = "Hello", targetNamespace = "http://cxf.apache.org/")
+@SOAPBinding(style = Style.RPC)
+public interface Greeter {
+    @WebMethod
+    String[] echoStringArray(String[] array);
+}

Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java?view=diff&rev=533486&r1=533485&r2=533486
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
(original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
Sun Apr 29 01:16:18 2007
@@ -299,7 +299,11 @@
         assertTrue(contents.indexOf("org.apache.cxf.tools.fortest.withannotation.doc") !=
-1);
     }
 
+    // REVISIT: CXF-610
+    // Ref: DOC-LIT-WRAPPED this.testDataBase()
+    //      RPC-LIT         JaxwsServiceBuilderRPCTest.testGreeter()
     @Test
+    @Ignore
     public void testGenWrapperWithStringArray() throws Exception {
         env.put(ToolConstants.CFG_CLASSNAME,
                 "org.apache.cxf.tools.fortest.withannotation.doc.GreeterStringArray");

Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/db.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/db.wsdl?view=diff&rev=533486&r1=533485&r2=533486
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/db.wsdl
(original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/db.wsdl
Sun Apr 29 01:16:18 2007
@@ -43,7 +43,7 @@
 <xs:element name="operation0Response">
 <xs:complexType>
 <xs:sequence>
-<xs:element maxOccurs="unbounded" minOccurs="0" name="return" type="tns:operation0ResponseType"/>
+<xs:element name="return" nillable="true" type="tns:operation0ResponseTypeArray"/>
 </xs:sequence>
 </xs:complexType>
 </xs:element>

Added: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderRPCTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderRPCTest.java?view=auto&rev=533486
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderRPCTest.java
(added)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderRPCTest.java
Sun Apr 29 01:16:18 2007
@@ -0,0 +1,64 @@
+/**
+ * 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.java2wsdl.processor.internal.jaxws;
+
+import java.io.File;
+
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.tools.common.ProcessorTestBase;
+import org.apache.cxf.tools.java2wsdl.generator.wsdl11.WSDL11Generator;
+import org.junit.Before;
+import org.junit.Test;
+
+public class JaxwsServiceBuilderRPCTest extends ProcessorTestBase {
+    JaxwsServiceBuilder builder = new JaxwsServiceBuilder();
+    WSDL11Generator generator = new WSDL11Generator();
+
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+        builder.setBus(BusFactory.getDefaultBus());
+    }
+
+    @org.junit.After
+    public void tearDown() {
+        super.tearDown();
+    }
+
+    @Test
+    public void testGreeter() throws Exception {
+        builder.setServiceClass(org.apache.cxf.tools.fortest.jaxws.rpc.Greeter.class);
+        ServiceInfo service = builder.build();
+        generator.setServiceModel(service);
+        File output = getOutputFile("rpc_greeter.wsdl");
+        assertNotNull(output);
+        generator.generate(output);
+        assertTrue(output.exists());
+
+        String expectedFile = this.getClass()
+            .getResource("expected/rpc_greeter.wsdl").getFile();
+        assertFileEquals(expectedFile, output.getAbsolutePath());
+    }
+
+    private File getOutputFile(String fileName) {
+        return new File(output, fileName);
+    }
+}

Added: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/rpc_greeter.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/rpc_greeter.wsdl?view=auto&rev=533486
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/rpc_greeter.wsdl
(added)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/rpc_greeter.wsdl
Sun Apr 29 01:16:18 2007
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<wsdl:definitions name="GreeterService" targetNamespace="http://cxf.apache.org/" xmlns:ns1="http://cxf.apache.org/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns2="http://jaxb.dev.java.net/array" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+  <wsdl:types>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://jaxb.dev.java.net/array"
version="1.0">
+<xs:complexType final="#all" name="stringArray">
+<xs:sequence>
+<xs:element maxOccurs="unbounded" minOccurs="0" name="item" nillable="true" type="xs:string"/>
+</xs:sequence>
+</xs:complexType>
+</xs:schema>
+  </wsdl:types>
+  <wsdl:message name="echoStringArrayResponse">
+    <wsdl:part name="return" type="ns2:stringArray">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="echoStringArray">
+    <wsdl:part name="arg0" type="ns2:stringArray">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:portType name="Hello">
+    <wsdl:operation name="echoStringArray">
+      <wsdl:input name="echoStringArray" message="ns1:echoStringArray">
+    </wsdl:input>
+      <wsdl:output name="echoStringArrayResponse" message="ns1:echoStringArrayResponse">
+    </wsdl:output>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:binding name="GreeterServiceSoapBinding" type="ns1:Hello">
+    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+    <wsdl:operation name="echoStringArray">
+      <soap:operation soapAction="" style="rpc"/>
+      <wsdl:input name="echoStringArray">
+        <soap:body use="literal" namespace="http://cxf.apache.org/"/>
+      </wsdl:input>
+      <wsdl:output name="echoStringArrayResponse">
+        <soap:body use="literal" namespace="http://cxf.apache.org/"/>
+      </wsdl:output>
+    </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:service name="GreeterService">
+    <wsdl:port name="HelloPort" binding="ns1:GreeterServiceSoapBinding">
+      <soap:address location="http://localhost:9090"/>
+    </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions>



Mime
View raw message