diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHUtilities.java b/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHUtilities.java index 1e711d0370d040df24b32450402f8225118bdc38..e197964d096a760c95c270f835d8429d08c04ad4 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHUtilities.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHUtilities.java @@ -49,7 +49,8 @@ import info.textgrid.namespaces.middleware.tgauth.ProjectInfo; * </p> * * @author Maximilian Brodhun, SUB Göttingen - * @version 2021-10-21 + * @author Stefan E. Funk, SUB Göttingen + * @version 2022-07-06 * @since 2014-01-29 */ public class OAIPMHUtilities { @@ -264,7 +265,7 @@ public class OAIPMHUtilities { final String resumptionToken, Map<String, Integer> cursorCollector, final String scrollID, final int searchResponseSize, final int i) { - log.info("Creating a ResumptionToken:\n " + "CompleteListSize: " + completeListSize + "\n" + log.debug("Creating a ResumptionToken:\n " + "CompleteListSize: " + completeListSize + "\n" + "ResumptionToken: " + resumptionToken + "\n" + "CursorCollector: " + cursorCollector + "\n" + "ScrollID: " + scrollID + "\n" + "SearchResponseSize: " + searchResponseSize + "\n" + "IterationStep: " + i); diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDelivererDC.java b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDelivererDC.java index 00d2b32aadb5e70314a3d822d09b561a23ba66c6..8d8cc9d3dca48dd524a7638680c3ed56699fa5d0 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDelivererDC.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDelivererDC.java @@ -260,14 +260,16 @@ public class RecordListDelivererDC extends RecordListDelivererAbstract { // Check the need for a resumption token! - log.info(" ## " + completeListSize + "\n ## " + resumptionToken + "\n ## " + scrollID); + System.out.println(" ## completeListSize: " + completeListSize); + System.out.println(" ## resumptionToken: " + resumptionToken); + System.out.println(" ## scrollid: " + scrollID); ResumptionTokenType resTokenForResponse = OAIPMHUtilities.getResumptionToken(completeListSize, resumptionToken, cursorCollector, scrollID, this.searchResponseSize, i); if (resTokenForResponse != null) { recordList.setResumptionToken(resTokenForResponse); - log.info(" ## resTokenForResponse: " + resTokenForResponse.getValue()); + System.out.println(" ## resTokenForResponse: " + resTokenForResponse.getValue()); } } else { diff --git a/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhDariahdeOnlineTests.java b/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhDariahdeOnlineTests.java index 764de98de1881d19a8080bbf73257f202a841dda..ba4132c9367f59c346a392d470fccb2676f90f64 100644 --- a/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhDariahdeOnlineTests.java +++ b/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhDariahdeOnlineTests.java @@ -266,6 +266,67 @@ public class OaiPmhDariahdeOnlineTests { } } + /** + * @throws IOException + */ + @Test + public void testListRecordsSetDCDifferentPrefixes() throws IOException { + + String uri = checkListRecordsSet; + + System.out.println(OaiPmhTestUtilities.TESTING + "#LISTRECORDS - HDL PREFIX"); + + if (!uri.startsWith("hdl:")) { + assertTrue("missing 'hdl:' prefix!", false); + } + System.out.println("uri: " + uri); + int pages1 = testList("ListRecords", "oai_dc", uri); + if (pages1 != checkListRecordsSetExpectedPages) { + System.out.println(pages1 + " != " + checkListRecordsSetExpectedPages); + } + + System.out.println(OaiPmhTestUtilities.TESTING + "#LISTRECORDS - NO PREFIX"); + + if (checkListRecordsSet.startsWith("hdl:")) { + uri = checkListRecordsSet.substring(4); + } + System.out.println("uri: " + uri); + int pages4 = testList("ListRecords", "oai_dc", uri); + if (pages4 != checkListRecordsSetExpectedPages) { + System.out.println(pages4 + " != " + checkListRecordsSetExpectedPages); + } + + System.out.println(OaiPmhTestUtilities.TESTING + "#LISTRECORDS - WRONG PREFIX"); + + if (checkListRecordsSet.startsWith("hdl:")) { + uri = "**" + checkListRecordsSet.substring(4); + } + System.out.println("uri: " + uri); + int pages2 = testList("ListRecords", "oai_dc", uri); + if (pages2 != checkListRecordsSetExpectedPages) { + System.out.println(pages2 + " != " + checkListRecordsSetExpectedPages); + } + + System.out.println(OaiPmhTestUtilities.TESTING + "#LISTRECORDS - WRONG PREFIX"); + + if (checkListRecordsSet.startsWith("hdl:")) { + uri = "**" + checkListRecordsSet.substring(4); + } + System.out.println("uri: " + uri); + int pages3 = testList("ListRecords", "oai_dc", uri); + if (pages3 != checkListRecordsSetExpectedPages) { + System.out.println(pages3 + " != " + checkListRecordsSetExpectedPages); + } + + // Check pages count. + if (pages1 != checkListRecordsSetExpectedPages + || pages2 != checkListRecordsSetExpectedPages + || pages3 != checkListRecordsSetExpectedPages + || pages4 != checkListRecordsSetExpectedPages) { + assertTrue("pages count does not match", false); + } + } + /** * @throws IOException */