Package org.apache.jcs.engine.behavior

Examples of org.apache.jcs.engine.behavior.ICacheElement


        ICacheElementSerialized element = new CacheElementSerialized( cacheName, key, elementSerializer
            .serialize( value ), attr );
        listener.handlePut( element );

        ICacheElement after = cacheMgr.getCache( cacheName ).get( key );

        assertNull( "Should not have a deserialized object since remove on put is true.", after );
    }
View Full Code Here


                int n = ran.nextInt( 4 );
                int kn = ran.nextInt( range );
                String key = "key" + kn;
                if ( n == 1 )
                {
                    ICacheElement element = new CacheElement( region, key, region + ":data" + i
                        + " junk asdfffffffadfasdfasf " + kn + ":" + n );
                    service.update( element );
                    if ( show )
                    {
                        p( "put " + key );
View Full Code Here

        RemoteCache remoteCache = new RemoteCache( cattr, service, listener );

        String cacheName = "testUpdate";

        // DO WORK
        ICacheElement element = new CacheElement( cacheName, "key", "value" );
        remoteCache.update( element );

        // VERIFY
        assertTrue( "The element should be in the serialized warapper.",
                    service.lastUpdate instanceof ICacheElementSerialized );
        ICacheElement result = SerializationConversionUtil
            .getDeSerializedCacheElement( (ICacheElementSerialized) service.lastUpdate, remoteCache
                .getElementSerializer() );
        assertEquals( "Wrong element updated.", element.getVal(), result.getVal() );
    }
View Full Code Here

        RemoteCache remoteCache = new RemoteCache( cattr, zombie, listener );

        String cacheName = "testUpdate";

        // DO WORK
        ICacheElement element = new CacheElement( cacheName, "key", "value" );
        remoteCache.update( element );
        // set the new service, this should call propogate
        remoteCache.fixCache( service );

        // VERIFY
        assertTrue( "The element should be in the serialized warapper.",
                    service.lastUpdate instanceof ICacheElementSerialized );
        ICacheElement result = SerializationConversionUtil
            .getDeSerializedCacheElement( (ICacheElementSerialized) service.lastUpdate, remoteCache
                .getElementSerializer() );
        assertEquals( "Wrong element updated.", element.getVal(), result.getVal() );
    }
View Full Code Here

        ZombieRemoteCacheService zombie = new ZombieRemoteCacheService( 10 );

        String cacheName = "testUpdate";

        // DO WORK
        ICacheElement element = new CacheElement( cacheName, "key", "value" );
        zombie.update( element, 123l );
        zombie.propagateEvents( service );

        // VERIFY
        assertEquals( "Updated element is not as expected.", element, service.lastUpdate );
View Full Code Here

        ZombieRemoteCacheService zombie = new ZombieRemoteCacheService( 0 );

        String cacheName = "testUpdate";

        // DO WORK
        ICacheElement element = new CacheElement( cacheName, "key", "value" );
        zombie.update( element, 123l );
        zombie.propagateEvents( service );

        // VERIFY
        assertNull( "Nothing should have been put to the service.", service.lastUpdate );
View Full Code Here

    {
        // SETUP
        RemoteCacheClientMockImpl client = new RemoteCacheClientMockImpl();
        RemoteCacheNoWait noWait = new RemoteCacheNoWait( client );

        ICacheElement element = new CacheElement( "testUpdate", "key", "value" );

        // DO WORK
        noWait.update( element );

        SleepUtil.sleepAtLeast( 10 );
View Full Code Here

    {
        // SETUP
        RemoteCacheClientMockImpl client = new RemoteCacheClientMockImpl();
        RemoteCacheNoWait noWait = new RemoteCacheNoWait( client );

        ICacheElement input = new CacheElement( "testUpdate", "key", "value" );
        client.getSetupMap.put( "key", input );

        // DO WORK
        ICacheElement result = noWait.get( "key" );

        // VERIFY
        assertEquals( "Wrong element", input, result );
    }
View Full Code Here

        client.status = CacheConstants.STATUS_ALIVE;
        RemoteCacheNoWait noWait = new RemoteCacheNoWait( client );

        RemoteCacheServiceMockImpl service = new RemoteCacheServiceMockImpl();

        ICacheElement element = new CacheElement( "testUpdate", "key", "value" );

        // DO WORK
        noWait.update( element );
        SleepUtil.sleepAtLeast( 10 );
        ICacheEventQueue originalQueue = noWait.getCacheEventQueue();
View Full Code Here

        if ( log.isDebugEnabled() )
        {
            log.debug( "The LateralCacheServlet has been called.\n" );
        }

        ICacheElement item = null;

        try
        {

            // Create the ObjectInputStream with
            // the Request InputStream.
            ObjectInputStream ois = new ObjectInputStream( request.getInputStream() );

            if ( log.isDebugEnabled() )
            {
                log.debug( "after getting input stream and before reading it" );
            }

            // READ POLLOBJ
            item = (ICacheElement) ois.readObject();
            ois.close();

        }
        catch ( Exception e )
        {
            log.error( e );
        }

        if ( item == null )
        {
            if ( log.isDebugEnabled() )
            {
                log.debug( "item is null in LateralCacheServlet" );
            }
        }
        else
        {
            String hashtableName = item.getCacheName();
            Serializable key = item.getKey();
            Serializable val = item.getVal();

            log.debug( "item read in = " + item );
            log.debug( "item.getKey = " + item.getKey() );

            CompositeCache cache = (CompositeCache) cacheMgr.getCache( hashtableName );
            try
            {
                // need to set as from lateral
View Full Code Here

TOP

Related Classes of org.apache.jcs.engine.behavior.ICacheElement

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.