Revision 5411
Added by berkley over 14 years ago
test/edu/ucsb/nceas/metacat/dataone/CrudServiceTest.java | ||
---|---|---|
87 | 87 |
public static Test suite() |
88 | 88 |
{ |
89 | 89 |
TestSuite suite = new TestSuite(); |
90 |
/* suite.addTest(new CrudServiceTest("initialize"));
|
|
90 |
suite.addTest(new CrudServiceTest("initialize")); |
|
91 | 91 |
suite.addTest(new CrudServiceTest("testSingletonAccessor")); |
92 | 92 |
suite.addTest(new CrudServiceTest("testCreateAndGet")); |
93 | 93 |
suite.addTest(new CrudServiceTest("testGetSystemMetadata")); |
94 |
suite.addTest(new CrudServiceTest("testUpdate"));*/
|
|
94 |
suite.addTest(new CrudServiceTest("testUpdate")); |
|
95 | 95 |
suite.addTest(new CrudServiceTest("testListObjects")); |
96 |
/*suite.addTest(new CrudServiceTest("testAccessControl"));
|
|
96 |
suite.addTest(new CrudServiceTest("testAccessControl")); |
|
97 | 97 |
suite.addTest(new CrudServiceTest("testGenerateMissingSystemMetadata")); |
98 | 98 |
suite.addTest(new CrudServiceTest("testGetLogRecords")); |
99 | 99 |
suite.addTest(new CrudServiceTest("testChecksumError")); |
100 |
suite.addTest(new CrudServiceTest("testPublicAccess"));*/
|
|
100 |
//suite.addTest(new CrudServiceTest("testPublicAccess"));
|
|
101 | 101 |
return suite; |
102 | 102 |
} |
103 | 103 |
|
... | ... | |
317 | 317 |
//create docs at different times |
318 | 318 |
Date d1 = new Date(); |
319 | 319 |
Identifier id1 = createDoc(token, getTestDoc(), of1); |
320 |
makeDocPublic(token, id1, true); |
|
321 | 320 |
SystemMetadata sm1 = getSystemMetadata(token, id1); |
322 | 321 |
|
323 | 322 |
Date d2 = new Date(); |
... | ... | |
393 | 392 |
assertTrue(idInObjectList(id3, list6)); |
394 | 393 |
assertTrue(idInObjectList(id5, list6)); |
395 | 394 |
|
396 |
//should return all
|
|
395 |
//should return 4 (id1 is not public)
|
|
397 | 396 |
token = new AuthToken("public"); |
398 | 397 |
ObjectList list7 = cs.listObjects(token, d1, d6, null); |
399 | 398 |
System.out.println("list7 size: " + list7.sizeObjectInfoList()); |
400 |
assertTrue(list7.sizeObjectInfoList() == 5);
|
|
399 |
assertTrue(list7.sizeObjectInfoList() == 4);
|
|
401 | 400 |
|
402 | 401 |
} |
403 | 402 |
catch(Exception e) |
src/edu/ucsb/nceas/metacat/restservice/ResourceHandler.java | ||
---|---|---|
1086 | 1086 |
String smidS = im.getSystemMetadataId(id.getValue()); |
1087 | 1087 |
Identifier smid = new Identifier(); |
1088 | 1088 |
smid.setValue(smidS); |
1089 |
cs.setAccess(token, smid, "public", "read", "allow", "allowFirst");
|
|
1089 |
cs.setAccess(token, smid, principal, permission, permissionType, permissionOrder);
|
|
1090 | 1090 |
} |
1091 | 1091 |
} |
1092 | 1092 |
catch(Exception e) |
src/edu/ucsb/nceas/metacat/dataone/CrudService.java | ||
---|---|---|
464 | 464 |
"identifier", "objectFormat", "dateSysMetadataModified", "checksum", "checksum/@algorithm"}); |
465 | 465 |
params.put("anyfield", new String[] {"%"}); |
466 | 466 |
|
467 |
System.out.println("query is: metacatUrl: " + metacatUrl + " user: " + sessionData.getUserName() + |
|
468 |
" sessionid: " + sessionData.getId() + " params: " + params.toString()); |
|
467 |
//System.out.println("query is: metacatUrl: " + metacatUrl + " user: " + sessionData.getUserName() +
|
|
468 |
// " sessionid: " + sessionData.getId() + " params: " + params.toString());
|
|
469 | 469 |
|
470 | 470 |
MetacatResultSet rs = handler.query(metacatUrl, params, sessionData.getUserName(), |
471 | 471 |
sessionData.getGroupNames(), sessionData.getId()); |
... | ... | |
475 | 475 |
count = docs.size(); |
476 | 476 |
} |
477 | 477 |
|
478 |
System.out.println("query returned " + count + " documents."); |
|
478 |
//System.out.println("query returned " + count + " documents.");
|
|
479 | 479 |
|
480 | 480 |
for(int i=start; i<count; i++) |
481 | 481 |
{ |
... | ... | |
533 | 533 |
id.setValue(d.getField("identifier")); |
534 | 534 |
info.setIdentifier(id); |
535 | 535 |
info.setObjectFormat(returnedObjectFormat); |
536 |
//info.setSize(new Long(d.getField("size").trim()).longValue());
|
|
536 |
info.setSize(new Long(d.getField("size").trim()).longValue()); |
|
537 | 537 |
//add the ObjectInfo to the ObjectList |
538 | 538 |
ol.addObjectInfo(info); |
539 |
//System.out.println("adding doc " + i + " to the objectList"); |
|
540 | 539 |
} |
541 | 540 |
} |
542 | 541 |
catch(Exception e) |
... | ... | |
548 | 547 |
EventLog.getInstance().log(metacatUrl, |
549 | 548 |
username, null, "read"); |
550 | 549 |
logCrud.info("listObjects"); |
551 |
System.out.println("ol.size: " + ol.sizeObjectInfoList()); |
|
550 |
//System.out.println("ol.size: " + ol.sizeObjectInfoList()); |
|
551 |
ol.setCount(ol.sizeObjectInfoList()); |
|
552 |
ol.setStart(0); |
|
553 |
ol.setTotal(ol.sizeObjectInfoList()); |
|
552 | 554 |
return ol; |
553 | 555 |
} |
554 | 556 |
|
... | ... | |
932 | 934 |
|
933 | 935 |
// if the session id is registered in SessionService, get the |
934 | 936 |
// SessionData for it. Otherwise, use the public session. |
935 |
System.out.println("sessionid: " + sessionId); |
|
937 |
//System.out.println("sessionid: " + sessionId);
|
|
936 | 938 |
if (sessionId != null && |
937 | 939 |
!sessionId.toLowerCase().equals("public") && |
938 | 940 |
SessionService.getInstance().isSessionRegistered(sessionId)) |
939 | 941 |
{ |
940 |
System.out.println("looking for registered session"); |
|
941 | 942 |
sessionData = SessionService.getInstance().getRegisteredSession(sessionId); |
942 | 943 |
} else { |
943 |
System.out.println("returning public session"); |
|
944 | 944 |
sessionData = SessionService.getInstance().getPublicSession(); |
945 | 945 |
} |
946 |
|
|
947 |
System.out.println("Session user is now: " + sessionData.getUserName()); |
|
948 |
|
|
946 |
|
|
949 | 947 |
return sessionData; |
950 | 948 |
} |
951 | 949 |
|
Also available in: Unified diff
fixed error with listObjects and get.