org.activiti.engine.ProcessEngines Java Examples

The following examples show how to use org.activiti.engine.ProcessEngines. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PluggableActivitiTestCase.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
protected void initializeProcessEngine() {
  if (cachedProcessEngine == null) {

    pluggableActivitiTestCaseLogger.info("No cached process engine found for test. Retrieving the default engine.");
    ProcessEngines.destroy(); // Just to be sure we're not getting any previously cached version

    cachedProcessEngine = ProcessEngines.getDefaultProcessEngine();
    if (cachedProcessEngine == null) {
      throw new ActivitiException("no default process engine available");
    }
  }
  
  processEngine = cachedProcessEngine;
  processEngineConfiguration = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration();
  
  // Enable verbose execution tree debugging if needed
  if (this.getClass().isAnnotationPresent(EnableVerboseExecutionTreeLogging.class)) {
    swapCommandInvoker(true);
  }
  
}
 
Example #2
Source File: AddZipInputStreamTest.java    From CrazyWorkflowHandoutsActiviti6 with MIT License 6 votes vote down vote up
public static void main(String[] args) throws Exception {
	// 新建流程引擎
	ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
	// 存储服务
	RepositoryService repositoryService = engine.getRepositoryService();
	// 新建部署构造器
	DeploymentBuilder deploymentBuilder = repositoryService.createDeployment();
	// 新建文件输入流
	FileInputStream fileInputStream = new FileInputStream(new File("resources/datas.zip"));
	// 新建Zip输入流
	ZipInputStream zipInputStream = new ZipInputStream(fileInputStream);
	// 将Zip输入流添加到部署构造器中
	deploymentBuilder.addZipInputStream(zipInputStream);
	// 发布部署构造器
	deploymentBuilder.deploy();
	// 关闭流程引擎
	engine.close();
}
 
Example #3
Source File: BpmnQueryTest.java    From CrazyWorkflowHandoutsActiviti6 with MIT License 6 votes vote down vote up
public static void main(String[] args) throws Exception {
      // 创建流程引擎
      ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
      // 得到流程存储服务对象
      RepositoryService repositoryService = engine.getRepositoryService();
      // 部署一份流程文件
      Deployment dep = repositoryService.createDeployment()
              .addClasspathResource("MyFirstProcess.bpmn").deploy();
      // 查询流程定义实体
      ProcessDefinition def = repositoryService.createProcessDefinitionQuery()
              .deploymentId(dep.getId()).singleResult();
      // 查询资源文件
      InputStream is = repositoryService.getProcessModel(def.getId());
      // 读取输入流
      int count = is.available();
      byte[] contents = new byte[count];
      is.read(contents);
      String result = new String(contents);
      //输入输出结果
      System.out.println(result);
// 关闭流程引擎
engine.close();
  }
 
Example #4
Source File: SchemaErrorTest.java    From CrazyWorkflowHandoutsActiviti6 with MIT License 6 votes vote down vote up
public static void main(String[] args) {           
// 新建流程引擎
ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
// 存储服务
RepositoryService repositoryService = engine.getRepositoryService();
// 新建部署构造器
DeploymentBuilder deploymentBuilder = repositoryService.createDeployment();
// 增加错误的schema文件(包括无效的标签)<test>test</test> 
// 校验报错:发现了以元素 'test' 开头的无效内容。
deploymentBuilder.addClasspathResource("error/schema_error.bpmn");
// 禁用Schema验证
deploymentBuilder.disableSchemaValidation();
// 发布部署构造器
deploymentBuilder.deploy();
// 关闭流程引擎
engine.close();
  }
 
Example #5
Source File: ApprovalTestApplication.java    From crnk-framework with Apache License 2.0 6 votes vote down vote up
public ApprovalTestApplication() {
    property(CrnkProperties.RESOURCE_DEFAULT_DOMAIN, "http://test.local");

    CrnkFeature feature = new CrnkFeature();
    initObjectMapper(feature);

    ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
    RuntimeService runtimeService = processEngine.getRuntimeService();
    TaskService taskService = processEngine.getTaskService();
    ModuleRegistry moduleRegistry = feature.getBoot().getModuleRegistry();

    processEngine.getRepositoryService().createDeployment()
            .addClasspathResource("approval.bpmn20.xml")
            .deploy();

    ActivitiResourceMapper resourceMapper =
            new ActivitiResourceMapper(moduleRegistry.getTypeParser(), new DefaultDateTimeMapper());
    ApprovalMapper mapper = new ApprovalMapper();
    ApprovalManager approvalManager = new ApprovalManagerFactory().getInstance();
    approvalManager.init(runtimeService, taskService, resourceMapper, mapper, moduleRegistry);
    feature.addModule(createApprovalModule(approvalManager));
    feature.addModule(createActivitiModule(processEngine));
    feature.addModule(new TestModule());

    registerInstances(feature);
}
 
Example #6
Source File: TextQueryTest.java    From CrazyWorkflowHandoutsActiviti6 with MIT License 6 votes vote down vote up
public static void main(String[] args) throws Exception {
	// 新建流程引擎
	ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
	// 存储服务
	RepositoryService repositoryService = engine.getRepositoryService();
	// 新建部署构造器
	DeploymentBuilder deploymentBuilder = repositoryService
			.createDeployment();
	deploymentBuilder.addClasspathResource("my_text.txt");
	Deployment deployment = deploymentBuilder.deploy();
	// 数据查询
	InputStream inputStream = repositoryService.getResourceAsStream(
			deployment.getId(), "my_text.txt");
	int count = inputStream.available();
	byte[] contents = new byte[count];
	inputStream.read(contents);
	String result = new String(contents);
	// 输入结果
	System.out.println(result);
	// 关闭流程引擎
	engine.close();
}
 
Example #7
Source File: AddBpmnModelTest.java    From CrazyWorkflowHandoutsActiviti6 with MIT License 6 votes vote down vote up
public static void main(String[] args) throws Exception {
	// 新建流程引擎
	ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
	// 存储服务
	RepositoryService repositoryService = engine.getRepositoryService();
	// 新建部署构造器
	DeploymentBuilder deploymentBuilder = repositoryService.createDeployment();
	String resourceName = "My Process";
	BpmnModel bpmnModel = createProcessModel();
	// 发布部署构造器
	deploymentBuilder.addBpmnModel(resourceName, bpmnModel);
	// 发布部署构造器
	deploymentBuilder.deploy();
	// 关闭流程引擎
	engine.close();
}
 
Example #8
Source File: FieldQuery.java    From CrazyWorkflowHandoutsActiviti6 with MIT License 6 votes vote down vote up
public static void main(String[] args) {
	// 新建流程引擎
	ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();

	IdentityService identityService = engine.getIdentityService();

	List<Group> groups = identityService.createGroupQuery()
			.groupName("Group_3").groupType("TYPE_0").list();

	for (Group group : groups) {
		System.out.println(group.getId() + "---" + group.getName() + "---"
				+ group.getType());
	}

	// 关闭流程引擎
	engine.close();
}
 
Example #9
Source File: SortMultiGroup.java    From CrazyWorkflowHandoutsActiviti6 with MIT License 6 votes vote down vote up
public static void main(String[] args) {
	// 新建流程引擎
	ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();

	IdentityService identityService = engine.getIdentityService();

	// 先按名称降序,再按类型降序
	List<Group> groups = identityService.createGroupQuery()
			.orderByGroupName().desc().orderByGroupType().desc().list();

	for (Group group : groups) {
		System.out.println(group.getId() + "---" + group.getName() + "---"
				+ group.getType());
	}

	// 关闭流程引擎
	engine.close();
}
 
Example #10
Source File: ListPageGroup.java    From CrazyWorkflowHandoutsActiviti6 with MIT License 6 votes vote down vote up
public static void main(String[] args) {
	// 新建流程引擎
	ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();

	IdentityService identityService = engine.getIdentityService();

	List<Group> groups = identityService.createGroupQuery().listPage(1, 5);

	for (Group group : groups) {
		System.out.println(group.getId() + "---" + group.getName() + "---"
				+ group.getType());
	}

	// 关闭流程引擎
	engine.close();
}
 
Example #11
Source File: SortGroup.java    From CrazyWorkflowHandoutsActiviti6 with MIT License 6 votes vote down vote up
public static void main(String[] args) {
	// 新建流程引擎
	ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();

	IdentityService identityService = engine.getIdentityService();

	List<Group> groups = identityService.createGroupQuery()
			.orderByGroupName().desc().list();

	for (Group group : groups) {
		System.out.println(group.getId() + "---" + group.getName() + "---"
				+ group.getType());
	}

	// 关闭流程引擎
	engine.close();
}
 
Example #12
Source File: NativeQuery.java    From CrazyWorkflowHandoutsActiviti6 with MIT License 6 votes vote down vote up
public static void main(String[] args) {
	// 新建流程引擎
	ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();

	IdentityService identityService = engine.getIdentityService();

	List<Group> groups = identityService.createNativeGroupQuery()
			.sql("SELECT * FROM ACT_ID_GROUP WHERE NAME_ = #{name}")
			.parameter("name", "Group_3").list();

	for (Group group : groups) {
		System.out.println(group.getId() + "---" + group.getName() + "---"
				+ group.getType());
	}

	// 关闭流程引擎
	engine.close();
}
 
Example #13
Source File: ActivitiTestBase.java    From crnk-framework with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() {
    processEngine = ProcessEngines.getDefaultProcessEngine();

    processEngine.getRepositoryService().createDeployment()
            .addClasspathResource("approval.bpmn20.xml")
            .deploy();

    boot = new CrnkBoot();
    boot.addModule(new TestModule());
    boot.addModule(createActivitiModule());
    boot.boot();

    taskRepository = (TaskResourceRepository<ApproveTask>) boot.getResourceRegistry().getEntry(ApproveTask.class)
            .getResourceRepository().getImplementation();
}
 
Example #14
Source File: NativeQuery.java    From CrazyWorkflowHandoutsActiviti6 with MIT License 6 votes vote down vote up
public static void main(String[] args) {
	// 新建流程引擎
	ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();

	IdentityService identityService = engine.getIdentityService();

	List<Group> groups = identityService.createNativeGroupQuery()
			.sql("SELECT * FROM ACT_ID_GROUP WHERE NAME_ = #{name}")
			.parameter("name", "Group_3").list();

	for (Group group : groups) {
		System.out.println(group.getId() + "---" + group.getName() + "---"
				+ group.getType());
	}

	// 关闭流程引擎
	engine.close();
}
 
Example #15
Source File: ProcessExecutionIntegrationTest.java    From tutorials with MIT License 6 votes vote down vote up
@Test
public void givenProcessDefinition_whenStartProcessInstance_thenProcessRunning() {
    ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
    RepositoryService repositoryService = processEngine.getRepositoryService();
    repositoryService.createDeployment()
      .addClasspathResource("org/activiti/test/vacationRequest.bpmn20.xml")
      .deploy();

    Map<String, Object> variables = new HashMap<String, Object>();
    variables.put("employeeName", "Kermit");
    variables.put("numberOfDays", new Integer(4));
    variables.put("vacationMotivation", "I'm really tired!");

    RuntimeService runtimeService = processEngine.getRuntimeService();
    ProcessInstance processInstance = runtimeService
      .startProcessInstanceByKey("vacationRequest", variables);

    Long count = runtimeService.createProcessInstanceQuery().count();
    assertTrue(count >= 1);
}
 
Example #16
Source File: SaveGroup.java    From CrazyWorkflowHandoutsActiviti6 with MIT License 6 votes vote down vote up
public static void main(String[] args) {
	// 新建流程引擎
	ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
	
	IdentityService identityService = engine.getIdentityService();
	
	Random ran = new Random(10);
	for (int i = 0; i < 10; i++) {
		Group group = identityService.newGroup(String.valueOf(i));
		group.setName("Group_" + ran.nextInt(10));
		group.setType("TYPE_" + ran.nextInt(10));
		identityService.saveGroup(group);
	}

	// 关闭流程引擎
	engine.close();
}
 
Example #17
Source File: ProcessEngineResource.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@ApiOperation(value = "Get engine info", tags = {"Engine"})
@ApiResponses(value = {
    @ApiResponse(code = 200, message =  "Indicates the engine info is returned."),
})
@RequestMapping(value = "/management/engine", method = RequestMethod.GET, produces = "application/json")
public ProcessEngineInfoResponse getEngineInfo() {
  ProcessEngineInfoResponse response = new ProcessEngineInfoResponse();

  try {
    ProcessEngineInfo engineInfo = ProcessEngines.getProcessEngineInfo(engine.getName());
    if (engineInfo != null) {
      response.setName(engineInfo.getName());
      response.setResourceUrl(engineInfo.getResourceUrl());
      response.setException(engineInfo.getException());
    } else {
      // Revert to using process-engine directly
      response.setName(engine.getName());
    }
  } catch (Exception e) {
    throw new ActivitiException("Error retrieving process info", e);
  }

  response.setVersion(ProcessEngine.VERSION);
  return response;
}
 
Example #18
Source File: FieldQuery.java    From CrazyWorkflowHandoutsActiviti6 with MIT License 6 votes vote down vote up
public static void main(String[] args) {
	// 新建流程引擎
	ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();

	IdentityService identityService = engine.getIdentityService();

	List<Group> groups = identityService.createGroupQuery()
			.groupName("Group_3").groupType("TYPE_0").list();

	for (Group group : groups) {
		System.out.println(group.getId() + "---" + group.getName() + "---"
				+ group.getType());
	}

	// 关闭流程引擎
	engine.close();
}
 
Example #19
Source File: AddBpmnModelTest.java    From CrazyWorkflowHandoutsActiviti6 with MIT License 6 votes vote down vote up
public static void main(String[] args) throws Exception {
	// 新建流程引擎
	ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
	// 存储服务
	RepositoryService repositoryService = engine.getRepositoryService();
	// 新建部署构造器
	DeploymentBuilder deploymentBuilder = repositoryService.createDeployment();
	String resourceName = "My Process";
	BpmnModel bpmnModel = createProcessModel();
	// 发布部署构造器
	deploymentBuilder.addBpmnModel(resourceName, bpmnModel);
	// 发布部署构造器
	deploymentBuilder.deploy();
	// 关闭流程引擎
	engine.close();
}
 
Example #20
Source File: TextQueryTest.java    From CrazyWorkflowHandoutsActiviti6 with MIT License 6 votes vote down vote up
public static void main(String[] args) throws Exception {
	// 新建流程引擎
	ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
	// 存储服务
	RepositoryService repositoryService = engine.getRepositoryService();
	// 新建部署构造器
	DeploymentBuilder deploymentBuilder = repositoryService
			.createDeployment();
	deploymentBuilder.addClasspathResource("my_text.txt");
	Deployment deployment = deploymentBuilder.deploy();
	// 数据查询
	InputStream inputStream = repositoryService.getResourceAsStream(
			deployment.getId(), "my_text.txt");
	int count = inputStream.available();
	byte[] contents = new byte[count];
	inputStream.read(contents);
	String result = new String(contents);
	// 输入结果
	System.out.println(result);
	// 关闭流程引擎
	engine.close();
}
 
Example #21
Source File: AddZipInputStreamTest.java    From CrazyWorkflowHandoutsActiviti6 with MIT License 6 votes vote down vote up
public static void main(String[] args) throws Exception {
	// 新建流程引擎
	ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
	// 存储服务
	RepositoryService repositoryService = engine.getRepositoryService();
	// 新建部署构造器
	DeploymentBuilder deploymentBuilder = repositoryService.createDeployment();
	// 新建文件输入流
	FileInputStream fileInputStream = new FileInputStream(new File("resources/datas.zip"));
	// 新建Zip输入流
	ZipInputStream zipInputStream = new ZipInputStream(fileInputStream);
	// 将Zip输入流添加到部署构造器中
	deploymentBuilder.addZipInputStream(zipInputStream);
	// 发布部署构造器
	deploymentBuilder.deploy();
	// 关闭流程引擎
	engine.close();
}
 
Example #22
Source File: SchemaErrorTest.java    From CrazyWorkflowHandoutsActiviti6 with MIT License 6 votes vote down vote up
public static void main(String[] args) {           
// 新建流程引擎
ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
// 存储服务
RepositoryService repositoryService = engine.getRepositoryService();
// 新建部署构造器
DeploymentBuilder deploymentBuilder = repositoryService.createDeployment();
// 增加错误的schema文件(包括无效的标签)<test>test</test> 
// 校验报错:发现了以元素 'test' 开头的无效内容。
deploymentBuilder.addClasspathResource("error/schema_error.bpmn");
// 禁用Schema验证
deploymentBuilder.disableSchemaValidation();
// 发布部署构造器
deploymentBuilder.deploy();
// 关闭流程引擎
engine.close();
  }
 
Example #23
Source File: BpmnErrorTest.java    From CrazyWorkflowHandoutsActiviti6 with MIT License 6 votes vote down vote up
public static void main(String[] args) {       
// 新建流程引擎
ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
// 存储服务
RepositoryService repositoryService = engine.getRepositoryService();
// 新建部署构造器
DeploymentBuilder deploymentBuilder = repositoryService.createDeployment();
// 增加错误的schema文件(包括无效的标签)<test>test</test>
// 报错信息:[Validation set: 'activiti-executable-process' | 
//Problem: 'activiti-start-event-multiple-found'] : 
//Multiple none start events are not supported - 
//[Extra info : processDefinitionId = myProcess | 
// processDefinitionName = My process |  | id = startevent1 |  
//| activityName = Start | ] ( line: 4, column: 47)
deploymentBuilder.addClasspathResource("error/bpmn_error.bpmn");
// 禁用Bpmn验证
deploymentBuilder.disableBpmnValidation();
// 发布部署构造器
deploymentBuilder.deploy();
// 关闭流程引擎
engine.close();
  }
 
Example #24
Source File: MuleHttpTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@Test
public void http() throws Exception {
  Assert.assertTrue(muleContext.isStarted());

  ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
  Deployment deployment = processEngine.getRepositoryService().createDeployment()
      .addClasspathResource("org/activiti5/mule/testHttp.bpmn20.xml")
      .deploymentProperty(DeploymentProperties.DEPLOY_AS_ACTIVITI5_PROCESS_DEFINITION, Boolean.TRUE)
      .deploy();
  RuntimeService runtimeService = processEngine.getRuntimeService();
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess");
  Assert.assertFalse(processInstance.isEnded());
  Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable");
  Assert.assertEquals(20, result);
  runtimeService.deleteProcessInstance(processInstance.getId(), "test");
  processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId());
  processEngine.getRepositoryService().deleteDeployment(deployment.getId());
  assertAndEnsureCleanDb(processEngine);
  ProcessEngines.destroy();
}
 
Example #25
Source File: MuleHttpBasicAuthTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@Test
public void httpWithBasicAuth() throws Exception {
  Assert.assertTrue(muleContext.isStarted());

  ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
  Deployment deployment = processEngine.getRepositoryService()
      .createDeployment()
      .addClasspathResource("org/activiti5/mule/testHttpBasicAuth.bpmn20.xml")
      .deploymentProperty(DeploymentProperties.DEPLOY_AS_ACTIVITI5_PROCESS_DEFINITION, Boolean.TRUE)
      .deploy();
  RuntimeService runtimeService = processEngine.getRuntimeService();
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess");
  Assert.assertFalse(processInstance.isEnded());
  Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable");
  Assert.assertEquals(10, result);
  runtimeService.deleteProcessInstance(processInstance.getId(), "test");
  processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId());
  processEngine.getRepositoryService().deleteDeployment(deployment.getId());
  assertAndEnsureCleanDb(processEngine);
  ProcessEngines.destroy();
}
 
Example #26
Source File: MuleHttpTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@Test
public void http() throws Exception {
  Assert.assertTrue(muleContext.isStarted());

  ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
  Deployment deployment = processEngine.getRepositoryService().createDeployment().addClasspathResource("org/activiti/mule/testHttp.bpmn20.xml").deploy();
  RuntimeService runtimeService = processEngine.getRuntimeService();
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess");
  Assert.assertFalse(processInstance.isEnded());
  Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable");
  Assert.assertEquals(20, result);
  runtimeService.deleteProcessInstance(processInstance.getId(), "test");
  processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId());
  processEngine.getRepositoryService().deleteDeployment(deployment.getId());
  assertAndEnsureCleanDb(processEngine);
  ProcessEngines.destroy();
}
 
Example #27
Source File: MuleHttpBasicAuthTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@Test
public void httpWithBasicAuth() throws Exception {
  Assert.assertTrue(muleContext.isStarted());

  ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
  Deployment deployment = processEngine.getRepositoryService().createDeployment().addClasspathResource("org/activiti/mule/testHttpBasicAuth.bpmn20.xml").deploy();
  RuntimeService runtimeService = processEngine.getRuntimeService();
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess");
  Assert.assertFalse(processInstance.isEnded());
  Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable");
  Assert.assertEquals(10, result);
  runtimeService.deleteProcessInstance(processInstance.getId(), "test");
  processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId());
  processEngine.getRepositoryService().deleteDeployment(deployment.getId());
  assertAndEnsureCleanDb(processEngine);
  ProcessEngines.destroy();
}
 
Example #28
Source File: MuleVMTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@Test
public void send() throws Exception {
  Assert.assertTrue(muleContext.isStarted());

  ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
  RepositoryService repositoryService = processEngine.getRepositoryService();
  Deployment deployment = repositoryService.createDeployment().addClasspathResource("org/activiti/mule/testVM.bpmn20.xml").deploy();

  RuntimeService runtimeService = processEngine.getRuntimeService();
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess");
  Assert.assertFalse(processInstance.isEnded());
  Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable");
  Assert.assertEquals(30, result);
  runtimeService.deleteProcessInstance(processInstance.getId(), "test");

  processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId());
  repositoryService.deleteDeployment(deployment.getId());
  assertAndEnsureCleanDb(processEngine);
  ProcessEngines.destroy();
}
 
Example #29
Source File: SortMultiGroup.java    From CrazyWorkflowHandoutsActiviti6 with MIT License 6 votes vote down vote up
public static void main(String[] args) {
	// 新建流程引擎
	ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();

	IdentityService identityService = engine.getIdentityService();

	// 先按名称降序,再按类型降序
	List<Group> groups = identityService.createGroupQuery()
			.orderByGroupName().desc().orderByGroupType().desc().list();

	for (Group group : groups) {
		System.out.println(group.getId() + "---" + group.getName() + "---"
				+ group.getType());
	}

	// 关闭流程引擎
	engine.close();
}
 
Example #30
Source File: ProcessEngineConfigurationTest.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
/**
 * 此测试会失败,因为本例没有配置oracle驱动
 */
@Test
public void specialName() {
    ProcessEngineConfiguration.createProcessEngineConfigurationFromResourceDefault().setProcessEngineName("oracleEngine").setJdbcDriver("oracle.jdbc.Driver")
            .setJdbcUrl("jdbc:oracle:thin:@localhost:1521:XE").setJdbcUsername("dbusername").setJdbcPassword("password").setDatabaseType("oracle")
            .buildProcessEngine();
    ProcessEngine oracleEngine = ProcessEngines.getProcessEngine("oracleEngine");
    assertNotNull(oracleEngine);
}