[jboss-cvs] JBossAS SVN: r62800 - in branches/Branch_4_2/ejb3/src: main/org/jboss/ejb3/entity and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri May 4 00:27:13 EDT 2007
Author: bstansberry at jboss.com
Date: 2007-05-04 00:27:13 -0400 (Fri, 04 May 2007)
New Revision: 62800
Added:
branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/entity/SecondLevelCacheUtil.java
Modified:
branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3Deployment.java
branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/entity/JBCCache.java
branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/entity/OptimisticJBCCache.java
branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/entity/TreeCacheProviderHook.java
branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/classloader/EntityQueryTestBean.java
branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityClassloaderTestBase.java
branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityQueryRedeployUnitTestCase.java
branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityQueryUnitTestCase.java
branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/OptimisticEntityQueryRedeployUnitTestCase.java
branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/OptimisticEntityQueryUnitTestCase.java
Log:
[EJBTHREE-954] Ensure segregation of deployments in the 2nd level cache
Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3Deployment.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3Deployment.java 2007-05-04 00:45:31 UTC (rev 62799)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3Deployment.java 2007-05-04 04:27:13 UTC (rev 62800)
@@ -50,6 +50,7 @@
import org.jboss.ejb3.enc.EjbModulePersistenceUnitResolver;
import org.jboss.ejb3.entity.PersistenceUnitDeployment;
import org.jboss.ejb3.entity.PersistenceXmlLoader;
+import org.jboss.ejb3.entity.SecondLevelCacheUtil;
import org.jboss.ejb3.metamodel.EjbJarDD;
import org.jboss.ejb3.metamodel.EjbJarDDObjectFactory;
import org.jboss.ejb3.metamodel.JBossDDObjectFactory;
@@ -518,6 +519,17 @@
{
String earShortName = deploymentScope == null ? null : deploymentScope.getShortName();
boolean isScoped = ejbContainers.size() > 0;
+
+ // Ensure 2nd level cache entries are segregated from other deployments
+ String cache_prefix = metadata.getProps().getProperty(SecondLevelCacheUtil.HIBERNATE_CACHE_REGION_PREFIX);
+ if (cache_prefix == null)
+ {
+ // Create a region_prefix for the 2nd level cache to ensure
+ // deployments are segregated
+ String jarName = isScoped ? unit.getShortName() : null;
+ cache_prefix = SecondLevelCacheUtil.createCacheRegionPrefix(earShortName, jarName, metadata.getName());
+ metadata.getProps().setProperty(SecondLevelCacheUtil.HIBERNATE_CACHE_REGION_PREFIX, cache_prefix);
+ }
PersistenceUnitDeployment deployment = new PersistenceUnitDeployment(initialContext, this, explicitEntityClasses, persistenceXmlUrl, metadata, earShortName, unit.getShortName(), isScoped);
PersistenceUnitRegistry.register(deployment);
persistenceUnitDeployments.add(deployment);
Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/entity/JBCCache.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/entity/JBCCache.java 2007-05-04 00:45:31 UTC (rev 62799)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/entity/JBCCache.java 2007-05-04 04:27:13 UTC (rev 62800)
@@ -35,7 +35,6 @@
import org.hibernate.cache.Cache;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.StandardQueryCache;
-import org.hibernate.cache.UpdateTimestampsCache;
import org.jboss.cache.Fqn;
import org.jboss.cache.config.Option;
import org.jboss.cache.lock.TimeoutException;
@@ -59,11 +58,12 @@
private final TransactionManager transactionManager;
private boolean localWritesOnly;
- public JBCCache(org.jboss.cache.TreeCache cache, String regionName, TransactionManager transactionManager)
+ public JBCCache(org.jboss.cache.TreeCache cache, String regionName,
+ String regionPrefix, TransactionManager transactionManager)
throws CacheException {
this.cache = cache;
this.regionName = regionName;
- this.regionFqn = Fqn.fromString( regionName.replace( '.', '/' ) );
+ this.regionFqn = Fqn.fromString(SecondLevelCacheUtil.createRegionFqn(regionName, regionPrefix));
this.transactionManager = transactionManager;
if (cache.getUseRegionBasedMarshalling())
{
@@ -216,7 +216,7 @@
opt.setCacheModeLocal(true);
cache.remove(regionFqn, opt);
- if (cache.getUseRegionBasedMarshalling() && !isSharedClassLoaderRegion(regionName))
+ if (cache.getUseRegionBasedMarshalling() && !SecondLevelCacheUtil.isSharedClassLoaderRegion(regionName))
{
inactivateCacheRegion();
}
@@ -231,7 +231,7 @@
}
public void lock(Object key) throws CacheException {
- throw new UnsupportedOperationException( "TreeCache is a fully transactional cache" + regionName );
+ throw new UnsupportedOperationException( "TreeCache is a fully transactional cache: " + regionName );
}
public void unlock(Object key) throws CacheException {
@@ -290,14 +290,8 @@
}
public String toString() {
- return "TreeCache(" + regionName + ')';
+ return "JBCCache(" + regionName + ')';
}
-
- private boolean isSharedClassLoaderRegion(String regionName)
- {
- return (StandardQueryCache.class.getName().equals(regionName)
- || UpdateTimestampsCache.class.getName().equals(regionName));
- }
private void activateCacheRegion(String regionName) throws CacheException
{
@@ -309,7 +303,7 @@
{
// Only register the classloader if it's not a shared region.
// If it's shared, no single classloader is valid
- if (!isSharedClassLoaderRegion(regionName))
+ if (!SecondLevelCacheUtil.isSharedClassLoaderRegion(regionName))
{
cache.registerClassLoader(fqnString, Thread.currentThread().getContextClassLoader());
}
Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/entity/OptimisticJBCCache.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/entity/OptimisticJBCCache.java 2007-05-04 00:45:31 UTC (rev 62799)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/entity/OptimisticJBCCache.java 2007-05-04 04:27:13 UTC (rev 62800)
@@ -34,7 +34,6 @@
import org.hibernate.cache.OptimisticCache;
import org.hibernate.cache.OptimisticCacheSource;
import org.hibernate.cache.StandardQueryCache;
-import org.hibernate.cache.UpdateTimestampsCache;
import org.jboss.cache.Fqn;
import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.config.Option;
@@ -63,11 +62,12 @@
private OptimisticCacheSource source;
private boolean localWritesOnly;
- public OptimisticJBCCache(org.jboss.cache.TreeCache cache, String regionName)
+ public OptimisticJBCCache(org.jboss.cache.TreeCache cache,
+ String regionName, String regionPrefix)
throws CacheException {
this.cache = cache;
this.regionName = regionName;
- this.regionFqn = Fqn.fromString( regionName.replace( '.', '/' ) );
+ this.regionFqn = Fqn.fromString(SecondLevelCacheUtil.createRegionFqn(regionName, regionPrefix));
if (cache.getUseRegionBasedMarshalling())
{
localWritesOnly = StandardQueryCache.class.getName().equals(regionName);
@@ -238,7 +238,7 @@
option.setDataVersion( NonLockingDataVersion.INSTANCE );
cache.remove( regionFqn, option );
- if (cache.getUseRegionBasedMarshalling() && !isSharedClassLoaderRegion(regionName))
+ if (cache.getUseRegionBasedMarshalling() && !SecondLevelCacheUtil.isSharedClassLoaderRegion(regionName))
{
inactivateCacheRegion();
}
@@ -249,7 +249,7 @@
}
public void lock(Object key) throws CacheException {
- throw new UnsupportedOperationException( "TreeCache is a fully transactional cache" + regionName );
+ throw new UnsupportedOperationException( "TreeCache is a fully transactional cache: " + regionName );
}
public void unlock(Object key) throws CacheException {
@@ -308,14 +308,8 @@
}
public String toString() {
- return "OptimisticTreeCache(" + regionName + ')';
+ return "OptimisticJBCCache(" + regionName + ')';
}
-
- private boolean isSharedClassLoaderRegion(String regionName)
- {
- return (StandardQueryCache.class.getName().equals(regionName)
- || UpdateTimestampsCache.class.getName().equals(regionName));
- }
private void activateCacheRegion(String regionName) throws CacheException
{
@@ -327,7 +321,7 @@
{
// Only register the classloader if it's not a shared region.
// If it's shared, no single classloader is valid
- if (!isSharedClassLoaderRegion(regionName))
+ if (!SecondLevelCacheUtil.isSharedClassLoaderRegion(regionName))
{
cache.registerClassLoader(fqnString, Thread.currentThread().getContextClassLoader());
}
Added: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/entity/SecondLevelCacheUtil.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/entity/SecondLevelCacheUtil.java (rev 0)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/entity/SecondLevelCacheUtil.java 2007-05-04 04:27:13 UTC (rev 62800)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.ejb3.entity;
+
+import org.hibernate.cache.StandardQueryCache;
+import org.hibernate.cache.UpdateTimestampsCache;
+import org.jboss.cache.Fqn;
+
+/**
+ * Utilities related to the Hibernate 2nd Level Cache
+ *
+ * @author Brian Stansberry
+ */
+public class SecondLevelCacheUtil
+{
+ public static final String HIBERNATE_CACHE_REGION_PREFIX = "hibernate.cache.region_prefix";
+
+ public static String createCacheRegionPrefix(String earName, String jarName, String unitName)
+ {
+ StringBuilder sb = new StringBuilder();
+ if (earName != null)
+ {
+ sb.append(earName);
+ if (!earName.endsWith(".ear"))
+ sb.append("_ear");
+ sb.append(",");
+ }
+ if (jarName != null)
+ {
+ sb.append(jarName);
+ if (!jarName.endsWith(".jar"))
+ sb.append("_jar");
+ sb.append(",");
+ }
+ sb.append(unitName);
+ String raw = sb.toString();
+ // Replace any '.' otherwise the JBoss Cache integration may replace
+ // it with a '/' and it will become a level in the FQN
+ String escaped = raw.replace('.', '_');
+ return escaped;
+ }
+
+ public static String createRegionFqn(String regionName, String regionPrefix)
+ {
+ String escaped = null;
+ int idx = -1;
+ if (regionPrefix != null)
+ {
+ idx = regionName.indexOf(regionPrefix);
+ }
+
+ if (idx > -1)
+ {
+ int regionEnd = idx + regionPrefix.length();
+ String prefix = regionName.substring(0, regionEnd);
+ String suffix = regionName.substring(regionEnd);
+ suffix = suffix.replace('.', '/');
+ escaped = prefix + suffix;
+ }
+ else
+ {
+ escaped = regionName.replace('.', '/');
+ }
+ return escaped;
+ }
+
+ public static boolean isSharedClassLoaderRegion(String regionName)
+ {
+ return (StandardQueryCache.class.getName().equals(regionName)
+ || UpdateTimestampsCache.class.getName().equals(regionName));
+ }
+
+ // Prevent instantiation
+ private SecondLevelCacheUtil() {}
+}
Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/entity/TreeCacheProviderHook.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/entity/TreeCacheProviderHook.java 2007-05-04 00:45:31 UTC (rev 62799)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/entity/TreeCacheProviderHook.java 2007-05-04 04:27:13 UTC (rev 62800)
@@ -83,13 +83,15 @@
*/
public Cache buildCache(String regionName, Properties properties) throws CacheException
{
+ String regionPrefix = properties.getProperty("hibernate.cache.region_prefix");
+
if (optimistic)
{
- return new OptimisticJBCCache(cache, regionName);
+ return new OptimisticJBCCache(cache, regionName, regionPrefix);
}
else
{
- return new JBCCache(cache, regionName, TxUtil.getTransactionManager());
+ return new JBCCache(cache, regionName, regionPrefix, TxUtil.getTransactionManager());
}
}
Modified: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/classloader/EntityQueryTestBean.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/classloader/EntityQueryTestBean.java 2007-05-04 00:45:31 UTC (rev 62799)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/classloader/EntityQueryTestBean.java 2007-05-04 04:27:13 UTC (rev 62800)
@@ -225,7 +225,7 @@
private boolean getSawRegion(String regionName, Set sawEvent)
{
boolean saw = false;
- Fqn fqn = Fqn.fromString("/" + regionName.replace(".", "/"));
+ Fqn fqn = Fqn.fromString(regionName);
for (Iterator it = sawEvent.iterator(); it.hasNext();)
{
Fqn modified = (Fqn) it.next();
Modified: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityClassloaderTestBase.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityClassloaderTestBase.java 2007-05-04 00:45:31 UTC (rev 62799)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityClassloaderTestBase.java 2007-05-04 04:27:13 UTC (rev 62800)
@@ -25,6 +25,8 @@
import javax.naming.InitialContext;
import org.hibernate.cache.StandardQueryCache;
+import org.jboss.cache.Fqn;
+import org.jboss.ejb3.entity.SecondLevelCacheUtil;
import org.jboss.ejb3.test.clusteredentity.classloader.Account;
import org.jboss.ejb3.test.clusteredentity.classloader.AccountHolderPK;
import org.jboss.ejb3.test.clusteredentity.classloader.EntityQueryTest;
@@ -43,6 +45,8 @@
extends JBossClusteredTestCase
{
public static final String EAR_NAME = "clusteredentity-classloader-test";
+ public static final String JAR_NAME = "clusteredentity-classloader-test";
+ public static final String PERSISTENCE_UNIT_NAME = "tempdb";
protected org.apache.log4j.Logger log = getLog();
@@ -138,21 +142,22 @@
protected void resetRegionUsageState()
{
- sfsb0.getSawRegionModification(StandardQueryCache.class.getName());
- sfsb0.getSawRegionModification("AccountRegion");
+ String stdName = createRegionName(StandardQueryCache.class.getName());
+ String acctName = createRegionName("AccountRegion");
- sfsb0.getSawRegionAccess(StandardQueryCache.class.getName());
- sfsb0.getSawRegionAccess("AccountRegion");
-
+ sfsb0.getSawRegionModification(stdName);
+ sfsb0.getSawRegionModification(acctName);
- sfsb1.getSawRegionModification(StandardQueryCache.class.getName());
- sfsb1.getSawRegionModification("AccountRegion");
+ sfsb0.getSawRegionAccess(stdName);
+ sfsb0.getSawRegionAccess(acctName);
- sfsb1.getSawRegionAccess(StandardQueryCache.class.getName());
- sfsb1.getSawRegionAccess("AccountRegion");
+ sfsb1.getSawRegionModification(stdName);
+ sfsb1.getSawRegionModification(acctName);
- log.info("Region usage state cleared");
+ sfsb1.getSawRegionAccess(stdName);
+ sfsb1.getSawRegionAccess(acctName);
+ log.info("Region usage state cleared");
}
protected void modifyEntities(EntityQueryTest bean)
@@ -172,7 +177,27 @@
log.info("Standard entities restored to initial state");
}
- protected void queryTest(boolean setupEntities, boolean useNamedQuery, boolean useNamedRegion, boolean checkEmptyRegion)
+ /**
+ * Executes a series of entity operations and queries, checking that
+ * expected modifications and reads of the query cache occur.
+ *
+ * @param setupEntities <code>true</code> if entities don't exist and need
+ * to be created; <code>false</code> if they should
+ * exist and need to be returned to their initial state
+ * @param useNamedQuery <code>true</code> if named queries are to be used;
+ * <code>false</code> if the EJBQL should be passed
+ * to the Query
+ * @param useNamedRegion <code>true</code> if the query should be cached in
+ * "AccountRegion"; <code>false</code> if it should be
+ * cached in the default region
+ * @param expectInactivatedRegion <code>true</code> if the test should assume
+ * the query cache region is inactive on each
+ * server until accessed on that server;
+ * <code>false</code> if it should be assumed
+ * the region is activated and able to
+ * receive replication events.
+ */
+ protected void queryTest(boolean setupEntities, boolean useNamedQuery, boolean useNamedRegion, boolean expectInactivatedRegion)
{
if (setupEntities)
standardEntitySetup();
@@ -183,12 +208,13 @@
// Initial ops on node 0
- String regionName = useNamedRegion ? "AccountRegion" : StandardQueryCache.class.getName();
+ String regionName = createRegionName(useNamedRegion ? "AccountRegion" : StandardQueryCache.class.getName());
// Query on post code count
assertEquals("63088 has correct # of accounts", 6, sfsb0.getCountForBranch("63088", useNamedQuery, useNamedRegion));
- assertTrue("Query cache used", sfsb0.getSawRegionModification(regionName));
+ assertTrue("Query cache used " + regionName,
+ sfsb0.getSawRegionModification(regionName));
// Clear the access state
sfsb0.getSawRegionAccess(regionName);
@@ -199,25 +225,28 @@
sleep(SLEEP_TIME);
// If region isn't activated yet, should not have been modified
- if (checkEmptyRegion)
+ if (expectInactivatedRegion)
{
- assertFalse("Query cache remotely modified", sfsb1.getSawRegionModification(regionName));
+ assertFalse("Query cache remotely modified " + regionName,
+ sfsb1.getSawRegionModification(regionName));
// Clear the access state
sfsb1.getSawRegionAccess(regionName);
}
- else if (useNamedRegion)
+ else //if (useNamedRegion)
{
- assertTrue("Query cache remotely modified", sfsb1.getSawRegionModification(regionName));
+ assertTrue("Query cache remotely modified " + regionName,
+ sfsb1.getSawRegionModification(regionName));
// Clear the access state
sfsb1.getSawRegionAccess(regionName);
}
assertEquals("63088 has correct # of accounts", 6, sfsb1.getCountForBranch("63088", useNamedQuery, useNamedRegion));
- if (checkEmptyRegion)
+ if (expectInactivatedRegion)
{
- // Query should have been inserted
- assertTrue("Query cache modified", sfsb1.getSawRegionModification(regionName));
+ // Query should have activated the region and then been inserted
+ assertTrue("Query cache modified " + regionName,
+ sfsb1.getSawRegionModification(regionName));
// Clear the access state
sfsb1.getSawRegionAccess(regionName);
}
@@ -235,7 +264,8 @@
assertEquals("Correct high balances for Jones", 40, sfsb0.getTotalBalance(JONES, useNamedQuery, useNamedRegion));
- assertTrue("Query cache used", sfsb0.getSawRegionModification(regionName));
+ assertTrue("Query cache used " + regionName,
+ sfsb0.getSawRegionModification(regionName));
// Clear the access state
sfsb0.getSawRegionAccess(regionName);
@@ -248,30 +278,20 @@
// First check if the previous queries replicated (if the region is replicable)
- if (useNamedRegion)
- {
- assertTrue("Query cache remotely modified", sfsb1.getSawRegionModification(regionName));
- // Clear the access state
- sfsb1.getSawRegionAccess(regionName);
- }
+ assertTrue("Query cache remotely modified " + regionName,
+ sfsb1.getSawRegionModification(regionName));
+ // Clear the access state
+ sfsb1.getSawRegionAccess(regionName);
assertEquals("Correct branch for Smith", "94536", sfsb1.getBranch(SMITH, useNamedQuery, useNamedRegion));
assertEquals("Correct high balances for Jones", 40, sfsb1.getTotalBalance(JONES, useNamedQuery, useNamedRegion));
- if (useNamedRegion)
- {
- // Should be no change; query was already there
- assertFalse("Query cache modified", sfsb1.getSawRegionModification(regionName));
- assertTrue("Query cache accessed", sfsb1.getSawRegionAccess(regionName));
- }
- else
- {
- // Query should have been inserted
- assertTrue("Query cache modified", sfsb1.getSawRegionModification(regionName));
- // Clear the access state
- sfsb1.getSawRegionAccess(regionName);
- }
+ // Should be no change; query was already there
+ assertFalse("Query cache modified " + regionName,
+ sfsb1.getSawRegionModification(regionName));
+ assertTrue("Query cache accessed " + regionName,
+ sfsb1.getSawRegionAccess(regionName));
log.info("Second set of queries on node1 done");
@@ -301,10 +321,51 @@
}
}
+ protected String createRegionName(String noPrefix)
+ {
+ String prefix = createCacheRegionPrefix(getEarName(), getJarName(), getPersistenceUnitName());
+ return "/" + prefix + "/" + noPrefix.replace('.', '/');
+ }
+
protected String getEarName()
{
return EAR_NAME;
}
+
+ protected String getJarName()
+ {
+ return JAR_NAME;
+ }
+
+ protected String getPersistenceUnitName()
+ {
+ return PERSISTENCE_UNIT_NAME;
+ }
+
+ public static String createCacheRegionPrefix(String earName, String jarName, String unitName)
+ {
+ StringBuilder sb = new StringBuilder();
+ if (earName != null)
+ {
+ sb.append(earName);
+ if (!earName.endsWith(".ear"))
+ sb.append("_ear");
+ sb.append(",");
+ }
+ if (jarName != null)
+ {
+ sb.append(jarName);
+ if (!jarName.endsWith(".jar"))
+ sb.append("_jar");
+ sb.append(",");
+ }
+ sb.append(unitName);
+ String raw = sb.toString();
+ // Replace any '.' otherwise the JBoss Cache integration may replace
+ // it with a '/' and it will become a level in the FQN
+ String escaped = raw.replace('.', '_');
+ return escaped;
+ }
protected boolean isOptimistic()
{
Modified: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityQueryRedeployUnitTestCase.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityQueryRedeployUnitTestCase.java 2007-05-04 00:45:31 UTC (rev 62799)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityQueryRedeployUnitTestCase.java 2007-05-04 04:27:13 UTC (rev 62800)
@@ -45,14 +45,14 @@
public void testRedeploy() throws Exception
{
// Set things up with the default region
- queryTest(true, true, false, true);
+ queryTest(true, true, false, false);
// Now get the named query regions active
queryTest(false, true, true, true);
redeploy();
// Redo the test, but no entity creation
- queryTest(false, true, false, true);
+ queryTest(false, true, false, false);
queryTest(false, true, true, true);
}
Modified: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityQueryUnitTestCase.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityQueryUnitTestCase.java 2007-05-04 00:45:31 UTC (rev 62799)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/EntityQueryUnitTestCase.java 2007-05-04 04:27:13 UTC (rev 62800)
@@ -45,7 +45,7 @@
public void testManualQueryDefaultRegion() throws Exception
{
log.info("+++ start testManualQueryDefaultRegion");
- queryTest(false, false);
+ queryTest(true, false, false, false);
log.info("+++ end testManualQueryDefaultRegion");
}
@@ -54,7 +54,7 @@
log.info("+++ start testManualQueryNamedRegion");
try
{
- queryTest(false, true);
+ queryTest(true, false, true, firstNamedRegionTest);
}
finally
{
@@ -66,7 +66,7 @@
public void testNamedQueryDefaultRegion() throws Exception
{
log.info("+++ start testNamedQueryDefaultRegion");
- queryTest(true, false);
+ queryTest(true, true, false, false);
log.info("+++ end testNamedQueryDefaultRegion");
}
@@ -75,7 +75,7 @@
log.info("+++ start testNamedQueryNamedRegion");
try
{
- queryTest(true, true);
+ queryTest(true, true, true, firstNamedRegionTest);
}
finally
{
@@ -83,11 +83,6 @@
}
log.info("+++ start testNamedQueryNamedRegion");
}
-
- private void queryTest(boolean useNamedQuery, boolean useNamedRegion)
- {
- queryTest(true, useNamedQuery, useNamedRegion, firstNamedRegionTest);
- }
public static Test suite() throws Exception
{
Modified: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/OptimisticEntityQueryRedeployUnitTestCase.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/OptimisticEntityQueryRedeployUnitTestCase.java 2007-05-04 00:45:31 UTC (rev 62799)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/OptimisticEntityQueryRedeployUnitTestCase.java 2007-05-04 04:27:13 UTC (rev 62800)
@@ -38,6 +38,7 @@
public class OptimisticEntityQueryRedeployUnitTestCase extends EntityQueryRedeployUnitTestCase
{
private static final String EAR_NAME = "clusteredentity-classloader-optimistic-test";
+ public static final String JAR_NAME = "clusteredentity-classloader-optimistic-test";
public OptimisticEntityQueryRedeployUnitTestCase(String name)
@@ -65,6 +66,12 @@
{
return EAR_NAME;
}
+
+ @Override
+ protected String getJarName()
+ {
+ return JAR_NAME;
+ }
@Override
protected boolean isOptimistic()
Modified: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/OptimisticEntityQueryUnitTestCase.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/OptimisticEntityQueryUnitTestCase.java 2007-05-04 00:45:31 UTC (rev 62799)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/unit/OptimisticEntityQueryUnitTestCase.java 2007-05-04 04:27:13 UTC (rev 62800)
@@ -37,6 +37,7 @@
public class OptimisticEntityQueryUnitTestCase extends EntityQueryUnitTestCase
{
private static final String EAR_NAME = "clusteredentity-classloader-optimistic-test";
+ public static final String JAR_NAME = "clusteredentity-classloader-optimistic-test";
public OptimisticEntityQueryUnitTestCase(String name)
{
@@ -63,6 +64,12 @@
{
return EAR_NAME;
}
+
+ @Override
+ protected String getJarName()
+ {
+ return JAR_NAME;
+ }
@Override
protected boolean isOptimistic()
More information about the jboss-cvs-commits
mailing list