You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sa...@apache.org on 2005/12/21 11:56:36 UTC

svn commit: r358262 - in /webservices/axis2/trunk/java/modules/core: test-resources/PingService.wsdl test/org/apache/axis2/deployment/AxisServiceBuilderTest.java

Author: sanka
Date: Wed Dec 21 02:56:27 2005
New Revision: 358262

URL: http://svn.apache.org/viewcvs?rev=358262&view=rev
Log:
Added: AxisServiceBuilderTest, which is a testcase for AxisServiceBuilder. PingService.wsdl is added to test-resources folder

Added:
    webservices/axis2/trunk/java/modules/core/test-resources/PingService.wsdl
    webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/AxisServiceBuilderTest.java   (with props)

Added: webservices/axis2/trunk/java/modules/core/test-resources/PingService.wsdl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/test-resources/PingService.wsdl?rev=358262&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/core/test-resources/PingService.wsdl (added)
+++ webservices/axis2/trunk/java/modules/core/test-resources/PingService.wsdl Wed Dec 21 02:56:27 2005
@@ -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>

Added: webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/AxisServiceBuilderTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/AxisServiceBuilderTest.java?rev=358262&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/AxisServiceBuilderTest.java (added)
+++ webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/AxisServiceBuilderTest.java Wed Dec 21 02:56:27 2005
@@ -0,0 +1,68 @@
+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;
+
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+
+/**
+ * TestCase for AxisServiceBuilder.
+ * 
+ * @author Thilini Gunawardhana (thilini@wso2.com)
+ */
+public class AxisServiceBuilderTest extends TestCase {
+	private AxisServiceBuilder builder;
+
+	public AxisServiceBuilderTest() {
+		super("AxisServiceBuilderTest");
+	}
+
+	protected void setUp() throws Exception {
+		builder = new AxisServiceBuilder();
+		super.setUp();
+	}
+
+	public void testAxisServiceBuilder() 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

Propchange: webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/AxisServiceBuilderTest.java
------------------------------------------------------------------------------
    svn:executable = *