Package org.apache.jcs.engine.behavior

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


        TCPLateralCacheAttributes lac = new TCPLateralCacheAttributes();
        lac.setTransmissionType( LateralCacheAttributes.TCP );
        lac.setTcpServer( "localhost" + ":" + 8111 );
        lac.setTcpListenerPort( 8111 );

        ICompositeCacheManager cacheMgr = CompositeCacheManager.getInstance();

        // start the listener
        LateralTCPListener listener = (LateralTCPListener) LateralTCPListener.getInstance( lac, cacheMgr );

        // send to the listener
View Full Code Here


    public void testUpdate()
        throws Exception
    {
        IRemoteCacheAttributes irca = new RemoteCacheAttributes();
        irca.setRemoveUponRemotePut( false );
        ICompositeCacheManager cacheMgr = new CompositeCacheManagerMockImpl();
        RemoteCacheListener listener = new RemoteCacheListener( irca, cacheMgr );

        String cacheName = "testName";
        String key = "key";
        String value = "value fdsadf dsafdsa fdsaf dsafdsaf dsafdsaf dsaf dsaf dsaf dsafa dsaf dsaf dsafdsaf";
        IElementAttributes attr = new ElementAttributes();
        attr.setMaxLifeSeconds( 34 );

        IElementSerializer elementSerializer = new StandardSerializer();

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

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

        assertNotNull( "Should have a deserialized object.", after );
        assertEquals( "Values should be the same.", value, after.getVal() );
        assertEquals( "Attributes should be the same.", attr.getMaxLifeSeconds(), after
            .getElementAttributes().getMaxLifeSeconds() );
View Full Code Here

    public void testUpdate_RemoveOnPut()
        throws Exception
    {
        IRemoteCacheAttributes irca = new RemoteCacheAttributes();
        irca.setRemoveUponRemotePut( true );
        ICompositeCacheManager cacheMgr = new CompositeCacheManagerMockImpl();
        RemoteCacheListener listener = new RemoteCacheListener( irca, cacheMgr );

        String cacheName = "testName";
        String key = "key";
        String value = "value fdsadf dsafdsa fdsaf dsafdsaf dsafdsaf dsaf dsaf dsaf dsafa dsaf dsaf dsafdsaf";
        IElementAttributes attr = new ElementAttributes();
        attr.setMaxLifeSeconds( 34 );

        IElementSerializer elementSerializer = new StandardSerializer();

        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

        throws Exception
    {

        Thread.sleep( 100 );

        ICompositeCacheManager cacheMgr = new CompositeCacheManagerMockImpl();

        RemoteCacheAttributes rca = new RemoteCacheAttributes();
        rca.setRemoteHost( "localhost" );
        rca.setRemotePort( 1101 );
View Full Code Here

        // create the attributes for the service
        TCPLateralCacheAttributes lac = new TCPLateralCacheAttributes();
        lac.setTransmissionType( LateralCacheAttributes.TCP );
        lac.setTcpServer( "localhost" + ":" + 1111 );

        ICompositeCacheManager cacheMgr = CompositeCacheManager.getInstance();

        // create the service
        UDPDiscoveryService service = new UDPDiscoveryService( lac.getUdpDiscoveryAddr(), lac.getUdpDiscoveryPort(), lac.getTcpListenerPort(), cacheMgr );
        service.setTcpLateralCacheAttributes( lac );
View Full Code Here

TOP

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

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.