<commit_before>package ch.elexis.data;

import static org.junit.Assert.fail;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.junit.Test;

import ch.rgw.tools.JdbcLink;
import ch.rgw.tools.JdbcLink.Stm;

public class Test_Trace extends AbstractPersistentObjectTest {
	
	public Test_Trace(JdbcLink link){
		super(link);
	}
	
	@Test
	public void testAddTraceEntry() throws SQLException{
		Trace.addTraceEntry("testUser", "testWorkstation", "testAction");
		
		Stm statement = link.getStatement();
		ResultSet rs = statement
			.query("SELECT * FROM " + Trace.TABLENAME);
		while(rs.next()) {
			String string = rs.getString("ACTION");
			if("testAction".equals(string)) {
				link.releaseStatement(statement);
				return;
			}
		}<commit_msg>[20762] fixed create trace entries test<commit_after>package ch.elexis.data;

import static org.junit.Assert.fail;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.junit.Test;

import ch.rgw.tools.JdbcLink;
import ch.rgw.tools.JdbcLink.Stm;

public class Test_Trace extends AbstractPersistentObjectTest {
	
	public Test_Trace(JdbcLink link){
		super(link);
	}
	
	@Test
	public void testAddTraceEntry() throws SQLException, InterruptedException{
		Trace.addTraceEntry("testUser", "testWorkstation", "testAction");
		// trace is written async
		Thread.sleep(10);
		
		Stm statement = link.getStatement();
		ResultSet rs = statement
			.query("SELECT * FROM " + Trace.TABLENAME);
		while(rs.next()) {
			String string = rs.getString("ACTION");
			if("testAction".equals(string)) {
				link.releaseStatement(statement);
				return;
			}
		}
{'fraction_non_alphanumeric': 0.12299134734239803, 'fraction_numerical': 0.004326328800988875, 'mean_word_length': 4.621527777777778, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '981904', 'n_tokens_mistral': 576, 'n_tokens_neox': 511, 'n_words': 109}