<commit_before>package org.activiti5.engine.test.api.event;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.activiti.engine.event.EventLogEntry;
import org.activiti.engine.impl.event.logger.EventLogger;
import org.activiti.engine.impl.event.logger.handler.Fields;
import org.activiti.engine.task.Task;
import org.activiti5.engine.impl.test.PluggableActivitiTestCase;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * @author <NAME>
 */
public class StandaloneDatabaseEventLoggerTest extends PluggableActivitiTestCase {
	
	protected EventLogger databaseEventLogger;
	
	protected ObjectMapper objectMapper = new ObjectMapper();

	@Override
	protected void setUp() throws Exception {
	  super.setUp();
	  
	  // Database event logger setup
	  databaseEventLogger = new EventLogger(processEngineConfiguration.getClock(), processEngineConfiguration.getObjectMapper());
	  runtimeService.addEventListener(databaseEventLogger);
	}
	
	@Override
	protected void tearDown() throws Exception {
		
		// Database event logger teardown
	  runtimeService.removeEventListener(databaseEventLogger);
		
	  super.tearDown();
	}
	
	public void testStandaloneTaskEvents() throws Exception {
		
		Task task = taskService.newTask();
		task.setAssignee("kermit");
		task.setTenantId("myTenant");
		taskService.saveTask(task);
		
		List<EventLogEntry> events = managementService.getEventLogEntries(null, null);
		assertEquals(2, events.size());
		assertEquals("TASK_CREATED", events.get(0).getType());
		assertEquals("TASK_ASSIGNED", events.get(1).getType());<commit_msg>Fix actviiti 5 compatibility test: order of events in v5 was actually not consistent for standalone tasks vs regular process tasks<commit_after>package org.activiti5.engine.test.api.event;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.activiti.engine.event.EventLogEntry;
import org.activiti.engine.impl.event.logger.EventLogger;
import org.activiti.engine.impl.event.logger.handler.Fields;
import org.activiti.engine.task.Task;
import org.activiti5.engine.impl.test.PluggableActivitiTestCase;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * @author <NAME>
 */
public class StandaloneDatabaseEventLoggerTest extends PluggableActivitiTestCase {
	
	protected EventLogger databaseEventLogger;
	
	protected ObjectMapper objectMapper = new ObjectMapper();

	@Override
	protected void setUp() throws Exception {
	  super.setUp();
	  
	  // Database event logger setup
	  databaseEventLogger = new EventLogger(processEngineConfiguration.getClock(), processEngineConfiguration.getObjectMapper());
	  runtimeService.addEventListener(databaseEventLogger);
	}
	
	@Override
	protected void tearDown() throws Exception {
		
		// Database event logger teardown
	  runtimeService.removeEventListener(databaseEventLogger);
		
	  super.tearDown();
	}
	
	public void testStandaloneTaskEvents() throws Exception {
		
		Task task = taskService.newTask();
		task.setAssignee("kermit");
		task.setTenantId("myTenant");
		taskService.saveTask(task);
		
		List<EventLogEntry> events = managementService.getEventLogEntries(null, null);
		assertEquals(2, events.size());
		assertEquals("TASK_ASSIGNED", events.get(0).getType());
		assertEquals("TASK_CREATED", events.get(1).getType());
{'fraction_non_alphanumeric': 0.10524772793902082, 'fraction_numerical': 0.003518029903254178, 'mean_word_length': 5.703339882121807, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7326828', 'n_tokens_mistral': 1033, 'n_tokens_neox': 944, 'n_words': 191}