Package org.shiftone.cache.decorator.cluster

Source Code of org.shiftone.cache.decorator.cluster.ClusterTestCase

package org.shiftone.cache.decorator.cluster;



import junit.framework.TestCase;
import org.shiftone.cache.Cache;
import org.shiftone.cache.CacheConfiguration;
import org.shiftone.cache.CacheFactory;
import org.shiftone.cache.util.Log;


/**
* @version $Revision: 1.4 $
* @author <a href="mailto:jeff@shiftone.org">Jeff Drost</a>
*/
public class ClusterTestCase extends TestCase
{

    private static final Log LOG = new Log(ClusterTestCase.class);

    public void testCluster() throws Exception
    {

        CacheConfiguration config   = new CacheConfiguration();
        CacheFactory       factoryA = config.getCacheFactory("clusterA");
        CacheFactory       factoryB = config.getCacheFactory("clusterB");
        Cache              oneA     = factoryA.newInstance("one", 1000, 1000);
        Cache              oneB     = factoryB.newInstance("one", 1000, 1000);

        for (int i = 0; i < 1000; i++)
        {
            oneA.addObject("key" + i, "value");
            oneB.addObject("key" + i, "value");
        }

        for (int i = 0; i < 1000; i++)
        {
            oneA.remove("key" + i);
        }

        LOG.info("sleeping...");
        Thread.sleep(2000);
    }
}
TOP

Related Classes of org.shiftone.cache.decorator.cluster.ClusterTestCase

TOP
Copyright © 2018 www.massapi.com. 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.