cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan Diephouse" <...@envoisolutions.com>
Subject Re: svn commit: r504471 - in /incubator/cxf/trunk: rt/core/src/main/java/org/apache/cxf/wsdl11/ tools2/common/src/main/java/org/apache/cxf/tools/common/ tools2/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/ tools2
Date Thu, 08 Feb 2007 05:33:23 GMT
Hiya,

I don't think this commit is right at all. First, you can't use a
Map<string, Element> with the targetNamespace as the key. You can have many
schemas with the same targetNamespace, so that isn't allowed. Second, this
code has caused an infinite loop on my machine at line 280. You need to
check to make sure you haven't already added an existing schema. Third, this
info should be in the SchemaInfo model, not in a Map in the service model
properties. If you're going to look at the imported Schema elements,
construct a new SchemaInfo object for each one. Fourth, this makes
WSDLServiceBuilder not thread safe, which is clearly a departure from the
current implementation.

I think what we should be doing instead is
1. Add a SystemId property to the SchemaInfo which contains the URI of the
schema element or in the case of the WSDL, the systemId = WSDL_URI +
"#types" + schemaNumber.
2. Loop through the imported schemas, checking for duplicates, and then
create a new SchemaInfo for each import

The one problem we will have is that XmlSchema will try to handle imports
itself - but we already have the imported schemas via SchemaImports. For now
we'll just have to create SchemaInfos for the imported Schemas without an
XmlSchema object I think. I will work on a resolution in the XmlSchema
source soon...

- Dan

On 2/7/07, ema@apache.org <ema@apache.org> wrote:
>
> Author: ema
> Date: Wed Feb  7 01:11:48 2007
> New Revision: 504471
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=504471
> Log:
> Added getSchemaElmentList method in WSDLServiceBuilder to get the schema
> element from jar file or classpath
> (After XMLSchema fixed getSchemaElment issue , this method will be
> removed)
>
> [CXF-313]Ported more testcase for new wsdl2java tools
>
> Modified:
>
>     incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
>
>     incubator/cxf/trunk/tools2/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java
>
>     incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
>
>     incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/CustomizationParser.java
>
>     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/wsdl11/JAXWSDefinitionBuilderTest.java
>
>     incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/binding2.xml
>
>     incubator/cxf/trunk/tools2/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
>
>     incubator/cxf/trunk/tools2/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenOptionTest.java
>
>     incubator/cxf/trunk/tools2/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
>
>     incubator/cxf/trunk/tools2/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/validator/ValidatorTest.java
>
> Modified:
> incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
> URL:
> http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java?view=diff&rev=504471&r1=504470&r2=504471
>
> ==============================================================================
> ---
> incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
> (original)
> +++
> incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
> Wed Feb  7 01:11:48 2007
> @@ -21,6 +21,8 @@
>
> import java.util.ArrayList;
> import java.util.Collection;
> +import java.util.HashMap;
> +import java.util.Iterator;
> import java.util.List;
> import java.util.Map;
> import java.util.logging.Logger;
> @@ -43,8 +45,11 @@
> import javax.wsdl.extensions.ExtensibilityElement;
> import javax.wsdl.extensions.UnknownExtensibilityElement;
> import javax.wsdl.extensions.schema.Schema;
> +import javax.wsdl.extensions.schema.SchemaImport;
> import javax.xml.namespace.QName;
>
> +import org.w3c.dom.Element;
> +
> import com.ibm.wsdl.extensions.soap.SOAPBindingImpl;
>
> import org.apache.cxf.Bus;
> @@ -86,13 +91,15 @@
>      public static final String WSDL_PORTTYPE =
> WSDLServiceBuilder.class.getName() + ".WSDL_PORTTYPE";
>      public static final String WSDL_PORT =
> WSDLServiceBuilder.class.getName() + ".PORT";
>      public static final String WSDL_BINDING =
> WSDLServiceBuilder.class.getName() + ".BINDING";
> -
> +    public static final String WSDL_SHEMA_ELEMENT_LIST =
> WSDLServiceBuilder.class.getName()
> +                                                         +
> ".SCHEMA_ELEMENTS";
>      public static final String WSDL_OPERATION =
> WSDLServiceBuilder.class.getName() + ".OPERATION";
>      public static final String WSDL_BINDING_OPERATION =
> WSDLServiceBuilder.class.getName()
>                                                          +
> ".BINDING_OPERATION";
>
>      private static final Logger LOG = Logger.getLogger(
> WSDLServiceBuilder.class.getName());
>      private Bus bus;
> +    private Map<String, Element> schemaList = new HashMap<String,
> Element>();
>
>      public WSDLServiceBuilder(Bus bus) {
>          this.bus = bus;
> @@ -105,17 +112,17 @@
>              }
>          }
>      }
> -
> +
>      @SuppressWarnings("unchecked")
>      public List<ServiceInfo> buildService(Definition d) {
>          DescriptionInfo description = new DescriptionInfo();
>          description.setProperty(WSDL_DEFINITION, d);
>          description.setName(d.getQName());
>          copyExtensors(description, d.getExtensibilityElements());
> -
> +
>          List<ServiceInfo> serviceList = new ArrayList<ServiceInfo>();
>          for (java.util.Iterator<QName> ite = d.getServices().keySet().iterator();
> ite.hasNext();) {
> -            QName qn = ite.next();
> +            QName qn = ite.next();
>              serviceList.add(buildService(d, qn, description));
>          }
>          return serviceList;
> @@ -149,6 +156,7 @@
>          service.setProperty(WSDL_SERVICE, serv);
>
>          XmlSchemaCollection schemas = getSchemas(def, service);
> +        service.setProperty(WSDL_SHEMA_ELEMENT_LIST, this.schemaList);
>          service.setProperty(WSDL_SCHEMA_LIST, schemas);
>          service.setTargetNamespace(def.getTargetNamespace());
>          service.setName(serv.getQName());
> @@ -180,13 +188,18 @@
>      private XmlSchemaCollection getSchemas(Definition def, ServiceInfo
> serviceInfo) {
>          XmlSchemaCollection schemaCol = new XmlSchemaCollection();
>          serviceInfo.setXmlSchemaCollection(schemaCol);
> -
> +
>          List<Definition> defList = new ArrayList<Definition>();
>          parseImports(def, defList);
>          extractSchema(def, schemaCol, serviceInfo);
> +        // added
> +        getSchemaList(def);
>          for (Definition def2 : defList) {
>              extractSchema(def2, schemaCol, serviceInfo);
> +            // added
> +            getSchemaList(def2);
>          }
> +
>          return schemaCol;
>      }
>
> @@ -222,13 +235,13 @@
>                          String ns =
> (String)def.getNamespaces().get(prefix);
>                          if (!"".equals(prefix) &&
> !schemaElem.hasAttribute("xmlns:" + prefix)) {
>                              schemaElem.setAttributeNS(
> javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI,
> -                                "xmlns:" + prefix, ns);
> +                                                      "xmlns:" + prefix,
> ns);
>                          }
>                      }
>                      schemaCol.setBaseUri(def.getDocumentBaseURI());
>                      schemaCol.setSchemaResolver(new
> XmlSchemaURIResolver());
>                      XmlSchema xmlSchema = schemaCol.read(schemaElem);
> -
> +
>                      SchemaInfo schemaInfo = new SchemaInfo(serviceInfo,
> xmlSchema.getTargetNamespace());
>                      schemaInfo.setElement(schemaElem);
>                      schemaInfo.setSchema(xmlSchema);
> @@ -236,21 +249,73 @@
>                  }
>              }
>          }
> +    }
>
> +    // Workaround for getting the elements
> +    private void getSchemaList(Definition def) {
> +        Types typesElement = def.getTypes();
> +        if (typesElement != null) {
> +            Iterator ite = typesElement.getExtensibilityElements
> ().iterator();
> +            while (ite.hasNext()) {
> +                Object obj = ite.next();
> +                if (obj instanceof Schema) {
> +                    Schema schema = (Schema)obj;
> +                    addSchema(schema);
> +                }
> +            }
> +        }
> +    }
> +
> +    @SuppressWarnings("unchecked")
> +    private void addSchema(Schema schema) {
> +        Map<String, List> imports = schema.getImports();
> +        if (imports != null && imports.size() > 0) {
> +            Collection<String> importKeys = imports.keySet();
> +            for (String importNamespace : importKeys) {
> +                if (!isSchemaParsed(schema.getDocumentBaseURI(),
> importNamespace)) {
> +                    List<SchemaImport> schemaImports = imports.get
> (importNamespace);
> +                    for (SchemaImport schemaImport : schemaImports) {
> +                        Schema tempImport =
> schemaImport.getReferencedSchema();
> +                        if (tempImport != null) {
> +                            addSchema(tempImport);
> +                        }
> +                    }
> +                }
> +            }
> +        }
> +        if (schemaList.get(schema.getDocumentBaseURI()) == null) {
> +            schemaList.put(schema.getDocumentBaseURI(), schema.getElement
> ());
> +        } else {
> +            String tns = schema.getDocumentBaseURI() + "#"
> +                         + schema.getElement
> ().getAttribute("targetNamespace");
> +            if (schemaList.get(tns) == null) {
> +                schemaList.put(tns, schema.getElement());
> +            }
> +        }
> +    }
> +
> +    private boolean isSchemaParsed(String baseUri, String ns) {
> +        if (schemaList.get(baseUri) != null) {
> +            Element ele = schemaList.get(baseUri);
> +            String tns = ele.getAttribute("targetNamespace");
> +            if (ns.equals(tns)) {
> +                return true;
> +            }
> +        }
> +        return false;
>      }
>
>      public EndpointInfo buildEndpoint(ServiceInfo service, BindingInfo
> bi, Port port) {
>          List elements = port.getExtensibilityElements();
>          String ns = null;
>          if (null != elements && elements.size() > 0) {
> -            ns = ((ExtensibilityElement)elements.get(0)).getElementType()
> -                        .getNamespaceURI();
> -        } else { // get the transport id from bindingInfo
> -            ExtensibilityElement extElem =
> (ExtensibilityElement)port.getBinding().
>
> -                                            getExtensibilityElements().get(0);
> +            ns =
> ((ExtensibilityElement)elements.get(0)).getElementType().getNamespaceURI();
> +        } else { // get the transport id from bindingInfo
> +            ExtensibilityElement extElem =
> (ExtensibilityElement)port.getBinding().getExtensibilityElements()
> +                .get(0);
>              if (extElem instanceof SOAPBindingImpl) {
> -                ns =
> (String)((SOAPBindingImpl)extElem).getTransportURI();
> -            }
> +                ns =
> (String)((SOAPBindingImpl)extElem).getTransportURI();
> +            }
>          }
>          EndpointInfo ei = null;
>
> @@ -320,8 +385,7 @@
>                          handleHeader(bop2.getOutput());
>                      }
>                      for (BindingFault f : cast(bop.getBindingFaults().values(),
> BindingFault.class)) {
> -                        copyExtensors(bop2.getFault(new QName(
> service.getTargetNamespace(),
> -                                                              f.getName
> ())),
> +                        copyExtensors(bop2.getFault(new QName(
> service.getTargetNamespace(), f.getName())),
>                                        bop.getBindingFault(f.getName
> ()).getExtensibilityElements());
>                      }
>                  }
> @@ -340,18 +404,18 @@
>
>      private void handleHeader(BindingMessageInfo bindingMessageInfo) {
>          // mark all message part which should be in header
> -        List<ExtensibilityElement> extensiblilityElement =
> -            bindingMessageInfo.getExtensors(ExtensibilityElement.class);
> +        List<ExtensibilityElement> extensiblilityElement =
> bindingMessageInfo
> +            .getExtensors(ExtensibilityElement.class);
>          // for non-soap binding, the extensiblilityElement could be null
>          if (extensiblilityElement == null) {
>              return;
>          }
> -//        for (ExtensibilityElement element : extensiblilityElement) {
> -//            LOG.info("the extensibility is " + element.getClass
> ().getName());
> -//            if (element instanceof SOAPHeader) {
> -//                LOG.info("the header is " +
> ((SOAPHeader)element).getPart());
> -//            }
> -//        }
> +        // for (ExtensibilityElement element : extensiblilityElement) {
> +        // LOG.info("the extensibility is " + element.getClass
> ().getName());
> +        // if (element instanceof SOAPHeader) {
> +        // LOG.info("the header is " + ((SOAPHeader)element).getPart());
> +        // }
> +        // }
>      }
>
>      public void buildInterface(ServiceInfo si, PortType p) {
> @@ -403,7 +467,7 @@
>      private void checkForWrapped(OperationInfo opInfo) {
>          MessageInfo inputMessage = opInfo.getInput();
>          MessageInfo outputMessage = opInfo.getOutput();
> -
> +
>          boolean passedRule = true;
>          // RULE No.1:
>          // The operation's input and output message (if present) each
> contain
> @@ -413,7 +477,7 @@
>              || (outputMessage != null && outputMessage.size() > 1)) {
>              passedRule = false;
>          }
> -
> +
>          if (!passedRule) {
>              return;
>          }
> @@ -433,12 +497,11 @@
>          } else {
>              QName inputElementName = inputPart.getElementQName();
>              inputEl = schemas.getElementByQName(inputElementName);
> -            if (inputEl == null
> -                || !opInfo.getName().getLocalPart().equals(
> inputElementName.getLocalPart())) {
> +            if (inputEl == null ||
> !opInfo.getName().getLocalPart().equals(inputElementName.getLocalPart()))
> {
>                  passedRule = false;
>              }
>          }
> -
> +
>          if (!passedRule) {
>              return;
>          }
> @@ -457,7 +520,7 @@
>                  }
>              }
>          }
> -
> +
>          if (!passedRule) {
>              return;
>          }
> @@ -473,34 +536,32 @@
>          XmlSchemaComplexType xsct = null;
>          if (inputEl.getSchemaType() instanceof XmlSchemaComplexType) {
>              xsct = (XmlSchemaComplexType)inputEl.getSchemaType();
> -            if (hasAttributes(xsct) || !isWrappableSequence(xsct,
> -
> inputEl.getQName().getNamespaceURI(),
> -                                                            unwrappedInput))
> {
> +            if (hasAttributes(xsct)
> +                || !isWrappableSequence(xsct, inputEl.getQName().getNamespaceURI(),
> unwrappedInput)) {
>                  passedRule = false;
>              }
>          } else {
>              passedRule = false;
>          }
> -
> +
>          if (!passedRule) {
>              return;
>          }
> -
> +
>          if (outputMessage != null) {
>              unwrappedOutput = new MessageInfo(opInfo,
> outputMessage.getName());
>
>              if (outputEl != null && outputEl.getSchemaType() instanceof
> XmlSchemaComplexType) {
>                  xsct = (XmlSchemaComplexType)outputEl.getSchemaType();
> -                if (hasAttributes(xsct) || !isWrappableSequence(xsct,
> -
> outputEl.getQName().getNamespaceURI(),
> -                                                                unwrappedOutput))
> {
> +                if (hasAttributes(xsct)
> +                    || !isWrappableSequence(xsct, outputEl.getQName().getNamespaceURI(),
> unwrappedOutput)) {
>                      passedRule = false;
>                  }
>              } else {
>                  passedRule = false;
>              }
>          }
> -
> +
>          if (!passedRule) {
>              return;
>          }
> @@ -523,9 +584,7 @@
>          return false;
>      }
>
> -    private boolean isWrappableSequence(XmlSchemaComplexType type,
> -                                        String namespaceURI,
> -                                        MessageInfo wrapper) {
> +    private boolean isWrappableSequence(XmlSchemaComplexType type, String
> namespaceURI, MessageInfo wrapper) {
>          if (type.getParticle() instanceof XmlSchemaSequence) {
>              XmlSchemaSequence seq =
> (XmlSchemaSequence)type.getParticle();
>              XmlSchemaObjectCollection items = seq.getItems();
> @@ -547,8 +606,7 @@
>                      mpi.setXmlSchema(el);
>                  } else {
>                      // anonymous type
> -                    MessagePartInfo mpi = wrapper.addMessagePart(
> -                        new QName(namespaceURI, el.getName()));
> +                    MessagePartInfo mpi = wrapper.addMessagePart(new
> QName(namespaceURI, el.getName()));
>                      mpi.setElementQName(mpi.getName());
>                      mpi.setElement(true);
>                      mpi.setXmlSchema(el);
> @@ -565,11 +623,11 @@
>      private void buildMessage(AbstractMessageContainer minfo, Message
> msg, List paramOrder) {
>          XmlSchemaCollection schemas =
> (XmlSchemaCollection)minfo.getOperation().getInterface().getService()
>              .getProperty(WSDL_SCHEMA_LIST);
> -
> +
>          List orderedParam = msg.getOrderedParts(paramOrder);
>          for (Part part : cast(orderedParam, Part.class)) {
> -            MessagePartInfo pi = minfo.addMessagePart(new QName(
> minfo.getName().getNamespaceURI(),
> -                    part.getName()));
> +            MessagePartInfo pi = minfo.addMessagePart(new QName(
> minfo.getName().getNamespaceURI(), part
> +                .getName()));
>              if (part.getTypeName() != null) {
>                  pi.setTypeQName(part.getTypeName());
>                  pi.setElement(false);
> @@ -582,8 +640,8 @@
>          }
>          for (Part part : cast(msg.getParts().values(), Part.class)) {
>              if (!orderedParam.contains(part)) {
> -                MessagePartInfo pi = minfo.addMessagePart(new QName(
> minfo.getName().getNamespaceURI(),
> -                        part.getName()));
> +                MessagePartInfo pi = minfo.addMessagePart(new QName(
> minfo.getName().getNamespaceURI(), part
> +                    .getName()));
>                  if (part.getTypeName() != null) {
>                      pi.setTypeQName(part.getTypeName());
>                      pi.setElement(false);
> @@ -592,9 +650,9 @@
>                      pi.setElementQName(part.getElementName());
>                      pi.setElement(true);
>                      pi.setXmlSchema(schemas.getElementByQName(
> part.getElementName()));
> -                }
> +                }
>              }
>          }
> -    }
> +    }
>
> }
>
> Modified:
> incubator/cxf/trunk/tools2/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java
> URL:
> http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java?view=diff&rev=504471&r1=504470&r2=504471
>
> ==============================================================================
> ---
> incubator/cxf/trunk/tools2/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java
> (original)
> +++
> incubator/cxf/trunk/tools2/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java
> Wed Feb  7 01:11:48 2007
> @@ -38,9 +38,9 @@
>      private String packageName;
>      private Map<String, String> namespacePackageMap = new HashMap<String,
> String>();
>      private Map<String, String> excludeNamespacePackageMap = new
> HashMap<String, String>();
> -    private final Map<String, InputSource> jaxbBindingFiles = new
> HashMap<String, InputSource>();
> -    private List<String> excludePkgList = new java.util.ArrayList
> <String>();
> -    private List<String> excludeFileList = new java.util.ArrayList
> <String>();
> +    private List<InputSource> jaxbBindingFiles = new
> ArrayList<InputSource>();
> +    private List<String> excludePkgList = new ArrayList<String>();
> +    private List<String> excludeFileList = new ArrayList<String>();
>
>      public ToolContext() {
>      }
> @@ -193,11 +193,11 @@
>          return URIParserUtil.getNamespace(mapPackageName(ns));
>      }
>
> -    public void addJaxbBindingFile(String location, InputSource is) {
> -        this.jaxbBindingFiles.put(location, is);
> +    public void setJaxbBindingFiles(List<InputSource> bindings) {
> +        jaxbBindingFiles = bindings;
>      }
>
> -    public Map<String, InputSource> getJaxbBindingFile() {
> +    public List<InputSource> getJaxbBindingFile() {
>          return this.jaxbBindingFiles;
>      }
>
>
> Modified:
> incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
> URL:
> http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java?view=diff&rev=504471&r1=504470&r2=504471
>
> ==============================================================================
> ---
> incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
> (original)
> +++
> incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
> Wed Feb  7 01:11:48 2007
> @@ -21,10 +21,9 @@
> import java.io.File;
> import java.io.IOException;
> import java.util.ArrayList;
> -import java.util.Collection;
> -import java.util.HashMap;
> import java.util.List;
> import java.util.Map;
> +import java.util.Set;
> import java.util.logging.Logger;
>
> import javax.wsdl.Definition;
> @@ -50,7 +49,6 @@
> import org.apache.cxf.common.i18n.Message;
> import org.apache.cxf.common.logging.LogUtils;
> import org.apache.cxf.common.util.StringUtils;
> -import org.apache.cxf.service.model.SchemaInfo;
> import org.apache.cxf.service.model.ServiceInfo;
> import org.apache.cxf.tools.common.ToolConstants;
> import org.apache.cxf.tools.common.ToolContext;
> @@ -59,6 +57,7 @@
> import org.apache.cxf.tools.util.JAXBUtils;
> import org.apache.cxf.tools.util.URIParserUtil;
> import org.apache.cxf.tools.wsdlto.core.DataBindingProfile;
> +import org.apache.cxf.wsdl11.WSDLServiceBuilder;
>
>
> public class JAXBDataBinding implements DataBindingProfile {
> @@ -67,7 +66,6 @@
>      private ToolContext env;
>      private ServiceInfo serviceInfo;
>      private Definition def;
> -    private Map<String, Element> sysIdSchemeMap = new HashMap<String,
> Element>();
>
>      @SuppressWarnings("unchecked")
>      private void initialize(ToolContext penv) throws ToolException {
> @@ -76,7 +74,6 @@
>          def = (Definition)env.get(Definition.class);
>
>          SchemaCompilerImpl schemaCompiler =
> (SchemaCompilerImpl)XJC.createSchemaCompiler();
> -
>
>          ClassCollector classCollector = env.get(ClassCollector.class);
>          ClassNameAllocatorImpl allocator = new
> ClassNameAllocatorImpl(classCollector);
> @@ -84,13 +81,51 @@
>          schemaCompiler.setClassNameAllocator(allocator);
>
>          JAXBBindErrorListener listener = new JAXBBindErrorListener(env);
> -        schemaCompiler.setErrorListener(listener);
> -
> -        Collection<SchemaInfo> schemas = serviceInfo.getSchemas();
> -
> -        Collection<InputSource> jaxbBindings = env.getJaxbBindingFile
> ().values();
> +        schemaCompiler.setErrorListener(listener);
> +        //Collection<SchemaInfo> schemas = serviceInfo.getSchemas();
> +        List<InputSource> jaxbBindings = env.getJaxbBindingFile();
> +        Map<String, Element> schemaLists =
> +            (Map<String, Element>)serviceInfo.getProperty(
> WSDLServiceBuilder.WSDL_SHEMA_ELEMENT_LIST);
> +        Set<String> keys = schemaLists.keySet();
> +        for (String key : keys) {
> +            Element ele = schemaLists.get(key);
> +            this.removeImportElement(ele);
> +            String tns = ele.getAttribute("targetNamespace");
> +
> +            if (StringUtils.isEmpty(tns)) {
> +                continue;
> +            }
> +
> +            String excludePkg = null;
> +
> +            if (env.hasExcludeNamespace(tns)) {
> +                excludePkg = env.getExcludePackageName(tns);
> +                if (excludePkg != null) {
> +                    env.getExcludePkgList().add(excludePkg);
> +                } else {
> +                    env.getExcludePkgList().add(
> URIParserUtil.getPackageName(tns));
> +                }
> +            }
> +
> +            String pkgName = null;
> +            if (env.hasNamespace(tns) || env.get(
> ToolConstants.CFG_PACKAGENAME) != null) {
> +                pkgName = env.mapPackageName(tns);
> +            }
> +
> +            pkgName = pkgName != null ? pkgName : excludePkg;
> +
> +            if (pkgName != null) {
> +                Node pkgNode = JAXBUtils.innerJaxbPackageBinding(ele,
> pkgName);
> +                ele.appendChild(pkgNode);
> +            }
>
> -        for (SchemaInfo schema : schemas) {
> +            schemaCompiler.parseSchema(key, ele);
> +
> +        }
> +        //After XmlSchema can be fixed , these codes will be used to
> +        //get schema elements
> +        /*
> +            for (SchemaInfo schema : schemas) {
>              Document[] docs = schema.getSchema().getAllSchemas();
>              for (int i = 0; i < docs.length; i++) {
>                  Element ele = docs[i].getDocumentElement();
> @@ -143,20 +178,21 @@
>                  schemaCompiler.parseSchema(systemId, ele);
>              }
>
> -        }
> +        }*/
>
>          for (InputSource binding : jaxbBindings) {
>              schemaCompiler.parseSchema(binding);
>          }
>
>          rawJaxbModelGenCode = schemaCompiler.bind();
> -        addedEnumClassToCollector(schemas, allocator);
> +        //This bug is fixed in latest JAXB_RI
> +        //addedEnumClassToCollector(schemas, allocator);
>      }
>
>      // JAXB bug. JAXB ClassNameCollector may not be invoked when
> generated
>      // class is an enum. We need to use this method to add the missed
> file
>      // to classCollector.
> -    private void addedEnumClassToCollector(Collection<SchemaInfo>
> schemaList,
> +   /* private void addedEnumClassToCollector(Collection<SchemaInfo>
> schemaList,
>                                             ClassNameAllocatorImpl
> allocator) {
>          for (SchemaInfo schema : schemaList) {
>              Element schemaElement = schema.getElement();
> @@ -169,8 +205,8 @@
>                  allocator.assignClassName(packageName, "*");
>              }
>          }
> -    }
> -
> +    }*/
> +/*
>      private boolean addedToClassCollector(String packageName) {
>          ClassCollector classCollector = env.get(ClassCollector.class);
>          List<String> files =
> (List<String>)classCollector.getGeneratedFileInfo();
> @@ -183,7 +219,7 @@
>          }
>          return false;
>      }
> -
> +*/
>      public void generate(ToolContext context) throws ToolException {
>          initialize(context);
>          if (rawJaxbModelGenCode == null) {
>
> Modified:
> incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/CustomizationParser.java
> URL:
> http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/CustomizationParser.java?view=diff&rev=504471&r1=504470&r2=504471
>
> ==============================================================================
> ---
> incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/CustomizationParser.java
> (original)
> +++
> incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/CustomizationParser.java
> Wed Feb  7 01:11:48 2007
> @@ -25,10 +25,8 @@
> import java.net.URI;
> import java.net.URISyntaxException;
> import java.util.ArrayList;
> -import java.util.HashSet;
> import java.util.Iterator;
> import java.util.List;
> -import java.util.Set;
> import java.util.logging.Logger;
>
> import javax.xml.namespace.NamespaceContext;
> @@ -60,15 +58,13 @@
>      // For WSDL1.1
>      private static final Logger LOG = LogUtils.getL7dLogger(
> CustomizationParser.class);
>      private static final XPathFactory XPF = XPathFactory.newInstance();
> -
>
>      private final XPath xpath = XPF.newXPath();
>
>      private ToolContext env;
>      private final List<Element> jaxwsBindings = new ArrayList<Element>();
> -    private final Set<InputSource> jaxbBindings = new
> HashSet<InputSource>();
> -
> -
> +    private final List<InputSource> jaxbBindings = new
> ArrayList<InputSource>();
> +
>      private Element handlerChains;
>      private Element wsdlNode;
>      private String wsdlURL;
> @@ -78,7 +74,6 @@
>          jaxbBindings.clear();
>      }
>
> -
>      public Element getHandlerChains() {
>          return this.handlerChains;
>      }
> @@ -87,7 +82,7 @@
>          this.env = pe;
>          String[] bindingFiles;
>          try {
> -            this.wsdlURL = (String)env.get(ToolConstants.CFG_WSDLURL);
> +            this.wsdlURL = (String)env.get(ToolConstants.CFG_WSDLURL);
>              this.wsdlNode = this.getTargetNode(wsdlURL);
>              bindingFiles = (String[])env.get(ToolConstants.CFG_BINDING);
>              if (bindingFiles == null) {
> @@ -110,7 +105,6 @@
>          for (Element element : jaxwsBindings) {
>              internalizeBinding(element, "");
>          }
> -
>          buildHandlerChains();
>      }
>
> @@ -120,27 +114,25 @@
>          try {
>              uri = new URI(wsdlLoc);
>          } catch (URISyntaxException e1) {
> -           //ignore
> +            // ignore
>          }
>          File file = new File(uri);
>          InputStream ins;
> -
> +
>          try {
>              ins = new FileInputStream(file);
>          } catch (FileNotFoundException e) {
>              Message msg = new Message("FILE_NOT_FOUND", LOG, new Object[]
> {file});
> -            throw new ToolException(msg, e);
> +            throw new ToolException(msg, e);
>          }
> -
> -
> -
> +
>          try {
>              doc = DOMUtils.readXml(ins);
>          } catch (Exception e) {
>              Message msg = new Message("CAN_NOT_READ_AS_ELEMENT", LOG, new
> Object[] {file});
> -            throw new ToolException(msg, e);
> -        }
> -
> +            throw new ToolException(msg, e);
> +        }
> +
>          if (doc != null) {
>              return doc.getDocumentElement();
>          }
> @@ -174,53 +166,63 @@
>
>          if (isJAXWSBindings(bindings) && bindings.getAttributeNode("node")
> != null) {
>              expression = expression + "/" + bindings.getAttribute
> ("node");
> -
> +
>              Node node = null;
> -            boolean nestedJaxb = nestedJaxbBinding(bindings);
> +            NodeList nestedJaxbNodes = getNestedJaxbBinding(bindings);
>
>              node = queryXPathNode(wsdlNode, expression);
> -            if (node != null && !nestedJaxb) {
> +            if (node != null && nestedJaxbNodes.getLength() == 0) {
>                  copyBindingsToWsdl(node, bindings);
>              }
>
> -            if (node != null && nestedJaxb) {
> +            if (node != null && nestedJaxbNodes.getLength() != 0) {
>                  // append xmlns:jaxb and jaxb:version attribute for
> schema
> -                Node schemaNode = getSchemaNode(node);
> -                Element schemaElement = (Element)schemaNode;
> -
> -                String jaxbPrefix = schemaElement.lookupPrefix(
> ToolConstants.NS_JAXB_BINDINGS);
> -                if (jaxbPrefix == null) {
> -                    schemaElement.setAttribute("xmlns:jaxb",
> ToolConstants.NS_JAXB_BINDINGS);
> -                    schemaElement.setAttribute("jaxb:version", "2.0");
> -                }
> +                for (int i = 0; i < nestedJaxbNodes.getLength(); i++) {
> +                    Node jaxbNode = nestedJaxbNodes.item(0);
>
> -                // append jaxb appinfo for value node
> -                Element annoElement = node.getOwnerDocument
> ().createElementNS(ToolConstants.SCHEMA_URI,
>
> -                                                                              "annotation");
> -                Element appinfoEle = node.getOwnerDocument
> ().createElementNS(ToolConstants.SCHEMA_URI,
> -
> "appinfo");
> -
> -                annoElement.appendChild(appinfoEle);
> -
> -                NodeList jxbBinds =
> getJaxbBindingNode((Element)bindings);
> -
> -                for (int l = 0; l < jxbBinds.getLength(); l++) {
> -                    Node jaxbBindingNode = jxbBinds.item(l);
> -                    Node cloneNode = ProcessorUtil.cloneNode(
> node.getOwnerDocument(), jaxbBindingNode, true);
> -                    appinfoEle.appendChild(cloneNode);
> -                }
> +                    String xpathExpress = DOMUtils.getAttribute(jaxbNode,
> "node");
>
> -                if (node.getChildNodes().getLength() > 0) {
> -                    node.insertBefore(annoElement, node.getChildNodes
> ().item(0));
> -                } else {
> -                    node.appendChild(annoElement);
> +                    Node schemaNode = getSchemaNode(node);
> +                    Node targetNode = queryXPathNode(schemaNode,
> xpathExpress);
> +                    Element schemaElement = (Element)schemaNode;
> +                    // Element targetElement = (Element)targetNode;
> +
> +                    String jaxbPrefix = schemaElement.lookupPrefix(
> ToolConstants.NS_JAXB_BINDINGS);
> +                    if (jaxbPrefix == null) {
> +                        schemaElement.setAttribute("xmlns:jaxb",
> ToolConstants.NS_JAXB_BINDINGS);
> +                        schemaElement.setAttribute("jaxb:version", "2.0
> ");
> +                    }
> +
> +                    // append jaxb appinfo for value node
> +                    Element annoElement = node.getOwnerDocument
> ().createElementNS(ToolConstants.SCHEMA_URI,
>
> +                                                                                  "annotation");
> +                    Element appinfoEle = node.getOwnerDocument
> ().createElementNS(ToolConstants.SCHEMA_URI,
> +
> "appinfo");
> +
> +                    annoElement.appendChild(appinfoEle);
> +
> +                    for (int j = 0; j < jaxbNode.getChildNodes().getLength();
> j++) {
> +                        Node cloneNode = ProcessorUtil.cloneNode(
> node.getOwnerDocument(), jaxbNode
> +                            .getChildNodes().item(j), true);
> +                        appinfoEle.appendChild(cloneNode);
> +                    }
> +
> +                    if (targetNode.getChildNodes().getLength() > 0) {
> +                        targetNode.insertBefore(annoElement,
> targetNode.getChildNodes().item(0));
> +                    } else {
> +                        targetNode.appendChild(annoElement);
> +                    }
>                  }
>              }
>          }
>
>          Element[] children = getChildElements(bindings,
> ToolConstants.NS_JAXWS_BINDINGS);
>          for (int i = 0; i < children.length; i++) {
> -            internalizeBinding(children[i], expression);
> +
> +            if (children[i].getNodeType() == Node.ELEMENT_NODE) {
> +                internalizeBinding(children[i], expression);
> +            }
> +
>          }
>      }
>
> @@ -244,15 +246,15 @@
>              Element jaxwsBindingElement = node.getOwnerDocument
> ().createElement("jaxws:bindings");
>              node.appendChild(jaxwsBindingElement);
>              firstChild = jaxwsBindingElement;
> -        }
> -
> +        }
> +
>          if (firstChild == null && cloneNode.getNodeName().indexOf("bindings")
> > -1) {
>              firstChild = node;
>              if (wsdlNode.getAttributeNode("xmls:jaxws") == null) {
>                  wsdlNode.setAttribute("xmlns:jaxws",
> ToolConstants.JAXWS_BINDINGS.getNamespaceURI());
>              }
>          }
> -
> +
>          Element cloneEle = (Element)cloneNode;
>          cloneEle.removeAttribute("node");
>          for (int i = 0; i < cloneNode.getChildNodes().getLength(); i++) {
> @@ -333,8 +335,8 @@
>                  root = DOMUtils.readXml
> (inputStream).getDocumentElement();
>              } catch (Exception e1) {
>                  Message msg = new Message("CAN_NOT_READ_AS_ELEMENT", LOG,
> new Object[] {bindingFile});
> -                throw new ToolException(msg, e1);
> -            }
> +                throw new ToolException(msg, e1);
> +            }
>              String wsdlLocation = root.getAttribute("wsdlLocation");
>              URI wsdlURI = null;
>              try {
> @@ -355,7 +357,6 @@
>
>              }
>
> -
>              if (wsdlURI.toString().equals(this.wsdlURL)) {
>                  jaxwsBindings.add(root);
>              } else {
> @@ -389,8 +390,6 @@
>
>      }
>
> -
> -
>      class ContextImpl implements NamespaceContext {
>          private Node targetNode;
>
> @@ -410,7 +409,6 @@
>              throw new UnsupportedOperationException();
>          }
>      }
> -
>
>      private Node queryXPathNode(Node target, String expression) {
>          NodeList nlst;
> @@ -421,7 +419,7 @@
>              Message msg = new Message("XPATH_ERROR", LOG, new Object[]
> {expression});
>              throw new ToolException(msg, e);
>          }
> -
> +
>          if (nlst.getLength() != 1) {
>              Message msg = new Message("ERROR_TARGETNODE_WITH_XPATH", LOG,
> new Object[] {expression});
>              throw new ToolException(msg);
> @@ -431,7 +429,7 @@
>          if (!(rnode instanceof Element)) {
>              Message msg = new Message("ERROR_TARGETNODE_WITH_XPATH", LOG,
> new Object[] {expression});
>              throw new ToolException(msg);
> -        }
> +        }
>          return (Element)rnode;
>      }
>
> @@ -444,39 +442,18 @@
>                 && "bindings".equals(bindings.getLocalName());
>      }
>
> -    private boolean nestedJaxbBinding(Element bindings) {
> -        NodeList nodeList = bindings.getElementsByTagNameNS(
> ToolConstants.NS_JAXB_BINDINGS, "bindings");
> -        if (nodeList.getLength() == 1) {
> -            return true;
> -        }
> -        return false;
> +    private NodeList getNestedJaxbBinding(Element bindings) {
> +        return bindings.getElementsByTagNameNS(
> ToolConstants.NS_JAXB_BINDINGS, "bindings");
>      }
>
> -    private NodeList getJaxbBindingNode(Element bindings) {
> -        NodeList nodeList = bindings.getElementsByTagNameNS(
> ToolConstants.NS_JAXB_BINDINGS, "bindings");
> -        return nodeList.item(0).getChildNodes();
> -    }
> -
>      public Element getCustomizedWSDLElement() {
>          return this.wsdlNode;
>      }
> -
> -   /* private URI getURI(String arg) {
> -        String location = ProcessorUtil.absolutize(arg);
> -        URI uri = null;
> -        try {
> -            uri = new URI(location);
> -        } catch (URISyntaxException e) {
> -            Message msg = new Message("NOT_URI", LOG, new Object[]
> {location});
> -            throw new ToolException(msg, e);
> -        }
> -        return uri;
> -    }*/
> -
> -    public Set<InputSource> getJaxbBindings() {
> +
> +    public List<InputSource> getJaxbBindings() {
>          return this.jaxbBindings;
>      }
> -
> +
>      public static JAXWSBinding mergeJawsBinding(JAXWSBinding binding1,
> JAXWSBinding binding2) {
>          if (binding1 != null && binding2 != null) {
>              if (binding2.isEnableAsyncMapping()) {
> @@ -501,5 +478,5 @@
>
>          return binding1 == null ? binding2 : binding1;
>      }
> -
> +
> }
>
> 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=504471&r1=504470&r2=504471
>
> ==============================================================================
> ---
> 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
> Wed Feb  7 01:11:48 2007
> @@ -26,7 +26,7 @@
> import java.io.InputStream;
> import java.io.OutputStream;
> import java.util.Iterator;
> -import java.util.Set;
> +import java.util.List;
> import java.util.logging.Logger;
>
> import javax.jws.soap.SOAPBinding;
> @@ -67,7 +67,7 @@
>      private WSDLReader wsdlReader;
>      private Definition wsdlDefinition;
>
> -    private Set<InputSource> jaxbBindings;
> +    private List<InputSource> jaxbBindings;
>      private Element handlerChain;
>
>      public JAXWSDefinitionBuilder() {
> @@ -110,10 +110,11 @@
>          }
>          cusParser = new CustomizationParser();
>          cusParser.parse(context);
> +
>          jaxbBindings = cusParser.getJaxbBindings();
>          handlerChain = cusParser.getHandlerChains();
> -
> -        context.put(ToolConstants.NS_JAXB_BINDINGS, jaxbBindings);
> +
> +        context.setJaxbBindingFiles(jaxbBindings);
>          context.put(ToolConstants.HANDLER_CHAIN, handlerChain);
>          try {
>              this.wsdlDefinition = buildCustomizedDefinition();
>
> 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=504471&r1=504470&r2=504471
>
> ==============================================================================
> ---
> 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
> Wed Feb  7 01:11:48 2007
> @@ -112,8 +112,6 @@
>          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());
>
> Modified:
> incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/binding2.xml
> URL:
> http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/binding2.xml?view=diff&rev=504471&r1=504470&r2=504471
>
> ==============================================================================
> ---
> incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/binding2.xml
> (original)
> +++
> incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/binding2.xml
> Wed Feb  7 01:11:48 2007
> @@ -34,13 +34,13 @@
>                 </jaxws:bindings>
>         </jaxws:bindings>
>
> -       <jaxws:bindings
> node="wsdl:definitions/wsdl:types/xsd:schema/xsd:element[@name='CreateProcess']/xsd:complexType/xsd:sequence/xsd:element[@name='MyProcess']/xsd:simpleType">
> -               <jaxb:bindings>
> -                  <jaxb:typesafeEnumClass name="MyProcess">
> -                               <jaxb:typesafeEnumMember name="BLUE"
> value="BLUE" />
> -                               <jaxb:typesafeEnumMember name="RED"
> value="RED" />
> -                               <jaxb:typesafeEnumMember name="GREEN"
> value="GREEN" />
> -                       </jaxb:typesafeEnumClass>
> -               </jaxb:bindings>
> +       <jaxws:bindings node="wsdl:definitions/wsdl:types/xsd:schema">
> +               <jaxb:bindings version="2.0"
> node="xsd:element[@name='CreateProcess']/xsd:complexType/xsd:sequence/xsd:element[@name='MyProcess']/xsd:simpleType">
> +                               <jaxb:typesafeEnumClass name="MyProcess">
> +                                       <jaxb:typesafeEnumMember
> name="BLUE" value="BLUE" />
> +                                       <jaxb:typesafeEnumMember
> name="RED" value="RED" />
> +                                       <jaxb:typesafeEnumMember
> name="GREEN" value="GREEN" />
> +                               </jaxb:typesafeEnumClass>
> +               </jaxb:bindings>
>         </jaxws:bindings>
> </jaxws:bindings>
>
> Modified:
> incubator/cxf/trunk/tools2/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
> URL:
> http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?view=diff&rev=504471&r1=504470&r2=504471
>
> ==============================================================================
> ---
> incubator/cxf/trunk/tools2/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
> (original)
> +++
> incubator/cxf/trunk/tools2/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
> Wed Feb  7 01:11:48 2007
> @@ -21,14 +21,12 @@
> import java.io.File;
> import java.io.FileInputStream;
> import java.io.IOException;
> -import java.io.InputStream;
> import java.lang.reflect.Modifier;
>
> import javax.jws.WebService;
>
> import org.apache.cxf.tools.common.ProcessorTestBase;
> import org.apache.cxf.tools.common.ToolConstants;
> -import org.apache.cxf.tools.common.toolspec.ToolSpec;
> import org.apache.cxf.tools.util.AnnotationUtil;
> import org.apache.cxf.tools.wsdlto.WSDLToJava;
> import org.apache.cxf.tools.wsdlto.frontend.jaxws.JAXWSContainer;
> @@ -46,13 +44,12 @@
>                                                + File.separatorChar);
>          classLoader = AnnotationUtil.getClassLoader(Thread.currentThread
> ().getContextClassLoader());
>          env.put(ToolConstants.CFG_COMPILE, ToolConstants.CFG_COMPILE);
> +
>          env.put(ToolConstants.CFG_IMPL, "impl");
>          env.put(ToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
>          env.put(ToolConstants.CFG_CLASSDIR, output.getCanonicalPath() +
> "/classes");
> -
> -        InputStream ins = JAXWSContainer.class.getResourceAsStream("
> jaxws-toolspec.xml");
> -        ToolSpec toolspec = new ToolSpec(ins, true);
> -        processor = new JAXWSContainer(toolspec);
> +
> +        processor = new JAXWSContainer(null);
>
>      }
>
> @@ -61,16 +58,16 @@
>          processor = null;
>          env = null;
>      }
> +
>
>      public void testBug305729() {
>          env.put(ToolConstants.CFG_WSDLURL,
> getLocation("/wsdl2java_wsdl/bug305729/hello_world.wsdl"));
>          processor.setContext(env);
> -        processor.execute(true);
> +        processor.execute();
>
>          assertNotNull("Process message with no part wsdl error", output);
>      }
>
> -
>
>      public void testBug305773() {
>          try {
> @@ -80,7 +77,7 @@
>              env.put(ToolConstants.CFG_CLASSDIR, output.getCanonicalPath()
> + "/classes");
>              env.put(ToolConstants.CFG_WSDLURL,
> getLocation("/wsdl2java_wsdl/bug305773/hello_world.wsdl"));
>              processor.setContext(env);
> -            processor.execute(true);
> +            processor.execute();
>              Class clz = classLoader.loadClass("
> org.apache.hello_world_soap_http.GreeterImpl");
>
>              WebService webServiceAnn =
> AnnotationUtil.getPrivClassAnnotation(clz, WebService.class);
> @@ -94,13 +91,13 @@
>              e.printStackTrace();
>          }
>      }
> -
> +   /*
>      public void testHangingBug() throws Exception {
>          env.put(ToolConstants.CFG_WSDLURL,
> getLocation("/wsdl2java_wsdl/bughanging/wsdl/wsrf.wsdl"));
>          processor.setContext(env);
> -        processor.execute(true);
> +        processor.execute();
>      }
> -
> +    */
>      public void testBug305700() throws Exception {
>          env.put(ToolConstants.CFG_COMPILE, "compile");
>          env.put(ToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
> @@ -108,7 +105,7 @@
>          env.put(ToolConstants.CFG_CLIENT, ToolConstants.CFG_CLIENT);
>          env.put(ToolConstants.CFG_WSDLURL,
> getLocation("/wsdl2java_wsdl/bug305700/addNumbers.wsdl"));
>          processor.setContext(env);
> -        processor.execute(true);
> +        processor.execute();
>      }
>
>      public void testNamespacePackageMapping1() throws Exception {
> @@ -116,7 +113,7 @@
>          env.addNamespacePackageMap("
> http://apache.org/hello_world_soap_http/types", "org.apache.types");
>          env.put(ToolConstants.CFG_WSDLURL,
> getLocation("/wsdl2java_wsdl/hello_world.wsdl"));
>          processor.setContext(env);
> -        processor.execute(true);
> +        processor.execute();
>
>          File org = new File(output, "org");
>          assertTrue(org.exists());
> @@ -142,7 +139,7 @@
>          env.addNamespacePackageMap("
> http://apache.org/hello_world_soap_http/types", "org.apache.types");
>          env.put(ToolConstants.CFG_WSDLURL,
> getLocation("/wsdl2java_wsdl/hello_world.wsdl"));
>          processor.setContext(env);
> -        processor.execute(true);
> +        processor.execute();
>
>          File org = new File(output, "org");
>          assertTrue("org directory is not found", org.exists());
> @@ -160,7 +157,7 @@
>          env.put(ToolConstants.CFG_PACKAGENAME, "org.cxf");
>          env.put(ToolConstants.CFG_WSDLURL,
> getLocation("/wsdl2java_wsdl/hello_world.wsdl"));
>          processor.setContext(env);
> -        processor.execute(true);
> +        processor.execute();
>
>          File org = new File(output, "org");
>          assertTrue(org.exists());
> @@ -181,7 +178,7 @@
>          // env.put(ToolConstants.CFG_CLIENT, ToolConstants.CFG_CLIENT);
>          env.put(ToolConstants.CFG_WSDLURL,
> getLocation("/wsdl2java_wsdl/bug305772/hello_world.wsdl"));
>          processor.setContext(env);
> -        processor.execute(true);
> +        processor.execute();
>          File file = new File(output.getCanonicalPath(), "build.xml");
>          FileInputStream fileinput = new FileInputStream(file);
>          java.io.BufferedInputStream filebuffer = new
> java.io.BufferedInputStream(fileinput);
> @@ -350,28 +347,11 @@
>
>          File[] files = address.listFiles();
>          assertEquals(11, files.length);
> -    }
> -
> -    /*
> -    //TODO: Need to be fixed
> -    public void testWithNoService() throws Exception {
> -        env.put(ToolConstants.CFG_WSDLURL,
> getLocation("/wsdl2java_wsdl/helloworld-noservice.wsdl"));
> -        processor.setContext(env);
> -        processor.execute(true);
> -        Class clz = classLoader.loadClass("
> org.apache.tuscany.samples.helloworldaxis.HelloWorldServiceImpl");
> -        Method method = clz.getMethod("getGreetings", new Class[] {
> java.lang.String.class});
> -        WebResult webResultAnno = AnnotationUtil.getPrivMethodAnnotation(method,
> WebResult.class);
> -        assertEquals("http://helloworldaxis.samples.tuscany.apache.org",
> webResultAnno.targetNamespace());
> -        assertEquals("response", webResultAnno.partName());
> -        assertEquals("getGreetingsResponse", webResultAnno.name());
> -
> -        WebParam webParamAnno = AnnotationUtil.getWebParam(method,
> "getGreetings");
> -        assertEquals("http://helloworldaxis.samples.tuscany.apache.org",
> webParamAnno.targetNamespace());
> -        assertEquals("request", webParamAnno.partName());
> -        assertEquals("getGreetings", webParamAnno.name());
> -
>      }
>
> +
> +
> +
>      public void testBug305924ForNestedBinding() {
>          try {
>              String[] args = new String[] {"-all", "-compile",
> "-classdir",
> @@ -391,22 +371,7 @@
>              e.printStackTrace();
>          }
>      }
> -
> -
> -     public void testBug305770() {
> -        try {
> -            env.put(ToolConstants.CFG_COMPILE, "compile");
> -            env.put(ToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath
> ());
> -            env.put(ToolConstants.CFG_CLASSDIR, output.getCanonicalPath()
> + "/classes");
> -            env.put(ToolConstants.CFG_ALL, ToolConstants.CFG_ALL);
> -            env.put(ToolConstants.CFG_WSDLURL,
> getLocation("/wsdl2java_wsdl/bug305770/Printer.wsdl"));
> -            processor.setContext(env);
> -            processor.execute(true);
> -        } catch (Exception e) {
> -            e.printStackTrace();
> -        }
> -    }
> -
> +
>      public void testBug305924ForExternalBinding() {
>          try {
>              String[] args = new String[] {"-all", "-compile",
> "-classdir",
> @@ -426,11 +391,8 @@
>              e.printStackTrace();
>          }
>      }
> -
> -    */
> -
> -
>
> +
>      private String getLocation(String wsdlFile) {
>          return this.getClass().getResource(wsdlFile).getFile();
>      }
>
> Modified:
> incubator/cxf/trunk/tools2/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenOptionTest.java
> URL:
> http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenOptionTest.java?view=diff&rev=504471&r1=504470&r2=504471
>
> ==============================================================================
> ---
> incubator/cxf/trunk/tools2/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenOptionTest.java
> (original)
> +++
> incubator/cxf/trunk/tools2/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenOptionTest.java
> Wed Feb  7 01:11:48 2007
> @@ -19,11 +19,9 @@
> package org.apache.cxf.tools.wsdlto.jaxws;
>
> import java.io.File;
> -import java.io.InputStream;
>
> import org.apache.cxf.tools.common.ProcessorTestBase;
> import org.apache.cxf.tools.common.ToolConstants;
> -import org.apache.cxf.tools.common.toolspec.ToolSpec;
> import org.apache.cxf.tools.util.AnnotationUtil;
> import org.apache.cxf.tools.wsdlto.frontend.jaxws.JAXWSContainer;
>
> @@ -43,9 +41,7 @@
>          env.put(ToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
>          env.put(ToolConstants.CFG_CLASSDIR, output.getCanonicalPath() +
> "/classes");
>
> -        InputStream ins = JAXWSContainer.class.getResourceAsStream("
> jaxws-toolspec.xml");
> -        ToolSpec toolspec = new ToolSpec(ins, true);
> -        processor = new JAXWSContainer(toolspec);
> +        processor = new JAXWSContainer(null);
>
>      }
>
> @@ -66,7 +62,7 @@
>
>          env.put(ToolConstants.CFG_WSDLURL,
> getLocation("/wsdl2java_wsdl/hello_world.wsdl"));
>          processor.setContext(env);
> -        processor.execute(true);
> +        processor.execute();
>
>          Class greeterServer = classLoader.loadClass("
> org.apache.hello_world_soap_http.GreeterServer");
>          assertNotNull("Server should be generated", greeterServer);
> @@ -79,7 +75,7 @@
>
>          env.put(ToolConstants.CFG_WSDLURL,
> getLocation("/wsdl2java_wsdl/hello_world.wsdl"));
>          processor.setContext(env);
> -        processor.execute(true);
> +        processor.execute();
>
>          Class greeterServer = classLoader.loadClass("
> org.apache.hello_world_soap_http.GreeterServer");
>          assertNotNull("Server should be generated", greeterServer);
> @@ -90,7 +86,7 @@
>          env.put(ToolConstants.CFG_WSDLURL,
> getLocation("/wsdl2java_wsdl/hello_world_jaxws_base.wsdl"));
>          env.put(ToolConstants.CFG_BINDING,
> getLocation("/wsdl2java_wsdl/hello_world_jaxws_binding.wsdl"));
>          processor.setContext(env);
> -        processor.execute(true);
> +        processor.execute();
>
>          assertNotNull(output);
>
>
> Modified:
> incubator/cxf/trunk/tools2/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
> URL:
> http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java?view=diff&rev=504471&r1=504470&r2=504471
>
> ==============================================================================
> ---
> incubator/cxf/trunk/tools2/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
> (original)
> +++
> incubator/cxf/trunk/tools2/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
> Wed Feb  7 01:11:48 2007
> @@ -19,7 +19,6 @@
> package org.apache.cxf.tools.wsdlto.jaxws;
>
> import java.io.File;
> -import java.io.InputStream;
> import java.lang.reflect.Method;
> import java.lang.reflect.Modifier;
>
> @@ -37,7 +36,6 @@
>
> import org.apache.cxf.tools.common.ProcessorTestBase;
> import org.apache.cxf.tools.common.ToolConstants;
> -import org.apache.cxf.tools.common.toolspec.ToolSpec;
> import org.apache.cxf.tools.util.AnnotationUtil;
> import org.apache.cxf.tools.wsdlto.frontend.jaxws.JAXWSContainer;
>
> @@ -56,10 +54,9 @@
>          env.put(ToolConstants.CFG_IMPL, "impl");
>          env.put(ToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
>          env.put(ToolConstants.CFG_CLASSDIR, output.getCanonicalPath() +
> "/classes");
> -        InputStream ins = JAXWSContainer.class.getResourceAsStream("
> jaxws-toolspec.xml");
> -        ToolSpec toolspec = new ToolSpec(ins, true);
> -        processor = new JAXWSContainer(toolspec);
> -        //processor = new WSDLToJavaContainer("jaxws", null);
> +
> +        processor = new JAXWSContainer(null);
> +
>
>      }
>
> @@ -617,7 +614,7 @@
>      public void testDefaultParameterOrder() throws Exception {
>          env.put(ToolConstants.CFG_WSDLURL,
> getLocation("/wsdl2java_wsdl/bug161/header2.wsdl"));
>          processor.setContext(env);
> -        processor.execute(true);
> +        processor.execute();
>          Class clz = classLoader.loadClass("org.apache.header2.Header2Test
> ");
>          Class header = classLoader.loadClass("org.apache.header2.Header
> ");
>          Method method = clz.getMethod("headerMethod", new Class[] {
> Holder.class, header});
> @@ -677,7 +674,7 @@
>
> getLocation("/wsdl2java_wsdl/hello_world_with_keywords_operation.wsdl"));
>
>          processor.setContext(env);
> -        processor.execute(true);
> +        processor.execute();
>
>          Class clz = classLoader.loadClass("
> org.apache.hello_world_soap_http.Greeter");
>          Class sayHi = classLoader.loadClass("
> org.apache.hello_world_soap_http.types.SayHi");
> @@ -690,7 +687,7 @@
>          try {
>              env.put(ToolConstants.CFG_WSDLURL,
> getLocation("/wsdl2java_wsdl/invalid_mep.wsdl"));
>              processor.setContext(env);
> -            processor.execute(true);
> +            processor.execute();
>          } catch (Exception e) {
>              assertTrue("Invalid wsdl should be diagnosed", e.getMessage()
>                  .indexOf("Invalid WSDL,wsdl:operation") > -1);
> @@ -700,7 +697,7 @@
>      public void testWSDLWithEnumType() throws Exception {
>          env.put(ToolConstants.CFG_WSDLURL,
> getLocation("/wsdl2java_wsdl/hello_world_with_enum_type.wsdl"));
>          processor.setContext(env);
> -        processor.execute(true);
> +        processor.execute();
>          Class clz = classLoader.loadClass("
> org.apache.hello_world_soap_http.types.ActionType");
>          assertNotNull("Enum class could not be found", clz);
>      }
>
> Modified:
> incubator/cxf/trunk/tools2/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/validator/ValidatorTest.java
> URL:
> http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/validator/ValidatorTest.java?view=diff&rev=504471&r1=504470&r2=504471
>
> ==============================================================================
> ---
> incubator/cxf/trunk/tools2/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/validator/ValidatorTest.java
> (original)
> +++
> incubator/cxf/trunk/tools2/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/validator/ValidatorTest.java
> Wed Feb  7 01:11:48 2007
> @@ -18,11 +18,8 @@
>   */
> package org.apache.cxf.tools.wsdlto.validator;
>
> -import java.io.InputStream;
> -
> import org.apache.cxf.tools.common.ProcessorTestBase;
> import org.apache.cxf.tools.common.ToolConstants;
> -import org.apache.cxf.tools.common.toolspec.ToolSpec;
> import org.apache.cxf.tools.wsdlto.WSDLToJavaContainer;
> import org.apache.cxf.tools.wsdlto.frontend.jaxws.JAXWSContainer;
>
> @@ -37,13 +34,11 @@
>      }
>
>      public void testXMLFormat() throws Exception {
> -        InputStream ins = JAXWSContainer.class.getResourceAsStream("
> jaxws-toolspec.xml");
> -        ToolSpec toolspec = new ToolSpec(ins, true);
> -        processor = new JAXWSContainer(toolspec);
> +        processor = new JAXWSContainer(null);
>          env.put(ToolConstants.CFG_WSDLURL,
> getLocation("/wsdl2java_wsdl/xml_format_root.wsdl"));
>          processor.setContext(env);
>
> -        processor.execute(false);
> +        processor.execute();
>
>          // TODO 1: check the exception here:
>          // Binding(Greeter_XMLBinding):BindingOperation({
> http://apache.org/xml_http_bare}sayHi)-input:
>
>
>


-- 
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message