• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Deployment类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.activiti.engine.test.Deployment的典型用法代码示例。如果您正苦于以下问题:Java Deployment类的具体用法?Java Deployment怎么用?Java Deployment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Deployment类属于org.activiti.engine.test包,在下文中一共展示了Deployment类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testNestedSequentialCallActivity

import org.activiti.engine.test.Deployment; //导入依赖的package包/类
@Deployment(resources = { "org/activiti/engine/test/bpmn/multiinstance/MultiInstanceTest.testNestedSequentialCallActivity.bpmn20.xml",
    "org/activiti/engine/test/bpmn/multiinstance/MultiInstanceTest.externalSubProcess.bpmn20.xml" })
public void testNestedSequentialCallActivity() {
  String procId = runtimeService.startProcessInstanceByKey("miNestedSequentialCallActivity").getId();
  
  for (int i=0; i<4; i++) {
    List<Task> tasks = taskService.createTaskQuery().orderByTaskName().asc().list();
    assertEquals(2, tasks.size());
    assertEquals("task one", tasks.get(0).getName());
    assertEquals("task two", tasks.get(1).getName());
    taskService.complete(tasks.get(0).getId());
    taskService.complete(tasks.get(1).getId());
  }

  assertProcessEnded(procId);
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:17,代码来源:MultiInstanceTest.java


示例2: testDeeplyNestedErrorThrown

import org.activiti.engine.test.Deployment; //导入依赖的package包/类
@Deployment
public void testDeeplyNestedErrorThrown() {
  
  // Input = 1 -> error1 will be thrown, which will destroy ALL BUT ONE 
  // subprocess, which leads to an end event, which ultimately leads to ending the process instance
  String procId = runtimeService.startProcessInstanceByKey("deeplyNestedErrorThrown").getId();
  Task task = taskService.createTaskQuery().singleResult();
  assertEquals("Nested task", task.getName());
  taskService.complete(task.getId(), CollectionUtil.singletonMap("input", 1));
  assertProcessEnded(procId);
  
  // Input == 2 -> error2 will be thrown, leading to a userTask outside all subprocesses
  procId = runtimeService.startProcessInstanceByKey("deeplyNestedErrorThrown").getId();
  task = taskService.createTaskQuery().singleResult();
  assertEquals("Nested task", task.getName());
  taskService.complete(task.getId(), CollectionUtil.singletonMap("input", 2));
  task = taskService.createTaskQuery().singleResult();
  assertEquals("task after catch", task.getName());
  taskService.complete(task.getId());
  assertProcessEnded(procId);
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:22,代码来源:BoundaryErrorEventTest.java


示例3: testCompleteDirectly

import org.activiti.engine.test.Deployment; //导入依赖的package包/类
/**
 * 不触发消息边界事件,直接完成任务--cancelActivity='true'
 */
@Deployment(resources = "chapter11/boundaryEvent/signalBoundaryEvent.bpmn")
public void testCompleteDirectly() throws Exception {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("signalBoundaryEvent");
    assertNotNull(processInstance);

    // 审核文件任务
    Task task = taskService.createTaskQuery().taskName("审核文件").singleResult();
    assertNotNull(task);
    ExecutionQuery executionQuery = runtimeService.createExecutionQuery();
    Execution execution = executionQuery.signalEventSubscriptionName("S_协助处理").singleResult();
    assertNotNull(execution);

    taskService.complete(task.getId());

}
 
开发者ID:barudisshu,项目名称:activiti-in-action-codes,代码行数:19,代码来源:SignalBoundaryEventTest.java


示例4: testClashingValues

import org.activiti.engine.test.Deployment; //导入依赖的package包/类
@Deployment(resources={
  "org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml"})
  public void testClashingValues() throws Exception {
    Map<String, Object> vars = new HashMap<String, Object>();
    vars.put("var", 1234L);
    
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess", vars);
    
    Map<String, Object> vars2 = new HashMap<String, Object>();
    vars2.put("var", 1234);
    
    ProcessInstance processInstance2 = runtimeService.startProcessInstanceByKey("oneTaskProcess", vars2);
    
    List<ProcessInstance> foundInstances = runtimeService.createProcessInstanceQuery()
    .processDefinitionKey("oneTaskProcess")
    .variableValueEquals("var", 1234L)
    .list();
    
    assertEquals(1, foundInstances.size());
    assertEquals(processInstance.getId(), foundInstances.get(0).getId());
    
    runtimeService.deleteProcessInstance(processInstance.getId(), "test");
    runtimeService.deleteProcessInstance(processInstance2.getId(), "test");
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:25,代码来源:ProcessInstanceQueryTest.java


示例5: testOne

import org.activiti.engine.test.Deployment; //导入依赖的package包/类
@Test
@Deployment(resources = {"diagrams/chapter10/multiinstance-for-subprocess.bpmn"})
public void testOne() throws Exception {

    identityService.setAuthenticatedUserId("henryyan");

    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("multiinstance-for-subprocess");

    Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).taskCandidateGroup("deptLeader").singleResult();
    taskService.claim(task.getId(), "bill");

    Map<String, Object> variables = new HashMap<String, Object>();
    List<String> users = Arrays.asList("user1", "user2", "user3");
    variables.put("users", users);
    taskService.complete(task.getId(), variables);

    for (String user : users) {
        long count = taskService.createTaskQuery().taskAssignee(user).count();
        assertEquals(1, count);
    }
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:22,代码来源:MultiInstanceForSubprocessTest.java


示例6: testSetJobRetries

import org.activiti.engine.test.Deployment; //导入依赖的package包/类
@Deployment(resources = {"org/activiti/engine/test/api/mgmt/ManagementServiceTest.testGetJobExceptionStacktrace.bpmn20.xml"})
public void testSetJobRetries() {
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("exceptionInJobExecution");

  // The execution is waiting in the first usertask. This contains a boundary
  // timer event.
  Job timerJob = managementService.createJobQuery()
    .processInstanceId(processInstance.getId())
    .singleResult();
  
  assertNotNull("No job found for process instance", timerJob);
  assertEquals(JobEntity.DEFAULT_RETRIES, timerJob.getRetries());

  managementService.setJobRetries(timerJob.getId(), 5);

  timerJob = managementService.createJobQuery()
    .processInstanceId(processInstance.getId())
    .singleResult();
  assertEquals(5, timerJob.getRetries());
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:21,代码来源:ManagementServiceTest.java


示例7: testBpmnModelToXml

import org.activiti.engine.test.Deployment; //导入依赖的package包/类
/**
 * 把BpmnModel转换为XML对象
 * @throws Exception
 */
@Test
@Deployment(resources = "chapter6/dynamic-form/leave.bpmn")
public void testBpmnModelToXml() throws Exception {

    // 验证是否部署成功
    long count = repositoryService.createProcessDefinitionQuery().count();
    assertEquals(1, count);

    // 查询流程定义对象
    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("leave").singleResult();

    // 获取BpmnModel对象
    BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinition.getId());

    // 创建转换对象
    BpmnXMLConverter converter = new BpmnXMLConverter();

    // 把BpmnModel对象转换成字符(也可以输出到文件中)
    byte[] bytes = converter.convertToXML(bpmnModel);
    String xmlContent = new String(bytes);
    System.out.println(xmlContent);
}
 
开发者ID:barudisshu,项目名称:activiti-in-action-codes,代码行数:27,代码来源:BpmnModelTest.java


示例8: testTimerOnNestingOfSubprocesses

import org.activiti.engine.test.Deployment; //导入依赖的package包/类
@Deployment
public void testTimerOnNestingOfSubprocesses() {
  
  Date testStartTime = ClockUtil.getCurrentTime();
  
  runtimeService.startProcessInstanceByKey("timerOnNestedSubprocesses");
  List<Task> tasks = taskService.createTaskQuery().orderByTaskName().asc().list();
  assertEquals(2, tasks.size());
  assertEquals("Inner subprocess task 1", tasks.get(0).getName());
  assertEquals("Inner subprocess task 2", tasks.get(1).getName());
  
  // Timer will fire in 2 hours
  ClockUtil.setCurrentTime(new Date(testStartTime.getTime() + ((2 * 60 * 60 *1000) + 5000)));
  Job timer = managementService.createJobQuery().timers().singleResult();
  managementService.executeJob(timer.getId());
  
  Task task = taskService.createTaskQuery().singleResult();
  assertEquals("task outside subprocess", task.getName());
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:20,代码来源:BoundaryTimerEventTest.java


示例9: testParseHandler

import org.activiti.engine.test.Deployment; //导入依赖的package包/类
@Test
@Deployment(resources = "chapter6/dynamic-form/leave.bpmn")
public void testParseHandler() throws Exception {
    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
    assertEquals("请假流程-动态表单-被PRE解析器修改", processDefinition.getName());
    assertEquals("leave-modified-by-post-parse-handler", processDefinition.getKey());

    RepositoryServiceImpl repositoryServiceImpl = (RepositoryServiceImpl) repositoryService;
    ReadOnlyProcessDefinition deployedProcessDefinition = repositoryServiceImpl
            .getDeployedProcessDefinition(processDefinition.getId());

    ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) deployedProcessDefinition;
    List<ActivityImpl> activitiList = processDefinitionEntity.getActivities();//获得当前任务的所有节点
    for (ActivityImpl activity : activitiList) {
        System.out.println("Activity Name: " + activity.getProperty("name") + ", async=" + activity.isAsync());
    }

    InputStream processBpmn = activitiRule.getRepositoryService()
            .getResourceAsStream(processDefinition.getDeploymentId(), processDefinition.getResourceName());
    String userHomeDir = getClass().getResource("/").getFile();
    FileUtils.copyInputStreamToFile(processBpmn,
            new File(userHomeDir + "/leave.bpmn20.xml"));
}
 
开发者ID:barudisshu,项目名称:activiti-in-action-codes,代码行数:24,代码来源:BpmnParseHandlerTest.java


示例10: testSimpleTextMail

import org.activiti.engine.test.Deployment; //导入依赖的package包/类
@Deployment
public void testSimpleTextMail() throws Exception {
  String procId = runtimeService.startProcessInstanceByKey("simpleTextOnly").getId();
  
  List<WiserMessage> messages = wiser.getMessages();
  assertEquals(0, messages.size());
  
  waitForJobExecutorToProcessAllJobs(5000L, 25L);
  
  messages = wiser.getMessages();
  assertEquals(1, messages.size());
  
  WiserMessage message = messages.get(0);
  EmailServiceTaskTest.assertEmailSend(message, false, "Hello Kermit!", "This a text only e-mail.", "[email protected]",
          Arrays.asList("[email protected]"), null);
  assertProcessEnded(procId);
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:18,代码来源:AsyncEmailTaskTest.java


示例11: allPass

import org.activiti.engine.test.Deployment; //导入依赖的package包/类
@Test
@Deployment(resources = {"chapter6/leave-formkey/leave-formkey.bpmn", "chapter6/leave-formkey/leave-start.form"})
public void allPass() throws Exception {

    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();

    // 读取启动表单
    Object renderedStartForm = formService.getRenderedStartForm(processDefinition.getId(), "myformengine");

    // 验证表单对象
    assertNotNull(renderedStartForm);
    assertTrue(renderedStartForm instanceof javax.swing.JButton);
    javax.swing.JButton button = (JButton) renderedStartForm;
    assertEquals("My Start Form Button", button.getName());

}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:17,代码来源:MyFormEngineTest.java


示例12: testSimpleTextMailMultipleRecipients

import org.activiti.engine.test.Deployment; //导入依赖的package包/类
@Deployment
public void testSimpleTextMailMultipleRecipients() {
  runtimeService.startProcessInstanceByKey("simpleTextOnlyMultipleRecipients");
  
  // 3 recipients == 3 emails in wiser with different receivers
  List<WiserMessage> messages = wiser.getMessages();
  assertEquals(3, messages.size());
  
  // sort recipients for easy assertion
  List<String> recipients = new ArrayList<String>();
  for (WiserMessage message : messages) {
    recipients.add(message.getEnvelopeReceiver());
  }
  Collections.sort(recipients);
  
  assertEquals("[email protected]", recipients.get(0));
  assertEquals("[email protected]", recipients.get(1));
  assertEquals("[email protected]", recipients.get(2));
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:20,代码来源:EmailServiceTaskTest.java


示例13: testJavascriptFormType

import org.activiti.engine.test.Deployment; //导入依赖的package包/类
@Test
@Deployment(resources = "chapter6/dynamic-form/leave.bpmn")
public void testJavascriptFormType() throws Exception {

    // 验证是否部署成功
    long count = repositoryService.createProcessDefinitionQuery().count();
    assertEquals(1, count);

    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("leave").singleResult();
    StartFormData startFormData = formService.getStartFormData(processDefinition.getId());
    List<FormProperty> formProperties = startFormData.getFormProperties();
    for (FormProperty formProperty : formProperties) {
        System.out.println(formProperty.getId() + ",value=" + formProperty.getValue());
    }
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:16,代码来源:LeaveDynamicFormTest.java


示例14: testTaskDelegate

import org.activiti.engine.test.Deployment; //导入依赖的package包/类
/**
 * 学习任务委派的过程,任务分配给bill,然后bill把任务委派给henryyan,henryyan处理完成后任务回归到bill
 */
@Deployment(resources = "diagrams/chapter12/taskDelegate.bpmn")
public void testTaskDelegate() throws Exception {
    Map<String, Object> variables = new HashMap<String, Object>();
    String userId = "bill";
    variables.put("userId", userId);
    runtimeService.startProcessInstanceByKey("taskDelegateProcess", variables);
    Task task = taskService.createTaskQuery().taskAssignee(userId).singleResult();
    assertNotNull(task);
    assertNull(task.getOwner());

    // 委派任务给其他人
    String delegatedUserId = "henryyan";
    taskService.delegateTask(task.getId(), delegatedUserId);

    // 查看数据状态
    task = taskService.createTaskQuery().taskAssignee(delegatedUserId).taskDelegationState(DelegationState.PENDING).singleResult();
    assertEquals(task.getOwner(), userId);
    assertEquals(task.getAssignee(), delegatedUserId);

    // 被委派人处理完成任务
    taskService.resolveTask(task.getId());

    // 任务回归到委派人
    task = taskService.createTaskQuery().taskAssignee(userId).taskDelegationState(DelegationState.RESOLVED).singleResult();
    assertEquals(task.getOwner(), userId);
    assertEquals(task.getAssignee(), userId);

    // 委派人完成任务
    taskService.complete(task.getId());
    long count = historyService.createHistoricProcessInstanceQuery().finished().count();
    assertEquals(1, count);
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:36,代码来源:TaskDelegateTest.java


示例15: testDeleteProcessInstance

import org.activiti.engine.test.Deployment; //导入依赖的package包/类
@Deployment(resources={
  "org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml"})
public void testDeleteProcessInstance() {
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
  assertEquals(1, runtimeService.createProcessInstanceQuery().processDefinitionKey("oneTaskProcess").count());
  
  runtimeService.deleteProcessInstance(processInstance.getId(), "testing instance deletion");
  assertEquals(0, runtimeService.createProcessInstanceQuery().processDefinitionKey("oneTaskProcess").count());
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:10,代码来源:RuntimeServiceTest.java


示例16: testProcess

import org.activiti.engine.test.Deployment; //导入依赖的package包/类
@Deployment(resources={
  "org/activiti/examples/bpmn/usertask/FinancialReportProcess.bpmn20.xml"})
public void testProcess() {
  
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("financialReport");
  
  List<Task> tasks = taskService.createTaskQuery().taskCandidateUser("fozzie").list();
  assertEquals(1, tasks.size());
  Task task = tasks.get(0);
  assertEquals("Write monthly financial report", task.getName());
  
  taskService.claim(task.getId(), "fozzie");
  tasks = taskService
    .createTaskQuery()
    .taskAssignee("fozzie")
    .list();
  
  assertEquals(1, tasks.size());
  taskService.complete(task.getId());

  tasks = taskService.createTaskQuery().taskCandidateUser("fozzie").list();
  assertEquals(0, tasks.size());
  tasks = taskService.createTaskQuery().taskCandidateUser("kermit").list();
  assertEquals(1, tasks.size());
  assertEquals("Verify monthly financial report", tasks.get(0).getName());
  taskService.complete(tasks.get(0).getId());

  assertProcessEnded(processInstance.getId());
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:30,代码来源:FinancialReportProcessTest.java


示例17: testNoSequenceFlowSelected

import org.activiti.engine.test.Deployment; //导入依赖的package包/类
@Deployment
public void testNoSequenceFlowSelected() {
  try {
    runtimeService.startProcessInstanceByKey("exclusiveGwNoSeqFlowSelected", CollectionUtil.singletonMap("input", 4));
    fail();
  } catch (ActivitiException e) {
    assertTextPresent("No outgoing sequence flow of the exclusive gateway " + "'exclusiveGw' could be selected for continuing the process", e.getMessage());
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:10,代码来源:ExclusiveGatewayTest.java


示例18: testOne

import org.activiti.engine.test.Deployment; //导入依赖的package包/类
@Deployment(resources = "chapter15/webservice.bpmn")
public void testOne() {
    Map<String, Object> variableMap = new HashMap<String, Object>();
    variableMap.put("startDate", "2013-01-01 09:00");
    variableMap.put("endDate", "2013-01-05 09:00");
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("webservice", variableMap);
    Object responseValue = runtimeService.getVariable(processInstance.getProcessInstanceId(), "webserviceResponse");
    assertEquals(true, responseValue);
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:10,代码来源:WebserviceLeaveTest.java


示例19: testDeleteProcessInstanceHistoryCreated

import org.activiti.engine.test.Deployment; //导入依赖的package包/类
@Deployment(resources = {"org/activiti/engine/test/history/oneTaskProcess.bpmn20.xml"})
public void testDeleteProcessInstanceHistoryCreated() {
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
  assertNotNull(processInstance);
  
  // delete process instance should not delete the history
  runtimeService.deleteProcessInstance(processInstance.getId(), "cancel");
  HistoricProcessInstance historicProcessInstance = 
    historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstance.getId()).singleResult();
  assertNotNull(historicProcessInstance.getEndTime());
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:12,代码来源:HistoricProcessInstanceTest.java


示例20: testWebServiceInvocation

import org.activiti.engine.test.Deployment; //导入依赖的package包/类
@Deployment(resources = "chapter15/webservice.bpmn")
public void testWebServiceInvocation() throws Exception {
	assertEquals(-1, counter.getCount());

	processEngine.getRuntimeService().startProcessInstanceByKey("webservice");
	waitForJobExecutorToProcessAllJobs(10000L, 250L);

	assertEquals(0, counter.getCount());
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:10,代码来源:WebServiceTaskTest.java



注:本文中的org.activiti.engine.test.Deployment类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ParticleEffect类代码示例发布时间:2022-05-22
下一篇:
Java TransitionSystem类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap