KickJava   Java API By Example, From Geeks To Geeks.

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


1 package com.tonbeller.wcf.web;
2
3 import java.io.IOException JavaDoc;
4 import java.net.MalformedURLException JavaDoc;
5
6 import javax.xml.transform.TransformerException JavaDoc;
7
8 import org.jaxen.JaxenException;
9 import org.xml.sax.SAXException JavaDoc;
10
11 import com.meterware.httpunit.GetMethodWebRequest;
12 /**
13  * tests virtual grouping of tree nodes
14  * @author av
15  */

16 public class Tree3Test extends HttpUnitTestCase {
17
18   public Tree3Test(String JavaDoc arg0) {
19     super(arg0);
20   }
21   
22   private void check(String JavaDoc name) throws JaxenException, IOException JavaDoc, SAXException JavaDoc, TransformerException JavaDoc {
23     utils.check(name, "filter.xsl", "form01");
24   }
25   private void click(int row, int but) throws JaxenException, IOException JavaDoc, SAXException JavaDoc {
26     utils.submitCell("form01", "tree03", row, 0, but);
27   }
28   
29   void start() throws MalformedURLException JavaDoc, IOException JavaDoc, SAXException JavaDoc {
30     GetMethodWebRequest req = new GetMethodWebRequest(servletUrl + "/treedemo3.jsp");
31     req.setParameter("init", "true");
32     wc.sendRequest(req);
33   }
34   
35   public void testTreeCutPaste1() throws Exception JavaDoc {
36     start();
37     check("tree3-01");
38     // open "A"
39
click(0, 0);
40     check("tree3-02");
41     // swap a0<->a1
42
click(1, 1);
43     check("tree3-03");
44     click(2, 1);
45     check("tree3-04");
46   }
47
48   public void testTreeCutPaste2() throws Exception JavaDoc {
49     start();
50     // open a, a1, a0, a00
51
click(0, 0);
52     click(2, 0);
53     click(1, 0);
54     click(2, 0);
55     check("tree3-11");
56     
57     // cut a002
58
click(5, 1);
59     check("tree3-12");
60     // paste before a000
61
click(3, 1);
62     check("tree3-13");
63
64     // cut a001
65
click(5, 1);
66     check("tree3-14");
67     // paste after a004
68
click(7, 1);
69     check("tree3-15");
70
71     // cut a00
72
click(2, 1);
73     check("tree3-16");
74     // paste after a01
75
click(8, 1);
76     check("tree3-17");
77
78     // cut a01
79
click(2, 1);
80     check("tree3-18");
81     // collapse a00
82
click(3, 0);
83     check("tree3-19");
84     
85   }
86   
87 }
88
Popular Tags