/**
 * JOnAS: Java(TM) Open Application Server
 * Copyright (C) 2006 Bull S.A.S.
 * Contact: jonas-team@objectweb.org
 *
 * This library 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 1any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * --------------------------------------------------------------------------
 * $Id$
 * --------------------------------------------------------------------------
 */

package org.objectweb.jonas_clusterd.tests;


import java.io.Reader;

import org.objectweb.jonas_clusterd.lib.ClusterDaemonConfigurationManager;
import org.objectweb.jonas_clusterd.xml.ClusterDaemon;

import org.objectweb.jonas_lib.deployment.tests.AbsDeploymentTest;
import org.objectweb.jonas_lib.deployment.xml.AbsElement;

/**
 * Defines a class for Cluster daemon configuration tests (clusterd.xml)
 * @author Benoit Pelletier
 */
public class ClusterDaemonConfigurationTest extends AbsDeploymentTest {

    /**
     * @return Returns the Application XML Element
     *
     * @throws Exception never thrown
     */
    public AbsElement getTopLevelElement() throws Exception {
        ClusterDaemon app = new ClusterDaemon();
        return app;
    }

    /**
     * Returns the XML document as a String.
     *
     * @param reader Reader of an clusterd.xml file
     * @param name not used
     * @param validation true/false
     *
     * @return Returns the XML document as a String.
     *
     * @throws Exception when parsing fails
     */
    public String parse(Reader reader, String name, boolean validation) throws Exception {
        ClusterDaemonConfigurationManager.setParsingWithValidation(validation);
        String xmlParsed = ClusterDaemonConfigurationManager.loadClusterDaemon(reader, "test").toXML();
        return xmlParsed;
    }


}
