[jbosscache-commits] JBoss Cache SVN: r6156 - in core/trunk/src/test/java/org/jboss/cache: factories and 1 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Thu Jul 3 08:00:46 EDT 2008


Author: manik.surtani at jboss.com
Date: 2008-07-03 08:00:46 -0400 (Thu, 03 Jul 2008)
New Revision: 6156

Modified:
   core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java
   core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java
   core/trunk/src/test/java/org/jboss/cache/factories/UnitTestCacheConfigurationFactory.java
   core/trunk/src/test/java/org/jboss/cache/loader/ChainingCacheLoaderBasicTest.java
Log:
Build cfgs using beans rather than XML

Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java	2008-07-03 12:00:22 UTC (rev 6155)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java	2008-07-03 12:00:46 UTC (rev 6156)
@@ -12,21 +12,19 @@
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.BuddyReplicationConfig;
 import org.jboss.cache.config.CacheLoaderConfig;
+import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.config.Configuration.CacheMode;
 import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
 import org.jboss.cache.loader.CacheLoader;
 import org.jboss.cache.loader.CacheLoaderManager;
 import org.jboss.cache.loader.DummyInMemoryCacheLoader;
+import org.jboss.cache.transaction.DummyTransactionManagerLookup;
 import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.config.parsing.XmlConfigHelper;
-import org.jboss.cache.config.parsing.element.LoadersElementParser;
-import org.jboss.cache.config.parsing.element.BuddyElementParser;
 import org.jgroups.Address;
 import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.Test;
-import org.w3c.dom.Element;
 
 import javax.transaction.TransactionManager;
 import java.util.ArrayList;
@@ -130,38 +128,25 @@
    {
       CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC, false, false, true), false);
       c.getConfiguration().setClusterName("BuddyReplicationTest");
-      String buddyPoolNameStr = buddyPoolName != null ? "buddyPoolName=\"" + buddyPoolName + "\"" : "";
-      String xmlStr =
-            "   <buddyReplication enabled=\"true\" " + buddyPoolNameStr + " buddyCommunicationTimeout=\"500000\">\n" +
-            "      <dataGravitation auto=\"" + useDataGravitation + "\" removeOnFind=\""+ removeOnFind + "\" searchBackupTrees=\"true\"/>\n" +
-            "      <buddyLocator class=\"org.jboss.cache.buddyreplication.NextMemberBuddyLocator\">\n" +
-            "         <properties>\n" +
-            "            numBuddies = " + numBuddies +"\n" +
-            "         </properties>\n" +
-            "      </buddyLocator>\n" +
-            "   </buddyReplication>";
-//      // basic config
-//      String xmlString = "<config><buddyReplicationEnabled>true</buddyReplicationEnabled>\n" +
-//            "<buddyCommunicationTimeout>500000</buddyCommunicationTimeout>\n" +
-//            "          <buddyLocatorClass>org.jboss.cache.buddyreplication.NextMemberBuddyLocator</buddyLocatorClass>\n" +
-//            "          <autoDataGravitation>" + useDataGravitation + "</autoDataGravitation>\n" +
-//            "          <dataGravitationRemoveOnFind>" + removeOnFind + "</dataGravitationRemoveOnFind>\n" +
-//            "          <buddyLocatorProperties>numBuddies = " + numBuddies + "</buddyLocatorProperties>\n";
-//
-//      if (buddyPoolName != null) xmlString += "<buddyPoolName>" + buddyPoolName + "</buddyPoolName>";
-//      xmlString += "</config>";
-      BuddyElementParser parser = new BuddyElementParser();
-      Element element = XmlConfigHelper.stringToElement(xmlStr);
-      BuddyReplicationConfig config = parser.parseBuddyElement(element);
-//      BuddyReplicationConfig config = XmlConfigurationParserOld.parseBuddyReplicationConfig(element);
-      c.getConfiguration().setBuddyReplicationConfig(config);
 
+      BuddyReplicationConfig brc = new BuddyReplicationConfig();
+      if (buddyPoolName != null) brc.setBuddyPoolName(buddyPoolName);
+      brc.setEnabled(true);
+      brc.setBuddyCommunicationTimeout(500000);
+      brc.setDataGravitationRemoveOnFind(removeOnFind);
+      brc.setDataGravitationSearchBackupTrees(true);
+      brc.setAutoDataGravitation(useDataGravitation);
+      NextMemberBuddyLocatorConfig nextMemberBuddyLocatorConfig = new NextMemberBuddyLocatorConfig();
+      nextMemberBuddyLocatorConfig.setNumBuddies(numBuddies);
+      brc.setBuddyLocatorConfig(nextMemberBuddyLocatorConfig);
+      c.getConfiguration().setBuddyReplicationConfig(brc);
+
       c.getConfiguration().setFetchInMemoryState(true);
       if (optimisticLocks)
       {
          c.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
       }
-      c.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
+      c.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
       c.getConfiguration().setSyncCommitPhase(true);// helps track down breakages
 
       // Call the hook that allows mux integration if that's what the test wants
@@ -237,15 +222,13 @@
    {
       CacheSPI cache = createCache(1, null, useDataGravitation, removeOnFind, false);
 
-      String xmlStr = "      " +
-            "      <loaders passivation=\"" + passivation + "\" shared=\"false\">\n" +
-            "         <preload/>\n" +
-            "         <loader class=\"" + DummyInMemoryCacheLoader.class.getName() + "\" async=\"false\" fetchPersistentState=\""+ fetchPersistent + "\"/>\n" +
-            "      </loaders>";
-      System.out.println("xmlStr = +\n" + xmlStr);
-      Element xmlEl = XmlConfigHelper.stringToElement(xmlStr);
-      LoadersElementParser parser = new LoadersElementParser();
-      CacheLoaderConfig  config = parser.parseLoadersElement(xmlEl);
+      CacheLoaderConfig config = new CacheLoaderConfig();
+      IndividualCacheLoaderConfig iclc = new IndividualCacheLoaderConfig();
+      iclc.setClassName(DummyInMemoryCacheLoader.class.getName());
+      iclc.setFetchPersistentState(fetchPersistent);
+      config.addIndividualCacheLoaderConfig(iclc);
+      config.setShared(false);
+      config.setPassivation(passivation);
       cache.getConfiguration().setCacheLoaderConfig(config);
       if (start)
       {

Modified: core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java	2008-07-03 12:00:22 UTC (rev 6155)
+++ core/trunk/src/test/java/org/jboss/cache/factories/InterceptorChainFactoryTest.java	2008-07-03 12:00:46 UTC (rev 6156)
@@ -5,20 +5,20 @@
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.config.BuddyReplicationConfig;
 import org.jboss.cache.config.CacheLoaderConfig;
+import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import static org.jboss.cache.config.Configuration.CacheMode.*;
+import static org.jboss.cache.config.Configuration.NodeLockingScheme.OPTIMISTIC;
 import org.jboss.cache.config.EvictionConfig;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.parsing.XmlConfigHelper;
-import org.jboss.cache.config.parsing.element.BuddyElementParser;
-import org.jboss.cache.config.parsing.element.LoadersElementParser;
 import org.jboss.cache.interceptors.*;
 import org.jboss.cache.interceptors.base.CommandInterceptor;
+import org.jboss.cache.loader.DummyInMemoryCacheLoader;
+import org.jboss.cache.transaction.DummyTransactionManagerLookup;
 import org.jboss.cache.util.TestingUtil;
 import static org.testng.AssertJUnit.assertEquals;
 import static org.testng.AssertJUnit.assertNotNull;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
-import org.w3c.dom.Element;
 
 import java.util.Iterator;
 import java.util.List;
@@ -32,7 +32,7 @@
    public void setUp() throws Exception
    {
       cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
-      cache.getConfiguration().setCacheMode("LOCAL");
+      cache.getConfiguration().setCacheMode(LOCAL);
       cache.getConfiguration().setUseLazyDeserialization(false);
    }
 
@@ -70,7 +70,7 @@
    public void testTxConfig() throws Exception
    {
       cache.getConfiguration().setExposeManagementStatistics(false);
-      cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
+      cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
 
       InterceptorChain chain = getInterceptorChainFactory(cache).buildInterceptorChain();
       List<CommandInterceptor> list = chain.asList();
@@ -91,28 +91,21 @@
 
    protected CacheLoaderConfig getCacheLoaderConfig(boolean pasv, boolean fetchPersistentState) throws Exception
    {
-      String xmlStr =
-            "   <loaders passivation=\"" + pasv + "\">\n" +
-            "      <preload/>\n" +
-            "      <loader class=\"org.jboss.cache.loader.FileCacheLoader\" fetchPersistentState=\"" + fetchPersistentState + "\"\n" +
-            "                   ignoreModifications=\"false\">\n" +
-            "         <properties>\n" +
-            "             location=/tmp\n" +
-            "         </properties>\n" +
-            "      </loader>\n" +
-            "   </loaders>";
-
-      Element element = XmlConfigHelper.stringToElement(xmlStr);
-      LoadersElementParser parser = new LoadersElementParser();
-      return parser.parseLoadersElement(element);
+      CacheLoaderConfig clc = new CacheLoaderConfig();
+      IndividualCacheLoaderConfig iclc = new IndividualCacheLoaderConfig();
+      iclc.setClassName(DummyInMemoryCacheLoader.class.getName());
+      iclc.setFetchPersistentState(fetchPersistentState);
+      clc.addIndividualCacheLoaderConfig(iclc);
+      clc.setPassivation(pasv);
+      return clc;
    }
 
    public void testSharedCacheLoaderConfig() throws Exception
    {
       cache.getConfiguration().setExposeManagementStatistics(false);
-      cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
+      cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
       cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(false, false));
-      cache.getConfiguration().setCacheMode("REPL_ASYNC");
+      cache.getConfiguration().setCacheMode(REPL_ASYNC);
       cache.getConfiguration().setFetchInMemoryState(false);
       cache.create();
       InterceptorChain chain = getInterceptorChainFactory(cache).buildInterceptorChain();
@@ -139,9 +132,9 @@
    public void testUnsharedCacheLoaderConfig() throws Exception
    {
       cache.getConfiguration().setExposeManagementStatistics(false);
-      cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
+      cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
       cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(false, true));
-      cache.getConfiguration().setCacheMode("REPL_ASYNC");
+      cache.getConfiguration().setCacheMode(REPL_ASYNC);
       cache.getConfiguration().setFetchInMemoryState(false);
       cache.create();
       InterceptorChain chain = getInterceptorChainFactory(cache).buildInterceptorChain();
@@ -168,8 +161,8 @@
    public void testTxAndRepl() throws Exception
    {
       cache.getConfiguration().setExposeManagementStatistics(false);
-      cache.getConfiguration().setCacheMode("repl_sync");
-      cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
+      cache.getConfiguration().setCacheMode(REPL_SYNC);
+      cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
       InterceptorChain chain = getInterceptorChainFactory(cache).buildInterceptorChain();
       List<CommandInterceptor> list = chain.asList();
       Iterator<CommandInterceptor> interceptors = list.iterator();
@@ -193,7 +186,7 @@
    public void testOptimisticChain() throws Exception
    {
       cache.getConfiguration().setExposeManagementStatistics(false);
-      cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
+      cache.getConfiguration().setNodeLockingScheme(OPTIMISTIC);
 
       InterceptorChain chain = getInterceptorChainFactory(cache).buildInterceptorChain();
       List<CommandInterceptor> list = chain.asList();
@@ -216,8 +209,8 @@
    public void testOptimisticReplicatedChain() throws Exception
    {
       cache.getConfiguration().setExposeManagementStatistics(false);
-      cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
-      cache.getConfiguration().setCacheMode("REPL_SYNC");
+      cache.getConfiguration().setNodeLockingScheme(OPTIMISTIC);
+      cache.getConfiguration().setCacheMode(REPL_SYNC);
 
       InterceptorChain chain = getInterceptorChainFactory(cache).buildInterceptorChain();
       List<CommandInterceptor> list = chain.asList();
@@ -241,7 +234,7 @@
    public void testOptimisticCacheLoaderChain() throws Exception
    {
       cache.getConfiguration().setExposeManagementStatistics(false);
-      cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
+      cache.getConfiguration().setNodeLockingScheme(OPTIMISTIC);
       cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(false, false));
       cache.create();
       InterceptorChain chain = getInterceptorChainFactory(cache).buildInterceptorChain();
@@ -267,7 +260,7 @@
    public void testOptimisticPassivationCacheLoaderChain() throws Exception
    {
       cache.getConfiguration().setExposeManagementStatistics(false);
-      cache.getConfiguration().setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
+      cache.getConfiguration().setNodeLockingScheme(OPTIMISTIC);
       cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(true, false));
       cache.create();
       InterceptorChain chain = getInterceptorChainFactory(cache).buildInterceptorChain();
@@ -293,7 +286,7 @@
    public void testInvalidationInterceptorChain() throws Exception
    {
       cache.getConfiguration().setExposeManagementStatistics(false);
-      cache.getConfiguration().setCacheMode("REPL_ASYNC");
+      cache.getConfiguration().setCacheMode(REPL_ASYNC);
 
       InterceptorChain chain = getInterceptorChainFactory(cache).buildInterceptorChain();
       List<CommandInterceptor> list = chain.asList();
@@ -312,7 +305,7 @@
 
       // now for my invalidation chain.
       cache.getConfiguration().setExposeManagementStatistics(false);
-      cache.getConfiguration().setCacheMode("INVALIDATION_ASYNC");
+      cache.getConfiguration().setCacheMode(INVALIDATION_ASYNC);
       chain = getInterceptorChainFactory(cache).buildInterceptorChain();
       list = chain.asList();
       interceptors = list.iterator();
@@ -384,17 +377,12 @@
 
    public void testBuddyReplicationOptLocking() throws Exception
    {
-      String xmlStr =
-            "      <buddy enabled=\"true\" buddyPoolName=\"buddyPoolName\" buddyCommunicationTimeout=\"600000\">\n" +
-            "         <dataGravitation auto=\"true\" removeOnFind=\"true\" searchBackupTrees=\"true\"/>\n" +
-            "      </buddy>";
-      Element element = XmlConfigHelper.stringToElement(xmlStr);
-      BuddyElementParser parser = new BuddyElementParser();
-      BuddyReplicationConfig brc = parser.parseBuddyElement(element); 
+      BuddyReplicationConfig brc = new BuddyReplicationConfig();
+      brc.setEnabled(true);
       cache.getConfiguration().setBuddyReplicationConfig(brc);
 
-      cache.getConfiguration().setCacheMode("REPL_SYNC");
-      cache.getConfiguration().setNodeLockingScheme("OPTIMISTIC");
+      cache.getConfiguration().setCacheMode(REPL_SYNC);
+      cache.getConfiguration().setNodeLockingScheme(OPTIMISTIC);
       cache.create();// initialise various subsystems such as BRManager
       InterceptorChain chain = getInterceptorChainFactory(cache).buildInterceptorChain();
       List<CommandInterceptor> list = chain.asList();
@@ -421,12 +409,10 @@
 
    public void testBuddyReplicationPessLocking() throws Exception
    {
-      String xmlStr = "<buddy enabled=\"true\" buddyPoolName=\"buddyPoolName\" buddyCommunicationTimeout=\"600000\"/>";
-      Element element = XmlConfigHelper.stringToElement(xmlStr);
-      BuddyElementParser parser = new BuddyElementParser();
-      BuddyReplicationConfig brc = parser.parseBuddyElement(element);
+      BuddyReplicationConfig brc = new BuddyReplicationConfig();
+      brc.setEnabled(true);
       cache.getConfiguration().setBuddyReplicationConfig(brc);
-      cache.getConfiguration().setCacheMode("REPL_SYNC");
+      cache.getConfiguration().setCacheMode(REPL_SYNC);
       cache.create();// initialise various subsystems such as BRManager
       InterceptorChain chain = getInterceptorChainFactory(cache).buildInterceptorChain();
       List<CommandInterceptor> list = chain.asList();

Modified: core/trunk/src/test/java/org/jboss/cache/factories/UnitTestCacheConfigurationFactory.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/factories/UnitTestCacheConfigurationFactory.java	2008-07-03 12:00:22 UTC (rev 6155)
+++ core/trunk/src/test/java/org/jboss/cache/factories/UnitTestCacheConfigurationFactory.java	2008-07-03 12:00:46 UTC (rev 6156)
@@ -7,13 +7,13 @@
 package org.jboss.cache.factories;
 
 import org.jboss.cache.config.CacheLoaderConfig;
+import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.config.Configuration.CacheMode;
 import org.jboss.cache.config.ConfigurationException;
 import org.jboss.cache.config.EvictionRegionConfig;
+import org.jboss.cache.config.parsing.XmlConfigHelper;
 import org.jboss.cache.config.parsing.XmlConfigurationParser;
-import org.jboss.cache.config.parsing.XmlConfigHelper;
-import org.jboss.cache.config.parsing.element.LoadersElementParser;
 import org.jboss.cache.eviction.LRUConfiguration;
 import org.jboss.cache.transaction.TransactionSetup;
 import org.jgroups.conf.XmlConfigurator;
@@ -82,18 +82,18 @@
                                                                 String properties, boolean async, boolean fetchPersistentState,
                                                                 boolean shared, boolean purgeOnStartup, boolean ignoreModifications) throws Exception
    {
-      String xmlStr =
-            "   <loaders passivation=\"" + passivation + "\" shared=\"" + shared + "\">\n" +
-            "      <loader class=\""+ cacheloaderClass + "\" async=\"" + async + "\" fetchPersistentState=\"" + fetchPersistentState + "\"\n" +
-            "                   purgeOnStartup=\"" + purgeOnStartup + "\" ignoreModifications=\"" + ignoreModifications + "\">\n" +
-            "         <properties>" + properties  + "</properties>\n" +
-            "      </loader>\n" +
-            "   </loaders>";
-      Element xmlElement = XmlConfigHelper.stringToElement(xmlStr);
-      LoadersElementParser parser = new LoadersElementParser();
-      CacheLoaderConfig clConfig = parser.parseLoadersElement(xmlElement);
-      clConfig.setPreload(preload);
-      return clConfig;
+      CacheLoaderConfig clc = new CacheLoaderConfig();
+      IndividualCacheLoaderConfig iclc = new IndividualCacheLoaderConfig();
+      iclc.setClassName(cacheloaderClass);
+      iclc.setAsync(async);
+      iclc.setFetchPersistentState(fetchPersistentState);
+      iclc.setPurgeOnStartup(purgeOnStartup);
+      iclc.setIgnoreModifications(ignoreModifications);
+      iclc.setProperties(properties);
+      clc.addIndividualCacheLoaderConfig(iclc);
+      clc.setPassivation(passivation);
+      clc.setShared(shared);
+      return clc;
    }
 
    public static CacheLoaderConfig.IndividualCacheLoaderConfig buildIndividualCacheLoaderConfig(String preload, String cacheloaderClass, String properties, boolean async, boolean fetchPersistentState, boolean purgeOnStartup, boolean ignoreModifications) throws Exception

Modified: core/trunk/src/test/java/org/jboss/cache/loader/ChainingCacheLoaderBasicTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/ChainingCacheLoaderBasicTest.java	2008-07-03 12:00:22 UTC (rev 6155)
+++ core/trunk/src/test/java/org/jboss/cache/loader/ChainingCacheLoaderBasicTest.java	2008-07-03 12:00:46 UTC (rev 6156)
@@ -7,11 +7,9 @@
 package org.jboss.cache.loader;
 
 import org.jboss.cache.config.CacheLoaderConfig;
-import org.jboss.cache.config.parsing.XmlConfigHelper;
-import org.jboss.cache.config.parsing.element.LoadersElementParser;
+import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
 import org.jboss.cache.util.TestingUtil;
 import org.testng.annotations.Test;
-import org.w3c.dom.Element;
 
 import java.io.File;
 
@@ -23,8 +21,8 @@
 @Test(groups = {"functional"})
 public class ChainingCacheLoaderBasicTest extends CacheLoaderTestsBase
 {
-   private String loc1 = System.getProperty("java.io.tmpdir", ".") + File.separator + "JBossCache-ChainingCacheLoaderBasicTest-1";
-   private String loc2 = System.getProperty("java.io.tmpdir", ".") + File.separator + "JBossCache-ChainingCacheLoaderBasicTest-2";
+   private String loc1 = "JBossCache-ChainingCacheLoaderBasicTest-1";
+   private String loc2 = "JBossCache-ChainingCacheLoaderBasicTest-2";
 
    public ChainingCacheLoaderBasicTest()
    {
@@ -45,23 +43,23 @@
 
    protected CacheLoaderConfig getCacheLoaderConfig(String loc1, String loc2) throws Exception
    {
-      String xmlStr =
-            "      <loaders passivation=\"false\">\n" +
-            "         <loader class=\"org.jboss.cache.loader.FileCacheLoader\" async=\"false\" fetchPersistentState=\"true\"\n" +
-            "                      ignoreModifications=\"false\" purgeOnStartup=\"false\">\n" +
-            "            <properties>\n" +
-            "               location=" + loc1+ "\n" +
-            "            </properties>\n" +
-            "         </loader>\n" +
-            "         <loader class=\"org.jboss.cache.loader.FileCacheLoader\" async=\"false\" fetchPersistentState=\"false\"\n" +
-            "                      ignoreModifications=\"false\" purgeOnStartup=\"false\">\n" +
-            "            <properties>\n" +
-            "               location=" + loc2+ "\n" +
-            "            </properties>\n" +
-            "         </loader>\n" +
-            "      </loaders>";
-      Element element = XmlConfigHelper.stringToElement(xmlStr);
-      LoadersElementParser parser = new LoadersElementParser();
-      return parser.parseLoadersElement(element);
+      CacheLoaderConfig clc = new CacheLoaderConfig();
+      // clc 1
+      IndividualCacheLoaderConfig iclc = new IndividualCacheLoaderConfig();
+      iclc.setClassName(DummySharedInMemoryCacheLoader.class.getName());
+      iclc.setAsync(false);
+      iclc.setFetchPersistentState(true);
+      iclc.setPurgeOnStartup(false);
+      iclc.setIgnoreModifications(false);
+      iclc.setProperties("bin=" + loc1);
+      clc.addIndividualCacheLoaderConfig(iclc);
+
+      IndividualCacheLoaderConfig iclc2 = iclc.clone();
+      iclc2.setFetchPersistentState(false);
+      iclc2.setProperties("bin=" + loc2);
+      clc.addIndividualCacheLoaderConfig(iclc2);
+      clc.setPassivation(false);
+      clc.setShared(false);
+      return clc;
    }
 }




More information about the jbosscache-commits mailing list