incubator-hise-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r.@apache.org
Subject svn commit: r898994 [4/7] - in /incubator/hise/trunk: ./ hise-services/ hise-services/src/main/java/org/apache/hise/api/ hise-services/src/main/java/org/apache/hise/dao/ hise-services/src/main/java/org/apache/hise/engine/ hise-services/src/main/java/or...
Date Wed, 13 Jan 2010 23:20:58 GMT
Added: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/RegexpTemplateEngine.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/RegexpTemplateEngine.java?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/RegexpTemplateEngine.java (added)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/RegexpTemplateEngine.java Wed Jan 13 23:20:54 2010
@@ -0,0 +1,88 @@
+/*
+ * 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.utils;
+
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+
+/**
+ * Utility class used to merge presentation parameters into template strings using regexp replace.
+ * @author Witek Wołejszo
+ */
+public class RegexpTemplateEngine {
+    
+    private final Log log = LogFactory.getLog(RegexpTemplateEngine.class);
+
+    /**
+     * Replaces occurrences of "$key$" in a template string with values provided in presentationParameters.
+     * Removes blocks starting with ?IF-key? and ending with ?ENDIF-key? if key is not present in presentationParameters.
+     * @param template The template String.
+     * @param presentationParameterValues Presentation parameters.
+     * @return The template string with filled in values.
+     */
+    public String merge(String template, Map<String, Object> presentationParameterValues) {
+         
+        Pattern blockPattern = Pattern.compile("\\?IF\\-[A-Za-z0-9]*\\?.*\\?ENDIF\\-[A-Za-z0-9]*\\?");
+        Matcher m = blockPattern.matcher(template);
+        
+        //- remove blocks from template if the key is not in presentationParameterValues.keySet or value is null
+        //- remove block markers otherwise
+        while (m.find() == true) {
+            
+            String key = m.group().substring(4).replaceAll("\\?.*$", "");
+
+            if (presentationParameterValues.get(key) == null) {
+                template = m.replaceFirst("");
+            } else {
+                template = template.replace("?IF-" + key + "?", "").replace("?ENDIF-" + key + "?", "");
+            }
+            
+            m = blockPattern.matcher(template);
+        }
+
+        Pattern replacePattern = Pattern.compile("\\$[A-Za-z0-9]*\\$");
+        m = replacePattern.matcher(template);
+        
+        while (m.find() == true) {
+            
+            String key = m.group().replace("$", "");
+            Object substitution = ((presentationParameterValues == null) ? null : presentationParameterValues.get(key));
+            String substitutionString = (substitution == null) ? "error:" + key : substitution.toString();
+            
+            if (substitutionString == null) {
+                
+                log.warn("Cannot find presentation parameter: " + key);
+                
+            } else {
+
+                template = m.replaceFirst(substitutionString);
+                m = replacePattern.matcher(template);
+            }
+        }
+
+        return template;
+    }
+    
+}

Propchange: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/RegexpTemplateEngine.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/TaskXmlUtils.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/TaskXmlUtils.java?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/TaskXmlUtils.java (added)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/TaskXmlUtils.java Wed Jan 13 23:20:54 2010
@@ -0,0 +1,202 @@
+/*
+ * 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.utils;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpression;
+import javax.xml.xpath.XPathFactory;
+import javax.xml.xpath.XPathFunction;
+import javax.xml.xpath.XPathFunctionException;
+import javax.xml.xpath.XPathFunctionResolver;
+
+import net.sf.saxon.dom.NodeOverNodeInfo;
+import net.sf.saxon.om.NodeInfo;
+
+import org.apache.commons.lang.Validate;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hise.dao.Message;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+
+public class TaskXmlUtils {
+    
+    private final Log __log = LogFactory.getLog(TaskXmlUtils.class);
+
+    private XPathFactory xPathFactory = null;
+    
+    private NamespaceContext namespaceContext;
+    
+    private Map<String, Message> input;
+    private Map<String, Message> output;
+
+    public TaskXmlUtils(NamespaceContext namespaceContext, Map<String, Message> input, Map<String, Message> output) {
+        super();
+        this.xPathFactory = DOMUtils.getXPathFactory();
+        this.namespaceContext = namespaceContext;
+        this.input = input;
+        this.output = output;
+    }
+    
+    /**
+     * Creates {@link XPath} aware of request namespaces.
+     */
+    synchronized XPath createXPathInstance() {
+        
+        XPath xpath = this.xPathFactory.newXPath();
+
+        xpath.setNamespaceContext(this.namespaceContext);
+        xpath.setXPathFunctionResolver(new XPathFunctionResolver() {
+
+            public XPathFunction resolveFunction(QName functionName, int arity) {
+    
+                if (functionName == null) {
+                    throw new NullPointerException("The function name cannot be null.");
+                }
+    
+                if (functionName.equals(new QName("http://www.example.org/WS-HT", "getInput", "htd"))) {
+    
+                    return new GetXPathFunction(input);
+                }
+                
+                if (functionName.equals(new QName("http://www.example.org/WS-HT", "getOutput", "htd"))) {
+    
+                    return new GetXPathFunction(output);
+                } 
+                    
+                return null;
+            }
+        });
+
+        return xpath;
+    }
+    
+    /**
+     * Evaluates XPath expression in context of the Task. Expression can contain 
+     * XPath Extension functions as defined by WS-HumanTask v1. Following
+     * XPath functions are implemented:
+     * <ul>
+     * <li> {@link GetInputXPathFunction} </li>
+     * <li> {@link GetOutputXPathFunction} </li>
+     * </ul>
+     * @param xPathString The XPath 1.0 expression.
+     * @param returnType The desired return type. See {@link XPathConstants}.
+     * @return The result of evaluating the <code>XPath</code> function as an <code>Object</code>.
+     */
+    public Object evaluateXPath(String xPathString, QName returnType) {
+        
+        Validate.notNull(xPathString);
+        Validate.notNull(returnType);
+
+        Object o = null;
+
+        XPath xpath = createXPathInstance();
+
+        try {
+
+            //TODO create empty document only once
+            DocumentBuilder builder = DOMUtils.getDocumentBuilderFactory().newDocumentBuilder();
+            Document emptyDocument;
+            emptyDocument = builder.parse(new ByteArrayInputStream("<empty/>".getBytes()));
+            XPathExpression expr = xpath.compile(xPathString);
+            o = expr.evaluate(emptyDocument, returnType);
+            __log.debug("evaluated " + o);
+            if (o instanceof NodeInfo) {
+                NodeInfo o2 = (NodeInfo) o;
+                Node o3 = NodeOverNodeInfo.wrap(o2);
+                __log.debug("returned " + DOMUtils.domToString(o3));
+                return o3;
+            } else {
+                return o;
+            }
+        } catch (Exception e) {
+            __log.error("Error evaluating XPath: " + xPathString, e);
+            throw new RuntimeException(e);
+        }
+    }
+    
+    /**
+     * Implements getInput {@link XPathFunction} - get the data for the part of the task's input message.
+     * @author Witek Wołejszo
+     */
+    private static class GetXPathFunction implements XPathFunction {
+        
+        private final Log log = LogFactory.getLog(GetXPathFunction.class);
+        private Map<String, Message> data;
+
+        
+        public GetXPathFunction(Map<String, Message> data) {
+            this.data = data;
+        }
+        
+        /**
+         * <p>Evaluate the function with the specified arguments.</p>
+         * @see XPathFunction#evaluate(List)
+         * @param args The arguments, <code>null</code> is a valid value.
+         * @return The result of evaluating the <code>XPath</code> function as an <code>Object</code>.
+         * @throws XPathFunctionException If <code>args</code> cannot be evaluated with this <code>XPath</code> function.
+         */
+        public Object evaluate(List args) throws XPathFunctionException {
+
+            String partName = (String) args.get(0);
+
+            Message message = data.get(partName);
+            Document document = null;
+            
+            if (message == null) {
+                throw new XPathFunctionException("Task's input does not contain partName: " + args.get(0));
+            }
+
+//            try {
+//                
+//                document = message.getDomDocument();
+//                
+//            } catch (ParserConfigurationException e) {
+//
+//                throw new XPathFunctionException(e);
+//            } catch (SAXException e) {
+//                
+//                throw new XPathFunctionException(e);
+//            } catch (IOException e) {
+//                
+//                throw new XPathFunctionException(e);
+//            }
+            
+            if (document == null) return null;
+            NodeList l = document.getElementsByTagName(partName);
+            Validate.isTrue(l.getLength() == 1, "Exactly one part must exist.");
+            return l.item(0);
+        }
+
+    }
+}

Propchange: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/TaskXmlUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/XQueryEvaluator.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/XQueryEvaluator.java?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/XQueryEvaluator.java (added)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/XQueryEvaluator.java Wed Jan 13 23:20:54 2010
@@ -0,0 +1,117 @@
+package org.apache.hise.utils;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import net.sf.saxon.Configuration;
+import net.sf.saxon.dom.DocumentWrapper;
+import net.sf.saxon.dom.NodeOverNodeInfo;
+import net.sf.saxon.expr.JPConverter;
+import net.sf.saxon.functions.FunctionLibrary;
+import net.sf.saxon.functions.FunctionLibraryList;
+import net.sf.saxon.functions.JavaExtensionLibrary;
+import net.sf.saxon.om.NodeInfo;
+import net.sf.saxon.om.StructuredQName;
+import net.sf.saxon.om.ValueRepresentation;
+import net.sf.saxon.query.DynamicQueryContext;
+import net.sf.saxon.query.StaticQueryContext;
+import net.sf.saxon.query.XQueryExpression;
+import net.sf.saxon.trans.XPathException;
+import net.sf.saxon.value.SequenceType;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.Node;
+
+public class XQueryEvaluator {
+    private static Log __log = LogFactory.getLog(XQueryEvaluator.class);
+
+    public static ThreadLocal<Object> contextObjectTL = new ThreadLocal<Object>() ;
+    
+    private Map<QName, Object> vars = new HashMap<QName, Object>();
+    private Configuration config = Configuration.makeConfiguration(null, null);
+    private JavaExtensionLibrary jel = new JavaExtensionLibrary(config);
+    
+    private Object contextObject;
+    
+    public void bindVariable(QName var, Object value) {
+        vars.put(var, value);
+    }
+    
+    public void declareJavaClass(String uri, Class clazz) {
+        jel.declareJavaClass(uri, clazz);
+    }
+
+    public void setContextObject(Object contextObject) {
+        this.contextObject = contextObject;
+    }
+
+    public static ValueRepresentation convertJavaToSaxon(Object obj) {
+        try {
+            if (obj == null) obj = "";
+            return JPConverter.allocate(obj.getClass(), null).convert(obj, null);
+        } catch (XPathException e) {
+            throw new RuntimeException("", e);
+        }
+    }
+    
+    public List evaluateExpression(String expr, org.w3c.dom.Node contextNode) {
+        try {
+            contextObjectTL.set(contextObject);
+            {
+                FunctionLibraryList fll = new FunctionLibraryList();
+                fll.addFunctionLibrary(jel);
+                config.setExtensionBinder("java", fll);
+            }
+
+            StaticQueryContext sqc = new StaticQueryContext(config);
+            for (QName var : vars.keySet()) {
+                sqc.declareGlobalVariable(StructuredQName.fromClarkName(var.toString()), SequenceType.SINGLE_ITEM, convertJavaToSaxon(vars.get(var)) , false);
+            }
+            DynamicQueryContext dqc = new DynamicQueryContext(config);
+            XQueryExpression e = sqc.compileQuery(expr);
+            
+            if (contextNode != null) {
+                if (!(contextNode instanceof Document || contextNode instanceof DocumentFragment) ) {
+                    try {
+                        contextNode = DOMUtils.parse(DOMUtils.domToString(contextNode));
+                    } catch (Exception e1) {
+                        throw new RuntimeException("", e1);
+                    }
+//                    DocumentFragment frag = contextNode.getOwnerDocument().createDocumentFragment();
+//                    frag.appendChild(contextNode);
+//                    contextNode = frag;
+                }
+                dqc.setContextItem(new DocumentWrapper(contextNode, "", config));
+            }
+
+            List value = e.evaluate(dqc);
+            List value2 = new ArrayList();
+            for (Object o : value) {
+                Object o2 = o;
+                if (o2 instanceof NodeInfo) {
+                    try {
+                        Node o3 = DOMUtils.parse(DOMUtils.domToString(NodeOverNodeInfo.wrap((NodeInfo) o2))).getDocumentElement();
+                        o2 = o3;
+                    } catch (Exception e1) {
+                        throw new RuntimeException("Error converting result", e1);
+                    }
+                }
+                value2.add(o2);
+            }
+            __log.debug("result for expression " + expr + " " + value2 + " value class " + (value2 == null ? null : value2.getClass()));
+            return value2;
+        } catch (XPathException e) {
+            __log.error("", e);
+            throw new RuntimeException(e);
+        } finally {
+            contextObjectTL.set(null);
+        }
+    }
+}

Propchange: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/utils/XQueryEvaluator.java
------------------------------------------------------------------------------
    svn:eol-style = native

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=898994&r1=898993&r2=898994&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 Wed Jan 13 23:20:54 2010
@@ -34,32 +34,32 @@
  */
 public class XmlUtils {
 
-    public static final QName SCHEMA_STRING = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "string");
-    public static final QName SCHEMA_DOUBLE = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "double");
-    public static final QName SCHEMA_BOOLEAN = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "boolean");
-
-    /**
-     * Calculates XPath return type based on XMLSchema type.
-     * @param type Schema type: string, boolean or double.
-     * @return The return type. See {@link XPathConstants}.
-     */
-    public QName getReturnType(QName type) {
-        
-        if (type.equals(SCHEMA_STRING)) {
-            
-            return XPathConstants.STRING;
-            
-        } if (type.equals(SCHEMA_DOUBLE)) {
-        
-            return XPathConstants.NUMBER;
-            
-        } if (type.equals(SCHEMA_BOOLEAN)) {
-        
-            return XPathConstants.BOOLEAN;
-        }
-        
-        throw new RuntimeException("Cannot map: " + type + " to XPath result type.");
-    }
+//    public static final QName SCHEMA_STRING = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "string");
+//    public static final QName SCHEMA_DOUBLE = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "double");
+//    public static final QName SCHEMA_BOOLEAN = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "boolean");
+//
+//    /**
+//     * Calculates XPath return type based on XMLSchema type.
+//     * @param type Schema type: string, boolean or double.
+//     * @return The return type. See {@link XPathConstants}.
+//     */
+//    public QName getReturnType(QName type) {
+//        
+//        if (type.equals(SCHEMA_STRING)) {
+//            
+//            return XPathConstants.STRING;
+//            
+//        } if (type.equals(SCHEMA_DOUBLE)) {
+//        
+//            return XPathConstants.NUMBER;
+//            
+//        } if (type.equals(SCHEMA_BOOLEAN)) {
+//        
+//            return XPathConstants.BOOLEAN;
+//        }
+//        
+//        throw new RuntimeException("Cannot map: " + type + " to XPath result type.");
+//    }
     
     public Object getElementByLocalPart(List<Object> any, String localPart) {
         for (Object o : any) {
@@ -98,4 +98,8 @@
 //          
 //      }
 //  }
+    
+    public static <T> T notNull(T a, T defaultValue) {
+        return a == null ? defaultValue : a;
+    }
 }

Added: incubator/hise/trunk/hise-services/src/main/resources/org/apache/hise/persistence.xml
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/resources/org/apache/hise/persistence.xml?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/resources/org/apache/hise/persistence.xml (added)
+++ incubator/hise/trunk/hise-services/src/main/resources/org/apache/hise/persistence.xml Wed Jan 13 23:20:54 2010
@@ -0,0 +1,36 @@
+<?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.
+  -->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
+    <persistence-unit name="org.apache.hise">
+        <provider>org.hibernate.ejb.HibernatePersistence</provider>
+        <class>org.apache.hise.dao.Attachment</class>
+        <class>org.apache.hise.dao.Comment</class>
+        <class>org.apache.hise.dao.Deadline</class>
+        <class>org.apache.hise.dao.Fault</class>
+        <class>org.apache.hise.dao.JpaBase</class>
+        <class>org.apache.hise.dao.Message</class>
+        <class>org.apache.hise.dao.OrgEntity</class>
+        <class>org.apache.hise.dao.TaskOrgEntity</class>
+        <class>org.apache.hise.dao.PresentationParameter</class>
+        <class>org.apache.hise.dao.Task</class>
+        <class>org.apache.hise.dao.Job</class>
+        <exclude-unlisted-classes/>
+    </persistence-unit>
+</persistence>

Propchange: incubator/hise/trunk/hise-services/src/main/resources/org/apache/hise/persistence.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/ClientTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/ClientTest.java?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/ClientTest.java (added)
+++ incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/ClientTest.java Wed Jan 13 23:20:54 2010
@@ -0,0 +1,15 @@
+package org.apache.hise;
+
+import junit.framework.Assert;
+
+import org.apache.hise.engine.jaxws.HISEJaxWSClient;
+import org.apache.hise.utils.DOMUtils;
+import org.junit.Test;
+
+public class ClientTest {
+    @Test
+    public void testEpr() throws Exception {
+        HISEJaxWSClient c = new HISEJaxWSClient();
+        Assert.assertEquals("http://localhost:8082/ClaimsResponseService/", c.getAddressFromEpr(DOMUtils.parse(getClass().getResourceAsStream("/epr2.xml")).getDocumentElement()));
+    }
+}

Propchange: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/ClientTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/CompilerTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/CompilerTest.java?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/CompilerTest.java (added)
+++ incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/CompilerTest.java Wed Jan 13 23:20:54 2010
@@ -0,0 +1,61 @@
+/*
+ * 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;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.apache.hise.engine.store.CompileException;
+import org.apache.hise.engine.store.HumanInteractionsCompiler;
+import org.apache.hise.lang.HumanInteractions;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
+
+
+public class CompilerTest {
+    @Test
+    public void testCompile() throws Exception {
+        Resource htdXml = new ClassPathResource("testHtd1.xml");
+        HumanInteractions hi = HumanInteractionsCompiler.compile(htdXml);
+        Set<QName> s = hi.getTaskDefinitions().keySet();
+        Assert.assertNotNull(hi);
+        Assert.assertTrue(s.contains(QName.valueOf("{http://www.insurance.example.com/claims}Task1")));
+        Assert.assertTrue(s.contains(QName.valueOf("{http://www.insurance.example.com/claims}Task2")));
+        Assert.assertTrue(s.contains(QName.valueOf("{http://www.insurance.example.com/claims}Task3")));
+        Assert.assertEquals("someOutput", hi.getTaskDefinitions().get(QName.valueOf("{http://www.insurance.example.com/claims}Task1")).getOutcomeExpression());
+    }
+    
+    @Test
+    public void testDuplicateTaskDef() throws Exception {
+        Resource htdXml = new ClassPathResource("duplicateTaskDef.xml");
+        try {
+            HumanInteractions hi = HumanInteractionsCompiler.compile(htdXml);
+        } catch (CompileException e) {
+            Assert.assertTrue(e.getCause().getMessage().contains("Duplicate task found, name: {http://www.insurance.example.com/claims}Task1"));
+            return;
+        }
+        Assert.assertTrue(false);
+    }
+
+}

Propchange: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/CompilerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/DaoTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/DaoTest.java?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/DaoTest.java (added)
+++ incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/DaoTest.java Wed Jan 13 23:20:54 2010
@@ -0,0 +1,159 @@
+package org.apache.hise;
+
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.hise.dao.GenericHumanRole;
+import org.apache.hise.dao.HISEDao;
+import org.apache.hise.dao.Job;
+import org.apache.hise.dao.Message;
+import org.apache.hise.dao.OrgEntity;
+import org.apache.hise.dao.Task;
+import org.apache.hise.dao.TaskOrgEntity;
+import org.apache.hise.dao.Task.Status;
+import org.apache.hise.dao.TaskOrgEntity.OrgEntityType;
+import org.apache.hise.lang.xsd.htda.TStatus;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.orm.jpa.JpaTransactionManager;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
+import org.springframework.transaction.TransactionStatus;
+import org.springframework.transaction.support.TransactionCallback;
+import org.springframework.transaction.support.TransactionTemplate;
+
+@ContextConfiguration(locations = "classpath:/dao.xml")
+public class DaoTest extends AbstractTransactionalJUnit4SpringContextTests {
+    
+    @Autowired
+    private HISEDao hiseDao;
+    
+    @Autowired
+    private JpaTransactionManager transactionManager;
+    
+    private OrgEntity o, o2;
+    
+    private Long addTask() throws Exception {
+        Assert.assertTrue(hiseDao != null);
+        
+        o2 = new OrgEntity();
+        o2.setName("group1");
+        o2.setType(OrgEntityType.GROUP);
+        hiseDao.saveOrgEntity(o2);
+
+        o = new OrgEntity();
+        o.setName("user1");
+        o.setType(OrgEntityType.USER);
+        o.setUserPassword("abc");
+        o.getUserGroups().add(o2);
+        hiseDao.saveOrgEntity(o);
+        
+        Task t = new Task();
+        t.setStatus(Status.CREATED);
+        t.setTaskDefinitionKey("asd");
+        t.setActualOwner(o);
+        
+        t.getInput().put("abc", new Message("abc", "def"));
+        hiseDao.saveTask(t);
+        return t.getId();
+    }
+
+    private void addTask2() throws Exception {
+        addTask();
+        Task t = new Task();
+        t.setStatus(Status.READY);
+        t.setTaskDefinitionKey("asd2");
+        Set<TaskOrgEntity> pa = new HashSet<TaskOrgEntity>();
+        TaskOrgEntity x = new TaskOrgEntity();
+        x.setName("user1");
+        x.setType(OrgEntityType.USER);
+        x.setGenericHumanRole(GenericHumanRole.POTENTIALOWNERS);
+        x.setTask(t);
+        pa.add(x);
+        t.setPeopleAssignments(pa);
+        hiseDao.saveTask(t);
+    }
+
+    private void addTask3() throws Exception {
+        addTask();
+        Task t = new Task();
+        t.setStatus(Status.READY);
+        t.setTaskDefinitionKey("asd3");
+        Set<TaskOrgEntity> pa = new HashSet<TaskOrgEntity>();
+        TaskOrgEntity x = new TaskOrgEntity();
+        x.setName("group1");
+        x.setType(OrgEntityType.GROUP);
+        x.setGenericHumanRole(GenericHumanRole.POTENTIALOWNERS);
+        x.setTask(t);
+        pa.add(x);
+        t.setPeopleAssignments(pa);
+        hiseDao.saveTask(t);
+    }
+
+    
+    @Test
+    public void testDao() throws Exception {
+        addTask();
+    }
+    
+    @Test 
+    public void testUserTasks() throws Exception {
+        addTask();
+        List<Task> r = hiseDao.getUserTasks(o, "", GenericHumanRole.ACTUALOWNER, "", Collections.EMPTY_LIST, "", null, 100);
+        Assert.assertEquals("asd", r.get(0).getTaskDefinitionKey());
+    }
+
+    @Test 
+    public void testUserTasks2() throws Exception {
+        addTask2();
+        List<Task> r = hiseDao.getUserTasks(o, "", GenericHumanRole.POTENTIALOWNERS, "", Collections.EMPTY_LIST, "", null, 100);
+        Assert.assertEquals("asd2", r.get(0).getTaskDefinitionKey());
+    }
+    
+    @Test
+    public void testInputs() throws Exception {
+        TransactionTemplate tt = new TransactionTemplate(transactionManager);
+        final Long tid = (Long) tt.execute(new TransactionCallback() {
+            public Object doInTransaction(TransactionStatus arg0) {
+                try {
+                    return addTask();
+                } catch (Exception e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        });
+        tt.execute(new TransactionCallback() {
+            public Object doInTransaction(TransactionStatus arg0) {
+                try {
+                    Assert.assertTrue(hiseDao.loadTask(tid).getInput().get("abc").getMessage().equals("def"));
+                } catch (Exception e) {
+                    throw new RuntimeException(e);
+                }
+                return null;
+            }
+        });
+        
+    }
+    
+    @Test 
+    public void testGrupQuery() throws Exception {
+        addTask3();
+        List<Task> r = hiseDao.getUserTasks(o, "", GenericHumanRole.POTENTIALOWNERS, "", Collections.EMPTY_LIST, "", null, 100);
+        Assert.assertEquals("asd3", r.get(0).getTaskDefinitionKey());
+    }
+
+    @Test 
+    public void testJobs() throws Exception {
+        Job j = new Job();
+        j.setFire(new Date(1213L));
+        j.setAction("abc");
+        hiseDao.persist(j);
+        
+        List<Job> r = hiseDao.listJobs(new Date(1214L), 12);
+        Assert.assertEquals("abc", r.get(0).getAction());
+    }
+}

Propchange: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/DaoTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/MessageTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/MessageTest.java?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/MessageTest.java (added)
+++ incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/MessageTest.java Wed Jan 13 23:20:54 2010
@@ -0,0 +1,64 @@
+/*
+ * 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;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.IOException;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.hise.dao.Message;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+
+/**
+ * {@link Message} tests.
+ * @author Witek Wołejszo
+ */
+@Ignore
+public class MessageTest {
+
+//    @Test
+//    public void testGetDomDocument() throws ParserConfigurationException, SAXException, IOException {
+//        Message message = new Message("<ClaimApprovalRequest><cust><firstname>witek</firstname></cust></ClaimApprovalRequest>");
+//        Document doc = message.getDomDocument();
+//        assertNotNull(doc);
+//    }
+//
+//    @Test
+//    public void testGetRootNodeName() {
+//        Message message = new Message("<ClaimApprovalRequest><cust><firstname>witek</firstname></cust></ClaimApprovalRequest>");
+//        String r = message.getRootNodeName();
+//        assertEquals("ClaimApprovalRequest", r);
+//    }
+//    
+//    @Test
+//    public void testGetRootNodeName_XML_WithProcessingInstruction() {
+//        Message message = new Message("<?xml version=\"1.0\" encoding=\"UTF-8\"?><ClaimApprovalRequest><cust><firstname>witek</firstname></cust></ClaimApprovalRequest>");
+//        String r = message.getRootNodeName();
+//        assertEquals("ClaimApprovalRequest", r);
+//    }
+
+}

Propchange: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/MessageTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/MockHiseDao.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/MockHiseDao.java?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/MockHiseDao.java (added)
+++ incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/MockHiseDao.java Wed Jan 13 23:20:54 2010
@@ -0,0 +1,26 @@
+package org.apache.hise;
+
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.hise.dao.GenericHumanRole;
+import org.apache.hise.dao.HISEDao;
+import org.apache.hise.dao.OrgEntity;
+import org.apache.hise.dao.Task;
+import org.apache.hise.dao.Task.Status;
+import org.apache.hise.lang.xsd.htda.TStatus;
+
+public class MockHiseDao extends HISEDao {
+
+    @Override
+    public List<Task> getUserTasks(OrgEntity user, String taskType, GenericHumanRole genericHumanRole, String workQueue, List<TStatus> status, String whereClause, String createdOnClause, Integer maxTasks) {
+        Task t = new Task();
+        t.setId(123L);
+        t.setTaskDefinitionKey("{asdf}asdf");
+        t.setStatus(Status.CREATED);
+        t.setCreatedOn(new Date(1234L));
+        return Collections.singletonList(t);
+    }
+    
+}

Propchange: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/MockHiseDao.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/MockTask.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/MockTask.java?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/MockTask.java (added)
+++ incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/MockTask.java Wed Jan 13 23:20:54 2010
@@ -0,0 +1,9 @@
+package org.apache.hise;
+
+import org.apache.hise.runtime.Task;
+
+public class MockTask extends Task {
+    public MockTask() {
+        super();
+    }
+}

Propchange: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/MockTask.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/MockTaskOperationsImpl.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/MockTaskOperationsImpl.java?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/MockTaskOperationsImpl.java (added)
+++ incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/MockTaskOperationsImpl.java Wed Jan 13 23:20:54 2010
@@ -0,0 +1,22 @@
+package org.apache.hise;
+
+import org.apache.hise.dao.OrgEntity;
+import org.apache.hise.dao.TaskOrgEntity.OrgEntityType;
+import org.apache.hise.engine.jaxws.TaskOperationsImpl;
+
+public class MockTaskOperationsImpl extends TaskOperationsImpl {
+
+    @Override
+    protected String getUserString() {
+        return "user1";
+    }
+
+    @Override
+    protected OrgEntity loadUser() {
+        OrgEntity oe = new OrgEntity();
+        oe.setName("user1");
+        oe.setType(OrgEntityType.USER);
+        return oe;
+    }
+
+}

Propchange: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/MockTaskOperationsImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/RegexpTemplateEngineTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/RegexpTemplateEngineTest.java?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/RegexpTemplateEngineTest.java (added)
+++ incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/RegexpTemplateEngineTest.java Wed Jan 13 23:20:54 2010
@@ -0,0 +1,134 @@
+/*
+ * 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;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.hise.utils.RegexpTemplateEngine;
+import org.junit.Assert;
+import org.junit.Test;
+
+
+/**
+ * Tests for {@link RegexpTemplateEngine}.
+ * @author Witek Wołejszo
+ */
+public class RegexpTemplateEngineTest {
+
+    @Test
+    public void mergeTest1() {
+        
+        RegexpTemplateEngine te = new RegexpTemplateEngine();
+        String r1 = te.merge("Raz dwa trzy.", null);
+        
+        Assert.assertEquals("Raz dwa trzy.", r1);
+        
+        Map<String, Object> pp = new HashMap<String, Object>();
+        
+        pp.put("Raz", "1");
+        String r2 = te.merge("$Raz$ dwa trzy.", pp);
+        Assert.assertEquals("1 dwa trzy.", r2);
+        
+        pp.put("dwa", "2");
+        String r3 = te.merge("$Raz$ $dwa$ trzy.", pp);
+        Assert.assertEquals("1 2 trzy.", r3);
+        
+        pp.put("trzy", "3");
+        String r4 = te.merge("$Raz$ $dwa$ $trzy$.", pp);
+        Assert.assertEquals("1 2 3.", r4);
+    }
+    
+    @Test
+    public void mergeTest2() {
+        
+        RegexpTemplateEngine te = new RegexpTemplateEngine();
+        
+        Map<String, Object> pp = new HashMap<String, Object>();
+        pp.put("euroAmount", Double.valueOf(1));
+        pp.put("firstname", "jan");
+        pp.put("lastname", "kowalski");
+        
+        String r1 = te.merge("Approve the insurance claim for €$euroAmount$ on behalf of $firstname$ $lastname$", pp);
+        Assert.assertEquals("Approve the insurance claim for €1.0 on behalf of jan kowalski", r1);
+    }
+    
+    @Test
+    public void removeTest1() {
+        RegexpTemplateEngine te = new RegexpTemplateEngine();
+        Map<String, Object> pp = new HashMap<String, Object>();
+        //no x in pp
+        String r1 = te.merge("?IF-x?bla bla bla?ENDIF-x?", pp);
+        Assert.assertEquals("", r1);
+    }
+    
+    @Test
+    public void noRemoveTest1() {
+        RegexpTemplateEngine te = new RegexpTemplateEngine();
+        Map<String, Object> pp = new HashMap<String, Object>();
+        pp.put("x", "1");
+        pp.put("y", "bleh");
+        String r1 = te.merge("?IF-x?bla $y$ bla?ENDIF-x?", pp);
+        Assert.assertEquals("bla bleh bla", r1);
+    }
+    
+    @Test
+    public void noRemoveTest2() {
+        RegexpTemplateEngine te = new RegexpTemplateEngine();
+        Map<String, Object> pp = new HashMap<String, Object>();
+        pp.put("correctedItemName1", "pozycja");
+        pp.put("correctedItemNewNetValue1", "1");
+        String r1 = te.merge("?IF-correctedItemName1?Pozycja: $correctedItemName1$ Na: $correctedItemNewNetValue1$?ENDIF-correctedItemName1?", pp);
+        Assert.assertEquals("Pozycja: pozycja Na: 1", r1);
+    }
+    
+    @Test
+    public void noRemoveTest3() {
+        RegexpTemplateEngine te = new RegexpTemplateEngine();
+        Map<String, Object> pp = new HashMap<String, Object>();
+        pp.put("correctedItemName1", "pozycja");
+        pp.put("correctedItemNewNetValue1", "1");
+        pp.put("correctedItemName2", null);
+        pp.put("correctedItemNewNetValue2", null);
+        String r1 = te.merge("?IF-correctedItemName1?Pozycja: $correctedItemName1$ Na: $correctedItemNewNetValue1$?ENDIF-correctedItemName1??IF-correctedItemName2?Pozycja: $correctedItemName2$ Na: $correctedItemNewNetValue2$?ENDIF-correctedItemName2?", pp);
+        Assert.assertEquals("Pozycja: pozycja Na: 1", r1);
+    }
+    
+    @Test
+    public void combinedTest1() {
+        RegexpTemplateEngine te = new RegexpTemplateEngine();
+        Map<String, Object> pp = new HashMap<String, Object>();
+        pp.put("y", "1");
+        String r1 = te.merge("?IF-x?bla bla bla?ENDIF-x?$y$", pp);
+        Assert.assertEquals("1", r1);
+    }
+    
+    @Test
+    public void mergeTestNoPresentationValue() {
+        
+        RegexpTemplateEngine te = new RegexpTemplateEngine();
+        
+        Map<String, Object> pp = new HashMap<String, Object>();
+        String r1 = te.merge("$Raz$ dwa $trzy$.", pp);
+        
+        Assert.assertEquals("error:Raz dwa error:trzy.", r1);
+    }
+    
+}

Propchange: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/RegexpTemplateEngineTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/SchedulerTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/SchedulerTest.java?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/SchedulerTest.java (added)
+++ incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/SchedulerTest.java Wed Jan 13 23:20:54 2010
@@ -0,0 +1,17 @@
+package org.apache.hise;
+
+import org.apache.hise.engine.Scheduler;
+import org.junit.Ignore;
+import org.junit.Test;
+
+@Ignore
+public class SchedulerTest {
+    
+    @Test
+    public void test() throws Exception {
+        Scheduler s = new Scheduler();
+        s.init();
+        Thread.sleep(30000);
+        s.destroy();
+    }
+}

Propchange: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/SchedulerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskEvaluatorTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskEvaluatorTest.java?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskEvaluatorTest.java (added)
+++ incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskEvaluatorTest.java Wed Jan 13 23:20:54 2010
@@ -0,0 +1,61 @@
+package org.apache.hise;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import net.sf.saxon.dom.NodeOverNodeInfo;
+import net.sf.saxon.om.NodeInfo;
+
+import org.apache.hise.runtime.Task;
+import org.apache.hise.runtime.TaskEvaluator;
+import org.apache.hise.utils.DOMUtils;
+import org.apache.hise.utils.XQueryEvaluator;
+import org.junit.Test;
+import org.w3c.dom.Node;
+
+public class TaskEvaluatorTest {
+    @Test
+    public void testEval() throws Exception {
+        XQueryEvaluator e = new XQueryEvaluator();
+        List r = e.evaluateExpression("string(*/*/text())", DOMUtils.parse("<a><b/><c>ddx</c></a>"));
+        Assert.assertTrue(r.toString().equals("[ddx]"));
+    }
+
+    @Test
+    public void testEval2() throws Exception {
+        XQueryEvaluator e = new XQueryEvaluator();
+        e.bindVariable(QName.valueOf("abc"), null);
+        Object r = e.evaluateExpression("declare namespace htd='http://www.example.org/WS-HT'; for $i in htd:literal/htd:organizationalEntity/htd:users/htd:user return string($i)", DOMUtils.parse(getClass().getResourceAsStream("/taskEvaluator.xml")));
+        Assert.assertTrue(r.toString().equals("[user1, user2]"));
+    }
+
+    @Test
+    public void testEval3() throws Exception {
+        XQueryEvaluator e = new XQueryEvaluator();
+        Object r = e.evaluateExpression("declare namespace htd='http://www.example.org/WS-HT'; for $i in htd:literal/htd:organizationalEntity/htd:users/htd:user return string($i)", DOMUtils.parse(getClass().getResourceAsStream("/taskEvaluator.xml")).getFirstChild());
+        Assert.assertTrue(r.toString().equals("[user1, user2]"));
+    }
+    
+    @Test
+    public void testEvalOutcome() throws Exception {
+        XQueryEvaluator e = new XQueryEvaluator();
+        e.bindVariable(QName.valueOf("outcome"), true);
+        Assert.assertEquals(true, e.evaluateExpression("$outcome", null).get(0));
+    }
+    
+    @Test
+    public void testEvaluateApproveResponseHeader() throws Exception {
+        Task t = new MockTask();
+        org.apache.hise.dao.Task t2 = new org.apache.hise.dao.Task();
+        t2.setId(1234L);
+        t.setTaskDto(t2);
+        
+        TaskEvaluator te = new TaskEvaluator(t);
+        Node n = te.evaluateApproveResponseHeader();
+        Assert.assertTrue(DOMUtils.domToString(n).contains(">1234<"));
+    }
+
+}

Propchange: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskEvaluatorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskOperationsTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskOperationsTest.java?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskOperationsTest.java (added)
+++ incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskOperationsTest.java Wed Jan 13 23:20:54 2010
@@ -0,0 +1,37 @@
+package org.apache.hise;
+
+import java.util.Collections;
+import java.util.List;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.namespace.QName;
+
+import org.apache.hise.engine.HISEEngine;
+import org.apache.hise.engine.jaxws.TaskOperationsImpl;
+import org.apache.hise.lang.xsd.htda.TTask;
+import org.junit.Test;
+
+public class TaskOperationsTest {
+
+    @Test
+    public void testGetMyTasks() throws Exception {
+        TaskOperationsImpl ti = new MockTaskOperationsImpl();
+        HISEEngine he = new HISEEngine();
+        MockHiseDao hd = new MockHiseDao();
+        he.setHiseDao(hd);
+        ti.setHiseEngine(he);
+        
+        List<TTask> r = ti.getMyTasks("ALL", "ACTUALOWNER", "", Collections.EMPTY_LIST, "", "", 100);
+        System.out.println(r.toString());
+        
+        JAXBContext c = JAXBContext.newInstance("org.apache.hise.lang.xsd.htda");
+        
+        
+        Marshaller m = c.createMarshaller();
+        m.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE );
+        m.marshal(new JAXBElement(QName.valueOf("{http://www.example.org/WS-HT/api/xsd}taskAbstract"), TTask.class, r.get(0)), System.out);
+    }
+}

Propchange: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskOperationsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskTest.java?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskTest.java (added)
+++ incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskTest.java Wed Jan 13 23:20:54 2010
@@ -0,0 +1,23 @@
+package org.apache.hise;
+
+import junit.framework.Assert;
+
+import org.apache.hise.runtime.Task;
+import org.apache.hise.runtime.TaskEvaluator;
+import org.apache.hise.utils.DOMUtils;
+import org.junit.Test;
+
+public class TaskTest {
+    @Test
+    public void testEpr() throws Exception {
+        Task t = new MockTask();
+        org.apache.hise.dao.Task t2 = new org.apache.hise.dao.Task();
+        t2.setId(1234L);
+        t.setTaskDto(t2);
+
+        TaskEvaluator e = new TaskEvaluator(t);
+        String r = DOMUtils.domToString(e.createEprFromHeader(DOMUtils.parse(getClass().getResourceAsStream("/epr.xml")).getDocumentElement()));
+        System.out.println(r);
+        Assert.assertTrue(r.contains("<wsa:EndpointReference xmlns:wsa=\"http://www.w3.org/2005/08/addressing\"><wsa:Address xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">http://localhost:8082/ClaimsResponseService/</wsa:Address></wsa:EndpointReference>"));
+    }
+}

Propchange: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskXmlUtilsTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskXmlUtilsTest.java?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskXmlUtilsTest.java (added)
+++ incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskXmlUtilsTest.java Wed Jan 13 23:20:54 2010
@@ -0,0 +1,93 @@
+/*
+ * 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;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.xpath.XPathConstants;
+
+import net.sf.saxon.dom.NodeWrapper;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hise.dao.Message;
+import org.apache.hise.utils.DOMUtils;
+import org.apache.hise.utils.TaskXmlUtils;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.w3c.dom.Node;
+
+@Ignore
+public class TaskXmlUtilsTest {
+    private static Log __log = LogFactory.getLog(TaskXmlUtilsTest.class);
+
+//    @Test
+//    public void testEvaluateXPath() {
+//        
+//        String xmlRequest = "<enterOrder xmlns:sch='http://www.hise/hise/schema' orderNumber='O26195' caseNumber='C81794' caseType='1' suggestedOwner='1' submitter='1' source='1' issueDate='1' priority='1' note='Niesłychanie pilne. Proszę się pośpieszyć.'>" +
+//                            "    <sch:correctiveInvoice customerId='1' customerCode='KLIENT_27959' correctedInvoiceNumber='1' correctionAmount='353.78' issueReason='1'>" +
+//                            "        <sch:correctiveInvoiceItem name='Usługi telekomunikacyjne.' newNetValue='424.68' newVat='93.4296' newVatRate='22'/>" +
+//                            "        <sch:correctiveInvoiceItem name='Usługi telekomunikacyjne.' newNetValue='1' newVat='0.22' newVatRate='22'/>" +
+//                            "    </sch:correctiveInvoice>" +
+//                            "</enterOrder>";
+//
+//        Map<String, Message> input = new HashMap<String, Message>();
+//        input.put("enterOrder", new Message(xmlRequest));
+//        
+//        TaskXmlUtils txu = new TaskXmlUtils(new NamespaceContext() {
+//
+//            public String getNamespaceURI(String prefix) {
+//                
+//                if (prefix.equals("hise")) {
+//                    return "http://www.hise/hise/schema";
+//                }
+//                if (prefix.equals("htd")) {
+//                    return "http://www.example.org/WS-HT";
+//                }
+//                
+//                return null;
+//            }
+//
+//            public String getPrefix(String namespaceURI) {
+//                return null;
+//            }
+//
+//            public Iterator getPrefixes(String namespaceURI) {
+//                return null;
+//            }
+//            
+//        }, input, null);
+//        
+////      Object o = txu.evaluateXPath("htd:getInput(\"enterOrder\")/hise:correctiveInvoice/@customerId", XPathConstants.STRING);
+////        Object o = txu.evaluateXPath("htd:getInput(\"enterOrder\")/hise:correctiveInvoice/hise:correctiveInvoiceItem/@name", XPathConstants.NODE);
+//        Object o = txu.evaluateXPath("htd:getInput(\"enterOrder\")/hise:correctiveInvoice/@correctedInvoiceNumber", XPathConstants.STRING);
+//        //__log.debug(DOMUtils.domToString((Node) o));
+//        
+//        assertNotNull(o);
+//        assertEquals("1", o);
+//    }
+    
+}

Propchange: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskXmlUtilsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/test/resources/dao.xml
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/test/resources/dao.xml?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/test/resources/dao.xml (added)
+++ incubator/hise/trunk/hise-services/src/test/resources/dao.xml Wed Jan 13 23:20:54 2010
@@ -0,0 +1,76 @@
+<?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.
+  -->
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util" xmlns:http-conf="http://cxf.apache.org/transports/http/configuration" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:cxf="http://cxf.apache.org/core" xmlns:htd="http://www.example.org/WS-HT" xmlns:htda="http://www.example.org/WS-HT/api" xmlns:htdt="http://www.example.org/WS-HT/api/xsd" xmlns:htdaw="http://www.example.org/WS-HT/api/wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ins="http://www.insurance.example.com/claims"
+  xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.0.xsd
+       http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
+       http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
+       http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
+       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
+       ">
+
+  <tx:annotation-driven transaction-manager="transactionManager"/>
+
+  <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
+    <property name="entityManagerFactory" ref="htEntityManagerFactory"/>
+    <property name="dataSource" ref="htDataSource"/>
+  </bean>
+
+  <bean id="htEntityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
+    <property name="dataSource" ref="htDataSource"/>
+    <property name="jpaVendorAdapter" ref="htJPAVendorAdapter"/>
+    <property name="jpaPropertyMap" ref="htJPAPropertyMap"/>
+    <property name="persistenceXmlLocation" value="classpath:/org/apache/hise/persistence.xml"/>
+    <property name="persistenceUnitName" value="org.apache.hise"/>
+  </bean>
+
+  <util:map id="htJPAPropertyMap">
+    <entry key="hibernate.hbm2ddl.auto" value="create-drop"/>
+  </util:map>
+
+  <bean id="htJPAVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
+    <property name="showSql" value="true"/>
+    <property name="generateDdl" value="true"/>
+    <property name="databasePlatform" value="org.hibernate.dialect.H2Dialect"/>
+  </bean>
+  <bean id="htDataSource" class="org.springframework.jdbc.datasource.SingleConnectionDataSource" lazy-init="true">
+    <property name="driverClassName" value="org.h2.Driver"/>
+    <property name="url" value="jdbc:h2:mem:test"/>
+    <property name="username" value="sa"/>
+    <property name="password">
+      <value></value>
+    </property>
+    <property name="autoCommit" value="false"/>
+    <property name="suppressClose" value="true"/>
+  </bean>
+
+  <!--
+    <bean id="htJPAVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> <property name="showSql" value="false"/> <property name="generateDdl" value="true"/> <property name="databasePlatform" value="org.hibernate.dialect.OracleDialect"/> </bean> <bean id="htDataSource" class="org.springframework.jdbc.datasource.SingleConnectionDataSource" lazy-init="true"> <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/> <property name="url" value="jdbc:oracle:thin:@localhost:1521:XE"/> <property name="username" value="hise"/> <property name="password" value="hise"/> <property name="autoCommit" value="false"/> <property name="suppressClose" value="true"/> </bean>
+  -->
+
+  <bean id="hiseDao" class="org.apache.hise.dao.HISEDao">
+    <property name="entityManagerFactory" ref="htEntityManagerFactory"/>
+  </bean>
+
+<!-- 
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util" xmlns:http-conf="http://cxf.apache.org/transports/http/configuration" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:cxf="http://cxf.apache.org/core" xmlns:htd="http://www.example.org/WS-HT" xmlns:htda="http://www.example.org/WS-HT/api" xmlns:htdt="http://www.example.org/WS-HT/api/xsd" xmlns:htdaw="http://www.example.org/WS-HT/api/wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ins="http://www.insurance.example.com/claims"
+  xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.0.xsd
+       http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
+       http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
+       http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
+       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
+       ">
+
+ -->
+</beans>
+

Propchange: incubator/hise/trunk/hise-services/src/test/resources/dao.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/test/resources/duplicateTaskDef.xml
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/test/resources/duplicateTaskDef.xml?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/test/resources/duplicateTaskDef.xml (added)
+++ incubator/hise/trunk/hise-services/src/test/resources/duplicateTaskDef.xml Wed Jan 13 23:20:54 2010
@@ -0,0 +1,365 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 
+https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a0c9ce4c-ee02-2a10-4b96-cb205464aa02
+
+© 2007 Active Endpoints Inc., Adobe Systems Inc., BEA Systems Inc., International
+Business Machines Corporation, Oracle Inc., and SAP AG. All rights reserved.
+ -->
+<htd:humanInteractions xmlns:htd="http://www.example.org/WS-HT"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:tns="http://www.insurance.example.com/claims/"
+    targetNamespace="http://www.insurance.example.com/claims/"
+    xsi:schemaLocation="http://www.example.org/WS-HT file:/usr/share/schemas/ws-humantask.xsd">
+    
+    <!-- 
+        
+        Test human task definition. Contains: task definitions, different human roles definitions,
+        descriptions with parameters.
+        
+        TODO:
+         
+         - matching business request
+        
+    -->
+    
+    <htd:import importType="http://schemas.xmlsoap.org/wsdl/" location="ExampleTasks.wsdl" namespace="http://www.insurance.example.com/claims/"/>
+    
+    <htd:logicalPeopleGroups>
+    
+    	<htd:logicalPeopleGroup name="lpg1">
+            <htd:documentation xml:lang="en-US">Employee group.</htd:documentation>
+            <htd:parameter name="region" type="xsd:string"/>
+        </htd:logicalPeopleGroup>
+
+    </htd:logicalPeopleGroups>
+    
+    <htd:tasks>
+    
+        <!-- Please change properties other than potential owners i both Task1 and Task2 -->
+        
+        <!-- One potential owners -->
+        <htd:task name="Task1">
+            
+            <htd:documentation xml:lang="en-US">This task is used to handle claims that require manual approval. </htd:documentation>
+            <htd:interface portType="tns:ClaimsHandlingPT" operation="approve" responsePortType="tns:ClaimsHandlingCallbackPT" responseOperation="approvalResponse"/>
+            <htd:priority> htd:getInput("ClaimApprovalRequest")/priority </htd:priority>
+            
+            <htd:peopleAssignments>
+            	<htd:potentialOwners>
+                  <htd:from>
+                    <htd:literal>
+                        <htd:organizationalEntity>
+                            <htd:users>
+                                <htd:user>user1</htd:user>
+                            </htd:users>
+                        </htd:organizationalEntity>
+                    </htd:literal>
+                  </htd:from>
+                </htd:potentialOwners>
+                
+                <htd:businessAdministrators>
+                  <htd:from>
+                    <htd:literal>
+                        <htd:organizationalEntity>
+                            <htd:groups>
+                                <htd:group>group1</htd:group>
+                                <htd:group>group2</htd:group>
+                            </htd:groups>
+                        </htd:organizationalEntity>
+                    </htd:literal>
+                  </htd:from>
+                </htd:businessAdministrators>
+
+                <htd:businessAdministrators>
+                  <htd:from>
+                    <htd:literal>
+                        <htd:organizationalEntity>
+                            <htd:users>
+                                <htd:user>user1</htd:user>
+                                <htd:user>user2</htd:user>
+                            </htd:users>
+                        </htd:organizationalEntity>
+                    </htd:literal>
+                  </htd:from>
+                </htd:businessAdministrators>
+
+                <htd:businessAdministrators>
+                    <htd:from logicalPeopleGroup="lpg1">
+                        <htd:argument name="region"> htd:getInput("ClahimApprovalRequest")/region </htd:argument>
+                    </htd:from>
+                </htd:businessAdministrators>
+                
+            	<htd:taskStakeholders>
+                  <htd:from>
+                    <htd:literal>
+                        <htd:organizationalEntity>
+                            <htd:users>
+                                <htd:user>user3</htd:user>
+                            </htd:users>
+                        </htd:organizationalEntity>
+                    </htd:literal>
+                  </htd:from>
+                </htd:taskStakeholders>
+                
+            </htd:peopleAssignments>
+            
+            <htd:delegation potentialDelegatees="nobody"/>
+            
+            <htd:presentationElements>
+                
+                <htd:name xml:lang="en-US"> Approve Claim </htd:name>
+                
+                <htd:presentationParameters>
+                    
+                    <htd:presentationParameter name="firstname" type="xsd:string">
+                        htd:getInput("ClaimApprovalRequest")/cust/firstname </htd:presentationParameter>
+                    
+                    <htd:presentationParameter name="lastname" type="xsd:string">
+                        htd:getInput("ClaimApprovalRequest")/cust/lastname </htd:presentationParameter>
+                    
+                    <htd:presentationParameter name="euroAmount" type="xsd:double">
+                        htd:getInput("ClaimApprovalRequest")/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:presentationElements>
+            
+  <htd:deadlines>
+    <htd:startDeadline>
+      <htd:for>'PT5S'</htd:for>
+      <htd:escalation name="reassignTask3">
+        <htd:reassignment>
+          <htd:potentialOwners>
+            <htd:from>
+              <htd:literal>
+                <htd:organizationalEntity>
+                  <htd:users>
+                    <htd:user>user3</htd:user>
+                  </htd:users>
+                </htd:organizationalEntity>
+
+              </htd:literal>
+            </htd:from>
+          </htd:potentialOwners>
+        </htd:reassignment>
+      </htd:escalation>
+    </htd:startDeadline>
+    <htd:completionDeadline>
+      <htd:for>'PT10S'</htd:for>
+      <htd:escalation name="reassignTask3Completion">
+        <htd:reassignment>
+          <htd:potentialOwners>
+            <htd:from>
+              <htd:literal>
+                <htd:organizationalEntity>
+                  <htd:users>
+                    <htd:user>user4</htd:user>
+                  </htd:users>
+                </htd:organizationalEntity>
+              </htd:literal>
+            </htd:from>
+          </htd:potentialOwners>
+        </htd:reassignment>
+      </htd:escalation>
+    </htd:completionDeadline>
+  </htd:deadlines>
+        </htd:task>    
+        
+        <!-- Two potential owners -->
+        <htd:task name="Task2">
+            
+            <htd:documentation xml:lang="en-US">This task is used to handle claims that require manual approval. </htd:documentation>
+            <htd:interface portType="tns:ClaimsHandlingPT" operation="approve2" responsePortType="tns:ClaimsHandlingCallbackPT" responseOperation="approvalResponse"/>
+            <htd:priority> htd:getInput("ClaimApprovalRequest")/prio </htd:priority>
+            
+            <htd:peopleAssignments>
+            	
+            	<htd:potentialOwners>
+                  <htd:from>
+                    <htd:literal>
+                        <htd:organizationalEntity>
+                            <htd:users>
+                                <htd:user>user1</htd:user>
+                                <htd:user>user2</htd:user>
+                            </htd:users>
+                        </htd:organizationalEntity>
+                    </htd:literal>
+                  </htd:from>
+                </htd:potentialOwners>
+                
+                <htd:businessAdministrators>
+                  <htd:from>
+                    <htd:literal>
+                        <htd:organizationalEntity>
+                            <htd:groups>
+                                <htd:group>group1</htd:group>
+                                <htd:group>group2</htd:group>
+                            </htd:groups>
+                        </htd:organizationalEntity>
+                    </htd:literal>
+                  </htd:from>  
+                </htd:businessAdministrators>
+
+                <htd:businessAdministrators>
+                  <htd:from>
+                    <htd:literal>
+                        <htd:organizationalEntity>
+                            <htd:users>
+                                <htd:user>user1</htd:user>
+                                <htd:user>user2</htd:user>
+                            </htd:users>
+                        </htd:organizationalEntity>
+                    </htd:literal>
+                  </htd:from>  
+                </htd:businessAdministrators>
+
+                <htd:businessAdministrators>
+                    <htd:from logicalPeopleGroup="lpg1">
+                        <htd:argument name="region"> htd:getInput("ClahimApprovalRequest")/region </htd:argument>
+                    </htd:from>
+                </htd:businessAdministrators>
+                
+            	<htd:taskStakeholders>
+                  <htd:from>
+                    <htd:literal>
+                        <htd:organizationalEntity>
+                            <htd:users>
+                                <htd:user>user3</htd:user>
+                            </htd:users>
+                        </htd:organizationalEntity>
+                    </htd:literal>
+                  </htd:from>  
+                </htd:taskStakeholders>
+                
+            </htd:peopleAssignments>
+            
+            <htd:delegation potentialDelegatees="nobody"/>
+            
+            <htd:presentationElements>
+                
+                <htd:name xml:lang="en-US"> Approve Claim </htd:name>
+                
+                <htd:presentationParameters>
+                    
+                    <htd:presentationParameter name="firstname" type="xsd:string">
+                        htd:getInput("ClaimApprovalRequest")/cust/firstname </htd:presentationParameter>
+                    
+                    <htd:presentationParameter name="lastname" type="xsd:string">
+                        htd:getInput("ClaimApprovalRequest")/cust/lastname </htd:presentationParameter>
+                    
+                    <htd:presentationParameter name="euroAmount" type="xsd:double">
+                        htd:getInput("ClaimApprovalRequest")/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:presentationElements>
+            
+        </htd:task>    
+
+
+        <!-- Escalation -->
+        <htd:task name="Task1">
+            
+            <htd:documentation xml:lang="en-US">This task is used to handle claims that require manual approval. </htd:documentation>
+            <htd:interface portType="tns:ClaimsHandlingPT" operation="approve3"/>
+            
+            <htd:peopleAssignments>
+              <htd:potentialOwners>
+                  <htd:from>
+                    <htd:literal>
+                        <htd:organizationalEntity>
+                            <htd:users>
+                                <htd:user>user1</htd:user>
+                            </htd:users>
+                        </htd:organizationalEntity>
+                    </htd:literal>
+                  </htd:from>
+                </htd:potentialOwners>
+
+                <htd:businessAdministrators>
+                  <htd:from>
+                    <htd:literal>
+                        <htd:organizationalEntity>
+                            <htd:users>
+                                <htd:user>user2</htd:user>
+                            </htd:users>
+                        </htd:organizationalEntity>
+                    </htd:literal>
+                  </htd:from>
+                </htd:businessAdministrators>
+            </htd:peopleAssignments>
+            
+            <htd:presentationElements>
+                
+                <htd:name xml:lang="en-US"> Approve Claim </htd:name>
+                
+                <htd:presentationParameters>
+                    
+                    <htd:presentationParameter name="firstname" type="xsd:string">
+                        htd:getInput("ClaimApprovalRequest")/cust/firstname </htd:presentationParameter>
+                    
+                    <htd:presentationParameter name="lastname" type="xsd:string">
+                        htd:getInput("ClaimApprovalRequest")/cust/lastname </htd:presentationParameter>
+                    
+                    <htd:presentationParameter name="euroAmount" type="xsd:double">
+                        htd:getInput("ClaimApprovalRequest")/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:presentationElements>
+
+  <htd:deadlines>
+    <htd:startDeadline>
+      <htd:for>PT5S</htd:for>
+      <htd:escalation name="reassignTask3">
+        <htd:reassignment>
+          <htd:potentialOwners>
+            <htd:from>
+              <htd:literal>
+                <htd:organizationalEntity>
+                  <htd:users>
+                    <htd:user>user3</htd:user>
+                  </htd:users>
+                </htd:organizationalEntity>
+
+              </htd:literal>
+            </htd:from>
+          </htd:potentialOwners>
+        </htd:reassignment>
+      </htd:escalation>
+    </htd:startDeadline>
+    <htd:completionDeadline>
+      <htd:for>PT10S</htd:for>
+      <htd:escalation name="reassignTask3Completion">
+        <htd:reassignment>
+          <htd:potentialOwners>
+            <htd:from>
+              <htd:literal>
+                <htd:organizationalEntity>
+                  <htd:users>
+                    <htd:user>user4</htd:user>
+                  </htd:users>
+                </htd:organizationalEntity>
+              </htd:literal>
+            </htd:from>
+          </htd:potentialOwners>
+        </htd:reassignment>
+      </htd:escalation>
+    </htd:completionDeadline>
+  </htd:deadlines>
+        </htd:task>    
+    </htd:tasks>    
+</htd:humanInteractions>

Propchange: incubator/hise/trunk/hise-services/src/test/resources/duplicateTaskDef.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/test/resources/epr.xml
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/test/resources/epr.xml?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/test/resources/epr.xml (added)
+++ incubator/hise/trunk/hise-services/src/test/resources/epr.xml Wed Jan 13 23:20:54 2010
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing">
+  <wsse:Security soapenv:mustUnderstand="1" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
+    <wsse:UsernameToken wsu:Id="UsernameToken-14728487" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
+      <wsse:Username>user2</wsse:Username>
+      <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">25T8md2OY7AKF4I9wPVsSjow9YI=</wsse:Password>
+      <wsse:Nonce>RCZ1KP85PrRcQrYHT94ZTQ==</wsse:Nonce>
+      <wsu:Created>2010-01-12T12:34:03.568Z</wsu:Created>
+    </wsse:UsernameToken>
+  </wsse:Security>
+  <wsa:Action xmlns:wsa="http://www.w3.org/2005/08/addressing">http://www.insurance.example.com/claims/ClaimsHandlingPT/approveRequest</wsa:Action>
+  <wsa:ReplyTo xmlns:wsa="http://www.w3.org/2005/08/addressing">
+    <wsa:Address>http://localhost:8082/ClaimsResponseService/</wsa:Address>
+  </wsa:ReplyTo>
+</soapenv:Header>
\ No newline at end of file

Propchange: incubator/hise/trunk/hise-services/src/test/resources/epr.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/test/resources/epr2.xml
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/test/resources/epr2.xml?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/test/resources/epr2.xml (added)
+++ incubator/hise/trunk/hise-services/src/test/resources/epr2.xml Wed Jan 13 23:20:54 2010
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
+  <wsa:Address xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">http://localhost:8082/ClaimsResponseService/</wsa:Address>
+</wsa:EndpointReference>

Propchange: incubator/hise/trunk/hise-services/src/test/resources/epr2.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/test/resources/outcome.xml
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/test/resources/outcome.xml?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/test/resources/outcome.xml (added)
+++ incubator/hise/trunk/hise-services/src/test/resources/outcome.xml Wed Jan 13 23:20:54 2010
@@ -0,0 +1,5 @@
+<cla:resolve xmlns:cla="http://www.insurance.example.com/claims">
+  <claimId>htd:getInput("ClaimApprovalRequest")/cla:cust/cla:id/text()</claimId>
+  <ok>{$outcome}</ok>
+</cla:resolve>
+                  
\ No newline at end of file

Propchange: incubator/hise/trunk/hise-services/src/test/resources/outcome.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/test/resources/taskEvaluator.xml
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/test/resources/taskEvaluator.xml?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/test/resources/taskEvaluator.xml (added)
+++ incubator/hise/trunk/hise-services/src/test/resources/taskEvaluator.xml Wed Jan 13 23:20:54 2010
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<htd:literal xmlns:htd="http://www.example.org/WS-HT">
+  <htd:organizationalEntity>
+    <htd:users>
+      <htd:user>user1</htd:user>
+      <htd:user>user2</htd:user>
+    </htd:users>
+  </htd:organizationalEntity>
+</htd:literal>

Propchange: incubator/hise/trunk/hise-services/src/test/resources/taskEvaluator.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message