<commit_before>
package com.ecyrd.jspwiki;

import junit.framework.*;
import java.util.*;
import java.io.*;

/**
 *  @author <NAME>.
 */
public class ReferenceManagerTest extends TestCase
{
    Properties props = new Properties();
    TestEngine engine;
    ReferenceManager mgr;
    
    public ReferenceManagerTest( String s )
    {
        super( s );
    }

    public void setUp()
        throws Exception
    {
        props.load( TestEngine.findTestProperties() );
        props.setProperty( "jspwiki.translatorReader.matchEnglishPlurals", "true");

        //
        //  We must make sure that the reference manager cache is cleaned first.
        //
        String workDir = props.getProperty( "jspwiki.workDir" );

        if( workDir != null )
        {
            File refmgrfile = new File( workDir, "refmgr.ser" );
            if( refmgrfile.exists() ) refmgrfile.delete();
        }

        engine = new TestEngine(props);

        engine.saveText( "TestPage", "Reference to [Foobar]." );
        engine.saveText( "Foobar", "Reference to [Foobar2], [Foobars], [Foobar]" );

        mgr = engine.getReferenceManager();
    }

    public void tearDown()
        throws Exception<commit_msg>Fixed; some other test was leaving files lying around.<commit_after>
package com.ecyrd.jspwiki;

import junit.framework.*;
import java.util.*;
import java.io.*;

import com.ecyrd.jspwiki.providers.FileSystemProvider;

/**
 *  @author <NAME>.
 */
public class ReferenceManagerTest extends TestCase
{
    Properties props = new Properties();
    TestEngine engine;
    ReferenceManager mgr;
    
    public ReferenceManagerTest( String s )
    {
        super( s );
    }

    public void setUp()
        throws Exception
    {
        props.load( TestEngine.findTestProperties() );
        props.setProperty( "jspwiki.translatorReader.matchEnglishPlurals", "true");

        //
        //  We must make sure that the reference manager cache is cleaned first.
        //
        String workDir = props.getProperty( "jspwiki.workDir" );

        if( workDir != null )
        {
            File refmgrfile = new File( workDir, "refmgr.ser" );
            if( refmgrfile.exists() ) refmgrfile.delete();
        }

        String fileDir = props.getProperty( FileSystemProvider.PROP_PAGEDIR );
        
        if( fileDir != null )
        {
            TestEngine.deleteAll( new File(fileDir) );
        }
        
        engine = new TestEngine(props);

        engine.saveText( "TestPage", "Reference to [Foobar]." );
        engine.saveText( "Foobar", "Reference to [Foobar2], [Foobars], [Foobar]" );

        mgr = engine.getReferenceManager();
    }

    public void tearDown()
        throws Exception
{'fraction_non_alphanumeric': 0.11398008115086684, 'fraction_numerical': 0.0007377351530800443, 'mean_word_length': 2.3194614443084456, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6404', 'n_tokens_mistral': 792, 'n_tokens_neox': 766, 'n_words': 199}