cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r483393 - in /incubator/cxf/trunk/rt: bindings/soap/src/main/java/org/apache/cxf/binding/soap/ frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ frontend/jaxws/src/test/java/org/apache/cxf...
Date Thu, 07 Dec 2006 09:35:17 GMT
Author: ningjiang
Date: Thu Dec  7 01:35:14 2006
New Revision: 483393

URL: http://svn.apache.org/viewvc?view=rev&rev=483393
Log:
[JIRA CXF-294] Added unit test for the code first client side test

Added:
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/HelloInterface.java
  (with props)
Modified:
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapDestinationFactory.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/AbstractJaxWsTest.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapDestinationFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapDestinationFactory.java?view=diff&rev=483393&r1=483392&r2=483393
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapDestinationFactory.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapDestinationFactory.java
Thu Dec  7 01:35:14 2006
@@ -62,8 +62,8 @@
         SoapBindingInfo binding = (SoapBindingInfo)ei.getBinding();
         DestinationFactory destinationFactory;
         try {
-            destinationFactory = bus.getExtension(DestinationFactoryManager.class)
-                .getDestinationFactory(binding.getTransportURI());
+            DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
+            destinationFactory = dfm.getDestinationFactory(binding.getTransportURI());
 
             return destinationFactory.getDestination(ei);
         } catch (BusException e) {

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java?view=diff&rev=483393&r1=483392&r2=483393
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
Thu Dec  7 01:35:14 2006
@@ -40,6 +40,7 @@
 import javax.xml.ws.Service.Mode;
 import javax.xml.ws.WebServiceException;
 import javax.xml.ws.handler.HandlerResolver;
+import javax.xml.ws.http.HTTPBinding;
 import javax.xml.ws.spi.ServiceDelegate;
 
 import org.apache.cxf.Bus;
@@ -309,17 +310,16 @@
         String transportId = df.getTransportIds().get(0);
         String bindingUri = portInfo.getBindingUri();
 
-        // TODO: Replace with discovery mechanism!!
+        // TODO: Replace with discovery mechanism, now it just the hardcode        
         AbstractBindingInfoFactoryBean bindingFactory = null;
-        if (bindingUri.equals(XMLConstants.NS_XML_FORMAT)) {
+        if (bindingUri.equals(XMLConstants.NS_XML_FORMAT) 
+            || bindingUri.equals(HTTPBinding.HTTP_BINDING)) {
             bindingFactory = new XMLBindingInfoFactoryBean();
-        } else if ("http://schemas.xmlsoap.org/soap/".equals(bindingUri)) {
+        } else { // we set the default binding to be soap binding
             JaxWsSoapBindingInfoFactoryBean soapBindingFactory = new JaxWsSoapBindingInfoFactoryBean();
             soapBindingFactory.setTransportURI(transportId);
             bindingFactory = soapBindingFactory;
-        } else {
-            bindingFactory = new XMLBindingInfoFactoryBean();
-        }
+        } 
 
         bindingFactory.setServiceFactory(serviceFactory);
 

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/AbstractJaxWsTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/AbstractJaxWsTest.java?view=diff&rev=483393&r1=483392&r2=483393
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/AbstractJaxWsTest.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/AbstractJaxWsTest.java
Thu Dec  7 01:35:14 2006
@@ -55,11 +55,13 @@
         soapDF.setBus(bus);
         dfm.registerDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/", soapDF);
         dfm.registerDestinationFactory("http://schemas.xmlsoap.org/soap/", soapDF);
+        dfm.registerDestinationFactory("http://cxf.apache.org/transports/local", soapDF);
         
         localTransport = new LocalTransportFactory();
         dfm.registerDestinationFactory("http://schemas.xmlsoap.org/soap/http", localTransport);
         dfm.registerDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/http", localTransport);
         dfm.registerDestinationFactory("http://cxf.apache.org/bindings/xformat", localTransport);
+        dfm.registerDestinationFactory("http://cxf.apache.org/transports/local", localTransport);
 
         ConduitInitiatorManager extension = bus.getExtension(ConduitInitiatorManager.class);
         extension.registerConduitInitiator(LocalTransportFactory.TRANSPORT_ID, localTransport);

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java?view=diff&rev=483393&r1=483392&r2=483393
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java
Thu Dec  7 01:35:14 2006
@@ -18,16 +18,22 @@
  */
 package org.apache.cxf.jaxws;
 
+import java.net.URL;
 import java.util.Collection;
 
+
 import javax.wsdl.Definition;
 import javax.wsdl.factory.WSDLFactory;
+import javax.xml.namespace.QName;
+
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 
 import org.apache.cxf.Bus;
+
 import org.apache.cxf.jaxws.service.Hello;
+import org.apache.cxf.jaxws.service.HelloInterface;
 import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.factory.ServerFactoryBean;
@@ -37,7 +43,7 @@
 import org.apache.cxf.wsdl11.ServiceWSDLBuilder;
 
 public class CodeFirstTest extends AbstractJaxWsTest {
-    String address = "http://localhost:9000/Hello";
+    String address = "local://localhost:9000/Hello";
     
     public void testDocLitModel() throws Exception {
         Definition d = createService(false);
@@ -105,24 +111,42 @@
         Hello service = new Hello();
 
         EndpointImpl ep = new EndpointImpl(getBus(), service, (String) null);
-        ep.publish("http://localhost:9090/hello");
+        ep.publish("local://localhost:9090/hello");
 
-        Node res = invoke("http://localhost:9090/hello", 
+        Node res = invoke("local://localhost:9090/hello", 
                           LocalTransportFactory.TRANSPORT_ID,
                           "sayHi.xml");
         
         assertNotNull(res);
-
+       
         addNamespace("h", "http://service.jaxws.cxf.apache.org");
         assertValid("//s:Body/h:sayHiResponse/h:return", res);
         
-        res = invoke("http://localhost:9090/hello", 
+        res = invoke("local://localhost:9090/hello", 
                      LocalTransportFactory.TRANSPORT_ID,
                      "getGreetings.xml");
 
         assertNotNull(res);
-
+        
         addNamespace("h", "http://service.jaxws.cxf.apache.org");
         assertValid("//s:Body/h:getGreetingsResponse/h:return/item", res);
+    }
+    
+    public void testClient() throws Exception {
+        Hello serviceImpl = new Hello();
+        EndpointImpl ep = new EndpointImpl(getBus(), serviceImpl, (String) null);
+        ep.publish("local://localhost:9090/hello");
+        
+        QName serviceName = new QName("http://service.jaxws.cxf.apache.org", "Hello");
+        QName portName = new QName("http://service.jaxws.cxf.apache.org", "HelloPortType");
+        
+        // need to set the same bus with service , so use the ServiceImpl
+        ServiceImpl service = new ServiceImpl(getBus(), (URL)null, serviceName, null);
+        service.addPort(portName, "http://schemas.xmlsoap.org/soap/", "local://localhost:9090/hello");

+        HelloInterface proxy = service.getPort(portName, HelloInterface.class);
+        assertEquals("Get the wrong result", "hello", proxy.sayHi("hello"));
+        //now the client side can't unmarshal the complex type without binding types annoutation

+        //List<String> result = proxy.getGreetings();
+        //assertEquals(2, result.size());
     }
 }

Added: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/HelloInterface.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/HelloInterface.java?view=auto&rev=483393
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/HelloInterface.java
(added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/HelloInterface.java
Thu Dec  7 01:35:14 2006
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.jaxws.service;
+
+import java.util.List;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+@WebService
+public interface HelloInterface {
+    @WebMethod
+    String sayHi(String text);
+    @WebMethod
+    List<String> getGreetings();
+}

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/HelloInterface.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/HelloInterface.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message