cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject svn commit: r490973 [3/3] - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/service/model/ rt/core/src/main/java/org/apache/cxf/interceptor/ rt/core/src/main/java/org/apache/cxf/wsdl11/ rt/core/src/test/java/org/apache/cxf/wsdl11/ rt/frontend...
Date Fri, 29 Dec 2006 10:05:43 GMT
Added: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/BindingAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/BindingAnnotator.java?view=auto&rev=490973
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/BindingAnnotator.java (added)
+++ incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/BindingAnnotator.java Fri Dec 29 02:05:41 2006
@@ -0,0 +1,111 @@
+/**
+ * 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.wsdlto.frontend.jaxws.processor.internal.annotator;
+
+import java.util.*;
+import javax.jws.soap.SOAPBinding;
+
+import org.apache.cxf.tools.common.model.Annotator;
+import org.apache.cxf.tools.common.model.JavaAnnotation;
+import org.apache.cxf.tools.common.model.JavaInterface;
+import org.apache.cxf.tools.common.model.JavaMethod;
+import org.apache.cxf.tools.util.SOAPBindingUtil;
+
+public final class BindingAnnotator implements Annotator {
+    
+    public void annotate(JavaInterface intf) {
+        if (processBinding(intf)) {
+            JavaAnnotation bindingAnnotation = new JavaAnnotation("SOAPBinding");
+            String style = SOAPBindingUtil.getBindingAnnotation(intf.getSOAPStyle().toString());
+            bindingAnnotation.addArgument("style", style, "");
+            String use = SOAPBindingUtil.getBindingAnnotation(intf.getSOAPUse().toString());
+            bindingAnnotation.addArgument("use", use, "");
+            if (intf.getSOAPStyle() == SOAPBinding.Style.DOCUMENT) {
+                String parameterStyle = SOAPBindingUtil.getBindingAnnotation(intf.
+                                                                             getSOAPParameterStyle().
+                                                                             toString());
+                bindingAnnotation.addArgument("parameterStyle", parameterStyle, "");
+            }
+            intf.addAnnotation(bindingAnnotation.toString());
+        }
+    }
+    
+    private boolean processBinding(JavaInterface intf) {
+        SOAPBinding.Style soapStyle = intf.getSOAPStyle();
+        SOAPBinding.Use soapUse = intf.getSOAPUse();
+        boolean isWrapped = true;
+        int count = 0;
+        for (JavaMethod method : intf.getMethods()) {
+            if (!method.isWrapperStyle()) {
+                isWrapped = false;
+                count++;
+            }
+            if (soapStyle == null
+                && method.getSoapStyle() != null) {
+                soapStyle = method.getSoapStyle();
+            }
+            if (soapUse == null
+                && method.getSoapUse() != null) {
+                soapUse = method.getSoapUse();
+            }
+        }
+
+        if (soapStyle == SOAPBinding.Style.DOCUMENT) {
+            intf.setSOAPStyle(SOAPBinding.Style.DOCUMENT);
+            if (isWrapped) {
+                intf.setSOAPParameterStyle(SOAPBinding.ParameterStyle.WRAPPED);
+            } else {
+                intf.setSOAPParameterStyle(SOAPBinding.ParameterStyle.BARE);
+            }
+        } else if (soapStyle == null) {
+            intf.setSOAPStyle(SOAPBinding.Style.DOCUMENT);
+            if (isWrapped) {
+                intf.setSOAPParameterStyle(SOAPBinding.ParameterStyle.WRAPPED);
+            } else {
+                intf.setSOAPParameterStyle(SOAPBinding.ParameterStyle.BARE);
+            }
+            
+        } else {
+            intf.setSOAPStyle(SOAPBinding.Style.RPC);
+        }
+        
+        if (soapUse == SOAPBinding.Use.LITERAL) {
+            intf.setSOAPUse(SOAPBinding.Use.LITERAL);
+        } else if (soapUse == null) {
+            intf.setSOAPUse(SOAPBinding.Use.LITERAL);
+        } else {
+            intf.setSOAPUse(SOAPBinding.Use.ENCODED);
+        }
+
+        if (intf.getSOAPStyle() == SOAPBinding.Style.DOCUMENT
+            && count != 0
+            && count != intf.getMethods().size()) {
+            return false;
+        }
+
+        if (intf.getSOAPStyle() == SOAPBinding.Style.DOCUMENT
+            && intf.getSOAPUse() == SOAPBinding.Use.LITERAL
+            && intf.getSOAPParameterStyle() == SOAPBinding.ParameterStyle.WRAPPED) {
+            return false;
+        }
+        return true;
+    }
+}
+

Propchange: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/BindingAnnotator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/BindingAnnotator.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebMethodAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebMethodAnnotator.java?view=auto&rev=490973
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebMethodAnnotator.java (added)
+++ incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebMethodAnnotator.java Fri Dec 29 02:05:41 2006
@@ -0,0 +1,119 @@
+/**
+ * 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.wsdlto.frontend.jaxws.processor.internal.annotator;
+
+import javax.jws.soap.SOAPBinding;
+
+import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.tools.common.model.Annotator;
+import org.apache.cxf.tools.common.model.JavaAnnotation;
+import org.apache.cxf.tools.common.model.JavaMethod;
+import org.apache.cxf.tools.common.model.JavaParameter;
+import org.apache.cxf.tools.util.SOAPBindingUtil;
+
+public class WebMethodAnnotator implements Annotator {
+   
+    public void addSOAPBindingAnnotation(JavaMethod method) {
+        if (method.getSoapStyle() == SOAPBinding.Style.DOCUMENT && !method.isWrapperStyle()) {
+            JavaAnnotation bindingAnnotation = new JavaAnnotation("SOAPBinding");
+            bindingAnnotation.addArgument("parameterStyle", SOAPBindingUtil.getBindingAnnotation("BARE"), "");
+            method.addAnnotation("SOAPBinding", bindingAnnotation);
+        }
+    }
+
+    public void addWebMethodAnnotation(JavaMethod method) {
+        addWebMethodAnnotation(method, method.getOperationName());
+    }
+
+    public void addWebMethodAnnotation(JavaMethod method, String operationName) {
+        JavaAnnotation methodAnnotation = new JavaAnnotation("WebMethod");
+        methodAnnotation.addArgument("operationName", operationName);
+        if (!StringUtils.isEmpty(method.getSoapAction())) {
+            methodAnnotation.addArgument("action", method.getSoapAction());
+        }
+        method.addAnnotation("WebMethod", methodAnnotation);
+        method.getInterface().addImport("javax.jws.WebMethod");
+    }
+
+    public void addWebResultAnnotation(JavaMethod method) {
+        if (method.isOneWay()) {
+            JavaAnnotation oneWayAnnotation = new JavaAnnotation("Oneway");
+            method.addAnnotation("Oneway", oneWayAnnotation);
+            method.getInterface().addImport("javax.jws.Oneway");
+            return;
+        }
+
+        if ("void".equals(method.getReturn().getType())) {
+            return;
+        }
+        JavaAnnotation resultAnnotation = new JavaAnnotation("WebResult");
+        String targetNamespace = method.getReturn().getTargetNamespace();
+        String name = "return";
+
+        if (method.getSoapStyle() == SOAPBinding.Style.DOCUMENT && !method.isWrapperStyle()) {
+            name = method.getName() + "Response";
+        }
+
+        if (method.getSoapStyle() == SOAPBinding.Style.RPC) {
+            name = method.getReturn().getName();
+            targetNamespace = method.getInterface().getNamespace();
+           
+        }
+        if (method.getSoapStyle() == SOAPBinding.Style.DOCUMENT) {
+            if (method.getReturn().getQName() != null) {
+                name = method.getReturn().getQName().getLocalPart();
+            }
+            targetNamespace = method.getReturn().getTargetNamespace();
+        }
+
+        resultAnnotation.addArgument("name", name);
+        resultAnnotation.addArgument("targetNamespace", targetNamespace);
+
+        if (method.getSoapStyle() == SOAPBinding.Style.RPC
+            || (method.getSoapStyle() == SOAPBinding.Style.DOCUMENT && !method.isWrapperStyle())) {
+            resultAnnotation.addArgument("partName", method.getReturn().getName());
+        }
+
+        method.addAnnotation("WebResult", resultAnnotation);
+        method.getInterface().addImport("javax.jws.WebResult");
+    }
+
+    public void addWrapperAnnotation(JavaMethod method,
+                                     JavaParameter wrapperRequest,
+                                     JavaParameter wrapperResponse) {
+        if (wrapperRequest != null) {
+            JavaAnnotation wrapperRequestAnnotation = new JavaAnnotation("RequestWrapper");
+            wrapperRequestAnnotation.addArgument("localName", wrapperRequest.getType());
+            wrapperRequestAnnotation.addArgument("targetNamespace", wrapperRequest.getTargetNamespace());
+            wrapperRequestAnnotation.addArgument("className", wrapperRequest.getClassName());
+            method.addAnnotation("RequestWrapper", wrapperRequestAnnotation);
+            method.getInterface().addImport("javax.xml.ws.RequestWrapper");
+        }
+        if (wrapperResponse != null) {
+            JavaAnnotation wrapperResponseAnnotation = new JavaAnnotation("ResponseWrapper");
+            wrapperResponseAnnotation.addArgument("localName", wrapperResponse.getType());
+            wrapperResponseAnnotation.addArgument("targetNamespace", wrapperResponse.getTargetNamespace());
+            wrapperResponseAnnotation.addArgument("className", wrapperResponse.getClassName());
+            method.addAnnotation("ResponseWrapper", wrapperResponseAnnotation);
+            method.getInterface().addImport("javax.xml.ws.ResponseWrapper");
+        }
+
+    }
+}

Propchange: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebMethodAnnotator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebMethodAnnotator.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotator.java?view=auto&rev=490973
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotator.java (added)
+++ incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotator.java Fri Dec 29 02:05:41 2006
@@ -0,0 +1,67 @@
+/**
+ * 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.wsdlto.frontend.jaxws.processor.internal.annotator;
+
+import javax.jws.soap.SOAPBinding;
+
+import org.apache.cxf.tools.common.model.Annotator;
+import org.apache.cxf.tools.common.model.JavaAnnotation;
+import org.apache.cxf.tools.common.model.JavaMethod;
+import org.apache.cxf.tools.common.model.JavaParameter;
+import org.apache.cxf.tools.common.model.JavaType;
+
+public final class WebParamAnnotator implements Annotator {
+    
+    public void annotate(final JavaMethod method, JavaParameter parameter) {
+        JavaAnnotation webParamAnnotation = new JavaAnnotation("WebParam");
+        String name = parameter.getName();
+        String targetNamespace = method.getInterface().getNamespace();
+        String partName = null;
+
+        if (method.getSoapStyle() == SOAPBinding.Style.DOCUMENT) {
+            targetNamespace = parameter.getTargetNamespace();
+            if (parameter.getQName() != null) {
+                name = parameter.getQName().getLocalPart();
+            }
+            if (!method.isWrapperStyle()) {
+                partName = parameter.getPartName();
+            }
+        }
+
+        if (method.getSoapStyle() == SOAPBinding.Style.RPC) {
+            name = parameter.getPartName();
+            partName = parameter.getPartName();
+        }
+
+        if (partName != null) {
+            webParamAnnotation.addArgument("partName", partName);
+        }
+        if (parameter.getStyle() == JavaType.Style.OUT || parameter.getStyle() == JavaType.Style.INOUT) {
+            webParamAnnotation.addArgument("mode", "Mode." + parameter.getStyle().toString(), "");
+        }
+        webParamAnnotation.addArgument("name", name);
+        if (method.getSoapStyle() == SOAPBinding.Style.DOCUMENT) {
+            webParamAnnotation.addArgument("targetNamespace", targetNamespace);
+        }
+
+        parameter.setAnnotation(webParamAnnotation);
+    }
+}
+

Propchange: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotator.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebServiceAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebServiceAnnotator.java?view=auto&rev=490973
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebServiceAnnotator.java (added)
+++ incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebServiceAnnotator.java Fri Dec 29 02:05:41 2006
@@ -0,0 +1,37 @@
+/**
+ * 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.wsdlto.frontend.jaxws.processor.internal.annotator;
+
+import org.apache.cxf.tools.common.model.Annotator;
+import org.apache.cxf.tools.common.model.JavaAnnotation;
+import org.apache.cxf.tools.common.model.JavaInterface;
+
+public final class WebServiceAnnotator implements Annotator {
+    
+    public void annotate(JavaInterface intf) {
+        JavaAnnotation serviceAnnotation = new JavaAnnotation("WebService");
+        serviceAnnotation.addArgument("targetNamespace", intf.getNamespace());
+        serviceAnnotation.addArgument("wsdlLocation", intf.getLocation());
+        serviceAnnotation.addArgument("name", intf.getWebServiceName());
+        
+        intf.addAnnotation(serviceAnnotation.toString());
+    }
+}
+

Propchange: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebServiceAnnotator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebServiceAnnotator.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/InterfaceMapper.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/InterfaceMapper.java?view=auto&rev=490973
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/InterfaceMapper.java (added)
+++ incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/InterfaceMapper.java Fri Dec 29 02:05:41 2006
@@ -0,0 +1,65 @@
+/**
+ * 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.wsdlto.frontend.jaxws.processor.internal.mapper;
+
+import java.util.logging.Logger;
+
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.service.model.InterfaceInfo;
+import org.apache.cxf.tools.common.ToolConstants;
+import org.apache.cxf.tools.common.ToolContext;
+import org.apache.cxf.tools.common.ToolException;
+import org.apache.cxf.tools.common.model.JavaInterface;
+import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.ProcessorUtil;
+
+public final class InterfaceMapper {
+    private static final Logger LOG = LogUtils.getL7dLogger(InterfaceMapper.class);
+    private ToolContext context;
+
+    public InterfaceMapper(ToolContext c) {
+        this.context = c;
+    }
+    
+    public JavaInterface map(InterfaceInfo interfaceInfo) {
+        JavaInterface intf = new JavaInterface();
+        String namespace = interfaceInfo.getName().getNamespaceURI();
+        String packageName = ProcessorUtil.parsePackageName(namespace, context.mapPackageName(namespace));
+        
+        String location = (String)context.get(ToolConstants.CFG_WSDLURL);
+        String urlLocation;
+        try {
+            location = ProcessorUtil.getAbsolutePath(location);
+            urlLocation = ProcessorUtil.getWSDLURL(location).toString();
+        } catch (Exception ioe) {
+            Message msg = new Message("CANNOT_FIND_WSDL", LOG, context.get(ToolConstants.CFG_WSDLURL));
+            throw new ToolException(msg, ioe);
+        }
+        String webServiceName = interfaceInfo.getName().getLocalPart();
+
+        intf.setWebServiceName(webServiceName);
+        intf.setName(ProcessorUtil.mangleNameToClassName(webServiceName));
+        intf.setNamespace(namespace);
+        intf.setPackageName(packageName);
+        intf.setLocation(urlLocation);
+
+        return intf;
+    }
+}

Propchange: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/InterfaceMapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/InterfaceMapper.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/Messages.properties?view=auto&rev=490973
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/Messages.properties (added)
+++ incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/Messages.properties Fri Dec 29 02:05:41 2006
@@ -0,0 +1 @@
+CANNOT_FIND_WSDL = Can not find the wsdl from : {0}
\ No newline at end of file

Added: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/MethodMapper.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/MethodMapper.java?view=auto&rev=490973
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/MethodMapper.java (added)
+++ incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/MethodMapper.java Fri Dec 29 02:05:41 2006
@@ -0,0 +1,50 @@
+/**
+ * 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.wsdlto.frontend.jaxws.processor.internal.mapper;
+
+import javax.wsdl.OperationType;
+
+import org.apache.cxf.service.model.OperationInfo;
+import org.apache.cxf.tools.common.model.JavaMethod;
+import org.apache.cxf.tools.util.ProcessorUtil;
+
+public final class MethodMapper {
+    
+    public JavaMethod map(OperationInfo operation) {
+        JavaMethod method = new JavaMethod();
+        // set default Document Bare style
+        method.setSoapStyle(javax.jws.soap.SOAPBinding.Style.DOCUMENT);
+
+        String operationName = operation.getName().getLocalPart();
+
+        method.setName(ProcessorUtil.mangleNameToVariableName(operationName));
+        method.setOperationName(operationName);
+
+        if (operation.isOneWay()) {
+            method.setStyle(OperationType.ONE_WAY);
+        } else {
+            method.setStyle(OperationType.REQUEST_RESPONSE);
+        }
+        
+        method.setWrapperStyle(operation.isUnwrappedCapable());
+
+        return method;
+    }
+}

Propchange: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/MethodMapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/MethodMapper.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/ParameterMapper.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/ParameterMapper.java?view=auto&rev=490973
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/ParameterMapper.java (added)
+++ incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/ParameterMapper.java Fri Dec 29 02:05:41 2006
@@ -0,0 +1,75 @@
+/**
+ * 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.wsdlto.frontend.jaxws.processor.internal.mapper;
+
+import com.sun.codemodel.JType;
+import com.sun.tools.xjc.api.Property;
+
+import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.tools.common.ToolContext;
+import org.apache.cxf.tools.common.model.JavaParameter;
+import org.apache.cxf.tools.common.model.JavaType;
+import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.ProcessorUtil;
+
+public final class ParameterMapper {
+
+    private ParameterMapper() {
+    }
+    
+    public static JavaParameter map(MessagePartInfo part, JavaType.Style style, ToolContext context) {
+        String name = ProcessorUtil.resolvePartName(part);
+        String namespace = ProcessorUtil.resolvePartNamespace(part);
+        String type = ProcessorUtil.resolvePartType(part, context);
+        
+        JavaParameter parameter = new JavaParameter(name, type, namespace);
+        parameter.setPartName(part.getName().getLocalPart());
+        parameter.setQName(ProcessorUtil.getElementName(part));
+        
+        parameter.setClassName(ProcessorUtil.getFullClzName(part, context, false));
+
+        if (style == JavaType.Style.INOUT || style == JavaType.Style.OUT) {
+            parameter.setHolder(true);
+            parameter.setHolderName(javax.xml.ws.Holder.class.getName());
+            
+            parameter.setHolderClass(ProcessorUtil.getFullClzName(part, context, true));
+        }
+        parameter.setStyle(style);
+        return parameter;
+    }
+
+    public static JavaParameter map(Property property,
+                                    JavaType.Style style,
+                                    MessagePartInfo part) {
+        JType t = property.type();
+        String targetNamespace = ProcessorUtil.resolvePartNamespace(part);
+        if (targetNamespace == null) {
+            targetNamespace = property.elementName().getNamespaceURI();
+        }
+        JavaParameter parameter = new JavaParameter(property.name(), t.fullName(), targetNamespace);
+        parameter.setStyle(style);
+        parameter.setQName(property.elementName());
+        if (style == JavaType.Style.OUT || style == JavaType.Style.INOUT) {
+            parameter.setHolder(true);
+            parameter.setHolderName(javax.xml.ws.Holder.class.getName());
+            parameter.setHolderClass(t.boxify().fullName());
+        }
+        return parameter;
+    }
+}

Propchange: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/ParameterMapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/ParameterMapper.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java?view=diff&rev=490973&r1=490972&r2=490973
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java (original)
+++ incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java Fri Dec 29 02:05:41 2006
@@ -159,10 +159,6 @@
     
 
     public boolean validate(Definition def) throws ToolException {
-        if (context.optionSet(ToolConstants.CFG_VALIDATE_WSDL)) {
-            WSDL11Validator validator = new WSDL11Validator(def, context);
-            validator.isValid();
-        }
-        return true;
+        return new WSDL11Validator(def, context).isValid();
     }
 }

Modified: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/DummyDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/DummyDataBinding.java?view=diff&rev=490973&r1=490972&r2=490973
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/DummyDataBinding.java (original)
+++ incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/DummyDataBinding.java Fri Dec 29 02:05:41 2006
@@ -21,18 +21,16 @@
 
 import java.util.List;
 
-import javax.wsdl.Part;
 import javax.xml.namespace.QName;
 
 import com.sun.tools.xjc.api.Property;
+import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.ToolException;
 
 public class DummyDataBinding implements org.apache.cxf.tools.wsdlto.core.DataBindingProfile {
-    public void initialize(ToolContext context) throws ToolException {
-    }
 
-    public void generate() throws ToolException {
+    public void generate(ToolContext context) throws ToolException {
     }
 
     
@@ -44,7 +42,7 @@
         return null;
     }
     
-    public List<? extends Property> getBlock(Part part) {
+    public List<? extends Property> getBlock(MessagePartInfo part) {
         return null;
     }
 }

Added: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/PortTypeProcessorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/PortTypeProcessorTest.java?view=auto&rev=490973
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/PortTypeProcessorTest.java (added)
+++ incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/PortTypeProcessorTest.java Fri Dec 29 02:05:41 2006
@@ -0,0 +1,28 @@
+/**
+ * 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.wsdlto.frontend.jaxws.processor.internal;
+
+import junit.framework.TestCase;
+
+public class PortTypeProcessorTest extends TestCase {
+    
+    public void testProcess() throws Exception {
+    }
+}

Propchange: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/PortTypeProcessorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/PortTypeProcessorTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtilTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtilTest.java?view=auto&rev=490973
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtilTest.java (added)
+++ incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtilTest.java Fri Dec 29 02:05:41 2006
@@ -0,0 +1,43 @@
+/**
+ * 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.wsdlto.frontend.jaxws.processor.internal;
+
+import junit.framework.TestCase;
+
+public class ProcessorUtilTest extends TestCase {
+
+    private boolean isWindows() {
+        return System.getProperty("os.name").contains("Windows");
+    }
+    
+    public void testGetAbsolutePath() throws Exception {
+        assertEquals("http://cxf.org",
+                     ProcessorUtil.getAbsolutePath("http://cxf.org"));
+
+        if (isWindows()) {
+            assertEquals("C:/org/cxf",
+                         ProcessorUtil.getAbsolutePath("c:\\org\\cxf"));
+            assertEquals("C:/org/cxf",
+                         ProcessorUtil.getAbsolutePath("c:/org/cxf"));
+            assertEquals("C:/org/cxf",
+                         ProcessorUtil.getAbsolutePath("/org/cxf"));
+        }
+    }
+}

Propchange: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtilTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtilTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebMethodAnnotatorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebMethodAnnotatorTest.java?view=auto&rev=490973
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebMethodAnnotatorTest.java (added)
+++ incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebMethodAnnotatorTest.java Fri Dec 29 02:05:41 2006
@@ -0,0 +1,56 @@
+/**
+ * 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.wsdlto.frontend.jaxws.processor.internal.annotator;
+
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.apache.cxf.tools.common.model.JavaAnnotation;
+import org.apache.cxf.tools.common.model.JavaMethod;
+
+public class WebMethodAnnotatorTest extends TestCase {
+
+    WebMethodAnnotator annotator = new WebMethodAnnotator();
+    
+    public void testAddWebMethodAnnotation() throws Exception {
+        JavaMethod method = new JavaMethod();
+        annotator.addWebMethodAnnotation(method);
+        Map<String, JavaAnnotation> annotations = method.getAnnotationMap();
+        assertNotNull(annotations);
+        assertEquals(1, annotations.size());
+        assertEquals("WebMethod", annotations.keySet().iterator().next());
+    }
+
+    public void testAddWebResultAnnotation() throws Exception {
+        JavaMethod method = new JavaMethod();
+        annotator.addWebResultAnnotation(method);
+        Map<String, JavaAnnotation> annotations = method.getAnnotationMap();
+        assertNotNull(annotations);
+        assertEquals(1, annotations.size());
+        assertEquals("WebResult", annotations.keySet().iterator().next());
+        JavaAnnotation resultAnnotation = annotations.values().iterator().next();
+        Map<String, String> arguments = resultAnnotation.getArguments();
+        assertNotNull(arguments);
+        assertEquals(1, arguments.size());
+        assertEquals("name", arguments.keySet().iterator().next());
+        assertEquals("\"return\"", arguments.values().iterator().next());
+    }
+}

Propchange: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebMethodAnnotatorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebMethodAnnotatorTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotatorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotatorTest.java?view=auto&rev=490973
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotatorTest.java (added)
+++ incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotatorTest.java Fri Dec 29 02:05:41 2006
@@ -0,0 +1,82 @@
+/**
+ * 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.wsdlto.frontend.jaxws.processor.internal.annotator;
+
+import javax.jws.soap.SOAPBinding;
+import javax.xml.namespace.QName;
+import junit.framework.TestCase;
+
+import org.apache.cxf.tools.common.model.JavaAnnotation;
+import org.apache.cxf.tools.common.model.JavaMethod;
+import org.apache.cxf.tools.common.model.JavaParameter;
+
+public class WebParamAnnotatorTest extends TestCase {
+
+    WebParamAnnotator annotator;
+    JavaMethod method;
+    JavaParameter parameter;
+
+    public void setUp() {
+        annotator = new WebParamAnnotator();
+        method = new JavaMethod();
+        parameter = new JavaParameter();
+    }
+
+    private void init(JavaMethod m, JavaParameter param, SOAPBinding.Style style, boolean wrapper) {
+        m.setSoapStyle(style);
+        m.setWrapperStyle(wrapper);
+
+        param.setName("x");
+        param.setTargetNamespace("http://apache.org/cxf");
+        param.setQName(new QName("http://apache.org/cxf", "x"));
+        param.setPartName("y");
+    }
+    
+    public void testAnnotateDOCWrapped() throws Exception {
+        init(method, parameter, SOAPBinding.Style.DOCUMENT, true);
+        
+        annotator.annotate(method, parameter);
+
+        JavaAnnotation annotation = parameter.getAnnotation();
+        assertEquals(2, annotation.getArguments().size());
+        assertEquals("@WebParam(targetNamespace = \"http://apache.org/cxf\", name = \"x\")",
+                     annotation.toString());
+    }
+
+    public void testAnnotateDOCBare() throws Exception {
+        init(method, parameter, SOAPBinding.Style.DOCUMENT, false);
+        
+        annotator.annotate(method, parameter);
+
+        JavaAnnotation annotation = parameter.getAnnotation();
+        assertEquals(3, annotation.getArguments().size());
+        assertEquals("@WebParam(targetNamespace = \"http://apache.org/cxf\", partName = \"y\", name = \"x\")",
+                     annotation.toString());
+    }
+
+    public void testAnnotateRPC() throws Exception {
+        init(method, parameter, SOAPBinding.Style.RPC, true);
+        annotator.annotate(method, parameter);
+        JavaAnnotation annotation = parameter.getAnnotation();
+        assertEquals(2, annotation.getArguments().size());
+        assertEquals("@WebParam(partName = \"y\", name = \"y\")",
+                     annotation.toString());
+    }
+}

Propchange: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotatorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotatorTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/InterfaceMapperTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/InterfaceMapperTest.java?view=auto&rev=490973
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/InterfaceMapperTest.java (added)
+++ incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/InterfaceMapperTest.java Fri Dec 29 02:05:41 2006
@@ -0,0 +1,49 @@
+/**
+ * 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.wsdlto.frontend.jaxws.processor.internal.mapper;
+
+import javax.xml.namespace.QName;
+import junit.framework.TestCase;
+
+import org.apache.cxf.service.model.InterfaceInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.tools.common.ToolConstants;
+import org.apache.cxf.tools.common.ToolContext;
+import org.apache.cxf.tools.common.model.JavaInterface;
+
+public class InterfaceMapperTest extends TestCase {
+    public void testMap() throws Exception {
+        InterfaceInfo interfaceInfo = new InterfaceInfo(new ServiceInfo(),
+                                                        new QName("http://apache.org/hello_world_soap_http",
+                                                                  "interfaceTest"));
+
+        ToolContext context = new ToolContext();
+        context.put(ToolConstants.CFG_WSDLURL, "http://localhost/?wsdl");
+        
+        JavaInterface intf = new InterfaceMapper(context).map(interfaceInfo);
+        assertNotNull(intf);
+
+        assertEquals("interfaceTest", intf.getWebServiceName());
+        assertEquals("InterfaceTest", intf.getName());
+        assertEquals("http://apache.org/hello_world_soap_http", intf.getNamespace());
+        assertEquals("org.apache.hello_world_soap_http", intf.getPackageName());
+        assertEquals("http://localhost/?wsdl", intf.getLocation());
+    }
+}

Propchange: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/InterfaceMapperTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/InterfaceMapperTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/MethodMapperTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/MethodMapperTest.java?view=auto&rev=490973
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/MethodMapperTest.java (added)
+++ incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/MethodMapperTest.java Fri Dec 29 02:05:41 2006
@@ -0,0 +1,70 @@
+/**
+ * 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.wsdlto.frontend.jaxws.processor.internal.mapper;
+
+import javax.wsdl.OperationType;
+import javax.xml.namespace.QName;
+import junit.framework.TestCase;
+
+import org.apache.cxf.service.model.MessageInfo;
+import org.apache.cxf.service.model.OperationInfo;
+import org.apache.cxf.tools.common.model.JavaMethod;
+
+public class MethodMapperTest extends TestCase {
+
+    private OperationInfo getOperation() {
+        OperationInfo operation = new OperationInfo();
+        operation.setName(new QName("urn:test:ns", "OperationTest"));
+        return operation;
+    }
+    
+    public void testMap() throws Exception {
+        JavaMethod method = new MethodMapper().map(getOperation());
+        assertNotNull(method);
+
+        assertEquals(javax.jws.soap.SOAPBinding.Style.DOCUMENT, method.getSoapStyle());
+        assertEquals("operationTest", method.getName());
+        assertEquals("OperationTest", method.getOperationName());
+        assertEquals(OperationType.REQUEST_RESPONSE, method.getStyle());
+        assertFalse(method.isWrapperStyle());
+        assertFalse(method.isOneWay());
+    }
+
+    public void testMapOneWayOperation() throws Exception {
+        OperationInfo operation = getOperation();
+
+        MessageInfo inputMessage = operation.createMessage(new QName("urn:test:ns", "testInputMessage"));
+        operation.setInput("input", inputMessage);
+
+        JavaMethod method = new MethodMapper().map(operation);
+        assertNotNull(method);
+        assertTrue(method.isOneWay());
+    }
+
+    public void testMapWrappedOperation() throws Exception {
+        OperationInfo operation = getOperation();
+        operation.setUnwrappedOperation(operation);
+
+        JavaMethod method = new MethodMapper().map(operation);
+        assertNotNull(method);
+        
+        assertTrue(method.isWrapperStyle());
+    }
+}

Propchange: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/MethodMapperTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/MethodMapperTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message