01: package org.objectweb.celtix.tools.common.toolspec;
02:
03: import junit.framework.TestCase;
04: import org.objectweb.celtix.tools.common.ToolException;
05:
06: public class AbstractToolContainerTest extends TestCase {
07: private DummyToolContainer dummyTool;
08:
09: public AbstractToolContainerTest(String name) {
10: super (name);
11: }
12:
13: public void setUp() throws Exception {
14: String tsSource = "/org/objectweb/celtix/tools/common/toolspec/parser/resources/testtool.xml";
15: ToolSpec toolspec = new ToolSpec(getClass()
16: .getResourceAsStream(tsSource), false);
17: dummyTool = new DummyToolContainer(toolspec);
18: }
19:
20: public void testQuietMode() {
21: // catch all exception in here.
22: try {
23: dummyTool.setCommandLine(new String[] { "-q" });
24: } catch (Exception e) {
25: // caught expected exception
26: }
27: assertNotNull("Fail to redirect err output:", dummyTool
28: .getErrOutputStream());
29: assertNotNull("Fail to redirect output:", dummyTool
30: .getOutOutputStream());
31: }
32:
33: public void testInit() {
34: try {
35: dummyTool.init();
36: } catch (ToolException e) {
37: assertEquals(
38: "Tool specification has to be set before initializing",
39: e.getMessage());
40: return;
41: }
42: assertTrue(true);
43: }
44:
45: public void testToolRunner() throws Exception {
46: String tsSource = "/org/objectweb/celtix/tools/common/toolspec/parser/resources/testtool.xml";
47: String[] args = { "-r", "wsdlurl=dfd" };
48: ToolRunner.runTool(DummyToolContainer.class, getClass()
49: .getResourceAsStream(tsSource), false, args);
50: }
51: }
|