[jbpm-commits] JBoss JBPM SVN: r5712 - in jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test: migration and 1 other directory.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Oct 7 15:34:20 EDT 2009
Author: koen.aers at jboss.com
Date: 2009-10-07 15:34:20 -0400 (Wed, 07 Oct 2009)
New Revision: 5712
Added:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/migration/
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/migration/InstanceMigratorTest.java
Log:
add instance migration test in the test-db module
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/migration/InstanceMigratorTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/migration/InstanceMigratorTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/migration/InstanceMigratorTest.java 2009-10-07 19:34:20 UTC (rev 5712)
@@ -0,0 +1,78 @@
+package org.jbpm.test.migration;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessDefinition;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.test.JbpmTestCase;
+
+
+public class InstanceMigratorTest extends JbpmTestCase {
+
+ private String firstVersion =
+ "<process name='foobar'>" +
+ " <start>" +
+ " <transition to='foo'/>" +
+ " </start>" +
+ " <state name='foo'>" +
+ " <transition to='bar'/>" +
+ " </state>" +
+ " <state name='bar'>" +
+ " <transition to='end'/>" +
+ " </state>" +
+ " <end name='end'/>" +
+ "</process>";
+
+ private String secondVersion =
+ "<process name='foobar'>" +
+ " <start>" +
+ " <transition to='foo'/>" +
+ " </start>" +
+ " <state name='foo'>" +
+ " <transition to='bar'/>" +
+ " </state>" +
+ " <state name='bar'>" +
+ " <transition to='end'/>" +
+ " </state>" +
+ " <end name='end'/>" +
+ " <migrate-instances/>" +
+ "</process>";
+
+
+ public void testSimpleMigration() {
+ String deploymentId1 = repositoryService.createDeployment()
+ .addResourceFromString("foobar.jpdl.xml", firstVersion)
+ .deploy();
+ ProcessDefinition processDefinition1 = repositoryService
+ .createProcessDefinitionQuery()
+ .deploymentId(deploymentId1)
+ .uniqueResult();
+ Execution execution = executionService
+ .startProcessInstanceById(processDefinition1.getId())
+ .findActiveExecutionIn("foo");
+ executionService.signalExecutionById(execution.getId());
+ ProcessInstance processInstance1 = executionService
+ .createProcessInstanceQuery()
+ .processDefinitionId(processDefinition1.getId())
+ .uniqueResult();
+ assertNotNull(processInstance1.findActiveExecutionIn("bar"));
+
+ String deploymentId2 = repositoryService.createDeployment()
+ .addResourceFromString("foobar.jpdl.xml", secondVersion)
+ .deploy();
+ ProcessDefinition processDefinition2 = repositoryService
+ .createProcessDefinitionQuery()
+ .deploymentId(deploymentId2)
+ .uniqueResult();
+ ProcessInstance processInstance2 = executionService
+ .createProcessInstanceQuery()
+ .processDefinitionId(processDefinition2.getId())
+ .uniqueResult();
+
+ assertNotNull(processInstance2);
+
+ repositoryService.deleteDeploymentCascade(deploymentId2);
+ repositoryService.deleteDeploymentCascade(deploymentId1);
+
+ }
+
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/migration/InstanceMigratorTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
More information about the jbpm-commits
mailing list