Revision 20420 trunk/libraries/libDataSourceDBBaseDrivers/src-test/org/gvsig/data/datastores/vectorial/db/jdbc/h2/H2Test.java

View differences:

H2Test.java
27 27
import org.gvsig.data.vectorial.IFeatureStore;
28 28
import org.gvsig.data.vectorial.IFeatureStoreExplorer;
29 29
import org.gvsig.data.vectorial.IFeatureType;
30
import org.gvsig.data.vectorial.IsNotAttributeSettingException;
30 31
import org.gvsig.data.vectorial.IsNotFeatureSettingException;
31 32
import org.gvsig.exceptions.BaseException;
32 33
import org.h2.tools.Server;
......
146 147
		} catch (OpenException e2) {
147 148
			e2.printStackTrace();
148 149
			fail();
149
		} catch (IsNotFeatureSettingException e) {
150
			// TODO Auto-generated catch block
151
			e.printStackTrace();
152 150
		}
153 151

  
154 152
		IFeatureType ft= fs.getDefaultFeatureType();
......
158 156
		} catch (ReadException e2) {
159 157
			// TODO Auto-generated catch block
160 158
			e2.printStackTrace();
161
		} catch (IsNotFeatureSettingException e) {
162
			// TODO Auto-generated catch block
163
			e.printStackTrace();
164 159
		}
165 160

  
166 161
		SHP2H2FeaturesVisitor visitor=new SHP2H2FeaturesVisitor(ft,h2Param);
......
227 222
		} catch (OpenException e2) {
228 223
			e2.printStackTrace();
229 224
			fail();
230
		} catch (IsNotFeatureSettingException e) {
231
			// TODO Auto-generated catch block
232
			e.printStackTrace();
233 225
		}
234 226

  
235 227

  
......
241 233
		} catch (ReadException e1) {
242 234
			e1.printStackTrace();
243 235
			fail();
244
		} catch (IsNotFeatureSettingException e) {
245
			// TODO Auto-generated catch block
246
			e.printStackTrace();
247 236
		}
248 237

  
249 238
		assertEquals(9, fc.size());
......
264 253
			fc = (IFeatureCollection)fs.getDataCollection(null,"NOMBRE like 'B%'",null);
265 254
		} catch (ReadException e1) {
266 255
			exc=e1;
267
		} catch (IsNotFeatureSettingException e) {
268
			// TODO Auto-generated catch block
269
			e.printStackTrace();
270 256
		}
271 257
		assertNotNull("Filter allowed in sqlSource mode",exc);
272 258

  
......
275 261
			fc = (IFeatureCollection)fs.getDataCollection(null,null,"NOMBRE");
276 262
		} catch (ReadException e1) {
277 263
			exc=e1;
278
		} catch (IsNotFeatureSettingException e) {
279
			// TODO Auto-generated catch block
280
			e.printStackTrace();
281 264
		}
282 265
		assertNotNull("Order allowed in sqlSource mode",exc);
283 266

  
......
356 339
		} catch (OpenException e2) {
357 340
			e2.printStackTrace();
358 341
			fail();
359
		} catch (IsNotFeatureSettingException e) {
360
			// TODO Auto-generated catch block
361
			e.printStackTrace();
362 342
		}
363 343

  
364 344
		Iterator it;
......
373 353
		} catch (ReadException e1) {
374 354
			e1.printStackTrace();
375 355
			fail();
376
		} catch (IsNotFeatureSettingException e) {
377
			// TODO Auto-generated catch block
378
			e.printStackTrace();
379 356
		}
380 357

  
381 358
		assertEquals(9, fc.size());
......
387 364
		} catch (ReadException e1) {
388 365
			e1.printStackTrace();
389 366
			fail();
390
		} catch (IsNotFeatureSettingException e) {
391
			// TODO Auto-generated catch block
392
			e.printStackTrace();
393 367
		}
394 368

  
395 369
		assertEquals(2, fc.size());
......
411 385
		} catch (ReadException e1) {
412 386
			e1.printStackTrace();
413 387
			fail();
414
		} catch (IsNotFeatureSettingException e) {
415
			// TODO Auto-generated catch block
416
			e.printStackTrace();
417 388
		}
418 389
		assertEquals(9, fc.size());
419 390
		it = fc.iterator();
......
438 409
		} catch (ReadException e1) {
439 410
			e1.printStackTrace();
440 411
			fail();
441
		} catch (IsNotFeatureSettingException e) {
442
			// TODO Auto-generated catch block
443
			e.printStackTrace();
444 412
		}
445 413
		assertEquals(9, fc.size());
446 414
		it = fc.iterator();
......
467 435
		} catch (ReadException e1) {
468 436
			e1.printStackTrace();
469 437
			fail();
470
		} catch (IsNotFeatureSettingException e) {
471
			// TODO Auto-generated catch block
472
			e.printStackTrace();
473 438
		}
474 439

  
475 440
		assertEquals(2, fc.size());
......
499 464
		} catch (ReadException e1) {
500 465
			e1.printStackTrace();
501 466
			fail();
502
		} catch (IsNotFeatureSettingException e) {
503
			// TODO Auto-generated catch block
504
			e.printStackTrace();
505 467
		}
506 468
		assertEquals(9, fc.size());
507 469
		it = fc.iterator();
......
548 510
		} catch (ReadException e1) {
549 511
			e1.printStackTrace();
550 512
			fail();
551
		} catch (IsNotFeatureSettingException e) {
552
			// TODO Auto-generated catch block
553
			e.printStackTrace();
554 513
		}
555 514

  
556 515
		assertEquals(10, fc.size());
......
561 520
		} catch (ReadException e1) {
562 521
			e1.printStackTrace();
563 522
			fail();
564
		} catch (IsNotFeatureSettingException e) {
565
			// TODO Auto-generated catch block
566
			e.printStackTrace();
567 523
		}
568 524

  
569 525
		assertEquals(3, fc.size());
......
584 540
		} catch (ReadException e1) {
585 541
			e1.printStackTrace();
586 542
			fail();
587
		} catch (IsNotFeatureSettingException e) {
588
			// TODO Auto-generated catch block
589
			e.printStackTrace();
590 543
		}
591 544
		assertEquals(10, fc.size());
592 545
		it = fc.iterator();
......
610 563
		} catch (ReadException e1) {
611 564
			e1.printStackTrace();
612 565
			fail();
613
		} catch (IsNotFeatureSettingException e) {
614
			// TODO Auto-generated catch block
615
			e.printStackTrace();
616 566
		}
617 567
		assertEquals(10, fc.size());
618 568
		it = fc.iterator();
......
637 587
		} catch (ReadException e1) {
638 588
			e1.printStackTrace();
639 589
			fail();
640
		} catch (IsNotFeatureSettingException e) {
641
			// TODO Auto-generated catch block
642
			e.printStackTrace();
643 590
		}
644 591

  
645 592
		assertEquals(3, fc.size());
......
669 616
		} catch (ReadException e1) {
670 617
			e1.printStackTrace();
671 618
			fail();
672
		} catch (IsNotFeatureSettingException e) {
673
			// TODO Auto-generated catch block
674
			e.printStackTrace();
675 619
		}
676 620
		assertEquals(10, fc.size());
677 621
		it = fc.iterator();
......
728 672
		} catch (ReadException e1) {
729 673
			e1.printStackTrace();
730 674
			fail();
731
		} catch (IsNotFeatureSettingException e) {
732
			e.printStackTrace();
733
			fail();
734 675
		}
735 676
		assertEquals(10, fc.size());
736 677
		it = fc.iterator();
......
764 705
		} catch (ReadException e1) {
765 706
			e1.printStackTrace();
766 707
			fail();
767
		} catch (IsNotFeatureSettingException e) {
768
			// TODO Auto-generated catch block
769
			e.printStackTrace();
770 708
		}
771 709
		assertEquals(1, fc.size());
772 710
		Feature old =(Feature)fc.iterator().next();
......
788 726
			// TODO Auto-generated catch block
789 727
			e2.printStackTrace();
790 728
		}
791

  
792
		fs.update(feature, old);
793 729
		try {
730
			old.editing();
731
			old.set(1,11111);
732
		} catch (IsNotFeatureSettingException e2) {
733
			e2.printStackTrace();
734
			fail("Exception: "+e2);
735
		}
736
		fs.update(old);
737
		try {
794 738
			fs.finishEditing();
795 739
		} catch (WriteException e) {
796 740
			e.printStackTrace();
......
798 742
		} catch (ReadException e) {
799 743
			e.printStackTrace();
800 744
			fail("Exception: "+e);
801
		} catch (IsNotFeatureSettingException e) {
802
			e.printStackTrace();
803
			fail("Exception: "+e);
804 745
		}
805 746

  
806 747
		try {
......
808 749
		} catch (ReadException e1) {
809 750
			e1.printStackTrace();
810 751
			fail();
811
		} catch (IsNotFeatureSettingException e) {
812
			e.printStackTrace();
813
			fail();
814 752
		}
815 753
		assertEquals(1, fc.size());
816 754
		fc.dispose();
......
830 768
		} catch (ReadException e1) {
831 769
			e1.printStackTrace();
832 770
			fail();
833
		} catch (IsNotFeatureSettingException e) {
834
			e.printStackTrace();
835
			fail();
836 771
		}
837 772
		assertEquals(1, fc.size());
838 773
		fs.delete((IFeature)fc.iterator().next());
......
845 780
		} catch (ReadException e) {
846 781
			e.printStackTrace();
847 782
			fail("Exception: "+e);
848
		} catch (IsNotFeatureSettingException e) {
849
			e.printStackTrace();
850
			fail("Exception: "+e);
851 783
		}
852 784

  
853 785
		try {
......
855 787
		} catch (ReadException e1) {
856 788
			e1.printStackTrace();
857 789
			fail();
858
		} catch (IsNotFeatureSettingException e) {
859
			e.printStackTrace();
860
			fail();
861 790
		}
862 791
		assertEquals(9, fc.size());
863 792
		fc.dispose();
......
1054 983
		JDBCAttributeDescriptor attr;
1055 984

  
1056 985
		attr = new JDBCAttributeDescriptor();
1057
		attr.setName("ID");
1058
		attr.setAutoIncrement(true);
1059
		attr.setType(IFeatureAttributeDescriptor.TYPE_INT);
1060
		attr.setPrimaryKey(true);
1061
		ftype.add(attr);
986
		try {
987
			attr.loading();
988
			attr.setName("ID");
989
			attr.setAutoIncrement(true);
990
			attr.setType(IFeatureAttributeDescriptor.TYPE_INT);
991
			attr.setPrimaryKey(true);
992
			attr.stopLoading();
993
			ftype.add(attr);
1062 994

  
1063
		attr = new JDBCAttributeDescriptor();
1064
		attr.setName("MYGEOMETRY");
1065
		attr.setType(IFeatureAttributeDescriptor.TYPE_GEOMETRY);
1066
		ftype.add(attr);
1067
		ftype.setDefaultGeometry(attr.getName());
995
			attr = new JDBCAttributeDescriptor();
996
			attr.loading();
997
			attr.setName("MYGEOMETRY");
998
			attr.setType(IFeatureAttributeDescriptor.TYPE_GEOMETRY);
999
			attr.stopLoading();
1000
			ftype.add(attr);
1001
			ftype.setDefaultGeometry(attr.getName());
1068 1002

  
1069
		attr = new JDBCAttributeDescriptor();
1070
		attr.setName("MYSTRING");
1071
		attr.setSize(50);
1072
		attr.setDefaultValue("def");
1073
		attr.setType(IFeatureAttributeDescriptor.TYPE_STRING);
1074
		ftype.add(attr);
1003
			attr = new JDBCAttributeDescriptor();
1004
			attr.loading();
1005
			attr.setName("MYSTRING");
1006
			attr.setSize(50);
1007
			attr.setDefaultValue("def");
1008
			attr.setType(IFeatureAttributeDescriptor.TYPE_STRING);
1009
			attr.stopLoading();
1010
			ftype.add(attr);
1075 1011

  
1076 1012

  
1077
		attr = new JDBCAttributeDescriptor();
1078
		attr.setName("MYDOUBLE");
1079
		attr.setType(IFeatureAttributeDescriptor.TYPE_DOUBLE);
1013
			attr = new JDBCAttributeDescriptor();
1014
			attr.loading();
1015
			attr.setName("MYDOUBLE");
1016

  
1017
			attr.setType(IFeatureAttributeDescriptor.TYPE_DOUBLE);
1018

  
1019
			attr.stopLoading();
1020
		} catch (IsNotAttributeSettingException e2) {
1021
			e2.printStackTrace();
1022
			fail();return;
1023
		}
1080 1024
		ftype.add(attr);
1081 1025

  
1082 1026
		try {

Also available in: Unified diff