Package org.apache.stratum.jcs

Examples of org.apache.stratum.jcs.JCS


        junit.textui.TestRunner.main( testCaseName );
    }

    public void testJCS() throws Exception
    {
        JCS jcs = JCS.getInstance( "testCache1" );
       
        LinkedList list = buildList();
       
        jcs.put( "some:key", list );
       
        assertEquals( list, jcs.get( "some:key" ) );
    }
View Full Code Here


     * @exception Exception If an error occurs
     */
    public void runTestForRegion( String region )
        throws Exception
    {
        JCS jcs = JCS.getInstance( region );

        // Add items to cache
       
        for ( int i = 0; i <= items; i++ )
        {
            jcs.put( i + ":key", region + " data " + i );
        }
       
        // Test that all items are in cache

        for ( int i = 0; i <= items; i++ )
        {
            String value = ( String ) jcs.get( i + ":key" );

            this.assertEquals( region + " data " + i , value );
        }

        // Remove all the items

        for ( int i = 0; i <= items; i++ )
        {
            jcs.destroy( i + ":key" );
        }
       
        // Verify removal
       
        for ( int i = 0; i <= items; i++ )
        {
            assertNull( jcs.get( i + ":key" ) );
        }
    }
View Full Code Here

     *@exception  Exception  Description of the Exception
     */
    public void testSimpleLoad()
        throws Exception
    {
        JCS jcs = JCS.getInstance( "testCache1" );
//        ICompositeCacheAttributes cattr = jcs.getCacheAttributes();
//        cattr.setMaxObjects( 20002 );
//        jcs.setCacheAttributes( cattr );

        for ( int i = 0; i <= items; i++ )
        {
            jcs.put( i + ":key", "data" + i );
        }

        for ( int i = items; i >= items; i-- )
        {
            String res = ( String ) jcs.get( i + ":key" );
            if ( res == null )
            {
                this.assertNotNull( "[" + i + ":key] should not be null", res );
            }
        }

        // test removal
        jcs.destroy( "300:key" );
        assertNull( jcs.get( "300:key" ) );

    }
View Full Code Here

TOP

Related Classes of org.apache.stratum.jcs.JCS

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.