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/09/08 12:23:17 UTC

svn commit: r573810 - in /incubator/tuscany/java/sca/modules/binding-ws-axis2/src: main/java/org/apache/tuscany/sca/binding/ws/axis2/ test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/ test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soa...

Author: antelder
Date: Sat Sep  8 03:23:15 2007
New Revision: 573810

URL: http://svn.apache.org/viewvc?rev=573810&view=rev
Log:
Start getting requires soap 1.1 /1.2 intent going, reinstate ?wsdl testcase

Added:
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java
      - copied, changed from r573799, incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCaseFIXME.java
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12TestCaseFIXME.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/definitions.xml   (with props)
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12.composite
Removed:
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCaseFIXME.java
Modified:
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl.composite

Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java?rev=573810&r1=573809&r2=573810&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java Sat Sep  8 03:23:15 2007
@@ -46,12 +46,15 @@
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.invocation.Invoker;
 import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
 import org.apache.tuscany.sca.runtime.RuntimeComponent;
 
 public class Axis2ServiceClient {
 
     private WebServiceBinding wsBinding;
     private ServiceClient serviceClient;
+    private static final QName SOAP12_INTENT = new QName("http://www.osoa.org/xmlns/sca/1.0", "soap12");
 
     public Axis2ServiceClient(RuntimeComponent component,
                               AbstractContract contract,
@@ -149,7 +152,7 @@
 
         options.setTimeOutInMilliSeconds(30 * 1000); // 30 seconds
 
-        SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory();
+        SOAPFactory soapFactory = requiresSOAP12() ? OMAbstractFactory.getSOAP12Factory() : OMAbstractFactory.getSOAP11Factory();
         QName wsdlOperationQName = new QName(operationName);
 
         Axis2BindingInvoker invoker;
@@ -159,6 +162,18 @@
             invoker = new Axis2BindingInvoker(serviceClient, wsdlOperationQName, options, soapFactory);
         }
         return invoker;
+    }
+
+    private boolean requiresSOAP12() {
+        if (wsBinding instanceof IntentAttachPoint) {
+            List<Intent> intents = ((IntentAttachPoint)wsBinding).getRequiredIntents();
+            for (Intent intent : intents) {
+                if (SOAP12_INTENT.equals(intent.getName())) {
+                    return true;
+                }
+            }
+        }
+        return false;
     }
 
     protected EndpointReference getPortLocationEPR(WebServiceBinding binding) {

Copied: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java (from r573799, incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCaseFIXME.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java?p2=incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java&p1=incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCaseFIXME.java&r1=573799&r2=573810&rev=573810&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCaseFIXME.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java Sat Sep  8 03:23:15 2007
@@ -35,11 +35,9 @@
 import org.apache.tuscany.sca.host.embedded.SCADomain;
 
 /**
- * FIXME: 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.
+ * Test ?wsdl works and that the returned wsdl has the correct endpoint
  */
-public class QuestionMarkWSDLTestCaseFIXME extends TestCase {
+public class QuestionMarkWSDLTestCase extends TestCase {
 
     private SCADomain domain;
 
@@ -53,7 +51,7 @@
 
         Definition definition = wsdlReader.readWSDL("http://localhost:8085/services/HelloWorldWebService?wsdl");
         assertNotNull(definition);
-        Service service = definition.getService(new QName("http://helloworld-om", "HelloWorldService"));
+        Service service = definition.getService(new QName("http://helloworld", "HelloWorldService"));
         Port port = service.getPort("HelloWorldSoapPort");
 
         String endpoint = getEndpoint(port);
@@ -69,14 +67,14 @@
         wsdlReader.setFeature("javax.wsdl.verbose",false);
         wsdlReader.setFeature("javax.wsdl.importDocuments",true);
 
-        Definition definition = wsdlReader.readWSDL("http://localhost:8085/HelloWorldService/foo/bar?wsdl");
+        Definition definition = wsdlReader.readWSDL("http://localhost:8085/foo/bar?wsdl");
         assertNotNull(definition);
-        Service service = definition.getService(new QName("http://helloworld-om", "HelloWorldService"));
-        Port port = service.getPort("HelloWorldSoapPort");
+        Service service = definition.getService(new QName("http://itests.axis2.ws.binding.sca.tuscany.apache.org", "HelloWorld"));
+        Port port = service.getPort("HelloWorldSOAP11port");
 
         String endpoint = getEndpoint(port);
         String ip = HttpUtils.getIpAddress();
-        assertEquals("http://" + ip + ":8085/HelloWorldService/foo/bar", endpoint);
+        assertEquals("http://" + ip + ":8085/foo/bar", endpoint);
     }
 
     protected String getEndpoint(Port port) {

Added: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12TestCaseFIXME.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12TestCaseFIXME.java?rev=573810&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12TestCaseFIXME.java (added)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12TestCaseFIXME.java Sat Sep  8 03:23:15 2007
@@ -0,0 +1,58 @@
+/*
+ * 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.sca.binding.ws.axis2.itests.soap12 ;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorld;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class HelloWorldSOAP12TestCaseFIXME extends TestCase {
+
+    private SCADomain domain;
+
+    public void testHelloWorld() throws Exception {
+        HelloWorld helloWorld = domain.getService(HelloWorld.class, "HelloWorldClient");
+        assertEquals("Hello petra", helloWorld.getGreetings("petra"));
+    }
+    public void testHelloWorldSOAP() throws Exception {
+        HelloWorld helloWorld = domain.getService(HelloWorld.class, "HelloWorldClientSOAP");
+        assertEquals("Hello petra", helloWorld.getGreetings("petra"));
+    }
+    public void testHelloWorldSOAP11() throws Exception {
+        HelloWorld helloWorld = domain.getService(HelloWorld.class, "HelloWorldClientSOAP11");
+        assertEquals("Hello petra", helloWorld.getGreetings("petra"));
+    }
+    public void testHelloWorldSOAP12() throws Exception {
+        HelloWorld helloWorld = domain.getService(HelloWorld.class, "HelloWorldClientSOAP12");
+        assertEquals("Hello petra", helloWorld.getGreetings("petra"));
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12.composite");
+    }
+   
+    @Override
+    protected void tearDown() throws Exception {
+        domain.close();
+    }
+
+}

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

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

Added: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/definitions.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/definitions.xml?rev=573810&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/definitions.xml (added)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/definitions.xml Sat Sep  8 03:23:15 2007
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.    
+-->
+<sca:definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ 			targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ 			xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+ <sca:intent name="soap"  
+ 			 constrains="sca:binding.ws">
+ 			 <sca:description>
+ 			 Communitcation thro this binding requires SOAP 
+ 			 </sca:description>
+ </sca:intent>
+
+ <sca:intent name="soap11"  
+ 			 constrains="sca:binding.ws">
+ 			 <sca:description>
+ 			 Communitcation thro this binding requires SOAP 1.1
+ 			 </sca:description>
+ </sca:intent>
+
+ <sca:intent name="soap12"  
+ 			 constrains="sca:binding.ws">
+ 			 <sca:description>
+ 			 Communitcation thro this binding requires SOAP 1.2
+ 			 </sca:description>
+ </sca:intent>
+
+</sca:definitions>
\ No newline at end of file

Propchange: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/definitions.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/definitions.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/definitions.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/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/sca/binding/ws/axis2/itests/questionmark-wsdl.composite?rev=573810&r1=573809&r2=573810&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl.composite (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl.composite Sat Sep  8 03:23:15 2007
@@ -22,17 +22,15 @@
            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)"/>
+        <binding.ws wsdlElement="http://helloworld#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"  />
+        <binding.ws uri="foo/bar"  />
     </service>
 
     <component name="HelloWorldService">
-		<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
+		<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldService"/>
     </component>
 
 </composite>

Added: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12.composite?rev=573810&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12.composite (added)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12.composite Sat Sep  8 03:23:15 2007
@@ -0,0 +1,71 @@
+<?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="HelloWorld">
+
+    <service name="helloWorld" promote="HelloWorldService">
+        <binding.ws/>
+    </service>
+    <service name="helloWorldSOAP" promote="HelloWorldService">
+        <binding.ws requires="soap"/>
+    </service>
+    <service name="helloWorldSOAP11" promote="HelloWorldService">
+        <binding.ws requires="soap11"/>
+    </service>
+    <service name="helloWorldSOAP12" promote="HelloWorldService">
+        <binding.ws requires="soap12"/>
+    </service>
+
+    <component name="HelloWorldService">
+		<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldService"/>
+    </component>
+
+    <component name="HelloWorldClient">
+		<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldComponent"/>
+        <reference name="helloWorldWS" />
+    </component>
+    <component name="HelloWorldClientSOAP">
+		<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldComponent"/>
+        <reference name="helloWorldWS" />
+    </component>
+    <component name="HelloWorldClientSOAP11">
+		<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldComponent"/>
+        <reference name="helloWorldWS" />
+    </component>
+    <component name="HelloWorldClientSOAP12">
+		<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldComponent"/>
+        <reference name="helloWorldWS" />
+    </component>
+
+    <reference name="helloWorldWS" promote="HelloWorldClient/helloWorldWS">
+        <binding.ws uri="http://localhost:8085/helloWorld"/>
+    </reference>
+    <reference name="helloWorldWS" promote="HelloWorldClientSOAP/helloWorldWS">
+        <binding.ws uri="http://localhost:8085/helloWorldSOAP" requires="soap"/>
+    </reference>
+    <reference name="helloWorldWS" promote="HelloWorldClientSOAP11/helloWorldWS">
+        <binding.ws uri="http://localhost:8085/helloWorldSOAP11" requires="soap11"/>
+    </reference>
+    <reference name="helloWorldWS" promote="HelloWorldClientSOAP12/helloWorldWS">
+        <binding.ws uri="http://localhost:8085/helloWorldSOAP12" requires="soap12"/>
+    </reference>
+
+</composite>



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