summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws-ri/src/test
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-04-20 10:46:05 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-04-20 10:46:05 +0000
commitf01464e7c3ed67e24b2a828aeb13388a9770eca9 (patch)
tree2eeb16b37890d0bd83bc1be051da18f353bcf9b9 /sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws-ri/src/test
parentc966b085ac37390376a36aca456a293be0cdc61d (diff)
Add ?wsdl generation and a simple WSDL test. The Tuscany WS model seems a bit unpredictable in terms of when certain properties will and won't be set. Need to tidy it up.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@935864 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws-ri/src/test')
-rw-r--r--sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws-ri/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/WSDLPortTestCase.java54
1 files changed, 51 insertions, 3 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws-ri/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/WSDLPortTestCase.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws-ri/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/WSDLPortTestCase.java
index 967babeae5..5c4bee15e8 100644
--- a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws-ri/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/WSDLPortTestCase.java
+++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws-ri/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/WSDLPortTestCase.java
@@ -19,6 +19,20 @@
package org.apache.tuscany.sca.binding.ws.axis2;
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+
import junit.framework.TestCase;
import org.apache.tuscany.sca.binding.ws.axis2.helloworld.HelloWorld;
@@ -31,9 +45,6 @@ public class WSDLPortTestCase extends TestCase {
private Node node;
private HelloWorld helloWorld;
- public void testCalculator() throws Exception {
- assertEquals("Hello petra", helloWorld.getGreetings("petra"));
- }
@Override
protected void setUp() throws Exception {
@@ -43,6 +54,43 @@ public class WSDLPortTestCase extends TestCase {
helloWorld = node.getService(HelloWorld.class, "HelloWorldClient");
}
+ public void testMessageExchange() throws Exception {
+ assertEquals("Hello petra", helloWorld.getGreetings("petra"));
+ }
+
+ public void testQuestionMarkWSDL() throws Exception {
+ InputStream inp = new URL("http://localhost:8085/HelloWorldService/HelloWorld?wsdl").openStream();
+ BufferedReader br = new BufferedReader(new InputStreamReader(inp));
+ String line;
+ while((line = br.readLine()) != null) {
+ System.out.println(line);
+ }
+ br.close();
+
+ WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
+ wsdlReader.setFeature("javax.wsdl.verbose",false);
+ wsdlReader.setFeature("javax.wsdl.importDocuments",true);
+
+ Definition definition = wsdlReader.readWSDL("http://localhost:8085/HelloWorldService/HelloWorld?wsdl");
+ assertNotNull(definition);
+ Service service = definition.getService(new QName("http://helloworld",
+ "HelloWorldService"));
+ Port port = service.getPort("HelloWorldSoapPort");
+
+ String endpoint = getEndpoint(port);
+ assertEquals("http://localhost:8085/HelloWorldService/HelloWorld", endpoint);
+ }
+
+ protected String getEndpoint(Port port) {
+ List wsdlPortExtensions = port.getExtensibilityElements();
+ for (final Object extension : wsdlPortExtensions) {
+ if (extension instanceof SOAPAddress) {
+ return ((SOAPAddress) extension).getLocationURI();
+ }
+ }
+ throw new RuntimeException("no SOAPAddress");
+ }
+
@Override
protected void tearDown() throws Exception {
node.stop();