当前位置: 首页>>代码示例>>Java>>正文


Java TaskListener.EVENTNAME_DELETE属性代码示例

本文整理汇总了Java中org.camunda.bpm.engine.delegate.TaskListener.EVENTNAME_DELETE属性的典型用法代码示例。如果您正苦于以下问题:Java TaskListener.EVENTNAME_DELETE属性的具体用法?Java TaskListener.EVENTNAME_DELETE怎么用?Java TaskListener.EVENTNAME_DELETE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.camunda.bpm.engine.delegate.TaskListener的用法示例。


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

示例1: testDeleteTaskListenerByClass

@Test
public void testDeleteTaskListenerByClass() {
  // given:
  ExtensionElements extensionElements = addExtensionElements(humanTask);
  CamundaTaskListener taskListener = createElement(extensionElements, null, CamundaTaskListener.class);

  String className = "org.camunda.bpm.test.tasklistener.ABC";
  String event = TaskListener.EVENTNAME_DELETE;
  taskListener.setCamundaEvent(event);
  taskListener.setCamundaClass(className);

  // when
  CmmnActivity activity = handler.handleElement(planItem, context);

  // then
  assertEquals(0, activity.getListeners().size());

  HumanTaskActivityBehavior behavior = (HumanTaskActivityBehavior) activity.getActivityBehavior();
  TaskDefinition taskDefinition = behavior.getTaskDefinition();

  assertNotNull(taskDefinition);

  assertEquals(1, taskDefinition.getTaskListeners().size());

  List<TaskListener> createListeners = taskDefinition.getTaskListeners(event);
  assertEquals(1, createListeners.size());
  TaskListener listener = createListeners.get(0);

  assertTrue(listener instanceof ClassDelegateTaskListener);

  ClassDelegateTaskListener classDelegateListener = (ClassDelegateTaskListener) listener;
  assertEquals(className, classDelegateListener.getClassName());
  assertTrue(classDelegateListener.getFieldDeclarations().isEmpty());

}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:35,代码来源:HumanTaskPlanItemHandlerTest.java

示例2: testDeleteTaskListenerByDelegateExpression

@Test
public void testDeleteTaskListenerByDelegateExpression() {
  // given:
  ExtensionElements extensionElements = addExtensionElements(humanTask);
  CamundaTaskListener taskListener = createElement(extensionElements, null, CamundaTaskListener.class);

  String delegateExpression = "${myDelegateExpression}";
  String event = TaskListener.EVENTNAME_DELETE;
  taskListener.setCamundaEvent(event);
  taskListener.setCamundaDelegateExpression(delegateExpression);

  // when
  CmmnActivity activity = handler.handleElement(planItem, context);

  // then
  assertEquals(0, activity.getListeners().size());

  HumanTaskActivityBehavior behavior = (HumanTaskActivityBehavior) activity.getActivityBehavior();
  TaskDefinition taskDefinition = behavior.getTaskDefinition();

  assertNotNull(taskDefinition);

  assertEquals(1, taskDefinition.getTaskListeners().size());

  List<TaskListener> createListeners = taskDefinition.getTaskListeners(event);
  assertEquals(1, createListeners.size());
  TaskListener listener = createListeners.get(0);

  assertTrue(listener instanceof DelegateExpressionTaskListener);

  DelegateExpressionTaskListener delegateExpressionListener = (DelegateExpressionTaskListener) listener;
  assertEquals(delegateExpression, delegateExpressionListener.getExpressionText());
  assertTrue(delegateExpressionListener.getFieldDeclarations().isEmpty());

}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:35,代码来源:HumanTaskPlanItemHandlerTest.java

示例3: testDeleteTaskListenerByExpression

@Test
public void testDeleteTaskListenerByExpression() {
  // given:
  ExtensionElements extensionElements = addExtensionElements(humanTask);
  CamundaTaskListener taskListener = createElement(extensionElements, null, CamundaTaskListener.class);

  String expression = "${myExpression}";
  String event = TaskListener.EVENTNAME_DELETE;
  taskListener.setCamundaEvent(event);
  taskListener.setCamundaExpression(expression);

  // when
  CmmnActivity activity = handler.handleElement(planItem, context);

  // then
  assertEquals(0, activity.getListeners().size());

  HumanTaskActivityBehavior behavior = (HumanTaskActivityBehavior) activity.getActivityBehavior();
  TaskDefinition taskDefinition = behavior.getTaskDefinition();

  assertNotNull(taskDefinition);

  assertEquals(1, taskDefinition.getTaskListeners().size());

  List<TaskListener> createListeners = taskDefinition.getTaskListeners(event);
  assertEquals(1, createListeners.size());
  TaskListener listener = createListeners.get(0);

  assertTrue(listener instanceof ExpressionTaskListener);

  ExpressionTaskListener expressionListener = (ExpressionTaskListener) listener;
  assertEquals(expression, expressionListener.getExpressionText());

}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:34,代码来源:HumanTaskPlanItemHandlerTest.java


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