| 153 | } |
| 154 | |
| 155 | public static void smokeTest(){ |
| 156 | /* |
| 157 | * Start with a simple table, and then run some operations on it. |
| 158 | * Row key is seat number, column values are fields. |
| 159 | * Name President Law school |
| 160 | * 0 John G. Roberts Bush (43) Harvard |
| 161 | * 1 Sonia Sotomayor Obama Yale |
| 162 | * 2 Stephen G. Breyer Clinton Harvard |
| 163 | * 3 Elena Kagan Obama Harvard |
| 164 | * 4 Anthony M. Kennedy Reagan Harvard |
| 165 | * 6 Ruth Bader Ginsburg Clinton Columbia |
| 166 | * 8 Samuel A. Alito Bush(43) Yale |
| 167 | * 9 Antonin Scalia Reagan Harvard |
| 168 | * 10 Clarence Thomas Bush (41) Yale |
| 169 | * |
| 170 | * During the test, we make one row change (replacing Kagan with |
| 171 | * her predcessor, John Paul Stevens) and one column change |
| 172 | * (replacing the short forms of the Presidential names with |
| 173 | * longer versions). |
| 174 | */ |
| 175 | |
| 176 | // Populate database. |
| 177 | setCell(db, "0", "Name", "John G. Roberts"); |
| 178 | setCell(db, "0", "President", "Bush (43)"); |
| 179 | setCell(db, "0", "Law school", "Harvard"); |
| 180 | setCell(db, "1", "Name", "Sonia Sotomayor"); |
| 181 | setCell(db, "1", "President", "Obama"); |
| 182 | setCell(db, "1", "Law school", "Yale"); |
| 183 | setCell(db, "2", "Name", "Stephen G. Breyer"); |
| 184 | setCell(db, "2", "President", "Clinton"); |
| 185 | setCell(db, "2", "Law school", "Harvard"); |
| 186 | setCell(db, "3", "Name", "Elena Kagan"); |
| 187 | setCell(db, "3", "President", "Obama"); |
| 188 | setCell(db, "3", "Law school", "Harvard"); |
| 189 | setCell(db, "4", "Name", "Anthony M. Kennedy"); |
| 190 | setCell(db, "4", "President", "Reagan"); |
| 191 | setCell(db, "4", "Law school", "Harvard"); |
| 192 | setCell(db, "6", "Name", "Ruth Bader Ginsburg"); |
| 193 | setCell(db, "6", "President", "Clinton"); |
| 194 | setCell(db, "6", "Law school", "Columbia"); |
| 195 | setCell(db, "8", "Name", "Samuel A. Alito"); |
| 196 | setCell(db, "8", "President", "Bush (43)"); |
| 197 | setCell(db, "8", "Law school", "Yale"); |
| 198 | setCell(db, "9", "Name", "Antonin Scalia"); |
| 199 | setCell(db, "9", "President", "Reagan"); |
| 200 | setCell(db, "9", "Law school", "Harvard"); |
| 201 | setCell(db, "10", "Name", "Clarence Thomas"); |
| 202 | setCell(db, "10", "President", "Bush (41)"); |
| 203 | setCell(db, "10", "Law school", "Yale"); |
| 204 | |
| 205 | String[] rowlabs = {"0","1","2","3","4","6","8","9","10"}; |
| 206 | String[] collabs = {"Name", "President", "Law school"}; |
| 207 | |
| 208 | // Print the whole database. |
| 209 | for(String rowlab : rowlabs){ |
| 210 | for(String collab : collabs){ |
| 211 | System.out.println(getCell(db, rowlab, collab)); |
| 212 | } |