cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject svn commit: r467264 - in /incubator/cxf/trunk: rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/frontend/jaxws/template/ tools/wsdl2java/src/test/java/org/apache/cxf/tools/wsdl2j...
Date Tue, 24 Oct 2006 07:28:33 GMT
Author: mmao
Date: Tue Oct 24 00:28:32 2006
New Revision: 467264

URL: http://svn.apache.org/viewvc?view=rev&rev=467264
Log:
[CXF-163] 
* WSDL2java add the endpointInterface element into the WebService annotation into the impl
code.
* RT check the WebService annotation in the interface when the endpointInterface element missing
from the WebService annotation in the impl code.

Modified:
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java
    incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/frontend/jaxws/template/impl.vm
    incubator/cxf/trunk/tools/wsdl2java/src/test/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToJavaProcessorTest.java

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java?view=diff&rev=467264&r1=467263&r2=467264
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsImplementorInfo.java
Tue Oct 24 00:28:32 2006
@@ -134,13 +134,26 @@
             return new QName(namespace, "NoNamedPort");
         }        
     }
+        
+    @SuppressWarnings("unchecked")
+    private String getWSInterfaceName(Class implClz) {
+        Class[] clzs = implClz.getInterfaces();
+        for (Class clz : clzs) {
+            if (null != clz.getAnnotation(WebService.class)) {
+                return clz.getName();
+            }
+        }
+        return null;
+    }
 
     private void initialise() {
         implementorAnnotation = implementorClass.getAnnotation(WebService.class);
         if (null != implementorAnnotation) {
-
             String sei = implementorAnnotation.endpointInterface();
-            if (null != sei && !"".equals(sei)) {
+            if (StringUtils.isEmpty(sei)) {
+                sei = getWSInterfaceName(implementorClass);                
+            }
+            if (!StringUtils.isEmpty(sei)) {
                 try {
                     seiClass = ClassLoaderUtils.loadClass(sei, implementorClass);
                 } catch (ClassNotFoundException ex) {
@@ -150,12 +163,9 @@
                 if (null == seiAnnotation) {
                     throw new WebServiceException(BUNDLE.getString("SEI_WITHOUT_WEBSERVICE_ANNOTATION_EXC"));
                 }
-                String portName = seiAnnotation.portName();
-                String serviceName = seiAnnotation.serviceName();
-                String endpointInterface = seiAnnotation.endpointInterface();
-                if ((null != portName && !"".equals(portName))
-                    || (null != serviceName && !"".equals(serviceName))
-                    || (null != endpointInterface && !"".equals(endpointInterface)))
{
+                if (!StringUtils.isEmpty(seiAnnotation.portName())
+                    || !StringUtils.isEmpty(seiAnnotation.serviceName())
+                    || !StringUtils.isEmpty(seiAnnotation.endpointInterface())) {
                     String expString = BUNDLE.getString("ILLEGAL_ATTRIBUTE_IN_SEI_ANNOTATION_EXC");
                     throw new WebServiceException(expString);
                 }

Modified: incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/frontend/jaxws/template/impl.vm
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/frontend/jaxws/template/impl.vm?view=diff&rev=467264&r1=467263&r2=467264
==============================================================================
--- incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/frontend/jaxws/template/impl.vm
(original)
+++ incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/frontend/jaxws/template/impl.vm
Tue Oct 24 00:28:32 2006
@@ -39,7 +39,8 @@
 @javax.jws.WebService(name = "$intf.Name", serviceName = "$service",
                       portName = "$port",
                       targetNamespace = "$intf.Namespace", 
-                      wsdlLocation = "$intf.Location")
+                      wsdlLocation = "$intf.Location" ,
+		      endpointInterface = "$intf.PackageName.$intf.Name")
                       
 public class ${intf.Name}Impl implements $intf.Name {
 

Modified: incubator/cxf/trunk/tools/wsdl2java/src/test/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToJavaProcessorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdl2java/src/test/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToJavaProcessorTest.java?view=diff&rev=467264&r1=467263&r2=467264
==============================================================================
--- incubator/cxf/trunk/tools/wsdl2java/src/test/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToJavaProcessorTest.java
(original)
+++ incubator/cxf/trunk/tools/wsdl2java/src/test/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToJavaProcessorTest.java
Tue Oct 24 00:28:32 2006
@@ -55,6 +55,7 @@
                                               + File.separatorChar);
         classLoader = AnnotationUtil.getClassLoader(Thread.currentThread().getContextClassLoader());
         env.put(ToolConstants.CFG_COMPILE, "compile");
+        env.put(ToolConstants.CFG_IMPL, "impl");
         env.put(ToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
         env.put(ToolConstants.CFG_CLASSDIR, output.getCanonicalPath() + "/classes");
     }
@@ -81,7 +82,7 @@
         File types = new File(helloworldsoaphttp, "types");
         assertTrue(types.exists());
         File[] files = helloworldsoaphttp.listFiles();
-        assertEquals(3, files.length);
+        assertEquals(4, files.length);
         files = types.listFiles();
         assertEquals(files.length, 3);
 
@@ -100,6 +101,15 @@
         Class paraClass = classLoader.loadClass("org.apache.hello_world_rpclit.types.MyComplexStruct");
         Method method = clz.getMethod("sendReceiveData", new Class[] {paraClass});
         assertEquals("MyComplexStruct", method.getReturnType().getSimpleName());
+        
+        clz = classLoader.loadClass("org.apache.hello_world_rpclit.GreeterRPCLitImpl");
+        assertNotNull(clz);
+        ws = AnnotationUtil.getPrivClassAnnotation(clz, javax.jws.WebService.class);
+        assertNotNull(ws);
+        assertTrue("Webservice annotation wsdlLocation should begin with file", ws.wsdlLocation()
+                   .startsWith("file"));
+        assertEquals("org.apache.hello_world_rpclit.GreeterRPCLit", ws.endpointInterface());
+        assertEquals("GreeterRPCLit", ws.name());
     }
 
     public void testAsynMethod() throws Exception {
@@ -117,7 +127,7 @@
         assertTrue(async.exists());
 
         File[] files = async.listFiles();
-        assertEquals(3, files.length);
+        assertEquals(4, files.length);
 
         Class clz = classLoader.loadClass("org.apache.hello_world_async_soap_http.GreeterAsync");
 
@@ -152,7 +162,7 @@
         File types = new File(helloworldsoaphttp, "types");
         assertTrue(types.exists());
         File[] files = helloworldsoaphttp.listFiles();
-        assertEquals(4, files.length);
+        assertEquals(5, files.length);
         files = types.listFiles();
         assertEquals(7, files.length);
 
@@ -210,7 +220,7 @@
         File types = new File(helloworldsoaphttp, "types");
         assertTrue(types.exists());
         File[] files = helloworldsoaphttp.listFiles();
-        assertEquals(6, files.length);
+        assertEquals(7, files.length);
         files = types.listFiles();
         assertEquals(17, files.length);
 
@@ -282,7 +292,7 @@
         File mapping = new File(apache, "mapping");
         assertTrue(mapping.exists());
         File[] files = mapping.listFiles();
-        assertEquals(6, files.length);
+        assertEquals(7, files.length);
 
         Class clz = classLoader.loadClass("org.apache.mapping.SomethingServer");
         Method method = clz.getMethod("doSomething", new Class[] {int.class, javax.xml.ws.Holder.class,
@@ -319,7 +329,7 @@
         File schemaImport = new File(apache, "schema_import");
         assertTrue(schemaImport.exists());
         files = schemaImport.listFiles();
-        assertEquals(3, files.length);
+        assertEquals(4, files.length);
 
         Class clz = classLoader.loadClass("org.apache.schema_import.Greeter");
         assertEquals(4, clz.getMethods().length);
@@ -370,7 +380,7 @@
         assertTrue(exceptionCollision.exists());
 
         File[] files = invoiceserver.listFiles();
-        assertEquals(12, files.length);
+        assertEquals(13, files.length);
         files = invoice.listFiles();
         assertEquals(files.length, 9);
 
@@ -396,7 +406,7 @@
         assertTrue(apache.exists());
 
         File[] files = apache.listFiles();
-        assertEquals(13, files.length);
+        assertEquals(14, files.length);
 
         File typeCollision = new File(apache, "Greeter_Type.java");
         assertTrue(typeCollision.exists());
@@ -427,7 +437,7 @@
         assertTrue(apache.exists());
 
         File[] files = apache.listFiles();
-        assertEquals(3, files.length);
+        assertEquals(4, files.length);
 
         File serviceCollision = new File(apache, "HelloWorldServiceImpl_Service.java");
         assertTrue(serviceCollision.exists());
@@ -473,7 +483,7 @@
         assertTrue(apache.exists());
 
         File[] files = apache.listFiles();
-        assertEquals(11, files.length);
+        assertEquals(12, files.length);
 
         Class clz = classLoader.loadClass("org.apache.HeaderTester");
         assertEquals(3, clz.getMethods().length);
@@ -564,7 +574,7 @@
         assertTrue(cxf.exists());
 
         File[] files = apache.listFiles();
-        assertEquals(5, files.length);
+        assertEquals(6, files.length);
         files = cxf.listFiles();
         assertEquals(17, files.length);
 
@@ -594,7 +604,7 @@
 
         File cxf = new File(org, "cxf");
         files = cxf.listFiles();
-        assertEquals(5, files.length);
+        assertEquals(6, files.length);
 
         Class clz = classLoader.loadClass("org.cxf.Greeter");
         assertTrue("Generate " + clz.getName() + "error", clz.isInterface());
@@ -615,7 +625,7 @@
         assertTrue(address.exists());
 
         File[] files = address.listFiles();
-        assertEquals(4, files.length);
+        assertEquals(5, files.length);
         File handlerConfig = new File(address, "Greeter_handler.xml");
         assertTrue(handlerConfig.exists());
 
@@ -790,7 +800,7 @@
         File xsd = new File(soapinterop, "xsd");
         assertTrue(xsd.exists());
         File[] files = wsdlinterop.listFiles();
-        assertEquals(3, files.length);
+        assertEquals(4, files.length);
         files = xsd.listFiles();
         assertEquals(4, files.length);
 



Mime
View raw message