cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject svn commit: r560885 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/wsdl/ rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/wsdl11/ rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/wsdl11/ tools/common/src/main/java/org/a...
Date Mon, 30 Jul 2007 07:53:34 GMT
Author: mmao
Date: Mon Jul 30 00:53:21 2007
New Revision: 560885

URL: http://svn.apache.org/viewvc?view=rev&rev=560885
Log:
CXF-855 Fixed misc tools,
          Wsdl2Service, Wsdl2Xml, Wsdl2Soap


Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/AbstractWSDLPlugin.java
    incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/wsdl11/HttpAddressPlugin.java
    incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/wsdl11/JmsTransportPlugin.java
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/util/SOAPBindingUtil.java
    incubator/cxf/trunk/tools/wsdlto/misc/pom.xml
    incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/Messages.properties
    incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessor.java
    incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessor.java
    incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessor.java
    incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/address/Address.java
    incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/address/JmsAddress.java
    incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/address/SoapAddress.java
    incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/address/XmlAddress.java
    incubator/cxf/trunk/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessorTest.java
    incubator/cxf/trunk/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessorTest.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/AbstractWSDLPlugin.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/AbstractWSDLPlugin.java?view=diff&rev=560885&r1=560884&r2=560885
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/AbstractWSDLPlugin.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/AbstractWSDLPlugin.java Mon
Jul 30 00:53:21 2007
@@ -41,6 +41,10 @@
         return args.get(key).toString();
     }
 
+    public <T> T getOption(final Map<String, Object> args, final String key,
final Class<T> clz) {
+        return clz.cast(args.get(key));
+    }
+
     public <T> T getOption(final Map<String, Object> args, final Class<T>
clz) {
         return clz.cast(args.get(clz.getName()));
     }
@@ -51,5 +55,5 @@
         }
         return getOption(args, key);
     }
-    
+
 }

Modified: incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/wsdl11/HttpAddressPlugin.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/wsdl11/HttpAddressPlugin.java?view=diff&rev=560885&r1=560884&r2=560885
==============================================================================
--- incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/wsdl11/HttpAddressPlugin.java
(original)
+++ incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/wsdl11/HttpAddressPlugin.java
Mon Jul 30 00:53:21 2007
@@ -28,17 +28,23 @@
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.wsdl.AbstractWSDLPlugin;
 import org.apache.cxf.wsdl.WSDLConstants;
+import org.xmlsoap.schemas.wsdl.http.AddressType;
 
 public final class HttpAddressPlugin extends AbstractWSDLPlugin {
 
     public ExtensibilityElement createExtension(final Map<String, Object> args) throws
WSDLException {
-        HTTPAddress xmlHttpAddress = null;
+        String address = getOption(args, ToolConstants.CFG_ADDRESS);
 
-        xmlHttpAddress = (HTTPAddress)registry.createExtension(Port.class,
-                                                               WSDLConstants.NS_XMLHTTP_BINDING_ADDRESS);
+        ExtensibilityElement  addr = registry.createExtension(Port.class,
+                                                              WSDLConstants.NS_XMLHTTP_BINDING_ADDRESS);
 
-        xmlHttpAddress.setLocationURI(getOption(args, ToolConstants.CFG_ADDRESS));
+        if (addr instanceof AddressType) {
+            ((AddressType)addr).setLocation(address);
+        }
 
-        return xmlHttpAddress;
+        if (addr instanceof HTTPAddress) {
+            ((HTTPAddress)addr).setLocationURI(address);
+        }
+        return addr;
     }
 }

Modified: incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/wsdl11/JmsTransportPlugin.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/wsdl11/JmsTransportPlugin.java?view=diff&rev=560885&r1=560884&r2=560885
==============================================================================
--- incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/wsdl11/JmsTransportPlugin.java
(original)
+++ incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/wsdl11/JmsTransportPlugin.java
Mon Jul 30 00:53:21 2007
@@ -26,6 +26,8 @@
 
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.transport.jms.AddressType;
+import org.apache.cxf.transport.jms.DestinationStyleType;
+import org.apache.cxf.transport.jms.JMSNamingPropertyType;
 import org.apache.cxf.wsdl.AbstractWSDLPlugin;
 
 public class JmsTransportPlugin extends AbstractWSDLPlugin {
@@ -33,29 +35,53 @@
         AddressType jmsAddress = null;
 
         jmsAddress = (AddressType)registry.createExtension(Port.class, ToolConstants.JMS_ADDRESS);
+
+        String destType = "queue";
         if (optionSet(args, ToolConstants.JMS_ADDR_DEST_STYLE)) {
-            //jmsAddress.setDestinationStyle((String)env.get(ToolConstants.JMS_ADDR_DEST_STYLE));
+            destType = getOption(args, ToolConstants.JMS_ADDR_DEST_STYLE);
         }
+        jmsAddress.setDestinationStyle(DestinationStyleType.fromValue(destType));
+
+        String finitValue = "org.apache.activemq.jndi.ActiveMQInitialContextFactory";
+        JMSNamingPropertyType finit = new JMSNamingPropertyType();
+        finit.setName("java.naming.factory.initial");
         if (optionSet(args, ToolConstants.JMS_ADDR_INIT_CTX)) {
-            //jmsAddress.setInitialContextFactory((String)env.get(ToolConstants.JMS_ADDR_INIT_CTX));
-        }
-        if (optionSet(args, ToolConstants.JMS_ADDR_JNDI_DEST)) {
-            jmsAddress.setJndiDestinationName(getOption(args, ToolConstants.JMS_ADDR_JNDI_DEST));
-        }
-        if (optionSet(args, ToolConstants.JMS_ADDR_JNDI_FAC)) {
-            jmsAddress.setJndiConnectionFactoryName(getOption(args, ToolConstants.JMS_ADDR_JNDI_FAC));
+            finitValue = getOption(args, ToolConstants.JMS_ADDR_INIT_CTX);
         }
+        finit.setValue(finitValue);
+
+        String providerURL = "tcp://localhost:61616";
+        JMSNamingPropertyType provider = new JMSNamingPropertyType();
+        provider.setName("java.naming.provider.url");
         if (optionSet(args, ToolConstants.JMS_ADDR_JNDI_URL)) {
-            //jmsAddress.setJndiProviderURL((String)env.get(ToolConstants.JMS_ADDR_JNDI_URL));
+            providerURL = getOption(args, ToolConstants.JMS_ADDR_JNDI_URL);
         }
-        if (optionSet(args, ToolConstants.JMS_ADDR_MSGID_TO_CORRID)) {
-            //jmsAddress.setUseMessageIDAsCorrelationID(Boolean.getBoolean((String)env
-            //.get(ToolConstants.JMS_ADDR_MSGID_TO_CORRID)));
+        provider.setValue(providerURL);
+
+        String destName = "dynamicQueues/test.cxf.jmstransport.queue";
+        if (optionSet(args, ToolConstants.JMS_ADDR_JNDI_DEST)) {
+            destName = getOption(args, ToolConstants.JMS_ADDR_JNDI_DEST);
         }
-        if (optionSet(args, ToolConstants.JMS_ADDR_SUBSCRIBER_NAME)) {
-            //jmsAddress.setDurableSubscriberName((String)env
-            //  .get(ToolConstants.JMS_ADDR_SUBSCRIBER_NAME));
+        jmsAddress.setJndiDestinationName(destName);
+
+        String factory = "ConnectionFactory";
+        if (optionSet(args, ToolConstants.JMS_ADDR_JNDI_FAC)) {
+            factory = getOption(args, ToolConstants.JMS_ADDR_JNDI_FAC);
         }
+        jmsAddress.setJndiConnectionFactoryName(factory);
+
+        //         if (optionSet(args, ToolConstants.JMS_ADDR_MSGID_TO_CORRID)) {
+        //             jmsAddress.setUseMessageIDAsCorrelationID(getOption(args,
+        //                                                             ToolConstants.JMS_ADDR_MSGID_TO_CORRID,
+        //                                                                 Boolean.class));
+        //         }
+
+        jmsAddress.getJMSNamingProperty().add(finit);
+        jmsAddress.getJMSNamingProperty().add(provider);
+
+        //         if (optionSet(args, ToolConstants.JMS_ADDR_SUBSCRIBER_NAME)) {
+        //       jmsAddress.setDurableSubscriberName(getOption(args, ToolConstants.JMS_ADDR_SUBSCRIBER_NAME));
+        //         }
         return jmsAddress;
     }
 }

Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/util/SOAPBindingUtil.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/util/SOAPBindingUtil.java?view=diff&rev=560885&r1=560884&r2=560885
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/util/SOAPBindingUtil.java
(original)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/util/SOAPBindingUtil.java
Mon Jul 30 00:53:21 2007
@@ -95,7 +95,7 @@
         }
         return false;
     }
-    
+
     public static String getBindingStyle(Binding binding) {
         Iterator ite = binding.getExtensibilityElements().iterator();
         while (ite.hasNext()) {
@@ -117,7 +117,7 @@
         }
         return null;
     }
-    
+
     public static SoapOperation getSoapOperation(Object obj) {
         if (isSOAPOperation(obj)) {
             return getProxy(SoapOperation.class, obj);
@@ -260,7 +260,7 @@
         }
         return null;
     }
-    
+
     public static SoapBinding getSoapBinding(Object obj) {
         if (isSOAPBinding(obj)) {
             return getProxy(SoapBinding.class, obj);
@@ -471,10 +471,10 @@
             && !namespaces.values().contains(WSDLConstants.SOAP12_NAMESPACE)) {
             definition.addNamespace("soap12", WSDLConstants.SOAP12_NAMESPACE);
         } else if (!namespaces.values().contains(WSDLConstants.SOAP11_NAMESPACE)) {
-            definition.addNamespace("soap", WSDLConstants.SOAP12_NAMESPACE);
+            definition.addNamespace("soap", WSDLConstants.SOAP11_NAMESPACE);
         }
     }
-    
+
     public static javax.jws.soap.SOAPBinding.Style getSoapStyle(String soapStyle) {
         if ("".equals(soapStyle)) {
             return null;
@@ -494,5 +494,5 @@
             return javax.jws.soap.SOAPBinding.Use.LITERAL;
         }
     }
-    
+
 }

Modified: incubator/cxf/trunk/tools/wsdlto/misc/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/misc/pom.xml?view=diff&rev=560885&r1=560884&r2=560885
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/misc/pom.xml (original)
+++ incubator/cxf/trunk/tools/wsdlto/misc/pom.xml Mon Jul 30 00:53:21 2007
@@ -6,9 +6,9 @@
   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
@@ -99,21 +99,21 @@
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-transports-jms</artifactId>
             <version>${project.version}</version>
-	    <scope>test</scope>
+            <scope>test</scope>
         </dependency>
 
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-bindings-xml</artifactId>
             <version>${project.version}</version>
-	    <scope>test</scope>
+            <scope>test</scope>
         </dependency>
 
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-bindings-soap</artifactId>
             <version>${project.version}</version>
-	    <scope>test</scope>
+            <scope>test</scope>
         </dependency>
 
     </dependencies>

Modified: incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/Messages.properties?view=diff&rev=560885&r1=560884&r2=560885
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/Messages.properties
(original)
+++ incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/Messages.properties
Mon Jul 30 00:53:21 2007
@@ -22,7 +22,7 @@
 FAIL_TO_CREATE_WSDL_DEFINITION = Failed to create wsdl definition {0}
 SERVICE_PORT_EXIST = Input service and port already exist in imported contract
 BINDING_NOT_EXIST = Input binding does not exist in imported contract
-FAIL_TO_WRITE_WSDL = Failed to write wsdl file
+FAIL_TO_WRITE_WSDL = Failed to write wsdl file, \n\ncaused by: {0}
 FAIL_TO_CLOSE_WSDL_FILE = Could not close wsdl file
 PORTTYPE_NOT_EXIST = Input port type does not exist in imported contract
 SOAPBINDING_STYLE_NOT_PROVIDED = For rpc style binding, soap binding namespace (-n) must
be provided

Modified: incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessor.java?view=diff&rev=560885&r1=560884&r2=560885
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessor.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessor.java
Mon Jul 30 00:53:21 2007
@@ -161,6 +161,11 @@
         String transport = (String)env.get(ToolConstants.CFG_TRANSPORT);
         Address address = AddressFactory.getInstance().getAddresser(transport);
 
+        Map<String, String> ns = address.getNamespaces(env);
+        for (String key : ns.keySet()) {
+            wsdlDefinition.addNamespace(key, ns.get(key));
+        }
+
         WSDLExtensibilityPlugin plugin = getWSDLPlugin(transport, Port.class);
         try {
             ExtensibilityElement extElement = plugin.createExtension(address.buildAddressArguments(env));

Modified: incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessor.java?view=diff&rev=560885&r1=560884&r2=560885
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessor.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessor.java
Mon Jul 30 00:53:21 2007
@@ -179,9 +179,8 @@
         try {
             wsdlWriter.writeWSDL(wsdlDefinition, outputWriter);
         } catch (WSDLException wse) {
-            Message msg = new Message("FAIL_TO_WRITE_WSDL", LOG);
+            Message msg = new Message("FAIL_TO_WRITE_WSDL", LOG, wse.getMessage());
             throw new ToolException(msg);
-
         }
         try {
             outputWriter.close();

Modified: incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessor.java?view=diff&rev=560885&r1=560884&r2=560885
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessor.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessor.java
Mon Jul 30 00:53:21 2007
@@ -162,7 +162,7 @@
         }
         if (wsdlDefinition.getNamespace(ToolConstants.XML_HTTP_PREFIX) == null) {
             wsdlDefinition.addNamespace(ToolConstants.XML_HTTP_PREFIX, ToolConstants.NS_XML_HTTP);
-        }        
+        }
     }
 
     private void doAppendBinding() throws ToolException {
@@ -268,6 +268,11 @@
         }
 
         Address address = AddressFactory.getInstance().getAddresser("xml");
+
+        for (String key : address.getNamespaces(env).keySet()) {
+            wsdlDefinition.addNamespace(key, address.getNamespaces(env).get(key));
+        }
+
         WSDLExtensibilityPlugin generator = getWSDLPlugin("xml", Port.class);
         try {
             ExtensibilityElement extElement = generator.createExtension(address.buildAddressArguments(env));

Modified: incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/address/Address.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/address/Address.java?view=diff&rev=560885&r1=560884&r2=560885
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/address/Address.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/address/Address.java
Mon Jul 30 00:53:21 2007
@@ -24,6 +24,7 @@
 
 public interface Address {
     String HTTP_PREFIX = "http://localhost:9000";
-    
+
     Map<String, Object> buildAddressArguments(final ToolContext context);
+    Map<String, String> getNamespaces(final ToolContext context);
 }

Modified: incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/address/JmsAddress.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/address/JmsAddress.java?view=diff&rev=560885&r1=560884&r2=560885
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/address/JmsAddress.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/address/JmsAddress.java
Mon Jul 30 00:53:21 2007
@@ -26,9 +26,15 @@
 import org.apache.cxf.tools.common.ToolContext;
 
 public class JmsAddress implements Address {
+    public Map<String, String> getNamespaces(final ToolContext context) {
+        Map<String, String> ns = new HashMap<String, String>();
+        ns.put("jms", ToolConstants.NS_JMS_ADDRESS);
+        return ns;
+    }
+
     public Map<String, Object> buildAddressArguments(final ToolContext context) {
         Map<String, Object> args = new HashMap<String, Object>();
-        
+
         if (context.optionSet(ToolConstants.JMS_ADDR_DEST_STYLE)) {
             args.put(ToolConstants.JMS_ADDR_DEST_STYLE,
                      context.get(ToolConstants.JMS_ADDR_DEST_STYLE));

Modified: incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/address/SoapAddress.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/address/SoapAddress.java?view=diff&rev=560885&r1=560884&r2=560885
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/address/SoapAddress.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/address/SoapAddress.java
Mon Jul 30 00:53:21 2007
@@ -24,14 +24,24 @@
 
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
+import org.apache.cxf.wsdl.WSDLConstants;
 
 public class SoapAddress extends XmlAddress {
-    
+    public Map<String, String> getNamespaces(final ToolContext context) {
+        Map<String, String> ns = new HashMap<String, String>();
+        if (context.optionSet(ToolConstants.CFG_SOAP12)) {
+            ns.put(ToolConstants.CFG_SOAP12, WSDLConstants.SOAP12_NAMESPACE);
+        } else {
+            ns.put("soap", WSDLConstants.SOAP11_NAMESPACE);
+        }
+        return ns;
+    }
+
     public Map<String, Object> buildAddressArguments(final ToolContext context) {
         Map<String, Object> args = new HashMap<String, Object>();
 
         args.putAll(super.buildAddressArguments(context));
-        
+
         if (context.optionSet(ToolConstants.CFG_SOAP12)) {
             args.put(ToolConstants.CFG_SOAP12,
                      context.get(ToolConstants.CFG_SOAP12));

Modified: incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/address/XmlAddress.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/address/XmlAddress.java?view=diff&rev=560885&r1=560884&r2=560885
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/address/XmlAddress.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/address/XmlAddress.java
Mon Jul 30 00:53:21 2007
@@ -26,7 +26,13 @@
 import org.apache.cxf.tools.common.ToolContext;
 
 public class XmlAddress implements Address {
-    
+
+    public Map<String, String> getNamespaces(final ToolContext context) {
+        Map<String, String> ns = new HashMap<String, String>();
+        ns.put("http", ToolConstants.NS_XML_HTTP);
+        return ns;
+    }
+
     public Map<String, Object> buildAddressArguments(final ToolContext context) {
         Map<String, Object> args = new HashMap<String, Object>();
 

Modified: incubator/cxf/trunk/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessorTest.java?view=diff&rev=560885&r1=560884&r2=560885
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessorTest.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessorTest.java
Mon Jul 30 00:53:21 2007
@@ -184,7 +184,7 @@
     @Test
     public void testJMSNewService() throws Exception {
         String[] args = new String[] {"-transport", "jms", "-e", "serviceins", "-p", "portins",
"-n",
-                                      "HelloWorldPortBinding", "-jpu", "tcp://localhost:61616",
"-jcf",
+                                      "HelloWorldPortBinding", "-jpu", "tcp://localhost:91919",
"-jcf",
                                       "org.activemq.jndi.ActiveMQInitialContextFactory",
"-jfn",
                                       "ConnectionFactory", "-jdn",
                                       "dynamicQueues/test.cxf.jmstransport.queue", "-jmt",
"text", "-jmc",
@@ -219,27 +219,17 @@
                           && "queue".equalsIgnoreCase(jmsAddress.getDestinationStyle().toString())))
{
                         break;
                     }
-//                     if (!(jmsAddress.getDurableSubscriberName() != null && jmsAddress
-//                         .getDurableSubscriberName().equals("cxf_Queue_subscriber"))) {
-//                         break;
-//                     }
-//                     if (!(jmsAddress.getInitialContextFactory() != null && jmsAddress
-//                         .getInitialContextFactory()
-//                         .equals("org.activemq.jndi.ActiveMQInitialContextFactory"))) {
-//                         break;
-//                     }
                     if (!(jmsAddress.getJndiDestinationName() != null && jmsAddress.getJndiDestinationName()
                         .equals("dynamicQueues/test.cxf.jmstransport.queue"))) {
                         break;
                     }
-//                 if (!(jmsAddress.getJndiProviderURL() != null && jmsAddress.getJndiProviderURL()
-//                         .equals("tcp://localhost:61616"))) {
-//                         break;
-//                 }
-//                 if (!(jmsAddress.getMessageType() != null && jmsAddress.getMessageType().equals("text")
-//                     && !jmsAddress.isUseMessageIDAsCorrelationID())) {
-//                         break;
-//                  }
+
+                    assertEquals(2, jmsAddress.getJMSNamingProperty().size());
+                    assertEquals("java.naming.factory.initial",
+                                 jmsAddress.getJMSNamingProperty().get(0).getName());
+                    assertEquals("tcp://localhost:91919",
+                                 jmsAddress.getJMSNamingProperty().get(1).getValue());
+
                     found = true;
                     break;
                 }
@@ -251,6 +241,64 @@
             fail("Exception Encountered when parsing wsdl, error: " + e.getMessage());
         }
     }
+
+    @Test
+    public void testJMSDefaultValue() throws Exception {
+        String[] args = new String[] {"-transport", "jms", "-e", "serviceins", "-p", "portins",
"-n",
+                                      "HelloWorldPortBinding",
+                                      "-d", output.getCanonicalPath(),
+                                      getLocation("/misctools_wsdl/jms_test.wsdl")};
+        WSDLToService.main(args);
+        File outputFile = new File(output, "jms_test-service.wsdl");
+        assertTrue("New wsdl file is not generated", outputFile.exists());
+        WSDLToServiceProcessor processor = new WSDLToServiceProcessor();
+        processor.setEnvironment(env);
+        try {
+            processor.parseWSDL(outputFile.getAbsolutePath());
+            Service service = processor.getWSDLDefinition().getService(
+                                                                       new QName(processor
+                                                                           .getWSDLDefinition()
+                                                                           .getTargetNamespace(),
+                                                                                 "serviceins"));
+            if (service == null) {
+                fail("Element wsdl:service serviceins Missed!");
+            }
+            Iterator it = service.getPort("portins").getExtensibilityElements().iterator();
+            if (service == null) {
+                fail("Element wsdl:port portins Missed!");
+            }
+            boolean found = false;
+            while (it.hasNext()) {
+                Object obj = it.next();
+                if (obj instanceof AddressType) {
+                    AddressType jmsAddress = (AddressType)obj;
+                    if (!(jmsAddress.getDestinationStyle() != null
+                          && "queue".equalsIgnoreCase(jmsAddress.getDestinationStyle().toString())))
{
+                        break;
+                    }
+                    if (!(jmsAddress.getJndiDestinationName() != null && jmsAddress.getJndiDestinationName()
+                        .equals("dynamicQueues/test.cxf.jmstransport.queue"))) {
+                        break;
+                    }
+
+                    assertEquals(2, jmsAddress.getJMSNamingProperty().size());
+                    assertEquals("java.naming.factory.initial",
+                                 jmsAddress.getJMSNamingProperty().get(0).getName());
+                    assertEquals("tcp://localhost:61616",
+                                 jmsAddress.getJMSNamingProperty().get(1).getValue());
+
+                    found = true;
+                    break;
+                }
+            }
+            if (!found) {
+                fail("Element jms:address of service port Missed!");
+            }
+        } catch (ToolException e) {
+            fail("Exception Encountered when parsing wsdl, error: " + e.getMessage());
+        }
+    }
+
 
     @Test
     public void testServiceExist() throws Exception {

Modified: incubator/cxf/trunk/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessorTest.java?view=diff&rev=560885&r1=560884&r2=560885
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessorTest.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessorTest.java
Mon Jul 30 00:53:21 2007
@@ -54,10 +54,10 @@
 
         File outputFile = new File(output, "hello_world-xmlbinding.wsdl");
         assertTrue("New wsdl file is not generated", outputFile.exists());
-        
+
         WSDLToXMLProcessor processor = new WSDLToXMLProcessor();
         processor.setEnvironment(env);
-        
+
 
         try {
             processor.parseWSDL(outputFile.getAbsolutePath());



Mime
View raw message