Package org.apache.directmemory.cache

Examples of org.apache.directmemory.cache.CacheService


    @Test
    public void testCacheService()
    {
        String key = "2";
        String obj = "Simple String Object";
        CacheService cacheService = getOsgiService( CacheService.class );

        //Test retrieving an object added by an other bundle.
        Object result = cacheService.retrieve( "1" );
        assertNotNull( result );

        cacheService.scheduleDisposalEvery( Every.seconds( 1 ) );
        cacheService.dump();
        Monitor.dump( "cache" );

        Pointer p = cacheService.put( "2", obj );
        result = cacheService.retrieve( "2" );
        cacheService.dump();
        assertEquals( obj, result );
    }
View Full Code Here


    public void testCacheServiceWithImportedObject()
    {
        SimpleObject obj1 = new SimpleObject( "2", "Object Two" );
        SimpleObject obj2 = new SimpleObject( "3", "Object Three" );

        CacheService cacheService = getOsgiService( CacheService.class );
        cacheService.scheduleDisposalEvery( Every.seconds( 1 ) );
        cacheService.dump();

        Pointer p1 = cacheService.put( "2", obj1 );
        Pointer p2 = cacheService.put( "3", obj2 );
        Object result1 = cacheService.retrieve( "2" );
        Object result2 = cacheService.retrieve( "3" );

        cacheService.dump();
        Monitor.dump( "cache" );

        assertEquals( obj1, result1 );
        assertEquals( obj2, result2 );
    }
View Full Code Here

    @Test
    public void testCacheService()
    {
        String key = "2";
        String obj = "Simple String Object";
        CacheService cacheService = getOsgiService( CacheService.class );

        //Test retrieving an object added by an other bundle.
        Object result = cacheService.retrieve( "1" );
        assertNotNull( result );

        cacheService.scheduleDisposalEvery( Every.seconds( 1 ) );
        cacheService.dump();
        Monitor.dump( "cache" );

        Pointer p = cacheService.put( "2", obj );
        result = cacheService.retrieve( "2" );
        cacheService.dump();
        assertEquals( obj, result );
    }
View Full Code Here

    public void testCacheServiceWithImportedObject()
    {
        SimpleObject obj1 = new SimpleObject( "2", "Object Two" );
        SimpleObject obj2 = new SimpleObject( "3", "Object Three" );

        CacheService cacheService = getOsgiService( CacheService.class );
        cacheService.scheduleDisposalEvery( Every.seconds( 1 ) );
        cacheService.dump();

        Pointer p1 = cacheService.put( "2", obj1 );
        Pointer p2 = cacheService.put( "3", obj2 );
        Object result1 = cacheService.retrieve( "2" );
        Object result2 = cacheService.retrieve( "3" );

        cacheService.dump();
        Monitor.dump( "cache" );

        assertEquals( obj1, result1 );
        assertEquals( obj2, result2 );
    }
View Full Code Here

TOP

Related Classes of org.apache.directmemory.cache.CacheService

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.