Author: mriou
Date: Thu Feb 28 08:08:00 2008
New Revision: 632037

URL: http://svn.apache.org/viewvc?rev=632037&view=rev
Log:
Fixed a couple of bugs on dates assignments and manipulations.

Added:
    
ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/TestAssignDate/
    
ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/TestAssignDate/NewDiagram-Pool.bpel
    
ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/TestAssignDate/NewDiagram-Pool.wsdl
    
ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/TestAssignDate/NewDiagram.wsdl
    
ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/TestAssignDate/deploy.xml
    
ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/TestAssignDate/test.properties
Modified:
    
ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntime.java
    
ode/branches/APACHE_ODE_1.1/bpel-test/src/test/java/org/apache/ode/test/DataHandling20Test.java
    
ode/branches/APACHE_ODE_1.1/utils/src/main/java/org/apache/ode/utils/ISO8601DateParser.java

Modified: 
ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntime.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntime.java?rev=632037&r1=632036&r2=632037&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntime.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/XPath20ExpressionRuntime.java
 Thu Feb 28 08:08:00 2008
@@ -143,9 +143,17 @@
     }
 
     public Calendar evaluateAsDate(OExpression cexp, EvaluationContext 
context) throws FaultException, EvaluationException {
-        String literal = evaluateAsString(cexp, context);
+        List literal = (List) evaluate(cexp, context, XPathConstants.NODESET);
+        if (literal.size() == 0)
+            throw new 
FaultException(cexp.getOwner().constants.qnSelectionFailure, "No results for 
expression: " + cexp);
+        if (literal.size() > 1)
+            throw new 
FaultException(cexp.getOwner().constants.qnSelectionFailure, "Multiple results 
for expression: " + cexp);
+
+        Object date =literal.get(0);
+        if (date instanceof Calendar) return (Calendar) date;
+
         try {
-            return ISO8601DateParser.parseCal(literal);
+            return ISO8601DateParser.parseCal(date.toString());
         } catch (Exception ex) {
             String errmsg = "Invalid date: " + literal;
             __log.error(errmsg, ex);

Modified: 
ode/branches/APACHE_ODE_1.1/bpel-test/src/test/java/org/apache/ode/test/DataHandling20Test.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-test/src/test/java/org/apache/ode/test/DataHandling20Test.java?rev=632037&r1=632036&r2=632037&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.1/bpel-test/src/test/java/org/apache/ode/test/DataHandling20Test.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.1/bpel-test/src/test/java/org/apache/ode/test/DataHandling20Test.java
 Thu Feb 28 08:08:00 2008
@@ -55,5 +55,8 @@
     @Test public void testCounter() throws Throwable {
         go("/bpel/2.0/TestCounter");
     }
+    @Test public void testDate() throws Throwable {
+        go("/bpel/2.0/TestAssignDate");
+    }
 
 }

Added: 
ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/TestAssignDate/NewDiagram-Pool.bpel
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/TestAssignDate/NewDiagram-Pool.bpel?rev=632037&view=auto
==============================================================================
--- 
ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/TestAssignDate/NewDiagram-Pool.bpel
 (added)
+++ 
ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/TestAssignDate/NewDiagram-Pool.bpel
 Thu Feb 28 08:08:00 2008
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpel:process 
xmlns:bpel="http://schemas.xmlsoap.org/ws/2004/03/business-process/"; 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns:pnlk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"; 
xmlns:Pool0="http://example.com/NewDiagram/Pool0"; 
xmlns:this="http://example.com/NewDiagram/Pool"; 
xmlns:diag="http://example.com/NewDiagram"; 
xmlns:bpmn="http://www.intalio.com/bpms"; 
xmlns:atomic="http://ode.apache.org/atomicScope"; 
queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0" 
expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0" 
bpmn:label="Pool" bpmn:id="_ZbUEcNw9Edye_tsy8V393Q" name="Pool" 
targetNamespace="http://example.com/NewDiagram/Pool";>
+  <bpel:import namespace="http://example.com/NewDiagram"; 
location="NewDiagram.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/>
+  <bpel:import namespace="http://example.com/NewDiagram/Pool"; 
location="NewDiagram-Pool.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/>
+  <bpel:partnerLinks>
+    <bpel:partnerLink name="pool0AndPoolPlkVar" 
partnerLinkType="diag:Pool0AndPool" myRole="Pool_for_Pool0"/>
+  </bpel:partnerLinks>
+  <bpel:variables>
+    <bpel:variable name="thisTaskRequestMsg" messageType="this:TaskRequest"/>
+    <bpel:variable name="thisTaskResponseMsg" messageType="this:TaskResponse"/>
+    <bpel:variable name="variable" type="xs:dateTime"/>
+  </bpel:variables>
+  <bpel:sequence>
+    <bpel:receive partnerLink="pool0AndPoolPlkVar" portType="this:ForPool0" 
operation="Task" variable="thisTaskRequestMsg" createInstance="yes" 
bpmn:label="Task" bpmn:id="_ZbmYUNw9Edye_tsy8V393Q"></bpel:receive>
+    <bpel:assign name="init-variables-Pool">
+      <bpel:copy bpmn:label="$thisTaskResponseMsg">
+        <bpel:from>
+          <bpel:literal>
+<this:TaskResponse>OK</this:TaskResponse>
+          </bpel:literal>
+        </bpel:from>
+        <bpel:to>$thisTaskResponseMsg.body</bpel:to>
+      </bpel:copy>
+      <bpel:copy bpmn:label="$variable">
+        <bpel:from>
+          <bpel:literal>2011-01-01T00:00:00Z
+          </bpel:literal>
+        </bpel:from>
+        <bpel:to>$variable</bpel:to>
+      </bpel:copy>
+    </bpel:assign>
+    <bpel:assign bpmn:label="Task" bpmn:id="_e0Xz0Nw9Edye_tsy8V393Q">
+      <bpel:copy>
+        <bpel:from 
xmlns:xdt="http://www.w3.org/2003/11/xpath-datatypes";>current-dateTime() + 
xdt:dayTimeDuration ("PT3S")</bpel:from>
+        <bpel:to>$variable</bpel:to>
+      </bpel:copy>
+    </bpel:assign>
+    <bpel:wait bpmn:label="EventIntermediateTimer" 
bpmn:id="_cLa0kNw9Edye_tsy8V393Q">
+      <bpel:until>$variable</bpel:until>
+    </bpel:wait>
+    <bpel:reply partnerLink="pool0AndPoolPlkVar" portType="this:ForPool0" 
operation="Task" variable="thisTaskResponseMsg" bpmn:label="Task" 
bpmn:id="_e0Xz0Nw9Edye_tsy8V393Q"></bpel:reply>
+  </bpel:sequence>
+</bpel:process>
\ No newline at end of file

Added: 
ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/TestAssignDate/NewDiagram-Pool.wsdl
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/TestAssignDate/NewDiagram-Pool.wsdl?rev=632037&view=auto
==============================================================================
--- 
ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/TestAssignDate/NewDiagram-Pool.wsdl
 (added)
+++ 
ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/TestAssignDate/NewDiagram-Pool.wsdl
 Thu Feb 28 08:08:00 2008
@@ -0,0 +1,38 @@
+<?xml version='1.0' encoding='utf-8'?>
+<wsdl:definitions 
xmlns:bpel="http://schemas.xmlsoap.org/ws/2004/03/business-process/"; 
xmlns:diag="http://example.com/NewDiagram"; 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
xmlns:Pool0="http://example.com/NewDiagram/Pool0"; 
xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
xmlns:pnlk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"; 
xmlns:this="http://example.com/NewDiagram/Pool"; 
targetNamespace="http://example.com/NewDiagram/Pool";>
+    <wsdl:types>
+        <xs:schema elementFormDefault="qualified" 
targetNamespace="http://example.com/NewDiagram/Pool";>
+            <xs:element name="TaskRequest" type="xs:string"/>
+            <xs:element name="TaskResponse" type="xs:string"/>
+        </xs:schema>
+    </wsdl:types>
+    <wsdl:message name="TaskRequest">
+        <wsdl:part name="body" element="this:TaskRequest"/>
+    </wsdl:message>
+    <wsdl:message name="TaskResponse">
+        <wsdl:part name="body" element="this:TaskResponse"/>
+    </wsdl:message>
+    <wsdl:portType name="ForPool0">
+        <wsdl:operation name="Task">
+            <wsdl:input message="this:TaskRequest" name="Task"/>
+            <wsdl:output message="this:TaskResponse" name="TaskResponse"/>
+        </wsdl:operation>
+    </wsdl:portType>
+    <wsdl:binding name="CanonicBindingForPool0" type="this:ForPool0">
+        <soap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>
+        <wsdl:operation name="Task">
+            <soap:operation style="document" 
soapAction="http://example.com/NewDiagram/Pool/ForPool0/Task"/>
+            <wsdl:input>
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+    <wsdl:service name="CanonicServiceForPool0">
+        <wsdl:port name="canonicPort" binding="this:CanonicBindingForPool0">
+            <soap:address 
location="http://localhost:8080/ode/processes/BugTimer/NewDiagram/Pool/Pool0"/>
+        </wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file

Added: 
ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/TestAssignDate/NewDiagram.wsdl
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/TestAssignDate/NewDiagram.wsdl?rev=632037&view=auto
==============================================================================
--- 
ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/TestAssignDate/NewDiagram.wsdl
 (added)
+++ 
ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/TestAssignDate/NewDiagram.wsdl
 Thu Feb 28 08:08:00 2008
@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<wsdl:definitions 
xmlns:bpdm="http://www.intalio/designer/business-process-data-modeling"; 
xmlns:bpel="http://schemas.xmlsoap.org/ws/2004/03/business-process/"; 
xmlns:diag="http://example.com/NewDiagram"; 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
xmlns:Pool="http://example.com/NewDiagram/Pool"; 
xmlns:Pool0="http://example.com/NewDiagram/Pool0"; 
xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
xmlns:pnlk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"; 
targetNamespace="http://example.com/NewDiagram";>
+    <wsdl:import namespace="http://example.com/NewDiagram/Pool"; 
location="NewDiagram-Pool.wsdl"/>
+    <pnlk:partnerLinkType name="Pool0AndPool">
+        <pnlk:role name="Pool_for_Pool0" portType="Pool:ForPool0"/>
+    </pnlk:partnerLinkType>
+</wsdl:definitions>
\ No newline at end of file

Added: 
ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/TestAssignDate/deploy.xml
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/TestAssignDate/deploy.xml?rev=632037&view=auto
==============================================================================
--- 
ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/TestAssignDate/deploy.xml
 (added)
+++ 
ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/TestAssignDate/deploy.xml
 Thu Feb 28 08:08:00 2008
@@ -0,0 +1,10 @@
+<?xml version='1.0' encoding='utf-8'?>
+<dd:deploy xmlns:dd="http://ode.fivesight.com/schemas/2006/06/27/dd";>
+<dd:process xmlns:diag="http://example.com/NewDiagram"; 
xmlns:Pool0="http://example.com/NewDiagram/Pool0"; 
xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns:this="http://example.com/NewDiagram/Pool"; name="this:Pool" 
fileName="NewDiagram-Pool.bpel">
+  <dd:property name="PATH">NewDiagram</dd:property>
+  <dd:property name="SVG">NewDiagram.svg</dd:property>
+  <dd:provide partnerLink="pool0AndPoolPlkVar">
+    <dd:service name="this:CanonicServiceForPool0" port="canonicPort"/>
+  </dd:provide>
+</dd:process>
+</dd:deploy>
\ No newline at end of file

Added: 
ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/TestAssignDate/test.properties
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/TestAssignDate/test.properties?rev=632037&view=auto
==============================================================================
--- 
ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/TestAssignDate/test.properties
 (added)
+++ 
ode/branches/APACHE_ODE_1.1/bpel-test/src/test/resources/bpel/2.0/TestAssignDate/test.properties
 Thu Feb 28 08:08:00 2008
@@ -0,0 +1,22 @@
+#
+#    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.
+#
+
+namespace=http://example.com/NewDiagram/Pool
+service=CanonicServiceForPool0
+operation=Task
+request1=<message><body><ns1:TaskRequest 
xmlns:ns1="http://example.com/NewDiagram/Pool";>start</ns1:TaskRequest></body></message>
+response1=.*TaskResponse.*OK.*TaskResponse.*
\ No newline at end of file

Modified: 
ode/branches/APACHE_ODE_1.1/utils/src/main/java/org/apache/ode/utils/ISO8601DateParser.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/utils/src/main/java/org/apache/ode/utils/ISO8601DateParser.java?rev=632037&r1=632036&r2=632037&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.1/utils/src/main/java/org/apache/ode/utils/ISO8601DateParser.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.1/utils/src/main/java/org/apache/ode/utils/ISO8601DateParser.java
 Thu Feb 28 08:08:00 2008
@@ -32,7 +32,7 @@
 
     public static Date parse(String date) throws java.text.ParseException {
         String pattern;
-        StringBuffer buffer = new StringBuffer(date);
+        StringBuffer buffer = new StringBuffer(date.trim());
         boolean timezoned = false;
 
         switch (buffer.length()) {


Reply via email to