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: * @(#)TestTemplateRegistry.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.io.File;
033: import java.io.FileInputStream;
034: import java.util.logging.Logger;
035: import javax.xml.transform.Source;
036: import javax.xml.transform.stream.StreamSource;
037: import javax.xml.transform.Templates;
038:
039: /**
040: * DOCUMENT ME!
041: *
042: * @author root
043: */
044: public class TestTemplateRegistry extends TestCase {
045:
046: /**
047: * DOCUMENT ME!
048: */
049: private StreamSource mSource;
050:
051: /**
052: * DOCUMENT ME!
053: */
054: private TemplateCommand mCommand;
055:
056: /**
057: * DOCUMENT ME!
058: */
059: private TemplateRegistry mTemplateRegistry;
060:
061: /**
062: * DOCUMENT ME!
063: */
064: private TemplateRegistry mTemplateRegistry2;
065:
066: /**
067: * DOCUMENT ME!
068: */
069: private String mXslt;
070:
071: /**
072: * Creates a new TestTemplateRegistry object.
073: *
074: * @param testName DOCUMENT ME!
075: */
076: public TestTemplateRegistry(java.lang.String testName) {
077: super (testName);
078: }
079:
080: /**
081: * DOCUMENT ME!
082: *
083: * @return DOCUMENT ME!
084: */
085: public static Test suite() {
086: TestSuite suite = new TestSuite(TestTemplateRegistry.class);
087: return suite;
088: }
089:
090: /**
091: * Sets up tests.
092: */
093: public void setUp() {
094: System.out.println("testSetup");
095: /*String srcroot = System.getProperty("junit.srcroot");
096:
097: try
098: {
099: mXslt = srcroot + "/engine/xslt/regress/data/test.xslt";
100: mSource = new StreamSource ( new FileInputStream(mXslt));
101: mCommand = new TemplateCommand("key1", mSource);
102: }
103: catch (Exception jbiException)
104: {
105: jbiException.printStackTrace();
106: }*/
107:
108: }
109:
110: /**
111: * Test of getRegistry method, of class com.sun.jbi.engine.xslt.util.TemplateRegistry.
112: */
113: public void testGetRegistry() {
114: /*System.out.println("testGetRegistry");
115: mTemplateRegistry = TemplateRegistry.getRegistry();
116: assertNotNull("Retrieved Template is Null", mTemplateRegistry);*/
117: }
118:
119: /**
120: * Test if the retrieved registry is the same, of class com.sun.jbi.engine.xslt.util.TemplateRegistry.
121: */
122: public void testCompareRegistry() {
123: /*System.out.println("testCompareRegistry");
124: mTemplateRegistry = TemplateRegistry.getRegistry();
125: mTemplateRegistry2 = TemplateRegistry.getRegistry();
126: assertNotNull("Retrieved Template Registry is Null", mTemplateRegistry);
127: assertNotNull("Retrieved Template Registry is Null", mTemplateRegistry2);
128: assertEquals("putTransformerfactory failed", mTemplateRegistry, mTemplateRegistry2);*/
129: }
130:
131: /**
132: * Test of get method, of class com.sun.jbi.engine.xslt.util.TemplateRegistry.
133: */
134: public void testGet() {
135: /*System.out.println("testGet");
136: TemplateCommand command = new TemplateCommand("key2", mSource);
137: command.execute();
138: mTemplateRegistry = TemplateRegistry.getRegistry();
139: Templates tpl = (Templates) mTemplateRegistry.get("key2");
140: assertNotNull("Retrieved Template is Null", tpl);*/
141: }
142:
143: /**
144: * Test of put method for class com.sun.jbi.engine.xslt.util.TemplateRegistry.
145: */
146: public void testPut() {
147: /*
148: System.out.println("testPut");
149: TemplateCommand command = new TemplateCommand("key3", mSource);
150: command.execute();
151: mTemplateRegistry = TemplateRegistry.getRegistry();
152: Templates tpl = (Templates) mTemplateRegistry.get("key3");
153: assertNotNull("Retrieved Template is Null", tpl);
154: mTemplateRegistry.put("key4", tpl);
155: Templates tpl2 = (Templates) mTemplateRegistry.get("key4");
156: assertNotNull("Template is NULL" , tpl2);
157: */
158: }
159: }
|