KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > tests > org > enhydra > wireless > voicexml > Test


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Original Code is DigitalSesame
15  * Portions created by DigitalSesame are Copyright (C) 1997-2000 DigitalSesame
16  * All Rights Reserved.
17  *
18  * Contributor(s):
19  *
20  * $Id: Test.java,v 1.2 2005/01/26 08:28:45 jkjome Exp $
21  */

22
23 package tests.org.enhydra.wireless.voicexml;
24
25 import java.io.File JavaDoc;
26 import java.io.FileOutputStream JavaDoc;
27 import java.io.IOException JavaDoc;
28
29 import org.enhydra.xml.dom.DOMInfo;
30 import org.enhydra.xml.io.DOMFormatter;
31 import org.enhydra.xml.io.OutputOptions;
32 import org.enhydra.xml.xmlc.XMLObject;
33 import org.w3c.dom.Element JavaDoc;
34
35 /**
36  * Very simple test of VoiceXML and XMLC functionality.
37  */

38 public class Test {
39     private static final String JavaDoc OUT_DIR = "output";
40     private static void output(XMLObject doc,
41                                String JavaDoc outname) throws IOException JavaDoc {
42         OutputOptions oos = new OutputOptions();
43         oos.setOmitEncoding(true);
44         oos.setJavaEncoding("ASCII");
45         DOMFormatter domf = new DOMFormatter(oos);
46         File JavaDoc ofile = new File JavaDoc(OUT_DIR, outname + ".vxml");
47         FileOutputStream JavaDoc ostream = new FileOutputStream JavaDoc(ofile);
48         domf.write(doc, ostream);
49         ostream.close();
50
51         ofile = new File JavaDoc(OUT_DIR, outname + ".dom");
52         ostream = new FileOutputStream JavaDoc(ofile);
53         DOMInfo.printTree(doc.getClass().getName(), doc, ostream);
54         ostream.close();
55     }
56
57     public static void main(String JavaDoc args[]) throws IOException JavaDoc {
58         Element JavaDoc elem;
59
60         Test1VoiceXML1VoiceXML test1VoiceXML1
61             = new Test1VoiceXML1VoiceXML();
62         elem = test1VoiceXML1.getElementForm1();
63         output(test1VoiceXML1, "test1VoiceXML1");
64
65         Test1EnhydraNuanceVoiceXML1VoiceXML test1EnhydraNuanceVoiceXML1
66             = new Test1EnhydraNuanceVoiceXML1VoiceXML();
67         elem = test1EnhydraNuanceVoiceXML1.getElementTime();
68         test1EnhydraNuanceVoiceXML1.setTextTime("12:12:12");
69         output(test1EnhydraNuanceVoiceXML1, "test1EnhydraNuanceVoiceXML1");
70
71         Test1EnhydraVoiceXML1VoiceXML test1EnhydraVoiceXML1
72             = new Test1EnhydraVoiceXML1VoiceXML();
73         elem = test1EnhydraVoiceXML1.getElementTime();
74         test1EnhydraVoiceXML1.setTextTime("12:12:12");
75         output(test1EnhydraVoiceXML1, "test1EnhydraVoiceXML1");
76
77         Test1NuanceVoiceXML1VoiceXML test1NuanceVoiceXML1
78             = new Test1NuanceVoiceXML1VoiceXML();
79         output(test1NuanceVoiceXML1, "test1NuanceVoiceXML1");
80
81         Test1TellMeVoiceXML test1TellMeVoiceXML
82             = new Test1TellMeVoiceXML();
83         output(test1TellMeVoiceXML, "test1TellMeVoiceXML");
84
85         Test2EnhydraNuanceVoiceXML1VoiceXML test2EnhydraNuanceVoiceXML1
86             = new Test2EnhydraNuanceVoiceXML1VoiceXML();
87         elem = test2EnhydraNuanceVoiceXML1.getElementTime();
88         test2EnhydraNuanceVoiceXML1.setTextTime("12:12:12");
89         output(test2EnhydraNuanceVoiceXML1, "test2EnhydraNuanceVoiceXML1");
90
91         Test2EnhydraVoiceXML1VoiceXML test2EnhydraVoiceXML1
92             = new Test2EnhydraVoiceXML1VoiceXML();
93         elem = test2EnhydraVoiceXML1.getElementTime();
94         test2EnhydraVoiceXML1.setTextTime("12:12:12");
95         output( test2EnhydraVoiceXML1, "test2EnhydraVoiceXML1");
96
97         Test2NuanceVoiceXML1VoiceXML test2NuanceVoiceXML1
98             = new Test2NuanceVoiceXML1VoiceXML();
99         output(test2NuanceVoiceXML1, "test2NuanceVoiceXML1");
100
101         Test2TellMeVoiceXML test2TellMeVoiceXML
102             = new Test2TellMeVoiceXML();
103         output(test2TellMeVoiceXML, "test2TellMeVoiceXML");
104     }
105 }
106
107
Popular Tags