KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jdesktop > swing > data > DefaultTableModelExtUnitTest


1 /*
2  * $Id: DefaultTableModelExtUnitTest.java,v 1.3 2005/02/07 12:54:38 kleopatra 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.swing.data;
9
10 import java.beans.PropertyChangeEvent JavaDoc;
11 import java.beans.PropertyChangeListener JavaDoc;
12
13 import java.io.InputStream JavaDoc;
14 import java.io.IOException JavaDoc;
15
16 import java.net.MalformedURLException JavaDoc;
17 import java.net.URL JavaDoc;
18
19 import java.util.ArrayList JavaDoc;
20 import java.util.Locale JavaDoc;
21
22 import javax.swing.SwingUtilities JavaDoc;
23 import javax.swing.event.TableModelEvent JavaDoc;
24 import javax.swing.event.TableModelListener JavaDoc;
25
26 import junit.framework.Test;
27 import junit.framework.TestCase;
28 import junit.framework.TestSuite;
29
30 import org.jdesktop.swing.event.ProgressEvent;
31 import org.jdesktop.swing.event.ProgressListener;
32
33
34 /**
35  * JUnit test class for tabular data model.
36  *
37  * @author Amy Fowler
38  */

39 public class DefaultTableModelExtUnitTest extends TestCase {
40
41     // Ideally test data should be placed in a separate jar
42
private static final String JavaDoc PREFIX = "/org/jdesktop/swing/resources/";
43
44     private static final String JavaDoc BUGDATA = PREFIX + "bugdata.txt";
45     public static String JavaDoc DATA_URL_STR;
46
47     private static final String JavaDoc STRINGDATA = PREFIX + "stringdata.csv";
48     private static final String JavaDoc STRINGDATA2 = PREFIX + "stringdata2.txt";
49     public static String JavaDoc STRINGDATA_URL_STR;
50     public static String JavaDoc STRINGDATA2_URL_STR;
51     public static final String JavaDoc STRINGDATA_COL_NAMES[] = {"firstname",
52             "lastname", "street", "city", "state", "zipcode", "phonenumber"};
53
54     public URL JavaDoc dataURL;
55     public URL JavaDoc stringDataURL;
56     public URL JavaDoc stringData2URL;
57
58     public static void verifyTabularDataModelProperties(DefaultTableModelExt data,
59         int columnCount,
60         int rowCount,
61         URL JavaDoc sourceURL,
62         DataLoader loader,
63         boolean loading) {
64
65         assertEquals(columnCount, data.getColumnCount());
66         assertEquals(rowCount, data.getRowCount());
67         assertEquals(sourceURL, data.getSource());
68         DataLoader theLoader = data.getLoader();
69         if (loader == null) {
70             assertEquals(loader, theLoader);
71         }
72         else {
73             assertEquals(loader.getClass(), theLoader.getClass());
74         }
75         assertEquals(loading, data.isLoading());
76
77     }
78
79     public static void verifyTabularDataTextLoaderProperties(
80         TableModelExtTextLoader loader,
81         String JavaDoc columnDelimiter,
82         boolean columnNamesInFirstRow,
83         int blockIncrementSize) {
84         assertEquals(columnDelimiter, loader.getColumnDelimiter());
85         assertEquals(columnNamesInFirstRow, loader.isFirstRowHeader());
86         assertEquals(blockIncrementSize, loader.getBlockIncrementSize());
87     }
88
89
90     public void setUp() throws Exception JavaDoc {
91         super.setUp();
92         System.setProperty(DataLoader.READER_PRIORITY_KEY, String
93                 .valueOf(Thread.NORM_PRIORITY));
94
95
96         dataURL = DefaultTableModelExtUnitTest.class.getResource(BUGDATA);
97         DATA_URL_STR = dataURL.toExternalForm();
98
99         stringDataURL = DefaultTableModelExtUnitTest.class.getResource(STRINGDATA);
100         STRINGDATA_URL_STR = stringDataURL.toExternalForm();
101
102         stringData2URL = DefaultTableModelExtUnitTest.class.getResource(STRINGDATA2);
103         STRINGDATA2_URL_STR = stringData2URL.toExternalForm();
104
105         // get the event dispatch thread spinning, else the data load can hang
106
SwingUtilities.invokeLater(new Runnable JavaDoc() {
107                 public void run() {
108                     ;
109                 }
110             });
111     }
112
113     
114     protected void tearDown() throws Exception JavaDoc {
115         System.getProperties().remove(DataLoader.READER_PRIORITY_KEY);
116
117         super.tearDown();
118     }
119     public void testTabularDataModelConstructors() {
120         DefaultTableModelExt data = null;
121
122         data = new DefaultTableModelExt();
123         verifyTabularDataModelProperties(data, 0, 0, null,
124                                          new TableModelExtTextLoader(),
125                                          false);
126
127         data = new DefaultTableModelExt(5);
128         verifyTabularDataModelProperties(data, 5, 0, null,
129                                          new TableModelExtTextLoader(),
130                                          false);
131
132         try {
133             data = new DefaultTableModelExt(DATA_URL_STR);
134             verifyTabularDataModelProperties(data, 8, 0, dataURL,
135                                          new TableModelExtTextLoader(),
136                                          false);
137         }
138         catch (MalformedURLException JavaDoc e) {
139             fail("testConstructors MalFormedURLException: url="+DATA_URL_STR);
140         }
141
142         try {
143             data = new DefaultTableModelExt(DATA_URL_STR, 8);
144             verifyTabularDataModelProperties(data, 8, 0, dataURL,
145                                  new TableModelExtTextLoader(),
146                                  false);
147         }
148         catch (MalformedURLException JavaDoc e) {
149             fail("testConstructors MalFormedURLException: url="+DATA_URL_STR);
150         }
151
152     }
153
154     public void testTabularDataModelProperties() {
155         DefaultTableModelExt data = new DefaultTableModelExt();
156         data.setColumnCount(10);
157         data.setSource(dataURL);
158         DataLoader dummyLoader = new DummyDataLoader();
159         data.setLoader(dummyLoader);
160
161         verifyTabularDataModelProperties(data, 10, 0, dataURL,
162                                          dummyLoader, false);
163
164         try {
165             data.setColumnCount( -2);
166             fail("should not allow setting columnCount to negative number");
167         } catch (IllegalArgumentException JavaDoc e) {
168             // success
169
}
170     }
171
172     public void testTabularDataModelColumnMetaData() {
173         int columnCount = 3;
174         DefaultTableModelExt data = new DefaultTableModelExt(columnCount);
175
176         for (int i = 0; i < columnCount; i ++) {
177             MetaData metaData = data.getColumnMetaData(i);
178             assertNotNull(metaData);
179             assertEquals(String JavaDoc.class, metaData.getElementClass());
180             assertEquals("column"+i, metaData.getName());
181             assertEquals(String JavaDoc.class, data.getColumnClass(i));
182             assertEquals("column"+i, data.getColumnName(i)); // by default label == name
183

184             MetaData newMetaData = new MetaData("field"+i, Integer JavaDoc.class);
185             data.setColumnMetaData(i, newMetaData);
186             metaData = data.getColumnMetaData(i);
187             assertEquals(newMetaData, metaData);
188             assertEquals(Integer JavaDoc.class, data.getColumnClass(i));
189             assertEquals("field"+i, data.getColumnName(i)); // by default label == name
190
}
191     }
192
193     public void testTabularDataModelLoading() {
194         DefaultTableModelExt data = null;
195         try {
196             data = new DefaultTableModelExt(DATA_URL_STR);
197
198             // verify the tabular data model is generating proper insert events
199
final TableModelEventTracker tracker = new TableModelEventTracker(1) {
200                 private int rowCount = 0;
201                 public void tableChanged(TableModelEvent JavaDoc e) {
202                     if (e.getType() == TableModelEvent.INSERT) {
203                         rowCount += (e.getLastRow() - e.getFirstRow());
204                         if (rowCount == 1275) {
205                             gotEvent[0] = true;
206                         }
207                     }
208                 }
209             };
210             data.addTableModelListener(tracker);
211
212             PropertyChangeListener JavaDoc pcl = new PropertyChangeListener JavaDoc() {
213                 private boolean doingLoad = false;
214                 public void propertyChange(PropertyChangeEvent JavaDoc e) {
215                     DefaultTableModelExt data = (DefaultTableModelExt)e.getSource();
216                     if (e.getPropertyName().equals("loading")) {
217                         boolean loading = ((Boolean JavaDoc)e.getNewValue()).booleanValue();
218                         if (!doingLoad && loading) {
219                             doingLoad = true;
220                         }
221                         if (doingLoad && !loading) {
222                             // we're done loading now, check rowcount
223
int count = data.getColumnCount();
224                             assertEquals("ERROR: columnCount should be 8 != " + count,
225                      8, count);
226                 count = data.getRowCount();
227                             assertEquals("ERROR: rowCount should be 1275 == " + count,
228                      1275, count);
229                             assertTrue(tracker.gotEvent[0]);
230                             data.removePropertyChangeListener(this);
231                         }
232                     }
233                 }
234             };
235             data.addPropertyChangeListener(pcl);
236
237             data.startLoading();
238         }
239         catch (Exception JavaDoc e) {
240             fail("testTabularDataModelLoading: exception: msg="+e.getMessage());
241         }
242
243         // Now test firstRowHeader property on loader
244
try {
245             data = new DefaultTableModelExt(stringDataURL);
246             TableModelExtTextLoader loader = (TableModelExtTextLoader) data.
247                 getLoader();
248             loader.setColumnDelimiter(",");
249             loader.setFirstRowHeader(true);
250         } catch (Exception JavaDoc e) {
251             fail("testTabularDataModelLoading: "+STRINGDATA_URL_STR+" "+e.getMessage());
252         }
253         assertEquals(7, data.getColumnCount());
254         assertEquals("firstname", data.getColumnName(0));
255         assertEquals("lastname", data.getColumnName(1));
256         assertEquals("street", data.getColumnName(2));
257         assertEquals("city", data.getColumnName(3));
258         assertEquals("state", data.getColumnName(4));
259         assertEquals("zipcode", data.getColumnName(5));
260         assertEquals("phonenumber", data.getColumnName(6));
261
262         try {
263             data.startLoading();
264         } catch (Exception JavaDoc e) {
265             fail("testTabularDataModelLoading: "+STRINGDATA_URL_STR+" "+e.getMessage());
266         }
267
268         while(data.isLoading());
269
270         assertEquals(10, data.getRowCount());
271     }
272
273     public void testTabularDataModelInsert() {
274         final int listRowCount = 3;
275         DefaultTableModelExt data = new DefaultTableModelExt(3);
276         Object JavaDoc row[] = {"John", "Doe", new Integer JavaDoc(25)};
277         Object JavaDoc dataRow[] = null;
278         ArrayList JavaDoc rowList = new ArrayList JavaDoc();
279         for(int i = 0; i < listRowCount; i++) {
280             rowList.add(row);
281         }
282
283         // verify the tabular data model is generating proper insert events
284
TableModelEventTracker tracker = new TableModelEventTracker(4) {
285             public void tableChanged(TableModelEvent JavaDoc e) {
286                 if (e.getType() == TableModelEvent.INSERT) {
287                     if (e.getFirstRow() == 0 && e.getLastRow() == 0) {
288                         gotEvent[0] = true;
289                     }
290                     if (e.getFirstRow() == 1 && e.getLastRow() == listRowCount) {
291                         gotEvent[1] = true;
292                     }
293                     if (e.getFirstRow() == 3 && e.getLastRow() == 3) {
294                         gotEvent[2] = true;
295                     }
296                     if (e.getFirstRow() == 2 && e.getLastRow() == listRowCount+1) {
297                         gotEvent[3] = true;
298                     }
299                 }
300             }
301         };
302         data.addTableModelListener(tracker);
303
304         // test 0
305
data.addRow(row);
306         assertEquals(1, data.getRowCount());
307         dataRow = data.getRow(0);
308         assertEquals(row, dataRow);
309         // verify copy
310
assertNotSame(row, dataRow);
311         assertTrue(tracker.gotEvent[0]);
312
313         // test 1
314
row[0] = "Jane";
315         data.addRows(rowList);
316         assertEquals(1+listRowCount, data.getRowCount());
317         for(int i = 1; i < listRowCount+1; i++) {
318             dataRow = data.getRow(i);
319             assertEquals(row, dataRow);
320             // verify copy
321
assertNotSame(row, dataRow);
322         }
323         assertTrue(tracker.gotEvent[1]);
324
325         // test 2
326
row[1] = "Smith";
327         data.insertRow(3, row);
328         assertEquals(2+listRowCount, data.getRowCount());
329         dataRow = data.getRow(3);
330         assertEquals(row, dataRow);
331         // verify copy
332
assertNotSame(row, dataRow);
333         assertTrue(tracker.gotEvent[2]);
334
335         // test 3
336
row[0] = "Jim";
337         data.insertRows(2, rowList);
338         assertEquals(2+(2*listRowCount), data.getRowCount());
339         for(int i = 2; i < listRowCount+2; i++) {
340             dataRow = data.getRow(i);
341             assertEquals(row, dataRow);
342             // verify copy
343
assertNotSame(row, dataRow);
344         }
345         assertTrue(tracker.gotEvent[3]);
346     }
347
348     public void testTabularDataModelDelete() {
349
350         Object JavaDoc dataRow[] = null;
351         int rowCount = 10;
352         DefaultTableModelExt data = initializeSimpleTabularDataModel(rowCount);
353
354         // verify the tabular data model is generating proper delete events
355
TableModelEventTracker tracker = new TableModelEventTracker(2) {
356              public void tableChanged(TableModelEvent JavaDoc e) {
357                  if (e.getType() == TableModelEvent.DELETE) {
358                      if (e.getFirstRow() == 0 && e.getLastRow() == 0) {
359                          gotEvent[0] = true;
360                      }
361                      if (e.getFirstRow() == 0 && e.getLastRow() == 3) {
362                          gotEvent[1] = true;
363                      }
364                  }
365              }
366          };
367          data.addTableModelListener(tracker);
368
369         // test 0: delete first row
370
data.deleteRow(0);
371         assertEquals(rowCount-1, data.getRowCount());
372         // ensure correct one was deleted
373
dataRow = data.getRow(0);
374         assertEquals("value1", dataRow[0]);
375         assertEquals(new Integer JavaDoc(1), dataRow[1]);
376         assertTrue(tracker.gotEvent[0]);
377
378         // test 1: delete range of rows
379
data.deleteRows(0,3);
380         assertEquals(rowCount-5, data.getRowCount());
381         assertTrue(tracker.gotEvent[1]);
382
383         // test 2: delete last row
384
data.deleteRow(data.getRowCount()-1);
385         assertEquals(rowCount-6, data.getRowCount());
386
387     }
388
389     public void testTabularDataModelGetValue() {
390         int rowCount = 10;
391         DefaultTableModelExt data = initializeSimpleTabularDataModel(rowCount);
392
393         assertEquals("value1", (String JavaDoc)data.getValueAt(1, 0));
394         assertEquals(new Integer JavaDoc(0), (Integer JavaDoc)data.getValueAt(0, 1));
395         assertEquals(Boolean.TRUE, (Boolean JavaDoc)data.getValueAt(3, 2));
396         assertEquals(new Float JavaDoc(5*3.3), (Float JavaDoc)data.getValueAt(5, 3));
397         assertEquals(new Long JavaDoc(9+5555), (Long JavaDoc)data.getValueAt(9, 4));
398
399     }
400
401     public void testTabularDataModelSetValue() {
402         int rowCount = 10;
403         DefaultTableModelExt data = initializeSimpleTabularDataModel(rowCount);
404
405         // verify the tabular data model is generating proper change events
406
TableModelEventTracker tracker = new TableModelEventTracker(2) {
407             public void tableChanged(TableModelEvent JavaDoc e) {
408                 if (e.getType() == TableModelEvent.UPDATE) {
409                     if (e.getFirstRow() == 0 && e.getLastRow() == 0 &&
410                         e.getColumn() == 0) {
411                         gotEvent[0] = true;
412                     }
413                     if (e.getFirstRow() == 5 && e.getLastRow() == 5 &&
414                         e.getColumn() == 2) {
415                         gotEvent[1] = true;
416                     }
417                 }
418             }
419         };
420         data.addTableModelListener(tracker);
421
422         // test 0
423
data.setValueAt("string0", 0, 0);
424         assertEquals("string0", (String JavaDoc)data.getValueAt(0,0));
425         assertTrue(tracker.gotEvent[0]);
426
427         // test 1
428
data.setValueAt(Boolean.FALSE, 5, 2);
429         assertEquals(Boolean.FALSE, (Boolean JavaDoc)data.getValueAt(5,2));
430         assertTrue(tracker.gotEvent[1]);
431     }
432
433     public void testTabularDataModelgetColumnIndex() {
434         int rowCount = 5;
435         DefaultTableModelExt data = initializeSimpleTabularDataModel(rowCount);
436
437         assertEquals(0, data.getColumnIndex("stringcolumn"));
438         assertEquals(4, data.getColumnIndex("longcolumn"));
439
440         try {
441             data.getColumnIndex("whichcolumn");
442             fail("getColumnIndex should throw IllegalArgumentException");
443         } catch (IllegalArgumentException JavaDoc e) {
444             // success
445
}
446     }
447
448     public void testTabularDataModelgetColumnName() {
449         int rowCount = 5;
450         DefaultTableModelExt data = initializeSimpleTabularDataModel(rowCount);
451
452         // note that getColumnName actually returns the *label*, not the name/id
453
assertEquals("Strings", data.getColumnName(0));
454         assertEquals("Integers", data.getColumnName(1));
455         assertEquals("Booleans", data.getColumnName(2));
456         assertEquals("Floats", data.getColumnName(3));
457         assertEquals("Longs", data.getColumnName(4));
458     }
459
460
461     public void testTabularDataTextLoaderConstructors() {
462         TableModelExtTextLoader loader = new TableModelExtTextLoader();
463         verifyTabularDataTextLoaderProperties(loader, "\t", false, 50);
464
465         loader = new TableModelExtTextLoader("foo", true, 100);
466         verifyTabularDataTextLoaderProperties(loader, "foo", true, 100);
467     }
468
469     public void testTabularDataTextLoaderProperties() {
470         TableModelExtTextLoader loader = new TableModelExtTextLoader();
471         loader.setBlockIncrementSize(25);
472         loader.setColumnDelimiter("bar");
473         loader.setFirstRowHeader(true);
474         verifyTabularDataTextLoaderProperties(loader, "bar", true, 25);
475     }
476
477     public void testTabularDataTextLoaderInitializeMetaData() {
478         DefaultTableModelExt data = new DefaultTableModelExt();
479         TableModelExtTextLoader loader = new TableModelExtTextLoader(",", true,
480             100);
481         try {
482             final InputStream JavaDoc is = stringDataURL.openStream();
483             loader.loadMetaData(data, is);
484
485             int columnCount = data.getColumnCount();
486             assertEquals(7, columnCount);
487             for (int i = 0; i < columnCount; i++) {
488                 MetaData metaData = data.getColumnMetaData(i);
489                 assertEquals(STRINGDATA_COL_NAMES[i], metaData.getName());
490             }
491         } catch (Exception JavaDoc e) {
492             fail("testTabularDataTextLoaderInitializeMetaData exception: msg="+e.getMessage());
493         }
494     }
495
496     /** PENDING: this hangs occasionally - need to investigate.
497      * doesn't help to comment - if done can hang in other methods as well
498      *
499      */

500     public void testTabularDataTextLoaderStartLoading() {
501         DefaultTableModelExt data = new DefaultTableModelExt();
502         TableModelExtTextLoader loader = new TableModelExtTextLoader(",", true, 3);
503         try {
504             InputStream JavaDoc is = stringDataURL.openStream();
505             ProgressTracker progressTracker = new ProgressTracker();
506             loader.addProgressListener(progressTracker);
507             loader.loadMetaData(data, is);
508             is.close();
509
510             is = stringDataURL.openStream();
511             loader.startLoading(data, is);
512
513             while(!progressTracker.done && progressTracker.error == null);
514
515             assertTrue(progressTracker.done);
516             assertEquals(10, data.getRowCount());
517             assertEquals("Gibson", (String JavaDoc)data.getValueAt(7,1));
518         } catch (Exception JavaDoc e) {
519             fail("testTabularDataTextLoaderStartLoading exception: msg="+e.getMessage());
520         }
521
522         data = new DefaultTableModelExt();
523         loader = new TableModelExtTextLoader("boo", false, 10);
524         try {
525             InputStream JavaDoc is = stringData2URL.openStream();
526             ProgressTracker progressTracker = new ProgressTracker();
527             loader.addProgressListener(progressTracker);
528             loader.loadMetaData(data, is);
529             is.close();
530
531             is = stringData2URL.openStream();
532             loader.startLoading(data, is);
533
534             while (!progressTracker.done && progressTracker.error == null);
535
536             assertTrue(progressTracker.done);
537             assertEquals(30, data.getRowCount());
538             assertEquals("two", (String JavaDoc) data.getValueAt(0, 1));
539             assertEquals("5", (String JavaDoc)data.getValueAt(1,4));
540             assertEquals("first", (String JavaDoc)data.getValueAt(5, 0));
541             assertEquals("six", (String JavaDoc)data.getValueAt(9,5));
542         }
543         catch (Exception JavaDoc e) {
544             fail("testTabularDataTextLoaderStartLoading exception: msg=" +
545                  e.getMessage());
546         }
547     }
548
549     public void assertEquals(Object JavaDoc[] expected, Object JavaDoc[] actual) {
550         assertEquals(expected.length, actual.length);
551         for(int i = 0; i < expected.length; i++) {
552             assertEquals(expected[i], actual[i]);
553         }
554     }
555
556     protected DefaultTableModelExt initializeSimpleTabularDataModel(int rowCount) {
557         int columnCount = 5;
558         DefaultTableModelExt data = new DefaultTableModelExt(columnCount);
559         data.getColumnMetaData(0).setName("stringcolumn");
560         data.getColumnMetaData(0).setLabel("Strings");
561         data.getColumnMetaData(1).setName("intcolumn");
562         data.getColumnMetaData(1).setLabel("Integers");
563         data.getColumnMetaData(2).setName("booleancolumn");
564         data.getColumnMetaData(2).setLabel("Booleans");
565         data.getColumnMetaData(3).setName("floatcolumn");
566         data.getColumnMetaData(3).setLabel("Floats");
567         data.getColumnMetaData(4).setName("longcolumn");
568         data.getColumnMetaData(4).setLabel("Longs");
569
570         data.getColumnMetaData(1).setElementClass(Integer JavaDoc.class);
571         data.getColumnMetaData(2).setElementClass(Boolean JavaDoc.class);
572         data.getColumnMetaData(3).setElementClass(Float JavaDoc.class);
573         data.getColumnMetaData(4).setElementClass(Long JavaDoc.class);
574
575         for (int i = 0; i < rowCount; i++) {
576             Object JavaDoc row[] = new Object JavaDoc[columnCount];
577             row[0] = "value" + i;
578             row[1] = new Integer JavaDoc(i);
579             row[2] = Boolean.TRUE;
580             row[3] = new Float JavaDoc(i*3.3);
581             row[4] = new Long JavaDoc(i+5555);
582             data.addRow(row);
583         }
584         return data;
585     }
586
587     private class DummyDataLoader extends DataLoader {
588         public void loadMetaData(Object JavaDoc model, InputStream JavaDoc is) {
589
590         }
591         public void readData(InputStream JavaDoc is) throws IOException JavaDoc,
592             ConversionException {
593         }
594         public void loadData(Object JavaDoc model) {
595         }
596
597     }
598
599     private abstract class TableModelEventTracker implements TableModelListener JavaDoc {
600         public boolean gotEvent[];
601         public TableModelEventTracker(int testCount) {
602             gotEvent = new boolean[testCount];
603             for(int i = 0; i < gotEvent.length; i++) {
604                 gotEvent[i] = false;
605             }
606         }
607         public abstract void tableChanged(TableModelEvent JavaDoc e);
608     }
609
610 /*
611     private class ProgressTracker implements ProgressListener {
612         public boolean done;
613         public Throwable error;
614         public ProgressTracker() {
615             done = false;
616             error = null;
617         }
618         public void inProgress(ProgressEvent event) {
619             if (event.isComplete()) {
620                 done = true;
621             }
622         }
623         public void errorOccurred(ProgressEvent event) {
624             error = event.getError();
625         }
626     }
627  */

628     private class ProgressTracker implements ProgressListener {
629         public boolean done;
630         public Throwable JavaDoc error;
631         public ProgressTracker() {
632             done = false;
633             error = null;
634         }
635         public void progressStarted(ProgressEvent e) {
636
637         }
638         public void progressIncremented(ProgressEvent e) {
639
640         }
641         public void progressEnded(ProgressEvent evt) {
642             done = true;
643         }
644         public void exception(ProgressEvent evt) {
645             error = evt.getThrowable();
646         }
647     }
648
649     /**
650      * nothing interactive, should not be run via main
651      */

652 // public static void main(String args[]) throws Exception {
653
// DefaultTableModelExtUnitTest test = new DefaultTableModelExtUnitTest();
654
// test.setUp();
655
//
656
// // DefaultTableModelExt tests
657
// test.testTabularDataModelColumnMetaData();
658
// test.testTabularDataModelConstructors();
659
// test.testTabularDataModelDelete();
660
// test.testTabularDataModelgetColumnIndex();
661
// test.testTabularDataModelgetColumnName();
662
// test.testTabularDataModelGetValue();
663
// test.testTabularDataModelInsert();
664
// test.testTabularDataModelLoading();
665
// test.testTabularDataModelProperties();
666
// test.testTabularDataModelSetValue();
667
//
668
// // TableModelExtTextLoader tests
669
//
670
// test.testTabularDataTextLoaderConstructors();
671
// test.testTabularDataTextLoaderInitializeMetaData();
672
// test.testTabularDataTextLoaderProperties();
673
// test.testTabularDataTextLoaderStartLoading();
674
// }
675

676 }
677
Popular Tags