cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r700960 - in /cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis: AbstractAegisTest.java type/java5/CollectionServiceInterface.java type/java5/CollectionTest.java
Date Wed, 01 Oct 2008 22:39:16 GMT
Author: bimargulies
Date: Wed Oct  1 15:39:15 2008
New Revision: 700960

URL: http://svn.apache.org/viewvc?rev=700960&view=rev
Log:
Instant unit test case to disprove CXF-1833.

Modified:
    cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/AbstractAegisTest.java
    cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionServiceInterface.java
    cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTest.java

Modified: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/AbstractAegisTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/AbstractAegisTest.java?rev=700960&r1=700959&r2=700960&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/AbstractAegisTest.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/AbstractAegisTest.java
Wed Oct  1 15:39:15 2008
@@ -46,6 +46,8 @@
 import org.apache.cxf.endpoint.ServerRegistry;
 import org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory;
 import org.apache.cxf.frontend.ServerFactoryBean;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.test.AbstractCXFTest;
 import org.apache.cxf.transport.ConduitInitiatorManager;
@@ -62,11 +64,10 @@
 public abstract class AbstractAegisTest extends AbstractCXFTest {
     protected LocalTransportFactory localTransport;
 
-
     @Before
     public void setUp() throws Exception {
         super.setUpBus();
-        
+
         SoapBindingFactory bindingFactory = new SoapBindingFactory();
         bindingFactory.setBus(bus);
 
@@ -80,7 +81,7 @@
         dfm.registerDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/", soapDF);
         dfm.registerDestinationFactory(SoapBindingConstants.SOAP11_BINDING_ID, 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);
@@ -92,15 +93,13 @@
         extension.registerConduitInitiator("http://schemas.xmlsoap.org/wsdl/soap/", localTransport);
         extension.registerConduitInitiator("http://schemas.xmlsoap.org/soap/http", localTransport);
         extension.registerConduitInitiator(SoapBindingConstants.SOAP11_BINDING_ID, localTransport);
-        
+
         bus.setExtension(new WSDLManagerImpl(), WSDLManager.class);
-        
 
         addNamespace("wsdl", SOAPConstants.WSDL11_NS);
         addNamespace("wsdlsoap", SOAPConstants.WSDL11_SOAP_NS);
         addNamespace("xsd", SOAPConstants.XSD);
 
-
     }
 
     @Override
@@ -109,87 +108,101 @@
         BusFactory.setDefaultBus(bus);
         return bus;
     }
-    
+
     protected Node invoke(String service, String message) throws Exception {
         return invoke("local://" + service, LocalTransportFactory.TRANSPORT_ID, message);
     }
-    
+
     public Server createService(Class serviceClass, QName name) {
         return createService(serviceClass, null, name);
     }
-    
+
     public Server createService(Class serviceClass, Object serviceBean, QName name) {
         return createService(serviceClass, serviceBean, serviceClass.getSimpleName(), name);
     }
-    
+
     protected Server createService(Class serviceClass, QName name, AegisDatabinding binding)
{
         return createService(serviceClass, serviceClass.getSimpleName(), name, binding);
     }
 
-    protected Server createService(Class serviceClass, 
-                                   String address, QName name, 
-                                    AegisDatabinding binding) {
+    protected Server createService(Class serviceClass, String address, QName name, AegisDatabinding
binding) {
         ServerFactoryBean sf = createServiceFactory(serviceClass, null, address, name, binding);
         return sf.create();
     }
-    
+
     protected Server createService(Class serviceClass, String address) {
         ServerFactoryBean sf = createServiceFactory(serviceClass, null, address, null, null);
         return sf.create();
     }
-    
+
     protected Server createService(Class serviceClass) {
-        ServerFactoryBean sf = createServiceFactory(serviceClass, null, 
-                                                    serviceClass.getSimpleName(), null, null);
+        ServerFactoryBean sf = createServiceFactory(serviceClass, null, serviceClass.getSimpleName(),
null,
+                                                    null);
         return sf.create();
     }
-    
-    public Server createService(Class serviceClass,
-                                Object serviceBean, 
-                                String address,
-                                QName name) {
+
+    protected Server createJaxwsService(Class serviceClass, Object serviceBean, String address,
QName name) {
+        if (address == null) {
+            address = serviceClass.getSimpleName();
+        }
+        JaxWsServiceFactoryBean sf = new JaxWsServiceFactoryBean();
+        sf.setDataBinding(new AegisDatabinding());
+        JaxWsServerFactoryBean serverFactoryBean = new JaxWsServerFactoryBean();
+        serverFactoryBean.setServiceClass(serviceClass);
+        
+        if (serviceBean != null) {
+            serverFactoryBean.setServiceBean(serviceBean);
+        }
+
+        serverFactoryBean.setAddress("local://" + address);
+            
+        serverFactoryBean.setServiceFactory(sf);
+        if (name != null) {
+            serverFactoryBean.setEndpointName(name);
+        }
+        return serverFactoryBean.create();
+    }
+
+    public Server createService(Class serviceClass, Object serviceBean, String address, QName
name) {
         ServerFactoryBean sf = createServiceFactory(serviceClass, serviceBean, address, name,
null);
         return sf.create();
     }
-    
-    public Server createService(Class serviceClass,
-                                Object serviceBean, 
-                                String address,
+
+    public Server createService(Class serviceClass, Object serviceBean, String address,
                                 AegisDatabinding binding) {
         ServerFactoryBean sf = createServiceFactory(serviceClass, serviceBean, address, null,
binding);
         return sf.create();
     }
 
-    protected ServerFactoryBean createServiceFactory(Class serviceClass, 
-                                                     Object serviceBean, 
-                                                     String address, 
-                                                     QName name,
-                                                     AegisDatabinding binding) {
+    protected ServerFactoryBean createServiceFactory(Class serviceClass, Object serviceBean,
String address,
+                                                     QName name, AegisDatabinding binding)
{
         ServerFactoryBean sf = new ServerFactoryBean();
         sf.setServiceClass(serviceClass);
         if (serviceBean != null) {
             sf.setServiceBean(serviceBean);
-        }    
+        }
         sf.getServiceFactory().setServiceName(name);
         sf.setAddress("local://" + address);
         setupAegis(sf, binding);
         return sf;
     }
-    protected void setupAegis(AbstractWSDLBasedEndpointFactory sf) { 
+
+    protected void setupAegis(AbstractWSDLBasedEndpointFactory sf) {
         setupAegis(sf, null);
     }
+
     @SuppressWarnings("deprecation")
     protected void setupAegis(AbstractWSDLBasedEndpointFactory sf, AegisDatabinding binding)
{
         if (binding == null) {
             binding = new AegisDatabinding();
         }
-        sf.getServiceFactory().getServiceConfigurations().add(0, 
-            new org.apache.cxf.aegis.databinding.AegisServiceConfiguration());
+        sf.getServiceFactory().getServiceConfigurations()
+            .add(0, new org.apache.cxf.aegis.databinding.AegisServiceConfiguration());
         sf.getServiceFactory().setDataBinding(binding);
     }
 
     protected Collection<Document> getWSDLDocuments(String string) throws WSDLException
{
-        WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter();        
+        WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter();
 
         Collection<Document> docs = new ArrayList<Document>();
         Definition definition = getWSDLDefinition(string);
@@ -197,7 +210,7 @@
             return null;
         }
         docs.add(writer.getDocument(definition));
-        
+
         for (Import wsdlImport : WSDLDefinitionBuilder.getImports(definition)) {
             docs.add(writer.getDocument(wsdlImport.getDefinition()));
         }
@@ -214,26 +227,26 @@
             }
         }
         return null;
-        
+
     }
-    
+
     protected void assertXPathEquals(String xpath, String value, Element element) throws
Exception {
         org.w3c.dom.Document doc = new DOMOutputter().output(element.getDocument());
         assertXPathEquals(xpath, value, doc);
     }
-    
+
     protected NodeList assertValid(String xpath, Element element) throws Exception {
         org.w3c.dom.Document doc = new DOMOutputter().output(element.getDocument());
-        
+
         return assertValid(xpath, doc);
     }
 
     protected void assertInvalid(String xpath, Element element) throws Exception {
         org.w3c.dom.Document doc = new DOMOutputter().output(element.getDocument());
-        
+
         assertInvalid(xpath, doc);
     }
-    
+
     protected Document getWSDLDocument(String string) throws WSDLException {
         Definition definition = getWSDLDefinition(string);
         if (definition == null) {
@@ -242,7 +255,7 @@
         WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter();
         return writer.getDocument(definition);
     }
-    
+
     protected Context getContext() {
         AegisContext globalContext = new AegisContext();
         globalContext.initialize();

Modified: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionServiceInterface.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionServiceInterface.java?rev=700960&r1=700959&r2=700960&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionServiceInterface.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionServiceInterface.java
Wed Oct  1 15:39:15 2008
@@ -22,6 +22,7 @@
 import java.util.List;
 import java.util.SortedSet;
 
+import javax.jws.WebMethod;
 import javax.jws.WebParam;
 
 public interface CollectionServiceInterface {
@@ -37,5 +38,7 @@
     void takeDoubleList(List<Double> doublesList);
 
     String takeSortedStrings(@WebParam(name = "strings")SortedSet<String> strings);
-
+    
+    @WebMethod
+    void method1(@WebParam(name = "headers1") List<String> headers1);
 }

Modified: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTest.java?rev=700960&r1=700959&r2=700960&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTest.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTest.java
Wed Oct  1 15:39:15 2008
@@ -211,6 +211,20 @@
         
     }
     
+    /**
+     * CXF-1833 complained of a bizarre schema when @@WebParaming a parameter of List<String>.
This regression
+     * test captures the fact that we don't, in fact, have this problem with correct us of
JAX-WS.
+     * @throws Exception
+     */
+    @Test
+    public void webMethodOnListParam() throws Exception {
+        createJaxwsService(CollectionService.class, new CollectionService(), null, null);
+        Document doc = getWSDLDocument("CollectionServiceService");
+        // what we do not want is <xsd:schema targetNamespace="http://util.java" ... />
+        assertInvalid("//xsd:schema[@targetNamespace='http://util.java']",
+                      doc);
+    }
+    
     @Test
     public void testSortedSet() throws Exception {
         createService(CollectionService.class, new CollectionService(), null);
@@ -260,5 +274,9 @@
         public String takeSortedStrings(SortedSet<String> strings) {
             return strings.first();
         }
+
+        public void method1(List<String> headers1) {
+            // do nothing, this is purely for schema issues.
+        }
     }
 }



Mime
View raw message