001: /*
002: * BEGIN_HEADER - DO NOT EDIT
003: *
004: * The contents of this file are subject to the terms
005: * of the Common Development and Distribution License
006: * (the "License"). You may not use this file except
007: * in compliance with the License.
008: *
009: * You can obtain a copy of the license at
010: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011: * See the License for the specific language governing
012: * permissions and limitations under the License.
013: *
014: * When distributing Covered Code, include this CDDL
015: * HEADER in each file and include the License file at
016: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017: * If applicable add the following below this CDDL HEADER,
018: * with the fields enclosed by brackets "[]" replaced with
019: * your own identifying information: Portions Copyright
020: * [year] [name of copyright owner]
021: */
022:
023: /*
024: * @(#)TestTemplateCommand.java
025: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026: *
027: * END_HEADER - DO NOT EDIT
028: */
029: package com.sun.jbi.engine.xslt;
030:
031: import junit.framework.*;
032: import java.util.logging.Logger;
033: import javax.xml.transform.Source;
034: import javax.xml.transform.stream.StreamSource;
035: import javax.xml.transform.Templates;
036: import java.io.FileInputStream;
037:
038: /**
039: * DOCUMENT ME!
040: *
041: * @author root
042: */
043: public class TestTemplateCommand extends TestCase {
044:
045: /**
046: * DOCUMENT ME!
047: */
048: private TransformationImpl mTransformationImpl;
049: /**
050: * DOCUMENT ME!
051: */
052: private String mXslt;
053: /**
054: * DOCUMENT ME!
055: */
056: private Source mSource;
057: /**
058: * DOCUMENT ME!
059: */
060: private Source mBadSource;
061: /**
062: * DOCUMENT ME!
063: */
064: private String mBadXslt;
065:
066: /**
067: * Creates a new TestTemplateCommand object.
068: *
069: * @param testName DOCUMENT ME!
070: */
071: public TestTemplateCommand(java.lang.String testName) {
072: super (testName);
073: }
074:
075: /**
076: * DOCUMENT ME!
077: *
078: * @return DOCUMENT ME!
079: */
080: public static Test suite() {
081: TestSuite suite = new TestSuite(TestTemplateCommand.class);
082: return suite;
083: }
084:
085: /**
086: * Sets up tests.
087: */
088: public void setUp() {
089: String srcroot = System.getProperty("junit.srcroot");
090: try {
091: mXslt = srcroot + "/engine/xslt/regress/data/test.xslt";
092: mSource = new StreamSource(new FileInputStream(mXslt));
093: mBadXslt = srcroot + "/engine/xslt/regress/data/bad.xslt";
094: mBadSource = new StreamSource(new FileInputStream(mBadXslt));
095: } catch (Exception jbiException) {
096: jbiException.printStackTrace();
097: fail("Source creation failed");
098: }
099: }
100:
101: /**
102: * Test of exec method, of class com.sun.jbi.engine.xslt.TemplateCommand
103: */
104: public void testExec() {
105: System.out.println("testExec");
106: /*TemplateCommand mTemplateCommand = new TemplateCommand("key1", mSource );
107: mTemplateCommand.execute();
108: Templates tpl = (Templates)TemplateRegistry.getRegistry().get("key1");
109: assertNotNull("Template creation failed", tpl);*/
110: }
111:
112: /**
113: * Test of badXslt method, of class com.sun.jbi.engine.xslt.TemplateCommand
114: */
115: /*
116: public void testBadXslt()
117: {
118: System.out.println("testExec with bad xslt");
119: TemplateCommand mTemplateCommand = new TemplateCommand("key1", mBadSource );
120: try
121: {
122: mTemplateCommand.execute();
123: }
124: catch(Exception ex)
125: {
126: ex.printStackTrace();
127: return;
128: }
129: fail("Exception expected");
130: }
131: */
132: }
|