Package org.hibernate.cache.jbc2.collection

Examples of org.hibernate.cache.jbc2.collection.TransactionalAccess


    }
   
    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


        Fqn regionFqn = getRegionFqn("test/test", "test");
       
        assertNull("No region node", remoteCache.getRoot().getChild( regionFqn ));
       
        Configuration cfg = CacheTestUtil.buildConfiguration("test", SharedJBossCacheRegionFactory.class, true, true);
        JBossCacheRegionFactory regionFactory = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport());
       
        Region region = createRegion(regionFactory, "test/test", cfg.getProperties(), getCacheDataDescription());
       
        Cache localCache = getJBossCache( regionFactory );
       
View Full Code Here

        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

        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

        }
    }
   
    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 evictOrRemoveTest(String configName) throws Exception {
   
        Configuration cfg = createConfiguration(configName);
        JBossCacheRegionFactory regionFactory = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport());
        Cache localCache = getJBossCache(regionFactory);
        boolean invalidation = CacheHelper.isClusteredInvalidation(localCache);
       
        // Sleep a bit to avoid concurrent FLUSH problem
        avoidConcurrentFlush();
View Full Code Here

    }

    private void evictOrRemoveAllTest(String configName) throws Exception {
   
        Configuration cfg = createConfiguration(configName);
        JBossCacheRegionFactory regionFactory = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport());
        Cache localCache = getJBossCache(regionFactory);
        boolean optimistic = "OPTIMISTIC".equals(localCache.getConfiguration().getNodeLockingSchemeString());
        boolean invalidation = CacheHelper.isClusteredInvalidation(localCache);
       
        // Sleep a bit to avoid concurrent FLUSH problem
View Full Code Here

    protected abstract Class getRegionFactoryClass();
   
    public void testUse2ndLevelCache() throws Exception {
        Configuration cfg = CacheTestUtil.buildConfiguration("", getRegionFactoryClass(), false, true);
       
        JBossCacheRegionFactory regionFactory = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport());
       
        CacheInstanceManager cim = regionFactory.getCacheInstanceManager();
       
        assertNull(cim.getCollectionCacheInstance());
        assertNull(cim.getEntityCacheInstance());
        assertNotNull(cim.getQueryCacheInstance());
        assertNotNull(cim.getTimestampsCacheInstance());
View Full Code Here

    }
   
    public void testUseQueryCache() throws Exception {
        Configuration cfg = CacheTestUtil.buildConfiguration("", getRegionFactoryClass(), true, false);
       
        JBossCacheRegionFactory regionFactory = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport());
       
        CacheInstanceManager cim = regionFactory.getCacheInstanceManager();
       
        assertNotNull(cim.getCollectionCacheInstance());
        assertNotNull(cim.getEntityCacheInstance());
        assertNull(cim.getQueryCacheInstance());
        assertNull(cim.getTimestampsCacheInstance());
View Full Code Here

    public void testDefaultConfig() throws Exception {

        Configuration cfg = CacheTestUtil.buildConfiguration("", JBossCacheRegionFactory.class, true, true);
       
        JBossCacheRegionFactory regionFactory = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport());
       
        CacheInstanceManager mgr = regionFactory.getCacheInstanceManager();
        assertTrue("Correct default CacheInstanceManager type", mgr instanceof SharedCacheInstanceManager);
       
        Cache cache = mgr.getEntityCacheInstance();
        assertTrue("entity cache exists", cache != null);
        assertEquals("Used correct config", "TestSharedCache", cache.getConfiguration().getClusterName());
View Full Code Here

TOP

Related Classes of org.hibernate.cache.jbc2.collection.TransactionalAccess

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.