View Javadoc

1   /*
2    * $Id: JbpmUnitTestCase.java 19740 2010-09-27 14:47:48Z tcarlson $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.module.jbpm;
12  
13  import org.mule.module.jbpm.Jbpm;
14  import org.mule.tck.AbstractMuleTestCase;
15  
16  /**
17   * Tests the jBPM wrapper with a simple process.
18   */
19  public class JbpmUnitTestCase extends AbstractMuleTestCase
20  {
21      public void testDeployAndRun() throws Exception 
22      {
23          Jbpm jbpm = new Jbpm();
24          jbpm.initialise();
25  
26          // Deploy the process
27          jbpm.deployProcess("simple-process.jpdl.xml");
28  
29          // Start the process
30          Object process = jbpm.startProcess("simple", null, null);
31          assertNotNull(process);
32          Object processId = jbpm.getId(process);
33          
34          // The process should be started and in a wait state.
35          process = jbpm.lookupProcess(processId);
36          assertNotNull(process);             
37          assertEquals("dummyState", jbpm.getState(process));
38  
39          // Advance the process one step.
40          process = jbpm.advanceProcess(processId);
41  
42          // The process should have ended.
43          assertNotNull(process);             
44          assertTrue(jbpm.hasEnded(process));
45  
46          jbpm.dispose();
47      }
48  }