cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject svn commit: r468242 - in /incubator/cxf/trunk/rt: bindings/soap/src/test/java/org/apache/cxf/binding/soap/ bindings/soap/src/test/resources/ core/src/main/java/org/apache/cxf/wsdl11/ core/src/test/java/org/apache/cxf/wsdl11/
Date Fri, 27 Oct 2006 02:44:34 GMT
Author: tli
Date: Thu Oct 26 19:44:33 2006
New Revision: 468242

URL: http://svn.apache.org/viewvc?view=rev&rev=468242
Log:
restore the soap rpc unit test, fixed the bug of namespace error during creation of javax.xml.validation.Schema
with serviceInfo

Added:
    incubator/cxf/trunk/rt/bindings/soap/src/test/resources/rpc-req.xml   (with props)
    incubator/cxf/trunk/rt/bindings/soap/src/test/resources/rpc-resp.xml   (with props)
Modified:
    incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/RPCInInterceptorTest.java
    incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/RPCOutInterceptorTest.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
    incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java

Modified: incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/RPCInInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/RPCInInterceptorTest.java?view=diff&rev=468242&r1=468241&r2=468242
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/RPCInInterceptorTest.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/RPCInInterceptorTest.java
Thu Oct 26 19:44:33 2006
@@ -19,75 +19,95 @@
 
 package org.apache.cxf.binding.soap;
 
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.cxf.binding.soap.interceptor.RPCInInterceptor;
+
+import org.apache.cxf.jaxb.JAXBDataBinding;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.hello_world_rpclit.types.MyComplexStruct;
+import org.apache.hello_world_soap_http.RPCLitGreeterImpl;
+import org.easymock.classextension.EasyMock;
+import org.easymock.classextension.IMocksControl;
 
 public class RPCInInterceptorTest extends TestBase {
-//    
-//    public void setUp() throws Exception {
-//        super.setUp();
-//
-//        soapMessage.getExchange().put(SoapMessage.DATAREADER_FACTORY_KEY, "test.reader.factory");
-//        soapMessage.put(SoapMessage.BINDING_INFO,
-//                        getTestService("resources/wsdl/hello_world_rpc_lit.wsdl", "SoapPortRPCLit"));
-//        soapMessage.put("IMPLEMENTOR_METHOD", getTestMethod(GreeterRPCLit.class, "sendReceiveData"));
-//    }
-//
+
+    private static final String TNS = "http://apache.org/hello_world_rpclit";
+
+    private static final String OPNAME = "sendReceiveData";
+
+    private IMocksControl control = EasyMock.createNiceControl();
+    
+    public void setUp() throws Exception {
+        super.setUp();
+        ServiceInfo si = getMockedServiceModel(this.getClass().getResource("/wsdl/hello_world_rpc_lit.wsdl")
+                .toString());
+        BindingInfo bi = si.getBinding(new QName(TNS, "Greeter_SOAPBinding_RPCLit"));
+        BindingOperationInfo boi = bi.getOperation(new QName(TNS, OPNAME));
+        boi.getOperationInfo().getInput().getMessagePartByIndex(0).setProperty(Class.class.getName(),

+                MyComplexStruct.class);
+        boi.getOperationInfo().getOutput().getMessagePartByIndex(0).setProperty(Class.class.getName(),

+                MyComplexStruct.class);
+        soapMessage.getExchange().put(BindingOperationInfo.class, boi);
+
+        control.reset(); 
+        Service service = control.createMock(Service.class);
+        JAXBDataBinding dataBinding = new JAXBDataBinding(RPCLitGreeterImpl.class);
+        service.getDataBinding();
+        EasyMock.expectLastCall().andReturn(dataBinding).anyTimes();
+        service.getServiceInfo();
+        EasyMock.expectLastCall().andReturn(si).anyTimes();
+        
+        soapMessage.getExchange().put(Service.class, service);
+        soapMessage.getExchange().put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.FALSE);
+        control.replay();
+    }
+
+    
+    public void testInterceptorRPCLitOutbound() throws Exception {
+        RPCInInterceptor interceptor = new RPCInInterceptor();
+
+        soapMessage.setContent(XMLStreamReader.class, XMLInputFactory.newInstance().createXMLStreamReader(
+                getTestStream(getClass(), "/rpc-resp.xml")));
+        soapMessage.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
+
+        interceptor.handleMessage(soapMessage);
+
+        List<?> parameters = (List<?>) soapMessage.getContent(List.class);
+        assertEquals(1, parameters.size());
+
+        Object obj = parameters.get(0);
+        assertTrue(obj instanceof MyComplexStruct);
+        MyComplexStruct s = (MyComplexStruct) obj;
+        assertEquals("elem1", s.getElem1());
+        assertEquals("elem2", s.getElem2());
+        assertEquals(45, s.getElem3());
+    }
+
     public void testInterceptorRPCLitInbound() throws Exception {
-//        RPCInInterceptor interceptor = new RPCInInterceptor();
-//
-//        soapMessage.setContent(XMLStreamReader.class, XMLInputFactory.newInstance()
-//            .createXMLStreamReader(getTestStream(getClass(), "resources/greetMeRpcLitReq.xml")));
-//        soapMessage.put(Message.INBOUND_MESSAGE, Message.INBOUND_MESSAGE);
-//
-//        interceptor.handleMessage(soapMessage);
-//
-//        List<?> parameters = (List<?>) soapMessage.get(Message.INVOCATION_OBJECTS);
-//        assertEquals(1, parameters.size());
-//
-//        assertEquals("sendReceiveData", (String) soapMessage.get(Message.INVOCATION_OPERATION));
-//        
-//        Object obj = parameters.get(0);
-//        assertTrue(obj instanceof MyComplexStruct);
-//        MyComplexStruct s = (MyComplexStruct) obj;
-//        assertEquals("this is element 2", s.getElem2());
+        RPCInInterceptor interceptor = new RPCInInterceptor();
+        soapMessage.setContent(XMLStreamReader.class, XMLInputFactory.newInstance().createXMLStreamReader(
+                getTestStream(getClass(), "/rpc-req.xml")));
+
+        interceptor.handleMessage(soapMessage);
+
+        List<?> parameters = (List<?>) soapMessage.getContent(List.class);
+        assertEquals(1, parameters.size());
+
+        Object obj = parameters.get(0);
+        assertTrue(obj instanceof MyComplexStruct);
+        MyComplexStruct s = (MyComplexStruct) obj;
+        assertEquals("elem1", s.getElem1());
+        assertEquals("elem2", s.getElem2());
+        assertEquals(45, s.getElem3());
     }
-//
-//    public void testInterceptorRPCLitOutbound() throws Exception {
-//        RPCInInterceptor interceptor = new RPCInInterceptor();
-//        soapMessage.setContent(XMLStreamReader.class, XMLInputFactory.newInstance()
-//            .createXMLStreamReader(getTestStream(getClass(), "resources/greetMeRpcLitResp.xml")));
-//        interceptor.handleMessage(soapMessage);
-//
-//        List<?> objs = (List<?>) soapMessage.get(Message.INVOCATION_OBJECTS);
-//        assertEquals(1, objs.size());
-//        
-//        Object retValue = objs.get(0);
-//        assertNotNull(retValue);
-//        
-//        assertTrue(retValue instanceof MyComplexStruct);
-//        MyComplexStruct s = (MyComplexStruct) retValue;
-//        assertEquals("return is element 2", s.getElem2());
-//    }
-//
-//    protected BindingInfo getTestService(String wsdlUrl, String port) throws Exception
{
-//        BindingInfo binding = super.getTestService(wsdlUrl, port);
-//
-//        assertEquals(3, binding.getOperations().size());
-//
-//        BindingOperationInfo op = binding.getOperation(new QName("http://apache.org/hello_world_rpclit",
-//                                                                 "sendReceiveData"));
-//        assertNotNull(op);
-//        assertEquals(1, op.getInput().getMessageInfo().size());
-//        assertEquals(1, op.getOutput().getMessageInfo().size());
-//        MessageInfo msg = op.getInput().getMessageInfo();
-//        assertEquals(1, msg.getMessageParts().size());
-//        MessagePartInfo part = msg.getMessageParts().get(0);
-//        assertEquals(new QName("http://apache.org/hello_world_rpclit", "in"), part.getName());
-//
-//        OperationInfo oi = op.getOperationInfo();
-//        oi.setProperty("test.reader.factory", getTestReaderFactory(GreeterRPCLit.class));
-//
-//        return binding;
-//    }
 
 }
-

Modified: incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/RPCOutInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/RPCOutInterceptorTest.java?view=diff&rev=468242&r1=468241&r2=468242
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/RPCOutInterceptorTest.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/RPCOutInterceptorTest.java
Thu Oct 26 19:44:33 2006
@@ -19,96 +19,129 @@
 
 package org.apache.cxf.binding.soap;
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.cxf.binding.soap.interceptor.RPCOutInterceptor;
+import org.apache.cxf.jaxb.JAXBDataBinding;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.staxutils.DepthXMLStreamReader;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.hello_world_rpclit.types.MyComplexStruct;
+import org.apache.hello_world_soap_http.RPCLitGreeterImpl;
+import org.easymock.classextension.EasyMock;
+import org.easymock.classextension.IMocksControl;
 
 public class RPCOutInterceptorTest extends TestBase {
-//
-//    private ByteArrayOutputStream baos;
-//    
-//    public void setUp() throws Exception {
-//        super.setUp();
-//        
-//        baos =  new ByteArrayOutputStream();
-//
-//        soapMessage.getExchange().put(SoapMessage.DATAWRITER_FACTORY_KEY, "test.writer.factory");
-//        soapMessage.put(SoapMessage.BINDING_INFO,
-//                        getTestService("resources/wsdl/hello_world_rpc_lit.wsdl", "SoapPortRPCLit"));
-//
-//        soapMessage.setContent(XMLStreamWriter.class, getXMLStreamWriter(baos));
-//        soapMessage.put(Message.INVOCATION_OPERATION, "sendReceiveData");
-//    }
-//
-//    public void tearDown() throws Exception {
-//        baos.close();
-//    }
-//
+
+    private static final String TNS = "http://apache.org/hello_world_rpclit";
+
+    private static final String OPNAME = "sendReceiveData";
+
+    private ByteArrayOutputStream baos = new ByteArrayOutputStream(64 * 1024);
+
+    private IMocksControl control = EasyMock.createNiceControl();
+
+    public void setUp() throws Exception {
+        super.setUp();
+        ServiceInfo si = getMockedServiceModel(this.getClass().getResource("/wsdl/hello_world_rpc_lit.wsdl")
+                .toString());
+        BindingInfo bi = si.getBinding(new QName(TNS, "Greeter_SOAPBinding_RPCLit"));
+        BindingOperationInfo boi = bi.getOperation(new QName(TNS, OPNAME));
+        soapMessage.getExchange().put(BindingOperationInfo.class, boi);
+
+        control.reset();
+        Service service = control.createMock(Service.class);
+        JAXBDataBinding dataBinding = new JAXBDataBinding(RPCLitGreeterImpl.class);
+        service.getDataBinding();
+        EasyMock.expectLastCall().andReturn(dataBinding).anyTimes();
+        service.getServiceInfo();
+        EasyMock.expectLastCall().andReturn(si).anyTimes();
+
+        soapMessage.getExchange().put(Service.class, service);
+        soapMessage.getExchange().put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.FALSE);
+        control.replay();
+        
+        MyComplexStruct mcs = new MyComplexStruct();
+        mcs.setElem1("elem1");
+        mcs.setElem2("elem2");
+        mcs.setElem3(45);
+        List<MyComplexStruct> param = new ArrayList<MyComplexStruct>();
+        param.add(mcs);
+        soapMessage.setContent(List.class, param);
+    }
+
+    public void tearDown() throws Exception {
+        baos.close();
+    }
+
     public void testWriteOutbound() throws Exception {
-//        RPCOutInterceptor interceptor = new RPCOutInterceptor();
-//        soapMessage.put(Message.INVOCATION_OBJECTS, Arrays.asList(getTestObject()));
-//
-//        interceptor.handleMessage(soapMessage);
-//
-//        assertNull(soapMessage.getContent(Exception.class));
-//        
-//        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-//        XMLStreamReader xr = StaxUtils.createXMLStreamReader(bais);
-//        DepthXMLStreamReader reader = new DepthXMLStreamReader(xr);
-//        StaxUtils.toNextElement(reader);
-//        assertEquals(new QName("http://apache.org/hello_world_rpclit", "sendReceiveData"),
-//                     reader.getName());
-//        
-//        StaxUtils.nextEvent(reader);
-//        StaxUtils.toNextElement(reader);
-//        assertEquals(new QName("http://apache.org/hello_world_rpclit", "in"),
-//                     reader.getName());
-//
-//        StaxUtils.toNextText(reader);
-//        assertEquals("this is elem1", reader.getText());
+        RPCOutInterceptor interceptor = new RPCOutInterceptor();
+
+        soapMessage.setContent(XMLStreamWriter.class, XMLOutputFactory.newInstance().createXMLStreamWriter(
+                baos));
+
+        soapMessage.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
+
+        interceptor.handleMessage(soapMessage);
+        assertNull(soapMessage.getContent(Exception.class));
+        soapMessage.getContent(XMLStreamWriter.class).flush();
+        baos.flush();
+        
+        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+        XMLStreamReader xr = StaxUtils.createXMLStreamReader(bais);
+        DepthXMLStreamReader reader = new DepthXMLStreamReader(xr);
+        StaxUtils.toNextElement(reader);
+        assertEquals(new QName("http://apache.org/hello_world_rpclit", "sendReceiveData"),
reader.getName());
+
+        StaxUtils.nextEvent(reader);
+        StaxUtils.toNextElement(reader);
+        assertEquals(new QName("http://apache.org/hello_world_rpclit", "in"), reader.getName());
+
+        StaxUtils.toNextText(reader);
+        assertEquals("elem1", reader.getText());
     }
-//
-//    public void testWriteInbound() throws Exception {
-//        RPCOutInterceptor interceptor = new RPCOutInterceptor();
-//        soapMessage.put(Message.INVOCATION_OBJECTS, Arrays.asList(getTestObject()));
-//        soapMessage.put(Message.INBOUND_MESSAGE, Message.INBOUND_MESSAGE);
-//        
-//        interceptor.handleMessage(soapMessage);
-//        assertNull(soapMessage.getContent(Exception.class));
-//
-//        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-//        XMLStreamReader xr = StaxUtils.createXMLStreamReader(bais);
-//        DepthXMLStreamReader reader = new DepthXMLStreamReader(xr);
-//        StaxUtils.toNextElement(reader);
-//        assertEquals(new QName("http://apache.org/hello_world_rpclit", "sendReceiveDataResponse"),
-//                     reader.getName());
-//        
-//        StaxUtils.nextEvent(reader);
-//        StaxUtils.toNextElement(reader);
-//        assertEquals(new QName("http://apache.org/hello_world_rpclit", "out"), reader.getName());
-//
-//        StaxUtils.nextEvent(reader);
-//        StaxUtils.toNextElement(reader);
-//
-//        assertEquals(new QName("http://apache.org/hello_world_rpclit/types", "elem1"),
reader.getName());
-//
-//        StaxUtils.nextEvent(reader);
-//        StaxUtils.toNextText(reader);
-//        assertEquals("this is elem1", reader.getText());
-//    }
-//
-//
-//    public BindingInfo getTestService(String wsdlUrl, String port) throws Exception {
-//        BindingInfo binding = super.getTestService(wsdlUrl, port);
-//        BindingOperationInfo op = binding.getOperation(new QName("http://apache.org/hello_world_rpclit",
-//                                                                 "sendReceiveData"));
-//        OperationInfo oi = op.getOperationInfo();
-//        oi.setProperty("test.writer.factory", getTestWriterFactory(GreeterRPCLit.class));
-//        return binding;
-//    }
-//
-//    public MyComplexStruct getTestObject() {
-//        MyComplexStruct obj = new MyComplexStruct();
-//        obj.setElem1("this is elem1");
-//        obj.setElem2("this is elem2");
-//        obj.setElem3(1982);
-//        return obj;
-//    }
+
+    public void testWriteInbound() throws Exception {
+        RPCOutInterceptor interceptor = new RPCOutInterceptor();
+        soapMessage.setContent(XMLStreamWriter.class, XMLOutputFactory.newInstance().createXMLStreamWriter(
+                baos));
+
+        interceptor.handleMessage(soapMessage);
+        assertNull(soapMessage.getContent(Exception.class));
+        soapMessage.getContent(XMLStreamWriter.class).flush();
+        baos.flush();
+        
+        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+        XMLStreamReader xr = StaxUtils.createXMLStreamReader(bais);
+        DepthXMLStreamReader reader = new DepthXMLStreamReader(xr);
+        StaxUtils.toNextElement(reader);
+        assertEquals(new QName("http://apache.org/hello_world_rpclit", "sendReceiveDataResponse"),
reader
+                .getName());
+
+        StaxUtils.nextEvent(reader);
+        StaxUtils.toNextElement(reader);
+        assertEquals(new QName("http://apache.org/hello_world_rpclit", "out"), reader.getName());
+
+        StaxUtils.nextEvent(reader);
+        StaxUtils.toNextElement(reader);
+
+        assertEquals(new QName("http://apache.org/hello_world_rpclit/types", "elem1"), reader.getName());
+
+        StaxUtils.nextEvent(reader);
+        StaxUtils.toNextText(reader);
+        assertEquals("elem1", reader.getText());
+    }
+
 }

Added: incubator/cxf/trunk/rt/bindings/soap/src/test/resources/rpc-req.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/test/resources/rpc-req.xml?view=auto&rev=468242
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/test/resources/rpc-req.xml (added)
+++ incubator/cxf/trunk/rt/bindings/soap/src/test/resources/rpc-req.xml Thu Oct 26 19:44:33
2006
@@ -0,0 +1,9 @@
+<ns1:sendReceiveData xmlns:ns1="http://apache.org/hello_world_rpclit">
+    <ns3:in xmlns:ns3="http://apache.org/hello_world_rpclit"
+        xmlns:ns2="http://apache.org/hello_world_rpclit/types"
+        xmlns="http://www.w3.org/2005/08/addressing/wsdl">
+        <ns2:elem1>elem1</ns2:elem1>
+        <ns2:elem2>elem2</ns2:elem2>
+        <ns2:elem3>45</ns2:elem3>
+    </ns3:in>
+</ns1:sendReceiveData>

Propchange: incubator/cxf/trunk/rt/bindings/soap/src/test/resources/rpc-req.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/bindings/soap/src/test/resources/rpc-req.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/bindings/soap/src/test/resources/rpc-req.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/cxf/trunk/rt/bindings/soap/src/test/resources/rpc-resp.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/test/resources/rpc-resp.xml?view=auto&rev=468242
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/test/resources/rpc-resp.xml (added)
+++ incubator/cxf/trunk/rt/bindings/soap/src/test/resources/rpc-resp.xml Thu Oct 26 19:44:33
2006
@@ -0,0 +1,9 @@
+<ns1:sendReceiveDataResponse xmlns:ns1="http://apache.org/hello_world_rpclit">
+    <ns3:out xmlns:ns3="http://apache.org/hello_world_rpclit"
+        xmlns:ns2="http://apache.org/hello_world_rpclit/types"
+        xmlns="http://www.w3.org/2005/08/addressing/wsdl">
+        <ns2:elem1>elem1</ns2:elem1>
+        <ns2:elem2>elem2</ns2:elem2>
+        <ns2:elem3>45</ns2:elem3>
+    </ns3:out>
+</ns1:sendReceiveDataResponse>

Propchange: incubator/cxf/trunk/rt/bindings/soap/src/test/resources/rpc-resp.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/bindings/soap/src/test/resources/rpc-resp.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/bindings/soap/src/test/resources/rpc-resp.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java?view=diff&rev=468242&r1=468241&r2=468242
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
Thu Oct 26 19:44:33 2006
@@ -186,6 +186,12 @@
                     }
                 }
                 if (schemaElem != null) {
+                    for (Object prefix : def.getNamespaces().keySet()) {
+                        String ns = (String)def.getNamespaces().get(prefix);
+                        if (!prefix.equals("") && !schemaElem.hasAttribute("xmlns:"
+ prefix)) {
+                            schemaElem.setAttribute("xmlns:" + prefix, ns);
+                        }
+                    }
                     schemaCol.setBaseUri(def.getDocumentBaseURI());
                     schemaCol.setSchemaResolver(new XmlSchemaURIResolver());
                     XmlSchema xmlSchema = schemaCol.read(schemaElem);

Modified: incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java?view=diff&rev=468242&r1=468241&r2=468242
==============================================================================
--- incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java
(original)
+++ incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLServiceBuilderTest.java
Thu Oct 26 19:44:33 2006
@@ -28,6 +28,7 @@
 import javax.wsdl.factory.WSDLFactory;
 import javax.wsdl.xml.WSDLReader;
 import javax.xml.namespace.QName;
+import javax.xml.validation.Schema;
 
 import junit.framework.TestCase;
 
@@ -45,6 +46,7 @@
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.service.model.TypeInfo;
 import org.apache.cxf.transport.DestinationFactoryManager;
+import org.apache.cxf.wsdl.EndpointReferenceUtils;
 import org.apache.ws.commons.schema.XmlSchemaCollection;
 import org.apache.ws.commons.schema.XmlSchemaElement;
 import org.easymock.classextension.EasyMock;
@@ -303,6 +305,9 @@
         assertEquals(schemaInfo.getNamespaceURI(), "http://apache.org/hello_world_soap_http/types");
         assertEquals(schemas.read(schemaInfo.getElement()).getTargetNamespace(),
                      "http://apache.org/hello_world_soap_http/types");
+        // add below code to test the creation of javax.xml.validation.Schema with schema
in serviceInfo
+        Schema schema = EndpointReferenceUtils.getSchema(serviceInfo);
+        assertNotNull(schema);
     }
     public void testBare() throws Exception {
         setUpWSDL(BARE_WSDL_PATH);



Mime
View raw message