KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > celtix > tools > common > toolspec > AbstractToolContainerTest


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