package com.iverticalleap.util.xml;

import com.iverticalleap.test.*;

import junit.framework.*;
import com.iverticalleap.util.io.IOUtility;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.URIResolver;
import javax.xml.transform.TransformerFactory;
import org.xml.sax.InputSource;
import javax.xml.transform.sax.SAXSource;
import com.iverticalleap.util.exception.RuntimeNestedException;
import com.iverticalleap.util.text.StringUtility;
import java.io.InputStream;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Reader;
import java.net.URL;
import java.net.MalformedURLException;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.dom.DOMSource;
import org.w3c.dom.Node;
import javax.xml.transform.*;
import javax.xml.transform.Templates;
import java.io.Writer;
import com.iverticalleap.test.AbstractLoggableTestCase;

/**
 *
 *@author     Kevin Ross
 *@version    $Revision: 1.2 $ $Date: 2002/04/12 21:29:18 $
 */
public class TraxUtilityTest extends AbstractLoggableTestCase {
    
    public TraxUtilityTest(java.lang.String testName) {
        super(testName);
    }
    
    public static void main(java.lang.String[] args) {
        junit.textui.TestRunner.run(suite());
    }
    
    public static Test suite() {
        //TestSuite suite = new TestSuite(TraxUtilityTest.class);
        TestSuite suite = new TestSuite();
        //suite.addTest( new TraxUtilityTest("testTransformStringAndURL") );
        suite.addTest( new TraxUtilityTest("testGetSource") );
        
        
        return suite;
    }
    
    public void testTransformStringAndURL() throws Throwable{
        
        String xmlContent = "<root><parameterList><parameter name='x'>y</parameter></parameterList></root>";
        URL xslURL = new URL("file:/c:/temp/hello.xsl");
        System.out.println(TraxUtility.transform(xmlContent, xslURL));
    }
    
    public void testTransformAsNode() {
    }
    
    public void testGetTransformer() {
    }
    
    public void testGetNodeAsXmlString() {
    }
    
    public void testGetSource() throws Throwable{
        String fileString = getSimpleTest();
        logInformation("\n\nloaded file contents: \n" + fileString);
        logInformation("\n\ncontents after creating as node from source: \n" + TraxUtility.getXMLString(TraxUtility.getSource(fileString)));
    }
    
    public void testTransform() {
    }
    
    public void testGetXMLString() {
    }
    
    public void testGetNode() throws Throwable{
        
        String fileString = getSimpleTest();
        logInformation("loaded file contents: \n" + fileString);
    }
    
    protected String getSimpleTest() throws Throwable {
        
        return com.iverticalleap.util.io.IOUtility.getFileAsStringFromClasspath("/com/iverticalleap/util/xml/simpleTest.xml");
    }
    
    public void testGetResult() {
    }
    
}
