Package org.hibernate.cache.jbc

Examples of org.hibernate.cache.jbc.JBossCacheRegionFactory


        assertNull("No region node", localCache.getRoot().getChild( regionFqn ));
    }
   
    public void testToMap() throws Exception {
        Configuration cfg = CacheTestUtil.buildConfiguration("test", SharedJBossCacheRegionFactory.class, true, true);
        JBossCacheRegionFactory regionFactory = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport());
       
        Region region = createRegion(regionFactory, "test/test", cfg.getProperties(), getCacheDataDescription());
       
        Map map = region.toMap();
        assertNotNull(map);
View Full Code Here


        Settings settings = cfg.buildSettings();
        Properties properties = cfg.getProperties();
       
        String factoryType = cfg.getProperty(Environment.CACHE_REGION_FACTORY);
        Class factoryClass = Thread.currentThread().getContextClassLoader().loadClass(factoryType);
        JBossCacheRegionFactory regionFactory = (JBossCacheRegionFactory) factoryClass.newInstance();
       
        regionFactory.start(settings, properties);
       
        return regionFactory;       
    }
View Full Code Here

    }
   
    public static JBossCacheRegionFactory startRegionFactory(Configuration cfg, CacheTestSupport testSupport)
            throws ClassNotFoundException, InstantiationException, IllegalAccessException {
   
        JBossCacheRegionFactory factory = startRegionFactory(cfg);
        testSupport.registerFactory(factory);
        return factory;
    }
View Full Code Here

        cfg.setProperty(getConfigResourceKey(), getConfigResourceLocation());
       
        Settings settings = cfg.buildSettings();
       
        Fqn<String> fqn = Fqn.fromString("/whatever");
        JBossCacheRegionFactory regionFactory = (JBossCacheRegionFactory) settings.getRegionFactory();
        regionFactory.start(settings, cfg.getProperties());
       
        // Make sure we clean up when done
        testSupport.registerFactory(regionFactory);
       
        Cache<Object, Object> treeCache = regionFactory.getCacheInstanceManager().getEntityCacheInstance();

        // Make sure this is an OPTIMISTIC cache
        assertEquals("Cache is OPTIMISTIC", "OPTIMISTIC", treeCache.getConfiguration().getNodeLockingSchemeString());
       
        Long long1 = new Long(1);
View Full Code Here

    protected void setUp() throws Exception {
        super.setUp();
       
        if (getEntityAccessStrategy() == null) {
            Configuration cfg = createConfiguration();
            JBossCacheRegionFactory rf  = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport());
            Cache localCache = rf.getCacheInstanceManager().getEntityCacheInstance();
            optimistic = localCache.getConfiguration().getNodeLockingScheme() == org.jboss.cache.config.Configuration.NodeLockingScheme.OPTIMISTIC;
           
            // Sleep a bit to avoid concurrent FLUSH problem
            avoidConcurrentFlush();
           
            EntityRegion localEntityRegion = rf.buildEntityRegion(REGION_NAME, cfg.getProperties(), null);
            setEntityRegionAccessStrategy(localEntityRegion.buildAccessStrategy(getAccessType()));
        }
    }
View Full Code Here

    protected void setUp() throws Exception {
        super.setUp();
       
        if (getCollectionAccessStrategy() == null) {
            Configuration cfg = createConfiguration();
            JBossCacheRegionFactory rf  = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport());
            Cache localCache = rf.getCacheInstanceManager().getEntityCacheInstance();
            optimistic = localCache.getConfiguration().getNodeLockingScheme() == org.jboss.cache.config.Configuration.NodeLockingScheme.OPTIMISTIC;
           
            // Sleep a bit to avoid concurrent FLUSH problem
            avoidConcurrentFlush();
           
            CollectionRegion localCollectionRegion = rf.buildCollectionRegion(REGION_NAME, cfg.getProperties(), null);
            setCollectionAccessStrategy(localCollectionRegion.buildAccessStrategy(getAccessType()));
        }
    }
View Full Code Here

        }
    }
   
    private Cache createCache() throws Exception {
        Configuration cfg = CacheTestUtil.buildConfiguration("test", MultiplexedJBossCacheRegionFactory.class, false, true);
        JBossCacheRegionFactory regionFactory = CacheTestUtil.startRegionFactory(cfg);
        CacheInstanceManager mgr = regionFactory.getCacheInstanceManager();
        return mgr.getTimestampsCacheInstance();
    }
View Full Code Here

    }
   
    private void putDoesNotBlockGetTest(String configName) throws Exception {
       
        Configuration cfg = createConfiguration(configName);
        JBossCacheRegionFactory regionFactory = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport());
       
        // Sleep a bit to avoid concurrent FLUSH problem
        avoidConcurrentFlush();

        final QueryResultsRegion region = regionFactory.buildQueryResultsRegion(getStandardRegionName(REGION_PREFIX), cfg.getProperties());
       
        region.put(KEY, VALUE1);
        assertEquals(VALUE1, region.get(KEY));

        final CountDownLatch readerLatch = new CountDownLatch(1);
View Full Code Here

    }
   
    private void getDoesNotBlockPutTest(String configName) throws Exception {
       
        Configuration cfg = createConfiguration(configName);
        JBossCacheRegionFactory regionFactory = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport());
       
        // Sleep a bit to avoid concurrent FLUSH problem
        avoidConcurrentFlush();
       
        final QueryResultsRegion region = regionFactory.buildQueryResultsRegion(getStandardRegionName(REGION_PREFIX), cfg.getProperties());
       
        region.put(KEY, VALUE1);
        assertEquals(VALUE1, region.get(KEY));
       
        final Fqn rootFqn = getRegionFqn(getStandardRegionName(REGION_PREFIX), REGION_PREFIX);
View Full Code Here

TOP

Related Classes of org.hibernate.cache.jbc.JBossCacheRegionFactory

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.