Author: galder.zamarreno(a)jboss.com
Date: 2010-08-27 07:12:52 -0400 (Fri, 27 Aug 2010)
New Revision: 8445
Added:
core/trunk/src/test/java/org/jboss/cache/loader/ReadOnlyClusteredCacheLoaderTest.java
Modified:
core/trunk/src/main/java/org/jboss/cache/loader/CacheLoaderManager.java
Log:
[JBCACHE-1571] (ClusteredCacheLoader throws NullPointerException when configured with
ignoreModifications) Fixed.
Modified: core/trunk/src/main/java/org/jboss/cache/loader/CacheLoaderManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/CacheLoaderManager.java 2010-08-27
08:54:51 UTC (rev 8444)
+++ core/trunk/src/main/java/org/jboss/cache/loader/CacheLoaderManager.java 2010-08-27
11:12:52 UTC (rev 8445)
@@ -453,7 +453,10 @@
try
{
// wire any deps.
- registry.wireDependencies(loader);
+ if (loader instanceof AbstractDelegatingCacheLoader)
+ registry.wireDependencies(((AbstractDelegatingCacheLoader)
loader).getCacheLoader());
+ else
+ registry.wireDependencies(loader);
// create the cache loader
loader.create();
Added:
core/trunk/src/test/java/org/jboss/cache/loader/ReadOnlyClusteredCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/ReadOnlyClusteredCacheLoaderTest.java
(rev 0)
+++
core/trunk/src/test/java/org/jboss/cache/loader/ReadOnlyClusteredCacheLoaderTest.java 2010-08-27
11:12:52 UTC (rev 8445)
@@ -0,0 +1,49 @@
+package org.jboss.cache.loader;
+
+import org.jboss.cache.AbstractMultipleCachesTest;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.Node;
+import org.jboss.cache.UnitTestCacheFactory;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.UnitTestConfigurationFactory;
+import org.testng.annotations.Test;
+
+/**
+ * Test read only clustered cache loader.
+ *
+ * @author Galder Zamarreño
+ * @since 3.2.6
+ */
+@Test(groups = {"functional"}, testName =
"loader.ReadOnlyClusteredCacheLoaderTest")
+public class ReadOnlyClusteredCacheLoaderTest extends AbstractMultipleCachesTest {
+
+ private CacheSPI<String, String> cache1, cache2;
+
+ @Override
+ protected void createCaches() throws Throwable {
+ Configuration c1 = new Configuration();
+ Configuration c2 = new Configuration();
+ c1.setCacheMode(Configuration.CacheMode.REPL_SYNC);
+ c2.setCacheMode(Configuration.CacheMode.REPL_SYNC);
+
+
c1.setCacheLoaderConfig(UnitTestConfigurationFactory.buildSingleCacheLoaderConfig(false,
"", "org.jboss.cache.loader.ClusteredCacheLoader",
+ "timeout=5000", false, false, false, false, true));
+
c2.setCacheLoaderConfig(UnitTestConfigurationFactory.buildSingleCacheLoaderConfig(false,
"", "org.jboss.cache.loader.ClusteredCacheLoader",
+ "timeout=5000", false, false, false, false, true));
+
+ cache1 = (CacheSPI<String, String>) new UnitTestCacheFactory<String,
String>().createCache(c1, false, getClass());
+ cache2 = (CacheSPI<String, String>) new UnitTestCacheFactory<String,
String>().createCache(c2, false, getClass());
+ cache1.start();
+ cache2.start();
+ registerCaches(cache1, cache2);
+ }
+
+
+ public void testReadOnlyAccess() throws Exception {
+ Node<String, String> rootNode = cache1.getRoot();
+ Fqn<String> fqn = Fqn.fromElements("blap");
+ Node<String, String> child = rootNode.getChild(fqn);
+ }
+
+}
Show replies by date