[jbpm-commits] JBoss JBPM SVN: r2564 - jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm983.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Oct 21 07:58:15 EDT 2008
Author: tom.baeyens at jboss.com
Date: 2008-10-21 07:58:14 -0400 (Tue, 21 Oct 2008)
New Revision: 2564
Modified:
jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm983/JBPM983Test.java
Log:
[JBPM-1736] Cleanup JBPM983Test
Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm983/JBPM983Test.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm983/JBPM983Test.java 2008-10-21 11:42:08 UTC (rev 2563)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm983/JBPM983Test.java 2008-10-21 11:58:14 UTC (rev 2564)
@@ -113,73 +113,45 @@
public void testConcurrentJobs() throws Exception
{
- if (true)
- {
- System.out.println("FIXME [JBPM-1736]: Cleanup JBPM983Test");
- return;
- }
-
assertTrue(getJbpmConfiguration().getJobExecutor().getNbrOfThreads() > 1);
- log.info("### TEST: deploy + start processes ###");
-
ProcessDefinition subProcessDefinition = ProcessDefinition.parseXmlString(SUBPROCESS_XML);
+ jbpmContext.deployProcessDefinition(subProcessDefinition);
+
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(PROCESS_XML);
+ jbpmContext.deployProcessDefinition(processDefinition);
- JbpmContext jbpmContext = getJbpmConfiguration().createJbpmContext();
- try
- {
- jbpmContext.deployProcessDefinition(subProcessDefinition);
- jbpmContext.deployProcessDefinition(processDefinition);
- }
- finally
- {
- jbpmContext.close();
- }
+ newTransaction();
+
+ try {
+ // create test properties
+ Map testVariables = new HashMap();
+ testVariables.put("test", "true");
- // create test properties
- Map testVariables = new HashMap();
- testVariables.put("test", "true");
-
- final int processCount = 10;
- long[] piIds = new long[processCount];
- for (int i = 0; i < processCount; i++)
- {
- log.info("#################### TEST: starting process " + i + " ####################");
-
- jbpmContext = getJbpmConfiguration().createJbpmContext();
- try
+ final int processCount = 10;
+ long[] piIds = new long[processCount];
+ for (int i = 0; i < processCount; i++)
{
ProcessInstance pi = jbpmContext.newProcessInstanceForUpdate("superprocess");
pi.getContextInstance().addVariables(testVariables);
pi.signal();
piIds[i] = pi.getId();
+
+ newTransaction();
}
- finally
- {
- jbpmContext.close();
- }
- }
- for (int i = 0; i < processCount; i++)
- {
- log.info("### TEST: wait for process completion ###");
-
- long piId = piIds[i];
- waitFor(piId);
-
- jbpmContext = getJbpmConfiguration().createJbpmContext();
- try
+ for (int i = 0; i < processCount; i++)
{
+ long piId = piIds[i];
+ waitFor(piId);
+
ProcessInstance pi = jbpmContext.loadProcessInstance(piId);
assertEquals("end-state-success", pi.getRootToken().getNode().getName());
}
- finally
- {
- jbpmContext.close();
- }
-
- log.info("#################### TEST: finished ####################");
+ } finally {
+ newTransaction();
+ graphSession.deleteProcessDefinition(processDefinition);
+ graphSession.deleteProcessDefinition(subProcessDefinition);
}
}
@@ -187,8 +159,10 @@
{
final int endTimeout = 30;
long startTime = System.currentTimeMillis();
+
+ boolean processInstanceHasEnded = false;
- while (true)
+ while (! processInstanceHasEnded)
{
if (System.currentTimeMillis() - startTime > endTimeout * 1000)
{
@@ -196,27 +170,19 @@
return;
}
+ newTransaction();
+
+ processInstanceHasEnded = jbpmContext.loadProcessInstance(piId).hasEnded();
+
log.info("waiting for workflow completion....");
try
{
- Thread.sleep(1000);
+ Thread.sleep(200);
}
catch (InterruptedException e)
{
log.error("wait for workflow was interruputed", e);
- fail();
}
-
- JbpmContext jbpmContext = getJbpmConfiguration().createJbpmContext();
- try
- {
- if (jbpmContext.loadProcessInstance(piId).hasEnded())
- break;
- }
- finally
- {
- jbpmContext.close();
- }
}
}
More information about the jbpm-commits
mailing list