/*
 * This code is generated by blanco Framework.
 * BlancoDbXmlHandler具象化SAXクラステストクラス<br>
 */
package blanco.db.concretesax;

import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.InputStream;

import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.sax.SAXResult;
import javax.xml.transform.stream.StreamSource;

import junit.framework.TestCase;
import org.xml.sax.SAXException;

/**
 * BlancoDbXmlHandler具象化SAXクラステストクラス<br>
 * SAXを利用したXML読み込みをラッピングするクラスのテストクラスです。<br>
 * このクラスは解析用XMLファイルを入力として具象化SAXクラスとして生成されました。<br>
 * このソースコードはblancoIgにより機械的に自動生成されています。
 */
public class BlancoDbXmlHandlerTest extends TestCase {
    /**
     * テスト用のXMLデータです<br>
     * これがXML構造を解析する際の入力データでもあります。
     */
    public static final String fXmlImage = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<workbook>\n  <sheet name=\"queryName\">\n    <blancodb-common>\n      <query-type>caller</query-type>\n      <single>false</single>\n      <name>selectAll</name>\n      <scroll>forward_only</scroll>\n      <updatable>false</updatable>\n    </blancodb-common>\n    <blancodb-inparameters>\n      <inparameter>\n        <no>param1</no>\n        <name>param1</name>\n        <type>java.lang.Long</type>\n        <description>コメント</description>\n        <samplevalue>参考値</samplevalue>\n      </inparameter>\n    </blancodb-inparameters>\n    <blancodb-outparameters>\n      <outparameter>\n        <no>param1</no>\n        <name>param</name>\n        <type>float</type>\n        <description>コメント</description>\n      </outparameter>\n    </blancodb-outparameters>\n    <blancodb-detail>\n      <detail-line>detail</detail-line>\n      <detail-line>of query</detail-line>\n    </blancodb-detail>\n    <blancodb-query>\n      <query-line>select * from dula</query-line>\n      <query-line>order by a</query-line>\n    </blancodb-query>\n  </sheet>\n</workbook>\n";

    public void testHandler() throws Exception {
        SAXResult result = new SAXResult(new BlancoDbXmlHandler() {
            public void startDocument() throws SAXException {
            }

            public void endDocument() throws SAXException {
            }
            public void startElementWorkbook(String uri, String localName, String qName) throws SAXException {
                System.out.println("start: workbook");
            }

            public void endElementWorkbook(String uri, String localName, String qName) throws SAXException {
                System.out.println("end: workbook");
            }

            public void charactersWorkbook(char[] ch, int start, int length) throws SAXException {
                System.out.println("characters: workbook[" + new String(ch, start, length) + "]");
            }

            public void ignorableWhitespaceWorkbook(char[] ch, int start, int length) throws SAXException {
            }

            public void startElementSheet(String uri, String localName, String qName, String attrName) throws SAXException {
                System.out.println("start: sheet: name[" + attrName + "]");
            }

            public void endElementSheet(String uri, String localName, String qName) throws SAXException {
                System.out.println("end: sheet");
            }

            public void charactersSheet(char[] ch, int start, int length) throws SAXException {
                System.out.println("characters: sheet[" + new String(ch, start, length) + "]");
            }

            public void ignorableWhitespaceSheet(char[] ch, int start, int length) throws SAXException {
            }

            public void startElementBlancodbCommon(String uri, String localName, String qName) throws SAXException {
                System.out.println("start: blancodb-common");
            }

            public void endElementBlancodbCommon(String uri, String localName, String qName) throws SAXException {
                System.out.println("end: blancodb-common");
            }

            public void charactersBlancodbCommon(char[] ch, int start, int length) throws SAXException {
                System.out.println("characters: blancodb-common[" + new String(ch, start, length) + "]");
            }

            public void ignorableWhitespaceBlancodbCommon(char[] ch, int start, int length) throws SAXException {
            }

            public void startElementQueryType(String uri, String localName, String qName) throws SAXException {
                System.out.println("start: query-type");
            }

            public void endElementQueryType(String uri, String localName, String qName) throws SAXException {
                System.out.println("end: query-type");
            }

            public void charactersQueryType(char[] ch, int start, int length) throws SAXException {
                System.out.println("characters: query-type[" + new String(ch, start, length) + "]");
            }

            public void ignorableWhitespaceQueryType(char[] ch, int start, int length) throws SAXException {
            }

            public void startElementSingle(String uri, String localName, String qName) throws SAXException {
                System.out.println("start: single");
            }

            public void endElementSingle(String uri, String localName, String qName) throws SAXException {
                System.out.println("end: single");
            }

            public void charactersSingle(char[] ch, int start, int length) throws SAXException {
                System.out.println("characters: single[" + new String(ch, start, length) + "]");
            }

            public void ignorableWhitespaceSingle(char[] ch, int start, int length) throws SAXException {
            }

            public void startElementName(String uri, String localName, String qName) throws SAXException {
                System.out.println("start: name");
            }

            public void endElementName(String uri, String localName, String qName) throws SAXException {
                System.out.println("end: name");
            }

            public void charactersName(char[] ch, int start, int length) throws SAXException {
                System.out.println("characters: name[" + new String(ch, start, length) + "]");
            }

            public void ignorableWhitespaceName(char[] ch, int start, int length) throws SAXException {
            }

            public void startElementScroll(String uri, String localName, String qName) throws SAXException {
                System.out.println("start: scroll");
            }

            public void endElementScroll(String uri, String localName, String qName) throws SAXException {
                System.out.println("end: scroll");
            }

            public void charactersScroll(char[] ch, int start, int length) throws SAXException {
                System.out.println("characters: scroll[" + new String(ch, start, length) + "]");
            }

            public void ignorableWhitespaceScroll(char[] ch, int start, int length) throws SAXException {
            }

            public void startElementUpdatable(String uri, String localName, String qName) throws SAXException {
                System.out.println("start: updatable");
            }

            public void endElementUpdatable(String uri, String localName, String qName) throws SAXException {
                System.out.println("end: updatable");
            }

            public void charactersUpdatable(char[] ch, int start, int length) throws SAXException {
                System.out.println("characters: updatable[" + new String(ch, start, length) + "]");
            }

            public void ignorableWhitespaceUpdatable(char[] ch, int start, int length) throws SAXException {
            }

            public void startElementBlancodbInparameters(String uri, String localName, String qName) throws SAXException {
                System.out.println("start: blancodb-inparameters");
            }

            public void endElementBlancodbInparameters(String uri, String localName, String qName) throws SAXException {
                System.out.println("end: blancodb-inparameters");
            }

            public void charactersBlancodbInparameters(char[] ch, int start, int length) throws SAXException {
                System.out.println("characters: blancodb-inparameters[" + new String(ch, start, length) + "]");
            }

            public void ignorableWhitespaceBlancodbInparameters(char[] ch, int start, int length) throws SAXException {
            }

            public void startElementInparameter(String uri, String localName, String qName) throws SAXException {
                System.out.println("start: inparameter");
            }

            public void endElementInparameter(String uri, String localName, String qName) throws SAXException {
                System.out.println("end: inparameter");
            }

            public void charactersInparameter(char[] ch, int start, int length) throws SAXException {
                System.out.println("characters: inparameter[" + new String(ch, start, length) + "]");
            }

            public void ignorableWhitespaceInparameter(char[] ch, int start, int length) throws SAXException {
            }

            public void startElementNo(String uri, String localName, String qName) throws SAXException {
                System.out.println("start: no");
            }

            public void endElementNo(String uri, String localName, String qName) throws SAXException {
                System.out.println("end: no");
            }

            public void charactersNo(char[] ch, int start, int length) throws SAXException {
                System.out.println("characters: no[" + new String(ch, start, length) + "]");
            }

            public void ignorableWhitespaceNo(char[] ch, int start, int length) throws SAXException {
            }

            public void startElementType(String uri, String localName, String qName) throws SAXException {
                System.out.println("start: type");
            }

            public void endElementType(String uri, String localName, String qName) throws SAXException {
                System.out.println("end: type");
            }

            public void charactersType(char[] ch, int start, int length) throws SAXException {
                System.out.println("characters: type[" + new String(ch, start, length) + "]");
            }

            public void ignorableWhitespaceType(char[] ch, int start, int length) throws SAXException {
            }

            public void startElementDescription(String uri, String localName, String qName) throws SAXException {
                System.out.println("start: description");
            }

            public void endElementDescription(String uri, String localName, String qName) throws SAXException {
                System.out.println("end: description");
            }

            public void charactersDescription(char[] ch, int start, int length) throws SAXException {
                System.out.println("characters: description[" + new String(ch, start, length) + "]");
            }

            public void ignorableWhitespaceDescription(char[] ch, int start, int length) throws SAXException {
            }

            public void startElementSamplevalue(String uri, String localName, String qName) throws SAXException {
                System.out.println("start: samplevalue");
            }

            public void endElementSamplevalue(String uri, String localName, String qName) throws SAXException {
                System.out.println("end: samplevalue");
            }

            public void charactersSamplevalue(char[] ch, int start, int length) throws SAXException {
                System.out.println("characters: samplevalue[" + new String(ch, start, length) + "]");
            }

            public void ignorableWhitespaceSamplevalue(char[] ch, int start, int length) throws SAXException {
            }

            public void startElementBlancodbOutparameters(String uri, String localName, String qName) throws SAXException {
                System.out.println("start: blancodb-outparameters");
            }

            public void endElementBlancodbOutparameters(String uri, String localName, String qName) throws SAXException {
                System.out.println("end: blancodb-outparameters");
            }

            public void charactersBlancodbOutparameters(char[] ch, int start, int length) throws SAXException {
                System.out.println("characters: blancodb-outparameters[" + new String(ch, start, length) + "]");
            }

            public void ignorableWhitespaceBlancodbOutparameters(char[] ch, int start, int length) throws SAXException {
            }

            public void startElementOutparameter(String uri, String localName, String qName) throws SAXException {
                System.out.println("start: outparameter");
            }

            public void endElementOutparameter(String uri, String localName, String qName) throws SAXException {
                System.out.println("end: outparameter");
            }

            public void charactersOutparameter(char[] ch, int start, int length) throws SAXException {
                System.out.println("characters: outparameter[" + new String(ch, start, length) + "]");
            }

            public void ignorableWhitespaceOutparameter(char[] ch, int start, int length) throws SAXException {
            }

            public void startElementBlancodbDetail(String uri, String localName, String qName) throws SAXException {
                System.out.println("start: blancodb-detail");
            }

            public void endElementBlancodbDetail(String uri, String localName, String qName) throws SAXException {
                System.out.println("end: blancodb-detail");
            }

            public void charactersBlancodbDetail(char[] ch, int start, int length) throws SAXException {
                System.out.println("characters: blancodb-detail[" + new String(ch, start, length) + "]");
            }

            public void ignorableWhitespaceBlancodbDetail(char[] ch, int start, int length) throws SAXException {
            }

            public void startElementDetailLine(String uri, String localName, String qName) throws SAXException {
                System.out.println("start: detail-line");
            }

            public void endElementDetailLine(String uri, String localName, String qName) throws SAXException {
                System.out.println("end: detail-line");
            }

            public void charactersDetailLine(char[] ch, int start, int length) throws SAXException {
                System.out.println("characters: detail-line[" + new String(ch, start, length) + "]");
            }

            public void ignorableWhitespaceDetailLine(char[] ch, int start, int length) throws SAXException {
            }

            public void startElementBlancodbQuery(String uri, String localName, String qName) throws SAXException {
                System.out.println("start: blancodb-query");
            }

            public void endElementBlancodbQuery(String uri, String localName, String qName) throws SAXException {
                System.out.println("end: blancodb-query");
            }

            public void charactersBlancodbQuery(char[] ch, int start, int length) throws SAXException {
                System.out.println("characters: blancodb-query[" + new String(ch, start, length) + "]");
            }

            public void ignorableWhitespaceBlancodbQuery(char[] ch, int start, int length) throws SAXException {
            }

            public void startElementQueryLine(String uri, String localName, String qName) throws SAXException {
                System.out.println("start: query-line");
            }

            public void endElementQueryLine(String uri, String localName, String qName) throws SAXException {
                System.out.println("end: query-line");
            }

            public void charactersQueryLine(char[] ch, int start, int length) throws SAXException {
                System.out.println("characters: query-line[" + new String(ch, start, length) + "]");
            }

            public void ignorableWhitespaceQueryLine(char[] ch, int start, int length) throws SAXException {
            }

        });

        InputStream inStream = null;
        try {
            inStream = new BufferedInputStream(new ByteArrayInputStream(fXmlImage.getBytes()));
            TransformerFactory tf = TransformerFactory.newInstance();
            Transformer transformer = tf.newTransformer();
            transformer.transform(new StreamSource(inStream), result);
        } finally {
            if (inStream != null) {
                inStream.close();
            }
        }
    }
}
