AsyncTaskLifeCycleEventProducer extends PersistableEventListener implements TaskLifeCycleEventListener { @Override public void beforeTaskReleasedEvent(TaskEvent event) { String userId = event.getTaskContext().getUserId(); Task ti = event.getTask(); TaskEventImpl taskEvent = new TaskEventImpl(ti.getId(), org.kie.internal.task.api.model.TaskEvent.TaskEventType.RELEASED, ti.getTaskData().getProcessInstanceId(), ti.getTaskData().getWorkItemId(), userId); sendMessage(new AuditTaskData(null, taskEvent), 7); } AsyncTaskLifeCycleEventProducer(); ConnectionFactory getConnectionFactory(); void setConnectionFactory(ConnectionFactory connectionFactory); Queue getQueue(); void setQueue(Queue queue); boolean isTransacted(); void setTransacted(boolean transacted); @Override void afterTaskStartedEvent(TaskEvent event); @Override void afterTaskActivatedEvent(TaskEvent event); @Override void afterTaskClaimedEvent(TaskEvent event); @Override void afterTaskSkippedEvent(TaskEvent event); @Override void afterTaskStoppedEvent(TaskEvent event); @Override void afterTaskCompletedEvent(TaskEvent event); @Override void afterTaskFailedEvent(TaskEvent event); @Override void afterTaskAddedEvent(TaskEvent event); @Override void afterTaskExitedEvent(TaskEvent event); @Override void afterTaskReleasedEvent(TaskEvent event); @Override void afterTaskResumedEvent(TaskEvent event); @Override void afterTaskSuspendedEvent(TaskEvent event); @Override void afterTaskForwardedEvent(TaskEvent event); @Override void afterTaskDelegatedEvent(TaskEvent event); @Override void afterTaskNominatedEvent(TaskEvent event); @Override void beforeTaskReleasedEvent(TaskEvent event); @Override void afterTaskUpdatedEvent(TaskEvent event); @Override void afterTaskReassignedEvent(TaskEvent event); @Override void afterTaskOutputVariableChangedEvent(TaskEvent event, Map<String, Object> variables); @Override void afterTaskInputVariableChangedEvent(TaskEvent event, Map<String, Object> variables); @Override void afterTaskAssignmentsAddedEvent(TaskEvent event, AssignmentType type, List<OrganizationalEntity> entities); @Override void afterTaskAssignmentsRemovedEvent(TaskEvent event, AssignmentType type, List<OrganizationalEntity> entities); @Override void beforeTaskActivatedEvent(TaskEvent event); @Override void beforeTaskClaimedEvent(TaskEvent event); @Override void beforeTaskSkippedEvent(TaskEvent event); @Override void beforeTaskStartedEvent(TaskEvent event); @Override void beforeTaskStoppedEvent(TaskEvent event); @Override void beforeTaskCompletedEvent(TaskEvent event); @Override void beforeTaskFailedEvent(TaskEvent event); @Override void beforeTaskAddedEvent(TaskEvent event); @Override void beforeTaskExitedEvent(TaskEvent event); @Override void beforeTaskResumedEvent(TaskEvent event); @Override void beforeTaskSuspendedEvent(TaskEvent event); @Override void beforeTaskForwardedEvent(TaskEvent event); @Override void beforeTaskDelegatedEvent(TaskEvent event); @Override void beforeTaskNominatedEvent(TaskEvent event); @Override void beforeTaskUpdatedEvent(TaskEvent event); @Override void beforeTaskReassignedEvent(TaskEvent event); @Override void beforeTaskNotificationEvent(TaskEvent event); @Override void afterTaskNotificationEvent(TaskEvent event); @Override boolean equals(Object obj); @Override int hashCode();  }
@Test public void testBeforeTaskReleasedEvent() throws JMSException { logProducer.beforeTaskReleasedEvent(event); ArgumentCaptor<String> argument = ArgumentCaptor.forClass(String.class); verify(session).createTextMessage(argument.capture()); String messageContent = argument.getValue(); assertThat(messageContent) .isNotNull() .doesNotContain("<auditTask>") .contains("<org.jbpm.services.task.audit.impl.model.TaskEventImpl>") .contains("<type>RELEASED</type>"); verify(message, times(1)).setStringProperty(eq("LogType"), eq("Task")); verify(producer, times(1)).setPriority(eq(7)); verify(producer, times(1)).send(eq(message)); }