01: /*
02: * This file is part of the WfMOpen project.
03: * Copyright (C) 2001-2007 Danet GmbH (www.danet.de), BU BTS.
04: * All rights reserved.
05: *
06: * This program is free software; you can redistribute it and/or modify
07: * it under the terms of the GNU General Public License as published by
08: * the Free Software Foundation; either version 2 of the License, or
09: * (at your option) any later version.
10: *
11: * This program is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: * GNU General Public License for more details.
15: *
16: * You should have received a copy of the GNU General Public License
17: * along with this program; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19: *
20: * $Id: JellyTest.java,v 1.1 2007/03/22 15:49:12 schnelle Exp $
21: *
22: * $Log: JellyTest.java,v $
23: * Revision 1.1 2007/03/22 15:49:12 schnelle
24: * Component renamed.
25: *
26: * Revision 1.1 2007/03/22 13:49:11 schnelle
27: * Initial release.
28: *
29: */
30:
31: package de.danet.an.workflow.tools.test;
32:
33: import java.io.IOException;
34:
35: import org.xml.sax.SAXException;
36:
37: import de.danet.an.workflow.spis.aii.ToolAgent;
38: import de.danet.an.workflow.tools.JellyTool;
39: import de.danet.an.workflow.util.SAXEventBufferImpl;
40:
41: /**
42: * Base class for tests with the {@link JellyTool} tool.
43: *
44: * @author Dirk Schnelle
45: */
46: public class JellyTest extends ToolAgentTestBase {
47: /**
48: * Constructs a test case without a name.
49: */
50: public JellyTest() {
51: this (null);
52: }
53:
54: /**
55: * Constructs a test case with the specified name.
56: * @param name name of the test.
57: */
58: public JellyTest(String name) {
59: super (name);
60: }
61:
62: /* (non-Javadoc)
63: * Comment copied from interface or super class.
64: */
65: public ToolAgent createToolAgent() {
66: return new JellyTool();
67: }
68:
69: /**
70: * Retrieves the Jelly tool.
71: *
72: * @return The Jelly tool.
73: */
74: public JellyTool getJellyTool() {
75: return (JellyTool) getTool();
76: }
77:
78: /**
79: * Loads the Jelly script and sets it in the tool.
80: * @param script Filename of the XSL transformation to load.
81: * @throws IOException Error reading the XSLT.
82: * @throws SAXException
83: * Script error.
84: */
85: protected void loadScript(String script) throws IOException,
86: SAXException {
87: SAXEventBufferImpl buf = loadDocument(script);
88:
89: getJellyTool().setScript(buf);
90: }
91: }
|