1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.commons.jelly.tags.define;
17
18 import java.io.File;
19 import java.io.StringWriter;
20
21 import junit.framework.Test;
22 import junit.framework.TestCase;
23 import junit.framework.TestSuite;
24 import junit.textui.TestRunner;
25
26 import org.apache.commons.jelly.JellyContext;
27 import org.apache.commons.jelly.XMLOutput;
28 import org.apache.commons.logging.Log;
29 import org.apache.commons.logging.LogFactory;
30
31 /*** Tests dynamic tags
32 *
33 * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
34 * @version $Revision: 155420 $
35 */
36 public class TestDynamicTags extends TestCase {
37
38 JellyContext context = new JellyContext();
39 XMLOutput output;
40
41 /*** The Log to which logging calls will be made. */
42 private static final Log log = LogFactory.getLog(TestDynamicTags.class);
43
44 public static void main(String[] args) {
45 TestRunner.run(suite());
46 }
47
48 public static Test suite() {
49 return new TestSuite(TestDynamicTags.class);
50 }
51
52 public TestDynamicTags(String testName) {
53 super(testName);
54 }
55
56 public void testParse() throws Exception {
57 StringWriter buffer = new StringWriter();
58 output = XMLOutput.createXMLOutput(buffer);
59
60
61 runScript("src/test/org/apache/commons/jelly/tags/define/example.jelly");
62
63 log.info("The output was as follows");
64 log.info(buffer.toString());
65 }
66
67 public void testJellyBean() throws Exception {
68 StringWriter buffer = new StringWriter();
69 output = XMLOutput.createXMLOutput(buffer);
70
71 log.warn("commented out test, need to rewrite without ant");
72
73
74 log.info("The output was as follows");
75 log.info(buffer.toString());
76 }
77
78 protected void runScript(String name) throws Exception {
79 context.runScript(new File(name), output);
80 }
81 }