<commit_before>package org.apache.jcs.auxiliary.javagroups;

import org.apache.jcs.engine.control.CompositeCacheManager;
import org.apache.jcs.access.CacheAccess;
import org.javagroups.log.Tracer;
import org.javagroups.log.Trace;

import java.util.Properties;
import java.io.IOException;

import junit.framework.TestCase;

public class JavaGroupsCacheTest extends TestCase
{
    public JavaGroupsCacheTest( String testName )
    {
        super( testName );
    }

    public void testStuff() throws Exception
    {
        // Create and configure two managers for the same channel

        CompositeCacheManager manager1 = new CompositeCacheManager();

        manager1.configure( getProperties() );

        CompositeCacheManager manager2 = new CompositeCacheManager();

        manager2.configure( getProperties() );

        // Get two the same region in each of the managers

        CacheAccess one = new CacheAccess( manager1.getCache( "testCache" ) );
        CacheAccess two = new CacheAccess( manager2.getCache( "testCache" ) );

        // Put some items to one of the mangers

        one.put( "1", "one" );
        one.put( "2", "two" );
        one.put( "3", "three" );
        one.put( "4", "four" );
        one.put( "5", "five" );

        // Wait for it to propogate -- FIXME: This is time sensitive and thus
        //                                    a bad idea for a unit test.

        Thread.sleep( 1000 );

        // Assert that the values were correctly propogated

        assertEquals( "one",   two.get( "1" ) );
        assertEquals( "two",   two.get( "2" ) );
        assertEquals( "three", two.get( "3" ) );
        assertEquals( "four",  two.get( "4" ) );
        assertEquals( "five",  two.get( "5" ) );

        // Free caches

        manager1.freeCache( "testCache" );
        manager2.freeCache( "testCache" );
    }

    private Properties getProperties() throws IOException
    {
        Properties props = new Properties();

        props.load( getClass().getResourceAsStream(
            "/org/apache/jcs/auxiliary/javagroups/JavaGroupsCacheTest.ccf" ) );

        return props;
    }
}<commit_msg>Now remove and removeAll as well as update.<commit_after>package org.apache.jcs.auxiliary.javagroups;

import org.apache.jcs.engine.control.CompositeCacheManager;
import org.apache.jcs.access.CacheAccess;
import org.javagroups.log.Tracer;
import org.javagroups.log.Trace;

import java.util.Properties;
import java.io.IOException;

import junit.framework.TestCase;

public class JavaGroupsCacheTest extends TestCase
{
    public JavaGroupsCacheTest( String testName )
    {
        super( testName );
    }

    public void testStuff() throws Exception
    {
        // Create and configure two managers for the same channel

        CompositeCacheManager manager1 = new CompositeCacheManager();

        manager1.configure( getProperties() );

        CompositeCacheManager manager2 = new CompositeCacheManager();

        manager2.configure( getProperties() );

        // Get two the same region in each of the managers

        CacheAccess one = new CacheAccess( manager1.getCache( "testCache" ) );
        CacheAccess two = new CacheAccess( manager2.getCache( "testCache" ) );

        // Put some items to one of the mangers

        one.put( "1", "one" );
        one.put( "2", "two" );
        one.put( "3", "three" );
        one.put( "4", "four" );
        one.put( "5", "five" );

        // Wait for it to propogate -- FIXME: This is time sensitive and thus
        //                                    a bad idea for a unit test.

        Thread.sleep( 1000 );

        // Assert that the values were correctly propogated

        assertEquals( "one",   two.get( "1" ) );
        assertEquals( "two",   two.get( "2" ) );
        assertEquals( "three", two.get( "3" ) );
        assertEquals( "four",  two.get( "4" ) );
        assertEquals( "five",  two.get( "5" ) );

        // Remove a value

        one.remove( "2" );

        Thread.sleep( 1000 );

        assertEquals( null, two.get( "2") );

        // Remove all values

        one.remove();

        Thread.sleep( 1000 );

        assertEquals( null, two.get( "1" ) );
        assertEquals( null, two.get( "2" ) );
        assertEquals( null, two.get( "3" ) );
        assertEquals( null, two.get( "4" ) );
        assertEquals( null, two.get( "5" ) );

        // Free caches

        manager1.freeCache( "testCache" );
        manager2.freeCache( "testCache" );
    }

    private Properties getProperties() throws IOException
    {
        Properties props = new Properties();

        props.load( getClass().getResourceAsStream(
            "/org/apache/jcs/auxiliary/javagroups/JavaGroupsCacheTest.ccf" ) );

        return props;
    }
}
{'fraction_non_alphanumeric': 0.1204034461021223, 'fraction_numerical': 0.012397562513133011, 'mean_word_length': 2.2918395573997232, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1798825', 'n_tokens_mistral': 1402, 'n_tokens_neox': 1348, 'n_words': 376}