1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.commons.jelly.tags.junit;
17
18 import org.apache.commons.jelly.TagLibrary;
19
20 import org.apache.commons.jelly.JellyException;
21 import org.apache.commons.jelly.TagLibrary;
22 import org.apache.commons.jelly.expression.Expression;
23 import org.apache.commons.jelly.expression.ExpressionFactory;
24 import org.apache.commons.jelly.impl.TagScript;
25 import org.apache.commons.jelly.expression.xpath.XPathExpression;
26
27 import org.apache.commons.logging.Log;
28 import org.apache.commons.logging.LogFactory;
29
30 import org.jaxen.JaxenException;
31
32 /*** Describes the Taglib. This class could be generated by XDoclet
33 *
34 * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
35 * @version $Revision: 1.5 $
36 */
37 public class JUnitTagLibrary extends TagLibrary {
38
39 /*** The Log to which logging calls will be made. */
40 private Log log = LogFactory.getLog(JUnitTagLibrary.class);
41
42 public JUnitTagLibrary() {
43 registerTag("assert", AssertTag.class);
44 registerTag("assertEquals", AssertEqualsTag.class);
45 registerTag("assertThrows", AssertThrowsTag.class);
46 registerTag("fail", FailTag.class);
47 registerTag("run", RunTag.class );
48 registerTag("case", CaseTag.class );
49 registerTag("suite", SuiteTag.class );
50 }
51
52 public Expression createExpression(
53 ExpressionFactory factory,
54 TagScript tagScript,
55 String attributeName,
56 String attributeValue) throws JellyException {
57
58
59
60 if (attributeName.equals("xpath")) {
61 if ( log.isDebugEnabled() ) {
62 log.debug( "Parsing XPath expression: " + attributeValue );
63 }
64
65
66 Expression xpathExpr = super.createExpression( factory,
67 tagScript,
68 attributeName,
69 attributeValue );
70
71 return new XPathExpression(attributeValue, xpathExpr, tagScript);
72 }
73
74
75 return super.createExpression(factory, tagScript, attributeName, attributeValue);
76 }
77 }