You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by ms...@apache.org on 2007/05/18 15:07:47 UTC

svn commit: r539449 - in /incubator/ode/trunk/bpel-test/src/test: java/org/apache/ode/test/ resources/bpel/2.0/TestImplicitFaultHandler/ resources/bpel/2.0/TestWait1/ resources/bpel/2.0/TestWaitUntil/

Author: mszefler
Date: Fri May 18 06:07:46 2007
New Revision: 539449

URL: http://svn.apache.org/viewvc?view=rev&rev=539449
Log:
Wait with "until" test case. Note that fails due to broken date parser.


Added:
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestWaitUntil/
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestWaitUntil/WaitUntil.bpel
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestWaitUntil/deploy.xml   (with props)
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestWaitUntil/test.wsdl   (with props)
Removed:
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestImplicitFaultHandler/data.txt
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestImplicitFaultHandler/test.properties
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestWait1/Wait2-2.0.bpel
Modified:
    incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTestAbstract.java
    incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BasicActivities20Test.java
    incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/CompensationHandling20Test.java
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestImplicitFaultHandler/TestImplicitFaultHandler.wsdl
    incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestWait1/deploy.xml

Modified: incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTestAbstract.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTestAbstract.java?view=diff&rev=539449&r1=539448&r2=539449
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTestAbstract.java (original)
+++ incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTestAbstract.java Fri May 18 06:07:46 2007
@@ -29,6 +29,7 @@
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
+import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import javax.persistence.EntityManager;
@@ -568,7 +569,12 @@
                             .getCorrelationStatus());
                 }
                 if (_invocation.expectedResponsePattern != null) {
-
+                    if (mex.getResponse() == null)
+                        failure(_invocation, "Expected response, but got none.", null);
+                    String responseStr = DOMUtils.domToString(mex.getResponse().getMessage());
+                    Matcher matcher = _invocation.expectedResponsePattern.matcher(responseStr);
+                    if (!matcher.matches())
+                        failure(_invocation, "Response does not match expected pattern", _invocation.expectedResponsePattern, responseStr);
                 }
             } finally {
                 scheduler.commit();

Modified: incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BasicActivities20Test.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BasicActivities20Test.java?view=diff&rev=539449&r1=539448&r2=539449
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BasicActivities20Test.java (original)
+++ incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BasicActivities20Test.java Fri May 18 06:07:46 2007
@@ -18,10 +18,17 @@
  */
 package org.apache.ode.test;
 
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
 import javax.xml.namespace.QName;
 
+import org.apache.log4j.helpers.ISO8601DateFormat;
 import org.apache.ode.bpel.iapi.ContextException;
 import org.apache.ode.bpel.iapi.MessageExchange;
+import org.apache.ode.utils.ISO8601DateParser;
 
 public class BasicActivities20Test extends BPELTestAbstract {
     public void testHelloWorld2() throws Throwable {
@@ -47,10 +54,32 @@
         go("/bpel/2.0/TestIf");
     }
     
-    public void testWait1() throws Throwable {
+    /**
+     * Tests the wait "for" syntax.
+     * @throws Throwable
+     */
+    public void testWaitFor() throws Throwable {
         deploy("/bpel/2.0/TestWait1");
         Invocation inv = addInvoke("Wait1#1", new QName("http://ode/bpel/unit-test.wsdl", "testService"), "testOperation", 
             "<message><TestPart/><Time/></message>",
+            null);
+        inv.minimumWaitMs=5*1000L;
+        inv.maximumWaitMs=7*1000L;
+        inv.expectedStatus = MessageExchange.Status.ASYNC;
+        inv.expectedFinalStatus = MessageExchange.Status.RESPONSE;
+        
+        go();
+    }
+    
+    /**
+     * Test the wait "until" syntax.
+     */
+    public void testWaitUntil() throws Throwable {
+        deploy("/bpel/2.0/TestWaitUntil");
+        DateFormat idf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
+        String isountil = idf.format(new Date(System.currentTimeMillis()+5000));
+        Invocation inv = addInvoke("Wait1#1", new QName("http://ode/bpel/unit-test.wsdl", "testService"), "testOperation", 
+            "<message><TestPart/><Time>"+isountil+"</Time></message>",
             null);
         inv.minimumWaitMs=5*1000L;
         inv.maximumWaitMs=7*1000L;

Modified: incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/CompensationHandling20Test.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/CompensationHandling20Test.java?view=diff&rev=539449&r1=539448&r2=539449
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/CompensationHandling20Test.java (original)
+++ incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/CompensationHandling20Test.java Fri May 18 06:07:46 2007
@@ -18,6 +18,12 @@
  */
 package org.apache.ode.test;
 
+import java.util.regex.Pattern;
+
+import javax.xml.namespace.QName;
+
+import org.apache.ode.bpel.iapi.MessageExchange;
+
 public class CompensationHandling20Test extends BPELTestAbstract {
 
 	  public void testCompensationHandlers() throws Throwable {
@@ -25,7 +31,18 @@
 	  }
 
 	  public void testImplicitFaultHandler() throws Throwable {
-		  go("/bpel/2.0/TestImplicitFaultHandler");
+              
+              
+         deploy("/bpel/2.0/TestImplicitFaultHandler");
+         Invocation inv = addInvoke("Invoke#1", 
+                 new QName("http://ode/bpel/unit-test/testImplicitFaultHandler.wsdl","testImplicitFaultHandlerService"),
+                 "request",
+                 "<message><requestID>Start TestImplicitFaultHandler</requestID><requestText>Event TestImplicitFaultHandler</requestText><faultIndicator1>yes</faultIndicator1><faultIndicator2>no</faultIndicator2></message>",
+                 null);
+         inv.expectedFinalStatus = MessageExchange.Status.FAULT;
+         inv.expectedResponsePattern=Pattern.compile(".*Event TestFaultWithVariable1 -&gt; caught FaultMessage1 -&gt; Event TestFaultWithVariable1 -&gt; process complete.*");
+         
+         go();
 	  }
 	
 }

Modified: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestImplicitFaultHandler/TestImplicitFaultHandler.wsdl
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestImplicitFaultHandler/TestImplicitFaultHandler.wsdl?view=diff&rev=539449&r1=539448&r2=539449
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestImplicitFaultHandler/TestImplicitFaultHandler.wsdl (original)
+++ incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestImplicitFaultHandler/TestImplicitFaultHandler.wsdl Fri May 18 06:07:46 2007
@@ -46,7 +46,7 @@
     </wsdl:operation>
   </wsdl:portType>
 
-  <plnk:partnerLinkType name="testImplicitFaultHandlerRequest">
+  <plnk:partnerLinkType name="testImplicitFaultHandlwequest">
     <plnk:role name="testImplicitFaultHandlerService" portType="tns:testImplicitFaultHandlerPT"/>
   </plnk:partnerLinkType>
   

Modified: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestWait1/deploy.xml
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestWait1/deploy.xml?view=diff&rev=539449&r1=539448&r2=539449
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestWait1/deploy.xml (original)
+++ incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestWait1/deploy.xml Fri May 18 06:07:46 2007
@@ -28,4 +28,5 @@
 			<service name="wns:testService" port="wns:TestPort"/>
 		</provide>
 	</process>
+
 </deploy>

Added: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestWaitUntil/WaitUntil.bpel
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestWaitUntil/WaitUntil.bpel?view=auto&rev=539449
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestWaitUntil/WaitUntil.bpel (added)
+++ incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestWaitUntil/WaitUntil.bpel Fri May 18 06:07:46 2007
@@ -0,0 +1,63 @@
+<!--
+  ~ 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="WaitUntil"
+    targetNamespace="http://ode/bpel/unit-test" 
+    xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+    xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+    xmlns:tns="http://ode/bpel/unit-test"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:test="http://ode/bpel/unit-test.wsdl" 
+    suppressJoinFailure="yes">
+
+  <import importType="http://schemas.xmlsoap.org/wsdl/"
+	  location="test.wsdl"
+	  namespace="http://ode/bpel/unit-test.wsdl" />
+
+   <partnerLinks>
+      <partnerLink name="testPartnerLink" 
+         partnerLinkType="test:TestPartnerLinkType" 
+         myRole="me" />
+   </partnerLinks>
+    
+   <variables>
+     <variable name="var1" messageType="test:TestMessage"/>
+   </variables>
+        
+   <sequence>   
+       <receive 
+          createInstance="yes"
+          name="startReceive"
+          partnerLink="testPartnerLink"
+          portType="test:TestPortType"
+          operation="testOperation"
+          variable="var1"/>
+        <!-- wait 5 seconds -->
+        <wait>
+          <until>$var1.Time</until>
+        </wait>
+      	
+       <reply name="endReply" 
+              operation="testOperation" 
+              partnerLink="testPartnerLink"
+              portType="test:TestPortType" 
+              variable="var1"/>
+   </sequence>
+
+</process>

Added: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestWaitUntil/deploy.xml
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestWaitUntil/deploy.xml?view=auto&rev=539449
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestWaitUntil/deploy.xml (added)
+++ incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestWaitUntil/deploy.xml Fri May 18 06:07:46 2007
@@ -0,0 +1,31 @@
+<!--
+	~ 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">
+
+
+	<process name="pns:WaitUntil">
+		<active>true</active>
+		<provide partnerLink="testPartnerLink">
+			<service name="wns:testService" port="wns:TestPort"/>
+		</provide>
+	</process>
+</deploy>

Propchange: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestWaitUntil/deploy.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestWaitUntil/test.wsdl
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestWaitUntil/test.wsdl?view=auto&rev=539449
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestWaitUntil/test.wsdl (added)
+++ incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestWaitUntil/test.wsdl Fri May 18 06:07:46 2007
@@ -0,0 +1,56 @@
+<?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:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+    xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+   
+    <wsdl:message name="TestMessage">
+        <wsdl:part name="TestPart" type="xsd:int"/>
+        <wsdl:part name="Time" type="xsd:string"/>
+    </wsdl:message>
+    <wsdl:portType name="TestPortType">
+        <wsdl:operation name="testOperation">
+            <wsdl:input message="tns:TestMessage" name="TestIn"/>
+            <wsdl:output message="tns:TestMessage" name="TestOut"/>
+        </wsdl:operation>    
+    </wsdl:portType> 
+   <plnk:partnerLinkType name="TestPartnerLinkType">
+       <plnk:role name="me" portType="tns:TestPortType"/>
+    </plnk:partnerLinkType>
+    
+    <wsdl:binding name="TestBinding" type="tns:TestPortType">
+		<wsdl:operation name="testOperation">
+		</wsdl:operation>
+	</wsdl:binding>
+	
+	<wsdl:service name="TestService">
+		<wsdl:port name="TestPort" binding="tns:TestBinding">
+		</wsdl:port>
+	</wsdl:service>
+   
+</wsdl:definitions>
+

Propchange: incubator/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestWaitUntil/test.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native