cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r666316 - in /cxf/trunk: api/src/main/java/org/apache/cxf/databinding/ api/src/main/java/org/apache/cxf/service/model/ api/src/test/java/org/apache/cxf/service/model/ rt/core/src/main/java/org/apache/cxf/wsdl11/ rt/core/src/test/java/org/ap...
Date Tue, 10 Jun 2008 20:48:09 GMT
Author: dkulp
Date: Tue Jun 10 13:48:09 2008
New Revision: 666316

URL: http://svn.apache.org/viewvc?rev=666316&view=rev
Log:
BUNCH of work to get all of the wsdl loading/parsing/extension stuff to only be done in WSDLManagerImpl.   (First part of moving/getting rid of META-INF/extensions.xml)
Change caching of schemas to use same key as what's caching the wsdl.
That said, removed ServiceInfo from SchemaInfo since it wasn't actually used.  Thus, the memory leak may have been gone just from that.
Make sure only the stuff from the actual wsdl is cached.   Aegis tends to modify things strangely causing other problems.

Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java
    cxf/trunk/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java
    cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java
    cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceSchemaInfo.java
    cxf/trunk/api/src/test/java/org/apache/cxf/service/model/SchemaInfoTest.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilder.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java
    cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilderTest.java
    cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
    cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
    cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDL11Validator.java
    cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
    cxf/trunk/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/WSDL11ValidatorTest.java
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilderTest.java
    cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/AbstractWSDLToProcessor.java
    cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessor.java
    cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessor.java
    cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessor.java
    cxf/trunk/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessorTest.java
    cxf/trunk/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessorTest.java
    cxf/trunk/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessorTest.java
    cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/wsdl11/JAXWSDefinitionBuilderTest.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java?rev=666316&r1=666315&r2=666316&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java Tue Jun 10 13:48:09 2008
@@ -86,7 +86,7 @@
             }
             n = n.getNextSibling();
         }
-        SchemaInfo schema = new SchemaInfo(serviceInfo, ns);
+        SchemaInfo schema = new SchemaInfo(ns);
         schema.setSystemId(systemId);
         XmlSchema xmlSchema;
         synchronized (d) {

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java?rev=666316&r1=666315&r2=666316&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java Tue Jun 10 13:48:09 2008
@@ -34,7 +34,6 @@
 
 public final class SchemaInfo extends AbstractPropertiesHolder {
   
-    ServiceInfo serviceInfo;
     String namespaceUri;
     Element element;
     boolean isElementQualified;
@@ -42,12 +41,11 @@
     XmlSchema schema;
     String systemId;
     
-    public SchemaInfo(ServiceInfo serviceInfo, String namespaceUri) {
-        this(serviceInfo, namespaceUri, false, false);
+    public SchemaInfo(String namespaceUri) {
+        this(namespaceUri, false, false);
     }
-    public SchemaInfo(ServiceInfo serviceInfo, String namespaceUri,
+    public SchemaInfo(String namespaceUri,
                       boolean qElement, boolean qAttribute) {
-        this.serviceInfo = serviceInfo;
         this.namespaceUri = namespaceUri;
         this.isElementQualified = qElement;
         this.isAttributeQualified = qAttribute;
@@ -64,10 +62,6 @@
         return buffer.toString();
     }
     
-    public ServiceInfo getServiceInfo() {
-        return serviceInfo;
-    }
-
     public String getNamespaceURI() {
         return namespaceUri;
     }

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java?rev=666316&r1=666315&r2=666316&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceInfo.java Tue Jun 10 13:48:09 2008
@@ -145,7 +145,7 @@
     }
     
     public SchemaInfo addNewSchema(String namespaceURI) {
-        SchemaInfo schemaInfo = new SchemaInfo(this, namespaceURI);
+        SchemaInfo schemaInfo = new SchemaInfo(namespaceURI);
         schemaInfo.setSchema(getXmlSchemaCollection().
                                 newXmlSchemaInCollection(namespaceURI));
         schemas.add(schemaInfo);

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceSchemaInfo.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceSchemaInfo.java?rev=666316&r1=666315&r2=666316&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceSchemaInfo.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceSchemaInfo.java Tue Jun 10 13:48:09 2008
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.service.model;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.cxf.common.xmlschema.SchemaCollection;
@@ -41,7 +42,7 @@
         return schemaInfoList;
     }
     public void setSchemaInfoList(List<SchemaInfo> schemaInfoList) {
-        this.schemaInfoList = schemaInfoList;
+        this.schemaInfoList = new ArrayList<SchemaInfo>(schemaInfoList);
     }
 
 }

Modified: cxf/trunk/api/src/test/java/org/apache/cxf/service/model/SchemaInfoTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/test/java/org/apache/cxf/service/model/SchemaInfoTest.java?rev=666316&r1=666315&r2=666316&view=diff
==============================================================================
--- cxf/trunk/api/src/test/java/org/apache/cxf/service/model/SchemaInfoTest.java (original)
+++ cxf/trunk/api/src/test/java/org/apache/cxf/service/model/SchemaInfoTest.java Tue Jun 10 13:48:09 2008
@@ -29,7 +29,7 @@
     
     @Before
     public void setUp() throws Exception {
-        schemaInfo = new SchemaInfo(null, "http://apache.org/hello_world_soap_http/types");
+        schemaInfo = new SchemaInfo("http://apache.org/hello_world_soap_http/types");
     }
   
     @Test

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java?rev=666316&r1=666315&r2=666316&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java Tue Jun 10 13:48:09 2008
@@ -109,7 +109,7 @@
                         schemaCol.setSchemaResolver(schemaResolver);
                         
                         XmlSchema xmlSchema = schemaCol.read(schemaElem, systemId);
-                        SchemaInfo schemaInfo = new SchemaInfo(serviceInfo, xmlSchema.getTargetNamespace());
+                        SchemaInfo schemaInfo = new SchemaInfo(xmlSchema.getTargetNamespace());
                         schemaInfo.setElement(schemaElem);
                         schemaInfo.setSchema(xmlSchema);
                         schemaInfo.setSystemId(systemId);

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilder.java?rev=666316&r1=666315&r2=666316&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilder.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilder.java Tue Jun 10 13:48:09 2008
@@ -28,95 +28,39 @@
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
-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.extensions.mime.MIMEPart;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-import javax.xml.bind.JAXBException;
 import javax.xml.namespace.QName;
 
-import com.ibm.wsdl.extensions.soap.SOAPHeaderImpl;
-import com.ibm.wsdl.extensions.soap.SOAPHeaderSerializer;
 import org.apache.cxf.Bus;
-import org.apache.cxf.BusException;
-import org.apache.cxf.catalog.OASISCatalogManager;
+import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.PropertiesLoaderUtils;
 import org.apache.cxf.helpers.CastUtils;
-import org.apache.cxf.wsdl.JAXBExtensionHelper;
 import org.apache.cxf.wsdl.WSDLBuilder;
-import org.apache.cxf.wsdl.WSDLConstants;
 import org.apache.cxf.wsdl.WSDLExtensibilityPlugin;
+import org.apache.cxf.wsdl.WSDLManager;
 
 public class WSDLDefinitionBuilder implements WSDLBuilder<Definition> {
-
     protected static final Logger LOG = LogUtils.getL7dLogger(WSDLDefinitionBuilder.class);
-    private static final String EXTENSIONS_RESOURCE = "META-INF/extensions.xml";
     private static final String WSDL_PLUGIN_RESOURCE = "META-INF/wsdl.plugin.xml";
 
-    protected WSDLReader wsdlReader;
     protected Definition wsdlDefinition;
-    final WSDLFactory wsdlFactory;
-    final ExtensionRegistry registry;
     private List<Definition> importedDefinitions = new ArrayList<Definition>();
 
+
     private final Map<String, WSDLExtensibilityPlugin> wsdlPlugins
         = new HashMap<String, WSDLExtensibilityPlugin>();
-
     private Bus bus;
 
     public WSDLDefinitionBuilder(Bus b) {
-        this();
         this.bus = b;
     }
 
-    public WSDLDefinitionBuilder() {
-        try {
-            wsdlFactory = WSDLFactory.newInstance();
-            registry = wsdlFactory.newPopulatedExtensionRegistry();
-            QName header11 = new QName(WSDLConstants.NS_SOAP11, "header");
-            QName header12 = new QName(WSDLConstants.NS_SOAP12, "header");
-            registry.registerDeserializer(MIMEPart.class,
-                                          header11,
-                                          new SOAPHeaderSerializer());
-            registry.registerSerializer(MIMEPart.class,
-                                        header11,
-                                        new SOAPHeaderSerializer());
-            registry.mapExtensionTypes(MIMEPart.class, header11, SOAPHeaderImpl.class);
-            registry.registerDeserializer(MIMEPart.class,
-                                          header12,
-                                          new SOAPHeaderSerializer());
-            registry.registerSerializer(MIMEPart.class,
-                                        header12,
-                                        new SOAPHeaderSerializer());
-            registry.mapExtensionTypes(MIMEPart.class, header12, SOAPHeaderImpl.class);
-            
-
-            registerInitialExtensions();
-            wsdlReader = wsdlFactory.newWSDLReader();
-            wsdlReader.setExtensionRegistry(registry);
-            
-            // TODO enable the verbose if in verbose mode.
-            wsdlReader.setFeature("javax.wsdl.verbose", false);
-            wsdlReader.setFeature("javax.wsdl.importDocuments", true);
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    public WSDLDefinitionBuilder(boolean requirePlugins) {
-        this();
-        if (requirePlugins) {
-            registerWSDLExtensibilityPlugins();
-        }
-    }
-
     public void setBus(Bus b) {
         this.bus = b;
     }
@@ -129,12 +73,9 @@
     @SuppressWarnings("unchecked")
     protected void parseWSDL(String wsdlURL) {
         try {
-
-            wsdlReader.setExtensionRegistry(registry);
-
-            WSDLLocatorImpl wsdlLocator = new WSDLLocatorImpl(wsdlURL);
-            wsdlLocator.setCatalogResolver(OASISCatalogManager.getCatalogManager(bus).getCatalog());
-            wsdlDefinition = wsdlReader.readWSDL(wsdlLocator);
+            WSDLManager mgr = bus.getExtension(WSDLManager.class);
+            registerWSDLExtensibilityPlugins(mgr.getExtensionRegistry());
+            wsdlDefinition = mgr.getDefinition(wsdlURL);
 
             parseImports(wsdlDefinition);
 
@@ -181,50 +122,12 @@
         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);
-                }
-                JAXBExtensionHelper.addExtensions(registry, parentType, elementType, 
-                                                  Thread.currentThread().getContextClassLoader());
-            } 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;
-    }
-
-    public WSDLReader getWSDLReader() {
-        return wsdlReader;
-    }
 
     public Map<String, WSDLExtensibilityPlugin> getWSDLPlugins() {
         return wsdlPlugins;
     }
 
-    private void registerWSDLExtensibilityPlugins() {
+    private void registerWSDLExtensibilityPlugins(ExtensionRegistry registry) {
         Properties initialExtensions = null;
         try {
             initialExtensions = PropertiesLoaderUtils.loadAllProperties(WSDL_PLUGIN_RESOURCE, Thread
@@ -242,7 +145,8 @@
                 }
 
                 WSDLExtensibilityPlugin plugin
-                    = (WSDLExtensibilityPlugin)Class.forName(pluginClz).newInstance();
+                    = (WSDLExtensibilityPlugin)ClassLoaderUtils.loadClass(pluginClz, getClass()).
+                        newInstance();
                 plugin.setExtensionRegistry(registry);
                 wsdlPlugins.put(key, plugin);
             } catch (Exception ex) {

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java?rev=666316&r1=666315&r2=666316&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java Tue Jun 10 13:48:09 2008
@@ -20,7 +20,6 @@
 package org.apache.cxf.wsdl11;
 
 import java.io.IOException;
-import java.lang.ref.WeakReference;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -78,14 +77,9 @@
     
     /**
      * The schemaCacheMap is used as a cache of SchemaInfo against the WSDLDefinitions.
-     * Note that the value is a WeakReference of ServiceSchemaInfo - Here the ServiceSchemaInfo in turn holds
-     * the key WSDL Definition. Since the value always strongly refers to the key, we make the value also
-     * weak - so that whenever their is no external strong reference to the key, the entry will qualify for
-     * removal from the map.
-     * https://issues.apache.org/jira/browse/CXF-1621
-     *
+     * The key is the same key that is used to hold the definition object into the definitionsMap 
      */
-    final Map<Definition, WeakReference<ServiceSchemaInfo>> schemaCacheMap;
+    final Map<Object, ServiceSchemaInfo> schemaCacheMap;
     private boolean disableSchemaCache;
     
     private Bus bus;
@@ -110,7 +104,7 @@
             throw new BusException(e);
         }
         definitionsMap = new CacheMap<Object, Definition>();
-        schemaCacheMap = new CacheMap<Definition, WeakReference<ServiceSchemaInfo>>();
+        schemaCacheMap = new CacheMap<Object, ServiceSchemaInfo>();
 
         registerInitialExtensions();
     }
@@ -254,10 +248,14 @@
         if (disableSchemaCache) {
             return null;
         }
-        synchronized (schemaCacheMap) {
-            WeakReference<ServiceSchemaInfo> weakReference = schemaCacheMap.get(wsdl);
-            if (weakReference != null) {
-                return weakReference.get();
+        synchronized (definitionsMap) {
+            for (Map.Entry<Object, Definition> e : definitionsMap.entrySet()) {
+                if (e.getValue() == wsdl) {
+                    ServiceSchemaInfo info = schemaCacheMap.get(e.getKey());
+                    if (info != null) {
+                        return info;
+                    }
+                }
             }
         }
         return null;
@@ -265,11 +263,14 @@
 
     public void putSchemasForDefinition(Definition wsdl, ServiceSchemaInfo schemas) {
         if (!disableSchemaCache) {
-            synchronized (schemaCacheMap) {
-                schemaCacheMap.put(wsdl, new WeakReference<ServiceSchemaInfo>(schemas));
-            }
+            synchronized (definitionsMap) {
+                for (Map.Entry<Object, Definition> e : definitionsMap.entrySet()) {
+                    if (e.getValue() == wsdl) {
+                        schemaCacheMap.put(e.getKey(), schemas);
+                    }
+                }
+            }            
         }
-        
     }
 
     public boolean isDisableSchemaCache() {
@@ -294,11 +295,10 @@
             }
             for (Object o : keys) {
                 definitionsMap.remove(o);
+                schemaCacheMap.remove(o);
             }
         }
-        synchronized (schemaCacheMap) {
-            schemaCacheMap.remove(wsdl);
-        }
     }
+    
 
 }

Modified: cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilderTest.java?rev=666316&r1=666315&r2=666316&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilderTest.java (original)
+++ cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilderTest.java Tue Jun 10 13:48:09 2008
@@ -30,6 +30,7 @@
 import javax.wsdl.Service;
 import javax.xml.namespace.QName;
 
+import org.apache.cxf.BusFactory;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -40,7 +41,7 @@
         String qname = "http://apache.org/hello_world_soap_http";
         String wsdlUrl = getClass().getResource("hello_world.wsdl").toString();
         
-        WSDLDefinitionBuilder builder = new WSDLDefinitionBuilder();
+        WSDLDefinitionBuilder builder = new WSDLDefinitionBuilder(BusFactory.getDefaultBus());
         Definition def = builder.build(wsdlUrl);
         assertNotNull(def);
         
@@ -61,7 +62,7 @@
     public void testBuildImportedWSDL() throws Exception {
         String wsdlUrl = getClass().getResource("hello_world_services.wsdl").toString();
         
-        WSDLDefinitionBuilder builder = new WSDLDefinitionBuilder();
+        WSDLDefinitionBuilder builder = new WSDLDefinitionBuilder(BusFactory.getDefaultBus());
         Definition def = builder.build(wsdlUrl);
 
         assertNotNull(def);

Modified: cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java?rev=666316&r1=666315&r2=666316&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java (original)
+++ cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java Tue Jun 10 13:48:09 2008
@@ -254,7 +254,7 @@
             return;
         }
         
-        schemaInfo = new SchemaInfo(serviceInfo, qn.getNamespaceURI(), qualifiedSchemas, false);
+        schemaInfo = new SchemaInfo(qn.getNamespaceURI(), qualifiedSchemas, false);
         
         el = createXsElement(part, typeName, schemaInfo);
 
@@ -403,7 +403,7 @@
             schema.setNamespaceContext(nsMap);
 
             
-            schemaInfo = new SchemaInfo(serviceInfo, part.getElementQName().getNamespaceURI());
+            schemaInfo = new SchemaInfo(part.getElementQName().getNamespaceURI());
             schemaInfo.setSchema(schema);
             serviceInfo.addSchema(schemaInfo);
         } else {

Modified: cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=666316&r1=666315&r2=666316&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java (original)
+++ cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java Tue Jun 10 13:48:09 2008
@@ -1214,7 +1214,7 @@
             }
         }
 
-        SchemaInfo schemaInfo = new SchemaInfo(serviceInfo, namespaceURI);
+        SchemaInfo schemaInfo = new SchemaInfo(namespaceURI);
         SchemaCollection col = serviceInfo.getXmlSchemaCollection();
         XmlSchema schema = col.getSchemaByTargetNamespace(namespaceURI);
 

Modified: cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDL11Validator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDL11Validator.java?rev=666316&r1=666315&r2=666316&view=diff
==============================================================================
--- cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDL11Validator.java (original)
+++ cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDL11Validator.java Tue Jun 10 13:48:09 2008
@@ -42,6 +42,7 @@
 import org.xml.sax.InputSource;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
 import org.apache.cxf.catalog.OASISCatalogManager;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
@@ -64,7 +65,7 @@
     }
 
     public WSDL11Validator(final Definition definition, final ToolContext pe) {
-        this(definition, pe, null);
+        this(definition, pe, BusFactory.getDefaultBus());
     }
 
     public WSDL11Validator(final Definition definition, final ToolContext pe, final Bus b) {

Modified: cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java?rev=666316&r1=666315&r2=666316&view=diff
==============================================================================
--- cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java (original)
+++ cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java Tue Jun 10 13:48:09 2008
@@ -49,6 +49,7 @@
 import org.w3c.dom.Node;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
@@ -68,6 +69,7 @@
 import org.apache.cxf.tools.validator.internal.model.XPortType;
 import org.apache.cxf.tools.validator.internal.model.XService;
 import org.apache.cxf.wsdl.WSDLConstants;
+import org.apache.cxf.wsdl.WSDLManager;
 import org.apache.cxf.wsdl11.WSDLDefinitionBuilder;
 import org.apache.ws.commons.schema.XmlSchemaElement;
 import org.apache.ws.commons.schema.XmlSchemaType;
@@ -98,17 +100,17 @@
     }
 
     public WSDLRefValidator(final String wsdl, final Document doc) {
-        this(wsdl, doc, null);
+        this(wsdl, doc, BusFactory.getDefaultBus());
     }
 
     public WSDLRefValidator(final String wsdl, final Document doc, final Bus b) {
-        WSDLDefinitionBuilder wsdlBuilder = new WSDLDefinitionBuilder();
-        if (b != null) {
-            wsdlBuilder.setBus(b);
-        }
+        WSDLDefinitionBuilder wsdlBuilder = new WSDLDefinitionBuilder(b);
 
         try {
             this.definition = wsdlBuilder.build(wsdl);
+            WSDLManager mgr = b.getExtension(WSDLManager.class);
+            mgr.removeDefinition(this.definition);
+
             if (wsdlBuilder.getImportedDefinitions().size() > 0) {
                 importedDefinitions = new ArrayList<Definition>();
                 importedDefinitions.addAll(wsdlBuilder.getImportedDefinitions());

Modified: cxf/trunk/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/WSDL11ValidatorTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/WSDL11ValidatorTest.java?rev=666316&r1=666315&r2=666316&view=diff
==============================================================================
--- cxf/trunk/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/WSDL11ValidatorTest.java (original)
+++ cxf/trunk/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/WSDL11ValidatorTest.java Tue Jun 10 13:48:09 2008
@@ -35,7 +35,9 @@
         try {
             assertFalse(validator.isValid());
         } catch (Exception e) {
-            assertTrue(e.getMessage().indexOf("Caused by {http://apache.org/hello_world/messages}"
+            e.printStackTrace();
+            assertTrue(e.getMessage(), e.getMessage()
+                           .indexOf("Caused by {http://apache.org/hello_world/messages}"
                                               + "[portType:GreeterA][operation:sayHi] not exist.") != -1);
         }
     }

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java?rev=666316&r1=666315&r2=666316&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java (original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java Tue Jun 10 13:48:09 2008
@@ -56,6 +56,7 @@
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.customization.JAXWSBinding;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.customization.JAXWSBindingDeserializer;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.customization.JAXWSBindingSerializer;
+import org.apache.cxf.wsdl.WSDLManager;
 import org.apache.cxf.wsdl11.WSDLDefinitionBuilder;
 
 public class JAXWSDefinitionBuilder extends AbstractWSDLBuilder<Definition> {
@@ -63,8 +64,6 @@
     protected static final Logger LOG = LogUtils.getL7dLogger(JAXWSDefinitionBuilder.class);
     protected CustomizationParser cusParser;
 
-    private WSDLDefinitionBuilder builder;
-    private WSDLReader wsdlReader;
     private Definition wsdlDefinition;
 
     private List<InputSource> jaxbBindings;
@@ -72,11 +71,6 @@
     private Map<String, String> cataLogResolvedMap = new HashMap<String, String>();
 
     public JAXWSDefinitionBuilder() {
-        builder = new WSDLDefinitionBuilder();
-        ExtensionRegistry registry = builder.getExtenstionRegistry();
-        registerJaxwsExtension(registry);
-        wsdlReader = builder.getWSDLReader();
-        wsdlReader.setExtensionRegistry(registry);
     }
 
     public Definition build() {
@@ -85,8 +79,12 @@
     }
 
     public Definition build(String wsdlURL) {
-        this.builder.setBus(this.bus);
+        WSDLManager mgr = bus.getExtension(WSDLManager.class);
+        registerJaxwsExtension(mgr.getExtensionRegistry());
+        
+        WSDLDefinitionBuilder builder = new WSDLDefinitionBuilder(this.bus);
         wsdlDefinition = builder.build(wsdlURL);
+        mgr.removeDefinition(wsdlDefinition);
         context.put(Bus.class, bus);
         context.put(ToolConstants.IMPORTED_DEFINITION, builder.getImportedDefinitions());
         checkSupported(wsdlDefinition);
@@ -175,7 +173,13 @@
         String wsdlUrl = URIParserUtil.getAbsoluteURI((String)context.get(ToolConstants.CFG_WSDLURL));
         CustomizedWSDLLocator wsdlLocator = new CustomizedWSDLLocator(wsdlUrl, eleMap);
         wsdlLocator.setCatalogResolver(OASISCatalogManager.getCatalogManager(bus).getCatalog());
-        Definition def = wsdlReader.readWSDL(wsdlLocator);
+        
+        WSDLManager mgr = bus.getExtension(WSDLManager.class);
+        WSDLReader reader = mgr.getWSDLFactory().newWSDLReader();
+        reader.setFeature("javax.wsdl.verbose", false);
+        reader.setExtensionRegistry(mgr.getExtensionRegistry());       
+
+        Definition def = reader.readWSDL(wsdlLocator);
         cataLogResolvedMap.putAll(wsdlLocator.getResolvedMap());
         return def;
 
@@ -189,16 +193,13 @@
 
         return this.wsdlDefinition;
     }
-    public WSDLReader getWSDLReader() {
-        return wsdlReader;
-    }
+
 
 
     public boolean validate(final Definition def) throws ToolException {
         return new WSDL11Validator(def, context, bus).isValid();
     }
     
-    
     public Map<String, String> getCataLogResolvedMap() {
         return this.cataLogResolvedMap;
     }

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilderTest.java?rev=666316&r1=666315&r2=666316&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilderTest.java (original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilderTest.java Tue Jun 10 13:48:09 2008
@@ -28,6 +28,7 @@
 import javax.wsdl.extensions.ExtensibilityElement;
 import javax.xml.namespace.QName;
 
+import org.apache.cxf.BusFactory;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.customization.JAXWSBinding;
@@ -49,6 +50,7 @@
         env.put(ToolConstants.CFG_BINDING, getClass().getResource("resources/binding2.xml").toString());
         JAXWSDefinitionBuilder builder = new JAXWSDefinitionBuilder();
         builder.setContext(env);
+        builder.setBus(BusFactory.getDefaultBus());
         builder.build();
         builder.customize();
 
@@ -95,6 +97,7 @@
         env.put(ToolConstants.CFG_BINDING, getClass().getResource("resources/binding3.xml").toString());
         JAXWSDefinitionBuilder builder = new JAXWSDefinitionBuilder();
         builder.setContext(env);
+        builder.setBus(BusFactory.getDefaultBus());
         builder.build();
         builder.customize();
 
@@ -147,6 +150,7 @@
 
         JAXWSDefinitionBuilder builder = new JAXWSDefinitionBuilder();
         builder.setContext(env);
+        builder.setBus(BusFactory.getDefaultBus());
         builder.build();
 
         // this call will fail before CXF-556
@@ -161,6 +165,7 @@
 
         JAXWSDefinitionBuilder builder = new JAXWSDefinitionBuilder();
         builder.setContext(env);
+        builder.setBus(BusFactory.getDefaultBus());
         builder.build();
 
         Definition def = builder.getWSDLModel();

Modified: cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/AbstractWSDLToProcessor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/AbstractWSDLToProcessor.java?rev=666316&r1=666315&r2=666316&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/AbstractWSDLToProcessor.java (original)
+++ cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/AbstractWSDLToProcessor.java Tue Jun 10 13:48:09 2008
@@ -21,19 +21,17 @@
 
 import java.io.IOException;
 import java.io.Writer;
-import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
-import java.util.logging.Level;
 import java.util.logging.Logger;
 import javax.wsdl.Definition;
-import javax.wsdl.extensions.schema.Schema;
+import javax.wsdl.extensions.ExtensionRegistry;
 import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
 
 import org.xml.sax.SAXParseException;
 
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.tools.common.Processor;
@@ -44,6 +42,7 @@
 import org.apache.cxf.tools.util.FileWriterUtil;
 import org.apache.cxf.tools.validator.internal.WSDL11Validator;
 import org.apache.cxf.wsdl.WSDLExtensibilityPlugin;
+import org.apache.cxf.wsdl.WSDLManager;
 import org.apache.cxf.wsdl11.WSDLDefinitionBuilder;
 
 public class AbstractWSDLToProcessor implements Processor, com.sun.tools.xjc.api.ErrorListener {
@@ -53,14 +52,14 @@
     protected Definition wsdlDefinition;
     protected ToolContext env;
     protected WSDLFactory wsdlFactory;
-    protected WSDLReader wsdlReader;
+    protected ExtensionRegistry extReg;
 
 
     protected ClassCollector classColletor;
-    List<Schema> schemaList = new ArrayList<Schema>();
-    
-    private final Map<String, WSDLExtensibilityPlugin> wsdlPlugins
+    private Map<String, WSDLExtensibilityPlugin> wsdlPlugins
         = new HashMap<String, WSDLExtensibilityPlugin>();
+    
+
 
     protected Writer getOutputWriter(String newNameExt) throws ToolException {
         Writer writer = null;
@@ -109,16 +108,22 @@
 
 
     protected void parseWSDL(String wsdlURL) throws ToolException {
-        WSDLDefinitionBuilder builder = new WSDLDefinitionBuilder(true);
+        Bus bus = env.get(Bus.class);
+        if (bus == null) {
+            bus = BusFactory.getDefaultBus();
+            env.put(Bus.class, bus);
+        }
+        WSDLDefinitionBuilder builder = new WSDLDefinitionBuilder(bus);
         wsdlDefinition = builder.build(wsdlURL);
-
-        wsdlReader = builder.getWSDLReader();
-        wsdlFactory = builder.getWSDLFactory();
+        WSDLManager mgr = bus.getExtension(WSDLManager.class);
+        mgr.removeDefinition(wsdlDefinition);
         
-        wsdlPlugins.putAll(builder.getWSDLPlugins());
-        LOG.log(Level.INFO, "FOUND_WSDL_PLUGINS", wsdlPlugins.keySet());
+        wsdlFactory = mgr.getWSDLFactory();
+        extReg = mgr.getExtensionRegistry();
+        wsdlPlugins = builder.getWSDLPlugins();
     }
 
+    
     public WSDLExtensibilityPlugin getWSDLPlugin(final String key, final Class clz) {
         StringBuffer sb = new StringBuffer();
         sb.append(key);
@@ -130,6 +135,7 @@
         }
         return plugin;
     }
+    
 
     protected void init() throws ToolException {
 

Modified: cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessor.java?rev=666316&r1=666315&r2=666316&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessor.java (original)
+++ cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessor.java Tue Jun 10 13:48:09 2008
@@ -28,7 +28,6 @@
 import javax.wsdl.Service;
 import javax.wsdl.WSDLException;
 import javax.wsdl.extensions.ExtensibilityElement;
-import javax.wsdl.extensions.ExtensionRegistry;
 import javax.wsdl.xml.WSDLWriter;
 import javax.xml.namespace.QName;
 
@@ -154,10 +153,6 @@
     }
 
     private void setAddrElement() throws ToolException {
-        ExtensionRegistry extReg = this.wsdlReader.getExtensionRegistry();
-        if (extReg == null) {
-            extReg = wsdlFactory.newPopulatedExtensionRegistry();
-        }
         String transport = (String)env.get(ToolConstants.CFG_TRANSPORT);
         Address address = AddressFactory.getInstance().getAddresser(transport);
 

Modified: cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessor.java?rev=666316&r1=666315&r2=666316&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessor.java (original)
+++ cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessor.java Tue Jun 10 13:48:09 2008
@@ -37,7 +37,6 @@
 import javax.wsdl.Part;
 import javax.wsdl.PortType;
 import javax.wsdl.WSDLException;
-import javax.wsdl.extensions.ExtensionRegistry;
 import javax.wsdl.xml.WSDLWriter;
 import javax.xml.namespace.QName;
 
@@ -56,8 +55,6 @@
 
     private static final String NEW_FILE_NAME_MODIFIER = "-soapbinding";
 
-    private ExtensionRegistry extReg;
-
     private Map portTypes;
     private PortType portType;
     private Binding binding;
@@ -65,7 +62,6 @@
     public void process() throws ToolException {
         init();
         validate();
-        extReg = this.wsdlReader.getExtensionRegistry();
         doAppendBinding();
     }
 

Modified: cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessor.java?rev=666316&r1=666315&r2=666316&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessor.java (original)
+++ cxf/trunk/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessor.java Tue Jun 10 13:48:09 2008
@@ -37,7 +37,6 @@
 import javax.wsdl.Service;
 import javax.wsdl.WSDLException;
 import javax.wsdl.extensions.ExtensibilityElement;
-import javax.wsdl.extensions.ExtensionRegistry;
 import javax.wsdl.xml.WSDLWriter;
 import javax.xml.namespace.QName;
 
@@ -53,8 +52,6 @@
 
     private static final String NEW_FILE_NAME_MODIFIER = "-xmlbinding";
 
-    private ExtensionRegistry extReg;
-
     private Map services;
     private Service service;
     private Map ports;
@@ -78,7 +75,6 @@
             Message msg = new Message("SERVICE_PORT_EXIST", LOG);
             throw new ToolException(msg);
         }
-        extReg = this.wsdlReader.getExtensionRegistry();
         doAppendBinding();
         doAppendService();
         writeToWSDL();
@@ -262,11 +258,6 @@
     }
 
     private void setAddrElement() throws ToolException {
-        extReg = this.wsdlReader.getExtensionRegistry();
-        if (extReg == null) {
-            extReg = wsdlFactory.newPopulatedExtensionRegistry();
-        }
-
         Address address = AddressFactory.getInstance().getAddresser("xml");
 
         for (String key : address.getNamespaces(env).keySet()) {

Modified: cxf/trunk/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessorTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessorTest.java?rev=666316&r1=666315&r2=666316&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessorTest.java (original)
+++ cxf/trunk/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessorTest.java Tue Jun 10 13:48:09 2008
@@ -27,6 +27,8 @@
 import javax.wsdl.extensions.soap12.SOAP12Address;
 import javax.xml.namespace.QName;
 
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
 import org.apache.cxf.tools.common.ProcessorTestBase;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolException;
@@ -42,6 +44,7 @@
     public void setUp() throws Exception {
         super.setUp();
         env.put(ToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
+        env.put(Bus.class, BusFactory.getDefaultBus());
     }
 
     @Test

Modified: cxf/trunk/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessorTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessorTest.java?rev=666316&r1=666315&r2=666316&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessorTest.java (original)
+++ cxf/trunk/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessorTest.java Tue Jun 10 13:48:09 2008
@@ -34,6 +34,8 @@
 import javax.wsdl.extensions.soap12.SOAP12Operation;
 import javax.xml.namespace.QName;
 
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
 import org.apache.cxf.tools.common.ProcessorTestBase;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolException;
@@ -54,6 +56,7 @@
     public void setUp() throws Exception {
         super.setUp();
         env.put(ToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
+        env.put(Bus.class, BusFactory.getDefaultBus());
     }
 
     @Test

Modified: cxf/trunk/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessorTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessorTest.java?rev=666316&r1=666315&r2=666316&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessorTest.java (original)
+++ cxf/trunk/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessorTest.java Tue Jun 10 13:48:09 2008
@@ -28,11 +28,12 @@
 import javax.wsdl.extensions.http.HTTPAddress;
 import javax.xml.namespace.QName;
 
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
 import org.apache.cxf.bindings.xformat.XMLBindingMessageFormat;
 import org.apache.cxf.bindings.xformat.XMLFormatBinding;
 import org.apache.cxf.tools.common.ProcessorTestBase;
 import org.apache.cxf.tools.common.ToolConstants;
-import org.apache.cxf.tools.common.ToolException;
 import org.apache.cxf.tools.misc.WSDLToXML;
 import org.junit.Before;
 import org.junit.Test;
@@ -44,6 +45,7 @@
     public void setUp() throws Exception {
         super.setUp();
         env.put(ToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
+        env.put(Bus.class, BusFactory.getDefaultBus());
     }
 
     @Test
@@ -59,70 +61,66 @@
         processor.setEnvironment(env);
 
 
-        try {
-            processor.parseWSDL(outputFile.getAbsolutePath());
-            Binding binding = processor.getWSDLDefinition().getBinding(
-                                                                       new QName(processor
-                                                                           .getWSDLDefinition()
-                                                                           .getTargetNamespace(),
-                                                                                 "Greeter_XMLBinding"));
-            if (binding == null) {
-                fail("Element wsdl:binding Greeter_XMLBinding Missed!");
-            }
-            Iterator it = binding.getExtensibilityElements().iterator();
-            boolean found = false;
-            while (it.hasNext()) {
-                Object obj = it.next();
-                if (obj instanceof XMLFormatBinding) {
-                    found = true;
-                    break;
-                }
-            }
-            if (!found) {
-                fail("Element <xformat:binding/> Missed!");
+        processor.parseWSDL(outputFile.getAbsolutePath());
+        Binding binding = processor.getWSDLDefinition().getBinding(
+                                                                   new QName(processor
+                                                                       .getWSDLDefinition()
+                                                                       .getTargetNamespace(),
+                                                                             "Greeter_XMLBinding"));
+        if (binding == null) {
+            fail("Element wsdl:binding Greeter_XMLBinding Missed!");
+        }
+        Iterator it = binding.getExtensibilityElements().iterator();
+        boolean found = false;
+        while (it.hasNext()) {
+            Object obj = it.next();
+            if (obj instanceof XMLFormatBinding) {
+                found = true;
+                break;
             }
-            BindingOperation bo = binding.getBindingOperation("sayHi", null, null);
-            if (bo == null) {
-                fail("Element <wsdl:operation name=\"sayHi\"> Missed!");
+        }
+        if (!found) {
+            fail("Element <xformat:binding/> Missed!");
+        }
+        BindingOperation bo = binding.getBindingOperation("sayHi", null, null);
+        if (bo == null) {
+            fail("Element <wsdl:operation name=\"sayHi\"> Missed!");
+        }
+        it = bo.getBindingInput().getExtensibilityElements().iterator();
+        found = false;
+        while (it.hasNext()) {
+            Object obj = it.next();
+            if (obj instanceof XMLBindingMessageFormat
+                && ((XMLBindingMessageFormat)obj).getRootNode().getLocalPart().equals("sayHi")) {
+                found = true;
+                break;
             }
-            it = bo.getBindingInput().getExtensibilityElements().iterator();
-            found = false;
-            while (it.hasNext()) {
-                Object obj = it.next();
-                if (obj instanceof XMLBindingMessageFormat
-                    && ((XMLBindingMessageFormat)obj).getRootNode().getLocalPart().equals("sayHi")) {
+        }
+        if (!found) {
+            fail("Element <xformat:body rootNode=\"tns:sayHi\" /> Missed!");
+        }
+        Service service = processor.getWSDLDefinition().getService(
+                                                                   new QName(processor
+                                                                       .getWSDLDefinition()
+                                                                       .getTargetNamespace(),
+                                                                             "Greeter_XMLService"));
+        if (service == null) {
+            fail("Element wsdl:service Greeter_XMLService Missed!");
+        }
+        it = service.getPort("Greeter_XMLPort").getExtensibilityElements().iterator();
+        found = false;
+        while (it.hasNext()) {
+            Object obj = it.next();
+            if (obj instanceof HTTPAddress) {
+                HTTPAddress xmlHttpAddress = (HTTPAddress)obj;
+                if (xmlHttpAddress.getLocationURI() != null) {
                     found = true;
                     break;
                 }
             }
-            if (!found) {
-                fail("Element <xformat:body rootNode=\"tns:sayHi\" /> Missed!");
-            }
-            Service service = processor.getWSDLDefinition().getService(
-                                                                       new QName(processor
-                                                                           .getWSDLDefinition()
-                                                                           .getTargetNamespace(),
-                                                                                 "Greeter_XMLService"));
-            if (service == null) {
-                fail("Element wsdl:service Greeter_XMLService Missed!");
-            }
-            it = service.getPort("Greeter_XMLPort").getExtensibilityElements().iterator();
-            found = false;
-            while (it.hasNext()) {
-                Object obj = it.next();
-                if (obj instanceof HTTPAddress) {
-                    HTTPAddress xmlHttpAddress = (HTTPAddress)obj;
-                    if (xmlHttpAddress.getLocationURI() != null) {
-                        found = true;
-                        break;
-                    }
-                }
-            }
-            if (!found) {
-                fail("Element http:address of service port Missed!");
-            }
-        } catch (ToolException e) {
-            fail("Exception Encountered when parsing wsdl, error: " + e.getMessage());
+        }
+        if (!found) {
+            fail("Element http:address of service port Missed!");
         }
     }
 }

Modified: cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/wsdl11/JAXWSDefinitionBuilderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/wsdl11/JAXWSDefinitionBuilderTest.java?rev=666316&r1=666315&r2=666316&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/wsdl11/JAXWSDefinitionBuilderTest.java (original)
+++ cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/wsdl11/JAXWSDefinitionBuilderTest.java Tue Jun 10 13:48:09 2008
@@ -29,6 +29,7 @@
 import javax.wsdl.extensions.http.HTTPAddress;
 import javax.xml.namespace.QName;
 
+import org.apache.cxf.BusFactory;
 import org.apache.cxf.bindings.xformat.XMLBindingMessageFormat;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder;
@@ -52,6 +53,7 @@
         String wsdlUrl = getClass().getResource("resources/hello_world_xml_bare.wsdl").toString();
 
         JAXWSDefinitionBuilder builder = new JAXWSDefinitionBuilder();
+        builder.setBus(BusFactory.getDefaultBus());
         builder.setContext(env);
         Definition def = builder.build(wsdlUrl);
         assertNotNull(def);
@@ -90,6 +92,7 @@
         String wsdlUrl = getClass().getResource("resources/jms_test.wsdl").toString();
 
         JAXWSDefinitionBuilder builder = new JAXWSDefinitionBuilder();
+        builder.setBus(BusFactory.getDefaultBus());
         builder.setContext(env);
         Definition def = builder.build(wsdlUrl);
         assertNotNull(def);



Mime
View raw message