cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject svn commit: r489301 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/wsdl/ integration/jca/src/test/java/org/apache/cxf/jca/cxf/test/ rt/core/ rt/core/src/main/java/org/apache/cxf/wsdl11/ rt/core/src/test/java/org/apache/cxf/wsdl11/ testutil...
Date Thu, 21 Dec 2006 09:32:31 GMT
Author: mmao
Date: Thu Dec 21 01:32:30 2006
New Revision: 489301

URL: http://svn.apache.org/viewvc?view=rev&rev=489301
Log:
CXF-222 Tooling refactoring

* WSDLDefinitionBuilder support wsdl extensions
* Tools2 depends xml binding and jms transport temporarily, and also copy the schema and extensions.xml from binding/transport into tools2/core
  since we are not decided which way to go.
* Test the imported wsdl in WSDLDefinitionBuilder, we are not using URIResolver, seems a bug in resolve, should the resolve re-visit later, 
  and also should add a test test the wsdl has imported wsdl in classpath/jars

Added:
    incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLManagerImplTest.java   (with props)
    incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_bindings.wsdl   (with props)
    incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_messages.wsdl
      - copied unchanged from r488142, incubator/cxf/trunk/tools/wsdl2java/src/test/resources/wsdl2java_wsdl/hello_world_messages.wsdl
    incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_services.wsdl   (with props)
    incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_wsdl_import.wsdl
      - copied, changed from r488142, incubator/cxf/trunk/tools/wsdl2java/src/test/resources/wsdl2java_wsdl/hello_world_wsdl_import.wsdl
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/resources/extensions/
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/resources/extensions/wsdl11/
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/resources/extensions/wsdl11/xml/
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/resources/extensions/wsdl11/xml/extensions.xml
      - copied unchanged from r488951, incubator/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/extensions.xml
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/resources/schemas/wsdl11/
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/resources/schemas/wsdl11/xml-binding.xjb
      - copied unchanged from r488951, incubator/cxf/trunk/rt/bindings/xml/src/main/resources/schemas/wsdl/xml-binding.xjb
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/resources/schemas/wsdl11/xml-binding.xsd
      - copied unchanged from r488951, incubator/cxf/trunk/rt/bindings/xml/src/main/resources/schemas/wsdl/xml-binding.xsd
Removed:
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/WSDLExtensionRegister.java
Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
    incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/test/DummyBus.java
    incubator/cxf/trunk/rt/core/pom.xml
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilder.java
    incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilderTest.java
    incubator/cxf/trunk/tools2/wsdlto/core/pom.xml
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
    incubator/cxf/trunk/tools2/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/core/PluginLoaderTest.java
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/pom.xml
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSProfileTest.java
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilderTest.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java?view=diff&rev=489301&r1=489300&r2=489301
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java Thu Dec 21 01:32:30 2006
@@ -383,35 +383,6 @@
 
         return null;
     }
-
-    
-   /* private static List<javax.wsdl.extensions.schema.Schema> getSchemas(Definition definition) {
-        Types types = definition.getTypes();
-        List<javax.wsdl.extensions.schema.Schema> schemaList = 
-            new ArrayList<javax.wsdl.extensions.schema.Schema>();
-        if (types != null) {
-            for (Object o : types.getExtensibilityElements()) {
-                if (o instanceof javax.wsdl.extensions.schema.Schema) {
-                    javax.wsdl.extensions.schema.Schema s =
-                        (javax.wsdl.extensions.schema.Schema)o;
-                    schemaList.add(s);
-                }
-            }
-        }
-
-        Map wsdlImports = definition.getImports();
-        for (Object o : wsdlImports.values()) {
-            if (o instanceof List) {
-                for (Object p : (List)o) {
-                    if (p instanceof Import) {
-                        schemaList.addAll(getSchemas(((Import)p).getDefinition()));
-                    }
-                }
-            }
-        }
-        return schemaList;
-    }*/
-    
     
     public static Schema getSchema(ServiceInfo serviceInfo) {
         if (serviceInfo == null) {
@@ -423,36 +394,7 @@
             }
         }
         Schema schema = schemaMap.get(serviceInfo);
-        /*Object obj = serviceInfo.getProperty("org.apache.cxf.wsdl11.WSDLServiceBuilder.DEFINITION");
-        Definition def = (Definition)obj;*/
-       /* if (schema == null) {
-            List<javax.wsdl.extensions.schema.Schema> schemas = getSchemas(def);
-            SchemaFactory factory = SchemaFactory.newInstance(
-                XMLConstants.W3C_XML_SCHEMA_NS_URI);
-            List<Source> schemaSources = new ArrayList<Source>();
-            for (javax.wsdl.extensions.schema.Schema s : schemas) {
-                Source source = new DOMSource(s.getElement());
-                if (source != null) {
-                    schemaSources.add(source);
-                }
-            }
-            try {
-                schema = factory.newSchema(schemaSources.toArray(
-                    new Source[schemaSources.size()]));
-                if (schema != null) {
-                    synchronized (schemaMap) {
-                        schemaMap.put(serviceInfo, schema);
-                    }
-                    LOG.log(Level.FINE, "Obtained schema from wsdl definition");
-                }
-            } catch (SAXException ex) {
-                // Something not right with the schema from the wsdl.
-               
-            }
-        }
-        return schema;
 
-    }*/
         if (schema == null) {
             SchemaFactory factory = SchemaFactory.newInstance(
                 XMLConstants.W3C_XML_SCHEMA_NS_URI);

Modified: incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/test/DummyBus.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/test/DummyBus.java?view=diff&rev=489301&r1=489300&r2=489301
==============================================================================
--- incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/test/DummyBus.java (original)
+++ incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/test/DummyBus.java Thu Dec 21 01:32:30 2006
@@ -19,27 +19,12 @@
 package org.apache.cxf.jca.cxf.test;
 
 
-//import java.util.Map;
+
 import java.util.ResourceBundle;
 import org.apache.cxf.Bus;
-// import org.apache.cxf.BusEvent;
-// import org.apache.cxf.BusEventCache;
-// import org.apache.cxf.BusEventFilter;
-// import org.apache.cxf.BusEventListener;
 import org.apache.cxf.BusException;
-//import org.apache.cxf.bindings.BindingManager;
-//import org.apache.cxf.buslifecycle.BusLifeCycleManager;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.interceptor.AbstractBasicInterceptorProvider;
-//import org.apache.cxf.jaxws.EndpointRegistry;
-//import org.apache.cxf.management.InstrumentationManager;
-//import org.apache.cxf.plugins.PluginManager;
-//import org.apache.cxf.resource.ResourceManager;
-//import org.apache.cxf.transports.TransportFactoryManager;
-//import org.apache.cxf.workqueue.WorkQueueManager;
-//import org.apache.cxf.wsdl.WSDLManager;
-
-
 
 public class DummyBus extends AbstractBasicInterceptorProvider implements Bus {    
     // for initialise behaviours
@@ -83,90 +68,8 @@
     }
 
 
-//     @Override
-//     public void sendEvent(BusEvent event) {
-//         // TODO Auto-generated method stub
-        
-//     }
-
-
-//     @Override
-//     public void addListener(BusEventListener l, BusEventFilter filter) throws BusException {
-//         // TODO Auto-generated method stub
-        
-//     }
-
-
-//     @Override
-//     public void removeListener(BusEventListener l) throws BusException {
-//         // TODO Auto-generated method stub
-        
-//     }
-
-
-//     @Override
-//     public BusEventCache getEventCache() {
-//         // TODO Auto-generated method stub
-//         return null;
-//     }
-
-
-//     @Override
-//     public TransportFactoryManager getTransportFactoryManager() {
-//         // TODO Auto-generated method stub
-//         return null;
-//     }
-
-
-//     @Override
-//     public BindingManager getBindingManager() {
-//         // TODO Auto-generated method stub
-//         return null;
-//     }
-
-
-//     @Override
-//     public WSDLManager getWSDLManager() {
-//         // TODO Auto-generated method stub
-//         return null;
-//     }
-
-
-//     @Override
-//     public PluginManager getPluginManager() {
-//         // TODO Auto-generated method stub
-//         return null;
-//     }
-
-
-//     @Override
-//     public BusLifeCycleManager getLifeCycleManager() {
-//         // TODO Auto-generated method stub
-//         return null;
-//     }
-
-
-//     @Override
-//     public WorkQueueManager getWorkQueueManager() {
-//         // TODO Auto-generated method stub
-//         return null;
-//     }
-
 
-//     @Override
-//     public ResourceManager getResourceManager() {
-//         // TODO Auto-generated method stub
-//         return null;
-//     }
-
-
-//     @Override
-//     public InstrumentationManager getInstrumentationManager() {
-//         // TODO Auto-generated method stub
-//         return null;
-//     }
-
-//    @Override
+    //    @Override
     public <T> T getExtension(Class<T> extensionType) {
         return null;
     }
@@ -189,31 +92,6 @@
         
     }
 
-
-//     @Override
-//     public EndpointRegistry getEndpointRegistry() {
-//         // TODO Auto-generated method stub
-//         return null;
-//     }
-
-
-//     @Override
-//     public void initialize(String[] args, Map<String, Object> properties) throws BusException {
-//         // TODO Auto-generated method stub
-        
-//     }
-
-
-//     public static String getCXFHome() {
-//         return cxfHome;
-//     }
-
-
-//     public static void setCXFHome(String home) {
-//         DummyBus.cxfHome = home;
-//     }
-
-
     public static boolean isCorrectThreadContextClassLoader() {
         return correctThreadContextClassLoader;
     }
@@ -232,30 +110,5 @@
     public static void setInitializeCount(int count) {
         DummyBus.initializeCount = count;
     }
-
-
-//     public static String[] getInvokeArgs() {
-//         return invokeArgs;
-//     }
-
-
-//     public static void setInvokeArgs(String[] args) {
-//         DummyBus.invokeArgs = args;
-//     }
-
-
-//     public static int getShutdownCount() {
-//         return shutdownCount;
-//     }
-
-
-//     public static void setShutdownCount(int count) {
-//         DummyBus.shutdownCount = count;
-//     }
-
-
-//     public static void setThrowException(boolean fthrow) {
-//         DummyBus.throwException = fthrow;
-//     } 
 
 }

Modified: incubator/cxf/trunk/rt/core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/pom.xml?view=diff&rev=489301&r1=489300&r2=489301
==============================================================================
--- incubator/cxf/trunk/rt/core/pom.xml (original)
+++ incubator/cxf/trunk/rt/core/pom.xml Thu Dec 21 01:32:30 2006
@@ -43,6 +43,11 @@
             <version>${project.version}</version>
         </dependency>
         <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-testutils</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
             <groupId>org.apache.ws.commons</groupId>
             <artifactId>XmlSchema</artifactId>
         </dependency> 

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilder.java?view=diff&rev=489301&r1=489300&r2=489301
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilder.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilder.java Thu Dec 21 01:32:30 2006
@@ -19,50 +19,73 @@
 
 package org.apache.cxf.wsdl11;
 
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
+import java.util.StringTokenizer;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import javax.wsdl.Definition;
 import javax.wsdl.Import;
+import javax.wsdl.extensions.ExtensionRegistry;
 import javax.wsdl.factory.WSDLFactory;
 import javax.wsdl.xml.WSDLReader;
+import javax.xml.bind.JAXBException;
 
-import org.xml.sax.InputSource;
-
+import org.apache.cxf.BusException;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.resource.URIResolver;
+import org.apache.cxf.common.util.PropertiesLoaderUtils;
+import org.apache.cxf.wsdl.JAXBExtensionHelper;
 import org.apache.cxf.wsdl.WSDLBuilder;
-import org.apache.cxf.wsdl4jutils.WSDLResolver;
+import org.apache.cxf.wsdl4jutils.WSDLLocatorImpl;
 
-public class WSDLDefinitionBuilder implements WSDLBuilder<Definition> {
+public class WSDLDefinitionBuilder implements WSDLBuilder<Definition> {    
+    
     protected static final Logger LOG = LogUtils.getL7dLogger(WSDLDefinitionBuilder.class);
-    protected WSDLFactory wsdlFactory;
+    private static final String EXTENSIONS_RESOURCE = "META-INF/extensions.xml";
+    
     protected WSDLReader wsdlReader;
     protected Definition wsdlDefinition;
+    final WSDLFactory wsdlFactory;
+    final ExtensionRegistry registry;    
     private List<Definition> importedDefinitions = new ArrayList<Definition>();
     
+    public WSDLDefinitionBuilder() {    
+        try {
+            wsdlFactory = WSDLFactory.newInstance();
+            registry = wsdlFactory.newPopulatedExtensionRegistry();
+            registerInitialExtensions();
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+    
     public Definition build(String wsdlURL) {
         parseWSDL(wsdlURL);
         return wsdlDefinition;
     }
 
     protected void parseWSDL(String wsdlURL) {
-        try {
-            wsdlFactory = WSDLFactory.newInstance();
+        try {            
             wsdlReader = wsdlFactory.newWSDLReader();
+            // TODO enable the verbose if in verbose mode.
             wsdlReader.setFeature("javax.wsdl.verbose", false);
-            // REVISIT: JAXWS/JMS/XML extensions, should be provided by the WSDLServiceBuilder
-            //          Do we need to expose the wsdlReader and wsdlFactory? 
-            //            WSDLExtensionRegister register = new WSDLExtensionRegister(wsdlFactory, wsdlReader);
-            //            register.registerExtensions();
-            URIResolver resolver = new URIResolver(wsdlURL);
-            InputSource insource = new InputSource(resolver.getInputStream());
-            wsdlURL = resolver.getURI().toString();
-            wsdlDefinition = wsdlReader.readWSDL(new WSDLResolver(wsdlURL, insource));
+            
+            // REVIST: URIResolve is to solve the wsdl import and schema import, 
+            //         but seems it works fine now without URIResolver
+            //         URIResolve has a bug, it can not resolve the wsdl in testutils
+            
+            //URIResolver resolver = new URIResolver(wsdlURL);
+            //InputSource insource = new InputSource(resolver.getInputStream());
+            //wsdlURL = resolver.getURI().toString();
+            //wsdlDefinition = wsdlReader.readWSDL(new WSDLResolver(wsdlURL, insource));
+            WSDLLocatorImpl wsdlLocator = new WSDLLocatorImpl(wsdlURL);
+            wsdlDefinition = wsdlReader.readWSDL(wsdlLocator);
 
             parseImports(wsdlDefinition);
         } catch (Exception we) {
@@ -89,5 +112,42 @@
     
     public List<Definition> getImportedDefinitions() {
         return importedDefinitions;
+    }
+
+    private void registerInitialExtensions() throws BusException {
+        Properties initialExtensions = null;
+        try {
+            initialExtensions = PropertiesLoaderUtils.loadAllProperties(EXTENSIONS_RESOURCE, Thread
+                            .currentThread().getContextClassLoader());
+        } catch (IOException ex) {
+            throw new BusException(ex);
+        }
+
+        for (Iterator it = initialExtensions.keySet().iterator(); it.hasNext();) {
+            StringTokenizer st = new StringTokenizer(initialExtensions.getProperty((String) it.next()), "=");
+            String parentType = st.nextToken();
+            String elementType = st.nextToken();
+            try {
+                if (LOG.isLoggable(Level.FINE)) {
+                    LOG.fine("Registering extension: " + elementType + " for parent: " + parentType);
+                }
+                System.err.println("parent type: " + parentType);
+                System.err.println("elementType : " + elementType);
+                JAXBExtensionHelper.addExtensions(registry, parentType, elementType, getClass()
+                                .getClassLoader());
+            } catch (ClassNotFoundException ex) {
+                LOG.log(Level.WARNING, "EXTENSION_ADD_FAILED_MSG", ex);
+            } catch (JAXBException ex) {
+                LOG.log(Level.WARNING, "EXTENSION_ADD_FAILED_MSG", ex);
+            }
+        }
+    }
+    
+    public ExtensionRegistry getExtenstionRegistry() {
+        return registry;
+    }
+
+    public WSDLFactory getWSDLFactory() {
+        return wsdlFactory;
     }
 }

Modified: incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilderTest.java?view=diff&rev=489301&r1=489300&r2=489301
==============================================================================
--- incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilderTest.java (original)
+++ incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilderTest.java Thu Dec 21 01:32:30 2006
@@ -21,8 +21,12 @@
 
 import java.util.Map;
 
+import javax.wsdl.Binding;
 import javax.wsdl.Definition;
+import javax.wsdl.Operation;
+import javax.wsdl.Part;
 import javax.wsdl.Port;
+import javax.wsdl.PortType;
 import javax.wsdl.Service;
 import javax.xml.namespace.QName;
 
@@ -50,4 +54,43 @@
         Port port = service.getPort("SoapPort");
         assertNotNull(port);        
     }
+    
+    public void testBuildImportedWSDL() throws Exception {
+        String wsdlUrl = getClass().getResource("/wsdl/hello_world_services.wsdl").toString();
+        
+        WSDLDefinitionBuilder builder = new WSDLDefinitionBuilder();
+        Definition def = builder.build(wsdlUrl);
+
+        assertNotNull(def);
+        Map services = def.getServices();
+        assertNotNull(services);
+        assertEquals(1, services.size());
+        
+        String serviceQName = "http://apache.org/hello_world/services";
+        Service service = (Service)services.get(new QName(serviceQName, "SOAPService"));
+        assertNotNull(service);
+        
+        Map ports = service.getPorts();
+        assertNotNull(ports);
+        assertEquals(1, ports.size());
+        Port port = service.getPort("SoapPort");
+        assertNotNull(port);
+        
+        Binding binding = port.getBinding();
+        assertNotNull(binding);
+        QName bindingQName = new QName("http://apache.org/hello_world/bindings", "SOAPBinding");
+        assertEquals(bindingQName, binding.getQName());
+        PortType portType = binding.getPortType();
+        assertNotNull(portType);
+        QName portTypeQName = new QName("http://apache.org/hello_world", "Greeter");
+        assertEquals(portTypeQName, portType.getQName());
+        Operation op1 = portType.getOperation("sayHi", "sayHiRequest", "sayHiResponse");
+        assertNotNull(op1);
+        QName messageQName = new QName("http://apache.org/hello_world/messages", "sayHiRequest");
+        assertEquals(messageQName, op1.getInput().getMessage().getQName());
+        
+        Part part = op1.getInput().getMessage().getPart("in");
+        assertNotNull(part);
+        assertEquals(new QName("http://apache.org/hello_world/types", "sayHi"), part.getElementName());
+    }    
 }

Added: incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLManagerImplTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLManagerImplTest.java?view=auto&rev=489301
==============================================================================
--- incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLManagerImplTest.java (added)
+++ incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLManagerImplTest.java Thu Dec 21 01:32:30 2006
@@ -0,0 +1,96 @@
+/**
+ * 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.wsdl11;
+
+import java.util.Map;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Definition;
+import javax.wsdl.Operation;
+import javax.wsdl.Part;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+public class WSDLManagerImplTest extends TestCase {
+
+    public void testBuildSimpleWSDL() throws Exception {
+        String qname = "http://apache.org/hello_world_soap_http";
+        String wsdlUrl = getClass().getResource("/wsdl/hello_world.wsdl").toString();
+        
+        WSDLManagerImpl builder = new WSDLManagerImpl();
+        Definition def = builder.getDefinition(wsdlUrl);
+        assertNotNull(def);
+        
+        Map services = def.getServices();
+        assertNotNull(services);
+        assertEquals(7, services.size());
+        Service service = (Service)services.get(new QName(qname, "SOAPService"));
+        assertNotNull(service);
+        
+        Map ports = service.getPorts();
+        assertNotNull(ports);
+        assertEquals(2, ports.size());
+        Port port = service.getPort("SoapPort");
+        assertNotNull(port);
+    }
+    
+    public void testBuildImportedWSDL() throws Exception {
+        String wsdlUrl = getClass().getResource("/wsdl/hello_world_services.wsdl").toString();
+        
+        WSDLManagerImpl builder = new WSDLManagerImpl();
+        Definition def = builder.getDefinition(wsdlUrl);
+
+        assertNotNull(def);
+        Map services = def.getServices();
+        assertNotNull(services);
+        assertEquals(1, services.size());
+        
+        String serviceQName = "http://apache.org/hello_world/services";
+        Service service = (Service)services.get(new QName(serviceQName, "SOAPService"));
+        assertNotNull(service);
+        
+        Map ports = service.getPorts();
+        assertNotNull(ports);
+        assertEquals(1, ports.size());
+        Port port = service.getPort("SoapPort");
+        assertNotNull(port);
+        
+        Binding binding = port.getBinding();
+        assertNotNull(binding);
+        QName bindingQName = new QName("http://apache.org/hello_world/bindings", "SOAPBinding");
+        assertEquals(bindingQName, binding.getQName());
+        PortType portType = binding.getPortType();
+        assertNotNull(portType);
+        QName portTypeQName = new QName("http://apache.org/hello_world", "Greeter");
+        assertEquals(portTypeQName, portType.getQName());
+        Operation op1 = portType.getOperation("sayHi", "sayHiRequest", "sayHiResponse");
+        assertNotNull(op1);
+        QName messageQName = new QName("http://apache.org/hello_world/messages", "sayHiRequest");
+        assertEquals(messageQName, op1.getInput().getMessage().getQName());
+        
+        Part part = op1.getInput().getMessage().getPart("in");
+        assertNotNull(part);
+        assertEquals(new QName("http://apache.org/hello_world/types", "sayHi"), part.getElementName());
+    }    
+}

Propchange: incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLManagerImplTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLManagerImplTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_bindings.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_bindings.wsdl?view=auto&rev=489301
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_bindings.wsdl (added)
+++ incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_bindings.wsdl Thu Dec 21 01:32:30 2006
@@ -0,0 +1,67 @@
+<?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="HelloWorld"
+		  xmlns="http://schemas.xmlsoap.org/wsdl/"
+		  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+		  xmlns:x2="http://apache.org/hello_world"
+		  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+		  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+		  targetNamespace="http://apache.org/hello_world/bindings">
+
+
+    <wsdl:import
+	namespace="http://apache.org/hello_world"
+	location="hello_world_wsdl_import.wsdl"/>
+
+    <wsdl:binding name="SOAPBinding" type="x2:Greeter">
+	<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+	<wsdl:operation name="sayHi">
+	    <soap:operation style="document"/>
+	    <wsdl:input>
+		<soap:body use="literal"/>
+	    </wsdl:input>
+	    <wsdl:output>
+		<soap:body use="literal"/>
+	    </wsdl:output>
+	</wsdl:operation>
+	<wsdl:operation name="greetMe">
+	    <soap:operation style="document"/>
+	    <wsdl:input>
+		<soap:body use="literal"/>
+	    </wsdl:input>
+	    <wsdl:output>
+		<soap:body use="literal"/>
+	    </wsdl:output>
+	</wsdl:operation>
+	<wsdl:operation name="pingMe">
+	    <soap:operation style="document"/>
+	    <wsdl:input>
+		<soap:body use="literal"/>
+	    </wsdl:input>
+	    <wsdl:output>
+		<soap:body use="literal"/>
+	    </wsdl:output>
+	    <wsdl:fault name="pingMeFault">
+		<soap:fault name="pingMeFault" use="literal"/>
+	    </wsdl:fault>
+	</wsdl:operation>
+    </wsdl:binding>
+
+</wsdl:definitions>

Propchange: incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_bindings.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_bindings.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_bindings.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_services.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_services.wsdl?view=auto&rev=489301
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_services.wsdl (added)
+++ incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_services.wsdl Thu Dec 21 01:32:30 2006
@@ -0,0 +1,40 @@
+<?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="HelloWorld"
+		  xmlns="http://schemas.xmlsoap.org/wsdl/"
+		  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"		 
+		  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+		  xmlns:tns="http://apache.org/hello_world/services"
+		  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+		  xmlns:x1="http://apache.org/hello_world/bindings"
+		  xmlns:x2="http://apache.org/hello_world"
+		  targetNamespace="http://apache.org/hello_world/services">
+
+    <wsdl:import
+        namespace="http://apache.org/hello_world/bindings"
+        location="hello_world_bindings.wsdl"/>
+
+    <wsdl:service name="SOAPService">
+	<wsdl:port name="SoapPort" binding="x1:SOAPBinding">
+	    <soap:address location="http://localhost:9000/SoapContext/SoapPort"/>
+	</wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>
+

Propchange: incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_services.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_services.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_services.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Copied: incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_wsdl_import.wsdl (from r488142, incubator/cxf/trunk/tools/wsdl2java/src/test/resources/wsdl2java_wsdl/hello_world_wsdl_import.wsdl)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_wsdl_import.wsdl?view=diff&rev=489301&p1=incubator/cxf/trunk/tools/wsdl2java/src/test/resources/wsdl2java_wsdl/hello_world_wsdl_import.wsdl&r1=488142&p2=incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_wsdl_import.wsdl&r2=489301
==============================================================================
--- incubator/cxf/trunk/tools/wsdl2java/src/test/resources/wsdl2java_wsdl/hello_world_wsdl_import.wsdl (original)
+++ incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_wsdl_import.wsdl Thu Dec 21 01:32:30 2006
@@ -28,7 +28,7 @@
 
     <wsdl:import
         namespace="http://apache.org/hello_world/messages"
-        location="./hello_world_messages.wsdl"/>
+        location="hello_world_messages.wsdl"/>
 
     <wsdl:portType name="Greeter">
         <wsdl:operation name="sayHi">

Modified: incubator/cxf/trunk/tools2/wsdlto/core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/core/pom.xml?view=diff&rev=489301&r1=489300&r2=489301
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/core/pom.xml (original)
+++ incubator/cxf/trunk/tools2/wsdlto/core/pom.xml Thu Dec 21 01:32:30 2006
@@ -144,6 +144,11 @@
 				<xsdOption>
 				    <xsd>${basedir}/src/main/resources/schemas/plugin.xsd</xsd>
 				</xsdOption>
+
+				<xsdOption>
+				    <xsd>${basedir}/src/main/resources/schemas/wsdl11/xml-binding.xsd</xsd>
+				    <bindingFile>${basedir}/src/main/resources/schemas/wsdl11/xml-binding.xjb</bindingFile>
+				</xsdOption>
 			    </xsdOptions>
 			</configuration>
 			<goals>

Modified: incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java?view=diff&rev=489301&r1=489300&r2=489301
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java (original)
+++ incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java Thu Dec 21 01:32:30 2006
@@ -95,7 +95,7 @@
                         builder.customize();
                     }
                     WSDLServiceBuilder serviceBuilder = new WSDLServiceBuilder(getBus());
-                    //services = 
+                    //services =
                     serviceBuilder.buildService(definition);
                 } else {
                     // TODO: wsdl2.0 support

Modified: incubator/cxf/trunk/tools2/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/core/PluginLoaderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/core/PluginLoaderTest.java?view=diff&rev=489301&r1=489300&r2=489301
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/core/PluginLoaderTest.java (original)
+++ incubator/cxf/trunk/tools2/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/core/PluginLoaderTest.java Thu Dec 21 01:32:30 2006
@@ -73,7 +73,6 @@
             loader.getFrontEndProfile("jaxws");
             fail("JaxWs frontend not loaded yet");
         } catch (ToolException e) {
-            System.err.println(e.getMessage());
             assertEquals(getLogMessage("FRONTEND_PROFILE_LOAD_FAIL", frontend.getPackage()
                                        + "."
                                        + frontend.getProfile()),

Modified: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/pom.xml?view=diff&rev=489301&r1=489300&r2=489301
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/pom.xml (original)
+++ incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/pom.xml Thu Dec 21 01:32:30 2006
@@ -59,6 +59,18 @@
 	    <version>${project.version}</version>
 	</dependency>
 
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-bindings-xml</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+	<dependency>
+	    <groupId>org.apache.cxf</groupId>
+	    <artifactId>cxf-rt-transports-jms</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
 	<dependency>
 	    <groupId>org.apache.cxf</groupId>
 	    <artifactId>cxf-tools2-wsdlto-core</artifactId>

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=489301&r1=489300&r2=489301
==============================================================================
--- 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 Thu Dec 21 01:32:30 2006
@@ -19,106 +19,78 @@
 
 package org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11;
 
-import java.util.ArrayList;
+
 import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+
 import java.util.logging.Logger;
 
 import javax.jws.soap.SOAPBinding;
 import javax.wsdl.Binding;
 import javax.wsdl.BindingOperation;
+
 import javax.wsdl.Definition;
-import javax.wsdl.Import;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
+import javax.wsdl.Operation;
 
-import org.xml.sax.InputSource;
+import javax.wsdl.PortType;
+import javax.wsdl.extensions.ExtensionRegistry;
 
-import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.resource.URIResolver;
 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.util.SOAPBindingUtil;
 import org.apache.cxf.tools.wsdlto.core.AbstractWSDLBuilder;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.customiztion.CustomizationParser;
-import org.apache.cxf.tools.wsdlto.frontend.jaxws.customiztion.WSDLExtensionRegister;
+import org.apache.cxf.tools.wsdlto.frontend.jaxws.customiztion.JAXWSBinding;
+import org.apache.cxf.tools.wsdlto.frontend.jaxws.customiztion.JAXWSBindingDeserializer;
+import org.apache.cxf.tools.wsdlto.frontend.jaxws.customiztion.JAXWSBindingSerializer;
 import org.apache.cxf.wsdl11.WSDLDefinitionBuilder;
-import org.apache.cxf.wsdl4jutils.WSDLResolver;
 
-public class JAXWSDefinitionBuilder extends AbstractWSDLBuilder {
+public class JAXWSDefinitionBuilder extends AbstractWSDLBuilder<Definition> {
 
-    protected static final Logger LOG = LogUtils.getL7dLogger(WSDLDefinitionBuilder.class);
-    protected WSDLFactory wsdlFactory;
-    protected WSDLReader wsdlReader;
-    protected Definition wsdlDefinition;
-    protected List<Definition> importedDefs = new ArrayList<Definition>();
+    protected static final Logger LOG = LogUtils.getL7dLogger(JAXWSDefinitionBuilder.class);
     protected CustomizationParser cusParser;
     
     public JAXWSDefinitionBuilder() {
     }
     
-    public void setContext(ToolContext arg) {
-        context = arg;
-    }
-
     public Definition build() {
         String wsdlURL = (String)context.get(ToolConstants.CFG_WSDLURL);
         return build(wsdlURL);
     }
 
     public Definition build(String wsdlURL) {
-        parseWSDL(wsdlURL);
+        WSDLDefinitionBuilder builder = new WSDLDefinitionBuilder();
+        ExtensionRegistry registry = builder.getExtenstionRegistry();
+
+        registerJaxwsExtension(registry);
+        Definition wsdlDefinition = builder.build(wsdlURL);
+
         context.put(ToolConstants.WSDL_DEFINITION, wsdlDefinition);
-        context.put(ToolConstants.IMPORTED_DEFINITION, this.importedDefs);
+        context.put(ToolConstants.IMPORTED_DEFINITION, builder.getImportedDefinitions());
+
+        checkSupported(wsdlDefinition);
+        
         return wsdlDefinition;
     }
 
-    public void customize() {
-        cusParser = CustomizationParser.getInstance();
-        cusParser.parse(context);   
+    private void registerJaxwsExtension(ExtensionRegistry registry) {
+        registerJAXWSBinding(registry, Definition.class);
+        registerJAXWSBinding(registry, PortType.class);
+        registerJAXWSBinding(registry, Operation.class);
+        registerJAXWSBinding(registry, Binding.class);
+        registerJAXWSBinding(registry, BindingOperation.class);
     }
 
-    protected void parseWSDL(String wsdlURL) {
-        try {
-            wsdlFactory = WSDLFactory.newInstance();
-            wsdlReader = wsdlFactory.newWSDLReader();
-            wsdlReader.setFeature("javax.wsdl.verbose", false);
-            // REVISIT: JAXWS/JMS/XML extensions, should be provided by the
-            // WSDLServiceBuilder
-            // Do we need to expose the wsdlReader and wsdlFactory?
-            WSDLExtensionRegister register = new WSDLExtensionRegister(wsdlFactory, wsdlReader);
-            register.registerExtensions();
-            URIResolver resolver = new URIResolver(wsdlURL);
-            InputSource insource = new InputSource(resolver.getInputStream());
-            wsdlURL = resolver.getURI().toString();
-            wsdlDefinition = wsdlReader.readWSDL(new WSDLResolver(wsdlURL, insource));
-            checkSupported(wsdlDefinition);
-            parseImports(wsdlDefinition);
-        } catch (Exception we) {
-            Message msg = new Message("FAIL_TO_CREATE_WSDL_DEFINITION", LOG, wsdlURL);
-            throw new RuntimeException(msg.toString(), we);
-        }
-    }
+    private void registerJAXWSBinding(ExtensionRegistry registry, Class clz) {
+        registry.registerSerializer(clz, ToolConstants.JAXWS_BINDINGS, new JAXWSBindingSerializer());
 
-    @SuppressWarnings("unchecked")
-    private void parseImports(Definition def) {
-        List<Import> importList = new ArrayList<Import>();
-        Map imports = def.getImports();
-        for (Iterator iter = imports.keySet().iterator(); iter.hasNext();) {
-            String uri = (String)iter.next();
-            importList.addAll((List<Import>)imports.get(uri));
-        }
-        for (Import impt : importList) {
-            parseImports(impt.getDefinition());
-            importedDefs.add(impt.getDefinition());
-        }
+        registry.registerDeserializer(clz, ToolConstants.JAXWS_BINDINGS, new JAXWSBindingDeserializer());
+        registry.mapExtensionTypes(clz, ToolConstants.JAXWS_BINDINGS, JAXWSBinding.class);
     }
 
-    public List<Definition> getImportedDefinition() {
-        return importedDefs;
+    public void customize() {
+        cusParser = CustomizationParser.getInstance();
+        cusParser.parse(context);
     }
 
     private void checkSupported(Definition def) throws ToolException {

Modified: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSProfileTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSProfileTest.java?view=diff&rev=489301&r1=489300&r2=489301
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSProfileTest.java (original)
+++ incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSProfileTest.java Thu Dec 21 01:32:30 2006
@@ -83,7 +83,6 @@
 
         Class container = profile.getContainerClass();
         assertEquals(container, JAXWSContainer.class);
-        System.err.println(profile.getToolspec());
         assertEquals("/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml", profile.getToolspec());
     }
 

Modified: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilderTest.java?view=diff&rev=489301&r1=489300&r2=489301
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilderTest.java (original)
+++ incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilderTest.java Thu Dec 21 01:32:30 2006
@@ -19,15 +19,27 @@
 
 package org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11;
 
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
 import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.extensions.http.HTTPAddress;
 import javax.xml.namespace.QName;
 
 import junit.framework.TestCase;
 
+import org.apache.cxf.bindings.xformat.XMLBindingMessageFormat;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.customiztion.CustomizationParser;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.customiztion.JAXWSBinding;
+import org.apache.cxf.transports.jms.JMSAddressPolicyType;
 
 public class JAXWSDefinitionBuilderTest extends TestCase {
     private ToolContext env;
@@ -36,12 +48,76 @@
         env = new ToolContext();
     }
 
+    public void testBuildDefinitionWithXMLBinding() {
+        String qname = "http://apache.org/hello_world_xml_http/bare";
+        String wsdlUrl = getClass().getResource("/wsdl/hello_world_xml_bare.wsdl").toString();
+
+        JAXWSDefinitionBuilder builder = new JAXWSDefinitionBuilder();
+        builder.setContext(env);
+        Definition def = builder.build(wsdlUrl);
+        assertNotNull(def);
+        
+        Map services = def.getServices();
+        assertNotNull(services);
+        assertEquals(1, services.size());
+        Service service = (Service)services.get(new QName(qname, "XMLService"));
+        assertNotNull(service);
+        
+        Map ports = service.getPorts();
+        assertNotNull(ports);
+        assertEquals(1, ports.size());
+        Port port = service.getPort("XMLPort");
+        assertNotNull(port);
+
+        assertEquals(1, port.getExtensibilityElements().size());
+        assertTrue(port.getExtensibilityElements().get(0) instanceof HTTPAddress);
+
+        Binding binding = port.getBinding();
+        assertNotNull(binding);
+        assertEquals(new QName(qname, "Greeter_XMLBinding"), binding.getQName());
+
+        BindingOperation operation = binding.getBindingOperation("sayHi", null, null);
+        assertNotNull(operation);
+
+        BindingInput input = operation.getBindingInput();
+        assertNotNull(input);
+        assertEquals(1, input.getExtensibilityElements().size());
+        assertTrue(input.getExtensibilityElements().get(0) instanceof XMLBindingMessageFormat);
+    }
+
+    public void testBuildDefinitionWithJMSTransport() {
+        String qname = "http://cxf.apache.org/hello_world_jms";
+        String wsdlUrl = getClass().getResource("/wsdl/jms_test.wsdl").toString();
+
+        JAXWSDefinitionBuilder builder = new JAXWSDefinitionBuilder();
+        builder.setContext(env);
+        Definition def = builder.build(wsdlUrl);
+        assertNotNull(def);
+        
+        Map services = def.getServices();
+        assertNotNull(services);
+        assertEquals(8, services.size());
+        Service service = (Service)services.get(new QName(qname, "HelloWorldQueueBinMsgService"));
+        assertNotNull(service);
+        
+        Map ports = service.getPorts();
+        assertNotNull(ports);
+        assertEquals(1, ports.size());
+        Port port = service.getPort("HelloWorldQueueBinMsgPort");
+        assertNotNull(port);
+
+        assertEquals(3, port.getExtensibilityElements().size());
+        assertTrue(port.getExtensibilityElements().get(0) instanceof JMSAddressPolicyType);
+    }
+
+
+
     public void testCustomization() {
         env.put(ToolConstants.CFG_WSDLURL, getClass().getResource("./hello_world.wsdl").toString());
         env.put(ToolConstants.CFG_BINDING, getClass().getResource("./binding2.xml").toString());
         JAXWSDefinitionBuilder builder = new JAXWSDefinitionBuilder();
         builder.setContext(env);
-        Definition def = builder.build((String)env.get(ToolConstants.CFG_WSDLURL));
+        Definition def = builder.build();
         builder.customize();
 
         CustomizationParser parser = builder.getCustomizationParer();



Mime
View raw message