[savara-commits] savara SVN: r51 - in tools/eclipse/trunk: plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator and 4 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Oct 16 19:21:50 EDT 2009


Author: objectiser
Date: 2009-10-16 19:21:50 -0400 (Fri, 16 Oct 2009)
New Revision: 51

Added:
   tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/WSDLBinding.java
   tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/soap/
   tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/soap/SOAPRPCWSDLBinding.java
Modified:
   tools/eclipse/trunk/
   tools/eclipse/trunk/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/Generator.java
   tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl.tests/src/java/org/jboss/savara/tools/wsdl/tests/WSDLGeneratorTest.java
   tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/META-INF/MANIFEST.MF
   tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/WSDLGenerator.java
Log:
Added WSDL service generation, with a port per binding. Set the port type on the binding. Added initial mechanism for defining specific binding details (default will be SOAP RPC).


Property changes on: tools/eclipse/trunk
___________________________________________________________________
Name: svn:ignore
   + .project


Modified: tools/eclipse/trunk/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/Generator.java
===================================================================
--- tools/eclipse/trunk/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/Generator.java	2009-10-16 13:35:32 UTC (rev 50)
+++ tools/eclipse/trunk/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/Generator.java	2009-10-16 23:21:50 UTC (rev 51)
@@ -24,6 +24,7 @@
 import org.jboss.savara.tools.bpel.generator.BuildSystem;
 import org.jboss.savara.tools.bpel.model.*;
 import org.jboss.savara.tools.bpel.util.XMLUtils;
+import org.jboss.savara.tools.wsdl.soap.SOAPRPCWSDLBinding;
 import org.scribble.contract.model.Contract;
 import org.scribble.conversation.model.*;
 import org.scribble.extensions.RegistryFactory;
@@ -216,7 +217,8 @@
 						new org.jboss.savara.tools.wsdl.WSDLGenerator();
 			Contract contract=(Contract)role.getAnnotations().get(Contract.class.getName());
 
-			java.util.List<javax.wsdl.Definition> defns=generator.generateDefinitions(contract);
+			java.util.List<javax.wsdl.Definition> defns=generator.generateDefinitions(contract,
+									new SOAPRPCWSDLBinding());
 			
 			for (int i=defns.size()-1; i >= 0; i--) {
 				javax.wsdl.Definition defn=defns.get(i);

Modified: tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/META-INF/MANIFEST.MF
===================================================================
--- tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/META-INF/MANIFEST.MF	2009-10-16 13:35:32 UTC (rev 50)
+++ tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/META-INF/MANIFEST.MF	2009-10-16 23:21:50 UTC (rev 51)
@@ -11,4 +11,5 @@
  org.scribble.contract.model;bundle-version="0.1.0",
  org.apache.commons.logging;bundle-version="1.0.4",
  org.scribble.core;bundle-version="0.1.0"
-Export-Package: org.jboss.savara.tools.wsdl
+Export-Package: org.jboss.savara.tools.wsdl,
+ org.jboss.savara.tools.wsdl.soap

Added: tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/WSDLBinding.java
===================================================================
--- tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/WSDLBinding.java	                        (rev 0)
+++ tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/WSDLBinding.java	2009-10-16 23:21:50 UTC (rev 51)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.jboss.savara.tools.wsdl;
+
+/**
+ * This interface is used to establish binding information on a
+ * WSDL definition.
+ *
+ */
+public interface WSDLBinding {
+
+	/**
+	 * This method returns the name of the WSDL binding implementation.
+	 * 
+	 * @return The WSDL binding
+	 */
+	public String getName();
+	
+	/**
+	 * This method initializes the WSDL definition for the binding.
+	 * 
+	 * @param defn The definition
+	 */
+	public void initDefinition(javax.wsdl.Definition defn);
+	
+	/**
+	 * This method adds WSDL binding information to the port binding.
+	 * 
+	 * @param defn The definition
+	 * @param binding The port type
+	 */
+	public void updateBinding(javax.wsdl.Definition defn, javax.wsdl.Binding binding);
+	
+	/**
+	 * This method adds WSDL binding information to the operation.
+	 * 
+	 * @param defn The definition
+	 * @param operation The operation
+	 */
+	public void updateOperation(javax.wsdl.Definition defn, javax.wsdl.Operation operation);
+	
+	/**
+	 * This method adds WSDL binding information to the input.
+	 * 
+	 * @param defn The definition
+	 * @param input The input
+	 */
+	public void updateInput(javax.wsdl.Definition defn, javax.wsdl.Input input);
+	
+	/**
+	 * This method adds WSDL binding information to the output.
+	 * 
+	 * @param defn The definition
+	 * @param output The output
+	 */
+	public void updateOutput(javax.wsdl.Definition defn, javax.wsdl.Output output);
+	
+	/**
+	 * This method adds WSDL binding information to the fault.
+	 * 
+	 * @param defn The definition
+	 * @param fault The fault
+	 */
+	public void updateFault(javax.wsdl.Definition defn, javax.wsdl.Fault fault);
+	
+}

Modified: tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/WSDLGenerator.java
===================================================================
--- tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/WSDLGenerator.java	2009-10-16 13:35:32 UTC (rev 50)
+++ tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/WSDLGenerator.java	2009-10-16 23:21:50 UTC (rev 51)
@@ -40,24 +40,43 @@
 	 * This method generates a WSDL definition from a Scribble contract model.
 	 * 
 	 * @param contract The contract model
+	 * @param wsdlBinding The WSDL binding to use, or null if no binding
 	 * @return The WSDL definition
 	 */
-	public java.util.List<javax.wsdl.Definition> generateDefinitions(org.scribble.contract.model.Contract contract) {
+	public java.util.List<javax.wsdl.Definition> generateDefinitions(org.scribble.contract.model.Contract contract,
+								WSDLBinding wsdlBinding) {
 		java.util.List<javax.wsdl.Definition> ret=new java.util.Vector<javax.wsdl.Definition>();
 		
 		try {
 			// Create definition for contract's target namespace
-			javax.wsdl.Definition main=getDefinition(ret, contract, contract.getNamespace());
+			javax.wsdl.Definition main=getDefinition(ret, contract, contract.getNamespace(), wsdlBinding);
 			
+			// Create service
+			javax.wsdl.Service service=main.createService();
+			service.setQName(new javax.xml.namespace.QName(contract.getNamespace(),
+								contract.getName()+"Service"));
+
+			main.addService(service);
+			
 			// Define a port type per interface
 			for (int i=0; i < contract.getInterfaces().size(); i++) {
-				createPortType(ret, contract, contract.getInterfaces().get(i));
+				javax.wsdl.PortType portType=
+							createPortType(ret, contract, contract.getInterfaces().get(i),
+												wsdlBinding);
 				
-				createBinding(ret, contract, contract.getInterfaces().get(i));
+				javax.wsdl.Binding binding=
+							createBinding(ret, contract, contract.getInterfaces().get(i),
+										portType, wsdlBinding);
+				
+				// Create service port for interface
+				javax.wsdl.Port port=main.createPort();
+				
+				port.setName(contract.getInterfaces().get(i).getName()+"Port");
+				port.setBinding(binding);
+				
+				service.addPort(port);
 			}
 			
-			// TODO: Add service with port type bindings
-			
 		} catch(Exception e) {
 			logger.error("Failed to generate WSDL", e);
 		}
@@ -71,10 +90,12 @@
 	 * @param wsdls The list of current WSDL definitions
 	 * @param contract The contract
 	 * @param targetNamespace The target namespace
+	 * @param wsdlBinding The WSDL binding to use, or null if no binding
 	 * @return The WSDL definition for the target namespace, or null if unable to find or create
 	 */
 	protected javax.wsdl.Definition getDefinition(java.util.List<javax.wsdl.Definition> wsdls,
-				org.scribble.contract.model.Contract contract, String targetNamespace) {
+				org.scribble.contract.model.Contract contract, String targetNamespace,
+				WSDLBinding wsdlBinding) {
 		javax.wsdl.Definition ret=null;
 		
 		if (targetNamespace != null) {
@@ -91,6 +112,12 @@
 				ret = createDefinition(contract, targetNamespace);
 				
 				if (ret != null) {
+					
+					// Initialize definition using the WSDL binding
+					if (wsdlBinding != null) {
+						wsdlBinding.initDefinition(ret);
+					}
+					
 					wsdls.add(ret);
 				}
 			}
@@ -148,11 +175,12 @@
 	 */
 	public javax.wsdl.PortType createPortType(java.util.List<javax.wsdl.Definition> wsdls,
 						org.scribble.contract.model.Contract contract,
-								org.scribble.contract.model.Interface intf) {
+								org.scribble.contract.model.Interface intf,
+								WSDLBinding wsdlBinding) {
 		javax.wsdl.PortType ret=null;
 		
 		if (intf != null) {
-			javax.wsdl.Definition defn=getDefinition(wsdls, contract, intf.getNamespace());
+			javax.wsdl.Definition defn=getDefinition(wsdls, contract, intf.getNamespace(), wsdlBinding);
 
 			if (defn != null) {
 				ret = defn.createPortType();
@@ -164,7 +192,7 @@
 				
 				for (int i=0; i < intf.getMessageExchangePatterns().size(); i++) {
 					createOperation(wsdls, contract, ret,
-								intf.getMessageExchangePatterns().get(i));
+								intf.getMessageExchangePatterns().get(i), wsdlBinding);
 				}
 
 				// Only add portType to definition if they have atleast one operation
@@ -184,20 +212,28 @@
 	 * @param wsdls The list of current WSDL definitions
 	 * @param contract The contract
 	 * @param intf The interface model
+	 * @param portType The port type
 	 * @return The WSDL port type binding
 	 */
 	public javax.wsdl.Binding createBinding(java.util.List<javax.wsdl.Definition> wsdls,
 						org.scribble.contract.model.Contract contract,
-								org.scribble.contract.model.Interface intf) {
+								org.scribble.contract.model.Interface intf,
+								javax.wsdl.PortType portType,
+								WSDLBinding wsdlBinding) {
 		javax.wsdl.Binding ret=null;
 		
 		if (intf != null) {
-			javax.wsdl.Definition defn=getDefinition(wsdls, contract, intf.getNamespace());
+			javax.wsdl.Definition defn=getDefinition(wsdls, contract, intf.getNamespace(), wsdlBinding);
 
 			if (defn != null) {
 				ret = defn.createBinding();
 				ret.setUndefined(false);
 				
+				// Check if WSDL binding details
+				if (wsdlBinding != null) {
+					wsdlBinding.updateBinding(defn, ret);
+				}
+				
 				// TODO: Need to make binding configurable
 				
 				if (intf.getName() != null) {
@@ -205,9 +241,11 @@
 							intf.getName()+SOAP_BINDING_SUFFIX));
 				}
 				
+				ret.setPortType(portType);
+				
 				for (int i=0; i < intf.getMessageExchangePatterns().size(); i++) {
 					createBindingOperation(wsdls, contract, ret,
-								intf.getMessageExchangePatterns().get(i));
+								intf.getMessageExchangePatterns().get(i), wsdlBinding);
 				}
 
 				// Only add portType to definition if they have atleast one operation
@@ -232,13 +270,14 @@
 	 */
 	public javax.wsdl.Operation createOperation(java.util.List<javax.wsdl.Definition> wsdls,
 			org.scribble.contract.model.Contract contract, javax.wsdl.PortType portType,
-								org.scribble.contract.model.MessageExchangePattern mep) {
+								org.scribble.contract.model.MessageExchangePattern mep,
+								WSDLBinding wsdlBinding) {
 		javax.wsdl.Operation ret=null;
 		
 		javax.wsdl.Definition defn=null;
 		
 		if (portType != null) {
-			defn = getDefinition(wsdls, contract, portType.getQName().getNamespaceURI());
+			defn = getDefinition(wsdls, contract, portType.getQName().getNamespaceURI(), wsdlBinding);
 		}
 
 		if (defn != null && mep != null) {
@@ -247,7 +286,7 @@
 			
 			ret.setName(mep.getOperation());
 			
-			javax.wsdl.Message mesg=getMessage(wsdls, contract, mep.getTypes());
+			javax.wsdl.Message mesg=getMessage(wsdls, contract, mep.getTypes(), wsdlBinding);
 			
 			if (mesg != null) {
 				javax.wsdl.Input input=defn.createInput();
@@ -259,7 +298,7 @@
 			if (mep instanceof RequestResponseMEP) {
 				RequestResponseMEP rr=(RequestResponseMEP)mep;
 				
-				javax.wsdl.Message om=getMessage(wsdls, contract, rr.getResponseTypes());
+				javax.wsdl.Message om=getMessage(wsdls, contract, rr.getResponseTypes(), wsdlBinding);
 				if (om != null) {
 					javax.wsdl.Output output=defn.createOutput();
 					output.setMessage(om);
@@ -271,7 +310,7 @@
 					for (int i=0; i < rr.getFaultDetails().size(); i++) {
 						FaultDetails fd=rr.getFaultDetails().get(i);
 						
-						javax.wsdl.Message fm=getMessage(wsdls, contract, fd.getTypes());
+						javax.wsdl.Message fm=getMessage(wsdls, contract, fd.getTypes(), wsdlBinding);
 						if (fm != null) {
 							javax.wsdl.Fault fault=defn.createFault();
 							fault.setName(fd.getName());
@@ -301,13 +340,14 @@
 	 */
 	public javax.wsdl.BindingOperation createBindingOperation(java.util.List<javax.wsdl.Definition> wsdls,
 			org.scribble.contract.model.Contract contract, javax.wsdl.Binding binding,
-								org.scribble.contract.model.MessageExchangePattern mep) {
+								org.scribble.contract.model.MessageExchangePattern mep,
+								WSDLBinding wsdlBinding) {
 		javax.wsdl.BindingOperation ret=null;
 		
 		javax.wsdl.Definition defn=null;
 		
 		if (binding != null) {
-			defn = getDefinition(wsdls, contract, binding.getQName().getNamespaceURI());
+			defn = getDefinition(wsdls, contract, binding.getQName().getNamespaceURI(), wsdlBinding);
 		}
 
 		if (defn != null && mep != null) {
@@ -316,7 +356,7 @@
 			
 			ret.setName(mep.getOperation());
 			
-			javax.wsdl.Message mesg=getMessage(wsdls, contract, mep.getTypes());
+			javax.wsdl.Message mesg=getMessage(wsdls, contract, mep.getTypes(), wsdlBinding);
 			
 			if (mesg != null) {
 				javax.wsdl.BindingInput input=defn.createBindingInput();
@@ -327,7 +367,7 @@
 			if (mep instanceof RequestResponseMEP) {
 				RequestResponseMEP rr=(RequestResponseMEP)mep;
 				
-				javax.wsdl.Message om=getMessage(wsdls, contract, rr.getResponseTypes());
+				javax.wsdl.Message om=getMessage(wsdls, contract, rr.getResponseTypes(), wsdlBinding);
 				if (om != null) {
 					javax.wsdl.BindingOutput output=defn.createBindingOutput();
 					ret.setBindingOutput(output);
@@ -338,7 +378,7 @@
 					for (int i=0; i < rr.getFaultDetails().size(); i++) {
 						FaultDetails fd=rr.getFaultDetails().get(i);
 						
-						javax.wsdl.Message fm=getMessage(wsdls, contract, fd.getTypes());
+						javax.wsdl.Message fm=getMessage(wsdls, contract, fd.getTypes(), wsdlBinding);
 						if (fm != null) {
 							javax.wsdl.BindingFault fault=defn.createBindingFault();
 							fault.setName(fd.getName());
@@ -373,7 +413,8 @@
 	 */
 	public javax.wsdl.Message getMessage(java.util.List<javax.wsdl.Definition> wsdls,
 						org.scribble.contract.model.Contract contract,
-								java.util.List<TypeReference> types) {
+								java.util.List<TypeReference> types,
+								WSDLBinding wsdlBinding) {
 		javax.wsdl.Message ret=null;
 		
 		if (types != null && types.size() > 0) {
@@ -384,7 +425,7 @@
 				TypeReference ref=types.get(0);
 				qname = new javax.xml.namespace.QName(ref.getNamespace(),ref.getLocalpart());
 				
-				defn = getDefinition(wsdls, contract, ref.getNamespace());
+				defn = getDefinition(wsdls, contract, ref.getNamespace(), wsdlBinding);
 			} else {
 				throw new UnsupportedOperationException("Currently only supports single type reference");
 			}

Added: tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/soap/SOAPRPCWSDLBinding.java
===================================================================
--- tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/soap/SOAPRPCWSDLBinding.java	                        (rev 0)
+++ tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/soap/SOAPRPCWSDLBinding.java	2009-10-16 23:21:50 UTC (rev 51)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.jboss.savara.tools.wsdl.soap;
+
+import org.jboss.savara.tools.wsdl.WSDLBinding;
+
+/**
+ * This interface is used to establish binding information on a
+ * WSDL definition.
+ *
+ */
+public class SOAPRPCWSDLBinding implements WSDLBinding {
+
+	/**
+	 * This method returns the name of the WSDL binding implementation.
+	 * 
+	 * @return The WSDL binding
+	 */
+	public String getName() {
+		return("SOAP RPC");
+	}
+	
+	/**
+	 * This method initializes the WSDL definition for the binding.
+	 * 
+	 * @param defn The definition
+	 */
+	public void initDefinition(javax.wsdl.Definition defn) {
+		defn.addNamespace("soap", "http://schemas.xmlsoap.org/wsdl/soap/");
+	}
+	
+	/**
+	 * This method adds WSDL binding information to the port binding.
+	 * 
+	 * @param defn The definition
+	 * @param binding The port type
+	 */
+	public void updateBinding(javax.wsdl.Definition defn, javax.wsdl.Binding binding) {
+		/*
+		org.w3c.dom.Element sb=binding.getDocumentationElement().getOwnerDocument().
+								createElementNS("http://schemas.xmlsoap.org/wsdl/soap/", "binding");
+		sb.setAttribute("style", "rpc");
+		sb.setAttribute("transport", "http://schemas.xmlsoap.org/soap/http");
+		binding.getDocumentationElement().appendChild(sb);
+		*/
+	}
+	
+	/**
+	 * This method adds WSDL binding information to the operation.
+	 * 
+	 * @param defn The definition
+	 * @param operation The operation
+	 */
+	public void updateOperation(javax.wsdl.Definition defn, javax.wsdl.Operation operation) {
+		
+	}
+	
+	/**
+	 * This method adds WSDL binding information to the input.
+	 * 
+	 * @param defn The definition
+	 * @param input The input
+	 */
+	public void updateInput(javax.wsdl.Definition defn, javax.wsdl.Input input) {
+		
+	}
+	
+	/**
+	 * This method adds WSDL binding information to the output.
+	 * 
+	 * @param defn The definition
+	 * @param output The output
+	 */
+	public void updateOutput(javax.wsdl.Definition defn, javax.wsdl.Output output) {
+		
+	}
+	
+	/**
+	 * This method adds WSDL binding information to the fault.
+	 * 
+	 * @param defn The definition
+	 * @param fault The fault
+	 */
+	public void updateFault(javax.wsdl.Definition defn, javax.wsdl.Fault fault) {
+		
+	}
+	
+}

Modified: tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl.tests/src/java/org/jboss/savara/tools/wsdl/tests/WSDLGeneratorTest.java
===================================================================
--- tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl.tests/src/java/org/jboss/savara/tools/wsdl/tests/WSDLGeneratorTest.java	2009-10-16 13:35:32 UTC (rev 50)
+++ tools/eclipse/trunk/plugins/org.jboss.savara.tools.wsdl.tests/src/java/org/jboss/savara/tools/wsdl/tests/WSDLGeneratorTest.java	2009-10-16 23:21:50 UTC (rev 51)
@@ -41,7 +41,7 @@
 		
 		WSDLGenerator gen=new WSDLGenerator();
 		
-		java.util.List<javax.wsdl.Definition> defns=gen.generateDefinitions(c);
+		java.util.List<javax.wsdl.Definition> defns=gen.generateDefinitions(c, null);
 		
 		if (defns.size() != 1) {
 			fail("Only one Definition found: "+defns.size());
@@ -80,7 +80,7 @@
 		
 		java.util.List<javax.wsdl.Definition> defns=new java.util.Vector<javax.wsdl.Definition>();
 		
-		javax.wsdl.PortType result=gen.createPortType(defns, new Contract(), src);
+		javax.wsdl.PortType result=gen.createPortType(defns, new Contract(), src, null);
 		
 		if (result == null) {
 			fail("PortType is null");
@@ -117,7 +117,7 @@
 		
 		java.util.List<javax.wsdl.Definition> defns=new java.util.Vector<javax.wsdl.Definition>();
 		
-		javax.wsdl.Binding result=gen.createBinding(defns, new Contract(), src);
+		javax.wsdl.Binding result=gen.createBinding(defns, new Contract(), src, null, null);
 		
 		if (result == null) {
 			fail("PortType is null");
@@ -202,7 +202,7 @@
 		
 		WSDLGenerator gen=new WSDLGenerator();
 		
-		java.util.List<javax.wsdl.Definition> defns=gen.generateDefinitions(c);
+		java.util.List<javax.wsdl.Definition> defns=gen.generateDefinitions(c, null);
 		
 		if (defns.size() != 1) {
 			fail("Only one Definition found: "+defns.size());
@@ -254,7 +254,7 @@
 		javax.wsdl.PortType ptype=defn.createPortType();
 		ptype.setQName(new javax.xml.namespace.QName(TEST_NAME_SPACE, TEST_NAME));
 		
-		javax.wsdl.Operation result=gen.createOperation(defns, new Contract(), ptype, src);
+		javax.wsdl.Operation result=gen.createOperation(defns, new Contract(), ptype, src, null);
 		
 		if (result == null) {
 			fail("Operation is null");
@@ -333,7 +333,7 @@
 		javax.wsdl.PortType ptype=defn.createPortType();
 		ptype.setQName(new javax.xml.namespace.QName(TEST_NAME_SPACE, TEST_NAME));
 		
-		javax.wsdl.Operation result=gen.createOperation(defns, new Contract(), ptype, src);
+		javax.wsdl.Operation result=gen.createOperation(defns, new Contract(), ptype, src, null);
 		
 		if (result == null) {
 			fail("Operation is null");
@@ -380,7 +380,7 @@
 		
 		java.util.List<javax.wsdl.Definition> defns=new java.util.Vector<javax.wsdl.Definition>();
 		
-		javax.wsdl.Message result=gen.getMessage(defns, new Contract(), refs);
+		javax.wsdl.Message result=gen.getMessage(defns, new Contract(), refs, null);
 		
 		if (result == null) {
 			fail("Message is null");
@@ -465,7 +465,7 @@
 		
 		WSDLGenerator gen=new WSDLGenerator();
 		
-		java.util.List<javax.wsdl.Definition> defns=gen.generateDefinitions(c);
+		java.util.List<javax.wsdl.Definition> defns=gen.generateDefinitions(c, null);
 		
 		if (defns.size() != 3) {
 			fail("Four Definitions expected, but got: "+defns.size());
@@ -521,5 +521,24 @@
 			fail("3: Number of message ("+defn3.getMessages().size()+
 			") does not match number expected (1)");
 		}
+		
+		// Check service only associated with the first defn
+		if (defn1.getServices().size() != 1) {
+			fail("First definition should only have 1 service: "+defn1.getServices().size());
+		}
+		
+		javax.wsdl.Service s=(javax.wsdl.Service)
+					defn1.getServices().values().iterator().next();
+		if (s.getPorts().size() != 3) {
+			fail("Should be 3 ports: "+s.getPorts().size());
+		}
+		
+		if (defn2.getServices().size() != 0) {
+			fail("Second definition should not have any services: "+defn2.getServices().size());
+		}
+		
+		if (defn3.getServices().size() != 0) {
+			fail("Third definition should not have any services: "+defn3.getServices().size());
+		}
 	}
 }



More information about the savara-commits mailing list