[jbpm-commits] JBoss JBPM SVN: r4340 - in jbpm4/branches/ainze/modules: spring and 26 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Mar 26 17:45:23 EDT 2009
Author: ainze
Date: 2009-03-26 17:45:23 -0400 (Thu, 26 Mar 2009)
New Revision: 4340
Added:
jbpm4/branches/ainze/modules/spring/
jbpm4/branches/ainze/modules/spring/pom.xml
jbpm4/branches/ainze/modules/spring/src/
jbpm4/branches/ainze/modules/spring/src/main/
jbpm4/branches/ainze/modules/spring/src/main/java/
jbpm4/branches/ainze/modules/spring/src/main/java/org/
jbpm4/branches/ainze/modules/spring/src/main/java/org/jbpm/
jbpm4/branches/ainze/modules/spring/src/main/java/org/jbpm/spring/
jbpm4/branches/ainze/modules/spring/src/main/java/org/jbpm/spring/cfg/
jbpm4/branches/ainze/modules/spring/src/main/java/org/jbpm/spring/cfg/SpringConfigurationFactoryBean.java
jbpm4/branches/ainze/modules/spring/src/main/java/org/jbpm/spring/test/
jbpm4/branches/ainze/modules/spring/src/main/java/org/jbpm/spring/test/AbstractTransactionalSpringJbpmTestCase.java
jbpm4/branches/ainze/modules/spring/src/test/
jbpm4/branches/ainze/modules/spring/src/test/java/
jbpm4/branches/ainze/modules/spring/src/test/java/org/
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/activities/
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/activities/ExclusiveTest.java
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/activities/StateTest.java
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/beans/
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/beans/InvokeTestBean.java
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/beans/SpringBeanTest.java
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/FindExecutionTest.java
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/SignalExecutionTest.java
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/StartExecutionTest.java
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/process/
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/process/ProcessDefinitionQueryTest.java
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskCreateUpdateDeleteTest.java
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskListTest.java
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskQueryTest.java
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/variables/
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/variables/BasicVariablesTest.java
jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/variables/VariableBasicTypesTest.java
jbpm4/branches/ainze/modules/spring/src/test/resources/
jbpm4/branches/ainze/modules/spring/src/test/resources/org/
jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/
jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/
jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/
jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/applicationContext.xml
jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/beans/
jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/beans/process.jpdl.xml
jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/hibernate.jbpm.cfg.xml
jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/jbpm.cfg.xml
Log:
spring release
Added: jbpm4/branches/ainze/modules/spring/pom.xml
===================================================================
--- jbpm4/branches/ainze/modules/spring/pom.xml (rev 0)
+++ jbpm4/branches/ainze/modules/spring/pom.xml 2009-03-26 21:45:23 UTC (rev 4340)
@@ -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-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/spring/pom.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/main/java/org/jbpm/spring/cfg/SpringConfigurationFactoryBean.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/main/java/org/jbpm/spring/cfg/SpringConfigurationFactoryBean.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/main/java/org/jbpm/spring/cfg/SpringConfigurationFactoryBean.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,80 @@
+/**
+ *
+ */
+package org.jbpm.spring.cfg;
+
+import org.hibernate.SessionFactory;
+import org.jbpm.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/spring/src/main/java/org/jbpm/spring/cfg/SpringConfigurationFactoryBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/main/java/org/jbpm/spring/test/AbstractTransactionalSpringJbpmTestCase.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/main/java/org/jbpm/spring/test/AbstractTransactionalSpringJbpmTestCase.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/main/java/org/jbpm/spring/test/AbstractTransactionalSpringJbpmTestCase.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,67 @@
+/**
+ *
+ */
+package org.jbpm.spring.test;
+
+import java.util.List;
+
+import org.jbpm.Configuration;
+import org.jbpm.ExecutionService;
+import org.jbpm.ManagementService;
+import org.jbpm.ProcessEngine;
+import org.jbpm.ProcessService;
+import org.jbpm.TaskService;
+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;
+ private ProcessEngine processEngine;
+
+ protected ExecutionService executionService;
+ protected ProcessService processService;
+ protected TaskService taskService;
+ protected ManagementService managementService;
+ protected List<String> taskIds;
+
+ 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();
+ executionService = processEngine.getExecutionService();
+ processService = processEngine.getProcessService();
+ taskService = processEngine.getTaskService();
+ managementService = processEngine.getManagementService();
+ }
+
+ public void deployJpdlXmlString(String jpdlXmlString) {
+ processService.createDeployment().addString("xmlstring.jpdl.xml",
+ jpdlXmlString).deploy().getProcessDefinitions();
+ }
+
+ public void deployJpdlResource(String resource) {
+ processService.createDeployment().addResource(resource).deploy()
+ .getProcessDefinitions();
+ }
+}
Property changes on: jbpm4/branches/ainze/modules/spring/src/main/java/org/jbpm/spring/test/AbstractTransactionalSpringJbpmTestCase.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/activities/ExclusiveTest.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/activities/ExclusiveTest.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/activities/ExclusiveTest.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,101 @@
+/*
+ * 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.Execution;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ExclusiveTest extends AbstractTransactionalSpringJbpmTestCase {
+
+ @Override
+ protected String[] getConfigLocations() {
+ return new String[]{"org/jbpm/spring/test/applicationContext.xml"};
+ }
+
+ public void testExclusiveExpression() {
+ deployJpdlXmlString(
+ "<process name='Poolcar'>" +
+ " <start>" +
+ " <transition to='How far?' />" +
+ " </start>" +
+ " <exclusive name='How far?' expr='#{distance}'>" +
+ " <transition name='far' to='Big car' />" +
+ " <transition name='nearby' to='Small car' />" +
+ " </exclusive>" +
+ " <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 testExclusiveWithConditions() {
+ deployJpdlXmlString(
+ "<process name='Poolcar'>" +
+ " <start>" +
+ " <transition to='How far?' />" +
+ " </start>" +
+ " <exclusive name='How far?'>" +
+ " <transition to='Big car'>" +
+ " <condition expr='#{distance > 10}' />" +
+ " </transition>" +
+ " <transition to='Small car'>" +
+ " <condition expr='#{distance >= 3}' />" +
+ " </transition>" +
+ " <transition to='No car' />" +
+ " </exclusive>" +
+ " <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/spring/src/test/java/org/jbpm/spring/test/activities/ExclusiveTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/activities/StateTest.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/activities/StateTest.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/activities/StateTest.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,44 @@
+/**
+ *
+ */
+package org.jbpm.spring.test.activities;
+
+import org.jbpm.Execution;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+
+/**
+ * @author AIEXM45
+ *
+ */
+public class StateTest extends AbstractTransactionalSpringJbpmTestCase {
+
+ /**
+ * {@inheritDoc)
+ */
+ @Override
+ protected String[] getConfigLocations() {
+ return new String[]{"org/jbpm/spring/test/applicationContext.xml"};
+ }
+
+ 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());
+ }
+
+
+}
Property changes on: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/activities/StateTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/beans/InvokeTestBean.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/beans/InvokeTestBean.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/beans/InvokeTestBean.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,54 @@
+/**
+ *
+ */
+package org.jbpm.spring.test.beans;
+
+import org.jbpm.jpdl.ExclusiveHandler;
+import org.jbpm.model.OpenExecution;
+
+/**
+ * @author Andries Inze
+ *
+ */
+public class InvokeTestBean implements ExclusiveHandler {
+
+ 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/spring/src/test/java/org/jbpm/spring/test/beans/InvokeTestBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/beans/SpringBeanTest.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/beans/SpringBeanTest.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/beans/SpringBeanTest.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,35 @@
+/**
+ *
+ */
+package org.jbpm.spring.test.beans;
+
+import org.jbpm.Execution;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+
+/**
+ * @author AIEXM45
+ *
+ */
+public class SpringBeanTest extends AbstractTransactionalSpringJbpmTestCase {
+
+ /**
+ * {@inheritDoc)
+ */
+ @Override
+ protected String[] getConfigLocations() {
+ return new String[]{"org/jbpm/spring/test/applicationContext.xml"};
+ }
+
+ public void testInvokeSpringBean() {
+ deployJpdlResource("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/spring/src/test/java/org/jbpm/spring/test/beans/SpringBeanTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/FindExecutionTest.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/FindExecutionTest.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/FindExecutionTest.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -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.Execution;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+
+/**
+ * @author Tom Baeyens
+ */
+public class FindExecutionTest extends AbstractTransactionalSpringJbpmTestCase {
+
+
+ @Override
+ protected String[] getConfigLocations() {
+ return new String[]{"org/jbpm/spring/test/applicationContext.xml"};
+ }
+
+ 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.findExecution(execution.getId());
+ assertNotNull(execution);
+ assertEquals("a", execution.getActivityName());
+ }
+
+}
Property changes on: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/FindExecutionTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/SignalExecutionTest.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/SignalExecutionTest.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/SignalExecutionTest.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,260 @@
+/*
+ * 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.Execution;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SignalExecutionTest extends AbstractTransactionalSpringJbpmTestCase {
+
+
+ @Override
+ protected String[] getConfigLocations() {
+ return new String[]{"org/jbpm/spring/test/applicationContext.xml"};
+ }
+
+ public void testSignalExecutionByKey() {
+ 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.signalExecutionByKey("ICL", "82436");
+
+ assertEquals("b", execution.getActivityName());
+
+ execution = executionService.signalExecutionByKey("ICL", "82436");
+
+ assertEquals("c", execution.getActivityName());
+ }
+
+ 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());
+ }
+
+ /*
+
+ public void testSetVariable()
+ {
+ Execution execution = startExecution();
+
+ String executionId = execution.getId();
+ // set variable a to value text
+ executionService.setVariable(executionId, "a", "text");
+ // check if we can read that value back
+ assertEquals("text", executionService.getVariable(executionId, "a"));
+
+ // overwrite the value of variable a with another text
+ executionService.setVariable(executionId, "a", "another text");
+ // see if we can read another text back from the variable
+ assertEquals("another text", executionService.getVariable(executionId, "a"));
+ }
+
+ public void testSetVariables()
+ {
+ Execution execution = startExecution();
+
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("a", new Integer(1));
+ variables.put("b", "text");
+
+ // set variables in bulk by providing a map
+ executionService.setVariables(execution.getId(), variables);
+
+ Map<String, Object> expected = new HashMap<String, Object>(variables);
+
+ Set<String> variableNames = new HashSet<String>();
+ variableNames.add("a");
+ variableNames.add("b");
+
+ // read the variables back and compare
+ assertEquals(expected, executionService.getVariables(execution.getId(), variableNames));
+
+ // now set variables b and c with a map
+ variables = new HashMap<String, Object>();
+ variables.put("b", new Integer(99));
+ variables.put("c", "another text");
+
+ // this should leave a untouched, overwrite b and create c
+ executionService.setVariables(execution.getId(), variables);
+
+ // update the expected map
+ expected.put("b", new Integer(99));
+ expected.put("c", "another text");
+
+ // add c to the variable names that should be collected
+ variableNames.add("c");
+
+ // read the variables back and compare
+ assertEquals(expected, executionService.getVariables(execution.getId(), variableNames));
+ }
+
+ // helper methods ///////////////////////////////////////////////////////////
+
+ /**
+ * deploys 3 versions of process with name 'nuclear fusion', 2 versions of the processes 'ultimate seduction' and
+ * 'publish book'
+ void deployMultipleVersionsOfProcesses()
+ {
+ ProcessService processService = getEnvironmentFactory().get(ProcessService.class);
+
+ ProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion").key("NFU").activity("initial").initial().behaviour(
+ WaitState.class).done();
+ DeploymentImpl deploymentImpl = new DeploymentImpl(processDefinition);
+ processService.deploy(deploymentImpl);
+
+ processDefinition = ProcessFactory.build("ultimate seduction").key("USD").activity("initial").initial().behaviour(WaitState.class).done();
+ deploymentImpl = new DeploymentImpl(processDefinition);
+ processService.deploy(deploymentImpl);
+
+ processDefinition = ProcessFactory.build("ultimate seduction").key("USD").activity("initial").initial().behaviour(WaitState.class).done();
+ deploymentImpl = new DeploymentImpl(processDefinition);
+ processService.deploy(deploymentImpl);
+
+ processDefinition = ProcessFactory.build("nuclear fusion").key("NFU").activity("initial").initial().behaviour(WaitState.class).done();
+ deploymentImpl = new DeploymentImpl(processDefinition);
+ processService.deploy(deploymentImpl);
+
+ processDefinition = ProcessFactory.build("publish book").key("PBO").activity("initial").initial().behaviour(WaitState.class).done();
+ deploymentImpl = new DeploymentImpl(processDefinition);
+ processService.deploy(deploymentImpl);
+
+ processDefinition = ProcessFactory.build("nuclear fusion").key("NFU").activity("initial").initial().behaviour(WaitState.class).done();
+ deploymentImpl = new DeploymentImpl(processDefinition);
+ processService.deploy(deploymentImpl);
+ }
+
+ Execution startExecution()
+ {
+ ProcessService processService = getEnvironmentFactory().get(ProcessService.class);
+
+ ProcessDefinition processDefinition = ProcessFactory.build("nuclear fusion").activity("initial").initial().behaviour(WaitState.class)
+ .done();
+ DeploymentImpl deploymentImpl = new DeploymentImpl(processDefinition);
+ processService.deploy(deploymentImpl);
+
+ ExecutionService executionService = getEnvironmentFactory().get(ExecutionService.class);
+
+ return executionService.startExecutionByName("nuclear fusion");
+ }
+
+ */
+}
Property changes on: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/SignalExecutionTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/StartExecutionTest.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/StartExecutionTest.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/execution/StartExecutionTest.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,224 @@
+/*
+ * 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.Execution;
+import org.jbpm.ProcessDefinition;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class StartExecutionTest extends AbstractTransactionalSpringJbpmTestCase {
+
+ @Override
+ protected String[] getConfigLocations() {
+ return new String[]{"org/jbpm/spring/test/applicationContext.xml"};
+ }
+
+ 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>"
+ );
+
+ ProcessDefinition processDefinition = processService.findProcessDefinitionsByKey("ICL").get(0);
+
+ // 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/spring/src/test/java/org/jbpm/spring/test/execution/StartExecutionTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/process/ProcessDefinitionQueryTest.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/process/ProcessDefinitionQueryTest.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/process/ProcessDefinitionQueryTest.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,145 @@
+/*
+ * 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.ProcessDefinition;
+import org.jbpm.ProcessDefinitionQuery;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ProcessDefinitionQueryTest extends AbstractTransactionalSpringJbpmTestCase {
+
+
+ @Override
+ protected String[] getConfigLocations() {
+ return new String[]{"org/jbpm/spring/test/applicationContext.xml"};
+ }
+
+ public void testQueryProcessDefinitionsEmpty() {
+ List<ProcessDefinition> processDefinitions = processService
+ .createProcessDefinitionQuery()
+ .execute();
+
+ assertEquals(0, processDefinitions.size());
+ }
+
+ 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 = processService.createProcessDefinitionQuery()
+ .nameLike("%make%")
+ .orderAsc(ProcessDefinitionQuery.PROPERTY_NAME)
+ .execute();
+
+ assertEquals("fix coffeemaker", processDefinitions.get(0).getName());
+ assertEquals("make friends", processDefinitions.get(1).getName());
+ assertEquals("make print", processDefinitions.get(2).getName());
+ }
+
+ 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 = processService.createProcessDefinitionQuery()
+ .keyLike("make%")
+ .orderAsc(ProcessDefinitionQuery.PROPERTY_NAME)
+ .orderDesc(ProcessDefinitionQuery.PROPERTY_VERSION)
+ .execute();
+
+ assertEquals("make_friends:3", processDefinitions.get(0).getId());
+ assertEquals("make_friends:2", processDefinitions.get(1).getId());
+ assertEquals("make_friends:1", processDefinitions.get(2).getId());
+ assertEquals("make_print:1", processDefinitions.get(3).getId());
+ }
+}
Property changes on: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/process/ProcessDefinitionQueryTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskCreateUpdateDeleteTest.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskCreateUpdateDeleteTest.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskCreateUpdateDeleteTest.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,74 @@
+/*
+ * 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.Date;
+
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.task.Task;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class TaskCreateUpdateDeleteTest extends AbstractTransactionalSpringJbpmTestCase {
+
+ @Override
+ protected String[] getConfigLocations() {
+ return new String[]{"org/jbpm/spring/test/applicationContext.xml"};
+ }
+
+ 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();
+ taskService.saveTask(task);
+ Long taskId = task.getDbid();
+ // task was made persistent
+ task = taskService.getTask(taskId);
+ 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(taskId);
+ assertEquals(dueDate, task.getDueDate());
+ }
+
+ public void testDeleteTask() {
+ Task task = taskService.newTask();
+ taskService.saveTask(task);
+ Long taskId = task.getDbid();
+
+ // task was made persistent
+ assertNotNull("expected non-null task", taskService.getTask(taskId));
+ // delete task and verify it does not exist
+ taskService.deleteTask(taskId);
+ task = taskService.getTask(taskId);
+ assertNull("expected null, but was " + task, task);
+ }
+}
Property changes on: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskCreateUpdateDeleteTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskListTest.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskListTest.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskListTest.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,120 @@
+/*
+ * 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.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.task.Task;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskListTest extends AbstractTransactionalSpringJbpmTestCase {
+
+ @Override
+ protected String[] getConfigLocations() {
+ return new String[]{"org/jbpm/spring/test/applicationContext.xml"};
+ }
+
+ public void testPersonalTaskList() {
+ Task task = taskService.newTask();
+ task.setName("do laundry");
+ task.setAssignee("johndoe");
+ taskService.saveTask(task);
+
+ task = taskService.newTask();
+ task.setName("get good idea");
+ task.setAssignee("joesmoe");
+ taskService.saveTask(task);
+
+ task = taskService.newTask();
+ task.setName("find venture capital");
+ task.setAssignee("joesmoe");
+ taskService.saveTask(task);
+
+ task = taskService.newTask();
+ task.setName("start new business");
+ task.setAssignee("joesmoe");
+ taskService.saveTask(task);
+
+ List<Task> taskList = taskService.getPersonalTaskList("johndoe", 0, 10);
+ assertNotNull(taskList);
+
+ assertEquals("do laundry", taskList.get(0).getName());
+ assertEquals(1, taskList.size());
+
+ taskList = taskService.getPersonalTaskList("joesmoe", 0, 10);
+ assertNotNull(taskList);
+
+// assertContainsTask(taskList, "get good idea");
+// assertContainsTask(taskList, "start new business");
+// assertContainsTask(taskList, "find venture capital");
+
+ assertEquals(3, taskList.size());
+ }
+
+ public void testPersonalTaskListDefaultSortOrder() {
+ Task task = taskService.newTask();
+ task.setName("get good idea");
+ task.setAssignee("joesmoe");
+ task.setPriority(3);
+ taskService.saveTask(task);
+
+ task = taskService.newTask();
+ task.setName("find venture capital");
+ task.setAssignee("joesmoe");
+ task.setPriority(2);
+ taskService.saveTask(task);
+
+ task = taskService.newTask();
+ task.setName("start new business");
+ task.setAssignee("joesmoe");
+ task.setPriority(1);
+ taskService.saveTask(task);
+
+ task = taskService.newTask();
+ task.setName("take a day off");
+ task.setAssignee("joesmoe");
+ task.setPriority(-5);
+ taskService.saveTask(task);
+
+ task = taskService.newTask();
+ task.setName("make profit");
+ task.setAssignee("joesmoe");
+ task.setPriority(10);
+ taskService.saveTask(task);
+
+ List<Task> taskList = taskService.getPersonalTaskList("joesmoe", 0, 10);
+ 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());
+ }
+}
Property changes on: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskListTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskQueryTest.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskQueryTest.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskQueryTest.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,116 @@
+/*
+ * 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.TaskQuery;
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+import org.jbpm.task.Task;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskQueryTest extends AbstractTransactionalSpringJbpmTestCase {
+
+ @Override
+ protected String[] getConfigLocations() {
+ return new String[]{"org/jbpm/spring/test/applicationContext.xml"};
+ }
+
+ public void testSimplestTaskQuery() {
+ Task task = taskService.newTask();
+ task.setName("do laundry");
+ task.setAssignee("johndoe");
+ task.setPriority(3);
+ taskService.saveTask(task);
+
+ task = taskService.newTask();
+ task.setName("change dyper");
+ task.setAssignee("johndoe");
+ task.setPriority(1);
+ taskService.saveTask(task);
+
+ task = taskService.newTask();
+ task.setName("start new business");
+ task.setAssignee("joesmoe");
+ task.setPriority(4);
+ taskService.saveTask(task);
+
+ task = taskService.newTask();
+ task.setName("find venture capital");
+ task.setPriority(4);
+ taskService.saveTask(task);
+
+ List<Task> taskList = taskService
+ .createTaskQuery()
+ .execute();
+ assertNotNull(taskList);
+
+// assertContainsTask(taskList, "do laundry");
+// assertContainsTask(taskList, "change dyper");
+// assertContainsTask(taskList, "start new business");
+// assertContainsTask(taskList, "find venture capital");
+
+ assertEquals(4, taskList.size());
+ }
+
+ public void testSimplestTaskQuerySortBy() {
+ Task task = taskService.newTask();
+ task.setName("do laundry");
+ task.setAssignee("johndoe");
+ task.setPriority(3);
+ taskService.saveTask(task);
+
+ task = taskService.newTask();
+ task.setName("change dyper");
+ task.setAssignee("johndoe");
+ task.setPriority(1);
+ taskService.saveTask(task);
+
+ task = taskService.newTask();
+ task.setName("start new business");
+ task.setAssignee("joesmoe");
+ task.setPriority(4);
+ taskService.saveTask(task);
+
+ task = taskService.newTask();
+ task.setName("find venture capital");
+ task.setPriority(7);
+ taskService.saveTask(task);
+
+ List<Task> taskList = taskService
+ .createTaskQuery()
+ .orderAsc(TaskQuery.PROPERTY_NAME)
+ .execute();
+ 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());
+ }
+
+}
Property changes on: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/task/TaskQueryTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/variables/BasicVariablesTest.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/variables/BasicVariablesTest.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/variables/BasicVariablesTest.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,121 @@
+/*
+ * 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;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class BasicVariablesTest extends AbstractTransactionalSpringJbpmTestCase {
+
+ @Override
+ protected String[] getConfigLocations() {
+ return new String[]{"org/jbpm/spring/test/applicationContext.xml"};
+ }
+
+ 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/spring/src/test/java/org/jbpm/spring/test/variables/BasicVariablesTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/variables/VariableBasicTypesTest.java
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/variables/VariableBasicTypesTest.java (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/variables/VariableBasicTypesTest.java 2009-03-26 21:45:23 UTC (rev 4340)
@@ -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.variables;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import org.jbpm.spring.test.AbstractTransactionalSpringJbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class VariableBasicTypesTest extends AbstractTransactionalSpringJbpmTestCase {
+
+ @Override
+ protected String[] getConfigLocations() {
+ return new String[]{"org/jbpm/spring/test/applicationContext.xml"};
+ }
+
+ public 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() {
+ checkVariableValue(new SerializeMe("hello world"));
+ }
+}
Property changes on: jbpm4/branches/ainze/modules/spring/src/test/java/org/jbpm/spring/test/variables/VariableBasicTypesTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/applicationContext.xml
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/applicationContext.xml (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/applicationContext.xml 2009-03-26 21:45:23 UTC (rev 4340)
@@ -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" />
+ <property name="sessionFactory" ref="sessionFactory" />
+ <property name="commandService" ref="commandService" />
+ </bean>
+
+ <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
+ <property name="configLocation" value="classpath:org/jbpm/spring/test/hibernate.jbpm.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/spring/src/test/resources/org/jbpm/spring/test/applicationContext.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/beans/process.jpdl.xml
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/beans/process.jpdl.xml (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/beans/process.jpdl.xml 2009-03-26 21:45:23 UTC (rev 4340)
@@ -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/spring/src/test/resources/org/jbpm/spring/test/beans/process.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/hibernate.jbpm.cfg.xml
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/hibernate.jbpm.cfg.xml (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/hibernate.jbpm.cfg.xml 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,50 @@
+<?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>
+ <mapping resource="jbpm.pvm.typedefs.hbm.xml" />
+ <mapping resource="jbpm.pvm.wire.hbm.xml" />
+ <mapping resource="jbpm.pvm.definition.hbm.xml" />
+ <mapping resource="jbpm.pvm.execution.hbm.xml" />
+ <mapping resource="jbpm.pvm.variable.hbm.xml" />
+ <mapping resource="jbpm.pvm.history.hbm.xml" />
+ <mapping resource="jbpm.pvm.job.hbm.xml" />
+ <mapping resource="jbpm.jpdl.hbm.xml" />
+ <mapping resource="jbpm.task.hbm.xml" />
+
+ <class-cache usage="nonstrict-read-write" class="org.jbpm.pvm.internal.model.ProcessDefinitionImpl" />
+ <class-cache usage="nonstrict-read-write" class="org.jbpm.pvm.internal.model.ActivityImpl" />
+ <class-cache usage="nonstrict-read-write" class="org.jbpm.pvm.internal.model.TransitionImpl" />
+ <class-cache usage="nonstrict-read-write" class="org.jbpm.pvm.internal.model.EventImpl" />
+ <class-cache usage="nonstrict-read-write" class="org.jbpm.pvm.internal.model.ExceptionHandlerImpl" />
+ <class-cache usage="nonstrict-read-write" class="org.jbpm.pvm.internal.model.ObjectReference" />
+ <class-cache usage="nonstrict-read-write" class="org.jbpm.pvm.internal.model.VariableDefinitionImpl" />
+ <class-cache usage="nonstrict-read-write" class="org.jbpm.pvm.internal.model.TimerDefinitionImpl" />
+ <class-cache usage="nonstrict-read-write" class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor" />
+
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.ProcessDefinitionImpl.exceptionHandlers" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.ProcessDefinitionImpl.events" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.ProcessDefinitionImpl.activities" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.ProcessDefinitionImpl.variableDefinitions" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.ProcessDefinitionImpl.timerDefinitions" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.ActivityImpl.exceptionHandlers" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.ActivityImpl.events" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.ActivityImpl.activities" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.ActivityImpl.variableDefinitions" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.ActivityImpl.timerDefinitions" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.ActivityImpl.incomingTransitions" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.ActivityImpl.outgoingTransitions" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.TransitionImpl.exceptionHandlers" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.TransitionImpl.events" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.EventImpl.exceptionHandlers" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.EventImpl.listenerReferences" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.model.ExceptionHandlerImpl.eventListenerReferences" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor.argDescriptors" />
+ <collection-cache usage="nonstrict-read-write" collection="org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor.operations" />
+
+ </session-factory>
+</hibernate-configuration>
\ No newline at end of file
Property changes on: jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/hibernate.jbpm.cfg.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/jbpm.cfg.xml
===================================================================
--- jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/jbpm.cfg.xml (rev 0)
+++ jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/jbpm.cfg.xml 2009-03-26 21:45:23 UTC (rev 4340)
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration xmlns="http://jbpm.org/xsd/cfg">
+
+ <process-engine-context>
+
+ <deployer-manager>
+ <assign-file-type>
+ <file extension=".jpdl.xml" type="jpdl" />
+ </assign-file-type>
+ <parse-jpdl />
+ <check-process />
+ <check-problems />
+ <save />
+ </deployer-manager>
+
+ <process-service />
+ <execution-service />
+ <history-service />
+ <management-service />
+ <task-service />
+
+ <command-service>
+ <retry-interceptor />
+ <environment-interceptor />
+
+ <!-- Spring is doing all the transaction stuff. -->
+ <!-- <standard-transaction-interceptor /> -->
+
+ </command-service>
+
+ <script-manager default-expression-language="juel"
+ default-script-language="juel"
+ read-contexts="execution, environment, process-engine"
+ write-context="">
+ <script-language name="juel" factory="com.sun.script.juel.JuelScriptEngineFactory" />
+ </script-manager>
+
+ <job-executor auto-start="true" />
+ <job-test-helper />
+
+ <id-generator />
+ <types resource="jbpm.pvm.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>
+ <!-- All operations inside a single request will be handled by the spring session -->
+ <hibernate-session current="true" />
+
+ <transaction />
+ <pvm-db-session />
+ <job-db-session />
+ <task-db-session />
+ <message-session />
+ <timer-session />
+ <history-session />
+ </transaction-context>
+
+
+</jbpm-configuration>
Property changes on: jbpm4/branches/ainze/modules/spring/src/test/resources/org/jbpm/spring/test/jbpm.cfg.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
More information about the jbpm-commits
mailing list