Examples of ErrorThrowingEventListener


Examples of org.activiti.engine.impl.bpmn.helper.ErrorThrowingEventListener

*/
public class ErrorThrowingEventListenerTest extends PluggableActivitiTestCase {

  @Deployment
  public void testThrowError() throws Exception {
    ErrorThrowingEventListener listener = null;
    try {
      listener = new ErrorThrowingEventListener();
     
      processEngineConfiguration.getEventDispatcher().addEventListener(listener, ActivitiEventType.TASK_ASSIGNED);
     
      ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testError");
      assertNotNull(processInstance);
View Full Code Here

Examples of org.activiti.engine.impl.bpmn.helper.ErrorThrowingEventListener

    assertNotNull(task);
  }
 
  @Deployment
  public void testThrowErrorWithErrorcode() throws Exception {
    ErrorThrowingEventListener listener = null;
    try {
      listener = new ErrorThrowingEventListener();
      listener.setErrorCode("123");
     
      processEngineConfiguration.getEventDispatcher().addEventListener(listener, ActivitiEventType.TASK_ASSIGNED);
     
      ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testError");
      assertNotNull(processInstance);
     
      // Fetch the task and assign it. Should cause error-event to be dispatched
      Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId())
          .taskDefinitionKey("userTask")
          .singleResult();
      assertNotNull(task);
      taskService.setAssignee(task.getId(), "kermit");
 
      // Error-handling should have been called, and "escalate" task should be available instead of original one
      task = taskService.createTaskQuery().processInstanceId(processInstance.getId())
          .taskDefinitionKey("escalatedTask")
          .singleResult();
      assertNotNull(task);
     
      // Try with a different error-code, resulting in a different task being created
      listener.setErrorCode("456");
     
      processInstance = runtimeService.startProcessInstanceByKey("testError");
      assertNotNull(processInstance);
     
      // Fetch the task and assign it. Should cause error-event to be dispatched
View Full Code Here

Examples of org.activiti.engine.impl.bpmn.helper.ErrorThrowingEventListener

      ((SignalThrowingEventListener) result).setProcessInstanceScope(false);
    } else if (ImplementationType.IMPLEMENTATION_TYPE_THROW_MESSAGE_EVENT.equals(eventListener.getImplementationType())) {
      result = new MessageThrowingEventListener();
      ((MessageThrowingEventListener) result).setMessageName(eventListener.getImplementation());
    } else if (ImplementationType.IMPLEMENTATION_TYPE_THROW_ERROR_EVENT.equals(eventListener.getImplementationType())) {
      result = new ErrorThrowingEventListener();
      ((ErrorThrowingEventListener) result).setErrorCode(eventListener.getImplementation());
    }

    if (result == null) {
      throw new ActivitiIllegalArgumentException("Cannot create an event-throwing event-listener, unknown implementation type: "
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.