Revision 6043
Added by Chris Jones over 13 years ago
test/edu/ucsb/nceas/metacattest/OnlineDataAccessTest.java | ||
---|---|---|
460 | 460 |
|
461 | 461 |
// try to read the data |
462 | 462 |
readDocid(onlineDocid + ".1", SUCCESS, false); |
463 |
|
|
463 |
|
|
464 | 464 |
// try to upload another data with same id |
465 | 465 |
uploadDocid(onlineDocid + ".1", |
466 | 466 |
onlinetestdatafile2, FAILURE, false); |
... | ... | |
473 | 473 |
// the docid given is for the online document |
474 | 474 |
testdocument = get201TestEmlDoc("OnlineDataAccessTest: Doing insert", |
475 | 475 |
null, null, |
476 |
"ecogrid://knb/" + onlineDocid + ".1",
|
|
476 |
"ecogrid://knb/" + onlineDocid + ".2",
|
|
477 | 477 |
null, getAccessBlock(anotheruser, true, |
478 | 478 |
true, false, false, false), |
479 | 479 |
null, null, null, null); |
... | ... | |
491 | 491 |
|
492 | 492 |
// delete the document - able to delete .1 |
493 | 493 |
// but not able to delete .2 as no rules |
494 |
// written to access table when a document |
|
495 |
// is 'uploaded' |
|
494 |
// written to access table when a document
|
|
495 |
// is 'uploaded'
|
|
496 | 496 |
deleteDocid(onlineDocid + ".1", SUCCESS, false); |
497 | 497 |
deleteDocid(onlineDocid + ".2", FAILURE, true); |
498 | 498 |
|
... | ... | |
549 | 549 |
// the docid given is for the online document |
550 | 550 |
testdocument = get210TestEmlDoc("OnlineDataAccessTest: Doing insert", |
551 | 551 |
null, null, |
552 |
"ecogrid://knb/" + onlineDocid + ".1",
|
|
552 |
"ecogrid://knb/" + onlineDocid + ".2",
|
|
553 | 553 |
null, getAccessBlock(anotheruser, true, |
554 | 554 |
true, false, false, false), |
555 | 555 |
null, null, null, null); |
... | ... | |
567 | 567 |
|
568 | 568 |
// delete the document - able to delete .1 |
569 | 569 |
// but not able to delete .2 as no rules |
570 |
// written to access table when a document |
|
571 |
// is 'uploaded' |
|
570 |
// written to access table when a document
|
|
571 |
// is 'uploaded'
|
|
572 | 572 |
deleteDocid(onlineDocid + ".1", SUCCESS, false); |
573 | 573 |
deleteDocid(onlineDocid + ".2", FAILURE, true); |
574 | 574 |
|
... | ... | |
590 | 590 |
} |
591 | 591 |
} |
592 | 592 |
|
593 |
|
|
594 | 593 |
/** |
595 | 594 |
* Checking the following cases on 2.0.1 version documents: |
596 | 595 |
* when only online data is uploaded by a user and another user |
... | ... | |
820 | 819 |
// the docid given is for the online document |
821 | 820 |
testdocument = get201TestEmlDoc("OnlineDataAccessTest: Another insert", |
822 | 821 |
null, null, |
823 |
"ecogrid://knb/" + onlineDocid + ".1",
|
|
822 |
"ecogrid://knb/" + onlineDocid + ".2",
|
|
824 | 823 |
null, getAccessBlock(anotheruser, true, |
825 | 824 |
false, false, false, true), |
826 | 825 |
null, null, null, null); |
... | ... | |
906 | 905 |
// the docid given is for the online document |
907 | 906 |
testdocument = get201TestEmlDoc("OnlineDataAccessTest: Doing insert", |
908 | 907 |
null, null, |
909 |
"ecogrid://knb/" + onlineDocid + ".1",
|
|
908 |
"ecogrid://knb/" + onlineDocid + ".2",
|
|
910 | 909 |
null, getAccessBlock(anotheruser, true, |
911 | 910 |
true, false, false, false), |
912 | 911 |
null, null, null, null); |
... | ... | |
980 | 979 |
// the docid given is for the online document |
981 | 980 |
testdocument = get210TestEmlDoc("OnlineDataAccessTest: Doing insert", |
982 | 981 |
null, null, |
983 |
"ecogrid://knb/" + onlineDocid + ".1",
|
|
982 |
"ecogrid://knb/" + onlineDocid + ".2",
|
|
984 | 983 |
null, getAccessBlock(anotheruser, true, |
985 | 984 |
false, false, false, true), |
986 | 985 |
null, null, null, null); |
... | ... | |
1022 | 1021 |
// the docid given is for the online document |
1023 | 1022 |
testdocument = get210TestEmlDoc("OnlineDataAccessTest: Another insert", |
1024 | 1023 |
null, null, |
1025 |
"ecogrid://knb/" + onlineDocid + ".1",
|
|
1024 |
"ecogrid://knb/" + onlineDocid + ".2",
|
|
1026 | 1025 |
null, getAccessBlock(anotheruser, true, |
1027 | 1026 |
false, false, false, true), |
1028 | 1027 |
null, null, null, null); |
... | ... | |
1064 | 1063 |
// the docid given is for the online document |
1065 | 1064 |
testdocument = get210TestEmlDoc("OnlineDataAccessTest: Doing insert", |
1066 | 1065 |
null, null, |
1067 |
"ecogrid://knb/" + onlineDocid + ".1",
|
|
1066 |
"ecogrid://knb/" + onlineDocid + ".2",
|
|
1068 | 1067 |
null, getAccessBlock(anotheruser, true, |
1069 | 1068 |
false, false, false, true), |
1070 | 1069 |
null, null, null, null); |
... | ... | |
1108 | 1107 |
// the docid given is for the online document |
1109 | 1108 |
testdocument = get210TestEmlDoc("OnlineDataAccessTest: Doing insert", |
1110 | 1109 |
null, null, |
1111 |
"ecogrid://knb/" + onlineDocid + ".1",
|
|
1110 |
"ecogrid://knb/" + onlineDocid + ".2",
|
|
1112 | 1111 |
null, getAccessBlock(anotheruser, true, |
1113 | 1112 |
true, false, false, false), |
1114 | 1113 |
null, null, null, null); |
... | ... | |
1224 | 1223 |
// the docid given is for the online document |
1225 | 1224 |
testdocument = get201TestEmlDoc("OnlineDataAccessTest: Doing insert", |
1226 | 1225 |
null, null, |
1227 |
"ecogrid://knb/" + onlineDocid + ".1",
|
|
1226 |
"ecogrid://knb/" + onlineDocid + ".2",
|
|
1228 | 1227 |
null, null, null, null, |
1229 | 1228 |
getAccessBlock(anotheruser, true, |
1230 | 1229 |
false, false, false, true), null); |
... | ... | |
1384 | 1383 |
// the docid given is for the online document |
1385 | 1384 |
testdocument = get210TestEmlDoc("OnlineDataAccessTest: Doing insert", |
1386 | 1385 |
null, null, |
1387 |
"ecogrid://knb/" + onlineDocid + ".1",
|
|
1386 |
"ecogrid://knb/" + onlineDocid + ".2",
|
|
1388 | 1387 |
null, null, null, null, |
1389 | 1388 |
getAccessBlock(anotheruser, true, |
1390 | 1389 |
false, false, false, true), null); |
... | ... | |
1426 | 1425 |
// the docid given is for the online document |
1427 | 1426 |
testdocument = get210TestEmlDoc("OnlineDataAccessTest: Doing insert", |
1428 | 1427 |
null, null, |
1429 |
"ecogrid://knb/" + onlineDocid + ".1",
|
|
1428 |
"ecogrid://knb/" + onlineDocid + ".2",
|
|
1430 | 1429 |
null, null, null, null, |
1431 | 1430 |
getAccessBlock(anotheruser, true, |
1432 | 1431 |
false, false, false, true), null); |
... | ... | |
1468 | 1467 |
// the docid given is for the online document |
1469 | 1468 |
testdocument = get210TestEmlDoc("OnlineDataAccessTest: Doing insert", |
1470 | 1469 |
null, null, |
1471 |
"ecogrid://knb/" + onlineDocid + ".1",
|
|
1470 |
"ecogrid://knb/" + onlineDocid + ".2",
|
|
1472 | 1471 |
null, null, null, null, |
1473 | 1472 |
getAccessBlock(anotheruser, true, |
1474 | 1473 |
false, false, false, true), null); |
... | ... | |
1512 | 1511 |
// the docid given is for the online document |
1513 | 1512 |
testdocument = get210TestEmlDoc("OnlineDataAccessTest: Doing insert", |
1514 | 1513 |
null, null, |
1515 |
"ecogrid://knb/" + onlineDocid + ".1",
|
|
1514 |
"ecogrid://knb/" + onlineDocid + ".2",
|
|
1516 | 1515 |
null, null, null, null, |
1517 | 1516 |
getAccessBlock(anotheruser, true, |
1518 | 1517 |
true, false, false, false), null); |
... | ... | |
1553 | 1552 |
// upload online data |
1554 | 1553 |
onlineDocid = generateDocid(); |
1555 | 1554 |
m.login(username, password); |
1555 |
uploadDocid(onlineDocid + ".1", onlinetestdatafile1, SUCCESS, false); |
|
1556 | 1556 |
|
1557 | 1557 |
/////////Case 1 |
1558 | 1558 |
testdocument = get201TestEmlDoc("OnlineDataAccessTest: Doing insert", null, null, |
... | ... | |
1905 | 1905 |
else { |
1906 | 1906 |
assertTrue( (response.indexOf("<success>") == -1)); |
1907 | 1907 |
} |
1908 |
System.err.println("respose from metacat: " + response); |
|
1908 |
System.err.println("response from metacat: " + response);
|
|
1909 | 1909 |
} |
1910 | 1910 |
catch (MetacatInaccessibleException mie) { |
1911 | 1911 |
fail("Metacat Inaccessible:\n" + mie.getMessage()); |
Also available in: Unified diff
Due to changes in MetacatHandler that creates system metadata from uploaded EML documents, OnlineDataAccessTest was failing certain tests because of errors in how the test documents were originally uploaded. MetacatHandler.createSystemMetadata() was throwing exceptions because of these errors, specifically when a data document is uploaded with a docid that is difeerent than the docid statement in the EML distribution URL. Most errors involved stated docids with .2 versions, and the metadata had .1 versions.
Modified each test in OnlineDataAccessTest that had incorrect metadata from the declared docids. Lastly, onlineData201CasesTest_5 was failing due to a data document not being uploaded. Now it does, and both the failure and success test succeed as expected.