You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jm...@apache.org on 2006/07/28 20:08:37 UTC

svn commit: r426629 [4/4] - in /incubator/tuscany/java/sca/bindings/binding.axis2: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/tuscany/ src/main/java/org/apache/tuscany/binding/ src/main/java/o...

Propchange: incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java?rev=426629&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java Fri Jul 28 11:08:35 2006
@@ -0,0 +1,90 @@
+package org.apache.tuscany.binding.axis2;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import javax.servlet.Servlet;
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+
+import org.xml.sax.InputSource;
+
+import org.apache.tuscany.spi.host.ServletHost;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.WireService;
+
+import junit.framework.TestCase;
+import org.easymock.classextension.EasyMock;
+
+public class Axis2ServiceTestCase extends TestCase {
+
+    public void testInvokeService() throws Exception {
+        TestServletHost tomcatHost = new TestServletHost();
+        Axis2Service axis2Service = createAxis2Service("testWebAppName", "testServiceName", tomcatHost);
+        axis2Service.start();
+
+        Servlet servlet = tomcatHost.getMapping("testWebAppName/services/testServiceName");
+        assertNotNull(servlet);
+
+        //Create mocked HttpRequest and HttpResponse object to test the Axis2Servlet
+        //To be done:
+
+    }
+
+    private Axis2Service createAxis2Service(String webAppName, String serviceName, ServletHost tomcatHost)
+        throws Exception {
+        //Create WebServiceBinding
+        String wsdlLocation = "/wsdl/hello_world_doc_lit.wsdl";
+        URL url = getClass().getResource(wsdlLocation);
+        assertNotNull("Could not find wsdl " + url.toString(), url);
+
+        WSDLFactory factory = WSDLFactory.newInstance();
+        WSDLReader reader = factory.newWSDLReader();
+        reader.setFeature("javax.wsdl.verbose", false);
+        InputSource input = new InputSource(url.openStream());
+        Definition wsdlDef = reader.readWSDL(url.toString(), input);
+        Service wsdlService = wsdlDef.getService(new QName("http://objectweb.org/hello_world_soap_http",
+            "SOAPService"));
+        Port port = wsdlService.getPort("SoapPort");
+        WebServiceBinding wsBinding = new WebServiceBinding(wsdlDef, port, "uri", "portURI", wsdlService);
+        wsBinding.setWebAppName(webAppName);
+
+        //Create a mocked WireService, make the call of ServiceExtension.getServiceInstance() returns a proxy instance.
+        WireService wireService = EasyMock.createNiceMock(WireService.class);
+        wireService.createProxy(EasyMock.isA(InboundWire.class));
+        EasyMock.expectLastCall().andReturn(null);
+        EasyMock.replay(wireService);
+
+        //Create a mocked InboundWire, make the call of ServiceExtension.getInterface() returns a Class
+        InboundWire inboundWire = EasyMock.createNiceMock(InboundWire.class);
+        inboundWire.getBusinessInterface();
+        EasyMock.expectLastCall().andReturn(Greeter.class).anyTimes();
+        EasyMock.replay(inboundWire);
+
+        Axis2Service<?> axis2Service = new Axis2Service(serviceName, null, wireService, wsBinding, tomcatHost);
+        axis2Service.setInboundWire(inboundWire);
+
+        return axis2Service;
+    }
+
+    protected class TestServletHost implements ServletHost {
+        private Map<String, Servlet> mappings = new HashMap<String, Servlet>();
+
+        public void registerMapping(String mapping, Servlet servlet) {
+            mappings.put(mapping, servlet);
+        }
+
+        public void unregisterMapping(String mapping) {
+        }
+
+        public Servlet getMapping(String mapping) {
+            return mappings.get(mapping);
+        }
+
+    }
+
+}

Propchange: incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Greeter.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Greeter.java?rev=426629&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Greeter.java (added)
+++ incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Greeter.java Fri Jul 28 11:08:35 2006
@@ -0,0 +1,11 @@
+package org.apache.tuscany.binding.axis2;
+
+public interface Greeter {
+
+    String sayHi();
+
+    String greetMe(String requestType);
+
+    void greetMeOneWay(String requestType);
+
+}

Propchange: incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Greeter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Greeter.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Greeter.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/java/sca/bindings/binding.axis2/src/test/resources/wsdl/hello_world_doc_lit.wsdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.axis2/src/test/resources/wsdl/hello_world_doc_lit.wsdl?rev=426629&view=auto
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.axis2/src/test/resources/wsdl/hello_world_doc_lit.wsdl (added)
+++ incubator/tuscany/java/sca/bindings/binding.axis2/src/test/resources/wsdl/hello_world_doc_lit.wsdl Fri Jul 28 11:08:35 2006
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions name="HelloWorld" targetNamespace="http://objectweb.org/hello_world_soap_http" 
+    xmlns="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
+    xmlns:tns="http://objectweb.org/hello_world_soap_http"
+    xmlns:x1="http://objectweb.org/hello_world_soap_http/types"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+    <wsdl:types>
+        <schema targetNamespace="http://objectweb.org/hello_world_soap_http/types" 
+            xmlns="http://www.w3.org/2001/XMLSchema"
+	    xmlns:tns="http://objectweb.org/hello_world_soap_http/types"
+            elementFormDefault="qualified">
+	    <simpleType name="MyStringType">
+		<restriction base="string">
+		    <maxLength value="30" />
+		</restriction>
+	    </simpleType>
+
+            <element name="sayHi">
+                <complexType/>
+            </element>
+            <element name="sayHiResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMe">
+                <complexType>
+                    <sequence>
+                        <element name="requestType" type="tns:MyStringType"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMeResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMeOneWay">
+                <complexType>
+                    <sequence>
+                        <element name="requestType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="pingMe">
+                <complexType/>
+            </element>
+            <element name="pingMeResponse">
+                <complexType/>
+            </element>
+            <element name="faultDetail">
+                <complexType>
+                    <sequence>
+                        <element name="minor" type="short"/>
+                        <element name="major" type="short"/>
+                    </sequence>
+                </complexType>
+            </element>
+        </schema>
+    </wsdl:types>
+    <wsdl:message name="sayHiRequest">
+        <wsdl:part element="x1:sayHi" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="sayHiResponse">
+        <wsdl:part element="x1:sayHiResponse" name="out"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeRequest">
+        <wsdl:part element="x1:greetMe" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeResponse">
+        <wsdl:part element="x1:greetMeResponse" name="out"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeOneWayRequest">
+        <wsdl:part element="x1:greetMeOneWay" name="in"/>
+    </wsdl:message>
+    
+    <wsdl:portType name="Greeter">
+        <wsdl:operation name="sayHi">
+            <wsdl:input message="tns:sayHiRequest" name="sayHiRequest"/>
+            <wsdl:output message="tns:sayHiResponse" name="sayHiResponse"/>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMe">
+            <wsdl:input message="tns:greetMeRequest" name="greetMeRequest"/>
+            <wsdl:output message="tns:greetMeResponse" name="greetMeResponse"/>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMeOneWay">
+            <wsdl:input message="tns:greetMeOneWayRequest" name="greetMeOneWayRequest"/>
+        </wsdl:operation>
+
+    </wsdl:portType>
+    <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
+        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+        
+        <wsdl:operation name="sayHi">
+            <soap:operation soapAction="" style="document"/>
+            <wsdl:input name="sayHiRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="sayHiResponse">
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMe">
+            <soap:operation soapAction="" style="document"/>
+            <wsdl:input name="greetMeRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="greetMeResponse">
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMeOneWay">
+            <soap:operation soapAction="" style="document"/>
+            <wsdl:input name="greetMeOneWayRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+        </wsdl:operation>
+       
+    </wsdl:binding>
+    <wsdl:service name="SOAPService">
+        <wsdl:port binding="tns:Greeter_SOAPBinding" name="SoapPort">
+            <soap:address location="http://localhost:9000/SoapContext/SoapPort"/>
+        </wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>
+

Propchange: incubator/tuscany/java/sca/bindings/binding.axis2/src/test/resources/wsdl/hello_world_doc_lit.wsdl
------------------------------------------------------------------------------
    svn:executable = *



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