KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > wcf > web > TreeTest


1 package com.tonbeller.wcf.web;
2
3 import java.io.IOException JavaDoc;
4
5 import javax.xml.transform.TransformerException JavaDoc;
6
7 import org.jaxen.JaxenException;
8 import org.xml.sax.SAXException JavaDoc;
9
10 import com.meterware.httpunit.GetMethodWebRequest;
11 import com.meterware.httpunit.WebForm;
12
13 public class TreeTest extends HttpUnitTestCase {
14
15   public TreeTest(String JavaDoc arg0) {
16     super(arg0);
17   }
18   
19   private void check(String JavaDoc name) throws JaxenException, IOException JavaDoc, SAXException JavaDoc, TransformerException JavaDoc {
20     utils.check(name, "filter.xsl", "form01");
21   }
22   
23   public void testTree() throws Exception JavaDoc {
24     wc.sendRequest(new GetMethodWebRequest(servletUrl + "/treedemo.jsp"));
25     check("tree-01");
26     
27     WebForm wf = wc.getCurrentPage().getFormWithID("form01");
28     // move A down
29
utils.submitCell("form01", "tree01", 0, 0, 1);
30     check("tree-02");
31     // open B
32
utils.submitCell("form01", "tree01", 0, 0, 0);
33     check("tree-03");
34     
35     // check B[1]
36
utils.setCheckBox("form01", "tree01", 2, 0, 0, true);
37     // open B[2]
38
utils.submitCell("form01", "tree01", 3, 0, 0);
39     check("tree-04");
40
41     // check B[2]
42
utils.setCheckBox("form01", "tree01", 3, 0, 0, true);
43     // move B[2] up
44
utils.submitCell("form01", "tree01", 3, 0, 1);
45     check("tree-05");
46
47     // close all B's
48
utils.submitCell("form01", "tree01", 0, 0, 0);
49     // open A
50
utils.submitCell("form01", "tree01", 1, 0, 0);
51     // delete A[2]
52
utils.submitCell("form01", "tree01", 4, 0, 3);
53     check("tree-06");
54
55   }
56
57 }
58
Popular Tags