Package org.castor.cache

Examples of org.castor.cache.Cache


        Cache c = new EHCache();
        assertTrue(c instanceof EHCache);
    }

    public void testGetType() throws Exception {
        Cache c = new EHCache();
        assertEquals("ehcache", c.getType());
    }
View Full Code Here


    }

    public void testGetCache() {
        CacheFactory cf = new UnlimitedFactory();
        try {
            Cache c = cf.getCache(null);
            assertTrue(c instanceof Unlimited);
        } catch (CacheAcquireException ex) {
            fail("Failed to get instance of Unlimited from factroy");
        }
    }
View Full Code Here

       
        logger.setLevel(level);
    }

    public void testClose() throws Exception {
        Cache c = new EHCache();
        int counter = DistributedCacheMock.getCounter();
       
        c.close();
        assertEquals(counter, DistributedCacheMock.getCounter());
    }
View Full Code Here

    }

    public void testGetCache() {
        CacheFactory cf = new JcsCacheFactory();
        try {
            Cache c = cf.getCache(null);
            assertTrue(c instanceof JcsCache);
        } catch (CacheAcquireException ex) {
            fail("Failed to get instance of JcsCache from factroy");
        }
    }
View Full Code Here

        assertFalse(cache.containsValue("fourth value"));
        assertFalse(cache.containsValue("fifth value"));
    }

    public void testClear() {
        Cache cache = initialize();

        cache.clear();

        assertFalse(cache.containsKey("first key"));
        assertFalse(cache.containsKey("second key"));
        assertFalse(cache.containsKey("third key"));
        assertFalse(cache.containsKey("fourth key"));
        assertFalse(cache.containsKey("fifth key"));
    }
View Full Code Here

    }

    public void testGetCache() {
        CacheFactory cf = new FKCacheFactory();
        try {
            Cache c = cf.getCache(null);
            assertTrue(c instanceof FKCache);
        } catch (CacheAcquireException ex) {
            fail("Failed to get instance of FKCache from factroy");
        }
    }
View Full Code Here

        assertFalse(cache.containsKey("fourth key"));
        assertFalse(cache.containsKey("fifth key"));
    }

    public void testSize() {
        Cache cache = initialize();

        assertEquals(3, cache.size());
        cache.clear();
        assertEquals(0, cache.size());
    }
View Full Code Here

        cache.clear();
        assertEquals(0, cache.size());
    }

    public void testIsEmpty() {
        Cache cache = initialize();

        assertFalse(cache.isEmpty());
        cache.clear();
        assertTrue(cache.isEmpty());
    }
View Full Code Here

        cache.clear();
        assertTrue(cache.isEmpty());
    }

    public void testGet() {
        Cache cache = initialize();

        assertEquals("first value", cache.get("first key"));
        assertEquals("second value", cache.get("second key"));
        assertEquals("third value", cache.get("third key"));
        assertNull(cache.get("fourth key"));
        assertNull(cache.get("fifth key"));
    }
View Full Code Here

        assertNull(cache.get("fourth key"));
        assertNull(cache.get("fifth key"));
    }

    public void testPut() {
        Cache cache = initialize();

        assertEquals("third value", cache.put("third key", "alternate third value"));
        assertNull(cache.put("fourth key", "forth value"));

        assertTrue(cache.containsKey("first key"));
        assertTrue(cache.containsKey("second key"));
        assertTrue(cache.containsKey("third key"));
        assertTrue(cache.containsKey("fourth key"));
        assertFalse(cache.containsKey("fifth key"));
    }
View Full Code Here

TOP

Related Classes of org.castor.cache.Cache

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.