You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by mi...@apache.org on 2009/04/15 06:44:32 UTC

svn commit: r765050 - in /ode/trunk/axis2-war/src/test: java/org/apache/ode/axis2/ resources/TestEndpointTimeouts/

Author: midon
Date: Wed Apr 15 04:44:31 2009
New Revision: 765050

URL: http://svn.apache.org/viewvc?rev=765050&view=rev
Log:
Add a test case to make sure mex.timeout is applied

Added:
    ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/EndpointTimeoutsTest.java
    ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/
    ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/HelloWorld2.bpel
    ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/HelloWorld2.wsdl
    ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/deploy.xml
    ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/dummy-service.wsdl
    ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/testRequest.soap
    ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/timeouts.endpoint

Added: ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/EndpointTimeoutsTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/EndpointTimeoutsTest.java?rev=765050&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/EndpointTimeoutsTest.java (added)
+++ ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/EndpointTimeoutsTest.java Wed Apr 15 04:44:31 2009
@@ -0,0 +1,32 @@
+package org.apache.ode.axis2;
+
+import static org.testng.AssertJUnit.assertTrue;
+import org.testng.annotations.Test;
+
+/**
+ * Tests that timeouts set in the *.endpoint files are applied.
+ * The test is designed so a fault must be received.
+ *
+ * Actually, the process invokes a 3-sec long operation (see the process request).
+ * The specified timeouts are lesser than 3-sec, so if properly applied, a fault should be trown.
+ * If not applied, the default 120-sec timeouts will be used. 5sec < 120sec, so the request will succeed.
+ *
+ */
+public class EndpointTimeoutsTest extends Axis2TestBase {
+    @Test
+    public void testTimeouts() throws Exception {
+        String bundleName = "TestEndpointTimeouts";
+        // deploy the required service
+        server.deployService(DummyService.class.getCanonicalName());
+        if (server.isDeployed(bundleName)) server.undeployProcess(bundleName);
+        server.deployProcess(bundleName);
+        try {
+            String response = server.sendRequestFile("http://localhost:8888/processes/helloWorld",
+                    bundleName, "testRequest.soap");
+            System.out.println(response);
+            assertTrue("A timeout exception was expected", response.contains("<soapenv:Fault") && response.contains("Call to {http://ode/bpel/unit-test.wsdl}HelloService.hello timed out(2000 ms)."));
+        } finally {
+            server.undeployProcess(bundleName);
+        }
+    }
+}
\ No newline at end of file

Added: ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/HelloWorld2.bpel
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/HelloWorld2.bpel?rev=765050&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/HelloWorld2.bpel (added)
+++ ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/HelloWorld2.bpel Wed Apr 15 04:44:31 2009
@@ -0,0 +1,81 @@
+<!--
+  ~ 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.
+  -->
+<process name="HelloWorld2"
+         targetNamespace="http://ode/bpel/unit-test"
+         xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+         xmlns:tns="http://ode/bpel/unit-test"
+         xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+         xmlns:test="http://ode/bpel/unit-test.wsdl"
+         xmlns:dummy="http://axis2.ode.apache.org"
+         queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+         expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+    <import location="HelloWorld2.wsdl"
+            namespace="http://ode/bpel/unit-test.wsdl"
+            importType="http://schemas.xmlsoap.org/wsdl/"/>
+
+    <partnerLinks>
+        <partnerLink name="helloPartnerLink"
+                     partnerLinkType="test:HelloPartnerLinkType" myRole="me"/>
+        <partnerLink name="dummyPartnerLink"
+                     partnerLinkType="test:DummyPartnerLinkType" partnerRole="you"/>
+    </partnerLinks>
+
+    <variables>
+        <variable name="myVar" messageType="test:HelloMessage"/>
+        <variable name="input" messageType="dummy:longOperationRequest"/>
+        <variable name="output" messageType="dummy:longOperationResponse"/>
+        <variable name="tmpVar" type="xsd:string"/>
+    </variables>
+
+    <sequence>
+        <receive name="start" partnerLink="helloPartnerLink" portType="test:HelloPortType"
+                 operation="hello" variable="myVar" createInstance="yes"/>
+
+        <assign>
+            <copy>
+                <from>
+                    <literal>
+                        <dummy:faultTest>
+                            <dummy:in></dummy:in>
+                        </dummy:faultTest>
+                    </literal>
+                </from>
+                <to>$input.parameters</to>
+            </copy>
+            <copy>
+                <from>$myVar.TestPart</from>
+                <to>$input.parameters/dummy:in</to>
+            </copy>
+        </assign>
+
+        <invoke partnerLink="dummyPartnerLink" portType="dummy:DummyServicePortType"
+                operation="longOperation" inputVariable="input" outputVariable="output"/>
+
+        <assign>
+            <copy>
+                <from>$output.parameters/return</from>
+                <to>$myVar.TestPart</to>
+            </copy>
+        </assign>
+
+        <reply name="end" partnerLink="helloPartnerLink" portType="test:HelloPortType"
+               operation="hello" variable="myVar"/>
+    </sequence>
+</process>

Added: ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/HelloWorld2.wsdl
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/HelloWorld2.wsdl?rev=765050&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/HelloWorld2.wsdl (added)
+++ ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/HelloWorld2.wsdl Wed Apr 15 04:44:31 2009
@@ -0,0 +1,73 @@
+<?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.
+  -->
+
+<wsdl:definitions 
+    targetNamespace="http://ode/bpel/unit-test.wsdl"
+    xmlns="http://schemas.xmlsoap.org/wsdl/"
+    xmlns:tns="http://ode/bpel/unit-test.wsdl"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+    xmlns:dummy="http://axis2.ode.apache.org"
+    xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype">
+
+    <wsdl:import namespace="http://axis2.ode.apache.org" location="dummy-service.wsdl"/>
+
+    <wsdl:message name="HelloMessage">
+        <wsdl:part name="TestPart" type="xsd:string"/>
+    </wsdl:message>
+    
+    <wsdl:portType name="HelloPortType">
+        <wsdl:operation name="hello">
+            <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+            <wsdl:output message="tns:HelloMessage" name="TestOut"/>
+        </wsdl:operation>    
+    </wsdl:portType>
+    
+     <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
+        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+        <wsdl:operation name="hello">
+            <soap:operation soapAction="" style="rpc"/>
+            <wsdl:input>
+                <soap:body
+                    namespace="http://ode/bpel/unit-test.wsdl"
+                    use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body
+                    namespace="http://ode/bpel/unit-test.wsdl" 
+                    use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+    <wsdl:service name="HelloService">
+        <wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
+            <soap:address location="http://localhost:8888/ode/processes/helloWorld"/>
+        </wsdl:port>
+    </wsdl:service>
+    
+   <plnk:partnerLinkType name="HelloPartnerLinkType">
+       <plnk:role name="me" portType="tns:HelloPortType"/>
+   </plnk:partnerLinkType>
+    <plnk:partnerLinkType name="DummyPartnerLinkType">
+        <plnk:role name="you" portType="dummy:DummyServicePortType"/>
+    </plnk:partnerLinkType>
+</wsdl:definitions>
+

Added: ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/deploy.xml
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/deploy.xml?rev=765050&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/deploy.xml (added)
+++ ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/deploy.xml Wed Apr 15 04:44:31 2009
@@ -0,0 +1,33 @@
+<!--
+  ~ 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.
+  -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+    xmlns:pns="http://ode/bpel/unit-test" 
+    xmlns:wns="http://ode/bpel/unit-test.wsdl" xmlns:dns="http://axis2.ode.apache.org">
+
+
+    <process name="pns:HelloWorld2">
+        <active>true</active>
+        <provide partnerLink="helloPartnerLink">
+            <service name="wns:HelloService" port="HelloPort"/>
+        </provide>
+        <invoke partnerLink="dummyPartnerLink">
+            <service name="dns:DummyService" port="DummyServiceSOAP11port_http"/>
+        </invoke>
+    </process>
+</deploy>

Added: ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/dummy-service.wsdl
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/dummy-service.wsdl?rev=765050&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/dummy-service.wsdl (added)
+++ ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/dummy-service.wsdl Wed Apr 15 04:44:31 2009
@@ -0,0 +1,142 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+                  xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
+                  xmlns:ns0="http://axis2.ode.apache.org/xsd"
+                  xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
+                  xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+                  xmlns:ns1="http://axis2.ode.apache.org"
+                  xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
+                  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+                  targetNamespace="http://axis2.ode.apache.org">
+   <wsdl:types>
+      <xs:schema xmlns:ns="http://axis2.ode.apache.org" attributeFormDefault="qualified"
+                 elementFormDefault="unqualified" targetNamespace="http://axis2.ode.apache.org">
+
+         <xs:element name="DummyException">
+            <xs:complexType>
+               <xs:sequence>
+                   <xs:element minOccurs="0" name="reason" nillable="true" type="xs:string"/>
+               </xs:sequence>
+            </xs:complexType>
+         </xs:element>
+         <xs:element name="faultTest">
+            <xs:complexType>
+               <xs:sequence>
+                  <xs:element minOccurs="0" name="in" nillable="true" type="xs:string"/>
+               </xs:sequence>
+            </xs:complexType>
+         </xs:element>
+         <xs:element name="faultTestResponse">
+            <xs:complexType>
+               <xs:sequence>
+                  <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+               </xs:sequence>
+            </xs:complexType>
+         </xs:element>
+         <xs:element name="hello">
+            <xs:complexType>
+               <xs:sequence>
+                  <xs:element minOccurs="0" name="in" nillable="true" type="xs:string"/>
+               </xs:sequence>
+            </xs:complexType>
+         </xs:element>
+         <xs:element name="helloResponse">
+            <xs:complexType>
+               <xs:sequence>
+                  <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+               </xs:sequence>
+            </xs:complexType>
+         </xs:element>
+         <xs:element name="longOperation">
+            <xs:complexType>
+               <xs:sequence>
+                  <xs:element minOccurs="0" name="in" nillable="true" type="xs:string"/>
+               </xs:sequence>
+            </xs:complexType>
+         </xs:element>
+         <xs:element name="longOperationResponse">
+            <xs:complexType>
+               <xs:sequence>
+                  <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+               </xs:sequence>
+            </xs:complexType>
+         </xs:element>
+      </xs:schema>
+   </wsdl:types>
+   <wsdl:message name="faultTestRequest">
+      <wsdl:part name="parameters" element="ns1:faultTest"/>
+   </wsdl:message>
+   <wsdl:message name="faultTestResponse">
+      <wsdl:part name="parameters" element="ns1:faultTestResponse"/>
+   </wsdl:message>
+   <wsdl:message name="DummyExceptionType">
+      <wsdl:part name="parameters" element="ns1:DummyException"/>
+   </wsdl:message>
+   <wsdl:message name="helloRequest">
+      <wsdl:part name="parameters" element="ns1:hello"/>
+   </wsdl:message>
+   <wsdl:message name="helloResponse">
+      <wsdl:part name="parameters" element="ns1:helloResponse"/>
+   </wsdl:message>
+   <wsdl:message name="longOperationRequest">
+      <wsdl:part name="parameters" element="ns1:longOperation"/>
+   </wsdl:message>
+   <wsdl:message name="longOperationResponse">
+      <wsdl:part name="parameters" element="ns1:longOperationResponse"/>
+   </wsdl:message>
+   <wsdl:portType name="DummyServicePortType">
+      <wsdl:operation name="faultTest">
+         <wsdl:input message="ns1:faultTestRequest" wsaw:Action="urn:faultTest"/>
+         <wsdl:output message="ns1:faultTestResponse" wsaw:Action="urn:faultTestResponse"/>
+         <wsdl:fault message="ns1:DummyExceptionType" name="DummyException"
+                     wsaw:Action="urn:faultTestDummyException"/>
+      </wsdl:operation>
+      <wsdl:operation name="hello">
+         <wsdl:input message="ns1:helloRequest" wsaw:Action="urn:hello"/>
+         <wsdl:output message="ns1:helloResponse" wsaw:Action="urn:helloResponse"/>
+      </wsdl:operation>
+      <wsdl:operation name="longOperation">
+         <wsdl:input message="ns1:longOperationRequest" wsaw:Action="urn:longOperation"/>
+         <wsdl:output message="ns1:longOperationResponse" wsaw:Action="urn:longOperationResponse"/>
+      </wsdl:operation>
+   </wsdl:portType>
+   <wsdl:binding name="DummyServiceSOAP11Binding" type="ns1:DummyServicePortType">
+      <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+      <wsdl:operation name="faultTest">
+         <soap:operation soapAction="urn:faultTest" style="document"/>
+         <wsdl:input>
+            <soap:body use="literal"/>
+         </wsdl:input>
+         <wsdl:output>
+            <soap:body use="literal"/>
+         </wsdl:output>
+         <wsdl:fault name="DummyException">
+            <soap:fault use="literal" name="DummyException"/>
+         </wsdl:fault>
+      </wsdl:operation>
+      <wsdl:operation name="hello">
+         <soap:operation soapAction="urn:hello" style="document"/>
+         <wsdl:input>
+            <soap:body use="literal"/>
+         </wsdl:input>
+         <wsdl:output>
+            <soap:body use="literal"/>
+         </wsdl:output>
+      </wsdl:operation>
+       <wsdl:operation name="longOperation">
+         <soap:operation soapAction="urn:longOperation" style="document"/>
+         <wsdl:input>
+            <soap:body use="literal"/>
+         </wsdl:input>
+         <wsdl:output>
+            <soap:body use="literal"/>
+         </wsdl:output>
+      </wsdl:operation>
+   </wsdl:binding>
+   <wsdl:service name="DummyService">
+      <wsdl:port name="DummyServiceSOAP11port_http" binding="ns1:DummyServiceSOAP11Binding">
+         <soap:address location="http://localhost:8888/processes/DummyService"/>
+      </wsdl:port>
+   </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file

Added: ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/testRequest.soap
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/testRequest.soap?rev=765050&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/testRequest.soap (added)
+++ ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/testRequest.soap Wed Apr 15 04:44:31 2009
@@ -0,0 +1,29 @@
+<?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.
+  -->
+
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
+  <!-- test soap message -->
+  <SOAP-ENV:Body>
+    <ns1:hello xmlns:ns1="http://ode/bpel/unit-test.wsdl">
+        <!-- this defines how long the operation would take. see #DummyService.java-->
+        <TestPart xmlns="">3000</TestPart>
+    </ns1:hello>
+  </SOAP-ENV:Body>
+</SOAP-ENV:Envelope>

Added: ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/timeouts.endpoint
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/timeouts.endpoint?rev=765050&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/timeouts.endpoint (added)
+++ ode/trunk/axis2-war/src/test/resources/TestEndpointTimeouts/timeouts.endpoint Wed Apr 15 04:44:31 2009
@@ -0,0 +1,10 @@
+
+
+# timeout in milliseconds until the ODE will wait for answer.
+mex.timeout=2000
+
+# timeout in milliseconds until a connection is established
+#http.connection.timeout=480000
+
+# timeout in milliseconds for waiting for data
+#http.socket.timeout=1000