incubator-hise-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r.@apache.org
Subject svn commit: r959359 [2/3] - in /incubator/hise/branches/0.2.x-experimental: ./ hise-bundle/ hise-bundle/src/main/resources/META-INF/spring/ hise-distro/src/distro/examples/war/claimsHandling/ hise-services/ hise-services/src/main/java/org/apache/hise/a...
Date Wed, 30 Jun 2010 16:06:38 GMT
Modified: incubator/hise/branches/0.2.x-experimental/hise-services/src/main/java/org/apache/hise/runtime/Task.java
URL: http://svn.apache.org/viewvc/incubator/hise/branches/0.2.x-experimental/hise-services/src/main/java/org/apache/hise/runtime/Task.java?rev=959359&r1=959358&r2=959359&view=diff
==============================================================================
--- incubator/hise/branches/0.2.x-experimental/hise-services/src/main/java/org/apache/hise/runtime/Task.java (original)
+++ incubator/hise/branches/0.2.x-experimental/hise-services/src/main/java/org/apache/hise/runtime/Task.java Wed Jun 30 16:06:35 2010
@@ -22,9 +22,19 @@ package org.apache.hise.runtime;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
+import javax.wsdl.Operation;
+import javax.wsdl.Part;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
 
 import org.apache.commons.lang.Validate;
 import org.apache.commons.logging.Log;
@@ -43,6 +53,8 @@ import org.apache.hise.lang.xsd.htd.TOrg
 import org.apache.hise.lang.xsd.htd.TUserlist;
 import org.apache.hise.utils.DOMUtils;
 import org.apache.hise.utils.XmlUtils;
+import org.apache.ws.commons.schema.utils.NamespaceMap;
+import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
 /**
@@ -66,24 +78,24 @@ public class Task {
     private TaskEvaluator taskEvaluator;
 
     private List<TaskStateListener> taskStateListeners;
-    
+
     private Job currentJob;
     private Date currentEventDateTime = Calendar.getInstance().getTime();
-    
+
     private String currentUser;
-    
+
     private DeadlineController deadlineController;
-    
+
     protected Task() {}
-    
+
     public Job getCurrentJob() {
         return currentJob;
     }
-    
+
     public void setCurrentJob(Job currentJob) {
         this.currentJob = currentJob;
     }
-    
+
     public Date getCurrentEventDateTime() {
         return currentEventDateTime;
     }
@@ -109,9 +121,9 @@ public class Task {
     }
 
     private Task(HISEEngineImpl engine, boolean notification) {
-        
+
         Validate.notNull(engine);
-        
+
         this.hiseEngine = engine;
 
         taskStateListeners = new ArrayList<TaskStateListener>();
@@ -161,32 +173,36 @@ public class Task {
                     }
                 }
             }
-            
+
             if (poSize == 1 && selected != null) {
                 //Nominate a single potential owner
                 setActualOwner(selected.getName());
             }
         }
     }
-    
+
     public static Task create(HISEEngineImpl engine, TaskDefinition taskDefinition, String createdBy, Node requestXml, Node requestHeader) {
 
         Task t = new Task(engine, false);
         Validate.notNull(taskDefinition);
         Validate.isTrue(!taskDefinition.isNotification());
-        
+
+        Map<String, Node> inputParts = findInputParts(taskDefinition, requestXml);
+
         t.taskDefinition = taskDefinition;
         org.apache.hise.dao.Task taskDto = new org.apache.hise.dao.Task();
         taskDto.setTaskDefinitionKey(taskDefinition.getTaskName().toString());
         taskDto.setCreatedBy(createdBy);
         taskDto.setStatus(null);
-        taskDto.getInput().put("request", new Message("request", DOMUtils.domToString(requestXml)));
+        for(String partName: inputParts.keySet()) {
+            taskDto.getInput().put(partName, new Message(partName, DOMUtils.domToString(inputParts.get(partName))));
+        }
         taskDto.getInput().put("requestHeader", new Message("requestHeader", DOMUtils.domToString(requestHeader)));
         taskDto.setCreatedOn(new Date());
         taskDto.setActivationTime(new Date());
         taskDto.setEscalated(false);
         taskDto.setNotification(false);
-        
+
         engine.getHiseDao().persist(taskDto);
         t.taskDto = taskDto;
         try {
@@ -196,7 +212,7 @@ public class Task {
         }
 
         taskDto.setPeopleAssignments(t.getTaskEvaluator().evaluatePeopleAssignments());
-        
+
         try {
             t.setStatus(Status.READY);
         } catch (HiseIllegalStateException e) {
@@ -254,27 +270,67 @@ public class Task {
         // recalculatePriority();
     }
 
+    static Map<String, Node> findInputParts(TaskDefinition taskDefinition, Node requestXml) {
+        Map<String, Node> inputParts = new HashMap<String, Node>();
+
+        Operation operation = taskDefinition.getPortType().getOperation(taskDefinition.getTaskInterface().getOperation(), null, null);
+        if(operation == null) {
+            LogFactory.getLog(Task.class).error("Operation: " + taskDefinition.getTaskInterface().getOperation() + " not found in port type definition.");
+            return inputParts;
+        }
+
+        Map<String, Part> partsMap = operation.getInput().getMessage().getParts();
+        Node messagePart = null;
+        for (Part part : partsMap.values()) {
+            String name = part.getName();
+            QName element = part.getElementName();
+            QName type = part.getTypeName();
+            Element root = (Element) requestXml;            
+            XPath xPath = XPathFactory.newInstance().newXPath();
+            try {
+                if (element != null) {
+                    Map namespaceMap = new HashMap(1);
+                    namespaceMap.put("prefix", element.getNamespaceURI());
+                    NamespaceContext nc = new NamespaceMap(namespaceMap);
+                    xPath.setNamespaceContext(nc);
+                    messagePart = (Node) xPath.evaluate("prefix:" + element.getLocalPart(), root, XPathConstants.NODE);
+                } else if (type != null) {
+                    messagePart = (Node) xPath.evaluate("child::*/" + part.getName(), root, XPathConstants.NODE);
+                }
+            } catch (XPathExpressionException ex) {
+                LogFactory.getLog(Task.class).error("Can not get message part.", ex);
+            }
+            inputParts.put(name, messagePart);
+        }
+
+        return inputParts;
+    }
+
     public static Task createNotification(HISEEngineImpl engine, TaskDefinition taskDefinition, String createdBy, Node requestXml, Node requestHeader) {
-        
+
         Validate.notNull(taskDefinition);
         Validate.isTrue(taskDefinition.isNotification());
-        
+
         Task t = new Task(engine, true);
-        
+
         t.taskDefinition = taskDefinition;
 
+        Map<String, Node> inputParts = findInputParts(taskDefinition, requestXml);
+
         org.apache.hise.dao.Task taskDto = new org.apache.hise.dao.Task();
         taskDto.setTaskDefinitionKey(taskDefinition.getTaskName().toString());
         taskDto.setCreatedBy(createdBy);
         taskDto.setStatus(null);
-        taskDto.getInput().put("request", new Message("request", DOMUtils.domToString(requestXml)));
+        for(String partName: inputParts.keySet()) {
+            taskDto.getInput().put(partName, new Message(partName, DOMUtils.domToString(inputParts.get(partName))));
+        }
         taskDto.getInput().put("requestHeader", new Message("requestHeader", DOMUtils.domToString(requestHeader)));
         taskDto.setCreatedOn(new Date());
         taskDto.setActivationTime(new Date());
         taskDto.setEscalated(false);
         taskDto.setNotification(true);
         engine.getHiseDao().persist(taskDto);
-        
+
         t.taskDto = taskDto;
         try {
             t.setStatus(Status.CREATED);
@@ -283,7 +339,7 @@ public class Task {
         }
 
         taskDto.setPeopleAssignments(t.getTaskEvaluator().evaluatePeopleAssignments());
-        
+
         try {
             t.setStatus(Status.READY);
         } catch (HiseIllegalStateException e) {
@@ -291,7 +347,7 @@ public class Task {
         }
 
         engine.getHiseDao().persist(taskDto);
-        
+
         return t;
     }
 
@@ -299,7 +355,7 @@ public class Task {
         setStatus(Status.RESERVED);
         taskDto.setActualOwner(user);
     }
-    
+
     public void setOutput(Node requestXml) {
         __log.debug("setting task output to: " + requestXml);
         this.taskDto.getOutput().put("request", new Message("request", DOMUtils.domToString(requestXml)));
@@ -559,7 +615,7 @@ public class Task {
         if (isCurrentUserInPotentialOwners()) {
             throw new HiseIllegalAccessException("User: " + currentUser + " is not a potential owner.");
         }
-        
+
         // //TODO test
         // // check if the person is excluded from potential owners
         // if ((this.getExcludedOwners() != null && this.getExcludedOwners().contains(person))) {
@@ -571,7 +627,7 @@ public class Task {
         // taskDto.addOperationComment(Operations.CLAIM, person);
         setStatus(Status.RESERVED);
     }
-    
+
     /**
      * TODO implement
      */
@@ -590,7 +646,7 @@ public class Task {
     public void release() throws HiseIllegalStateException {
         setStatus(Status.READY);
     }
-    
+
     /**
      * Suspends the task.
      * @throws HiseIllegalStateException 
@@ -598,7 +654,7 @@ public class Task {
     public void suspend() throws HiseIllegalStateException {
         setStatus(Status.SUSPENDED);
     }
-    
+
     public void suspendUntil(Date when) throws HiseIllegalStateException {
         Validate.notNull(when);
 
@@ -606,7 +662,7 @@ public class Task {
         Job job = hiseEngine.getHiseScheduler().createJob(when, "suspendUntil", taskDto);
         taskDto.setSuspendUntil(job);
     }
-    
+
     public void suspendUntilJobAction() throws HiseIllegalStateException {
         taskDto.setSuspendUntil(null);
         resume();
@@ -616,7 +672,7 @@ public class Task {
         taskDto.getDeadlines().remove(getCurrentJob());
         deadlineController.deadlineCrossed(getCurrentJob());
     }
-    
+
     public void resume() throws HiseIllegalStateException {
         setStatus(taskDto.getStatusBeforeSuspend());
     }
@@ -626,18 +682,21 @@ public class Task {
         sendResponse();
     }
 
+    /**
+     * TODO Execution of the task finished successfully. If no output data is set the operation returns illegalArgumentFault.
+     */
     public void complete() throws HiseIllegalStateException {
         setStatus(Status.COMPLETED);
         sendResponse();
     }
-    
+
     /**
      * FIXME is outcome a reponse?
      */
     private void sendResponse() {
         try {
             Node response = taskEvaluator.evaluateOutcome(taskDto.getStatus() == Status.COMPLETED);
-            hiseEngine.sendResponse(getTaskDefinition().getTaskName(), 
+            hiseEngine.sendResponse(getTaskDefinition().getTaskName(),
                     response,
                     taskEvaluator.createEprFromHeader(DOMUtils.parse(taskDto.getInput().get("requestHeader").getMessage()).getDocumentElement()));
         } catch (Exception e) {
@@ -649,10 +708,10 @@ public class Task {
         setStatus(Status.READY);
         taskDto.setActualOwner(null);
     }
-    
+
     public void forward(TOrganizationalEntity target) throws HiseIllegalStateException {
         Set<TaskOrgEntity> e = new HashSet<TaskOrgEntity>();
-        
+
         for (String user : XmlUtils.notNull(target.getUsers(), new TUserlist()).getUser()) {
             TaskOrgEntity x = new TaskOrgEntity();
             x.setGenericHumanRole(GenericHumanRole.POTENTIALOWNERS);
@@ -670,24 +729,24 @@ public class Task {
             x.setTask(taskDto);
             e.add(x);
         }
-        
+
         forward(e);
     }
-    
+
     public void forward(Set<TaskOrgEntity> targets) throws HiseIllegalStateException {
         __log.debug("forwarding to " + targets);
         releaseOwner();
-        
+
         for (TaskOrgEntity x : taskDto.getPeopleAssignments()) {
             x.setTask(null);
             hiseEngine.getHiseDao().remove(x);
         }
         taskDto.getPeopleAssignments().clear();
         taskDto.getPeopleAssignments().addAll(targets);
-        
+
         tryNominateOwner();
     }
-    
+
 
     //    
     // /**
@@ -1140,16 +1199,16 @@ public class Task {
     // return result;
     // }
 
-    
+
     public void remove() {
         Validate.isTrue(taskDto.isNotification());
         hiseEngine.getHiseDao().remove(taskDto);
     }
-    
+
     public Node getInput(String part) {
         return DOMUtils.parse(taskDto.getInput().get(part).getMessage()).getDocumentElement();
     }
-    
+
     public Node getOutput(String part) {
         return DOMUtils.parse(taskDto.getOutput().get(part).getMessage()).getDocumentElement();
     }

Modified: incubator/hise/branches/0.2.x-experimental/hise-services/src/main/java/org/apache/hise/runtime/TaskEvaluator.java
URL: http://svn.apache.org/viewvc/incubator/hise/branches/0.2.x-experimental/hise-services/src/main/java/org/apache/hise/runtime/TaskEvaluator.java?rev=959359&r1=959358&r2=959359&view=diff
==============================================================================
--- incubator/hise/branches/0.2.x-experimental/hise-services/src/main/java/org/apache/hise/runtime/TaskEvaluator.java (original)
+++ incubator/hise/branches/0.2.x-experimental/hise-services/src/main/java/org/apache/hise/runtime/TaskEvaluator.java Wed Jun 30 16:06:35 2010
@@ -50,8 +50,10 @@ import org.apache.hise.lang.xsd.htd.TToP
 import org.apache.hise.utils.DOMUtils;
 import org.apache.hise.utils.XQueryEvaluator;
 import org.apache.hise.utils.XmlUtils;
+import org.w3c.dom.DOMImplementation;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
+import org.w3c.dom.bootstrap.DOMImplementationRegistry;
 
 public class TaskEvaluator {
     
@@ -67,7 +69,11 @@ public class TaskEvaluator {
         public static Node getInput(String part) {
             TaskEvaluator te = (TaskEvaluator) XQueryEvaluator.contextObjectTL.get();
             try {
-                return DOMUtils.parse(te.task.getTaskDto().getInput().get(part).getMessage()).getDocumentElement();
+                if(te.task.getTaskDto().getInput().get(part) != null) {
+                    return DOMUtils.parse(te.task.getTaskDto().getInput().get(part).getMessage()).getDocumentElement();
+                } else {
+                    return null;
+                }
             } catch (Exception e) {
                 throw new RuntimeException("", e);
             }
@@ -77,6 +83,7 @@ public class TaskEvaluator {
     public XQueryEvaluator buildQueryEvaluator() {
         XQueryEvaluator evaluator = new XQueryEvaluator();
         evaluator.setContextObject(this);
+        evaluator.declareNamespace("htd", "http://www.example.org/WS-HT");
         evaluator.declareJavaClass("http://www.example.org/WS-HT", HtdFunctions.class);
         evaluator.bindVariable(QName.valueOf("taskId"), task.getTaskDto().getId());
         evaluator.bindVariable(QName.valueOf("currentEventDateTime"), task.getCurrentEventDateTime());

Modified: incubator/hise/branches/0.2.x-experimental/hise-services/src/main/java/org/apache/hise/utils/XQueryEvaluator.java
URL: http://svn.apache.org/viewvc/incubator/hise/branches/0.2.x-experimental/hise-services/src/main/java/org/apache/hise/utils/XQueryEvaluator.java?rev=959359&r1=959358&r2=959359&view=diff
==============================================================================
--- incubator/hise/branches/0.2.x-experimental/hise-services/src/main/java/org/apache/hise/utils/XQueryEvaluator.java (original)
+++ incubator/hise/branches/0.2.x-experimental/hise-services/src/main/java/org/apache/hise/utils/XQueryEvaluator.java Wed Jun 30 16:06:35 2010
@@ -58,6 +58,8 @@ public class XQueryEvaluator {
     public static ThreadLocal<Object> contextObjectTL = new ThreadLocal<Object>() ;
     
     private Map<QName, Object> vars = new HashMap<QName, Object>();
+    private Map<String, String> namespaces = new HashMap<String, String>();
+    
     private Configuration config = Configuration.makeConfiguration(null, null);
     private JavaExtensionLibrary jel = new JavaExtensionLibrary(config);
     
@@ -71,6 +73,10 @@ public class XQueryEvaluator {
         jel.declareJavaClass(uri, clazz);
     }
 
+    public void declareNamespace(String prefix, String namespace) {
+        namespaces.put(prefix, namespace);
+    }
+
     public void setContextObject(Object contextObject) {
         this.contextObject = contextObject;
     }
@@ -100,6 +106,9 @@ public class XQueryEvaluator {
             }
 
             StaticQueryContext sqc = new StaticQueryContext(config);
+            for (Map.Entry<String,String> namespace : namespaces.entrySet()){
+                sqc.declareNamespace(namespace.getKey(), namespace.getValue());
+            }
             for (QName var : vars.keySet()) {
                 sqc.declareGlobalVariable(StructuredQName.fromClarkName(var.toString()), SequenceType.SINGLE_ITEM, convertJavaToSaxon(vars.get(var)) , false);
             }

Added: incubator/hise/branches/0.2.x-experimental/hise-spring/pom.xml
URL: http://svn.apache.org/viewvc/incubator/hise/branches/0.2.x-experimental/hise-spring/pom.xml?rev=959359&view=auto
==============================================================================
--- incubator/hise/branches/0.2.x-experimental/hise-spring/pom.xml (added)
+++ incubator/hise/branches/0.2.x-experimental/hise-spring/pom.xml Wed Jun 30 16:06:35 2010
@@ -0,0 +1,221 @@
+<?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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.hise</groupId>
+        <artifactId>hise</artifactId>
+        <version>0.2.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>hise-spring</artifactId>
+    <packaging>jar</packaging>
+    <version>0.2.0-SNAPSHOT</version>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.hise</groupId>
+            <artifactId>hise-wsdl</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.hise</groupId>
+            <artifactId>hise-services</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.openjpa</groupId>
+            <artifactId>openjpa</artifactId>
+            <version>1.2.1</version>
+        </dependency>
+
+
+        <!-- Spring Dependencies -->
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+            <version>${spring.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-core</artifactId>
+            <version>${spring.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-tx</artifactId>
+            <version>${spring.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-asm</artifactId>
+            <version>${spring.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-expression</artifactId>
+            <version>${spring.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-aop</artifactId>
+            <version>${spring.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-jdbc</artifactId>
+            <version>${spring.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-orm</artifactId>
+            <version>${spring.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-beans</artifactId>
+            <version>${spring.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>asm</groupId>
+            <artifactId>asm-commons</artifactId>
+            <version>2.2.3</version>
+        </dependency>
+        <dependency>
+            <groupId>asm</groupId>
+            <artifactId>asm</artifactId>
+            <version>2.2.3</version>
+        </dependency>
+        <dependency>
+            <groupId>cglib</groupId>
+            <artifactId>cglib-nodep</artifactId>
+            <version>2.2</version>
+        </dependency>
+        <!-- End of Spring Dependencies -->
+
+
+        <!-- CFX Dependencies -->
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-bindings-http</artifactId>
+            <version>${cxf.version}</version>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-core</artifactId>
+            <version>${cxf.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-frontend-jaxws</artifactId>
+            <version>${cxf.version}</version>
+            <exclusions>
+                <exclusion>
+                    <artifactId>jaxb-xjc</artifactId>
+                    <groupId>com.sun.xml.bind</groupId>
+                </exclusion>
+                <exclusion>
+                    <artifactId>asm</artifactId>
+                    <groupId>asm</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-transports-http</artifactId>
+            <version>${cxf.version}</version>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-common-utilities</artifactId>
+            <version>${cxf.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-ws-security</artifactId>
+            <version>${cxf.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>xalan</groupId>
+            <artifactId>xalan</artifactId>
+            <version>2.7.1</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.xml.soap</groupId>
+            <artifactId>saaj-impl</artifactId>
+            <version>1.3</version>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>soap</groupId>
+            <artifactId>soap</artifactId>
+            <scope>runtime</scope>
+            <version>2.3.1</version>
+        </dependency>
+        <dependency>
+            <groupId>wsdl4j</groupId>
+            <artifactId>wsdl4j</artifactId>
+            <scope>runtime</scope>
+            <version>1.6.2</version>
+        </dependency>
+        <!-- End of CFX Dependencies -->
+
+        <!-- Test Dependencies -->
+        <dependency>
+            <groupId>com.h2database</groupId>
+            <artifactId>h2</artifactId>
+            <version>1.1.108</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jmock</groupId>
+            <artifactId>jmock</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jmock</groupId>
+            <artifactId>jmock-legacy</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-test</artifactId>
+            <version>${spring.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <!--
+        <dependency>
+            <groupId>jdepend</groupId>
+            <artifactId>jdepend</artifactId>
+            <version>2.9.1</version>
+            <scope>test</scope>
+        </dependency>
+        -->
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <version>${log4j.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+    </dependencies>
+</project>
+
+

Added: incubator/hise/branches/0.2.x-experimental/hise-spring/src/main/java/org/apache/hise/dao/Transactional.java
URL: http://svn.apache.org/viewvc/incubator/hise/branches/0.2.x-experimental/hise-spring/src/main/java/org/apache/hise/dao/Transactional.java?rev=959359&view=auto
==============================================================================
--- incubator/hise/branches/0.2.x-experimental/hise-spring/src/main/java/org/apache/hise/dao/Transactional.java (added)
+++ incubator/hise/branches/0.2.x-experimental/hise-spring/src/main/java/org/apache/hise/dao/Transactional.java Wed Jun 30 16:06:35 2010
@@ -0,0 +1,18 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.apache.hise.dao;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.TYPE,ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+@org.springframework.transaction.annotation.Transactional
+public @interface Transactional {
+
+}

Added: incubator/hise/branches/0.2.x-experimental/hise-spring/src/main/java/org/apache/hise/dao/vendor/OpenJpaVendorAdapter.java
URL: http://svn.apache.org/viewvc/incubator/hise/branches/0.2.x-experimental/hise-spring/src/main/java/org/apache/hise/dao/vendor/OpenJpaVendorAdapter.java?rev=959359&view=auto
==============================================================================
--- incubator/hise/branches/0.2.x-experimental/hise-spring/src/main/java/org/apache/hise/dao/vendor/OpenJpaVendorAdapter.java (added)
+++ incubator/hise/branches/0.2.x-experimental/hise-spring/src/main/java/org/apache/hise/dao/vendor/OpenJpaVendorAdapter.java Wed Jun 30 16:06:35 2010
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2002-2008 the original author or authors.
+ *
+ * Licensed 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.dao.vendor;
+
+import java.util.HashMap;
+import java.util.Map;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.spi.PersistenceProvider;
+
+import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
+import org.apache.openjpa.persistence.OpenJPAEntityManagerSPI;
+import org.apache.openjpa.persistence.PersistenceProviderImpl;
+
+import org.springframework.orm.jpa.JpaDialect;
+import org.springframework.orm.jpa.vendor.AbstractJpaVendorAdapter;
+import org.springframework.orm.jpa.vendor.Database;
+import org.springframework.orm.jpa.vendor.OpenJpaDialect;
+
+/**
+ * {@link org.springframework.orm.jpa.JpaVendorAdapter} implementation for
+ * Apache OpenJPA. Developed and tested against OpenJPA 1.0.0.
+ *
+ * <p>Exposes OpenJPA's persistence provider and EntityManager extension interface,
+ * and supports {@link AbstractJpaVendorAdapter}'s common configuration settings.
+ *
+ * @author Costin Leau
+ * @author Juergen Hoeller
+ * @since 2.0
+ * @see org.apache.openjpa.persistence.PersistenceProviderImpl
+ * @see org.apache.openjpa.persistence.OpenJPAEntityManager
+ */
+public class OpenJpaVendorAdapter extends AbstractJpaVendorAdapter {
+
+        private final PersistenceProvider persistenceProvider = new PersistenceProviderImpl();
+
+        private final OpenJpaDialect jpaDialect = new OpenJpaDialect();
+
+        private Map<String, Object> extProperties = new HashMap<String, Object>();
+
+        public Map<String, Object> getExtProperties() {
+            return extProperties;
+        }
+
+        public void setExtProperties(Map<String, Object> extProperties) {
+            this.extProperties = extProperties;
+        }
+
+        public PersistenceProvider getPersistenceProvider() {
+                return this.persistenceProvider;
+        }
+
+        @Override
+        public String getPersistenceProviderRootPackage() {
+                return "org.apache.openjpa";
+        }
+
+        @Override
+        public Map<String, Object> getJpaPropertyMap() {
+                Map<String, Object> jpaProperties = new HashMap<String, Object>();
+
+                if (getDatabasePlatform() != null) {
+                        jpaProperties.put("openjpa.jdbc.DBDictionary", getDatabasePlatform());
+                }
+                else if (getDatabase() != null) {
+                        String databaseDictonary = determineDatabaseDictionary(getDatabase());
+                        if (databaseDictonary != null) {
+                                jpaProperties.put("openjpa.jdbc.DBDictionary", databaseDictonary);
+                        }
+                }
+
+                if (isGenerateDdl()) {
+                        jpaProperties.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
+                }
+                if (isShowSql()) {
+                        // Taken from the OpenJPA 0.9.6 docs ("Standard OpenJPA Log Configuration + All SQL Statements")
+                        jpaProperties.put("openjpa.Log", "DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE");
+                }
+
+                jpaProperties.putAll(extProperties);
+                
+                return jpaProperties;
+        }
+
+        /**
+         * Determine the OpenJPA database dictionary name for the given database.
+         * @param database the specified database
+         * @return the OpenJPA database dictionary name, or <code>null<code> if none found
+         */
+        protected String determineDatabaseDictionary(Database database) {
+                switch (database) {
+                        case DB2: return "db2";
+                        case DERBY: return "derby";
+                        case HSQL: return "hsql(SimulateLocking=true)";
+                        case INFORMIX: return "informix";
+                        case MYSQL: return "mysql";
+                        case ORACLE: return "oracle";
+                        case POSTGRESQL: return "postgres";
+                        case SQL_SERVER: return "sqlserver";
+                        case SYBASE: return "sybase";
+                        default: return null;
+                }
+        }
+
+        @Override
+        public JpaDialect getJpaDialect() {
+                return this.jpaDialect;
+        }
+
+        @Override
+        public Class<? extends EntityManagerFactory> getEntityManagerFactoryInterface() {
+                return OpenJPAEntityManagerFactorySPI.class;
+        }
+
+        @Override
+        public Class<? extends EntityManager> getEntityManagerInterface() {
+                return OpenJPAEntityManagerSPI.class;
+        }
+
+}
\ No newline at end of file

Added: incubator/hise/branches/0.2.x-experimental/hise-spring/src/main/resources/hise.xml
URL: http://svn.apache.org/viewvc/incubator/hise/branches/0.2.x-experimental/hise-spring/src/main/resources/hise.xml?rev=959359&view=auto
==============================================================================
--- incubator/hise/branches/0.2.x-experimental/hise-spring/src/main/resources/hise.xml (added)
+++ incubator/hise/branches/0.2.x-experimental/hise-spring/src/main/resources/hise.xml Wed Jun 30 16:06:35 2010
@@ -0,0 +1,141 @@
+<?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-3.0.xsd
+       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
+       http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.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-3.0.xsd
+       ">
+
+    <import resource="classpath:META-INF/cxf/cxf.xml"/>
+    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
+    <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
+    <import resource="classpath:META-INF/cxf/cxf-extension-jaxws.xml"/> 
+
+    <!-- no autowiring, manually specify the injections using the Spring configuration below
+  <context:annotation-config/>
+-->
+
+    <tx:annotation-driven transaction-manager="transactionManager"/>
+
+    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
+        <property name="entityManagerFactory" ref="htEntityManagerFactory"/>
+        <property name="dataSource" ref="dataSource"/>
+    </bean>
+
+    <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
+    <bean id="commonAnnotationBean" class="org.springframework.context.annotation.CommonAnnotationBeanPostProcessor"/>
+    <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
+        <property name="targetObject">
+            <ref local="commonAnnotationBean" />
+        </property>
+        <property name="targetMethod">
+            <value>ignoreResourceType</value>
+        </property>
+        <property name="arguments">
+            <list>
+                <value>java.net.URL</value>
+            </list>
+        </property>
+    </bean>
+    <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
+        <property name="targetObject">
+            <ref local="commonAnnotationBean" />
+        </property>
+        <property name="targetMethod">
+            <value>ignoreResourceType</value>
+        </property>
+        <property name="arguments">
+            <list>
+                <value>javax.xml.namespace.QName</value>
+            </list>
+        </property>
+    </bean>
+
+    <bean id="hiseDao" class="org.apache.hise.dao.HISEDaoImpl"/>
+
+    <bean id="hiseEngine" class="org.apache.hise.engine.HISEEngineImpl">
+        <property name="hiseDao" ref="hiseDao"/>
+        <property name="hiseScheduler" ref="hiseScheduler"/>
+        <property name="hiseUserDetails" ref="hiseUserDetails"/>
+    </bean>
+
+    <bean id="hiseUserDetails" class="org.apache.hise.engine.DefaultHISEUserDetails">
+        <property name="hiseDao" ref="hiseDao"/>
+    </bean>
+
+    <bean id="hisePasswordCallback" class="org.apache.hise.engine.HISEPasswordCallback">
+        <property name="hiseUserDetails" ref="hiseUserDetails"/>
+    </bean>
+
+    <bean id="hiseScheduler" class="org.apache.hise.engine.HISESchedulerImpl">
+        <property name="jobExecutor" ref="jobExecutor"/>
+    </bean>
+
+    <bean id="jobExecutor" class="org.apache.hise.engine.HISESchedulerImpl$JobExecutorImpl">
+        <property name="hiseDao" ref="hiseDao"/>
+        <property name="jobTaskBuilder" ref="jobTaskBuilder"/>
+    </bean>
+
+    <!-- The JobTask bean could be a singleton but this config illustrates injecting stateful beans using JSR330-->
+    <bean id="jobTaskBuilder"  class="org.springframework.beans.factory.config.ProviderCreatingFactoryBean">
+        <property name="targetBeanName">
+            <idref local="jobTask" />
+        </property>
+    </bean>
+
+    <bean id="jobTask" scope="prototype" class="org.apache.hise.engine.HISESchedulerImpl$JobTaskImpl">
+        <property name="hiseEngine" ref="hiseEngine"/>
+    </bean>
+
+    <util:properties id="hiseLoginProperties" location="classpath:hise-login.properties"/>
+
+    <bean name="taskOperations" class="org.apache.hise.engine.jaxws.TaskOperationsImpl">
+        <property name="hiseEngine" ref="hiseEngine"/>
+    </bean>
+
+    <jaxws:endpoint id="taskOperationsEndpoint" name="taskOperationsEndpoint" address="/taskOperations/" implementor="#taskOperations" implementorClass="org.apache.hise.engine.jaxws.TaskOperationsImpl" serviceName="htdaw:taskOperations" publish="true"  wsdlLocation="classpath:ws-humantask.wsdl">
+        <!--<jaxws:features>
+            <wsa:addressing xmlns:wsa="http://cxf.apache.org/ws/addressing"/>
+        </jaxws:features> -->
+        <jaxws:inInterceptors>
+            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
+                <constructor-arg>
+                    <map>
+                        <entry key="action" value="UsernameToken"/>
+                        <entry key="passwordType" value="PasswordDigest"/>
+                        <entry key="passwordCallbackRef">
+                            <ref bean="hisePasswordCallback"/>
+                        </entry>
+                    </map>
+                </constructor-arg>
+            </bean>
+        </jaxws:inInterceptors>
+    </jaxws:endpoint>
+
+    <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+    <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
+
+    <cxf:bus>
+        <cxf:inInterceptors>
+            <ref bean="logInbound"/>
+        </cxf:inInterceptors>
+        <cxf:outInterceptors>
+            <ref bean="logOutbound"/>
+        </cxf:outInterceptors>
+        <cxf:inFaultInterceptors>
+            <ref bean="logInbound"/>
+        </cxf:inFaultInterceptors>
+        <cxf:outFaultInterceptors>
+            <ref bean="logOutbound"/>
+        </cxf:outFaultInterceptors>
+    </cxf:bus>
+</beans>

Added: incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/ClientTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/ClientTest.java?rev=959359&view=auto
==============================================================================
--- incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/ClientTest.java (added)
+++ incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/ClientTest.java Wed Jun 30 16:06:35 2010
@@ -0,0 +1,20 @@
+package org.apache.hise;
+
+import java.net.URL;
+import javax.xml.namespace.QName;
+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();
+        c.setServiceName(new QName("http://www.insurance.example.com/claims","ClaimsHandlingService"));
+        c.setWsdlDocumentLocation(getClass().getResource("/ExampleTasks.wsdl"));
+        c.init();
+        Assert.assertEquals("http://localhost:8082/ClaimsResponseService/", c.getAddressFromEpr(DOMUtils.parse(getClass().getResourceAsStream("/epr2.xml")).getDocumentElement()));
+    }
+}

Added: incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/CompilerTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/CompilerTest.java?rev=959359&view=auto
==============================================================================
--- incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/CompilerTest.java (added)
+++ incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/CompilerTest.java Wed Jun 30 16:06:35 2010
@@ -0,0 +1,62 @@
+/*
+ * 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.net.URL;
+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;
+
+public class CompilerTest {
+    
+    @Test
+    public void testCompile() throws Exception {
+        URL htdXml = getClass().getClassLoader().getResource("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.assertTrue(s.contains(QName.valueOf("{http://www.insurance.example.com/claims}Notify2")));
+        Assert.assertEquals("someOutput", hi.getTaskDefinitions().get(QName.valueOf("{http://www.insurance.example.com/claims}Task1")).getOutcomeExpression());
+        Assert.assertEquals("approve", hi.getTaskDefinitions().get(QName.valueOf("{http://www.insurance.example.com/claims}Task1")).getTaskInterface().getOperation());
+        Assert.assertEquals("notify", hi.getTaskDefinitions().get(QName.valueOf("{http://www.insurance.example.com/claims}Notify2")).getTaskInterface().getOperation());
+    }
+    
+    @Test//(expected = CompileException.class)
+    public void testDuplicateTaskDef() throws CompileException {
+        URL htdXml = getClass().getClassLoader().getResource("duplicateTaskDef.xml");
+        try {
+            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);
+    }
+
+}

Added: incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/DaoTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/DaoTest.java?rev=959359&view=auto
==============================================================================
--- incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/DaoTest.java (added)
+++ incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/DaoTest.java Wed Jun 30 16:06:35 2010
@@ -0,0 +1,196 @@
+package org.apache.hise;
+
+import java.util.Date;
+import java.util.List;
+
+import org.apache.hise.TaskCreationHelper.TaskType;
+import org.apache.hise.dao.GenericHumanRole;
+import org.apache.hise.dao.HISEDao;
+import org.apache.hise.dao.Job;
+import org.apache.hise.dao.OrgEntity;
+import org.apache.hise.dao.Task;
+import org.apache.hise.dao.TaskQuery;
+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.AbstractJUnit4SpringContextTests;
+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 AbstractJUnit4SpringContextTests {
+    
+	@Autowired
+    private HISEDao hiseDao;
+    
+    @Autowired
+    private JpaTransactionManager transactionManager;
+    
+    private TaskCreationHelper taskHelper = new TaskCreationHelper();
+    
+    private void cleanup() throws Exception {
+        hiseDao.clearAllRecords(OrgEntity.class);
+        hiseDao.clearAllRecords(Task.class);
+        hiseDao.clearAllRecords(Job.class);
+    }
+    
+    @Test
+    public void testDao() throws Exception {
+        TransactionTemplate tt = new TransactionTemplate(transactionManager);
+        Long tid = taskHelper.addTaskInTransaction(TaskType.TASK1, tt, hiseDao);
+        Assert.assertNotNull(tid);
+    }
+    
+    @Test 
+    public void testUserTasks() throws Exception {
+        TransactionTemplate tt = new TransactionTemplate(transactionManager);
+        taskHelper.addTaskInTransaction(TaskType.TASK1, tt, hiseDao);
+        
+        tt.execute(new TransactionCallback() {
+            public Object doInTransaction(TransactionStatus arg0) {
+                try {
+                    TaskQuery query = new TaskQuery();
+                    query.setUser(TaskCreationHelper.TASK1_OWNER);
+                    List<Task> r = hiseDao.getUserTasks(query);
+                    Assert.assertEquals(TaskCreationHelper.TASK1_DEFINITION_KEY, r.get(0).getTaskDefinitionKey());
+                    return null;
+                } catch (Exception e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        });
+    }
+
+    @Test 
+    public void testUserTasks2() throws Exception {
+        TransactionTemplate tt = new TransactionTemplate(transactionManager);
+        tt.execute(new TransactionCallback() {
+            public Object doInTransaction(TransactionStatus arg0) {
+                try{
+                    cleanup();
+                    taskHelper.addTask2(hiseDao);
+                    TaskQuery query = new TaskQuery();
+                    query.setUser(TaskCreationHelper.TASK2_ASSIGNED_USER);
+                    query.setGenericHumanRole(GenericHumanRole.POTENTIALOWNERS);
+                    List<Task> r = hiseDao.getUserTasks(query);
+                    query.getUserGroups().add(TaskCreationHelper.TASK2_ASSIGNED_USER_GROUP);
+                    r = hiseDao.getUserTasks(query);
+                    
+                    Assert.assertEquals(TaskCreationHelper.TASK2_DEFINITION_KEY, r.get(0).getTaskDefinitionKey());
+                    return null;
+                } catch (Exception e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        });
+    }
+    
+    @Test
+    public void testInputs() throws Exception {
+        TransactionTemplate tt = new TransactionTemplate(transactionManager);
+        final Long tid = taskHelper.addTaskInTransaction(TaskType.TASK1, tt, hiseDao);
+        tt.execute(new TransactionCallback() {
+            public Object doInTransaction(TransactionStatus arg0) {
+                try {
+                	Task task = hiseDao.find(Task.class, tid);
+                	Assert.assertTrue(task.getInput().get(TaskCreationHelper.TASK1_INPUT_KEY).getMessage().equals(TaskCreationHelper.TASK1_INPUT_VALUE));
+                } catch (Exception e) {
+                    throw new RuntimeException(e);
+                }
+                return null;
+            }
+        });
+        
+    }
+    
+    @Test 
+    public void testGroupQuery() throws Exception {
+        TransactionTemplate tt = new TransactionTemplate(transactionManager);
+        taskHelper.addTaskInTransaction(TaskType.TASK3, tt, hiseDao);
+                
+        tt.execute(new TransactionCallback() {
+            public Object doInTransaction(TransactionStatus arg0) {
+                try {
+                    TaskQuery query = new TaskQuery();
+                    query.setUser(TaskCreationHelper.TASK3_ASSIGNED_USER);
+                    query.getUserGroups().add(TaskCreationHelper.TASK3_ASSIGNED_GROUP);
+                    query.setGenericHumanRole(GenericHumanRole.POTENTIALOWNERS);
+                    List<Task> r = hiseDao.getUserTasks(query);
+                    Assert.assertEquals(TaskCreationHelper.TASK3_DEFINITION_KEY, r.get(0).getTaskDefinitionKey());
+                } catch (Exception e) {
+                    throw new RuntimeException(e);
+                }
+                return null;
+            }
+        });
+    }
+
+    @Test 
+    public void testJobs() throws Exception {
+        TransactionTemplate tt = new TransactionTemplate(transactionManager);
+        tt.execute(new TransactionCallback() {
+            public Object doInTransaction(TransactionStatus arg0) {
+                try {
+                    cleanup();
+                    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());
+                } catch (Exception e) {
+                    throw new RuntimeException(e);
+                }
+                return null;
+            }
+        });
+    }
+    
+    @Test 
+    public void testDeadlines() throws Exception {
+        TransactionTemplate tt = new TransactionTemplate(transactionManager);
+        final Long tid = (Long) tt.execute(new TransactionCallback() {
+            public Object doInTransaction(TransactionStatus arg0) {
+                try {
+                    cleanup();
+                    Task t = hiseDao.find(Task.class, taskHelper.addTask(hiseDao));
+                    
+                    {
+                        Job j = new Job();
+                        j.setFire(new Date(1213L));
+                        j.setTask(t);
+                        j.setAction("abc");
+                        hiseDao.persist(j);
+                        t.getDeadlines().add(j);
+                    }
+                    {
+                        Job j = new Job();
+                        j.setFire(new Date(1213L));
+                        j.setTask(t);
+                        j.setAction("abc2");
+                        hiseDao.persist(j);
+                        t.getDeadlines().add(j);
+                    }
+                    return t.getId();
+                } catch (Exception e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        });
+        Integer s = (Integer) tt.execute(new TransactionCallback() {
+            public Object doInTransaction(TransactionStatus arg0) {
+                try {
+                    Task t = hiseDao.find(Task.class, tid);
+                    return t.getDeadlines().size();
+                } catch (Exception e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        });
+        Assert.assertEquals(new Integer(2), s);
+    }
+}

Added: incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/HISEEngineTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/HISEEngineTest.java?rev=959359&view=auto
==============================================================================
--- incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/HISEEngineTest.java (added)
+++ incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/HISEEngineTest.java Wed Jun 30 16:06:35 2010
@@ -0,0 +1,15 @@
+package org.apache.hise;
+
+import junit.framework.Assert;
+
+import org.apache.hise.engine.HISEEngineImpl;
+import org.apache.hise.utils.DOMUtils;
+import org.junit.Test;
+
+public class HISEEngineTest {
+    @Test
+    public void testEval2() throws Exception {
+        String r = HISEEngineImpl.fetchCreatedBy(DOMUtils.parse(getClass().getResourceAsStream("/approveHeader.xml")));
+        Assert.assertEquals("soapui", r);
+    }
+}

Added: incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/MessageTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/MessageTest.java?rev=959359&view=auto
==============================================================================
--- incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/MessageTest.java (added)
+++ incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/MessageTest.java Wed Jun 30 16:06:35 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);
+//    }
+
+}

Added: incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/MockHiseDao.java
URL: http://svn.apache.org/viewvc/incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/MockHiseDao.java?rev=959359&view=auto
==============================================================================
--- incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/MockHiseDao.java (added)
+++ incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/MockHiseDao.java Wed Jun 30 16:06:35 2010
@@ -0,0 +1,24 @@
+package org.apache.hise;
+
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.hise.dao.HISEDaoImpl;
+import org.apache.hise.dao.Task;
+import org.apache.hise.dao.TaskQuery;
+import org.apache.hise.dao.Task.Status;
+
+public class MockHiseDao extends HISEDaoImpl {
+
+    @Override
+    public List<Task> getUserTasks(TaskQuery query) {
+        Task t = new Task();
+        t.setId(123L);
+        t.setTaskDefinitionKey("{asdf}asdf");
+        t.setStatus(Status.CREATED);
+        t.setCreatedOn(new Date(1234L));
+        return Collections.singletonList(t);
+    }
+    
+}

Added: incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/MockTask.java
URL: http://svn.apache.org/viewvc/incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/MockTask.java?rev=959359&view=auto
==============================================================================
--- incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/MockTask.java (added)
+++ incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/MockTask.java Wed Jun 30 16:06:35 2010
@@ -0,0 +1,9 @@
+package org.apache.hise;
+
+import org.apache.hise.runtime.Task;
+
+public class MockTask extends Task {
+    public MockTask() {
+        super();
+    }
+}

Added: incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/MockTaskOperationsImpl.java
URL: http://svn.apache.org/viewvc/incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/MockTaskOperationsImpl.java?rev=959359&view=auto
==============================================================================
--- incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/MockTaskOperationsImpl.java (added)
+++ incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/MockTaskOperationsImpl.java Wed Jun 30 16:06:35 2010
@@ -0,0 +1,12 @@
+package org.apache.hise;
+
+import org.apache.hise.engine.jaxws.TaskOperationsImpl;
+
+public class MockTaskOperationsImpl extends TaskOperationsImpl {
+
+    @Override
+    protected String getUserString() {
+        return "user1";
+    }
+
+}

Added: incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/RegexpTemplateEngineTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/RegexpTemplateEngineTest.java?rev=959359&view=auto
==============================================================================
--- incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/RegexpTemplateEngineTest.java (added)
+++ incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/RegexpTemplateEngineTest.java Wed Jun 30 16:06:35 2010
@@ -0,0 +1,135 @@
+/*
+ * 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.apache.hise.utils.TemplateEngine;
+import org.junit.Assert;
+import org.junit.Test;
+
+
+/**
+ * Tests for {@link RegexpTemplateEngine}.
+ * @author Witek Wołejszo
+ */
+public class RegexpTemplateEngineTest {
+
+    @Test
+    public void mergeTest1() {
+        
+        TemplateEngine 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() {
+        
+        TemplateEngine 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() {
+        TemplateEngine 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() {
+        TemplateEngine 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() {
+        TemplateEngine 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() {
+        TemplateEngine 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() {
+        TemplateEngine 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() {
+        
+        TemplateEngine 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);
+    }
+    
+}

Added: incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/SchedulerTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/SchedulerTest.java?rev=959359&view=auto
==============================================================================
--- incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/SchedulerTest.java (added)
+++ incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/SchedulerTest.java Wed Jun 30 16:06:35 2010
@@ -0,0 +1,17 @@
+package org.apache.hise;
+
+import org.apache.hise.engine.HISESchedulerImpl;
+import org.junit.Ignore;
+import org.junit.Test;
+
+@Ignore
+public class SchedulerTest {
+    
+    @Test
+    public void test() throws Exception {
+        HISESchedulerImpl s = new HISESchedulerImpl();
+        s.init();
+        Thread.sleep(30000);
+        s.destroy();
+    }
+}

Added: incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/TaskCreationHelper.java
URL: http://svn.apache.org/viewvc/incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/TaskCreationHelper.java?rev=959359&view=auto
==============================================================================
--- incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/TaskCreationHelper.java (added)
+++ incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/TaskCreationHelper.java Wed Jun 30 16:06:35 2010
@@ -0,0 +1,139 @@
+package org.apache.hise;
+
+import java.util.HashSet;
+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.junit.Assert;
+import org.springframework.transaction.TransactionStatus;
+import org.springframework.transaction.support.TransactionCallback;
+import org.springframework.transaction.support.TransactionTemplate;
+
+public class TaskCreationHelper {
+	
+	public enum TaskType {
+		TASK1, TASK2, TASK3
+	}
+	
+	public static String TASK1_GROUP = "group1";
+	public static String TASK1_OWNER = "user1";
+	public static String TASK1_OWNER_PASSWORD = "abc";
+	public static String TASK1_DEFINITION_KEY = "asd";
+	public static String TASK1_INPUT_KEY = "abc";
+	public static String TASK1_INPUT_VALUE = "def";
+	
+	public static String TASK2_ASSIGNED_USER = "user1";
+	public static String TASK2_ASSIGNED_USER_GROUP = "group1";
+	public static String TASK2_DEFINITION_KEY = "asd2";
+	
+	public static String TASK3_ASSIGNED_USER = "user1";
+	public static String TASK3_ASSIGNED_GROUP = "group1";
+	public static String TASK3_DEFINITION_KEY = "asd3";
+	
+	
+	private void cleanup(HISEDao hiseDao) throws Exception {
+        hiseDao.clearAllRecords(OrgEntity.class);
+        hiseDao.clearAllRecords(Task.class);
+        hiseDao.clearAllRecords(Job.class);
+    }
+    
+    
+    public Long addTask(HISEDao hiseDao) throws Exception {
+        Assert.assertTrue(hiseDao != null);
+        
+        OrgEntity o, o2;
+        
+        o2 = new OrgEntity();
+        o2.setName(TASK1_GROUP);
+        o2.setType(OrgEntityType.GROUP);
+        hiseDao.persist(o2);
+
+        o = new OrgEntity();
+        o.setName(TASK1_OWNER);
+        o.setType(OrgEntityType.USER);
+        o.setUserPassword(TASK1_OWNER_PASSWORD);
+        
+        o.addToGroup(o2);
+        hiseDao.persist(o);
+        
+        Task t = new Task();
+        t.setStatus(Status.CREATED);
+        t.setTaskDefinitionKey(TASK1_DEFINITION_KEY);
+        t.setActualOwner(TASK1_OWNER);
+        
+        t.getInput().put(TASK1_INPUT_KEY, new Message(TASK1_INPUT_KEY, TASK1_INPUT_VALUE));
+        hiseDao.persist(t);
+        Long id = t.getId();
+        Assert.assertNotNull(id);
+        return id;
+    }
+
+    public void addTask2(HISEDao hiseDao) throws Exception {
+        addTask(hiseDao);
+        Task t = new Task();
+        t.setStatus(Status.READY);
+        t.setTaskDefinitionKey(TASK2_DEFINITION_KEY);
+        Set<TaskOrgEntity> pa = new HashSet<TaskOrgEntity>();
+        TaskOrgEntity x = new TaskOrgEntity();
+        x.setName(TASK2_ASSIGNED_USER);
+        x.setType(OrgEntityType.USER);
+        x.setGenericHumanRole(GenericHumanRole.POTENTIALOWNERS);
+        x.setTask(t);
+        pa.add(x);
+        t.setPeopleAssignments(pa);
+        hiseDao.persist(t);
+    }
+
+    public void addTask3(HISEDao hiseDao) throws Exception {
+        addTask(hiseDao);
+        Task t = new Task();
+        t.setStatus(Status.READY);
+        t.setTaskDefinitionKey(TASK3_DEFINITION_KEY);
+        Set<TaskOrgEntity> pa = new HashSet<TaskOrgEntity>();
+        TaskOrgEntity x = new TaskOrgEntity();
+        x.setName(TASK3_ASSIGNED_GROUP);
+        x.setType(OrgEntityType.GROUP);
+        x.setGenericHumanRole(GenericHumanRole.POTENTIALOWNERS);
+        x.setTask(t);
+        pa.add(x);
+        t.setPeopleAssignments(pa);
+        hiseDao.persist(t);
+    }
+    
+    public Long addTaskInTransaction(final TaskType taskType, TransactionTemplate tt, final HISEDao hiseDao) {
+    	Long tid = (Long) tt.execute(new TransactionCallback() {
+            public Object doInTransaction(TransactionStatus arg0) {
+                try {
+                	cleanup(hiseDao);
+                	Long tid = null;
+                    switch(taskType) {
+                    	case TASK1:
+                    		tid = addTask(hiseDao);
+                    		break;
+                    	case TASK2:
+                    		addTask2(hiseDao);
+                    		break;
+                    	case TASK3:
+                    		addTask3(hiseDao);
+                    		break;
+                    }
+                    return tid;
+                	
+                } catch (Exception e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        });
+    	return tid;
+    }
+
+    
+}
\ No newline at end of file

Added: incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/TaskEvaluatorTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/TaskEvaluatorTest.java?rev=959359&view=auto
==============================================================================
--- incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/TaskEvaluatorTest.java (added)
+++ incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/TaskEvaluatorTest.java Wed Jun 30 16:06:35 2010
@@ -0,0 +1,110 @@
+package org.apache.hise;
+
+import java.util.Collections;
+import java.util.Date;
+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 net.sf.saxon.type.TypeHierarchy;
+
+import org.apache.cxf.helpers.IOUtils;
+import org.apache.hise.dao.Message;
+import org.apache.hise.lang.xsd.htd.TDeadline;
+import org.apache.hise.lang.xsd.htd.TDurationExpr;
+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 {
+    
+    private TaskEvaluator buildTaskEvaluator() {
+        Task t = new MockTask();
+        t.setCurrentEventDateTime(new Date(1234L));
+        org.apache.hise.dao.Task t2 = new org.apache.hise.dao.Task();
+        t2.setId(1234L);
+        t2.getInput().put("request", new Message("request", "<a><b>text1</b></a>"));
+        t.setTaskDto(t2);
+        
+        return new TaskEvaluator(t);
+    }
+    
+    @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 testEval4() throws Exception {
+        XQueryEvaluator e = new XQueryEvaluator();
+        e.bindVariable(QName.valueOf("abc"), "val");
+        Object r = e.evaluateExpression(TaskEvaluator.getTemplateExpr(Collections.singletonList((Object) "123 {$abc} 345")), null);
+        Assert.assertEquals(r.toString(), "[123 val 345]");
+    }
+
+    @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 {
+        TaskEvaluator te = buildTaskEvaluator();
+        Node n = te.evaluateApproveResponseHeader();
+        Assert.assertTrue(DOMUtils.domToString(n).contains(">1234<"));
+    }
+    
+    @Test
+    public void testDeadline() throws Exception {
+        TaskEvaluator e = buildTaskEvaluator();
+
+        TDeadline deadline = new TDeadline();
+        TDurationExpr d = new TDurationExpr();
+        deadline.setFor(d);
+        d.getContent().add(new String("'PT5S'"));
+        Date r = e.evaluateDeadline(deadline);
+        Assert.assertEquals(6234L, r.getTime());
+    }
+
+    @Test
+    public void testEvalGetInput() throws Exception {
+        XQueryEvaluator e = buildTaskEvaluator().buildQueryEvaluator();
+        Object r = e.evaluateExpression("declare namespace htd='http://www.example.org/WS-HT'; xs:string(htd:getInput('request')/b)", null);
+        Assert.assertTrue(r.toString().equals("[text1]"));
+    }
+ 
+    @Test
+    public void testEvalOutcome2() throws Exception {
+        System.out.println("testEvalOutcome2");
+        XQueryEvaluator e = buildTaskEvaluator().buildQueryEvaluator();
+        Object r = DOMUtils.domToString((Node) e.evaluateExpression(IOUtils.toString(getClass().getResourceAsStream("/outcome2.xml")), null).get(0));
+        Assert.assertTrue(r.toString().contains("<firstname>text1</firstname><lastname>text1</lastname><taskId>1234</taskId>"));
+        System.out.println("~testEvalOutcome2");
+    }
+}

Added: incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/TaskOperationsTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/TaskOperationsTest.java?rev=959359&view=auto
==============================================================================
--- incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/TaskOperationsTest.java (added)
+++ incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/TaskOperationsTest.java Wed Jun 30 16:06:35 2010
@@ -0,0 +1,76 @@
+package org.apache.hise;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import javax.xml.XMLConstants;
+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 javax.xml.validation.SchemaFactory;
+
+import junit.framework.Assert;
+
+import org.apache.hise.api.HISEUserDetails;
+import org.apache.hise.engine.HISEEngineImpl;
+import org.apache.hise.engine.jaxws.TaskOperationsImpl;
+import org.apache.hise.lang.xsd.htda.TTask;
+import org.apache.hise.lang.xsd.htdt.SuspendUntil;
+import org.apache.hise.utils.XQueryEvaluator;
+import org.junit.Test;
+import org.junit.Ignore;
+
+public class TaskOperationsTest {
+
+    @Ignore
+    public void testGetMyTasks() throws Exception {
+        
+        TaskOperationsImpl ti = new MockTaskOperationsImpl();
+        
+        HISEEngineImpl he = new HISEEngineImpl();
+        he.setHiseUserDetails(new HISEUserDetails() {
+            public String getUserPassword(String user) {
+                return null;
+            }
+            
+            public Collection<String> getUserGroups(String user) {
+                return Collections.singleton("group1");
+            }
+        });
+
+        MockHiseDao dao = new MockHiseDao();
+        he.setHiseDao(dao);
+        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);
+    }
+    
+    @Test
+    public void testSuspendUntil() throws Exception {
+        JAXBContext c = JAXBContext.newInstance("org.apache.hise.lang.xsd.htdt");
+        Unmarshaller m = c.createUnmarshaller();
+        m.setSchema(SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema").newSchema(getClass().getResource("/ws-humantask-api-wsdl.xsd")));
+        SuspendUntil e = (SuspendUntil) m.unmarshal(getClass().getResourceAsStream("/suspendUntil.xml"));
+        XQueryEvaluator ev = new XQueryEvaluator();
+        Date d = (Date) ev.evaluateExpression("declare namespace xsd='http://www.w3.org/2001/XMLSchema'; xsd:dateTime('2009-01-01T12:59:34')", null).get(0);
+        System.out.println(d);
+        e.getTime().getTimePeriod().addTo(d);
+        
+        Date d2 = (Date) ev.evaluateExpression("declare namespace xsd='http://www.w3.org/2001/XMLSchema'; xsd:dateTime('2009-01-04T12:59:34')", null).get(0);
+        System.out.println(d2);
+        Assert.assertEquals(d2, d);
+        System.out.println(d);
+    }
+}

Added: incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/TaskTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/TaskTest.java?rev=959359&view=auto
==============================================================================
--- incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/TaskTest.java (added)
+++ incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/TaskTest.java Wed Jun 30 16:06:35 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>"));
+    }
+}

Added: incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/TaskXmlUtilsTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/TaskXmlUtilsTest.java?rev=959359&view=auto
==============================================================================
--- incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/TaskXmlUtilsTest.java (added)
+++ incubator/hise/branches/0.2.x-experimental/hise-spring/src/test/java/org/apache/hise/TaskXmlUtilsTest.java Wed Jun 30 16:06:35 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);
+//    }
+    
+}



Mime
View raw message