Package net.sf.ehcache

Examples of net.sf.ehcache.CacheManager


        // Now do some routes to let endpoints be initialized
        template.sendBody("direct:add1", "Hello World");
        template.sendBody("direct:add2", "Hello World");

        //Now should not be null
        CacheManager cacheManager = cmfRef.getCacheManager();
        assertNotNull("CacheManager initialized", cacheManager);

        Cache cache = cmfRef.getCacheManager().getCache("foo");

        // Is cache alive
View Full Code Here


                in.setHeader(CacheConstants.CACHE_KEY, "greeting");
                in.setBody("Hello World");
            }
        });

        CacheManager cm = cacheEndpoint.getCacheManagerFactory().getInstance();
        Cache cache = cm.getCache(cacheEndpoint.getConfig().getCacheName());
        Set<CacheEventListener> ehcacheEventListners = cache.getCacheEventNotificationService().getCacheEventListeners();
        List<CacheLoader> cacheLoaders = cache.getRegisteredCacheLoaders();
        CacheEventListenerRegistry configuredEventRegistry = cacheEndpoint.getConfig().getEventListenerRegistry();
        CacheLoaderRegistry configuredLoaderRegistry = cacheEndpoint.getConfig().getCacheLoaderRegistry();
View Full Code Here

{

    @Test
    public void testPutRetreive()
    {
        CacheManager cacheManager = CacheManager.getInstance();
        Ehcache ehcache = cacheManager.getEhcache( "testCache" );

        ehcache.put( new Element( "testKey", "testValue" ) );
        stats( ehcache );
        Assert.assertEquals( "testValue", ehcache.get( "testKey" ).getObjectValue() );
    }
View Full Code Here

    }

    @Test
    public void testSizing()
    {
        CacheManager cacheManager = CacheManager.getInstance();
        Ehcache ehcache = cacheManager.getEhcache( "testCache" );
        for ( int i = 0; i < 30000; i++ )
        {
            if ( ( i % 1000 ) == 0 )
            {
                System.out.println( "heatbeat " + i );
View Full Code Here

    @Test
    public void testOffHeapExceedMemory()
        throws IOException
    {
        CacheManager cacheManager = CacheManager.getInstance();
        Ehcache ehcache = cacheManager.getEhcache( "testCache" );
        Element element = null;
        try
        {
            for ( int i = 0; i < 3000000; i++ )
            {
View Full Code Here

public class EhCacheTest extends DirectMemoryOsgiTestSupport {

  @Test
  public void testPutRetreive() {
    Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
    CacheManager cacheManager = CacheManager.getInstance();
    Ehcache ehcache = cacheManager.getEhcache("testCache");

    ehcache.put(new Element("testKey", "testValue"));
    stats(ehcache);
    Assert.assertEquals("testValue", ehcache.get("testKey").getObjectValue());
  }
View Full Code Here

  }

  @Test
  public void testSizing() {
    Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
    CacheManager cacheManager = CacheManager.getInstance();
    Ehcache ehcache = cacheManager.getEhcache("testCache");
    for (int i = 0; i < 30000; i++) {
      if ((i % 1000) == 0) {
        System.out.println("heatbeat " + i);
        stats(ehcache);
      }
View Full Code Here

  @Test
  public void testOffHeapExceedMemory()
          throws IOException {
    Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
    CacheManager cacheManager = CacheManager.getInstance();
    Ehcache ehcache = cacheManager.getEhcache("testCache");
    Element element = null;
    try {
      for (int i = 0; i < 3000000; i++) {
        if ((i % 1000) == 0) {
          System.out.println("heatbeat 2 " + i);
View Full Code Here

            ConfigurationFactory.parseConfiguration(EHCacheUtil.class.getResource("/cxf-test-ehcache.xml"));
           
        assertNotNull(conf);
        conf.setName("testCache");
       
        CacheManager manager1 = EHCacheUtil.createCacheManager(conf);
        assertNotNull(manager1);
        CacheManager manager2 = EHCacheUtil.createCacheManager();
        assertNotNull(manager2);
       
        manager1.shutdown();
        assertEquals(Status.STATUS_SHUTDOWN, manager1.getStatus());
       
        assertEquals(Status.STATUS_ALIVE, manager2.getStatus());
       
        manager2.shutdown();
        assertEquals(Status.STATUS_SHUTDOWN, manager2.getStatus());
       
    }
View Full Code Here

public class EhCacheGaugesTest {
    private CacheManager mgr;

    @Before
    public void createManager() {
        mgr = new CacheManager();
    }
View Full Code Here

TOP

Related Classes of net.sf.ehcache.CacheManager

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.