[infinispan-commits] Infinispan SVN: r1413 - in trunk/core/src: test/java/org/infinispan/statetransfer and 1 other directory.
infinispan-commits at lists.jboss.org
infinispan-commits at lists.jboss.org
Tue Jan 26 10:02:09 EST 2010
Author: galder.zamarreno at jboss.com
Date: 2010-01-26 10:02:09 -0500 (Tue, 26 Jan 2010)
New Revision: 1413
Added:
trunk/core/src/test/java/org/infinispan/statetransfer/StateTransferFetchOnlyPersistentStateTest.java
Modified:
trunk/core/src/main/java/org/infinispan/factories/StateTransferManagerFactory.java
Log:
[ISPN-338] (fetchPersistentState should be allowed regardless of fetchInMemoryState) Fixed.
Modified: trunk/core/src/main/java/org/infinispan/factories/StateTransferManagerFactory.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/factories/StateTransferManagerFactory.java 2010-01-25 14:25:06 UTC (rev 1412)
+++ trunk/core/src/main/java/org/infinispan/factories/StateTransferManagerFactory.java 2010-01-26 15:02:09 UTC (rev 1413)
@@ -34,7 +34,7 @@
@DefaultFactoryFor(classes = StateTransferManager.class)
public class StateTransferManagerFactory extends AbstractNamedCacheComponentFactory implements AutoInstantiableFactory {
public <T> T construct(Class<T> componentType) {
- if (configuration.getCacheMode().isClustered() && configuration.isFetchInMemoryState())
+ if (configuration.getCacheMode().isClustered() && configuration.isStateTransferEnabled())
return componentType.cast(new StateTransferManagerImpl());
else
return null;
Added: trunk/core/src/test/java/org/infinispan/statetransfer/StateTransferFetchOnlyPersistentStateTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/statetransfer/StateTransferFetchOnlyPersistentStateTest.java (rev 0)
+++ trunk/core/src/test/java/org/infinispan/statetransfer/StateTransferFetchOnlyPersistentStateTest.java 2010-01-26 15:02:09 UTC (rev 1413)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, 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.infinispan.statetransfer;
+
+import java.lang.reflect.Method;
+
+import org.infinispan.Cache;
+import org.infinispan.config.CacheLoaderManagerConfig;
+import org.infinispan.config.Configuration;
+import org.infinispan.loaders.CacheStoreConfig;
+import org.infinispan.loaders.dummy.DummyInMemoryCacheStore;
+import org.infinispan.manager.CacheManager;
+import org.infinispan.test.MultipleCacheManagersTest;
+import org.testng.annotations.Test;
+
+/**
+ * StateTransferFetchOnlyPersistentStateTest.
+ *
+ * @author Galder Zamarreño
+ * @since 4.0
+ */
+ at Test(groups = "functional", testName = "statetransfer.StateTransferFetchOnlyPersistentStateTest")
+public class StateTransferFetchOnlyPersistentStateTest extends MultipleCacheManagersTest {
+
+ @Override
+ protected void createCacheManagers() throws Throwable {
+ for (int i = 0; i < 2; i++) {
+ Configuration cfg = createConfiguration(i + 1);
+ CacheManager cm = addClusterEnabledCacheManager();
+ cm.defineConfiguration("onlyFetchPersistent", cfg);
+ }
+ }
+
+ private Configuration createConfiguration(int id) {
+ Configuration cfg = getDefaultClusteredConfig(Configuration.CacheMode.REPL_SYNC, true);
+ CacheLoaderManagerConfig clmc = new CacheLoaderManagerConfig();
+ CacheStoreConfig clc = new DummyInMemoryCacheStore.Cfg("store id: " + id);
+ clmc.addCacheLoaderConfig(clc);
+ clc.setFetchPersistentState(true);
+ clmc.setShared(false);
+ cfg.setCacheLoaderManagerConfig(clmc);
+ return cfg;
+ }
+
+ public void test000(Method m) {
+ Cache cache1 = cache(0, "onlyFetchPersistent");
+ assert !cache1.getConfiguration().isFetchInMemoryState();
+ cache1.put("k-" + m.getName(), "v-" + m.getName());
+
+ Cache cache2 = cache(1, "onlyFetchPersistent");
+ assert !cache2.getConfiguration().isFetchInMemoryState();
+ assert cache2.containsKey("k-" + m.getName());
+ assert cache2.get("k-" + m.getName()).equals("v-" + m.getName());
+ }
+
+}
More information about the infinispan-commits
mailing list