Author: manik.surtani(a)jboss.com
Date: 2008-05-17 06:52:37 -0400 (Sat, 17 May 2008)
New Revision: 5869
Modified:
core/trunk/src/main/java/org/jboss/cache/loader/CacheLoaderManager.java
core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderManagerTest.java
Log:
Fixed broken test
Modified: core/trunk/src/main/java/org/jboss/cache/loader/CacheLoaderManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/CacheLoaderManager.java 2008-05-16
14:46:15 UTC (rev 5868)
+++ core/trunk/src/main/java/org/jboss/cache/loader/CacheLoaderManager.java 2008-05-17
10:52:37 UTC (rev 5869)
@@ -16,6 +16,7 @@
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import
org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig;
import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.ConfigurationException;
import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.factories.annotations.Start;
@@ -161,12 +162,9 @@
{
throw new Exception("Invalid cache loader configuration!! Only ONE
cache loader may have fetchPersistentState set to true. Cache will not start!");
}
- SingletonStoreConfig ssc = cfg.getSingletonStoreConfig();
- if (ssc != null && ssc.isSingletonStoreEnabled() &&
config.isShared())
- {
- throw new Exception("Invalid cache loader configuration!! If a cache
loader is configured as a singleton, the cache loader cannot be shared in a
cluster!");
- }
+ assertNotSingletonAndShared(cfg);
+
CacheLoader l = createCacheLoader(cfg, cache);
cfg = l.getConfig();
finalConfigs.add(cfg);
@@ -182,6 +180,7 @@
tmpLoader = createCacheLoader(cfg, cache);
finalConfigs.add(tmpLoader.getConfig() == null ? cfg : tmpLoader.getConfig());
fetchPersistentState = cfg.isFetchPersistentState();
+ assertNotSingletonAndShared(cfg);
}
// Update the config with those actually used by the loaders
@@ -191,6 +190,13 @@
return tmpLoader;
}
+ private void assertNotSingletonAndShared(IndividualCacheLoaderConfig cfg)
+ {
+ SingletonStoreConfig ssc = cfg.getSingletonStoreConfig();
+ if (ssc != null && ssc.isSingletonStoreEnabled() &&
config.isShared())
+ throw new ConfigurationException("Invalid cache loader configuration!! If
a cache loader is configured as a singleton, the cache loader cannot be shared in a
cluster!");
+ }
+
/**
* Creates the cache loader based on the configuration.
*
Modified: core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderManagerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderManagerTest.java 2008-05-16
14:46:15 UTC (rev 5868)
+++ core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderManagerTest.java 2008-05-17
10:52:37 UTC (rev 5869)
@@ -11,6 +11,7 @@
import org.jboss.cache.factories.XmlConfigurationParser;
import org.jboss.cache.xml.XmlHelper;
import static org.testng.AssertJUnit.*;
+import org.testng.annotations.Test;
import org.w3c.dom.Element;
import java.util.List;
@@ -22,6 +23,7 @@
* @author <a href="mailto:manik@jboss.org">Manik Surtani
(manik(a)jboss.org)</a>
* @author <a href="mailto:galder.zamarreno@jboss.com">Galder
Zamarreno</a>
*/
+@Test(groups = "functional")
public class CacheLoaderManagerTest extends AbstractCacheLoaderTestBase
{
private CacheLoaderConfig createCacheLoaderCfg(boolean passivation)
Show replies by date