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