You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2007/05/03 16:01:31 UTC

svn commit: r534866 - in /incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test: java/org/apache/tuscany/binding/axis2/itests/QuestionMarkWSDLTestCaseFIXME.java resources/org/apache/tuscany/binding/axis2/itests/questionmark-wsdl.composite

Author: antelder
Date: Thu May  3 07:01:29 2007
New Revision: 534866

URL: http://svn.apache.org/viewvc?view=rev&rev=534866
Log:
Axis2 binding testcase for ?wsdl. Doesn't work right now as there seems to be some problems stopping the http services without causing hangs (maybe as the service has never actually been invoked?)

Added:
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/binding/axis2/itests/QuestionMarkWSDLTestCaseFIXME.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/binding/axis2/itests/questionmark-wsdl.composite

Added: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/binding/axis2/itests/QuestionMarkWSDLTestCaseFIXME.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/binding/axis2/itests/QuestionMarkWSDLTestCaseFIXME.java?view=auto&rev=534866
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/binding/axis2/itests/QuestionMarkWSDLTestCaseFIXME.java (added)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/binding/axis2/itests/QuestionMarkWSDLTestCaseFIXME.java Thu May  3 07:01:29 2007
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.    
+ */
+
+package org.apache.tuscany.binding.axis2.itests;
+
+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.axis2.transport.http.server.HttpUtils;
+import org.apache.tuscany.host.embedded.SCARuntime;
+
+/**
+ * TODO: This doesn't work right now as it seems to cause hangs when running 
+ * from mvn. Also running in eclipse mostly only works if you comment out
+ * one of the test methods.  
+ */
+public class QuestionMarkWSDLTestCaseFIXME extends TestCase {
+
+    /**
+     * Tests ?wsdl works and returns the correct port endpoint from the WSDL 
+     */
+    public void testWSDLPortEndpoint() throws Exception {
+        WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
+        wsdlReader.setFeature("javax.wsdl.verbose",false);
+        wsdlReader.setFeature("javax.wsdl.importDocuments",true);
+
+        Definition definition = wsdlReader.readWSDL("http://localhost:8080/services/HelloWorldWebService?wsdl");
+        assertNotNull(definition);
+        Service service = definition.getService(new QName("http://helloworld-om", "HelloWorldService"));
+        Port port = service.getPort("HelloWorldSoapPort");
+
+        String endpoint = getEndpoint(port);
+        String ip = HttpUtils.getIpAddress();
+        assertEquals("http://" + ip + ":8080/services/HelloWorldWebService", endpoint);
+    }
+
+    /**
+     * Tests ?wsdl works and returns the correct port endpoint from binding.ws with a custom URI
+     */
+    public void testCustomEndpoint() throws Exception {
+        WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
+        wsdlReader.setFeature("javax.wsdl.verbose",false);
+        wsdlReader.setFeature("javax.wsdl.importDocuments",true);
+
+        Definition definition = wsdlReader.readWSDL("http://localhost:8080/HelloWorldService/foo/bar?wsdl");
+        assertNotNull(definition);
+        Service service = definition.getService(new QName("http://helloworld-om", "HelloWorldService"));
+        Port port = service.getPort("HelloWorldSoapPort");
+
+        String endpoint = getEndpoint(port);
+        String ip = HttpUtils.getIpAddress();
+        assertEquals("http://" + ip + ":8080/HelloWorldService/foo/bar", 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");
+    }
+
+    protected void setUp() throws Exception {
+        SCARuntime.start("org/apache/tuscany/binding/axis2/itests/questionmark-wsdl.composite");
+    }
+    
+    protected void tearDown() throws Exception {
+        SCARuntime.stop();
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/binding/axis2/itests/QuestionMarkWSDLTestCaseFIXME.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/binding/axis2/itests/QuestionMarkWSDLTestCaseFIXME.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/binding/axis2/itests/questionmark-wsdl.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/binding/axis2/itests/questionmark-wsdl.composite?view=auto&rev=534866
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/binding/axis2/itests/questionmark-wsdl.composite (added)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/binding/axis2/itests/questionmark-wsdl.composite Thu May  3 07:01:29 2007
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.    
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+
+           name="QuestionMarkWSDLTests">
+
+    <service name="ep1" promote="HelloWorldService">
+        <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
+        <binding.ws wsdlElement="http://helloworld-om#wsdl.port(HelloWorldService/HelloWorldSoapPort)"/>
+    </service>
+
+    <service name="ep2" promote="HelloWorldService">
+        <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
+        <binding.ws wsdlElement="http://helloworld-om#wsdl.binding(HelloWorldSoapBinding)"  uri="foo/bar"  />
+    </service>
+
+    <component name="HelloWorldService">
+		<implementation.java class="org.apache.tuscany.binding.axis2.itests.HelloWorldOMService"/>
+    </component>
+
+</composite>



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