You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hise-commits@incubator.apache.org by wi...@apache.org on 2010/10/26 09:05:03 UTC

svn commit: r1027412 - in /incubator/hise/trunk: hise-services/src/main/java/org/apache/hise/utils/ rtests/src/test/java/org/apache/hise/runtime/ rtests/src/test/resources/test-example/

Author: witek
Date: Tue Oct 26 09:05:03 2010
New Revision: 1027412

URL: http://svn.apache.org/viewvc?rev=1027412&view=rev
Log:
HISE-98 - fix to getTaskDescription thanks to Piotr Zagorski

Added:
    incubator/hise/trunk/rtests/src/test/java/org/apache/hise/runtime/
    incubator/hise/trunk/rtests/src/test/java/org/apache/hise/runtime/TaskEvaluatorTest.java
Modified:
    incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/XmlUtils.java
    incubator/hise/trunk/rtests/src/test/resources/test-example/testHtd1.xml

Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/XmlUtils.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/XmlUtils.java?rev=1027412&r1=1027411&r2=1027412&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/XmlUtils.java (original)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/XmlUtils.java Tue Oct 26 09:05:03 2010
@@ -24,8 +24,10 @@ import java.util.List;
 import javax.xml.XMLConstants;
 import javax.xml.namespace.QName;
 import javax.xml.xpath.XPathConstants;
+import org.apache.ws.commons.schema.utils.DOMUtil;
 
 import org.w3c.dom.Element;
+import org.w3c.dom.Node;
 
 
 /**
@@ -79,6 +81,9 @@ public class XmlUtils {
             if (o instanceof String) {
                 b.append(o);
             }
+            if (o instanceof Node) {
+                b.append(DOMUtil.getChildText((Node) o));
+            }
         }
         return b.toString();
     }

Added: incubator/hise/trunk/rtests/src/test/java/org/apache/hise/runtime/TaskEvaluatorTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/rtests/src/test/java/org/apache/hise/runtime/TaskEvaluatorTest.java?rev=1027412&view=auto
==============================================================================
--- incubator/hise/trunk/rtests/src/test/java/org/apache/hise/runtime/TaskEvaluatorTest.java (added)
+++ incubator/hise/trunk/rtests/src/test/java/org/apache/hise/runtime/TaskEvaluatorTest.java Tue Oct 26 09:05:03 2010
@@ -0,0 +1,46 @@
+/*
+ * 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.hise.runtime;
+
+import javax.xml.namespace.QName;
+import org.apache.hise.TaskTestBase;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.util.Assert;
+
+/**
+ *
+ * @author pzg at touk.pl
+ */
+public class TaskEvaluatorTest extends TaskTestBase {
+    private Task task = null;
+
+    @Before
+    public void setUp() throws Exception {
+        init("test-example/test.xml");
+        task = getTask("test-example/approveHeader.xml", "test-example/approveBody.xml", new QName("http://www.insurance.example.com/claims", "Task1"));
+    }
+
+    @Test
+    public void evalPresentationDescriptionTest() {
+        String descr = task.getTaskEvaluator().evalPresentationDescription();
+        Assert.isTrue("Approve this claim following corporate guideline #4711.0815/7 for EdmundZorn".equals(descr.trim()));
+    }
+}

Modified: incubator/hise/trunk/rtests/src/test/resources/test-example/testHtd1.xml
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/rtests/src/test/resources/test-example/testHtd1.xml?rev=1027412&r1=1027411&r2=1027412&view=diff
==============================================================================
--- incubator/hise/trunk/rtests/src/test/resources/test-example/testHtd1.xml (original)
+++ incubator/hise/trunk/rtests/src/test/resources/test-example/testHtd1.xml Tue Oct 26 09:05:03 2010
@@ -13,7 +13,7 @@ Business Machines Corporation, Oracle In
                        xsi:schemaLocation="http://www.example.org/WS-HT file:/usr/share/schemas/ws-humantask.xsd"
                        xmlns:cla="http://www.insurance.example.com/claims">
 
-    <htd:import importType="http://schemas.xmlsoap.org/wsdl/" location="test-example/ExampleTasks.wsdl" namespace="http://www.insurance.example.com/claims/"/>
+    <htd:import importType="http://schemas.xmlsoap.org/wsdl/" location="test-example/ExampleTasks.wsdl" namespace="http://www.insurance.example.com/claims"/>
 
     <htd:logicalPeopleGroups>
 
@@ -101,20 +101,27 @@ Business Machines Corporation, Oracle In
                 <htd:presentationParameters>
 
                     <htd:presentationParameter name="firstname" type="xsd:string">
-                    htd:getInput("ClaimApprovalRequest")/cla:cust/cla:firstname </htd:presentationParameter>
+                        xs:string(htd:getInput("ClaimApprovalRequest")/cla:cust/cla:firstname)
+                    </htd:presentationParameter>
 
                     <htd:presentationParameter name="lastname" type="xsd:string">
-                    htd:getInput("ClaimApprovalRequest")/cla:cust/cla:lastname </htd:presentationParameter>
+                        xs:string(htd:getInput("ClaimApprovalRequest")/cla:cust/cla:lastname)
+                    </htd:presentationParameter>
 
                     <htd:presentationParameter name="euroAmount" type="xsd:double">
-                    htd:getInput("ClaimApprovalRequest")/cla:amount </htd:presentationParameter>
+                        xs:double(htd:getInput("ClaimApprovalRequest")/cla:amount)
+                    </htd:presentationParameter>
 
                 </htd:presentationParameters>
 
-                <htd:subject xml:lang="en-US"> Approve the insurance claim for PLN $euroAmount$ on behalf of $firstname$ $lastname$ </htd:subject>
-
-                <htd:description xml:lang="en-US" contentType="text/plain"> Approve this claim following corporate guideline #4711.0815/7 ... </htd:description>
-
+                <htd:subject xml:lang="en-US">
+                    Approve the insurance claim for PLN {$euroAmount} on behalf of {$firstname} {$lastname}
+                </htd:subject>
+                
+                <htd:description xml:lang="en-US" contentType="text/plain">
+                    Approve this claim following corporate guideline #4711.0815/7 for {$firstname} {$lastname}
+                </htd:description>
+                
             </htd:presentationElements>
             <htd:outcome>someOutput</htd:outcome>