/*
 * JBoss, Home of Professional Open Source
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package org.jboss.cache.aop.loader;

import junit.framework.TestCase;
import org.w3c.dom.Element;
import org.jboss.cache.xml.XmlHelper;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Very basic test case that provides methods to create a cache loader config.
 *
 * @author <a href="mailto:manik@jboss.org">Manik Surtani (manik@jboss.org)</a>
 */
public abstract class AbstractCacheLoaderTestBase extends TestCase
{

   protected final Log log = LogFactory.getLog(getClass());

    protected Element getSingleCacheLoaderConfig(String preload, String cacheloaderClass, String properties, boolean async, boolean fetchPersistentState, boolean shared) throws Exception
    {
        String xml = "<config>\n" +
                "<passivation>false</passivation>\n" +
                "<preload>" + preload + "</preload>\n" +
                "<cacheloader>\n" +
                "<class>" + cacheloaderClass + "</class>\n" +
                "<properties>" + properties + "</properties>\n" +
                "<async>" + async + "</async>\n" +
                "<shared>" + shared + "</shared>\n" + 
                "<fetchPersistentState>" + fetchPersistentState + "</fetchPersistentState>\n" +
                "</cacheloader>\n" +
                "</config>";
        return XmlHelper.stringToElement(xml);
    }
}
