Revision 4476
Added by daigle over 16 years ago
test/edu/ucsb/nceas/metacattest/AccessControlTest.java | ||
---|---|---|
76 | 76 |
private String testdocument = ""; |
77 | 77 |
private String onlineDocid; |
78 | 78 |
private String onlinetestdatafile1 = "test/onlineDataFile1"; |
79 |
private String onlinetestdatafile2 = "test/onlineDataFile2"; |
|
79 |
// private String onlinetestdatafile2 = "test/onlineDataFile2";
|
|
80 | 80 |
private static final String ALLOWFIRST = "allowFirst"; |
81 | 81 |
private static final String DENYFIRST = "denyFirst"; |
82 | 82 |
|
... | ... | |
86 | 86 |
* These variables are for eml-2.0.1 only. For other eml versions, this |
87 | 87 |
* function might have to modified |
88 | 88 |
*/ |
89 |
|
|
89 |
private String testEml_200_Header = "<?xml version=\"1.0\"?><eml:eml" |
|
90 |
+ " xmlns:eml=\"eml://ecoinformatics.org/eml-2.0.0\"" |
|
91 |
+ " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" |
|
92 |
+ " packageId=\"eml.1.1\" system=\"knb\"" |
|
93 |
+ " xsi:schemaLocation=\"eml://ecoinformatics.org/eml-2.0.0 eml.xsd\"" |
|
94 |
+ " scope=\"system\">"; |
|
95 |
|
|
96 |
private String testEml_201_Header = "<?xml version=\"1.0\"?><eml:eml" |
|
97 |
+ " xmlns:eml=\"eml://ecoinformatics.org/eml-2.0.1\"" |
|
98 |
+ " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" |
|
99 |
+ " packageId=\"eml.1.1\" system=\"knb\"" |
|
100 |
+ " xsi:schemaLocation=\"eml://ecoinformatics.org/eml-2.0.1 eml.xsd\"" |
|
101 |
+ " scope=\"system\">"; |
|
102 |
|
|
90 | 103 |
private String testEml_210_Header = "<?xml version=\"1.0\"?><eml:eml" |
91 | 104 |
+ " xmlns:eml=\"eml://ecoinformatics.org/eml-2.1.0\"" |
92 | 105 |
+ " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" |
... | ... | |
94 | 107 |
+ " xsi:schemaLocation=\"eml://ecoinformatics.org/eml-2.1.0 eml.xsd\"" |
95 | 108 |
+ " scope=\"system\">"; |
96 | 109 |
|
97 |
private String testEml_201_Header = "<?xml version=\"1.0\"?><eml:eml" |
|
98 |
+ " xmlns:eml=\"eml://ecoinformatics.org/eml-2.0.1\"" |
|
99 |
+ " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" |
|
100 |
+ " packageId=\"eml.1.1\" system=\"knb\"" |
|
101 |
+ " xsi:schemaLocation=\"eml://ecoinformatics.org/eml-2.0.1 eml.xsd\"" |
|
102 |
+ " scope=\"system\">"; |
|
103 |
|
|
104 |
private String testEml_200_Header = "<?xml version=\"1.0\"?><eml:eml" |
|
105 |
+ " xmlns:eml=\"eml://ecoinformatics.org/eml-2.0.0\"" |
|
106 |
+ " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" |
|
107 |
+ " packageId=\"eml.1.1\" system=\"knb\"" |
|
108 |
+ " xsi:schemaLocation=\"eml://ecoinformatics.org/eml-2.0.0 eml.xsd\"" |
|
109 |
+ " scope=\"system\">"; |
|
110 |
|
|
111 | 110 |
private String testEmlCreatorBlock = "<creator scope=\"document\"> " |
112 | 111 |
+ " <individualName> " |
113 | 112 |
+ " <surName>Smith</surName> " |
... | ... | |
167 | 166 |
/* |
168 | 167 |
* Gets eml access block base on given acccess rules and perm order |
169 | 168 |
*/ |
170 |
private String getAccessBlock(Vector accessRules, String permOrder) { |
|
169 |
private String getAccessBlock(Vector<String> accessRules, String permOrder) {
|
|
171 | 170 |
String accessBlock = "<access " |
172 | 171 |
+ "authSystem=\"ldap://ldap.ecoinformatics.org:389/dc=ecoinformatics,dc=org\"" |
173 | 172 |
+ " order=\"" + permOrder + "\"" + " scope=\"document\"" + ">"; |
... | ... | |
223 | 222 |
} |
224 | 223 |
|
225 | 224 |
/** |
226 |
* This function returns a valid eml document with no access rules This |
|
227 |
* function is for eml-2.0.1 only. For other eml versions, this function |
|
228 |
* might have to modified |
|
225 |
* This function returns a valid eml document with no access rules |
|
229 | 226 |
*/ |
230 | 227 |
private String getTestEmlDoc(String title, String emlVersion, String inlineData1, |
231 | 228 |
String inlineData2, String onlineUrl1, String onlineUrl2, |
... | ... | |
247 | 244 |
} else { |
248 | 245 |
header = testEml_210_Header; |
249 | 246 |
} |
250 |
testDocument = testDocument + header + "<dataset scope=\"document\"><title>" |
|
247 |
testDocument += header; |
|
248 |
|
|
249 |
// if this is a 2.1.0+ document, the document level access block sits |
|
250 |
// at the same level and before the dataset element. |
|
251 |
if (docAccessBlock != null && emlVersion.equals(EML2_1_0)) { |
|
252 |
testDocument += docAccessBlock; |
|
253 |
} |
|
254 |
|
|
255 |
testDocument += "<dataset scope=\"document\"><title>" |
|
251 | 256 |
+ title + "</title>" + testEmlCreatorBlock; |
252 | 257 |
|
253 | 258 |
if (inlineData1 != null) { |
... | ... | |
274 | 279 |
} |
275 | 280 |
testDocument += testEmlContactBlock; |
276 | 281 |
|
277 |
if (docAccessBlock != null) { |
|
282 |
// if this is a 2.0.X document, the document level access block sits |
|
283 |
// inside the dataset element. |
|
284 |
if (docAccessBlock != null && |
|
285 |
(emlVersion.equals(EML2_0_0) || emlVersion.equals(EML2_0_1))) { |
|
278 | 286 |
testDocument += docAccessBlock; |
279 | 287 |
} |
280 | 288 |
|
... | ... | |
439 | 447 |
false, false); |
440 | 448 |
String accessRule2 = generateOneAccessRule("public", false, true, false, |
441 | 449 |
false, false); |
442 |
Vector accessRules = new Vector();
|
|
450 |
Vector<String> accessRules = new Vector<String>();
|
|
443 | 451 |
accessRules.add(accessRule1); |
444 | 452 |
accessRules.add(accessRule2); |
445 | 453 |
String access = getAccessBlock(accessRules, ALLOWFIRST); |
... | ... | |
479 | 487 |
accessRule1 = generateOneAccessRule(anotheruser, true, true, true, false, |
480 | 488 |
false); |
481 | 489 |
accessRule2 = generateOneAccessRule("public", false, true, true, false, false); |
482 |
accessRules = new Vector(); |
|
490 |
accessRules = new Vector<String>();
|
|
483 | 491 |
accessRules.add(accessRule1); |
484 | 492 |
accessRules.add(accessRule2); |
485 | 493 |
access = getAccessBlock(accessRules, ALLOWFIRST); |
... | ... | |
518 | 526 |
// deny ALL rule for public. |
519 | 527 |
accessRule1 = generateOneAccessRule(anotheruser, true, true, true, true, true); |
520 | 528 |
accessRule2 = generateOneAccessRule("public", false, true, true, true, true); |
521 |
accessRules = new Vector(); |
|
529 |
accessRules = new Vector<String>();
|
|
522 | 530 |
accessRules.add(accessRule1); |
523 | 531 |
accessRules.add(accessRule2); |
524 | 532 |
access = getAccessBlock(accessRules, ALLOWFIRST); |
... | ... | |
559 | 567 |
false); |
560 | 568 |
accessRule2 = generateOneAccessRule("public", false, false, true, false, |
561 | 569 |
false); |
562 |
accessRules = new Vector(); |
|
570 |
accessRules = new Vector<String>();
|
|
563 | 571 |
accessRules.add(accessRule1); |
564 | 572 |
accessRules.add(accessRule2); |
565 | 573 |
access = getAccessBlock(accessRules, ALLOWFIRST); |
... | ... | |
599 | 607 |
false); |
600 | 608 |
accessRule2 = generateOneAccessRule("public", false, true, false, false, |
601 | 609 |
false); |
602 |
accessRules = new Vector(); |
|
610 |
accessRules = new Vector<String>();
|
|
603 | 611 |
accessRules.add(accessRule1); |
604 | 612 |
accessRules.add(accessRule2); |
605 | 613 |
access = getAccessBlock(accessRules, ALLOWFIRST); |
... | ... | |
643 | 651 |
accessRule2 = generateOneAccessRule( |
644 | 652 |
"cn=knb-usr,o=nceas,dc=ecoinformatics,dc=org", false, true, false, |
645 | 653 |
false, false); |
646 |
accessRules = new Vector(); |
|
654 |
accessRules = new Vector<String>();
|
|
647 | 655 |
accessRules.add(accessRule1); |
648 | 656 |
accessRules.add(accessRule2); |
649 | 657 |
access = getAccessBlock(accessRules, ALLOWFIRST); |
... | ... | |
687 | 695 |
accessRule2 = generateOneAccessRule( |
688 | 696 |
"cn=knb-usr,o=nceas,dc=ecoinformatics,dc=org", false, true, true, |
689 | 697 |
false, false); |
690 |
accessRules = new Vector(); |
|
698 |
accessRules = new Vector<String>();
|
|
691 | 699 |
accessRules.add(accessRule1); |
692 | 700 |
accessRules.add(accessRule2); |
693 | 701 |
access = getAccessBlock(accessRules, ALLOWFIRST); |
... | ... | |
730 | 738 |
accessRule2 = generateOneAccessRule( |
731 | 739 |
"cn=knb-usr,o=nceas,dc=ecoinformatics,dc=org", false, true, true, |
732 | 740 |
true, true); |
733 |
accessRules = new Vector(); |
|
741 |
accessRules = new Vector<String>();
|
|
734 | 742 |
accessRules.add(accessRule1); |
735 | 743 |
accessRules.add(accessRule2); |
736 | 744 |
access = getAccessBlock(accessRules, ALLOWFIRST); |
... | ... | |
774 | 782 |
accessRule2 = generateOneAccessRule( |
775 | 783 |
"cn=knb-usr,o=nceas,dc=ecoinformatics,dc=org", false, false, true, |
776 | 784 |
false, false); |
777 |
accessRules = new Vector(); |
|
785 |
accessRules = new Vector<String>();
|
|
778 | 786 |
accessRules.add(accessRule1); |
779 | 787 |
accessRules.add(accessRule2); |
780 | 788 |
access = getAccessBlock(accessRules, ALLOWFIRST); |
... | ... | |
818 | 826 |
accessRule2 = generateOneAccessRule( |
819 | 827 |
"cn=knb-usr,o=nceas,dc=ecoinformatics,dc=org", false, true, false, |
820 | 828 |
false, false); |
821 |
accessRules = new Vector(); |
|
829 |
accessRules = new Vector<String>();
|
|
822 | 830 |
accessRules.add(accessRule1); |
823 | 831 |
accessRules.add(accessRule2); |
824 | 832 |
access = getAccessBlock(accessRules, ALLOWFIRST); |
... | ... | |
928 | 936 |
false, false); |
929 | 937 |
String accessRule2 = generateOneAccessRule("public", false, true, false, |
930 | 938 |
false, false); |
931 |
Vector accessRules = new Vector();
|
|
939 |
Vector<String> accessRules = new Vector<String>();
|
|
932 | 940 |
accessRules.add(accessRule1); |
933 | 941 |
accessRules.add(accessRule2); |
934 | 942 |
String access = getAccessBlock(accessRules, ALLOWFIRST); |
... | ... | |
968 | 976 |
accessRule1 = generateOneAccessRule(anotheruser, true, true, true, false, |
969 | 977 |
false); |
970 | 978 |
accessRule2 = generateOneAccessRule("public", false, true, true, false, false); |
971 |
accessRules = new Vector(); |
|
979 |
accessRules = new Vector<String>();
|
|
972 | 980 |
accessRules.add(accessRule1); |
973 | 981 |
accessRules.add(accessRule2); |
974 | 982 |
access = getAccessBlock(accessRules, ALLOWFIRST); |
... | ... | |
1007 | 1015 |
// deny ALL rule for public. |
1008 | 1016 |
accessRule1 = generateOneAccessRule(anotheruser, true, true, true, true, true); |
1009 | 1017 |
accessRule2 = generateOneAccessRule("public", false, true, true, true, true); |
1010 |
accessRules = new Vector(); |
|
1018 |
accessRules = new Vector<String>();
|
|
1011 | 1019 |
accessRules.add(accessRule1); |
1012 | 1020 |
accessRules.add(accessRule2); |
1013 | 1021 |
access = getAccessBlock(accessRules, ALLOWFIRST); |
... | ... | |
1048 | 1056 |
false); |
1049 | 1057 |
accessRule2 = generateOneAccessRule("public", false, false, true, false, |
1050 | 1058 |
false); |
1051 |
accessRules = new Vector(); |
|
1059 |
accessRules = new Vector<String>();
|
|
1052 | 1060 |
accessRules.add(accessRule1); |
1053 | 1061 |
accessRules.add(accessRule2); |
1054 | 1062 |
access = getAccessBlock(accessRules, ALLOWFIRST); |
... | ... | |
1088 | 1096 |
false); |
1089 | 1097 |
accessRule2 = generateOneAccessRule("public", false, true, false, false, |
1090 | 1098 |
false); |
1091 |
accessRules = new Vector(); |
|
1099 |
accessRules = new Vector<String>();
|
|
1092 | 1100 |
accessRules.add(accessRule1); |
1093 | 1101 |
accessRules.add(accessRule2); |
1094 | 1102 |
access = getAccessBlock(accessRules, ALLOWFIRST); |
... | ... | |
1132 | 1140 |
accessRule2 = generateOneAccessRule( |
1133 | 1141 |
"cn=knb-usr,o=nceas,dc=ecoinformatics,dc=org", false, true, false, |
1134 | 1142 |
false, false); |
1135 |
accessRules = new Vector(); |
|
1143 |
accessRules = new Vector<String>();
|
|
1136 | 1144 |
accessRules.add(accessRule1); |
1137 | 1145 |
accessRules.add(accessRule2); |
1138 | 1146 |
access = getAccessBlock(accessRules, ALLOWFIRST); |
... | ... | |
1176 | 1184 |
accessRule2 = generateOneAccessRule( |
1177 | 1185 |
"cn=knb-usr,o=nceas,dc=ecoinformatics,dc=org", false, true, true, |
1178 | 1186 |
false, false); |
1179 |
accessRules = new Vector(); |
|
1187 |
accessRules = new Vector<String>();
|
|
1180 | 1188 |
accessRules.add(accessRule1); |
1181 | 1189 |
accessRules.add(accessRule2); |
1182 | 1190 |
access = getAccessBlock(accessRules, ALLOWFIRST); |
... | ... | |
1219 | 1227 |
accessRule2 = generateOneAccessRule( |
1220 | 1228 |
"cn=knb-usr,o=nceas,dc=ecoinformatics,dc=org", false, true, true, |
1221 | 1229 |
true, true); |
1222 |
accessRules = new Vector(); |
|
1230 |
accessRules = new Vector<String>();
|
|
1223 | 1231 |
accessRules.add(accessRule1); |
1224 | 1232 |
accessRules.add(accessRule2); |
1225 | 1233 |
access = getAccessBlock(accessRules, ALLOWFIRST); |
... | ... | |
1263 | 1271 |
accessRule2 = generateOneAccessRule( |
1264 | 1272 |
"cn=knb-usr,o=nceas,dc=ecoinformatics,dc=org", false, false, true, |
1265 | 1273 |
false, false); |
1266 |
accessRules = new Vector(); |
|
1274 |
accessRules = new Vector<String>();
|
|
1267 | 1275 |
accessRules.add(accessRule1); |
1268 | 1276 |
accessRules.add(accessRule2); |
1269 | 1277 |
access = getAccessBlock(accessRules, ALLOWFIRST); |
... | ... | |
1307 | 1315 |
accessRule2 = generateOneAccessRule( |
1308 | 1316 |
"cn=knb-usr,o=nceas,dc=ecoinformatics,dc=org", false, true, false, |
1309 | 1317 |
false, false); |
1310 |
accessRules = new Vector(); |
|
1318 |
accessRules = new Vector<String>();
|
|
1311 | 1319 |
accessRules.add(accessRule1); |
1312 | 1320 |
accessRules.add(accessRule2); |
1313 | 1321 |
access = getAccessBlock(accessRules, ALLOWFIRST); |
... | ... | |
1418 | 1426 |
false, false); |
1419 | 1427 |
String accessRule2 = generateOneAccessRule("public", false, true, false, |
1420 | 1428 |
false, false); |
1421 |
Vector accessRules = new Vector();
|
|
1429 |
Vector<String> accessRules = new Vector<String>();
|
|
1422 | 1430 |
accessRules.add(accessRule1); |
1423 | 1431 |
accessRules.add(accessRule2); |
1424 | 1432 |
String access = getAccessBlock(accessRules, DENYFIRST); |
... | ... | |
1458 | 1466 |
accessRule1 = generateOneAccessRule(anotheruser, true, true, true, false, |
1459 | 1467 |
false); |
1460 | 1468 |
accessRule2 = generateOneAccessRule("public", false, true, true, false, false); |
1461 |
accessRules = new Vector(); |
|
1469 |
accessRules = new Vector<String>();
|
|
1462 | 1470 |
accessRules.add(accessRule1); |
1463 | 1471 |
accessRules.add(accessRule2); |
1464 | 1472 |
access = getAccessBlock(accessRules, DENYFIRST); |
... | ... | |
1497 | 1505 |
// deny ALL rule for public. |
1498 | 1506 |
accessRule1 = generateOneAccessRule(anotheruser, true, true, true, true, true); |
1499 | 1507 |
accessRule2 = generateOneAccessRule("public", false, true, true, true, true); |
1500 |
accessRules = new Vector(); |
|
1508 |
accessRules = new Vector<String>();
|
|
1501 | 1509 |
accessRules.add(accessRule1); |
1502 | 1510 |
accessRules.add(accessRule2); |
1503 | 1511 |
access = getAccessBlock(accessRules, DENYFIRST); |
... | ... | |
1539 | 1547 |
false); |
1540 | 1548 |
accessRule2 = generateOneAccessRule("public", false, false, true, false, |
1541 | 1549 |
false); |
1542 |
accessRules = new Vector(); |
|
1550 |
accessRules = new Vector<String>();
|
|
1543 | 1551 |
accessRules.add(accessRule1); |
1544 | 1552 |
accessRules.add(accessRule2); |
1545 | 1553 |
access = getAccessBlock(accessRules, DENYFIRST); |
... | ... | |
1580 | 1588 |
false); |
1581 | 1589 |
accessRule2 = generateOneAccessRule("public", false, true, false, false, |
1582 | 1590 |
false); |
1583 |
accessRules = new Vector(); |
|
1591 |
accessRules = new Vector<String>();
|
|
1584 | 1592 |
accessRules.add(accessRule1); |
1585 | 1593 |
accessRules.add(accessRule2); |
1586 | 1594 |
access = getAccessBlock(accessRules, DENYFIRST); |
... | ... | |
1624 | 1632 |
accessRule2 = generateOneAccessRule( |
1625 | 1633 |
"cn=knb-usr,o=nceas,dc=ecoinformatics,dc=org", false, true, false, |
1626 | 1634 |
false, false); |
1627 |
accessRules = new Vector(); |
|
1635 |
accessRules = new Vector<String>();
|
|
1628 | 1636 |
accessRules.add(accessRule1); |
1629 | 1637 |
accessRules.add(accessRule2); |
1630 | 1638 |
access = getAccessBlock(accessRules, DENYFIRST); |
... | ... | |
1668 | 1676 |
accessRule2 = generateOneAccessRule( |
1669 | 1677 |
"cn=knb-usr,o=nceas,dc=ecoinformatics,dc=org", false, true, true, |
1670 | 1678 |
false, false); |
1671 |
accessRules = new Vector(); |
|
1679 |
accessRules = new Vector<String>();
|
|
1672 | 1680 |
accessRules.add(accessRule1); |
1673 | 1681 |
accessRules.add(accessRule2); |
1674 | 1682 |
access = getAccessBlock(accessRules, DENYFIRST); |
... | ... | |
1711 | 1719 |
accessRule2 = generateOneAccessRule( |
1712 | 1720 |
"cn=knb-usr,o=nceas,dc=ecoinformatics,dc=org", false, true, true, |
1713 | 1721 |
true, true); |
1714 |
accessRules = new Vector(); |
|
1722 |
accessRules = new Vector<String>();
|
|
1715 | 1723 |
accessRules.add(accessRule1); |
1716 | 1724 |
accessRules.add(accessRule2); |
1717 | 1725 |
access = getAccessBlock(accessRules, DENYFIRST); |
... | ... | |
1756 | 1764 |
accessRule2 = generateOneAccessRule( |
1757 | 1765 |
"cn=knb-usr,o=nceas,dc=ecoinformatics,dc=org", false, false, true, |
1758 | 1766 |
false, false); |
1759 |
accessRules = new Vector(); |
|
1767 |
accessRules = new Vector<String>();
|
|
1760 | 1768 |
accessRules.add(accessRule1); |
1761 | 1769 |
accessRules.add(accessRule2); |
1762 | 1770 |
access = getAccessBlock(accessRules, DENYFIRST); |
... | ... | |
1800 | 1808 |
accessRule2 = generateOneAccessRule( |
1801 | 1809 |
"cn=knb-usr,o=nceas,dc=ecoinformatics,dc=org", false, true, false, |
1802 | 1810 |
false, false); |
1803 |
accessRules = new Vector(); |
|
1811 |
accessRules = new Vector<String>();
|
|
1804 | 1812 |
accessRules.add(accessRule1); |
1805 | 1813 |
accessRules.add(accessRule2); |
1806 | 1814 |
access = getAccessBlock(accessRules, DENYFIRST); |
... | ... | |
1911 | 1919 |
false, false); |
1912 | 1920 |
String accessRule2 = generateOneAccessRule("public", false, true, false, |
1913 | 1921 |
false, false); |
1914 |
Vector accessRules = new Vector();
|
|
1922 |
Vector<String> accessRules = new Vector<String>();
|
|
1915 | 1923 |
accessRules.add(accessRule1); |
1916 | 1924 |
accessRules.add(accessRule2); |
1917 | 1925 |
String access = getAccessBlock(accessRules, DENYFIRST); |
... | ... | |
1951 | 1959 |
accessRule1 = generateOneAccessRule(anotheruser, true, true, true, false, |
1952 | 1960 |
false); |
1953 | 1961 |
accessRule2 = generateOneAccessRule("public", false, true, true, false, false); |
1954 |
accessRules = new Vector(); |
|
1962 |
accessRules = new Vector<String>();
|
|
1955 | 1963 |
accessRules.add(accessRule1); |
1956 | 1964 |
accessRules.add(accessRule2); |
1957 | 1965 |
access = getAccessBlock(accessRules, DENYFIRST); |
... | ... | |
1990 | 1998 |
// deny ALL rule for public. |
1991 | 1999 |
accessRule1 = generateOneAccessRule(anotheruser, true, true, true, true, true); |
1992 | 2000 |
accessRule2 = generateOneAccessRule("public", false, true, true, true, true); |
1993 |
accessRules = new Vector(); |
|
2001 |
accessRules = new Vector<String>();
|
|
1994 | 2002 |
accessRules.add(accessRule1); |
1995 | 2003 |
accessRules.add(accessRule2); |
1996 | 2004 |
access = getAccessBlock(accessRules, DENYFIRST); |
... | ... | |
2032 | 2040 |
false); |
2033 | 2041 |
accessRule2 = generateOneAccessRule("public", false, false, true, false, |
2034 | 2042 |
false); |
2035 |
accessRules = new Vector(); |
|
2043 |
accessRules = new Vector<String>();
|
|
2036 | 2044 |
accessRules.add(accessRule1); |
2037 | 2045 |
accessRules.add(accessRule2); |
2038 | 2046 |
access = getAccessBlock(accessRules, DENYFIRST); |
... | ... | |
2073 | 2081 |
false); |
2074 | 2082 |
accessRule2 = generateOneAccessRule("public", false, true, false, false, |
2075 | 2083 |
false); |
2076 |
accessRules = new Vector(); |
|
2084 |
accessRules = new Vector<String>();
|
|
2077 | 2085 |
accessRules.add(accessRule1); |
2078 | 2086 |
accessRules.add(accessRule2); |
2079 | 2087 |
access = getAccessBlock(accessRules, DENYFIRST); |
... | ... | |
2117 | 2125 |
accessRule2 = generateOneAccessRule( |
2118 | 2126 |
"cn=knb-usr,o=nceas,dc=ecoinformatics,dc=org", false, true, false, |
2119 | 2127 |
false, false); |
2120 |
accessRules = new Vector(); |
|
2128 |
accessRules = new Vector<String>();
|
|
2121 | 2129 |
accessRules.add(accessRule1); |
2122 | 2130 |
accessRules.add(accessRule2); |
2123 | 2131 |
access = getAccessBlock(accessRules, DENYFIRST); |
... | ... | |
2161 | 2169 |
accessRule2 = generateOneAccessRule( |
2162 | 2170 |
"cn=knb-usr,o=nceas,dc=ecoinformatics,dc=org", false, true, true, |
2163 | 2171 |
false, false); |
2164 |
accessRules = new Vector(); |
|
2172 |
accessRules = new Vector<String>();
|
|
2165 | 2173 |
accessRules.add(accessRule1); |
2166 | 2174 |
accessRules.add(accessRule2); |
2167 | 2175 |
access = getAccessBlock(accessRules, DENYFIRST); |
... | ... | |
2204 | 2212 |
accessRule2 = generateOneAccessRule( |
2205 | 2213 |
"cn=knb-usr,o=nceas,dc=ecoinformatics,dc=org", false, true, true, |
2206 | 2214 |
true, true); |
2207 |
accessRules = new Vector(); |
|
2215 |
accessRules = new Vector<String>();
|
|
2208 | 2216 |
accessRules.add(accessRule1); |
2209 | 2217 |
accessRules.add(accessRule2); |
2210 | 2218 |
access = getAccessBlock(accessRules, DENYFIRST); |
... | ... | |
2249 | 2257 |
accessRule2 = generateOneAccessRule( |
2250 | 2258 |
"cn=knb-usr,o=nceas,dc=ecoinformatics,dc=org", false, false, true, |
2251 | 2259 |
false, false); |
2252 |
accessRules = new Vector(); |
|
2260 |
accessRules = new Vector<String>();
|
|
2253 | 2261 |
accessRules.add(accessRule1); |
2254 | 2262 |
accessRules.add(accessRule2); |
2255 | 2263 |
access = getAccessBlock(accessRules, DENYFIRST); |
... | ... | |
2293 | 2301 |
accessRule2 = generateOneAccessRule( |
2294 | 2302 |
"cn=knb-usr,o=nceas,dc=ecoinformatics,dc=org", false, true, false, |
2295 | 2303 |
false, false); |
2296 |
accessRules = new Vector(); |
|
2304 |
accessRules = new Vector<String>();
|
|
2297 | 2305 |
accessRules.add(accessRule1); |
2298 | 2306 |
accessRules.add(accessRule2); |
2299 | 2307 |
access = getAccessBlock(accessRules, DENYFIRST); |
... | ... | |
3429 | 3437 |
} |
3430 | 3438 |
} |
3431 | 3439 |
|
3432 |
/** |
|
3433 |
* Read a document from metacat. The expected result is passed as result |
|
3434 |
*/ |
|
3435 |
private void readDocid(String docid, boolean result, boolean expectedKarmaFailure) { |
|
3436 |
debug("readDocid(): docid=" + docid + " expectedResult=" + result |
|
3437 |
+ " expectedKarmaFailure=" + expectedKarmaFailure); |
|
3438 |
try { |
|
3439 |
Reader r = m.read(docid); |
|
3440 |
String response = IOUtil.getAsString(r, true); |
|
3440 |
// /** |
|
3441 |
// * Read a document from metacat. The expected result is passed as result |
|
3442 |
// */ |
|
3443 |
// private void readDocid(String docid, boolean result, boolean expectedKarmaFailure) { |
|
3444 |
// debug("readDocid(): docid=" + docid + " expectedResult=" + result |
|
3445 |
// + " expectedKarmaFailure=" + expectedKarmaFailure); |
|
3446 |
// try { |
|
3447 |
// Reader r = m.read(docid); |
|
3448 |
// String response = IOUtil.getAsString(r, true); |
|
3449 |
// |
|
3450 |
// if (!result) { |
|
3451 |
// assertTrue(response, response.indexOf("<success>") == -1); |
|
3452 |
// } |
|
3453 |
// debug("readDocid(): response=" + response); |
|
3454 |
// } catch (MetacatInaccessibleException mie) { |
|
3455 |
// fail("Metacat Inaccessible:\n" + mie.getMessage()); |
|
3456 |
// } catch (InsufficientKarmaException ike) { |
|
3457 |
// if (!expectedKarmaFailure) { |
|
3458 |
// fail("Insufficient karma:\n" + ike.getMessage()); |
|
3459 |
// } |
|
3460 |
// } catch (MetacatException me) { |
|
3461 |
// fail("Metacat Error:\n" + me.getMessage()); |
|
3462 |
// } catch (Exception e) { |
|
3463 |
// fail("General exception:\n" + e.getMessage()); |
|
3464 |
// } |
|
3465 |
// } |
|
3441 | 3466 |
|
3442 |
if (!result) { |
|
3443 |
assertTrue(response, response.indexOf("<success>") == -1); |
|
3444 |
} |
|
3445 |
debug("readDocid(): response=" + response); |
|
3446 |
} catch (MetacatInaccessibleException mie) { |
|
3447 |
fail("Metacat Inaccessible:\n" + mie.getMessage()); |
|
3448 |
} catch (InsufficientKarmaException ike) { |
|
3449 |
if (!expectedKarmaFailure) { |
|
3450 |
fail("Insufficient karma:\n" + ike.getMessage()); |
|
3451 |
} |
|
3452 |
} catch (MetacatException me) { |
|
3453 |
fail("Metacat Error:\n" + me.getMessage()); |
|
3454 |
} catch (Exception e) { |
|
3455 |
fail("General exception:\n" + e.getMessage()); |
|
3456 |
} |
|
3457 |
} |
|
3458 |
|
|
3459 | 3467 |
/** |
3460 | 3468 |
* Read a document from metacat and check if it is equal to a given string. |
3461 | 3469 |
* The expected result is passed as result |
Also available in: Unified diff
Add test cases for EML 2.1.0 documents. Add some generics typing.