Package com.volantis.cache.impl

Examples of com.volantis.cache.impl.CacheBuilderImpl


        //   Test Expectations
        // =====================================================================

        CacheableObjectProvider objectProvider = new TestCacheableObjectProvider();

        CacheBuilder builder = new CacheBuilderImpl();
        builder.setObjectProvider(objectProvider);
        builder.setMaxCount(8);
        Cache cache = builder.buildCache();

        GroupBuilder groupBuilder = new GroupBuilderImpl();
        groupBuilder.setMaxCount(4);
        Group root = cache.getRootGroup();
        root.addRemovalListener(listenerRootMock);
View Full Code Here


    /**
     * Ensure that an asynchronous update of the cache works correctly.
     */
    public void testAsyncUpdate() throws Exception {

        CacheBuilder builder = new CacheBuilderImpl();
        builder.setMaxCount(10);

        Cache cache = builder.buildCache();

        AsyncResult async = cache.asyncQuery("key", Period.inMilliSeconds(50));
        Object value;
        if (async.isReady()) {
            value = async.getValue();
View Full Code Here

    }

    public void testAsyncResultFinalize()
        throws Exception {

        CacheBuilder builder = new CacheBuilderImpl();
        builder.setMaxCount(10);

        Cache cache = builder.buildCache();
        Period period = Period.inMilliSeconds(5000);

        Runnable runnable = new FinalizeRunnable(cache, period);

        Thread[] threads = new Thread[2];
View Full Code Here

    /**
     * Ensure that max count must be set.
     */
    public void testMaxCountNotSet() throws Exception {

        CacheBuilder builder = new CacheBuilderImpl();
        try {
            builder.buildCache();
            fail("Did not detect maxCount was not set.");
        } catch (IllegalStateException expected) {
            assertEquals("maxCount must be set", expected.getMessage());
        }
    }
View Full Code Here

    /**
     * Ensure that max count cannot be set to an invalid value.
     */
    public void testMaxCountSetInvalid() throws Exception {

        CacheBuilder builder = new CacheBuilderImpl();
        try {
            builder.setMaxCount(-1);
            fail("Did not detect maxCount was not set.");
        } catch (IllegalArgumentException expected) {
            assertEquals("maxCount must be > 0 but is -1", expected.getMessage());
        }
    }
View Full Code Here

TOP

Related Classes of com.volantis.cache.impl.CacheBuilderImpl

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.