KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jdesktop > dataset > DataRelationTableTest


1 /*
2  * $Id: DataRelationTableTest.java,v 1.2 2005/02/25 19:46:06 rbair Exp $
3  *
4  * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
5  * Santa Clara, California 95054, U.S.A. All rights reserved.
6  */

7
8 package org.jdesktop.dataset;
9
10 import junit.framework.*;
11
12
13 /**
14  *
15  * @author rbair
16  */

17 public class DataRelationTableTest extends TestCase {
18     
19     private DataSet ds;
20     private DataRelation relation;
21     private DataTable parentTable;
22     private DataTable childTable;
23
24     public DataRelationTableTest(String JavaDoc testName) {
25         super(testName);
26     }
27     
28     // TODO add test methods here. The name must begin with 'test'. For example:
29
// public void testHello() {}
30

31     protected void setUp() throws Exception JavaDoc {
32         ds = new DataSet();
33         relation = ds.createRelation();
34         
35         parentTable = ds.createTable();
36         DataColumn parentColumn = parentTable.createColumn();
37         parentColumn.setName("pid");
38         relation.setParentColumn(parentColumn);
39         parentTable.appendRow().setValue("pid", 100);
40         parentTable.appendRow().setValue("pid", 101);
41         parentTable.appendRow().setValue("pid", 102);
42         parentTable.createSelector().setName("parentSelector");
43         
44         childTable = ds.createTable();
45         DataColumn childColumn = childTable.createColumn();
46         childColumn.setName("cid");
47         childColumn = childTable.createColumn();
48         childColumn.setName("pid");
49         relation.setChildColumn(childColumn);
50         DataRow row = childTable.appendRow();
51         row.setValue("cid", 200);
52         row.setValue("pid", 100);
53         row = childTable.appendRow();
54         row.setValue("cid", 201);
55         row.setValue("pid", 101);
56         row = childTable.appendRow();
57         row.setValue("cid", 202);
58         row.setValue("pid", 101);
59         row = childTable.appendRow();
60         row.setValue("cid", 203);
61         row.setValue("pid", 100);
62         row = childTable.appendRow();
63         row.setValue("cid", 204);
64         row.setValue("pid", 100);
65         row = childTable.appendRow();
66         row.setValue("cid", 205);
67         row.setValue("pid", 102);
68     }
69
70     protected void tearDown() throws Exception JavaDoc {
71     }
72
73     public static Test suite() {
74         TestSuite suite = new TestSuite(DataRelationTableTest.class);
75         
76         return suite;
77     }
78
79     /**
80      * Test of getRelation method, of class org.jdesktop.dataset.DataRelationTable.
81      */

82     public void testGetRelation() {
83         System.out.println("testGetRelation");
84         
85         // TODO add your test code below by replacing the default call to fail.
86
// fail("The test case is empty.");
87
}
88
89     /**
90      * Test of getSelector method, of class org.jdesktop.dataset.DataRelationTable.
91      */

92     public void testGetSelector() {
93         System.out.println("testGetSelector");
94         
95         // TODO add your test code below by replacing the default call to fail.
96
// fail("The test case is empty.");
97
}
98
99     /**
100      * Test of setDataProvider method, of class org.jdesktop.dataset.DataRelationTable.
101      */

102     public void testSetDataProvider() {
103         System.out.println("testSetDataProvider");
104         
105         // TODO add your test code below by replacing the default call to fail.
106
// fail("The test case is empty.");
107
}
108
109     /**
110      * Test of save method, of class org.jdesktop.dataset.DataRelationTable.
111      */

112     public void testSave() {
113         System.out.println("testSave");
114         
115         // TODO add your test code below by replacing the default call to fail.
116
// fail("The test case is empty.");
117
}
118
119     /**
120      * Test of appendRow method, of class org.jdesktop.dataset.DataRelationTable.
121      */

122     public void testAppendRow() {
123         System.out.println("testAppendRow");
124         
125         // TODO add your test code below by replacing the default call to fail.
126
// fail("The test case is empty.");
127
}
128
129     /**
130      * Test of refresh method, of class org.jdesktop.dataset.DataRelationTable.
131      */

132     public void testRefresh() {
133         System.out.println("testRefresh");
134         
135         // TODO add your test code below by replacing the default call to fail.
136
// fail("The test case is empty.");
137
}
138     
139 }
Popular Tags