⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 forkinlooptest.java

📁 一个java工作流引擎
💻 JAVA
字号:
package org.jbpm.service;

import java.util.*;
import junit.framework.*;
import org.jbpm.*;
import org.jbpm.model.definition.*;
import org.jbpm.model.execution.*;
import org.jbpm.model.execution.impl.*;
import org.jbpm.model.log.*;

public class ForkInLoopTest extends TestCase {
  
  public static TestHelper helper = new TestHelper();
  private ExecutionService executionService = helper.getExecutionService();
  
  static {
    helper.deployProcess( "process/forkinloopprocess.xml" );
  }
  
  public void testForkInLoop() throws Exception {
    // retrieve the definition
    Definition definition = executionService.getLatestDefinition( "the fork-in-loop process" );
    
    Collection tasks = executionService.getTaskList( "testrunner", null );
    int origTaskListSize = tasks.size();

    // start a process instance
    InvocationLog invocationLog = executionService.startProcessInstance( "testrunner", definition.getId() );
    ProcessInstanceImpl pi = (ProcessInstanceImpl) invocationLog.getProcessInstance();
    
    tasks = executionService.getTaskList( "testrunner", null );
    assertEquals( origTaskListSize+1, tasks.size() );

    for ( int i = 0; i < 15; i++ ) {
      Token token = (Token) tasks.iterator().next();
      if ( token.getProcessInstance() == pi ) {
        executionService.endOfState( "testrunner", token.getId() );
        tasks = executionService.getTaskList( "testrunner", null );
        assertEquals( origTaskListSize+1, tasks.size() );
      }
    }
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -