axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From barre...@apache.org
Subject svn commit: r477703 - in /webservices/axis2/trunk/java/modules/jaxws: src/org/apache/axis2/jaxws/description/ src/org/apache/axis2/jaxws/description/impl/ test/org/apache/axis2/jaxws/description/
Date Tue, 21 Nov 2006 15:43:46 GMT
Author: barrettj
Date: Tue Nov 21 07:43:45 2006
New Revision: 477703

URL: http://svn.apache.org/viewvc?view=rev&rev=477703
Log:
Added default processing for Request and Response wrapper annotation values for target namespaces.
 Prior to this they threw UnsupportedOperationExceptions.

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointInterfaceDescription.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointInterfaceDescriptionJava.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/AnnotationServiceImplDescriptionTests.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/WSDLDescriptionTests.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointInterfaceDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointInterfaceDescription.java?view=diff&rev=477703&r1=477702&r2=477703
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointInterfaceDescription.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointInterfaceDescription.java
Tue Nov 21 07:43:45 2006
@@ -53,6 +53,8 @@
 public interface EndpointInterfaceDescription {
     public abstract EndpointDescription getEndpointDescription();
     
+    public abstract String getTargetNamespace();
+    
     public abstract OperationDescription getOperation(Method seiMethod);
     public abstract OperationDescription[] getOperation(QName operationQName);
     public abstract OperationDescription getOperation(String operationName);

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointInterfaceDescriptionJava.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointInterfaceDescriptionJava.java?view=diff&rev=477703&r1=477702&r2=477703
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointInterfaceDescriptionJava.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/EndpointInterfaceDescriptionJava.java
Tue Nov 21 07:43:45 2006
@@ -18,9 +18,13 @@
 */
 package org.apache.axis2.jaxws.description;
 
+import javax.jws.WebService;
 import javax.jws.soap.SOAPBinding;
 
 public interface EndpointInterfaceDescriptionJava {
+    public abstract WebService getAnnoWebService();
+    public abstract String getAnnoWebServiceTargetNamespace();
+    
     public SOAPBinding getAnnoSoapBinding();
     public abstract javax.jws.soap.SOAPBinding.ParameterStyle getAnnoSoapBindingParameterStyle();
     public abstract javax.jws.soap.SOAPBinding.Style getAnnoSoapBindingStyle();

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java?view=diff&rev=477703&r1=477702&r2=477703
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java
Tue Nov 21 07:43:45 2006
@@ -21,6 +21,7 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import java.util.StringTokenizer;
 
 import javax.xml.namespace.QName;
 
@@ -123,5 +124,124 @@
     	}
     	return className;
     }
+    /**
+     * Return the name of the class without any package qualifier.
+     * This method should be DEPRECATED when DBC support is complete
+     * @param theClass
+     * @return the name of the class sans package qualification.
+     */
+    static String getSimpleJavaClassName(Class theClass) {
+        String returnName = null;
+        if (theClass != null) {
+            String fqName = theClass.getName();
+            // We need the "simple name", so strip off any package information from the name
+            int endOfPackageIndex = fqName.lastIndexOf('.');
+            int startOfClassIndex = endOfPackageIndex + 1;
+            returnName = fqName.substring(startOfClassIndex);
+        }
+        else {
+            // TODO: RAS and NLS
+            throw new UnsupportedOperationException("Java class is null");
+        }
+        return returnName;
+    }
+    
+    /**
+     * Return the name of the class without any package qualifier.
+     * @param theClass
+     * @return the name of the class sans package qualification.
+     */
+    static String getSimpleJavaClassName(String name) {
+        String returnName = null;
+        
+        if (name != null) {
+            String fqName = name;
+            
+            // We need the "simple name", so strip off any package information from the name
+            int endOfPackageIndex = fqName.lastIndexOf('.');
+            int startOfClassIndex = endOfPackageIndex + 1;
+            returnName = fqName.substring(startOfClassIndex);
+        }
+        else {
+            // TODO: RAS and NLS
+            throw new UnsupportedOperationException("Java class is null");
+        }
+        return returnName;
+    }
+    
+    /**
+     * Returns the package name from the class.  If no package, then returns null
+     * This method should be DEPRECATED when DBC support is complete
+     * @param theClass
+     * @return
+     */
+    static String getJavaPackageName(Class theClass) {
+        String returnPackage = null;
+        if (theClass != null) {
+            String fqName = theClass.getName();
+            // Get the package name, if there is one
+            int endOfPackageIndex = fqName.lastIndexOf('.');
+            if (endOfPackageIndex >= 0) {
+                returnPackage = fqName.substring(0, endOfPackageIndex);
+            }
+        }
+        else {
+            // TODO: RAS and NLS
+            throw new UnsupportedOperationException("Java class is null");
+        }
+        return returnPackage;
+    }
+    
+    /**
+     * Returns the package name from the class.  If no package, then returns null
+     * @param theClassName
+     * @return
+     */
+    static String getJavaPackageName(String theClassName) {
+        String returnPackage = null;
+        if (theClassName != null) {
+            String fqName = theClassName;
+            // Get the package name, if there is one
+            int endOfPackageIndex = fqName.lastIndexOf('.');
+            if (endOfPackageIndex >= 0) {
+                returnPackage = fqName.substring(0, endOfPackageIndex);
+            }
+        }
+        else {
+            // TODO: RAS and NLS
+            throw new UnsupportedOperationException("Java class is null");
+        }
+        return returnPackage;
+    }
+    
+    /**
+     * Create a JAX-WS namespace based on the package name
+     * @param packageName
+     * @param protocol
+     * @return
+     */
+    static final String NO_PACKAGE_HOST_NAME = "DefaultNamespace";
 
+    static String makeNamespaceFromPackageName(String packageName, String protocol) {
+        if (DescriptionUtils.isEmpty(protocol)) {
+            protocol = "http";
+        }
+        if (DescriptionUtils.isEmpty(packageName)) {
+            return protocol + "://" + NO_PACKAGE_HOST_NAME;
+        }
+        StringTokenizer st = new StringTokenizer( packageName, "." );
+        String[] words = new String[ st.countTokens() ];
+        for(int i = 0; i < words.length; ++i)
+            words[i] = st.nextToken();
+
+        StringBuffer sb = new StringBuffer(80);
+        for(int i = words.length-1; i >= 0; --i) {
+            String word = words[i];
+            // seperate with dot
+            if( i != words.length-1 )
+                sb.append('.');
+            sb.append( word );
+        }
+        return protocol + "://" + sb.toString() + "/";
+    }
 }

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java?view=diff&rev=477703&r1=477702&r2=477703
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
Tue Nov 21 07:43:45 2006
@@ -850,9 +850,9 @@
                 // Default value is the "simple name" of the class or interface + "Service"
                 // Per JSR-181 MR Sec 4.1, pg 15
             	if (getServiceDescriptionImpl().isDBCMap()) {
-                	annotation_ServiceName = getSimpleJavaClassName(composite.getClassName())
+ "Service";
+                	annotation_ServiceName = DescriptionUtils.getSimpleJavaClassName(composite.getClassName())
+ "Service";
             	} else {
-                    annotation_ServiceName = getSimpleJavaClassName(implOrSEIClass) + "Service";
+                    annotation_ServiceName = DescriptionUtils.getSimpleJavaClassName(implOrSEIClass)
+ "Service";
             	}
             }
         }
@@ -882,8 +882,8 @@
                     // name element on the WebServiceProvider annotation
                 	
                 	annotation_PortName = (getServiceDescriptionImpl().isDBCMap()) ?
-                 			getSimpleJavaClassName(composite.getClassName()) + "Port"
-                 			: getSimpleJavaClassName(implOrSEIClass) + "Port";
+                            DescriptionUtils.getSimpleJavaClassName(composite.getClassName())
+ "Port"
+                 			: DescriptionUtils.getSimpleJavaClassName(implOrSEIClass) + "Port";
                }
                 else {
                     // This is the @WebService annotation path
@@ -912,10 +912,10 @@
                 // FIXME: Hardcoded protocol for namespace
             	if (getServiceDescriptionImpl().isDBCMap())
             		annotation_TargetNamespace = 
-            			makeNamespaceFromPackageName(getJavaPackageName(composite.getClassName()),
"http");
+                        DescriptionUtils.makeNamespaceFromPackageName(DescriptionUtils.getJavaPackageName(composite.getClassName()),
"http");
             	else
             		annotation_TargetNamespace = 
-            			makeNamespaceFromPackageName(getJavaPackageName(implOrSEIClass), "http");
+                        DescriptionUtils.makeNamespaceFromPackageName(DescriptionUtils.getJavaPackageName(implOrSEIClass),
"http");
 
             }
         }
@@ -923,127 +923,6 @@
     }
     
     
-    /**
-     * Return the name of the class without any package qualifier.
-     * This method should be DEPRECATED when DBC support is complete
-     * @param theClass
-     * @return the name of the class sans package qualification.
-     */
-    private static String getSimpleJavaClassName(Class theClass) {
-        String returnName = null;
-        if (theClass != null) {
-            String fqName = theClass.getName();
-            // We need the "simple name", so strip off any package information from the name
-            int endOfPackageIndex = fqName.lastIndexOf('.');
-            int startOfClassIndex = endOfPackageIndex + 1;
-            returnName = fqName.substring(startOfClassIndex);
-        }
-        else {
-            // TODO: RAS and NLS
-            throw new UnsupportedOperationException("Java class is null");
-        }
-        return returnName;
-    }
-    
-    /**
-     * Return the name of the class without any package qualifier.
-     * @param theClass
-     * @return the name of the class sans package qualification.
-     */
-    private static String getSimpleJavaClassName(String name) {
-        String returnName = null;
-        
-        if (name != null) {
-            String fqName = name;
-            
-            // We need the "simple name", so strip off any package information from the name
-            int endOfPackageIndex = fqName.lastIndexOf('.');
-            int startOfClassIndex = endOfPackageIndex + 1;
-            returnName = fqName.substring(startOfClassIndex);
-        }
-        else {
-            // TODO: RAS and NLS
-            throw new UnsupportedOperationException("Java class is null");
-        }
-        return returnName;
-    }
-    
-    /**
-     * Returns the package name from the class.  If no package, then returns null
-     * This method should be DEPRECATED when DBC support is complete
-     * @param theClass
-     * @return
-     */
-    private static String getJavaPackageName(Class theClass) {
-        String returnPackage = null;
-        if (theClass != null) {
-            String fqName = theClass.getName();
-            // Get the package name, if there is one
-            int endOfPackageIndex = fqName.lastIndexOf('.');
-            if (endOfPackageIndex >= 0) {
-                returnPackage = fqName.substring(0, endOfPackageIndex);
-            }
-        }
-        else {
-            // TODO: RAS and NLS
-            throw new UnsupportedOperationException("Java class is null");
-        }
-        return returnPackage;
-    }
-    
-    /**
-     * Returns the package name from the class.  If no package, then returns null
-     * @param theClassName
-     * @return
-     */
-    private static String getJavaPackageName(String theClassName) {
-        String returnPackage = null;
-        if (theClassName != null) {
-            String fqName = theClassName;
-            // Get the package name, if there is one
-            int endOfPackageIndex = fqName.lastIndexOf('.');
-            if (endOfPackageIndex >= 0) {
-                returnPackage = fqName.substring(0, endOfPackageIndex);
-            }
-        }
-        else {
-            // TODO: RAS and NLS
-            throw new UnsupportedOperationException("Java class is null");
-        }
-        return returnPackage;
-    }
-    
-    /**
-     * Create a JAX-WS namespace based on the package name
-     * @param packageName
-     * @param protocol
-     * @return
-     */
-    private static final String NO_PACKAGE_HOST_NAME = "DefaultNamespace";
-
-    private static String makeNamespaceFromPackageName(String packageName, String protocol)
{
-        if (DescriptionUtils.isEmpty(protocol)) {
-            protocol = "http";
-        }
-        if (DescriptionUtils.isEmpty(packageName)) {
-            return protocol + "://" + NO_PACKAGE_HOST_NAME;
-        }
-        StringTokenizer st = new StringTokenizer( packageName, "." );
-        String[] words = new String[ st.countTokens() ];
-        for(int i = 0; i < words.length; ++i)
-            words[i] = st.nextToken();
-
-        StringBuffer sb = new StringBuffer(80);
-        for(int i = words.length-1; i >= 0; --i) {
-            String word = words[i];
-            // seperate with dot
-            if( i != words.length-1 )
-                sb.append('.');
-            sb.append( word );
-        }
-        return protocol + "://" + sb.toString() + "/";
-    }
-
     // ===========================================
     // ANNOTATION: WebServiceProvider
     // ===========================================
@@ -1097,10 +976,10 @@
     			else {
     				if (getServiceDescriptionImpl().isDBCMap()) {
     					//The name is the simple name of the class or interface
-    					webService_Name = getSimpleJavaClassName(composite.getClassName());
+    					webService_Name = DescriptionUtils.getSimpleJavaClassName(composite.getClassName());
     				} else {
     					// Default per JSR-181 Sec 4.1, pg 15
-    					webService_Name = getSimpleJavaClassName(implOrSEIClass);
+    					webService_Name = DescriptionUtils.getSimpleJavaClassName(implOrSEIClass);
     				}
     			}                	
     		}

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java?view=diff&rev=477703&r1=477702&r2=477703
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java
Tue Nov 21 07:43:45 2006
@@ -24,6 +24,7 @@
 import java.util.Iterator;
 import java.util.List;
 
+import javax.jws.WebService;
 import javax.jws.soap.SOAPBinding;
 import javax.wsdl.Binding;
 import javax.wsdl.Definition;
@@ -67,6 +68,11 @@
     // ANNOTATION related information
     // ===========================================
     
+    // ANNOTATION: @WebService
+    private WebService          webServiceAnnotation;
+    private String              webServiceTargetNamespace;
+    
+    
     // ANNOTATION: @SOAPBinding
     // Note this is the Type-level annotation.  See OperationDescription for the Method-level
annotation
     private SOAPBinding         soapBindingAnnotation;
@@ -638,6 +644,48 @@
             portType = wsdlDefn.getPortType(new QName(tns, localPart));
         }
         return portType;
+    }
+
+    
+    public String getTargetNamespace() {
+        // REVIEW: WSDL/Anno mertge
+        return getAnnoWebServiceTargetNamespace();
+    }
+
+    public WebService getAnnoWebService() {
+        // TODO Auto-generated method stub
+        if (webServiceAnnotation == null) {
+            if (dbc != null) {
+                webServiceAnnotation = dbc.getWebServiceAnnot();
+            } else {
+                if (seiClass != null) {
+                    webServiceAnnotation = (WebService) seiClass.getAnnotation(WebService.class);
               
+                }
+            }
+        }
+        return webServiceAnnotation;
+    }
+
+    public String getAnnoWebServiceTargetNamespace() {
+        if (webServiceTargetNamespace == null) {
+            if (getAnnoWebService() != null 
+                    && !DescriptionUtils.isEmpty(getAnnoWebService().targetNamespace()))
{
+                webServiceTargetNamespace = getAnnoWebService().targetNamespace();
+            }
+            else {
+                // Default value per JSR-181 MR Sec 4.1 pg 15 defers to "Implementation defined,

+                // as described in JAX-WS 2.0, section 3.2" which is JAX-WS 2.0 Sec 3.2,
pg 29.
+                // FIXME: Hardcoded protocol for namespace
+                if (dbc != null)
+                    webServiceTargetNamespace = 
+                        DescriptionUtils.makeNamespaceFromPackageName(DescriptionUtils.getJavaPackageName(dbc.getClassName()),
"http");
+                else
+                    webServiceTargetNamespace = 
+                        DescriptionUtils.makeNamespaceFromPackageName(DescriptionUtils.getJavaPackageName(seiClass),
"http");
+
+            }
+        }
+        return webServiceTargetNamespace;
     }
 
 }

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java?view=diff&rev=477703&r1=477702&r2=477703
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
Tue Nov 21 07:43:45 2006
@@ -573,9 +573,8 @@
             }
             else {
                 // The default value for targetNamespace is the target namespace of the SEI.
[JAX-WS Sec 7.3, p. 80]
-                // TODO: Implement getting the TNS from the SEI 
-//                requestWrapperTargetNamespace = getEndpointInterfaceDescription().getWebServiceTargetNamespace();
-                throw new UnsupportedOperationException("RequestWrapper.targetNamespace default
not implented yet");            }
+                requestWrapperTargetNamespace = getEndpointInterfaceDescription().getTargetNamespace();
+            }
         }
         return requestWrapperTargetNamespace;
     }
@@ -676,8 +675,7 @@
             else {
                 // The default value for targetNamespace is the target namespace of the SEI.
[JAX-WS Sec 7.3, p. 80]
                 // TODO: Implement getting the TNS from the SEI 
-//                responseWrapperTargetNamespace = getEndpointInterfaceDescription().getWebServiceTargetNamespace();
-                throw new UnsupportedOperationException("RequestWrapper.targetNamespace default
not implented yet");
+                responseWrapperTargetNamespace = getEndpointInterfaceDescription().getTargetNamespace();
             }
         }
         return responseWrapperTargetNamespace;

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/AnnotationServiceImplDescriptionTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/AnnotationServiceImplDescriptionTests.java?view=diff&rev=477703&r1=477702&r2=477703
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/AnnotationServiceImplDescriptionTests.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/AnnotationServiceImplDescriptionTests.java
Tue Nov 21 07:43:45 2006
@@ -373,7 +373,8 @@
         assertNotNull(operationDesc);
         assertEquals("wrappedParams", operationDesc.getRequestWrapperLocalName());
         assertEquals("wrappedParamsResponse", operationDesc.getResponseWrapperLocalName());
-        // TODO: Tests for request and response wrapper namespace; currently throws UnsupportedOperationException
+        assertEquals("http://description.jaxws.axis2.apache.org/", operationDesc.getRequestWrapperTargetNamespace());
+        assertEquals("http://description.jaxws.axis2.apache.org/", operationDesc.getResponseWrapperTargetNamespace());
         assertEquals("org.apache.axis2.jaxws.description.WrappedParams", operationDesc.getRequestWrapperClassName());
         assertEquals("org.apache.axis2.jaxws.description.WrappedParams", operationDesc.getResponseWrapperClassName());
         // Test WebResult annotation defaults
@@ -408,7 +409,8 @@
         assertNotNull(operationDesc);
         assertEquals("wrappedParams", operationDesc.getRequestWrapperLocalName());
         assertEquals("wrappedParamsResponse", operationDesc.getResponseWrapperLocalName());
-        // TODO: Tests for request and response wrapper namespace; currently throws UnsupportedOperationException
+        assertEquals("http://description.jaxws.axis2.apache.org/", operationDesc.getRequestWrapperTargetNamespace());
+        assertEquals("http://description.jaxws.axis2.apache.org/", operationDesc.getResponseWrapperTargetNamespace());
         assertEquals("org.apache.axis2.jaxws.description.WrappedParams", operationDesc.getRequestWrapperClassName());
         assertEquals("org.apache.axis2.jaxws.description.WrappedParams", operationDesc.getResponseWrapperClassName());
 

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/WSDLDescriptionTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/WSDLDescriptionTests.java?view=diff&rev=477703&r1=477702&r2=477703
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/WSDLDescriptionTests.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/WSDLDescriptionTests.java
Tue Nov 21 07:43:45 2006
@@ -150,7 +150,7 @@
         assertNull(endpointInterfaceDesc);
     }
     
-    public void testInvalidAddPort() {
+    public void testInvalidAddPortExists() {
         try {
             service.addPort(validPortQName, null, null);
             fail("Shouldn't be able to add a port that exists in the WSDL");
@@ -160,7 +160,8 @@
         }
     }
     
-    public void testInvalidAddPortNull() {
+    public void testInvalidAddPort() {
+        // Null portQname
         try {
             service.addPort(null, null, null);
             fail("Shouldn't be able to add a port with a null QName");
@@ -171,6 +172,43 @@
         catch (Exception e) {
             fail("Unexpected exception caught " + e);
         }
+        
+        // Empty Port QName
+        try {
+            service.addPort(new QName("", ""), null, null);
+            fail("Shouldn't be able to add an empty port QName");
+        }
+        catch (WebServiceException e) {
+            // Expected path
+        }
+        catch (Exception e) {
+            fail("Unexpected exception caught " + e);
+        }
+
+        // Empty binding ID
+        try {
+            service.addPort(new QName(VALID_NAMESPACE, "dispatchPort2"), "", null);
+            fail("Shouldn't be able to add a port with an empty binding type");
+        }
+        catch (WebServiceException e) {
+            // Expected path
+        }
+        catch (Exception e) {
+            fail("Unexpected exception caught " + e);
+        }
+
+        // Invalid binding ID
+        try {
+            service.addPort(new QName(VALID_NAMESPACE, "dispatchPort3"), "InvalidBindingType",
null);
+            fail("Shouldn't be able to add a port with an invalid binding type");
+        }
+        catch (WebServiceException e) {
+            // Expected path
+        }
+        catch (Exception e) {
+            fail("Unexpected exception caught " + e);
+        }
+
     }
     
     public void testValidAddAndGetPort() {



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message