[jbpm-commits] JBoss JBPM SVN: r4735 - in jbpm4/branches/ainze/modules: pvm/src/main/java/org/jbpm/pvm/internal/tx and 33 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue May 5 16:15:23 EDT 2009


Author: ainze
Date: 2009-05-05 16:15:22 -0400 (Tue, 05 May 2009)
New Revision: 4735

Added:
   jbpm4/branches/ainze/modules/test-spring/
   jbpm4/branches/ainze/modules/test-spring/pom.xml
   jbpm4/branches/ainze/modules/test-spring/src/
   jbpm4/branches/ainze/modules/test-spring/src/main/
   jbpm4/branches/ainze/modules/test-spring/src/main/java/
   jbpm4/branches/ainze/modules/test-spring/src/main/java/org/
   jbpm4/branches/ainze/modules/test-spring/src/main/java/org/jbpm/
   jbpm4/branches/ainze/modules/test-spring/src/main/java/org/jbpm/spring/
   jbpm4/branches/ainze/modules/test-spring/src/main/java/org/jbpm/spring/cfg/
   jbpm4/branches/ainze/modules/test-spring/src/main/java/org/jbpm/spring/cfg/SpringConfigurationFactoryBean.java
   jbpm4/branches/ainze/modules/test-spring/src/main/java/org/jbpm/spring/test/
   jbpm4/branches/ainze/modules/test-spring/src/main/java/org/jbpm/spring/test/AbstractTransactionalSpringJbpmTestCase.java
   jbpm4/branches/ainze/modules/test-spring/src/main/java/org/jbpm/test/
   jbpm4/branches/ainze/modules/test-spring/src/main/resources/
   jbpm4/branches/ainze/modules/test-spring/src/test/
   jbpm4/branches/ainze/modules/test-spring/src/test/java/
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/Constants.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/activities/
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/activities/DecisionTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/activities/StateTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/beans/
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/beans/InvokeTestBean.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/beans/SpringBeanTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/cfg/
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/cfg/ConfigurationTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/eventlistener/
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/eventlistener/EventListenerTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/eventlistener/HqlEventListenerTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/execution/
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/execution/ExecutionEagerLoadingTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/execution/FindExecutionTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/execution/SignalExecutionTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/execution/StartExecutionTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/history/
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/history/AvgDurationTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/history/ChoiceDistributionTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/history/EndProcessInstanceTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/history/ProcessInstanceHistoryTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/identity/
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/identity/IdentityTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/mgmt/
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/mgmt/JobQueryTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/process/
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/process/ActivityCoordinatesTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/process/DeploymentResourcesTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/process/ProcessDefinitionQueryTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/process/RepositoryServiceTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/SubTaskTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskCandidatesTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskCommentsTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskCreateUpdateDeleteTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskHandlerTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskListTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskParticipationsTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskQueryTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/variables/
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/variables/BasicVariablesTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/variables/VariableBasicTypesTest.java
   jbpm4/branches/ainze/modules/test-spring/src/test/resources/
   jbpm4/branches/ainze/modules/test-spring/src/test/resources/org/
   jbpm4/branches/ainze/modules/test-spring/src/test/resources/org/jbpm/
   jbpm4/branches/ainze/modules/test-spring/src/test/resources/org/jbpm/spring/
   jbpm4/branches/ainze/modules/test-spring/src/test/resources/org/jbpm/spring/test/
   jbpm4/branches/ainze/modules/test-spring/src/test/resources/org/jbpm/spring/test/applicationContext.xml
   jbpm4/branches/ainze/modules/test-spring/src/test/resources/org/jbpm/spring/test/beans/
   jbpm4/branches/ainze/modules/test-spring/src/test/resources/org/jbpm/spring/test/beans/process.jpdl.xml
   jbpm4/branches/ainze/modules/test-spring/src/test/resources/org/jbpm/spring/test/jbpm.cfg.xml
   jbpm4/branches/ainze/modules/test-spring/src/test/resources/org/jbpm/spring/test/jbpm.hibernate.cfg.xml
Modified:
   jbpm4/branches/ainze/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/SpringTransactionInterceptor.java
   jbpm4/branches/ainze/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SpringTransactionInterceptorBinding.java
Log:
added spring test suite

Modified: jbpm4/branches/ainze/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/SpringTransactionInterceptor.java
===================================================================
--- jbpm4/branches/ainze/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/SpringTransactionInterceptor.java	2009-05-05 19:34:12 UTC (rev 4734)
+++ jbpm4/branches/ainze/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/SpringTransactionInterceptor.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -21,6 +21,7 @@
  */
 package org.jbpm.pvm.internal.tx;
 
+import org.hibernate.Session;
 import org.jbpm.api.JbpmException;
 import org.jbpm.api.cmd.Command;
 import org.jbpm.api.env.Environment;
@@ -28,47 +29,68 @@
 import org.jbpm.pvm.internal.spring.CommandTransactionCallback;
 import org.jbpm.pvm.internal.svc.Interceptor;
 import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.TransactionDefinition;
+import org.springframework.transaction.support.DefaultTransactionDefinition;
 import org.springframework.transaction.support.TransactionCallback;
 import org.springframework.transaction.support.TransactionTemplate;
-import org.springframework.util.Assert;
 
-
-/** calls setRollbackOnly on the transaction in the environment 
- * in case an exception occurs during execution of the command.
+/**
+ * calls setRollbackOnly on the transaction in the environment in case an
+ * exception occurs during execution of the command.
  * 
  * @author Andries Inze
  */
 public class SpringTransactionInterceptor extends Interceptor {
-  
+
   private static final Log log = Log.getLog(SpringTransactionInterceptor.class.getName());
   
+  private boolean useCurrent;
+
   @SuppressWarnings("unchecked")
-public <T> T execute(Command<T> command) {
-	Environment environment = Environment.getCurrent();
-	if (environment==null) {
-	    throw new JbpmException("no environment for managing hibernate transaction");
-	}
-    
+  public <T> T execute(Command<T> command) {
+    Environment environment = Environment.getCurrent();
+    if (environment == null) {
+      throw new JbpmException("no environment for managing hibernate transaction");
+    }
+
     StandardTransaction standardTransaction = environment.get(StandardTransaction.class);
-    if (standardTransaction==null) {
-      throw new JbpmException("no spring-transaction in environment");
+    if (standardTransaction == null) {
+      throw new JbpmException("no standard-transaction in environment");
     }
+
+    PlatformTransactionManager platformTransactionManager = environment.get(PlatformTransactionManager.class);
+    if (platformTransactionManager == null) {
+      throw new JbpmException("No platformTransaction manager defined.");
+    }
     
+    
     standardTransaction.begin();
 
     try {
-    	PlatformTransactionManager platformTransactionManager = environment.get(PlatformTransactionManager.class);
-        Assert.notNull(platformTransactionManager);
-        TransactionTemplate template = new TransactionTemplate(platformTransactionManager);
-        TransactionCallback transactionCallback = new CommandTransactionCallback<T>(command, next, platformTransactionManager);
-        return (T) template.execute(transactionCallback);
+      DefaultTransactionDefinition definition = new DefaultTransactionDefinition();
       
+      if (useCurrent) {
+        definition.setPropagationBehavior(TransactionDefinition.PROPAGATION_MANDATORY);
+      }
+
+      TransactionTemplate template = new TransactionTemplate(platformTransactionManager, definition);
+      TransactionCallback transactionCallback = new CommandTransactionCallback<T>(command, next, platformTransactionManager);
+      T t = (T) template.execute(transactionCallback);
+      
+      Session session = environment.get(Session.class);
+      session.flush();
+      return t;
+//      return next.execute(command);
     } catch (RuntimeException e) {
       standardTransaction.setRollbackOnly();
       throw e;
-      
+
     } finally {
       standardTransaction.complete();
     }
   }
+
+  public void setUseCurrent(Boolean useCurrent) {
+    this.useCurrent = useCurrent;
+  }
 }

Modified: jbpm4/branches/ainze/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SpringTransactionInterceptorBinding.java
===================================================================
--- jbpm4/branches/ainze/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SpringTransactionInterceptorBinding.java	2009-05-05 19:34:12 UTC (rev 4734)
+++ jbpm4/branches/ainze/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SpringTransactionInterceptorBinding.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -23,6 +23,7 @@
 
 import org.jbpm.pvm.internal.tx.SpringTransactionInterceptor;
 import org.jbpm.pvm.internal.tx.StandardTransactionInterceptor;
+import org.jbpm.pvm.internal.util.XmlUtil;
 import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
 import org.jbpm.pvm.internal.xml.Parse;
 import org.jbpm.pvm.internal.xml.Parser;
@@ -42,6 +43,13 @@
 
   public Object parse(Element element, Parse parse, Parser parser) {
     SpringTransactionInterceptor springTransactionInterceptor = new SpringTransactionInterceptor();
+    
+    Boolean useCurrent = XmlUtil.attributeBoolean(element, "current", false, parse);
+    if (useCurrent!=null) {
+      // set it accordingly
+      springTransactionInterceptor.setUseCurrent(useCurrent);
+    }
+    
     return new ProvidedObjectDescriptor(springTransactionInterceptor);
   }
 }

Added: jbpm4/branches/ainze/modules/test-spring/pom.xml
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/pom.xml	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/pom.xml	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ====================================================================== -->
+<!--                                                                        -->
+<!--  JBoss, the OpenSource J2EE webOS                                      -->
+<!--                                                                        -->
+<!--  Distributable under LGPL license.                                     -->
+<!--  See terms of license at http://www.gnu.org.                           -->
+<!--                                                                        -->
+<!-- ====================================================================== -->
+
+<!-- $Id: pom.xml 3558 2008-12-27 12:58:42Z tom.baeyens at jboss.com $ -->
+<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>
+	<name>jBPM 4 - Spring</name>
+	<groupId>org.jbpm.jbpm4</groupId>
+	<artifactId>jbpm-test-spring</artifactId>
+	<packaging>jar</packaging>
+
+	<!-- Parent -->
+	<parent>
+		<groupId>org.jbpm.jbpm4</groupId>
+		<artifactId>jbpm</artifactId>
+		<version>4.0.0-SNAPSHOT</version>
+		<relativePath>../../pom.xml</relativePath>
+	</parent>
+
+	<!-- Dependencies -->
+	<dependencies>
+		<dependency>
+			<groupId>org.jbpm.jbpm4</groupId>
+			<artifactId>jbpm-api</artifactId>
+			<version>${version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.jbpm.jbpm4</groupId>
+			<artifactId>jbpm-test-base</artifactId>
+			<version>${version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.jbpm.jbpm4</groupId>
+			<artifactId>jbpm-jpdl</artifactId>
+			<version>${version}</version>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.jbpm.jbpm4</groupId>
+			<artifactId>jbpm-pvm</artifactId>
+			<version>${version}</version>
+		</dependency>
+
+
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring</artifactId>
+			<version>${spring.version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-mock</artifactId>
+			<version>${spring.version}</version>
+		</dependency>
+
+	</dependencies>
+
+	<!-- Plugins -->
+	<build>
+		<plugins>
+			<plugin>
+				<artifactId>maven-surefire-plugin</artifactId>
+				<configuration>
+					<testSourceDirectory>
+						src/main/java
+					</testSourceDirectory>
+					<classesDirectory>target/classes</classesDirectory>
+					<testClassesDirectory>
+						target/classes
+					</testClassesDirectory>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+
+</project>
\ No newline at end of file


Property changes on: jbpm4/branches/ainze/modules/test-spring/pom.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/main/java/org/jbpm/spring/cfg/SpringConfigurationFactoryBean.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/main/java/org/jbpm/spring/cfg/SpringConfigurationFactoryBean.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/main/java/org/jbpm/spring/cfg/SpringConfigurationFactoryBean.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,80 @@
+/**
+ * 
+ */
+package org.jbpm.spring.cfg;
+
+import org.hibernate.SessionFactory;
+import org.jbpm.api.cmd.CommandService;
+import org.jbpm.pvm.internal.cfg.SpringConfiguration;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.FactoryBean;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+/**
+ * Factory that creates a singleton SpringConfiguration.
+ * 
+ * @author Andries Inze
+ *
+ */
+public class SpringConfigurationFactoryBean implements FactoryBean, ApplicationContextAware {
+
+	private String jbpmConfigurationLocation;
+	private SessionFactory sessionFactory;
+	private CommandService commandService;
+	
+	private ApplicationContext applicationContext;
+	
+	/**
+	 * {@inheritDoc}
+	 */
+	public Object getObject() throws Exception {
+		SpringConfiguration result = new SpringConfiguration(jbpmConfigurationLocation);
+		result.setApplicationContext(applicationContext);
+//		result.setSessionFactory(sessionFactory);
+//		if (commandService != null) {
+//			result.set("commandService", commandService);
+//		}
+		return result;
+	}
+
+	/**
+	 * {@inheritDoc)
+	 */
+	@SuppressWarnings("unchecked")
+	public Class getObjectType() {
+		return SpringConfiguration.class;
+	}
+
+	/**
+	 * {@inheritDoc)
+	 */
+	public boolean isSingleton() {
+		return true;
+	}
+
+	/**
+	 * @param jbpmConfigurationLocation the jbpmConfigurationLocation to set
+	 */
+	public void setJbpmConfigurationLocation(String jbpmConfigurationLocation) {
+		this.jbpmConfigurationLocation = jbpmConfigurationLocation;
+	}
+
+	/**
+	 * @param sessionFactory the sessionFactory to set
+	 */
+	public void setSessionFactory(SessionFactory sessionFactory) {
+		this.sessionFactory = sessionFactory;
+	}
+
+	public void setApplicationContext(ApplicationContext applicationContext)
+			throws BeansException {
+		this.applicationContext = applicationContext;
+	}
+
+	public void setCommandService(CommandService commandService) {
+		this.commandService = commandService;
+	}
+	
+	
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/main/java/org/jbpm/spring/cfg/SpringConfigurationFactoryBean.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/main/java/org/jbpm/spring/test/AbstractTransactionalSpringJbpmTestCase.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/main/java/org/jbpm/spring/test/AbstractTransactionalSpringJbpmTestCase.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/main/java/org/jbpm/spring/test/AbstractTransactionalSpringJbpmTestCase.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,163 @@
+/**
+ * 
+ */
+package org.jbpm.spring.test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jbpm.api.Configuration;
+import org.jbpm.api.ExecutionService;
+import org.jbpm.api.HistoryService;
+import org.jbpm.api.IdentityService;
+import org.jbpm.api.ManagementService;
+import org.jbpm.api.ProcessEngine;
+import org.jbpm.api.RepositoryService;
+import org.jbpm.api.TaskService;
+import org.jbpm.api.cmd.CommandService;
+import org.jbpm.api.task.Task;
+import org.jbpm.test.Db;
+import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests;
+
+/**
+ * Abstract test class that - builds the application context - runs in 1
+ * transaction - adds convenience methods: e.g. deploying a process.
+ * 
+ * @author Andries Inze
+ * 
+ */
+public abstract class AbstractTransactionalSpringJbpmTestCase extends AbstractTransactionalDataSourceSpringContextTests {
+
+  private Configuration configuration;
+  protected ProcessEngine processEngine;
+
+  protected RepositoryService repositoryService;
+  protected ExecutionService executionService;
+  protected ManagementService managementService;
+  protected TaskService taskService;
+  protected HistoryService historyService;
+  protected IdentityService identityService;
+
+  protected CommandService commandService;
+
+  protected List<String> taskIds;
+  
+  /** registered deployments.  registered deployments will be deleted automatically 
+   * in the tearDown. This is a convenience function as each test is expected to clean up the DB. */
+  protected List<Long> registeredDeployments = new ArrayList<Long>();
+
+  public AbstractTransactionalSpringJbpmTestCase() {
+    super();
+
+    // AUTOWIRE_BY_NAME is default behavior for Spring version 2.5.x
+    // AUTOWIRE_BY_TYPE is default behavior for Spring version 2.0.8, but
+    // fails because of Hibernate specific instances.
+    setAutowireMode(AUTOWIRE_BY_NAME);
+  }
+
+  /**
+   * {@inheritDoc)
+
+   */
+  protected void injectDependencies() throws Exception {
+    super.injectDependencies();
+
+    configuration = (Configuration) applicationContext.getBean("configuration");
+    processEngine = configuration.buildProcessEngine();
+
+    repositoryService = processEngine.get(RepositoryService.class);
+    executionService = processEngine.getExecutionService();
+    historyService = processEngine.getHistoryService();
+    managementService = processEngine.getManagementService();
+    taskService = processEngine.getTaskService();
+    identityService = processEngine.getIdentityService();
+    commandService = processEngine.get(CommandService.class);
+  }
+  
+  
+
+  @Override
+  protected void onSetUp() throws Exception {
+    super.onSetUp();
+
+  }
+  
+  
+
+  @Override
+  protected void onTearDownInTransaction() throws Exception {
+    super.onTearDownInTransaction();
+      for (Long deploymentDbid : registeredDeployments) {
+        repositoryService.deleteDeploymentCascade(deploymentDbid);
+      }
+
+//      Db.verifyClean(processEngine);
+
+  }
+
+  /** deploys the process, keeps a reference to the deployment and 
+   * automatically deletes the deployment in the tearDown */
+  public long deployJpdlXmlString(String jpdlXmlString) {
+    long deploymentDbid =
+        repositoryService.createDeployment()
+            .addResourceFromString("xmlstring.jpdl.xml", jpdlXmlString)
+            .deploy();
+
+    registerDeployment(deploymentDbid);
+
+    return deploymentDbid;
+  }
+  
+  /** registered deployments will be deleted in the tearDown */
+  protected void registerDeployment(long deploymentDbid) {
+    registeredDeployments.add(deploymentDbid);
+  }
+  
+  public void assertTextPresent(String expected, String value) {
+    
+    //TODO utility!
+    if ( (value==null)
+         || (value.indexOf(expected)==-1)
+       ) {
+      fail("expected presence of '"+expected+"' but was '"+value+"'");
+    }
+  }
+  
+  public static void assertContainsTask(List<Task> taskList, String taskName) {
+    if (getTask(taskList, taskName)==null) {
+      fail("tasklist doesn't contain task '"+taskName+"': "+taskList);
+    }
+  }
+
+  public static void assertContainsTask(List<Task> taskList, String taskName, String assignee) {
+    if (getTask(taskList, taskName, assignee)==null) {
+      fail("tasklist doesn't contain task '"+taskName+"' for assignee '"+assignee+"': "+taskList);
+    }
+  }
+  
+  public static Task getTask(List<Task> taskList, String taskName) {
+    for (Task task : taskList) {
+      if (taskName.equals(task.getName())) {
+        return task;
+      }
+    }
+    return null;
+  }
+  
+  public static Task getTask(List<Task> taskList, String taskName, String assignee) {
+    for (Task task : taskList) {
+      if (taskName.equals(task.getName())) {
+        if (assignee==null) {
+          if (task.getAssignee()==null) {
+            return task;
+          }
+        } else {
+          if (assignee.equals(task.getAssignee())) {
+            return task;
+          }
+        }
+      }
+    }
+    return null;
+  }
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/main/java/org/jbpm/spring/test/AbstractTransactionalSpringJbpmTestCase.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/Constants.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/Constants.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/Constants.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test;
+
+
+/**
+ * @author Andries Inze
+ */
+public class Constants {
+  
+  public final  static String APPLICATIONCONTEXT_LOCATION = "classpath:org/jbpm/spring/test/applicationContext.xml";
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/Constants.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/activities/DecisionTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/activities/DecisionTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/activities/DecisionTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.activities;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jbpm.api.Execution;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DecisionTest extends AbstractTransactionalSpringJbpmTestCase {
+
+  
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+
+  public void testDecisionExpression() {
+    deployJpdlXmlString(
+      "<process name='Poolcar'>" +
+      "  <start>" +
+      "    <transition to='How far?' />" +
+      "  </start>" +
+      "  <decision name='How far?' expr='#{distance}'>" +
+      "    <transition name='far'    to='Big car' />" +
+      "    <transition name='nearby' to='Small car' />" +
+      "  </decision>" +
+      "  <state name='Big car' />" +
+      "  <state name='Small car' />" +
+      "</process>"
+    );
+
+    Map<String, Object> variables = new HashMap<String, Object>();
+    variables.put("distance", "far");
+    Execution execution = executionService.startProcessInstanceByKey("Poolcar", variables);
+    assertEquals("Big car", execution.getActivityName());
+
+    variables.put("distance", "nearby");
+    execution = executionService.startProcessInstanceByKey("Poolcar", variables);
+    assertEquals("Small car", execution.getActivityName());
+  }
+
+  public void testDecisionWithConditions() {
+    deployJpdlXmlString(
+      "<process name='Poolcar'>" +
+      "  <start>" +
+      "    <transition to='How far?' />" +
+      "  </start>" +
+      "  <decision name='How far?'>" +
+      "    <transition to='Big car'>" +
+      "      <condition expr='#{distance &gt; 10}' />" +
+      "    </transition>" +
+      "    <transition to='Small car'>" +
+      "      <condition expr='#{distance &gt;= 3}' />" +
+      "    </transition>" +
+      "    <transition to='No car' />" +
+      "  </decision>" +
+      "  <state name='Big car' />" +
+      "  <state name='Small car' />" +
+      "  <state name='No car' />" +
+      "</process>"
+    );
+
+    Map<String, Object> variables = new HashMap<String, Object>();
+    variables.put("distance", new Integer(69));
+    Execution execution = executionService.startProcessInstanceByKey("Poolcar", variables);
+    assertEquals("Big car", execution.getActivityName());
+
+    variables.put("distance", new Integer(6));
+    execution = executionService.startProcessInstanceByKey("Poolcar", variables);
+    assertEquals("Small car", execution.getActivityName());
+
+    variables.put("distance", new Integer(2));
+    execution = executionService.startProcessInstanceByKey("Poolcar", variables);
+    assertEquals("No car", execution.getActivityName());
+  }
+
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/activities/DecisionTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/activities/StateTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/activities/StateTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/activities/StateTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,159 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.activities;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.JbpmException;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+/**
+ * @author Tom Baeyens
+ */
+public class StateTest extends AbstractTransactionalSpringJbpmTestCase {
+
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+  
+  public void testWaitStatesSequence() {
+    deployJpdlXmlString(
+      "<process name='ThreeStates'>" +
+      "  <start name='a'>" +
+      "    <transition to='b' />" +
+      "  </start>" +
+      "  <state name='b'>" +
+      "    <transition to='c' />" +
+      "  </state>" +
+      "  <state name='c'>" +
+      "    <transition to='d' />" +
+      "  </state>" +
+      "  <end name='d' />" +
+      "</process>"
+    );
+    
+    Execution execution = executionService.startProcessInstanceById("ThreeStates-1");
+    assertEquals("b", execution.getActivityName());
+
+    String executionId = execution.getId();
+    execution = executionService.signalExecutionById(executionId);
+    assertEquals("c", execution.getActivityName());
+
+    execution = executionService.signalExecutionById(executionId);
+    assertEquals("d", execution.getActivityName());
+    assertTrue(execution.isEnded());
+  }
+
+  public void testExternalDecision() {
+    deployJpdlXmlString(
+      "<process name='p'>" +
+      "  <start>" +
+      "    <transition to='ed' />" +
+      "  </start>" +
+      "  <state name='ed'>" +
+      "    <transition name='left'   to='b' />" +
+      "    <transition name='middle' to='c' />" +
+      "    <transition name='right'  to='d' />" +
+      "  </state>" +
+      "  <state name='b' />" +
+      "  <state name='c' />" +
+      "  <state name='d' />" +
+      "</process>"
+    );
+
+    Execution execution = executionService.startProcessInstanceByKey("p", "one");
+    assertEquals("ed", execution.getActivityName());
+    execution = executionService.signalExecutionById("p.one", "left");
+    assertEquals("b", execution.getActivityName());
+
+    executionService.startProcessInstanceById("p-1", "two");
+    execution = executionService.signalExecutionById("p.two", "middle");
+    assertEquals("c", execution.getActivityName());
+
+    executionService.startProcessInstanceById("p-1", "three");
+    execution = executionService.signalExecutionById("p.three", "right");
+    assertEquals("d", execution.getActivityName());
+  }
+
+  public void testDefaultSignalWithNamedTransitions() {
+    deployJpdlXmlString(
+      "<process name='p'>" +
+      "  <start>" +
+      "    <transition to='a' />" +
+      "  </start>" +
+      "  <state name='a'>" +
+      "    <transition name='left'   to='b' />" +
+      "    <transition name='middle' to='c' />" +
+      "    <transition name='right'  to='d' />" +
+      "  </state>" +
+      "  <state name='b' />" +
+      "  <state name='c' />" +
+      "  <state name='d' />" +
+      "</process>"
+    );
+
+    executionService.startProcessInstanceByKey("p", "one");
+    try {
+      executionService.signalExecutionById("p.one", "left");
+    } catch (JbpmException e) {
+      assertTextPresent("no matching transition or event for default signal in state(a)", e.getMessage());
+    }
+  }
+
+  public void testNamedSignalWithoutMatchingTransition() {
+    deployJpdlXmlString(
+      "<process name='p'>" +
+      "  <start>" +
+      "    <transition to='a' />" +
+      "  </start>" +
+      "  <state name='a'>" +
+      "    <transition name='left'   to='b' />" +
+      "    <transition name='middle' to='c' />" +
+      "    <transition name='right'  to='d' />" +
+      "  </state>" +
+      "  <state name='b' />" +
+      "  <state name='c' />" +
+      "  <state name='d' />" +
+      "</process>"
+    );
+
+    executionService.startProcessInstanceByKey("p", "one");
+    Execution execution = executionService.signalExecutionById("p.one", "up");
+    assertEquals("a", execution.getActivityName());
+  }
+
+  public void testDefaultSignalWithoutTransitions() {
+    deployJpdlXmlString(
+      "<process name='p'>" +
+      "  <start>" +
+      "    <transition to='a' />" +
+      "  </start>" +
+      "  <state name='a' />" +
+      "</process>"
+    );
+
+    executionService.startProcessInstanceByKey("p", "one");
+    Execution execution = executionService.signalExecutionById("p.one");
+    assertEquals("a", execution.getActivityName());
+  }
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/activities/StateTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/beans/InvokeTestBean.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/beans/InvokeTestBean.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/beans/InvokeTestBean.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,52 @@
+/**
+ * 
+ */
+package org.jbpm.spring.test.beans;
+
+
+/**
+ * @author Andries Inze
+ *
+ */
+public class InvokeTestBean  {
+
+	private boolean testMethodHasRun;
+	private boolean testMethodWithParametersHasRun;
+	private boolean testSelectHasRun;
+	
+	public void testMethod() {
+		testMethodHasRun = true;
+	}
+	
+	public void testMethodWithParameters(String name) {
+		if ("a good test".equals(name)) {
+			testMethodWithParametersHasRun = true;
+		}
+	}
+
+//	public String select(OpenExecution execution) {
+//		testSelectHasRun = true;
+//		return "yes";
+//	}
+
+	/**
+	 * @return the testMethodHasRun
+	 */
+	public boolean isTestMethodHasRun() {
+		return testMethodHasRun;
+	}
+
+	/**
+	 * @return the testMethodWithParametersHasRun
+	 */
+	public boolean isTestMethodWithParametersHasRun() {
+		return testMethodWithParametersHasRun;
+	}
+
+	/**
+	 * @return the testSelectHasRun
+	 */
+	public boolean isTestSelectHasRun() {
+		return testSelectHasRun;
+	}
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/beans/InvokeTestBean.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/beans/SpringBeanTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/beans/SpringBeanTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/beans/SpringBeanTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,33 @@
+/**
+ * 
+ */
+package org.jbpm.spring.test.beans;
+
+import org.jbpm.api.Execution;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+/**
+ * @author AIEXM45
+ * 
+ */
+public class SpringBeanTest extends AbstractTransactionalSpringJbpmTestCase {
+
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+
+	public void testInvokeSpringBean() {
+		deployJpdlXmlString("org/jbpm/spring/test/beans/process.jpdl.xml");
+		
+		InvokeTestBean invokeTestBean = (InvokeTestBean) applicationContext.getBean("testBean");
+		
+		Execution execution = executionService
+				.startProcessInstanceByKey("Spring");
+		assertEquals("wait", execution.getActivityName());
+		assertTrue(invokeTestBean.isTestMethodHasRun());
+		assertTrue(invokeTestBean.isTestMethodWithParametersHasRun());
+		assertTrue(invokeTestBean.isTestSelectHasRun());
+	}
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/beans/SpringBeanTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/cfg/ConfigurationTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/cfg/ConfigurationTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/cfg/ConfigurationTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.cfg;
+
+import org.jbpm.api.Configuration;
+import org.jbpm.api.ProcessEngine;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+/**
+ * @author Tom Baeyens
+ */
+public class ConfigurationTest extends AbstractTransactionalSpringJbpmTestCase {
+
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+  
+  public void testDefaultConfiguration() {
+    ProcessEngine processEngine = new Configuration()
+        .buildProcessEngine();
+    assertNotNull(processEngine);
+  }
+
+  public void testMinimalConfiguration() {
+    ProcessEngine processEngine = new Configuration()
+        .setXmlString("<jbpm-configuration />")
+        .buildProcessEngine();
+    assertNotNull(processEngine);
+  }
+
+  public void testConfigurationServices() {
+    ProcessEngine processEngine = new Configuration()
+        .setXmlString(
+            "<jbpm-configuration>" +
+            "  <process-engine-context>" +
+            "    <repository-service />" +
+            "    <execution-service />" +
+            "    <management-service />" +
+            "  </process-engine-context>" +
+            "</jbpm-configuration>"
+        )
+        .buildProcessEngine();
+    assertNotNull(processEngine);
+    assertNotNull(processEngine.getExecutionService());
+    assertNotNull(processEngine.getManagementService());
+  }
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/cfg/ConfigurationTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/eventlistener/EventListenerTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/eventlistener/EventListenerTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/eventlistener/EventListenerTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,241 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.eventlistener;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.listener.EventListener;
+import org.jbpm.api.listener.EventListenerExecution;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class EventListenerTest extends AbstractTransactionalSpringJbpmTestCase {
+  
+  static boolean isInvoked = false;
+  static List<Integer> order;
+  
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+  
+  protected void onSetUpInTransaction() throws Exception {
+    isInvoked = false;
+  }
+
+  public static class ProcessStartListener implements EventListener {
+    private static final long serialVersionUID = 1L;
+    public void notify(EventListenerExecution execution) {
+      assertNotNull(execution.getActivity());
+      assertSame(execution.getActivity(), execution.getProcessDefinition().getInitial());
+      isInvoked = true;
+    }
+  }
+
+  public void testProcessStartListener() {
+    deployJpdlXmlString(
+      "<process name='Insurance claim' key='ICL'>" +
+      "  <on event='start'>" +
+      "    <event-listener class='"+ProcessStartListener.class.getName()+"' />" +
+      "  </on>" +
+      "  <start>" +
+      "    <transition to='a' />" +
+      "  </start>" +
+      "  <state name='a' />" +
+      "</process>"
+    );
+    
+    executionService.startProcessInstanceByKey("ICL");
+
+    assertTrue("process start listener not invoked", isInvoked);
+  }
+
+  public static class ProcessEndListener implements EventListener {
+    private static final long serialVersionUID = 1L;
+    public void notify(EventListenerExecution execution) {
+      assertNotNull(execution.getActivity());
+      assertSame(execution.getActivity(), execution.getProcessDefinition().getActivity("end"));
+      isInvoked = true;
+    }
+  }
+
+  public void testProcessEndListener() {
+    deployJpdlXmlString(
+      "<process name='Insurance claim' key='ICL'>" +
+      "  <on event='end'>" +
+      "    <event-listener class='"+ProcessEndListener.class.getName()+"' />" +
+      "  </on>" +
+      "  <start>" +
+      "    <transition to='end' />" +
+      "  </start>" +
+      "  <end name='end' />" +
+      "</process>"
+    );
+    
+    executionService.startProcessInstanceByKey("ICL");
+    
+    assertTrue("process end listener not invoked", isInvoked);
+  }
+
+  public static class ActivityStartListener implements EventListener {
+    private static final long serialVersionUID = 1L;
+    public void notify(EventListenerExecution execution) {
+      assertNotNull(execution.getActivity());
+      assertSame(execution.getActivity(), execution.getProcessDefinition().getActivity("s"));
+      isInvoked = true;
+    }
+  }
+
+  public void testActivityStartListener() {
+    deployJpdlXmlString(
+      "<process name='Insurance claim' key='ICL'>" +
+      "  <start>" +
+      "    <transition to='s' />" +
+      "  </start>" +
+      "  <state name='s'>" +
+      "    <on event='start'>" +
+      "      <event-listener class='"+ActivityStartListener.class.getName()+"' />" +
+      "    </on>" +
+      "    <transition to='end' />" +
+      "  </state>" +
+      "  <end name='end' />" +
+      "</process>"
+    );
+    
+    executionService.startProcessInstanceByKey("ICL");
+    
+    assertTrue("activity start listener not invoked", isInvoked);
+  }
+
+  public static class ActivityEndListener implements EventListener {
+    private static final long serialVersionUID = 1L;
+    public void notify(EventListenerExecution execution) {
+      assertNotNull(execution.getActivity());
+      assertSame(execution.getActivity(), execution.getProcessDefinition().getActivity("s"));
+      isInvoked = true;
+    }
+  }
+
+  public void testActivityEndListener() {
+    deployJpdlXmlString(
+      "<process name='Insurance claim' key='ICL'>" +
+      "  <start>" +
+      "    <transition to='s' />" +
+      "  </start>" +
+      "  <state name='s'>" +
+      "    <on event='end'>" +
+      "      <event-listener class='"+ActivityStartListener.class.getName()+"' />" +
+      "    </on>" +
+      "    <transition to='end' />" +
+      "  </state>" +
+      "  <end name='end' />" +
+      "</process>"
+    );
+    
+    Execution execution = executionService.startProcessInstanceByKey("ICL");
+
+    assertFalse("activity end listener invoked too early", isInvoked);
+    
+    executionService.signalExecutionById(execution.getId());
+
+    assertTrue("activity end listener not invoked", isInvoked);
+  }
+
+  public static class TransitionListener implements EventListener {
+    private static final long serialVersionUID = 1L;
+    public void notify(EventListenerExecution execution) {
+      assertNotNull(execution.getTransition());
+      isInvoked = true;
+    }
+  }
+
+  public void testTransitionListener() {
+    order = new ArrayList<Integer>();
+    deployJpdlXmlString(
+      "<process name='Insurance claim' key='ICL'>" +
+      "  <start>" +
+      "    <transition to='end'>" +
+      "      <event-listener class='"+TransitionListener.class.getName()+"' />" +
+      "    </transition>" +
+      "  </start>" +
+      "  <end name='end' />" +
+      "</process>"
+    );
+    
+    executionService.startProcessInstanceByKey("ICL");
+    
+    assertTrue("transition listener not invoked", isInvoked);
+  }
+
+  public static class OrderListener implements EventListener {
+    private static final long serialVersionUID = 1L;
+    int i;
+    public void notify(EventListenerExecution execution) {
+      order.add(i);
+    }
+  }
+
+  public void testEventOrdering() {
+    order = new ArrayList<Integer>();
+    deployJpdlXmlString(
+      "<process name='Insurance claim' key='ICL'>" +
+      "  <start>" +
+      "    <transition to='end'>" +
+      "      <event-listener class='"+OrderListener.class.getName()+"'>" +
+      "        <field name='i'><int value='1' /></field> " +
+      "      </event-listener>" +
+      "      <event-listener class='"+OrderListener.class.getName()+"'>" +
+      "        <field name='i'><int value='2' /></field> " +
+      "      </event-listener>" +
+      "      <event-listener class='"+OrderListener.class.getName()+"'>" +
+      "        <field name='i'><int value='3' /></field> " +
+      "      </event-listener>" +
+      "      <event-listener class='"+OrderListener.class.getName()+"'>" +
+      "        <field name='i'><int value='4' /></field> " +
+      "      </event-listener>" +
+      "      <event-listener class='"+OrderListener.class.getName()+"'>" +
+      "        <field name='i'><int value='5' /></field> " +
+      "      </event-listener>" +
+      "    </transition>" +
+      "  </start>" +
+      "  <end name='end' />" +
+      "</process>"
+    );
+    
+    executionService.startProcessInstanceByKey("ICL");
+    
+    List<Integer> expectedOrder = new ArrayList<Integer>();
+    expectedOrder.add(1);
+    expectedOrder.add(2);
+    expectedOrder.add(3);
+    expectedOrder.add(4);
+    expectedOrder.add(5);
+    
+    assertEquals(expectedOrder, order);
+  }
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/eventlistener/EventListenerTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/eventlistener/HqlEventListenerTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/eventlistener/HqlEventListenerTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/eventlistener/HqlEventListenerTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,83 @@
+package org.jbpm.spring.test.eventlistener;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.task.Task;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+
+public class HqlEventListenerTest extends AbstractTransactionalSpringJbpmTestCase {
+
+  long taskLaundryDbid;
+  long taskDishesDbid;
+  long taskIronDbid;
+  
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+  
+  protected void onSetUpInTransaction() throws Exception {
+    
+    // add task laundry
+    Task task = taskService.newTask();
+    task.setName("laundry");
+    taskLaundryDbid = taskService.saveTask(task);
+    
+    // add task dishes
+    task = taskService.newTask();
+    task.setName("dishes");
+    taskDishesDbid = taskService.saveTask(task);
+    
+    // add task iron
+    task = taskService.newTask();
+    task.setName("iron");
+    taskIronDbid = taskService.saveTask(task);
+  }
+
+  protected void onTearDownInTransaction() throws Exception {
+    taskService.deleteTask(taskLaundryDbid);
+    taskService.deleteTask(taskDishesDbid);
+    taskService.deleteTask(taskIronDbid);
+    
+  }
+
+
+  public void testHql() {
+    deployJpdlXmlString(
+      "<process name='HqlEventListener' xmlns='http://jbpm.org/4.0/jpdl'>" +
+      "  <start >" +
+      "    <transition to='wait' />" +
+      "  </start>" +
+      "  <state name='wait'>" +
+      "    <on event='start'>" +
+      "      <hql var='tasknames with i'>" +
+      "        <query>" +
+      "          select task.name" +
+      "          from org.jbpm.pvm.internal.task.TaskImpl as task" +
+      "          where task.name like :taskName" +
+      "        </query>" +
+      "        <parameters>" +
+      "          <string name='taskName' value='%i%' />" +
+      "        </parameters>" +
+      "      </hql>" +
+      "    </on>" +
+      "  </state>" +
+      "</process>"
+    );
+    
+    Execution execution = executionService.startProcessInstanceByKey("HqlEventListener");
+    String executionId = execution.getId();
+
+    Set<String> expectedTaskNames = new HashSet<String>();
+    expectedTaskNames.add("dishes");
+    expectedTaskNames.add("iron");
+    Collection<String> taskNames = (Collection<String>) executionService.getVariable(executionId, "tasknames with i");
+    taskNames = new HashSet<String>(taskNames);
+    assertEquals(expectedTaskNames, taskNames);
+  }
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/eventlistener/HqlEventListenerTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/execution/ExecutionEagerLoadingTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/execution/ExecutionEagerLoadingTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/execution/ExecutionEagerLoadingTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.execution;
+
+import org.jbpm.api.Execution;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ExecutionEagerLoadingTest extends AbstractTransactionalSpringJbpmTestCase {
+
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+  
+  public void testEagerLoading() {
+    deployJpdlXmlString(
+      "<process name='p'>" +
+      "  <start>" +
+      "    <transition to='f' />" +
+      "  </start>" +
+      "  <fork name='f'>" +
+      "    <transition to='f1' />" +
+      "    <transition to='f2' />" +
+      "  </fork>" +
+      "  <fork name='f1'>" +
+      "    <transition to='s11' />" +
+      "    <transition to='s12' />" +
+      "  </fork>" +
+      "  <fork name='f2'>" +
+      "    <transition to='s21' />" +
+      "    <transition to='s22' />" +
+      "  </fork>" +
+      "  <state name ='s11' />" +
+      "  <state name ='s12' />" +
+      "  <state name ='s21' />" +
+      "  <state name ='s22' />" +
+      "</process>"
+    );
+  
+    Execution processInstance = executionService.startProcessInstanceByKey("p");
+   
+    processInstance = executionService.findExecutionById(processInstance.getId());
+    
+    assertNotNull(processInstance.findActiveExecutionIn("s11"));
+    assertNotNull(processInstance.findActiveExecutionIn("s12"));
+    assertNotNull(processInstance.findActiveExecutionIn("s21"));
+    assertNotNull(processInstance.findActiveExecutionIn("s22"));
+
+    processInstance = executionService.findExecutionById(processInstance.getId());
+
+    assertEquals(6, processInstance.getExecutions().size());
+
+    processInstance = executionService.findExecutionById(processInstance.getId());
+
+    assertEquals(1, processInstance.getExecutionsMap().size());
+
+    processInstance = executionService.findExecutionById(processInstance.getId());
+
+    assertNotNull(processInstance.getExecution(null));
+  }
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/execution/ExecutionEagerLoadingTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/execution/FindExecutionTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/execution/FindExecutionTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/execution/FindExecutionTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.execution;
+
+import org.jbpm.api.Execution;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+/**
+ * @author Tom Baeyens
+ */
+public class FindExecutionTest extends AbstractTransactionalSpringJbpmTestCase {
+
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+  
+  public void testFindExecutionById() {
+    deployJpdlXmlString(
+      "<process name='p'>" +
+      "  <start>" +
+      "    <transition to='a' />" +
+      "  </start>" +
+      "  <state name='a' />" +
+      "</process>"
+    );
+
+    Execution execution = executionService.startProcessInstanceByKey("p");
+
+    // take the id and see if the execution service can still find it back
+    execution = executionService.findExecutionById(execution.getId());
+    assertNotNull(execution);
+    assertEquals("a", execution.getActivityName());
+  }
+
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/execution/FindExecutionTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/execution/SignalExecutionTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/execution/SignalExecutionTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/execution/SignalExecutionTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,123 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.execution;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.jbpm.api.Execution;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SignalExecutionTest extends AbstractTransactionalSpringJbpmTestCase {
+  
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+  
+  public void testSignalExecutionById() {
+    deployJpdlXmlString(
+      "<process name='Insurance claim' key='ICL'>" +
+      "  <start>" +
+      "    <transition to='a' />" +
+      "  </start>" +
+      "  <state name='a'>" +
+      "    <transition to='b' />" +
+      "  </state>" +
+      "  <state name='b'>" +
+      "    <transition to='c' />" +
+      "  </state>" +
+      "  <state name='c' />" +
+      "</process>"
+    );
+
+    Execution execution = executionService.startProcessInstanceByKey("ICL", "82436");
+    
+    assertEquals("a", execution.getActivityName());
+    
+    execution = executionService.signalExecutionById("ICL.82436");
+
+    assertEquals("b", execution.getActivityName());
+
+    execution = executionService.signalExecutionById("ICL.82436");
+
+    assertEquals("c", execution.getActivityName());
+  }
+
+  public void testSignalExecutionWithVariables() {
+    deployJpdlXmlString(
+      "<process name='Insurance claim' key='ICL'>" +
+      "  <start>" +
+      "    <transition to='a' />" +
+      "  </start>" +
+      "  <state name='a'>" +
+      "    <transition to='b' />" +
+      "  </state>" +
+      "  <state name='b' />" +
+      "</process>"
+    );
+
+    Execution execution = executionService.startProcessInstanceByKey("ICL", "82436");
+
+    Map<String,Object> variables = new HashMap<String,Object>();
+    variables.put("customer", "John Doe");
+    variables.put("type", "Accident");
+    variables.put("amount", new Float(763.74));
+
+    execution = executionService.signalExecutionById("ICL.82436", variables);
+
+    assertNotNull(execution);
+    String executionId = execution.getId();
+    assertEquals("b", execution.getActivityName());
+    
+    Map<String,Object> expectedVariables = new HashMap<String, Object>(variables); 
+    Set<String> expectedVariableNames = new HashSet<String>(expectedVariables.keySet());
+    Set<String> variableNames = new HashSet<String>(executionService.getVariableNames(executionId));
+    assertEquals(expectedVariableNames, variableNames);
+    
+    variables = executionService.getVariables(executionId, variableNames);
+    assertEquals(expectedVariables, variables);
+  }
+
+  
+  public void testDefaultSignalWithoutTransitions() {
+    deployJpdlXmlString(
+      "<process name='p'>" +
+      "  <start>" +
+      "    <transition to='a' />" +
+      "  </start>" +
+      "  <state name='a' />" +
+      "</process>"
+    );
+
+    Execution execution = executionService.startProcessInstanceByKey("p");
+    execution = executionService.signalExecutionById(execution.getId());
+    assertEquals("a", execution.getActivityName());
+  }
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/execution/SignalExecutionTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/execution/StartExecutionTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/execution/StartExecutionTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/execution/StartExecutionTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,222 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.execution;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.jbpm.api.Execution;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class StartExecutionTest extends AbstractTransactionalSpringJbpmTestCase {
+
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+  
+  public void testStartNewExecutionByKey() {
+    deployJpdlXmlString(
+      "<process name='Insurance claim' key='ICL'>" +
+      "  <start>" +
+      "    <transition to='a' />" +
+      "  </start>" +
+      "  <state name='a' />" +
+      "</process>"
+    );
+
+    Execution execution = executionService.startProcessInstanceByKey("ICL");
+
+    assertNotNull(execution);
+    assertEquals("a", execution.getActivityName());
+  }
+
+  public void testStartNewExecutionInLatestProcessDefinition() {
+    deployJpdlXmlString(
+      "<process name='Insurance claim' key='ICL'>" +
+      "  <start>" +
+      "    <transition to='a' />" +
+      "  </start>" +
+      "  <state name='a' />" +
+      "</process>"
+    );
+
+    Execution execution = executionService.startProcessInstanceByKey("ICL");
+
+    assertNotNull(execution);
+    assertEquals("a", execution.getActivityName());
+
+    deployJpdlXmlString(
+      "<process name='Insurance claim' key='ICL'>" +
+      "  <start>" +
+      "    <transition to='b' />" +
+      "  </start>" +
+      "  <state name='b' />" +
+      "</process>"
+    );
+
+    execution = executionService.startProcessInstanceByKey("ICL");
+
+    assertNotNull(execution);
+    assertEquals("b", execution.getActivityName());
+  }
+  
+  public void testStartExecutionInLatestByNameWithVariables() {
+    deployJpdlXmlString(
+      "<process name='Insurance claim' key='ICL'>" +
+      "  <start>" +
+      "    <transition to='a' />" +
+      "  </start>" +
+      "  <state name='a' />" +
+      "</process>"
+    );
+
+    deployJpdlXmlString(
+      "<process name='Insurance claim' key='ICL'>" +
+      "  <start>" +
+      "    <transition to='b' />" +
+      "  </start>" +
+      "  <state name='b' />" +
+      "</process>"
+    );
+
+    // create variables that are fed into the process before it starts executing
+    Map<String, Object> variables = new HashMap<String, Object>();
+    variables.put("a", new Integer(1));
+    variables.put("b", "text");
+
+    // feed the variables in
+    Execution execution = executionService.startProcessInstanceByKey("ICL", variables);
+    String executionId = execution.getId();
+    assertEquals("b", execution.getActivityName());
+
+    // verify that the variables are actually set
+    assertEquals(new Integer(1), executionService.getVariable(executionId, "a"));
+    assertEquals("text", executionService.getVariable(executionId, "b"));
+
+    // in the generated id, we can see if the right process definition version was taken
+    assertTrue(execution.getId().startsWith("ICL."));
+  }
+
+  public void testStartNewProcessInstanceWithAKey() {
+    deployJpdlXmlString(
+      "<process name='Insurance claim' key='ICL'>" +
+      "  <start>" +
+      "    <transition to='a' />" +
+      "  </start>" +
+      "  <state name='a' />" +
+      "</process>"
+    );
+
+    Execution execution = executionService.startProcessInstanceByKey("ICL", "one");
+
+    assertNotNull(execution);
+    assertEquals("ICL.one", execution.getId());
+  }
+
+  public void testStartNewProcessInstanceWithVariables() {
+    deployJpdlXmlString(
+      "<process name='Insurance claim' key='ICL'>" +
+      "  <start>" +
+      "    <transition to='a' />" +
+      "  </start>" +
+      "  <state name='a' />" +
+      "</process>"
+    );
+    
+    Map<String,Object> variables = new HashMap<String,Object>();
+    variables.put("customer", "John Doe");
+    variables.put("type", "Accident");
+    variables.put("amount", new Float(763.74));
+
+    Execution execution = executionService.startProcessInstanceByKey("ICL", variables);
+    
+    String executionId = execution.getId();
+
+    assertNotNull(execution);
+    
+    Map<String,Object> expectedVariables = new HashMap<String, Object>(variables); 
+    Set<String> expectedVariableNames = new HashSet<String>(expectedVariables.keySet());
+    Set<String> variableNames = new HashSet<String>(executionService.getVariableNames(executionId));
+    assertEquals(expectedVariableNames, variableNames);
+    
+    variables = executionService.getVariables(executionId, variableNames);
+    assertEquals(expectedVariables, variables);
+  }
+
+  public void testStartExecutionById() {
+    deployJpdlXmlString(
+      "<process name='Insurance claim' key='ICL'>" +
+      "  <start>" +
+      "    <transition to='a' />" +
+      "  </start>" +
+      "  <state name='a' />" +
+      "</process>"
+    );
+    
+    // start an execution for the process with the given id
+    Execution execution = executionService.startProcessInstanceById("ICL-1");
+    assertNotNull(execution);
+
+    // checking the state
+    assertEquals("a", execution.getActivityName());
+
+    // checking the generated id
+    assertNull(execution.getName());
+    assertNull(execution.getKey());
+    // if there is no user defined name or key specified in the execution,
+    // the default id generator will create a unique id like this: processDefinitionId/execution.dbid
+    assertTrue(execution.getId().startsWith("ICL."));
+    // the last part of the execution key should be the dbid.
+    Long.parseLong(execution.getId().substring(4));
+  }
+
+  public void testStartExecutionByIdWithVariables() {
+    deployJpdlXmlString(
+      "<process name='Insurance claim' key='ICL'>" +
+      "  <start>" +
+      "    <transition to='a' />" +
+      "  </start>" +
+      "  <state name='a' />" +
+      "</process>"
+    );
+
+    // create the map with variables
+    Map<String, Object> variables = new HashMap<String, Object>();
+    variables.put("a", new Integer(1));
+    variables.put("b", "text");
+
+    // provide the variables in the start execution method
+    Execution execution = executionService.startProcessInstanceById("ICL-1", variables);
+    String executionId = execution.getId();
+
+    assertEquals(new Integer(1), executionService.getVariable(executionId, "a"));
+    assertEquals("text", executionService.getVariable(executionId, "b"));
+  }
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/execution/StartExecutionTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/history/AvgDurationTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/history/AvgDurationTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/history/AvgDurationTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.history;
+
+import java.util.Map;
+
+import org.jbpm.api.Execution;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class AvgDurationTest extends AbstractTransactionalSpringJbpmTestCase {
+
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+  
+  public void testAvgDuration() throws Exception {
+    deployJpdlXmlString(
+      "<process name='Insurance claim' key='ICL'>" +
+      "  <start>" +
+      "    <transition to='one' />" +
+      "  </start>" +
+      "  <state name='one'>" +
+      "    <transition to='two' />" +
+      "  </state>" +
+      "  <state name='two'>" +
+      "    <transition to='three' />" +
+      "  </state>" +
+      "  <state name='three'>" +
+      "    <transition to='end' />" +
+      "  </state>" +
+      "  <end name='end' />" +
+      "</process>"
+    );
+
+    executeProcess();
+    executeProcess();
+    executeProcess();
+
+    Map<String, Long> avgDurations = historyService.avgDurationPerActivity("ICL-1");
+
+
+    Long avgDurationOne = avgDurations.get("one");
+    assertNotNull(avgDurationOne);
+    assertTrue("expected avg duration bigger then 40, but was"+avgDurationOne, avgDurationOne>40);
+    Long avgDurationTwo = avgDurations.get("two");
+    assertNotNull(avgDurationTwo);
+    assertTrue("expected avg duration bigger then 10, but was"+avgDurationTwo, avgDurationTwo>10);
+    Long avgDurationThree = avgDurations.get("three");
+    assertNotNull(avgDurationThree);
+    assertTrue("expected avg duration bigger then 0, but was"+avgDurationThree, avgDurationThree>=0);
+
+    assertEquals(3, avgDurations.size());
+  }
+
+  protected void executeProcess() throws InterruptedException {
+    Execution execution = executionService.startProcessInstanceByKey("ICL");
+    Thread.sleep(50);
+    executionService.signalExecutionById(execution.getId());
+    Thread.sleep(20);
+    executionService.signalExecutionById(execution.getId());
+    executionService.signalExecutionById(execution.getId());
+  }
+
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/history/AvgDurationTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/history/ChoiceDistributionTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/history/ChoiceDistributionTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/history/ChoiceDistributionTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.history;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ChoiceDistributionTest extends AbstractTransactionalSpringJbpmTestCase {
+
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+  
+  public void testDecisionExpression() {
+    deployJpdlXmlString(
+      "<process name='Transport Selection' key='TRS'>" +
+      "  <start>" +
+      "    <transition to='How far?' />" +
+      "  </start>" +
+      "  <decision name='How far?' expr='#{distance}'>" +
+      "    <transition name='far'           to='Big car' />" +
+      "    <transition name='nearby'        to='Small car' />" +
+      "    <transition name='other country' to='Airoplane' />" +
+      "  </decision>" +
+      "  <state name='Big car' />" +
+      "  <state name='Small car' />" +
+      "  <state name='Airoplane' />" +
+      "</process>"
+    );
+
+    Map<String, Object> variables = new HashMap<String, Object>();
+    variables.put("distance", "far");
+    executionService.startProcessInstanceByKey("TRS", variables);
+
+    variables.put("distance", "nearby");
+    executionService.startProcessInstanceByKey("TRS", variables);
+    executionService.startProcessInstanceByKey("TRS", variables);
+    executionService.startProcessInstanceByKey("TRS", variables);
+
+    variables.put("distance", "other country");
+    executionService.startProcessInstanceByKey("TRS", variables);
+    executionService.startProcessInstanceByKey("TRS", variables);
+
+    Map<String, Integer> choiceDistribution = historyService.choiceDistribution("TRS-1", "How far?");
+    
+    assertEquals(1, (int)choiceDistribution.get("far"));
+    assertEquals(3, (int)choiceDistribution.get("nearby"));
+    assertEquals(2, (int)choiceDistribution.get("other country"));
+      
+  }
+
+
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/history/ChoiceDistributionTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/history/EndProcessInstanceTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/history/EndProcessInstanceTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/history/EndProcessInstanceTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.history;
+
+import java.util.List;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.history.HistoryProcessInstance;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class EndProcessInstanceTest extends AbstractTransactionalSpringJbpmTestCase {
+
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+  
+  public void testCancelProcessInstance() {
+    deployJpdlXmlString(
+      "<process name='Insurance claim' key='ICL'>" +
+      "  <start>" +
+      "    <transition to='wait' />" +
+      "  </start>" +
+      "  <state name='wait'>" +
+      "    <transition to='end' />" +
+      "  </state>" +
+      "  <end name='end' />" +
+      "</process>"
+    );
+
+    Execution execution = executionService.startProcessInstanceByKey("ICL");
+    String processInstanceId = execution.getId();
+    executionService.endProcessInstance(processInstanceId, Execution.STATE_CANCELLED);
+
+    List<Execution> executions = executionService.createProcessInstanceQuery()
+        .processInstanceId(processInstanceId)
+        .list();
+    assertEquals(0, executions.size());
+
+    HistoryProcessInstance historyProcessInstance = historyService.createHistoryProcessInstanceQuery()
+      .processInstanceId(processInstanceId)
+      .uniqueResult();
+
+    assertNotNull(historyProcessInstance.getEndTime());
+    assertEquals(Execution.STATE_CANCELLED, historyProcessInstance.getState());
+  }
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/history/EndProcessInstanceTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/history/ProcessInstanceHistoryTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/history/ProcessInstanceHistoryTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/history/ProcessInstanceHistoryTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.history;
+
+import java.util.List;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.history.HistoryProcessInstance;
+import org.jbpm.api.history.HistoryProcessInstanceQuery;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ProcessInstanceHistoryTest extends AbstractTransactionalSpringJbpmTestCase {
+
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+  
+  public void testProcessInstanceHistory() {
+    deployJpdlXmlString(
+      "<process name='Insurance claim' key='ICL'>" +
+      "  <start>" +
+      "    <transition to='end' />" +
+      "  </start>" +
+      "  <end name='end' />" +
+      "</process>"
+    );
+
+    executionService.startProcessInstanceByKey("ICL");
+    executionService.startProcessInstanceByKey("ICL");
+    executionService.startProcessInstanceByKey("ICL");
+    
+    List<HistoryProcessInstance> historyProcessInstances = historyService
+      .createHistoryProcessInstanceQuery()
+      .processDefinitionId("ICL-1")
+      .orderAsc(HistoryProcessInstanceQuery.PROPERTY_STARTTIME)
+      .list();
+
+    assertEquals(3, historyProcessInstances.size());
+    
+    for (HistoryProcessInstance historyProcessInstance: historyProcessInstances) {
+      assertTrue(historyProcessInstance.getProcessInstanceId().startsWith("ICL"));
+      assertEquals(HistoryProcessInstance.STATE_ENDED, historyProcessInstance.getState());
+      assertNotNull(historyProcessInstance.getStartTime());
+      assertNotNull(historyProcessInstance.getEndTime());
+    }
+    
+    // also check that the ended process instances have been removed from the 
+    // runtime database
+    List<Execution> executions = executionService
+      .createProcessInstanceQuery()
+      .processDefinitionId("ICL-1")
+      .list();
+
+    assertEquals(0, executions.size());
+  }
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/history/ProcessInstanceHistoryTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/identity/IdentityTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/identity/IdentityTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/identity/IdentityTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.identity;
+
+import java.util.List;
+
+import org.jbpm.api.IdentityService;
+import org.jbpm.api.identity.Group;
+import org.jbpm.api.identity.User;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class IdentityTest extends AbstractTransactionalSpringJbpmTestCase {
+  
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+  
+  public void testSingleUser() throws Exception {
+    IdentityService identityService = processEngine.get(IdentityService.class);
+    
+    identityService.createUser("johndoe", "johndoe", "John", "Doe");
+    
+    List<User> users = identityService.findUsers();
+    assertNotNull(users);
+    assertEquals(1, users.size());
+    
+    User johndoe = users.get(0);
+    assertEquals("johndoe", johndoe.getId());
+    assertEquals("John", johndoe.getGivenName());
+    assertEquals("Doe", johndoe.getFamilyName());
+    assertEquals("John Doe", johndoe.toString());
+    
+    identityService.deleteUser("johndoe");
+    
+    assertEquals(0, identityService.findUsers().size());
+  }
+
+  public void testSingleGroup() throws Exception {
+    IdentityService identityService = processEngine.get(IdentityService.class);
+    
+    identityService.createUser("johndoe", "johndoe", "John", "Doe");
+    identityService.createUser("joesmoe", "joesmoe", "Joe", "Smoe");
+    identityService.createUser("jackblack", "jackblack", "Jack", "Black");
+    
+    String redhatId = identityService.createGroup("redhat", Group.TYPE_UNIT, null);
+    String jbossId = identityService.createGroup("jboss", Group.TYPE_UNIT, "redhat");
+    String jbpmId = identityService.createGroup("jbpm", Group.TYPE_UNIT, "jboss");
+    
+    identityService.createMembership("johndoe", jbpmId, "developer");
+    identityService.createMembership("joesmoe", jbpmId, "developer");
+    identityService.createMembership("jackblack", jbossId, "manager");
+    
+    List<Group> groups = identityService.findGroupsByUserAndGroupType("jackblack", Group.TYPE_UNIT);
+
+     assertEquals(1, groups.size());
+     Group group = groups.get(0);
+     assertEquals("unit.jboss", group.getId());
+  }
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/identity/IdentityTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/mgmt/JobQueryTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/mgmt/JobQueryTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/mgmt/JobQueryTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,115 @@
+package org.jbpm.spring.test.mgmt;
+
+import java.util.List;
+
+import org.jbpm.api.job.Job;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+
+public class JobQueryTest extends AbstractTransactionalSpringJbpmTestCase {
+  
+  
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+  
+  public void testQueryOutstandingTimers() {
+    deployJpdlXmlString(
+      "<process name='TimerQueryTest' >" +
+      "  <start>" +
+      "    <transition to='t' />" +
+      "  </start>" +
+      "  <state name='t'>" +
+      "    <transition name='timeout' to='t'>" +
+      "      <timer duedate='20 seconds' />" +
+      "    </transition>" +
+      "  </state>" +
+      "</process>"
+    );
+
+    executionService.startProcessInstanceByKey("TimerQueryTest");
+    executionService.startProcessInstanceByKey("TimerQueryTest");
+    executionService.startProcessInstanceByKey("TimerQueryTest");
+    executionService.startProcessInstanceByKey("TimerQueryTest");
+    
+    List<Job> timers = managementService.createJobQuery()
+      .timers()
+      .list();
+    
+    assertEquals(4, timers.size());
+  }
+
+  public void testQueryBacklogMessages() {
+    deployJpdlXmlString(
+      "<process name='MessagesQueryTest' >" +
+      "  <start>" +
+      "    <transition to='t' />" +
+      "  </start>" +
+      "  <state name='t' async='true' />" +
+      "</process>"
+    );
+
+    executionService.startProcessInstanceByKey("MessagesQueryTest");
+    executionService.startProcessInstanceByKey("MessagesQueryTest");
+    executionService.startProcessInstanceByKey("MessagesQueryTest");
+    executionService.startProcessInstanceByKey("MessagesQueryTest");
+    
+    List<Job> timers = managementService.createJobQuery()
+      .messages()
+      .list();
+    
+    assertEquals(4, timers.size());
+  }
+
+  
+  public static class Dog {
+    public void bark() {
+      throw new RuntimeException("wooof");
+    }
+  }
+  public void testErrorMessages() {
+    deployJpdlXmlString(
+      "<process name='ErrorMsgQueryTest' >" +
+      "  <start>" +
+      "    <transition to='t' />" +
+      "  </start>" +
+      "  <java name='t' " +
+      "        async='true' " +
+      "        class='"+Dog.class.getName()+"'" +
+      "        method='bark'>" +
+      "  </java>" +
+      "</process>"
+    );
+
+    executionService.startProcessInstanceByKey("ErrorMsgQueryTest");
+    executionService.startProcessInstanceByKey("ErrorMsgQueryTest");
+    executionService.startProcessInstanceByKey("ErrorMsgQueryTest");
+    
+    
+    List<Job> messages = managementService.createJobQuery()
+      .messages()
+      .list();
+
+    assertEquals(3, messages.size());
+
+    managementService.executeJob(messages.get(0).getDbid());
+    managementService.executeJob(messages.get(0).getDbid());
+    managementService.executeJob(messages.get(0).getDbid());
+
+    List<Job> errorJobs = managementService.createJobQuery()
+      .exception()
+      .list();
+  
+    assertEquals(1, errorJobs.size());
+    
+    assertTextPresent("wooof", errorJobs.get(0).getException());
+
+    messages = managementService.createJobQuery()
+      .messages()
+      .list();
+
+    assertEquals(2, messages.size()); 
+  }
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/mgmt/JobQueryTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/process/ActivityCoordinatesTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/process/ActivityCoordinatesTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/process/ActivityCoordinatesTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.process;
+
+import org.jbpm.api.model.ActivityCoordinates;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ActivityCoordinatesTest extends AbstractTransactionalSpringJbpmTestCase {
+
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+  
+  public void testActivityCoordinates() {
+    deployJpdlXmlString(
+      "<process name='ActivityCoordinatesProcess'>" +
+      "  <start>" +
+      "    <transition to='a' />" +
+      "  </start>" +
+      "  <state name='a' g='96,16,75,52' />" +
+      "</process>"
+    );
+    
+    String processDefinitionId = repositoryService.createProcessDefinitionQuery()
+      .key("ActivityCoordinatesProcess")
+      .uniqueResult()
+      .getId();
+    
+    ActivityCoordinates activityCoordinates = repositoryService.getActivityCoordinates(processDefinitionId, "a");
+    assertEquals(96, activityCoordinates.getX());
+    assertEquals(16, activityCoordinates.getY());
+    assertEquals(75, activityCoordinates.getWidth());
+    assertEquals(52, activityCoordinates.getHeight());
+  }
+
+  public void testUnexistingCoordinates() {
+    deployJpdlXmlString(
+      "<process name='ActivityCoordinatesProcess'>" +
+      "  <start>" +
+      "    <transition to='a' />" +
+      "  </start>" +
+      "  <state name='a' />" +
+      "</process>"
+    );
+    
+    String processDefinitionId = repositoryService.createProcessDefinitionQuery()
+      .key("ActivityCoordinatesProcess")
+      .uniqueResult()
+      .getId();
+    
+    ActivityCoordinates activityCoordinates = repositoryService.getActivityCoordinates(processDefinitionId, "a");
+    assertNull(activityCoordinates);
+  }
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/process/ActivityCoordinatesTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/process/DeploymentResourcesTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/process/DeploymentResourcesTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/process/DeploymentResourcesTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,132 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.process;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Arrays;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.ProcessDefinition;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DeploymentResourcesTest extends AbstractTransactionalSpringJbpmTestCase {
+
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+  
+  public void testProcessWithNameOnly() {
+    byte[] lotOfBytes = generateString("a lot of bytes ", 5000).getBytes();
+    byte[] otherBytes = generateString("other bytes ", 5000).getBytes();
+    
+    long deploymentDbid = 
+    repositoryService.createDeployment()
+      .addResourceFromString("xmlstring.jpdl.xml", 
+                 "<process name='Insurance claim'>" +
+                 "  <start />" +
+                 "</process>")
+      .addResourceFromInputStream("a lot of attachment", new ByteArrayInputStream(lotOfBytes))
+      .addResourceFromInputStream("other attachment", new ByteArrayInputStream(otherBytes))
+      .deploy();
+    
+    registerDeployment(deploymentDbid);
+
+    InputStream stream = repositoryService.getResourceAsStream(deploymentDbid, "a lot of attachment");
+    byte[] retrievedLotOfBytes = readBytes(stream);
+    assertNotNull(retrievedLotOfBytes);
+    assertTrue(Arrays.equals(lotOfBytes, retrievedLotOfBytes));
+    
+    stream = repositoryService.getResourceAsStream(deploymentDbid, "other attachment");
+    byte[] retrievedOtherBytes = readBytes(stream);
+    assertNotNull(retrievedOtherBytes);
+    assertTrue(Arrays.equals(otherBytes, retrievedOtherBytes));
+  }
+
+  public void testLoadProcessAsResource() {
+    ClassLoader classLoader = DeploymentResourcesTest.class.getClassLoader();
+    InputStream inputStream = classLoader.getResourceAsStream("org/jbpm/test/process/process.jpdl.xml");
+    assertNotNull(inputStream);
+    
+    long deploymentDbid = 
+    repositoryService.createDeployment()
+      .addResourceFromInputStream("process.jpdl.xml", inputStream)
+      .deploy();
+    
+    registerDeployment(deploymentDbid);
+
+    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
+      .key("Resource")
+      .uniqueResult();
+    
+    assertNotNull(processDefinition);
+  }
+
+  protected String generateString(String base, int multiplier) {
+    StringBuffer buffer = new StringBuffer();
+    for (int i=0; i<multiplier; i++) {
+      buffer.append(base);
+    }
+    String string = buffer.toString();
+    return string;
+  }
+
+  public static byte[] readBytes(InputStream inputStream) {
+    byte[] bytes = null;
+    if (inputStream==null) {
+      throw new JbpmException("inputStream is null");
+    }
+    try {
+      ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+      transfer(inputStream, outputStream);
+      bytes = outputStream.toByteArray();
+      outputStream.close();
+      return bytes;
+    } catch (IOException e) {
+      throw new JbpmException("couldn't read bytes from inputStream", e);
+    }
+  }
+  public static int transfer(InputStream in, OutputStream out) {
+    int total = 0;
+    byte[] buffer = new byte[4096];
+    try {
+      int bytesRead = in.read( buffer );
+      while ( bytesRead != -1 ) {
+        out.write( buffer, 0, bytesRead );
+        total += bytesRead;
+        bytesRead = in.read( buffer );
+      }
+      return total;
+    } catch (IOException e) {
+      throw new JbpmException("couldn't write bytes to output stream", e);
+    }
+  }
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/process/DeploymentResourcesTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/process/ProcessDefinitionQueryTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/process/ProcessDefinitionQueryTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/process/ProcessDefinitionQueryTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,146 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.process;
+
+import java.util.List;
+
+import org.jbpm.api.ProcessDefinition;
+import org.jbpm.api.ProcessDefinitionQuery;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ProcessDefinitionQueryTest extends AbstractTransactionalSpringJbpmTestCase {
+
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+  
+
+
+  public void testQueryProcessDefinitionsNameLike() {
+    deployJpdlXmlString(
+      "<process name='make print'>" +
+      "  <start />" +
+      "</process>"
+    );
+
+    deployJpdlXmlString(
+      "<process name='use phone'>" +
+      "  <start />" +
+      "</process>"
+    );
+
+    deployJpdlXmlString(
+      "<process name='make friends'>" +
+      "  <start />" +
+      "</process>"
+    );
+
+    deployJpdlXmlString(
+      "<process name='clean whiteboard'>" +
+      "  <start />" +
+      "</process>"
+    );
+
+    deployJpdlXmlString(
+      "<process name='fix coffeemaker'>" +
+      "  <start />" +
+      "</process>"
+    );
+
+    List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery()
+      .nameLike("%make%")
+      .orderAsc(ProcessDefinitionQuery.PROPERTY_NAME)
+      .list();
+
+    assertEquals("fix coffeemaker", processDefinitions.get(0).getName());
+    assertEquals("make friends",    processDefinitions.get(1).getName());
+    assertEquals("make print",      processDefinitions.get(2).getName());
+  }
+  
+  public void testQueryProcessDefinitionsEmpty() {
+    List<ProcessDefinition> processDefinitions = repositoryService
+      .createProcessDefinitionQuery()
+      .list();
+    
+    assertEquals(0, processDefinitions.size());
+  }
+
+  public void testQueryProcessDefinitionsKeyLike() {
+    deployJpdlXmlString(
+      "<process name='make print'>" +
+      "  <start />" +
+      "</process>"
+    );
+
+    deployJpdlXmlString(
+      "<process name='use phone'>" +
+      "  <start />" +
+      "</process>"
+    );
+
+    deployJpdlXmlString(
+      "<process name='make friends'>" +
+      "  <start />" +
+      "</process>"
+    );
+
+    deployJpdlXmlString(
+      "<process name='make friends'>" +
+      "  <start />" +
+      "</process>"
+    );
+
+    deployJpdlXmlString(
+      "<process name='make friends'>" +
+      "  <start />" +
+      "</process>"
+    );
+
+    deployJpdlXmlString(
+      "<process name='clean whiteboard'>" +
+      "  <start />" +
+      "</process>"
+    );
+
+    deployJpdlXmlString(
+      "<process name='fix coffeemaker'>" +
+      "  <start />" +
+      "</process>"
+    );
+
+    List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery()
+      .nameLike("make%")
+      .orderAsc(ProcessDefinitionQuery.PROPERTY_ID)
+      .list();
+
+    assertEquals("make_friends-1", processDefinitions.get(0).getId());
+    assertEquals("make_friends-2", processDefinitions.get(1).getId());
+    assertEquals("make_friends-3", processDefinitions.get(2).getId());
+    assertEquals("make_print-1",   processDefinitions.get(3).getId());
+  }
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/process/ProcessDefinitionQueryTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/process/RepositoryServiceTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/process/RepositoryServiceTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/process/RepositoryServiceTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,385 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.process;
+
+import java.util.List;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.ProcessDefinition;
+import org.jbpm.api.ProcessDefinitionQuery;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class RepositoryServiceTest extends AbstractTransactionalSpringJbpmTestCase {
+
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+  
+  public void testProcessWithNameOnly() {
+    deployJpdlXmlString(
+      "<process name='Insurance claim'>" +
+      "  <start />" +
+      "</process>"
+    );
+    
+    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
+        .key("Insurance_claim")
+        .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+        .page(0,1)
+        .uniqueResult();
+
+    assertNotNull(processDefinition);
+    assertEquals("Insurance claim", processDefinition.getName());
+    assertEquals("Insurance_claim", processDefinition.getKey());
+    assertEquals(1, processDefinition.getVersion());
+    assertEquals("Insurance_claim-1", processDefinition.getId());
+  }
+
+  public void testProcessWithNameAndKey() {
+    deployJpdlXmlString(
+      "<process name='Insurance claim' key='ICL'>" +
+      "  <start />" +
+      "</process>"
+    );
+
+    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
+        .key("ICL")
+        .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+        .page(0,1)
+        .uniqueResult();
+    
+    assertNotNull(processDefinition);
+    assertEquals("Insurance claim", processDefinition.getName());
+    assertEquals("ICL", processDefinition.getKey());
+    assertEquals(1, processDefinition.getVersion());
+    assertEquals("ICL-1", processDefinition.getId());
+  }
+
+  // interface methods ////////////////////////////////////////////////////////
+
+  public void testFindProcessByKey() {
+    deployJpdlXmlString(
+      "<process name='Name with spaces'>" +
+      "  <start />" +
+      "</process>"
+    );
+
+    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
+        .key("Name_with_spaces")
+        .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+        .page(0,1)
+        .uniqueResult();
+
+    assertNotNull(processDefinition);
+    assertEquals("Name with spaces", processDefinition.getName());
+    assertEquals("Name_with_spaces", processDefinition.getKey());
+    assertEquals(1, processDefinition.getVersion());
+    assertEquals("Name_with_spaces-1", processDefinition.getId());
+  }
+
+  public void testFindProcessDefinitions() {
+    deployMultipleVersionsOfProcesses();
+
+    List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery()
+      .key("nuclear_fusion")
+      .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+      .list();
+    assertNotNull(processDefinitions);
+
+    assertEquals("expected 3 but was " + processDefinitions.size() + ": " + processDefinitions, 3, processDefinitions.size());
+    assertEquals("nuclear fusion", processDefinitions.get(0).getName());
+    assertEquals(3, processDefinitions.get(0).getVersion());
+
+    assertEquals("nuclear fusion", processDefinitions.get(1).getName());
+    assertEquals(2, processDefinitions.get(1).getVersion());
+
+    assertEquals("nuclear fusion", processDefinitions.get(2).getName());
+    assertEquals(1, processDefinitions.get(2).getVersion());
+  }
+
+  public void testFindLatestProcessDefinition() {
+    deployMultipleVersionsOfProcesses();
+
+    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
+        .key("nuclear_fusion")
+        .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+        .page(0,1)
+        .uniqueResult();
+    assertNotNull(processDefinition);
+
+    assertEquals(3, processDefinition.getVersion());
+    assertEquals("nuclear fusion", processDefinition.getName());
+    assertEquals("nuclear_fusion", processDefinition.getKey());
+  }
+
+  public void testFindProcessDefinitionById() {
+    deployJpdlXmlString(
+      "<process name='given' version='33'>" +
+      "  <start />" +
+      "</process>"
+    );
+
+    // load it
+    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
+        .id("given-33")
+        .uniqueResult();
+
+    assertNotNull(processDefinition);
+    assertEquals("given", processDefinition.getName());
+    assertEquals(33, processDefinition.getVersion());
+  }
+
+  public void testDeleteDeployment() {
+    long deploymentDbid = repositoryService.createDeployment()
+        .addResourceFromString("xmlstring.jpdl.xml", 
+            "<process name='deleteme' version='33'>" +
+            "  <start />" +
+            "</process>")
+        .deploy();
+
+    // delete it
+    repositoryService.deleteDeployment(deploymentDbid);
+
+    // check if the db is empty
+    assertEquals(0, repositoryService.createProcessDefinitionQuery().list().size());
+  }
+
+  public void testDeleteProcessDefinitionAndInstances() {
+    long deploymentDbid = repositoryService.createDeployment()
+        .addResourceFromString("xmlstring.jpdl.xml", 
+          "<process name='deleteme' version='33'>" +
+          "  <start>" +
+          "    <transition to='w' />" +
+          "  </start>" +
+          "  <state name='w' />" +
+          "</process>")
+        .deploy();
+    
+    executionService.startProcessInstanceByKey("deleteme");
+    executionService.startProcessInstanceByKey("deleteme");
+    executionService.startProcessInstanceByKey("deleteme");
+    executionService.startProcessInstanceByKey("deleteme");
+    
+    // delete it all
+    repositoryService.deleteDeploymentCascade(deploymentDbid);
+
+    // check if the db is empty
+    assertEquals(0, repositoryService.createProcessDefinitionQuery().list().size());
+    assertEquals(0, executionService.createProcessInstanceQuery().list().size());
+  }
+  
+  public void testDeleteProcessDefinitionButNotInstances() {
+    long deploymentDbid = deployJpdlXmlString(
+      "<process name='deleteme' version='33'>" +
+      "  <start>" +
+      "    <transition to='w' />" +
+      "  </start>" +
+      "  <state name='w' />" +
+      "</process>"
+    );
+    
+    executionService.startProcessInstanceByKey("deleteme");
+    executionService.startProcessInstanceByKey("deleteme");
+    executionService.startProcessInstanceByKey("deleteme");
+    executionService.startProcessInstanceByKey("deleteme");
+    
+    // delete it all
+    try {
+      repositoryService.deleteDeployment(deploymentDbid);
+      fail("expected exception");
+    } catch (JbpmException e) {
+      assertTextPresent("cannot delete deployment", e.getMessage());
+      assertTextPresent("still executions for process(deleteme): ", e.getMessage());
+    }
+  }
+  
+  // various other aspects ////////////////////////////////////////////////////
+  
+  public void testAutomaticVersioning() {
+    deployJpdlXmlString(
+      "<process name='versionme'>" +
+      "  <start />" +
+      "</process>"
+    );
+
+    // look it up again
+    List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery()
+        .key("versionme")
+        .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+        .list();
+    
+    assertNotNull(processDefinitions);
+    // verify that there is only one
+    assertEquals(processDefinitions.toString(), 1, processDefinitions.size());
+    ProcessDefinition processDefinition = processDefinitions.get(0);
+    // and check that automatically assigned version starts with 1
+    assertEquals(1, processDefinition.getVersion());
+
+    deployJpdlXmlString(
+      "<process name='versionme'>" +
+      "  <start />" +
+      "</process>"
+    );
+
+    // look them up again
+    processDefinitions = repositoryService.createProcessDefinitionQuery()
+        .key("versionme")
+        .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+        .list();
+    
+    // verify that there is only one
+    assertEquals(processDefinitions.toString(), 2, processDefinitions.size());
+    // and check that automatically assigned version starts with 1
+    assertEquals(2, processDefinitions.get(0).getVersion());
+    assertEquals(1, processDefinitions.get(1).getVersion());
+  }
+
+  public void testUserProvidedVersion() {
+    deployJpdlXmlString(
+      "<process name='takethis' version='234'>" +
+      "  <start />" +
+      "</process>"
+    );
+
+    // load it
+    List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery()
+        .key("takethis")
+        .list();
+    
+    assertNotNull(processDefinitions);
+    assertEquals(processDefinitions.toString(), 1, processDefinitions.size());
+    ProcessDefinition processDefinition = processDefinitions.get(0);
+    // verify that the user specified version was used
+    // (and not overwritten by an automatically assigned versioning)
+    assertEquals(234, processDefinition.getVersion());
+  }
+
+  public void testDuplicateUserProvidedVersion()  {
+    deployJpdlXmlString(
+      "<process name='takethis' version='234'>" +
+      "  <start />" +
+      "</process>"
+    );
+
+    try {
+      deployJpdlXmlString(
+        "<process name='takethis' version='234'>" +
+        "  <start />" +
+        "</process>"
+      );
+      fail("expected exception");
+    } catch (JbpmException e) {
+      assertTextPresent("process 'takethis-234' already exists", e.getMessage());
+    }
+  }
+
+  /**
+   * deploys 3 versions of process with name 'nuclear fusion', 2 versions of the processes 'ultimate seduction' and
+   * 'publish book'
+   */
+  void deployMultipleVersionsOfProcesses() {
+    deployJpdlXmlString(
+      "<process name='nuclear fusion'>" +
+      "  <start />" +
+      "</process>"
+    );
+
+    deployJpdlXmlString(
+      "<process name='ultimate seduction'>" +
+      "  <start />" +
+      "</process>"
+    );
+
+    deployJpdlXmlString(
+      "<process name='ultimate seduction'>" +
+      "  <start />" +
+      "</process>"
+    );
+
+    deployJpdlXmlString(
+      "<process name='ultimate seduction'>" +
+      "  <start />" +
+      "</process>"
+    );
+
+    deployJpdlXmlString(
+      "<process name='ultimate seduction'>" +
+      "  <start />" +
+      "</process>"
+    );
+
+    deployJpdlXmlString(
+      "<process name='publish book'>" +
+      "  <start />" +
+      "</process>"
+    );
+
+    deployJpdlXmlString(
+      "<process name='nuclear fusion'>" +
+      "  <start />" +
+      "</process>"
+    );
+
+    deployJpdlXmlString(
+      "<process name='nuclear fusion'>" +
+      "  <start />" +
+      "</process>"
+    );
+  }
+
+  public void testMinimalProcess() {
+    deployJpdlXmlString(
+      "<process name='minimal'>" +
+      "  <start>" +
+      "    <transition to='end' />" +
+      "  </start>" +
+      "  <end name='end' />" +
+      "</process>"
+    );
+    
+    Execution execution = executionService.startProcessInstanceByKey("minimal");
+    
+    assertEquals("end", execution.getActivityName());
+    assertTrue(execution.isEnded());
+    assertFalse(execution.isActive());
+  }
+
+  public void testMostMinimalProcess() {
+    deployJpdlXmlString(
+      "<process name='minimal'>" +
+      "  <start />" +
+      "</process>"
+    );
+
+    Execution execution = executionService.startProcessInstanceByKey("minimal");
+    
+    assertTrue(execution.isEnded());
+    assertFalse(execution.isActive());
+  }
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/process/RepositoryServiceTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/SubTaskTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/SubTaskTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/SubTaskTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,171 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.task;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.jbpm.api.task.Task;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SubTaskTest extends AbstractTransactionalSpringJbpmTestCase {
+
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+  
+  public void testTaskParticipants() {
+    
+    // create top level task
+    // * clean da house
+    
+    Task task = taskService.newTask();
+    task.setName("clean da house");
+    long taskDbid = taskService.saveTask(task);
+    
+    // create 3 sub tasks: 
+    // * clean da house
+    //   * dishes
+    //   * laundry
+    //   * sweep floor
+    
+    Task subTask = taskService.newTask(taskDbid);
+    subTask.setName("dishes");
+    long dishesTaskDbid = taskService.saveTask(subTask);
+    
+    subTask = taskService.newTask(taskDbid);
+    subTask.setName("laundry");
+    long laundryTaskDbid = taskService.saveTask(subTask);
+    
+    subTask = taskService.newTask(taskDbid);
+    subTask.setName("sweep floor");
+    long sweepFloorTaskDbid = taskService.saveTask(subTask);
+    
+    // verify 3 sub tasks of clean da house
+    
+    List<Task> subTasks = taskService.getSubTasks(taskDbid);
+    Set<String> subTaskNames = getTaskNames(subTasks);
+    
+    Set<String> expectedTaskNames = new HashSet<String>();
+    expectedTaskNames.add("dishes");
+    expectedTaskNames.add("laundry");
+    expectedTaskNames.add("sweep floor");
+    
+    assertEquals(expectedTaskNames, subTaskNames);
+
+    // add 3 sub tasks for sweep floor: 
+    // * clean da house
+    //   * dishes
+    //   * laundry
+    //   * sweep floor
+    //     * find broom
+    //     * find water
+    //     * scrub
+
+    // now second level subtasks under sweep floor
+    subTask = taskService.newTask(sweepFloorTaskDbid);
+    subTask.setName("find broom");
+    taskService.saveTask(subTask);
+
+    subTask = taskService.newTask(sweepFloorTaskDbid);
+    subTask.setName("find water");
+    taskService.saveTask(subTask);
+
+    subTask = taskService.newTask(sweepFloorTaskDbid);
+    subTask.setName("scrub");
+    taskService.saveTask(subTask);
+
+    // verify all the sub tasks of 'clean da house' and 'sweep floor'
+    
+    subTaskNames = getTaskNames(taskService.getSubTasks(taskDbid));
+    
+    expectedTaskNames = new HashSet<String>();
+    expectedTaskNames.add("dishes");
+    expectedTaskNames.add("laundry");
+    expectedTaskNames.add("sweep floor");
+    
+    assertEquals(expectedTaskNames, subTaskNames);
+    
+    subTaskNames = getTaskNames(taskService.getSubTasks(sweepFloorTaskDbid));
+    
+    expectedTaskNames = new HashSet<String>();
+    expectedTaskNames.add("find broom");
+    expectedTaskNames.add("find water");
+    expectedTaskNames.add("scrub");
+    
+    assertEquals(expectedTaskNames, subTaskNames);
+    
+    // delete task dishes
+    taskService.deleteTask(dishesTaskDbid);
+
+    // verify all the sub tasks of 'clean da house' and 'sweep floor'
+    
+    subTaskNames = getTaskNames(taskService.getSubTasks(taskDbid));
+    
+    expectedTaskNames = new HashSet<String>();
+    expectedTaskNames.add("laundry");
+    expectedTaskNames.add("sweep floor");
+    
+    assertEquals(expectedTaskNames, subTaskNames);
+    
+    subTaskNames = getTaskNames(taskService.getSubTasks(sweepFloorTaskDbid));
+    
+    expectedTaskNames = new HashSet<String>();
+    expectedTaskNames.add("find broom");
+    expectedTaskNames.add("find water");
+    expectedTaskNames.add("scrub");
+    
+    assertEquals(expectedTaskNames, subTaskNames);
+
+    // delete laundry and delete sweep floor
+    // NOTE: deleting sweep floor should recursively delete the subtasks
+    taskService.deleteTask(laundryTaskDbid);
+    taskService.deleteTask(sweepFloorTaskDbid);
+
+    subTaskNames = getTaskNames(taskService.getSubTasks(taskDbid));
+
+    expectedTaskNames = new HashSet<String>();
+    assertEquals(expectedTaskNames, subTaskNames);
+    
+    subTaskNames = getTaskNames(taskService.getSubTasks(sweepFloorTaskDbid));
+    
+    expectedTaskNames = new HashSet<String>();
+    assertEquals(expectedTaskNames, subTaskNames);
+    
+    taskService.deleteTask(taskDbid);
+  }
+
+  private Set<String> getTaskNames(List<Task> tasks) {
+    Set<String> taskNames = new HashSet<String>();
+    for (Task task: tasks) {
+      taskNames.add(task.getName());
+    }
+    return taskNames;
+  }
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/SubTaskTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskCandidatesTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskCandidatesTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskCandidatesTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,214 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.task;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.task.Task;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskCandidatesTest extends AbstractTransactionalSpringJbpmTestCase {
+
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+  
+  public void testCommaSeparatedTaskCandidates() {
+    deployJpdlXmlString(
+      "<process name='TaskCandidates'>" +
+      "  <start>" +
+      "    <transition to='review' />" +
+      "  </start>" +
+      "  <task name='review' " +
+      "        candidate-users='johndoe, joesmoe'>" +
+      "    <transition to='wait' />" +
+      "  </task>" +
+      "  <state name='wait'/>" +
+      "</process>"
+    );
+    
+    Execution execution = executionService.startProcessInstanceByKey("TaskCandidates");
+    String executionId = execution.getId();
+
+    // both johndoe and joesmoe will see the task in their *takable* task list 
+    List<Task> taskList = taskService.findTakableTasks("johndoe");
+    assertEquals("Expected a single task being created", 1, taskList.size());
+    Task task = taskList.get(0);
+    assertEquals("review", task.getName());
+    
+    taskList = taskService.findTakableTasks("joesmoe");
+    assertEquals("Expected a single task being created", 1, taskList.size());
+    task = taskList.get(0);
+    assertEquals("review", task.getName());
+
+    // johndoe and joesmoe will NOT see the task in their *assigned* task list 
+
+    taskList = taskService.findAssignedTasks("johndoe");
+    assertEquals(0, taskList.size());
+
+    taskList = taskService.findAssignedTasks("joesmoe");
+    assertEquals(0, taskList.size());
+
+    // lets assume that johndoe takes the task
+    taskService.takeTask(task.getDbid(), "johndoe");
+    
+    // johndoe's and joesmoe's takable task list is now empty  
+    taskList = taskService.findTakableTasks("johndoe");
+    assertEquals(0, taskList.size());
+
+    taskList = taskService.findTakableTasks("joesmoe");
+    assertEquals(0, taskList.size());
+
+    // johndoe's assigned task list has the task in it
+    taskList = taskService.findAssignedTasks("johndoe");
+    assertEquals("Expected a single task being created", 1, taskList.size());
+    task = taskList.get(0);
+    assertEquals("review", task.getName());
+    assertEquals("johndoe", task.getAssignee());
+    
+    // joesmoe will not see the task in the assigned task list
+    taskList = taskService.findAssignedTasks("joesmoe");
+    assertEquals(0, taskList.size());
+
+    // now johndoe completes the task
+    taskService.completeTask(task.getDbid());
+    
+    // verify that the task list is now empty
+    taskList = taskService.findAssignedTasks("johndoe");
+    assertEquals(0, taskList.size());
+
+    // verify that process moved to the next state
+    execution = executionService.findExecutionById(executionId);
+    assertEquals("wait", execution.getActivityName());
+  }
+
+  public void testTaskCandidatesExpression() {
+    deployJpdlXmlString(
+      "<process name='TaskCandidates'>" +
+      "  <start>" +
+      "    <transition to='review' />" +
+      "  </start>" +
+      "  <task name='review' " +
+      "        candidate-users='#{userone}, #{usertwo}'>" +
+      "    <transition to='wait' />" +
+      "  </task>" +
+      "  <state name='wait'/>" +
+      "</process>"
+    );
+    
+    Map<String, Object> variables = new HashMap<String, Object>(); 
+    variables.put("userone", "johndoe");
+    variables.put("usertwo", "joesmoe");
+    Execution execution = executionService.startProcessInstanceByKey("TaskCandidates", variables);
+    String executionId = execution.getId();
+    
+    // both johndoe and joesmoe will see the task in their *takable* task list 
+    List<Task> taskList = taskService.findTakableTasks("johndoe");
+    assertEquals("Expected a single task being created", 1, taskList.size());
+    Task task = taskList.get(0);
+    assertEquals("review", task.getName());
+    
+    taskList = taskService.findTakableTasks("joesmoe");
+    assertEquals("Expected a single task being created", 1, taskList.size());
+    task = taskList.get(0);
+    assertEquals("review", task.getName());
+
+    // johndoe and joesmoe will NOT see the task in their *assigned* task list 
+
+    taskList = taskService.findAssignedTasks("johndoe");
+    assertEquals(0, taskList.size());
+
+    taskList = taskService.findAssignedTasks("joesmoe");
+    assertEquals(0, taskList.size());
+
+    // lets assume that johndoe takes the task
+    taskService.takeTask(task.getDbid(), "johndoe");
+    
+    // johndoe's and joesmoe's takable task list is now empty  
+    taskList = taskService.findTakableTasks("johndoe");
+    assertEquals(0, taskList.size());
+
+    taskList = taskService.findTakableTasks("joesmoe");
+    assertEquals(0, taskList.size());
+
+    // johndoe's assigned task list has the task in it
+    taskList = taskService.findAssignedTasks("johndoe");
+    assertEquals("Expected a single task being created", 1, taskList.size());
+    task = taskList.get(0);
+    assertEquals("review", task.getName());
+    assertEquals("johndoe", task.getAssignee());
+    
+    // joesmoe will not see the task in the assigned task list
+    taskList = taskService.findAssignedTasks("joesmoe");
+    assertEquals(0, taskList.size());
+
+    // now johndoe completes the task
+    taskService.completeTask(task.getDbid());
+    
+    // verify that the task list is now empty
+    taskList = taskService.findAssignedTasks("johndoe");
+    assertEquals(0, taskList.size());
+
+    // verify that process moved to the next state
+    execution = executionService.findExecutionById(executionId);
+    assertEquals("wait", execution.getActivityName());
+  }
+
+  public void testDoubleTake() {
+    deployJpdlXmlString(
+      "<process name='DoubleTake'>" +
+      "  <start>" +
+      "    <transition to='review' />" +
+      "  </start>" +
+      "  <task name='review' " +
+      "        candidate-users='johndoe, joesmoe'>" +
+      "    <transition to='wait' />" +
+      "  </task>" +
+      "  <state name='wait'/>" +
+      "</process>"
+    );
+    
+    Execution execution = executionService.startProcessInstanceByKey("DoubleTake");
+    String executionId = execution.getId();
+    
+    // both johndoe and joesmoe will see the task in their *takable* task list 
+    long taskDbid = taskService.findTakableTasks("johndoe").get(0).getDbid();
+
+    taskService.takeTask(taskDbid, "johndoe");
+
+    try {
+      taskService.takeTask(taskDbid, "joesmoe");
+    } catch (JbpmException e) {
+      assertTextPresent("task already taken by johndoe", e.getMessage());
+    }
+  }
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskCandidatesTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskCommentsTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskCommentsTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskCommentsTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.task;
+
+import java.util.List;
+
+import org.jbpm.api.model.Comment;
+import org.jbpm.api.task.Task;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskCommentsTest extends AbstractTransactionalSpringJbpmTestCase {
+  
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+  
+  public void testComments() {
+    Task task = taskService.newTask();
+    task.setName("clean da house");
+    long taskDbid = taskService.saveTask(task);
+
+    // what a party yesterday
+    //   - what! you had a party while i was out ?!
+    //      - euh yes.  it was a great party :-)
+    // i'll clean up the mess
+    Comment comment = taskService.addTaskComment(taskDbid, "what a party yesterday");
+    long whatAPartyDbid = comment.getDbid();
+    comment = taskService.addReplyComment(whatAPartyDbid, "what! you had a party while i was out ?!");
+    long youHadAPartyDbid = comment.getDbid();
+    taskService.addReplyComment(youHadAPartyDbid, "euh yes.  it was a great party :-)");
+
+    taskService.addTaskComment(taskDbid, "i'll clean up the mess");
+    
+    List<Comment> taskComments = taskService.getTaskComments(taskDbid);
+    assertEquals("what a party yesterday", taskComments.get(0).getMessage());
+    assertEquals("i'll clean up the mess", taskComments.get(1).getMessage());
+    
+    taskComments = taskComments.get(0).getComments();
+    assertEquals("what! you had a party while i was out ?!", taskComments.get(0).getMessage());
+    
+    taskComments = taskComments.get(0).getComments();
+    assertEquals("euh yes.  it was a great party :-)", taskComments.get(0).getMessage());
+    
+    taskService.deleteComment(whatAPartyDbid);
+
+    taskComments = taskService.getTaskComments(taskDbid);
+    assertEquals("i'll clean up the mess", taskComments.get(0).getMessage());
+    
+    // the following should delete the remaining comment.  if not, this 
+    // will show up as a fixme.
+    taskService.deleteTask(taskDbid);
+  }
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskCommentsTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskCreateUpdateDeleteTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskCreateUpdateDeleteTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskCreateUpdateDeleteTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.task;
+
+import java.text.DateFormat;
+import java.util.Date;
+
+import org.jbpm.api.task.Task;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class TaskCreateUpdateDeleteTest extends AbstractTransactionalSpringJbpmTestCase {
+
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+  
+  public void testNewTask() {
+    // creation of a new non-persisted task
+    Task task = taskService.newTask();
+    task = taskService.getTask(task.getDbid());
+    assertNull(task);
+  }
+
+  public void testSaveTask() {
+    Task task = taskService.newTask();
+    long taskDbid = taskService.saveTask(task);
+    // task was made persistent
+    task = taskService.getTask(taskDbid); 
+    assertNotNull("expected non-null task", task);
+    // make some change
+    Date dueDate = new Date();
+    task.setDueDate(dueDate);
+    taskService.saveTask(task);
+    // verify change is applied
+    task = taskService.getTask(taskDbid);
+    
+    // task.getDueDate() return an java.sql.Timestamp
+    DateFormat df = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG);
+    assertEquals(df.format(dueDate), df.format(task.getDueDate()));
+    
+    taskService.deleteTask(taskDbid);
+  }
+
+  public void testDeleteTask() {
+    Task task = taskService.newTask();
+    long taskDbid = taskService.saveTask(task);
+    
+    // task was made persistent
+    assertNotNull("expected non-null task", taskService.getTask(taskDbid));
+    // delete task and verify it does not exist
+    taskService.deleteTask(taskDbid);
+    task = taskService.getTask(taskDbid);
+    assertNull("expected null, but was " + task, task);
+  }
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskCreateUpdateDeleteTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskHandlerTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskHandlerTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskHandlerTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,172 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.task;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.task.OpenTask;
+import org.jbpm.api.task.Task;
+import org.jbpm.api.task.TaskHandler;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskHandlerTest extends AbstractTransactionalSpringJbpmTestCase {
+
+  static boolean isExecutionCreateTaskCalled;
+  static boolean isExecutionSignalledCalled;
+  static boolean isTaskCancelCalled;
+  static boolean isTaskCompleteCalled;
+  static boolean isSubTaskCompleteCalled;
+  static boolean isTaskVariableUpdateCalled;
+  
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+  
+  public void onSetUpInTransaction() throws Exception {
+
+    isExecutionCreateTaskCalled = false;
+    isExecutionSignalledCalled = false;
+    isTaskCancelCalled = false;
+    isTaskCompleteCalled = false;
+    isSubTaskCompleteCalled = false;
+    isTaskVariableUpdateCalled = false;
+  }
+
+  public static class ReviewHandler extends TaskHandler {
+    public boolean executionCreateTask(OpenTask task) {
+      isExecutionCreateTaskCalled = true;
+      return super.executionCreateTask(task);
+    }
+
+    public void executionSignal(OpenTask task) {
+      isExecutionSignalledCalled = true;
+      super.executionSignal(task);
+    }
+
+    public void taskCancel(OpenTask task, String reason) {
+      isTaskCancelCalled = true;
+      super.taskCancel(task, reason);
+    }
+
+    public void taskComplete(OpenTask task, String outcome) {
+      isTaskCompleteCalled = true;
+      super.taskComplete(task, outcome);
+    }
+
+    public void taskSubTaskComplete(OpenTask task, OpenTask subTask, String outcome) {
+      isSubTaskCompleteCalled = true;
+      super.taskSubTaskComplete(task, subTask, outcome);
+    }
+
+    public void taskVariableUpdate(OpenTask task, String key, Object value) {
+      isTaskVariableUpdateCalled = true;
+      super.taskVariableUpdate(task, key, value);
+    }
+  }
+
+  public void testTaskHandlerBasicScenario() {
+    deployJpdlXmlString(
+      "<process name='TaskHandler'>" +
+      "  <start>" +
+      "    <transition to='review' />" +
+      "  </start>" +
+      "  <task name='review'>" +
+      "    <task-handler class='"+ReviewHandler.class.getName()+"' />" +
+      "    <transition to='wait' />" +
+      "  </task>" +
+      "  <state name='wait'/>" +
+      "</process>"
+    );
+    
+    executionService.startProcessInstanceByKey("TaskHandler");
+    
+    assertTrue(isExecutionCreateTaskCalled);
+    
+    Task task = taskService.createTaskQuery().list().get(0);
+    
+    long taskDbid = task.getDbid();
+    taskService.setVariable(taskDbid, "checked", "true");
+    
+    assertTrue(isExecutionCreateTaskCalled);
+    
+    Task subTask = taskService.newTask(taskDbid);
+    long subTaskDbid = taskService.saveTask(subTask);
+    taskService.completeTask(subTaskDbid);
+    
+    assertTrue(isSubTaskCompleteCalled);
+
+    taskService.completeTask(taskDbid);
+
+    assertTrue(isTaskCompleteCalled);
+  }
+
+  public void testTaskHandlerCancelScenario() {
+    deployJpdlXmlString(
+      "<process name='TaskHandler'>" +
+      "  <start>" +
+      "    <transition to='review' />" +
+      "  </start>" +
+      "  <task name='review'>" +
+      "    <task-handler class='"+ReviewHandler.class.getName()+"' />" +
+      "    <transition to='wait' />" +
+      "  </task>" +
+      "  <state name='wait'/>" +
+      "</process>"
+    );
+    
+    executionService.startProcessInstanceByKey("TaskHandler");
+    
+    Task task = taskService.createTaskQuery().list().get(0);
+    long taskDbid = task.getDbid();
+
+    taskService.deleteTask(taskDbid);
+    
+    assertTrue(isTaskCancelCalled);
+  }
+
+  public void testTaskHandlerExecutionSignalScenario() {
+    deployJpdlXmlString(
+      "<process name='TaskHandler'>" +
+      "  <start>" +
+      "    <transition to='review' />" +
+      "  </start>" +
+      "  <task name='review'>" +
+      "    <task-handler class='"+ReviewHandler.class.getName()+"' />" +
+      "    <transition to='wait' />" +
+      "  </task>" +
+      "  <state name='wait'/>" +
+      "</process>"
+    );
+    
+    Execution execution = executionService.startProcessInstanceByKey("TaskHandler");
+    String executionId = execution.getId();
+    
+    executionService.signalExecutionById(executionId);
+    
+    assertTrue(isExecutionSignalledCalled);
+  }
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskHandlerTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskListTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskListTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskListTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,136 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.task;
+
+import java.util.List;
+
+import org.jbpm.api.task.Task;
+import org.jbpm.api.task.UserRef;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskListTest extends AbstractTransactionalSpringJbpmTestCase {
+
+  UserRef johndoe = new UserRef("johndoe");
+  UserRef joesmoe = new UserRef("joesmoe");
+  
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+  
+  public void testPersonalTaskList() {
+    Task task = taskService.newTask();
+    task.setName("do laundry");
+    task.setAssignee("johndoe");
+    long laundryTaskDbid = taskService.saveTask(task);
+
+    task = taskService.newTask();
+    task.setName("get good idea");
+    task.setAssignee("joesmoe");
+    long ideaTaskDbid = taskService.saveTask(task);
+
+    task = taskService.newTask();
+    task.setName("find venture capital");
+    task.setAssignee("joesmoe");
+    long capitalTaskDbid = taskService.saveTask(task);
+    
+    task = taskService.newTask();
+    task.setName("start new business");
+    task.setAssignee("joesmoe");
+    long startBusinessTaskDbid = taskService.saveTask(task);
+
+    List<Task> taskList = taskService.findAssignedTasks("johndoe");
+    assertNotNull(taskList);
+    
+    assertEquals("do laundry", taskList.get(0).getName());
+    assertEquals(1, taskList.size());
+
+    taskList = taskService.findAssignedTasks("joesmoe");
+    assertNotNull(taskList);
+    
+    assertContainsTask(taskList, "get good idea");
+    assertContainsTask(taskList, "start new business");
+    assertContainsTask(taskList, "find venture capital");
+
+    assertEquals(3, taskList.size());
+    
+    taskService.deleteTask(startBusinessTaskDbid);
+    taskService.deleteTask(capitalTaskDbid);
+    taskService.deleteTask(ideaTaskDbid);
+    taskService.deleteTask(laundryTaskDbid);
+  }
+
+  public void testPersonalTaskListDefaultSortOrder() {
+    Task task = taskService.newTask();
+    task.setName("get good idea");
+    task.setAssignee("joesmoe");
+    task.setPriority(3);
+    long ideaTaskDbid = taskService.saveTask(task);
+
+    task = taskService.newTask();
+    task.setName("find venture capital");
+    task.setAssignee("joesmoe");
+    task.setPriority(2);
+    long capitalTaskDbid = taskService.saveTask(task);
+    
+    task = taskService.newTask();
+    task.setName("start new business");
+    task.setAssignee("joesmoe");
+    task.setPriority(1);
+    long startBusinessTaskDbid = taskService.saveTask(task);
+
+    task = taskService.newTask();
+    task.setName("take a day off");
+    task.setAssignee("joesmoe");
+    task.setPriority(-5);
+    long dayOffTaskDbid = taskService.saveTask(task);
+
+    task = taskService.newTask();
+    task.setName("make profit");
+    task.setAssignee("joesmoe");
+    task.setPriority(10);
+    long profitTaskDbid = taskService.saveTask(task);
+
+    List<Task> taskList = taskService.findAssignedTasks("joesmoe");
+    assertNotNull(taskList);
+    
+    // default sort order is based on the priority
+    assertEquals("make profit",          taskList.get(0).getName());
+    assertEquals("get good idea",        taskList.get(1).getName());
+    assertEquals("find venture capital", taskList.get(2).getName());
+    assertEquals("start new business",   taskList.get(3).getName());
+    assertEquals("take a day off",       taskList.get(4).getName());
+
+    assertEquals(5, taskList.size());
+
+    taskService.deleteTask(profitTaskDbid);
+    taskService.deleteTask(dayOffTaskDbid);
+    taskService.deleteTask(startBusinessTaskDbid);
+    taskService.deleteTask(capitalTaskDbid);
+    taskService.deleteTask(ideaTaskDbid);
+  }
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskListTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskParticipationsTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskParticipationsTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskParticipationsTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,128 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.task;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.jbpm.api.task.Participation;
+import org.jbpm.api.task.Task;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskParticipationsTest extends AbstractTransactionalSpringJbpmTestCase {
+
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+  
+  public void testTaskParticipants() {
+    Task task = taskService.newTask();
+    task.setName("do laundry");
+    long taskDbid = taskService.saveTask(task);
+    
+    taskService.addTaskParticipatingUser(taskDbid, "johndoe", Participation.CANDIDATE);
+    taskService.addTaskParticipatingUser(taskDbid, "joesmoe", Participation.CANDIDATE);
+    taskService.addTaskParticipatingUser(taskDbid, "joesmoe", Participation.OWNER);
+    taskService.addTaskParticipatingGroup(taskDbid, "losers", Participation.CANDIDATE);
+    taskService.addTaskParticipatingGroup(taskDbid, "dummies", Participation.CANDIDATE);
+    
+    List<Participation> taskParticipations = taskService.getTaskParticipations(taskDbid);
+
+    Set<String> candidateUserIds = extractParticipatingUserIds(taskParticipations, Participation.CANDIDATE);
+    Set<String> ownerUserIds = extractParticipatingUserIds(taskParticipations, Participation.OWNER);
+    Set<String> candidateGroupIds = extractParticipatingGroupIds(taskParticipations, Participation.CANDIDATE);
+
+    Set<String> expectedIds  = new HashSet<String>();
+    expectedIds.add("johndoe");
+    expectedIds.add("joesmoe");
+
+    assertEquals(expectedIds, candidateUserIds);
+
+    expectedIds  = new HashSet<String>();
+    expectedIds.add("joesmoe");
+
+    assertEquals(expectedIds, ownerUserIds);
+    
+    expectedIds  = new HashSet<String>();
+    expectedIds.add("losers");
+    expectedIds.add("dummies");
+
+    assertEquals(expectedIds, candidateGroupIds);
+    
+    taskService.removeTaskParticipatingUser(taskDbid, "joesmoe", Participation.OWNER);
+    taskService.removeTaskParticipatingGroup(taskDbid, "losers", Participation.CANDIDATE);
+
+    taskParticipations = taskService.getTaskParticipations(taskDbid);
+
+    candidateUserIds = extractParticipatingUserIds(taskParticipations, Participation.CANDIDATE);
+    ownerUserIds = extractParticipatingUserIds(taskParticipations, Participation.OWNER);
+    candidateGroupIds = extractParticipatingGroupIds(taskParticipations, Participation.CANDIDATE);
+
+    expectedIds  = new HashSet<String>();
+    expectedIds.add("johndoe");
+    expectedIds.add("joesmoe");
+
+    assertEquals(expectedIds, candidateUserIds);
+
+    expectedIds  = new HashSet<String>();
+
+    assertEquals(expectedIds, ownerUserIds);
+    
+    expectedIds  = new HashSet<String>();
+    expectedIds.add("dummies");
+
+    assertEquals(expectedIds, candidateGroupIds);
+    
+    taskService.deleteTask(taskDbid);
+  }
+
+  public Set<String> extractParticipatingUserIds(List<Participation> taskParticipations, String participationType) {
+    Set<String> userIds = new HashSet<String>();
+    for (Participation participation : taskParticipations) {
+      if (participationType.equals(participation.getType())) {
+        if (participation.getUserId()!=null) {
+          userIds.add(participation.getUserId());
+        }
+      }
+    }
+    return userIds;
+  }
+
+  public Set<String> extractParticipatingGroupIds(List<Participation> taskParticipations, String participationType) {
+    Set<String> groupIds = new HashSet<String>();
+    for (Participation participation : taskParticipations) {
+      if (participationType.equals(participation.getType())) {
+        if (participation.getGroupId()!=null) {
+          groupIds.add(participation.getGroupId());
+        }
+      }
+    }
+    return groupIds;
+  }
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskParticipationsTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskQueryTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskQueryTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskQueryTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,127 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.task;
+
+import java.util.List;
+
+import org.jbpm.api.TaskQuery;
+import org.jbpm.api.task.Task;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskQueryTest extends AbstractTransactionalSpringJbpmTestCase {
+
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+  
+  public void testSimplestTaskQuery() {
+    Task task = taskService.newTask();
+    task.setName("do laundry");
+    task.setAssignee("johndoe");
+    task.setPriority(3);
+    long laudryTaskDbid = taskService.saveTask(task);
+
+    task = taskService.newTask();
+    task.setName("change dyper");
+    task.setAssignee("johndoe");
+    task.setPriority(1);
+    long dyperTaskDbid = taskService.saveTask(task);
+
+    task = taskService.newTask();
+    task.setName("start new business");
+    task.setAssignee("joesmoe");
+    task.setPriority(4);
+    long startBusinessTaskDbid = taskService.saveTask(task);
+
+    task = taskService.newTask();
+    task.setName("find venture capital");
+    task.setPriority(4);
+    long capitalTaskDbid = taskService.saveTask(task);
+
+    List<Task> taskList = taskService
+      .createTaskQuery()
+      .list();
+    assertNotNull(taskList);
+    
+    assertContainsTask(taskList, "do laundry");
+    assertContainsTask(taskList, "change dyper");
+    assertContainsTask(taskList, "start new business");
+    assertContainsTask(taskList, "find venture capital");
+
+    assertEquals(4, taskList.size());
+    
+    taskService.deleteTask(capitalTaskDbid);
+    taskService.deleteTask(startBusinessTaskDbid);
+    taskService.deleteTask(dyperTaskDbid);
+    taskService.deleteTask(laudryTaskDbid);
+  }
+
+  public void testSimplestTaskQuerySortBy() {
+    Task task = taskService.newTask();
+    task.setName("do laundry");
+    task.setAssignee("johndoe");
+    task.setPriority(3);
+    long laudryTaskDbid = taskService.saveTask(task);
+
+    task = taskService.newTask();
+    task.setName("change dyper");
+    task.setAssignee("johndoe");
+    task.setPriority(1);
+    long dyperTaskDbid = taskService.saveTask(task);
+
+    task = taskService.newTask();
+    task.setName("start new business");
+    task.setAssignee("joesmoe");
+    task.setPriority(4);
+    long startBusinessTaskDbid = taskService.saveTask(task);
+
+    task = taskService.newTask();
+    task.setName("find venture capital");
+    task.setPriority(7);
+    long capitalTaskDbid = taskService.saveTask(task);
+
+    List<Task> taskList = taskService
+      .createTaskQuery()
+      .orderAsc(TaskQuery.PROPERTY_NAME)
+      .list();
+    assertNotNull(taskList);
+    
+    assertEquals("change dyper",         taskList.get(0).getName());
+    assertEquals("do laundry",           taskList.get(1).getName());
+    assertEquals("find venture capital", taskList.get(2).getName());
+    assertEquals("start new business",   taskList.get(3).getName());
+
+    assertEquals(4, taskList.size());
+
+    taskService.deleteTask(capitalTaskDbid);
+    taskService.deleteTask(startBusinessTaskDbid);
+    taskService.deleteTask(dyperTaskDbid);
+    taskService.deleteTask(laudryTaskDbid);
+  }
+
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/task/TaskQueryTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/variables/BasicVariablesTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/variables/BasicVariablesTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/variables/BasicVariablesTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,122 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.variables;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class BasicVariablesTest extends AbstractTransactionalSpringJbpmTestCase {
+
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+  
+  public void testStartProcessInstanceWithoutVariables() {
+    deployJpdlXmlString(
+      "<process name='var'>" +
+      "  <start name='a'>" +
+      "    <transition to='b' />" +
+      "  </start>" +
+      "  <state name='b'/>" +
+      "</process>"
+    );
+    
+    executionService.startProcessInstanceByKey("var", "one");
+    Set<String> variableNames = executionService.getVariableNames("var.one");
+    assertNotNull(variableNames);
+    assertEquals(0, variableNames.size());
+  }
+
+  public void testStartProcessInstanceWithThreeVariables() {
+    deployJpdlXmlString(
+      "<process name='var'>" +
+      "  <start name='a'>" +
+      "    <transition to='b' />" +
+      "  </start>" +
+      "  <state name='b'/>" +
+      "</process>"
+    );
+    
+    Map<String, Object> variables = new HashMap<String, Object>();
+    variables.put("customer", "John Doe");
+    variables.put("type", "Accident");
+    variables.put("amount", new Float(763.74));
+
+    Set<String> expectedVariableNames = new HashSet<String>(variables.keySet());
+    Map<String, Object> expectedVariables = new HashMap<String, Object>(variables);
+
+    executionService.startProcessInstanceByKey("var", variables, "one");
+    
+    Set<String> variableNames = executionService.getVariableNames("var.one");
+    assertNotNull(variableNames);
+    
+    assertEquals(expectedVariableNames, variableNames);
+
+    variables = executionService.getVariables("var.one", variableNames);
+
+    assertEquals(expectedVariables, variables);
+  }
+
+  public void testSetAndUpdateVariable() {
+    deployJpdlXmlString(
+      "<process name='var'>" +
+      "  <start name='a'>" +
+      "    <transition to='b' />" +
+      "  </start>" +
+      "  <state name='b'/>" +
+      "</process>"
+    );
+    
+    executionService.startProcessInstanceByKey("var", "one");
+    executionService.setVariable("var.one", "msg", "hello");
+    assertEquals("hello", executionService.getVariable("var.one", "msg"));
+    executionService.setVariable("var.one", "msg", "world");
+    assertEquals("world", executionService.getVariable("var.one", "msg"));
+  }
+
+  public void testUpdateVariableToDifferentType() {
+    deployJpdlXmlString(
+      "<process name='var'>" +
+      "  <start name='a'>" +
+      "    <transition to='b' />" +
+      "  </start>" +
+      "  <state name='b'/>" +
+      "</process>"
+    );
+    
+    executionService.startProcessInstanceByKey("var", "one");
+    executionService.setVariable("var.one", "msg", "hello");
+    assertEquals("hello", executionService.getVariable("var.one", "msg"));
+    executionService.setVariable("var.one", "msg", new Integer(5));
+    assertEquals(new Integer(5), executionService.getVariable("var.one", "msg"));
+  }
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/variables/BasicVariablesTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/variables/VariableBasicTypesTest.java
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/variables/VariableBasicTypesTest.java	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/variables/VariableBasicTypesTest.java	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,149 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.spring.test.variables;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.spring.test.Constants;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class VariableBasicTypesTest extends AbstractTransactionalSpringJbpmTestCase {
+
+  @Override
+  protected String[] getConfigLocations() {
+    return new String[]{Constants.APPLICATIONCONTEXT_LOCATION};
+  }
+  
+  @Override
+  protected void onSetUpInTransaction() throws Exception {
+    super.onSetUpInTransaction();
+  }
+
+  private void checkVariableValue(Object variableValue) {
+    deployJpdlXmlString(
+            "<process name='var'>" +
+            "  <start name='a'>" +
+            "    <transition to='b' />" +
+            "  </start>" +
+            "  <state name='b'/>" +
+            "</process>"
+          );
+    
+    executionService.startProcessInstanceByKey("var", "one");
+    executionService.setVariable("var.one", "msg", variableValue);
+    assertEquals(variableValue, executionService.getVariable("var.one", "msg"));
+  }
+
+  public void testVariableTypeString() {
+    checkVariableValue("hello");
+  }
+
+  public void testVariableTypeCharacter() {
+    checkVariableValue(new Character('x'));
+  }
+
+  public void testVariableTypeBoolean() {
+    checkVariableValue(Boolean.TRUE);
+  }
+
+  public void testVariableTypeByte() {
+    checkVariableValue(new Byte((byte)5));
+  }
+
+  public void testVariableTypeShort() {
+    checkVariableValue(new Short((short)5));
+  }
+
+  public void testVariableTypeInteger() {
+    checkVariableValue(new Integer(5));
+  }
+
+  public void testVariableTypeLong() {
+    checkVariableValue(new Long(5));
+  }
+
+  public void testVariableTypeFloat() {
+    checkVariableValue(new Float(5.7));
+  }
+
+  public void testVariableTypeDouble() {
+    checkVariableValue(new Double(5.7));
+  }
+
+  public void testVariableTypeDate() {
+    checkVariableValue(new Date());
+  }
+  
+  public static class SerializeMe implements Serializable {
+    private static final long serialVersionUID = 1L;
+    String text;
+    public SerializeMe(String text) {
+      this.text = text;
+    }
+    public int hashCode() {
+      final int prime = 31;
+      int result = 1;
+      result = prime * result + ((text == null) ? 0 : text.hashCode());
+      return result;
+    }
+    public boolean equals(Object obj) {
+      if (this == obj)
+        return true;
+      if (obj == null)
+        return false;
+      if (getClass() != obj.getClass())
+        return false;
+      SerializeMe other = (SerializeMe) obj;
+      if (text == null) {
+        if (other.text != null)
+          return false;
+      } else if (!text.equals(other.text))
+        return false;
+      return true;
+    }
+  }
+  
+  public void testVariableTypeSerializable() {
+    SerializeMe originalValue = new SerializeMe(generateString("a lot of text ", 500));
+    checkVariableValue(originalValue);
+    
+    // now check if an update still works ok
+    // updating a serialized object might fail when the blob is cached by hibernate
+    SerializeMe newValue = new SerializeMe(generateString("another text ", 500));
+    executionService.setVariable("var.one", "msg", newValue);
+    assertEquals(newValue, executionService.getVariable("var.one", "msg"));
+  }
+  
+  protected String generateString(String base, int multiplier) {
+    StringBuffer buffer = new StringBuffer();
+    for (int i=0; i<multiplier; i++) {
+      buffer.append(base);
+    }
+    String string = buffer.toString();
+    return string;
+  }
+}


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/java/org/jbpm/spring/test/variables/VariableBasicTypesTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/resources/org/jbpm/spring/test/applicationContext.xml
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/resources/org/jbpm/spring/test/applicationContext.xml	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/resources/org/jbpm/spring/test/applicationContext.xml	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
+	xmlns:tx="http://www.springframework.org/schema/tx"
+	xsi:schemaLocation="
+        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
+        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
+        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
+
+	<bean id="configuration" class="org.jbpm.spring.cfg.SpringConfigurationFactoryBean">
+		<property name="jbpmConfigurationLocation" value="org/jbpm/spring/test/jbpm.cfg.xml" />
+	</bean>
+
+	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
+		<property name="configLocation" value="classpath:org/jbpm/spring/test/jbpm.hibernate.cfg.xml" />
+		<!-- A best practice should be to keep split the config into multiple files
+			<property name="configLocations" value="hibernate.cfg.xml, hibernate.jbpm.cfg.xml" />
+		 -->
+	</bean>
+
+	<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
+		<property name="sessionFactory" ref="sessionFactory" />
+	</bean>
+
+	<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
+		<property name="driverClassName" value="org.hsqldb.jdbcDriver" />
+		<property name="url" value="jdbc:hsqldb:mem:." />
+		<property name="username" value="sa" />
+		<property name="password" value="" />
+	</bean>
+	
+	<!-- We need to get the commandService, since we want a transaction around it. 
+	<bean id="commandService" 
+        class="org.jbpm.pvm.internal.spring.SpringCommandService">
+    	<property name="transactionManager" ref="transactionManager" />
+  	</bean>
+  	-->
+	
+	<!-- Start the jobExecutor
+	<bean id="jobExecutor" class="org.jbpm.pvm.internal.jobexecutor.JobExecutor" init-method="start" destroy-method="stop">
+		<property name="commandExecutor" ref="commandService" />
+	</bean>
+	 -->
+
+	<bean id="testBean" class="org.jbpm.spring.test.beans.InvokeTestBean" />
+
+
+</beans>
\ No newline at end of file


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/resources/org/jbpm/spring/test/applicationContext.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/resources/org/jbpm/spring/test/beans/process.jpdl.xml
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/resources/org/jbpm/spring/test/beans/process.jpdl.xml	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/resources/org/jbpm/spring/test/beans/process.jpdl.xml	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="Spring">
+
+	<start>
+		<transition to="test" />
+	</start>
+
+	<spring name="test">
+		<bean>testBean</bean>
+		<method>testMethod</method>
+		<transition to="testWithParameters" />
+	</spring>
+
+	<spring name="testWithParameters">
+		<bean>testBean</bean>
+		<method>testMethodWithParameters</method>
+		<parameters>
+			<string value="a good test" />
+		</parameters>
+		<transition to="exclusive spring test" />
+	</spring>
+	
+	<exclusive name="exclusive spring test"  handler-ref="testBean">
+		<transition name="no" to="wait" />
+		<transition name="yes" to="wait" />
+	</exclusive>
+
+	<state name="wait" />
+
+</process>


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/resources/org/jbpm/spring/test/beans/process.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/resources/org/jbpm/spring/test/jbpm.cfg.xml
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/resources/org/jbpm/spring/test/jbpm.cfg.xml	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/resources/org/jbpm/spring/test/jbpm.cfg.xml	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration xmlns="http://jbpm.org/xsd/cfg">
+
+  <process-engine-context>
+  
+    <repository-service />
+    <repository-cache />
+    <execution-service />
+    <history-service />
+    <management-service />
+    <task-service />
+    <identity-service />
+    <command-service>
+      <retry-interceptor />
+      <environment-interceptor />
+      <spring-transaction-interceptor current="true"/>
+      <!--
+      <spring-transaction-interceptor />
+    	-->
+    </command-service>
+    
+    <hibernate-configuration>
+      <cfg resource="jbpm.hibernate.cfg.xml" />     
+    </hibernate-configuration>
+
+    <deployer-manager>
+      <jpdl-deployer />
+    </deployer-manager>
+    
+    <script-manager default-expression-language="juel"
+                    default-script-language="juel"
+                    read-contexts="execution, environment, process-engine"
+                    write-context="">
+        <script-language name="juel" factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
+    </script-manager>
+    
+    <authentication />
+
+    <job-executor auto-start="false" />
+
+    <id-generator />
+    <types resource="jbpm.variable.types.xml" />
+
+    <business-calendar>
+      <monday    hours="9:00-12:00 and 12:30-17:00"/>
+      <tuesday   hours="9:00-12:00 and 12:30-17:00"/>
+      <wednesday hours="9:00-12:00 and 12:30-17:00"/>
+      <thursday  hours="9:00-12:00 and 12:30-17:00"/>
+      <friday    hours="9:00-12:00 and 12:30-17:00"/>
+      <holiday period="01/07/2008 - 31/08/2008"/>
+    </business-calendar>
+  
+  </process-engine-context>
+
+  <transaction-context>
+    <repository-session />
+    <pvm-db-session />
+    <job-db-session />
+    <task-db-session />
+    <message-session />
+    <timer-session />
+    <history-session />
+    <transaction />
+    <hibernate-session />
+    <identity-session />
+  </transaction-context>
+
+</jbpm-configuration>


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/resources/org/jbpm/spring/test/jbpm.cfg.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/ainze/modules/test-spring/src/test/resources/org/jbpm/spring/test/jbpm.hibernate.cfg.xml
===================================================================
--- jbpm4/branches/ainze/modules/test-spring/src/test/resources/org/jbpm/spring/test/jbpm.hibernate.cfg.xml	                        (rev 0)
+++ jbpm4/branches/ainze/modules/test-spring/src/test/resources/org/jbpm/spring/test/jbpm.hibernate.cfg.xml	2009-05-05 20:15:22 UTC (rev 4735)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!DOCTYPE hibernate-configuration PUBLIC
+          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+  <session-factory>
+  
+     <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
+     <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
+     <property name="hibernate.connection.url">jdbc:hsqldb:mem:.</property>
+     <property name="hibernate.connection.username">sa</property>
+     <property name="hibernate.connection.password"></property>
+     <property name="hibernate.hbm2ddl.auto">create-drop</property>
+     <property name="hibernate.format_sql">true</property>
+     
+     <mapping resource="jbpm.repository.hbm.xml" />
+     <mapping resource="jbpm.execution.hbm.xml" />
+     <mapping resource="jbpm.history.hbm.xml" />
+     <mapping resource="jbpm.task.hbm.xml" />
+     <mapping resource="jbpm.jpdl.hbm.xml" />
+     <mapping resource="jbpm.identity.hbm.xml" />
+     
+  </session-factory>
+</hibernate-configuration>


Property changes on: jbpm4/branches/ainze/modules/test-spring/src/test/resources/org/jbpm/spring/test/jbpm.hibernate.cfg.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain




More information about the jbpm-commits mailing list