Hi,

Attached is the test case written for AxisServiceBuilder.java. Please review and apply the patch

Thanks
Thilini
Index: test-resources/PingService.wsdl
===================================================================
--- test-resources/PingService.wsdl     (revision 0)
+++ test-resources/PingService.wsdl     (revision 0)
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- WSDL description of the WSS Ping interop scenarios -->
+
+<definitions name="Ping"
+    targetNamespace="http://xmlsoap.org/Ping";
+    xmlns:tns="http://xmlsoap.org/Ping";
+    xmlns="http://schemas.xmlsoap.org/wsdl/";
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema";
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";>
+  <types>
+    <schema targetNamespace="http://xmlsoap.org/Ping";
+         xmlns="http://www.w3.org/2001/XMLSchema";>
+      <complexType name="ping">
+        <sequence>
+          <element name="text" type="xsd:string" nillable="true"/>
+                 </sequence>
+      </complexType>
+      <complexType name="pingResponse">
+        <sequence>
+          <element name="text" type="xsd:string" nillable="true"/>
+                 </sequence>
+      </complexType>
+      <element name="Ping" type="tns:ping"/>
+      <element name="PingResponse" type="tns:pingResponse"/>
+    </schema>
+  </types>
+
+  <message name="PingRequest">
+    <part name="ping" element="tns:Ping"/>
+  </message>
+
+  <message name="PingResponse">
+    <part name="pingResponse" element="tns:PingResponse"/>
+  </message>
+
+  <portType name="PingPort">
+    <operation name="Ping">
+      <input  message="tns:PingRequest"/>
+      <output message="tns:PingResponse"/>
+    </operation>
+  </portType>
+
+  <binding name="PingBinding" type="tns:PingPort">
+    <soap:binding transport="http://schemas.xmlsoap.org/soap/http";
+style="document"/>
+    <operation name="Ping">
+      <soap:operation soapAction=""/>
+      <input> <soap:body use="literal"/></input>
+      <output><soap:body use="literal"/></output>
+    </operation>
+   </binding>
+
+  <service name="PingService">
+    <port name="PingPort" binding="tns:PingBinding">
+    <soap:address location="http://localhost:8080/axis2/services/PingService"/>
+    </port>
+  </service>
+
+</definitions>
Index: test/org/apache/axis2/deployment/AxisServiceBuilderTest.java
===================================================================
--- test/org/apache/axis2/deployment/AxisServiceBuilderTest.java        
(revision 0)
+++ test/org/apache/axis2/deployment/AxisServiceBuilderTest.java        
(revision 0)
@@ -0,0 +1,61 @@
+/*
+ * Created on Dec 21, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.axis2.deployment;
+
+import java.io.FileInputStream;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.description.AxisMessage;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.wsdl.WSDLConstants;
+
+import junit.framework.TestCase;
+
+/**
+ * @author Thilini
+ * 
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public class AxisServiceBuilderTest extends TestCase {
+       private AxisServiceBuilder builder;
+
+       public AxisServiceBuilderTest(String args) {
+               super(args);
+       }
+
+       protected void setUp() throws Exception {
+               builder = new AxisServiceBuilder();
+               super.setUp();
+       }
+
+       public void testWSDLTOAxisService() throws Exception {
+
+               assertNotNull(builder);
+
+               AxisService service = builder.getAxisService(new 
FileInputStream(
+                               "./test-resources/PingService.wsdl"));
+
+               assertNotNull(service);
+               assertEquals(service.getName(), "PingService");
+               AxisOperation operation = service.getOperation(new 
QName("Ping"));
+               assertNotNull(operation);
+               AxisMessage inMessage = operation
+                               
.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+               assertNotNull(inMessage);
+               assertEquals("PingRequest", 
inMessage.getElementQName().getLocalPart());
+               AxisMessage outMessage = operation
+                               
.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+               assertNotNull(outMessage);
+               assertEquals("PingResponse", outMessage.getElementQName()
+                               .getLocalPart());
+
+       }
+
+}
\ No newline at end of file

Reply via email to