From hibernate-commits at lists.jboss.org Thu Oct 18 23:15:09 2007 Content-Type: multipart/mixed; boundary="===============1554214267231826970==" MIME-Version: 1.0 From: hibernate-commits at lists.jboss.org To: hibernate-commits at lists.jboss.org Subject: [hibernate-commits] Hibernate SVN: r14109 - in core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2: timestamp and 1 other directory. Date: Thu, 18 Oct 2007 23:15:09 -0400 Message-ID: --===============1554214267231826970== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: bstansberry(a)jboss.com Date: 2007-10-18 23:15:08 -0400 (Thu, 18 Oct 2007) New Revision: 14109 Modified: core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2= /query/QueryRegionImplTestCase.java core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2= /timestamp/TimestampsRegionImplTestCase.java Log: Add evict/evictAll tests for query and timestamps regions Modified: core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cac= he/jbc2/query/QueryRegionImplTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc= 2/query/QueryRegionImplTestCase.java 2007-10-19 03:14:33 UTC (rev 14108) +++ core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc= 2/query/QueryRegionImplTestCase.java 2007-10-19 03:15:08 UTC (rev 14109) @@ -25,13 +25,12 @@ import org.hibernate.cache.CacheDataDescription; import org.hibernate.cache.QueryResultsRegion; import org.hibernate.cache.Region; +import org.hibernate.cache.StandardQueryCache; import org.hibernate.cache.jbc2.BasicRegionAdapter; import org.hibernate.cache.jbc2.CacheInstanceManager; import org.hibernate.cache.jbc2.JBossCacheRegionFactory; -import org.hibernate.cache.jbc2.MultiplexedJBossCacheRegionFactory; -import org.hibernate.cache.jbc2.builder.MultiplexingCacheInstanceManager; import org.hibernate.cfg.Configuration; -import org.hibernate.test.cache.jbc2.AbstractRegionImplTestCase; +import org.hibernate.test.cache.jbc2.AbstractGeneralDataRegionTestCase; import org.hibernate.test.util.CacheTestUtil; import org.jboss.cache.Cache; import org.jboss.cache.Fqn; @@ -46,12 +45,10 @@ * @author Brian Stansberry * @version $Revision: 1 $ */ -public class QueryRegionImplTestCase extends AbstractRegionImplTestCase { +public class QueryRegionImplTestCase extends AbstractGeneralDataRegionTest= Case { + +// protected static final String REGION_NAME =3D "test/" + StandardQuer= yCache.class.getName(); = - private static final String KEY =3D "Key"; - private static final String VALUE1 =3D "value1"; - private static final String VALUE2 =3D "value2"; - = /** * Create a new EntityRegionImplTestCase. * = @@ -67,6 +64,11 @@ } = @Override + protected String getStandardRegionName(String regionPrefix) { + return regionPrefix + "/" + StandardQueryCache.class.getName(); + } + + @Override protected Cache getJBossCache(JBossCacheRegionFactory regionFactory) { CacheInstanceManager mgr =3D regionFactory.getCacheInstanceManager= (); return mgr.getQueryCacheInstance(); @@ -76,7 +78,7 @@ protected Fqn getRegionFqn(String regionName, String regionPrefix) { return Fqn.fromString(BasicRegionAdapter.escapeRegionName(regionNa= me, regionPrefix)); } - = + public void testPutDoesNotBlockGetOptimistic() throws Exception { putDoesNotBlockGetTest("optimistic-shared"); } @@ -87,13 +89,10 @@ = private void putDoesNotBlockGetTest(String configName) throws Exceptio= n { = - Configuration cfg =3D CacheTestUtil.buildConfiguration("test", Mul= tiplexedJBossCacheRegionFactory.class, false, true); - cfg.setProperty(MultiplexingCacheInstanceManager.QUERY_CACHE_RESOU= RCE_PROP, configName); - // Use the local-query config for timestamps as well to save time - cfg.setProperty(MultiplexingCacheInstanceManager.TIMESTAMP_CACHE_R= ESOURCE_PROP, configName); + Configuration cfg =3D createConfiguration(configName); JBossCacheRegionFactory regionFactory =3D CacheTestUtil.startRegio= nFactory(cfg, getCacheTestSupport()); = - final QueryResultsRegion region =3D regionFactory.buildQueryResult= sRegion("test/com.foo.test", cfg.getProperties()); + final QueryResultsRegion region =3D regionFactory.buildQueryResult= sRegion(getStandardRegionName(REGION_PREFIX), cfg.getProperties()); = region.put(KEY, VALUE1); assertEquals(VALUE1, region.get(KEY)); @@ -178,18 +177,15 @@ = private void getDoesNotBlockPutTest(String configName) throws Exceptio= n { = - Configuration cfg =3D CacheTestUtil.buildConfiguration("test", Mul= tiplexedJBossCacheRegionFactory.class, false, true); - cfg.setProperty(MultiplexingCacheInstanceManager.QUERY_CACHE_RESOU= RCE_PROP, configName); - // Use the local-query config for timestamps as well to save time - cfg.setProperty(MultiplexingCacheInstanceManager.TIMESTAMP_CACHE_R= ESOURCE_PROP, configName); + Configuration cfg =3D createConfiguration(configName); JBossCacheRegionFactory regionFactory =3D CacheTestUtil.startRegio= nFactory(cfg, getCacheTestSupport()); = - final QueryResultsRegion region =3D regionFactory.buildQueryResult= sRegion("test/com.foo.test", cfg.getProperties()); + final QueryResultsRegion region =3D regionFactory.buildQueryResult= sRegion(getStandardRegionName(REGION_PREFIX), cfg.getProperties()); = region.put(KEY, VALUE1); assertEquals(VALUE1, region.get(KEY)); = - final Fqn rootFqn =3D getRegionFqn("test/com.foo.test", "test"); + final Fqn rootFqn =3D getRegionFqn(getStandardRegionName(REGION_PR= EFIX), REGION_PREFIX); final Cache jbc =3D getJBossCache(regionFactory); = final CountDownLatch blockerLatch =3D new CountDownLatch(1); @@ -275,17 +271,7 @@ blockerLatch.countDown(); } } - = - private void rollback() { - try { - BatchModeTransactionManager.getInstance().rollback(); - } - catch (Exception e) { - log.error(e.getMessage(), e); - } - = - } - = + @CacheListener public class GetBlocker { = Modified: core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cac= he/jbc2/timestamp/TimestampsRegionImplTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc= 2/timestamp/TimestampsRegionImplTestCase.java 2007-10-19 03:14:33 UTC (rev = 14108) +++ core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc= 2/timestamp/TimestampsRegionImplTestCase.java 2007-10-19 03:15:08 UTC (rev = 14109) @@ -20,11 +20,12 @@ = import org.hibernate.cache.CacheDataDescription; import org.hibernate.cache.Region; +import org.hibernate.cache.UpdateTimestampsCache; import org.hibernate.cache.jbc2.BasicRegionAdapter; import org.hibernate.cache.jbc2.CacheInstanceManager; import org.hibernate.cache.jbc2.JBossCacheRegionFactory; import org.hibernate.cache.jbc2.timestamp.TimestampsRegionImpl; -import org.hibernate.test.cache.jbc2.AbstractRegionImplTestCase; +import org.hibernate.test.cache.jbc2.AbstractGeneralDataRegionTestCase; import org.jboss.cache.Cache; import org.jboss.cache.Fqn; = @@ -34,7 +35,7 @@ * @author Brian Stansberry * @version $Revision: 1 $ */ -public class TimestampsRegionImplTestCase extends AbstractRegionImplTestCa= se { +public class TimestampsRegionImplTestCase extends AbstractGeneralDataRegio= nTestCase { = /** * Create a new EntityRegionImplTestCase. @@ -60,6 +61,12 @@ protected Fqn getRegionFqn(String regionName, String regionPrefix) { return BasicRegionAdapter.getTypeFirstRegionFqn(regionName, region= Prefix, TimestampsRegionImpl.TYPE); } + + @Override + protected String getStandardRegionName(String regionPrefix) { + return regionPrefix + "/" + UpdateTimestampsCache.class.getName(); + } = = + = } --===============1554214267231826970==--