1 package org.apache.maven.plugin;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 import junit.framework.TestCase;
22 import org.jdom.JDOMException;
23
24 import java.io.File;
25 import java.io.IOException;
26 import java.util.Map;
27
28 /**
29 * @author Dion Gillard
30 */
31 public class PluginToTagsTest extends TestCase
32 {
33 private static final String basedir = System.getProperty("basedir");
34
35 /**
36 * test the right taglibs are found
37 * @throws JDOMException
38 * @throws IOException
39 */
40 public void testTaglibs() throws JDOMException, IOException
41 {
42 PluginToTags instance = new PluginToTags();
43 testBasedir();
44 instance.setPluginScript(basedir + "/src/test/plugin.jelly");
45 assertEquals("wrong number of taglibs", 1, instance.getTaglibs().size());
46 Map taglib = (Map)instance.getTaglibs().get(0);
47 assertEquals("bad taglib uri", "doc", taglib.get("uri"));
48 }
49
50 /**
51 * test that basedir is passed in
52 */
53 public void testBasedir()
54 {
55 assertNotNull("no basedir", basedir);
56 }
57
58 /**
59 * test the taglibs are written as a file
60 * @throws JDOMException
61 * @throws IOException
62 */
63 public void testTransform() throws JDOMException, IOException
64 {
65 PluginToTags instance = new PluginToTags();
66 testBasedir();
67 instance.setPluginScript(basedir + "/src/test/plugin.jelly");
68 instance.setXdoc(basedir + "/target/tags.xml");
69 instance.transform();
70 File outputFile = new File(instance.getXdoc());
71 assertTrue("xdoc not generated", outputFile.exists());
72 }
73
74
75 }