Revision 9313
Added by Jing Tao over 9 years ago
test/edu/ucsb/nceas/metacattest/IdentifierManagerTest.java | ||
---|---|---|
26 | 26 |
|
27 | 27 |
import java.io.ByteArrayInputStream; |
28 | 28 |
import java.io.InputStream; |
29 |
import java.math.BigInteger; |
|
29 | 30 |
import java.sql.SQLException; |
30 | 31 |
import java.util.*; |
31 | 32 |
|
... | ... | |
417 | 418 |
CNodeService.getInstance(request).create(session, pid2_case4, object, sysmeta2_case4); |
418 | 419 |
|
419 | 420 |
sysmeta_case4.setObsoletedBy(pid2_case4); |
421 |
BigInteger version = BigInteger.ONE.add(BigInteger.ONE); |
|
422 |
sysmeta_case4.setSerialVersion(version); |
|
420 | 423 |
CNodeService.getInstance(request).updateSystemMetadata(session, pid1_case4, sysmeta_case4); |
421 | 424 |
|
422 | 425 |
Thread.sleep(1000); |
... | ... | |
431 | 434 |
CNodeService.getInstance(request).create(session, pid3_case4, object, sysmeta3_case4); |
432 | 435 |
|
433 | 436 |
sysmeta2_case4.setObsoletedBy(pid3_case4); |
437 |
version = version.add(BigInteger.ONE); |
|
438 |
sysmeta2_case4.setSerialVersion(version); |
|
434 | 439 |
CNodeService.getInstance(request).updateSystemMetadata(session, pid2_case4, sysmeta2_case4); |
435 | 440 |
|
436 | 441 |
//check |
... | ... | |
523 | 528 |
CNodeService.getInstance(request).create(session, pid2_case6, object, sysmeta2_case6); |
524 | 529 |
|
525 | 530 |
sysmeta_case6.setObsoletedBy(pid2_case6); |
531 |
version = BigInteger.ONE.add(BigInteger.ONE); |
|
532 |
sysmeta_case6.setSerialVersion(version); |
|
526 | 533 |
CNodeService.getInstance(request).updateSystemMetadata(session, pid1_case6, sysmeta_case6); |
527 | 534 |
|
528 | 535 |
Thread.sleep(1000); |
... | ... | |
534 | 541 |
CNodeService.getInstance(request).create(session, pid3_case6, object, sysmeta3_case6); |
535 | 542 |
|
536 | 543 |
sysmeta2_case6.setObsoletedBy(pid3_case6); |
544 |
version = version.add(BigInteger.ONE); |
|
545 |
sysmeta2_case6.setSerialVersion(version); |
|
537 | 546 |
CNodeService.getInstance(request).updateSystemMetadata(session, pid2_case6, sysmeta2_case6); |
538 | 547 |
|
539 | 548 |
//check |
... | ... | |
574 | 583 |
CNodeService.getInstance(request).create(session, pid2_case7, object, sysmeta2_case7); |
575 | 584 |
|
576 | 585 |
sysmeta_case7.setObsoletedBy(pid2_case7); |
586 |
version = version.add(BigInteger.ONE); |
|
587 |
sysmeta_case7.setSerialVersion(version); |
|
577 | 588 |
CNodeService.getInstance(request).updateSystemMetadata(session, pid1_case7, sysmeta_case7); |
578 | 589 |
|
579 | 590 |
Thread.sleep(1000); |
... | ... | |
585 | 596 |
CNodeService.getInstance(request).create(session, pid3_case7, object, sysmeta3_case7); |
586 | 597 |
|
587 | 598 |
sysmeta2_case7.setObsoletedBy(pid3_case7); |
599 |
version = version.add(BigInteger.ONE); |
|
600 |
sysmeta2_case7.setSerialVersion(version); |
|
588 | 601 |
CNodeService.getInstance(request).updateSystemMetadata(session, pid2_case7, sysmeta2_case7); |
589 | 602 |
|
590 | 603 |
Thread.sleep(1000); |
... | ... | |
599 | 612 |
CNodeService.getInstance(request).create(session, pid4_case7, object, sysmeta4_case7); |
600 | 613 |
|
601 | 614 |
sysmeta3_case7.setObsoletedBy(pid4_case7); |
615 |
version = version.add(BigInteger.ONE); |
|
616 |
sysmeta3_case7.setSerialVersion(version); |
|
602 | 617 |
CNodeService.getInstance(request).updateSystemMetadata(session, pid3_case7, sysmeta3_case7); |
603 | 618 |
|
604 | 619 |
//check |
... | ... | |
645 | 660 |
CNodeService.getInstance(request).create(session, pid2_case8, object, sysmeta2_case8); |
646 | 661 |
|
647 | 662 |
sysmeta_case8.setObsoletedBy(pid2_case8); |
663 |
version = version.add(BigInteger.ONE); |
|
664 |
sysmeta_case8.setSerialVersion(version); |
|
648 | 665 |
CNodeService.getInstance(request).updateSystemMetadata(session, pid1_case8, sysmeta_case8); |
649 | 666 |
|
650 | 667 |
Thread.sleep(1000); |
... | ... | |
657 | 674 |
CNodeService.getInstance(request).create(session, pid3_case8, object, sysmeta3_case8); |
658 | 675 |
|
659 | 676 |
sysmeta2_case8.setObsoletedBy(pid3_case8); |
677 |
version = version.add(BigInteger.ONE); |
|
678 |
sysmeta2_case8.setSerialVersion(version); |
|
660 | 679 |
CNodeService.getInstance(request).updateSystemMetadata(session, pid2_case8, sysmeta2_case8); |
661 | 680 |
|
662 | 681 |
Thread.sleep(1000); |
... | ... | |
718 | 737 |
CNodeService.getInstance(request).create(session, pid2_case9, object, sysmeta2_case9); |
719 | 738 |
|
720 | 739 |
sysmeta_case9.setObsoletedBy(pid2_case9); |
740 |
version = version.add(BigInteger.ONE); |
|
741 |
sysmeta_case9.setSerialVersion(version); |
|
721 | 742 |
CNodeService.getInstance(request).updateSystemMetadata(session, pid1_case9, sysmeta_case9); |
722 | 743 |
//check |
723 | 744 |
meta = CNodeService.getInstance(request).getSystemMetadata(session, pid1_case9); |
... | ... | |
794 | 815 |
CNodeService.getInstance(request).create(session, pid2_case10, object, sysmeta2_case10); |
795 | 816 |
|
796 | 817 |
sysmeta_case10.setObsoletedBy(pid2_case10); |
818 |
version = version.add(BigInteger.ONE); |
|
819 |
sysmeta_case10.setSerialVersion(version); |
|
797 | 820 |
CNodeService.getInstance(request).updateSystemMetadata(session, pid1_case10, sysmeta_case10); |
798 | 821 |
//check |
799 | 822 |
meta = CNodeService.getInstance(request).getSystemMetadata(session, pid1_case10); |
... | ... | |
809 | 832 |
CNodeService.getInstance(request).create(session, pid3_case10, object, sysmeta3_case10); |
810 | 833 |
|
811 | 834 |
sysmeta2_case10.setObsoletedBy(pid3_case10); |
835 |
version = version.add(BigInteger.ONE); |
|
836 |
sysmeta2_case10.setSerialVersion(version); |
|
812 | 837 |
CNodeService.getInstance(request).updateSystemMetadata(session, pid2_case10, sysmeta2_case10); |
813 | 838 |
|
814 | 839 |
Thread.sleep(1000); |
... | ... | |
870 | 895 |
CNodeService.getInstance(request).create(session, pid2_case11, object, sysmeta2_case11); |
871 | 896 |
|
872 | 897 |
sysmeta_case11.setObsoletedBy(pid2_case11); |
898 |
version = version.add(BigInteger.ONE); |
|
899 |
sysmeta_case11.setSerialVersion(version); |
|
873 | 900 |
CNodeService.getInstance(request).updateSystemMetadata(session, pid1_case11, sysmeta_case11); |
874 | 901 |
//check |
875 | 902 |
meta = CNodeService.getInstance(request).getSystemMetadata(session, pid1_case11); |
... | ... | |
885 | 912 |
CNodeService.getInstance(request).create(session, pid3_case11, object, sysmeta3_case11); |
886 | 913 |
|
887 | 914 |
sysmeta2_case11.setObsoletedBy(pid3_case11); |
915 |
version = version.add(BigInteger.ONE); |
|
916 |
sysmeta2_case11.setSerialVersion(version); |
|
888 | 917 |
CNodeService.getInstance(request).updateSystemMetadata(session, pid2_case11, sysmeta2_case11); |
889 | 918 |
|
890 | 919 |
//archive pid3_case11 |
... | ... | |
929 | 958 |
CNodeService.getInstance(request).create(session, pid2_case12, object, sysmeta2_case12); |
930 | 959 |
|
931 | 960 |
sysmeta_case12.setObsoletedBy(pid2_case12); |
961 |
version = version.add(BigInteger.ONE); |
|
962 |
sysmeta_case12.setSerialVersion(version); |
|
932 | 963 |
CNodeService.getInstance(request).updateSystemMetadata(session, pid1_case12, sysmeta_case12); |
933 | 964 |
//check |
934 | 965 |
meta = CNodeService.getInstance(request).getSystemMetadata(session, pid1_case12); |
... | ... | |
944 | 975 |
CNodeService.getInstance(request).create(session, pid3_case12, object, sysmeta3_case12); |
945 | 976 |
|
946 | 977 |
sysmeta2_case12.setObsoletedBy(pid3_case12); |
978 |
version = version.add(BigInteger.ONE); |
|
979 |
sysmeta2_case12.setSerialVersion(version); |
|
947 | 980 |
CNodeService.getInstance(request).updateSystemMetadata(session, pid2_case12, sysmeta2_case12); |
948 | 981 |
|
949 | 982 |
//archive pid3_case12 |
... | ... | |
1037 | 1070 |
CNodeService.getInstance(request).create(session, pid3_case14, object, sysmeta3_case14); |
1038 | 1071 |
|
1039 | 1072 |
sysmeta2_case14.setObsoletedBy(pid3_case14); |
1073 |
version = version.add(BigInteger.ONE); |
|
1074 |
sysmeta2_case14.setSerialVersion(version); |
|
1040 | 1075 |
CNodeService.getInstance(request).updateSystemMetadata(session, pid2_case14, sysmeta2_case14); |
1041 | 1076 |
|
1042 | 1077 |
meta = CNodeService.getInstance(request).getSystemMetadata(session, pid2_case14); |
... | ... | |
1078 | 1113 |
CNodeService.getInstance(request).create(session, pid2_case15, object, sysmeta2_case15); |
1079 | 1114 |
|
1080 | 1115 |
sysmeta_case15.setObsoletedBy(pid2_case15); |
1116 |
version = version.add(BigInteger.ONE); |
|
1117 |
sysmeta_case15.setSerialVersion(version); |
|
1081 | 1118 |
CNodeService.getInstance(request).updateSystemMetadata(session, pid1_case15, sysmeta_case15); |
1082 | 1119 |
//check |
1083 | 1120 |
meta = CNodeService.getInstance(request).getSystemMetadata(session, pid1_case15); |
... | ... | |
1113 | 1150 |
CNodeService.getInstance(request).create(session, pid5_case15, object, sysmeta5_case15); |
1114 | 1151 |
|
1115 | 1152 |
sysmeta4_case15.setObsoletedBy(pid5_case15); |
1153 |
version = version.add(BigInteger.ONE); |
|
1154 |
sysmeta4_case15.setSerialVersion(version); |
|
1116 | 1155 |
CNodeService.getInstance(request).updateSystemMetadata(session, pid4_case15, sysmeta4_case15); |
1117 | 1156 |
|
1118 | 1157 |
CNodeService.getInstance(request).delete(session, pid3_case15); |
... | ... | |
1177 | 1216 |
CNodeService.getInstance(request).create(session, pid3_case16, object, sysmeta3_case16); |
1178 | 1217 |
|
1179 | 1218 |
sysmeta2_case16.setObsoletedBy(pid3_case16); |
1219 |
version = version.add(BigInteger.ONE); |
|
1220 |
sysmeta2_case16.setSerialVersion(version); |
|
1180 | 1221 |
CNodeService.getInstance(request).updateSystemMetadata(session, pid2_case16, sysmeta2_case16); |
1181 | 1222 |
|
1182 | 1223 |
Thread.sleep(1000); |
... | ... | |
1246 | 1287 |
CNodeService.getInstance(request).create(session, pid3_case17, object, sysmeta3_case17); |
1247 | 1288 |
|
1248 | 1289 |
sysmeta2_case17.setObsoletedBy(pid3_case17); |
1290 |
version = version.add(BigInteger.ONE); |
|
1291 |
sysmeta2_case17.setSerialVersion(version); |
|
1249 | 1292 |
CNodeService.getInstance(request).updateSystemMetadata(session, pid2_case17, sysmeta2_case17); |
1250 | 1293 |
|
1251 | 1294 |
Thread.sleep(1000); |
... | ... | |
1303 | 1346 |
CNodeService.getInstance(request).create(session, pid2_case18, object, sysmeta2_case18); |
1304 | 1347 |
|
1305 | 1348 |
sysmeta_case18.setObsoletedBy(pid2_case18); |
1349 |
version = version.add(BigInteger.ONE); |
|
1350 |
sysmeta_case18.setSerialVersion(version); |
|
1306 | 1351 |
CNodeService.getInstance(request).updateSystemMetadata(session, pid1_case18, sysmeta_case18); |
1307 | 1352 |
|
1308 | 1353 |
Thread.sleep(1000); |
... | ... | |
1315 | 1360 |
CNodeService.getInstance(request).create(session, pid3_case18, object, sysmeta3_case18); |
1316 | 1361 |
|
1317 | 1362 |
sysmeta2_case18.setObsoletedBy(pid3_case18); |
1363 |
version = version.add(BigInteger.ONE); |
|
1364 |
sysmeta2_case18.setSerialVersion(version); |
|
1318 | 1365 |
CNodeService.getInstance(request).updateSystemMetadata(session, pid2_case18, sysmeta2_case18); |
1319 | 1366 |
|
1320 | 1367 |
Thread.sleep(1000); |
... | ... | |
1336 | 1383 |
CNodeService.getInstance(request).create(session, pid5_case18, object, sysmeta5_case18); |
1337 | 1384 |
|
1338 | 1385 |
sysmeta4_case18.setObsoletedBy(pid5_case18); |
1386 |
version = version.add(BigInteger.ONE); |
|
1387 |
sysmeta4_case18.setSerialVersion(version); |
|
1339 | 1388 |
CNodeService.getInstance(request).updateSystemMetadata(session, pid4_case18, sysmeta4_case18); |
1340 | 1389 |
|
1341 | 1390 |
CNodeService.getInstance(request).delete(session, pid3_case18); |
Also available in: Unified diff
Increase the serial version before we call cn.updateSystemMetadata method.