diff --git a/oaipmh-core/pom.xml b/oaipmh-core/pom.xml index 7cbb94eb6ecf2068e659efd42751ead1808691f1..c51818be71827c41906419cf1cac21271ea80406 100644 --- a/oaipmh-core/pom.xml +++ b/oaipmh-core/pom.xml @@ -5,7 +5,7 @@ <parent> <artifactId>oaipmh</artifactId> <groupId>info.textgrid.middleware</groupId> - <version>4.0.3-SNAPSHOT</version> + <version>4.0.4-SNAPSHOT</version> </parent> <groupId>info.textgrid.middleware</groupId> <artifactId>oaipmh-core</artifactId> diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/IdentifierListDelivererAbstract.java b/oaipmh-core/src/main/java/info/textgrid/middleware/IdentifierListDelivererAbstract.java index 2c817d91761e3d8873cfc659668260d3446c1d98..0bcf0fc067a504b2c307d45b041f5acd128c7497 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/IdentifierListDelivererAbstract.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/IdentifierListDelivererAbstract.java @@ -88,18 +88,24 @@ public abstract class IdentifierListDelivererAbstract implements IdentifierListD ErrorHandler result = new ErrorHandler(); + // Check for metadata prefix AND resumption token. + if (request.getMetadataPrefix() != null && request.getResumptionToken() != null) { + result.setError(OAIPMHConstants.OAI_BAD_ARGUMENT, + "The resumptionToken is an exclusive argument, please remove metadataPrefix!"); + } + // Check if metadata prefix is existing and valid. if (request.getMetadataPrefix() != null && !request.getMetadataPrefix().equals(OAIPMHUtilities.OAIDC_PREFIX) && !request.getMetadataPrefix().equals(OAIPMHConstants.METADATA_IDIOM_PREFIX) && !request.getMetadataPrefix().equals(OAIPMHConstants.METADATA_OPENAIRE_PREFIX)) { result.setError(OAIPMHConstants.OAI_METADATA_FORMAT_ERROR, - "The value of the metadataPrefix: " + request.getMetadataPrefix() + "The value of the metadataPrefix " + request.getMetadataPrefix() + " is not supported by the item identified by the value of: " + request.getIdentifier()); } - // Check if resumptionToken is invalid or existing. + // Check for invalid resumptionToken. if (request.getResumptionToken() != null) { boolean restokDCExisting = IdentifierListDelivererDC.cursorCollector != null && IdentifierListDelivererDC.cursorCollector.containsKey(request.getResumptionToken()); @@ -107,14 +113,13 @@ public abstract class IdentifierListDelivererAbstract implements IdentifierListD && IdentifierListDelivererDC.cursorCollector.containsKey(request.getResumptionToken()); boolean restok = cursorCollector != null && cursorCollector.containsKey(request.getResumptionToken()); - if (!restokDCExisting && !restokIDIOMExisting && !restok) { - result.setError(OAIPMHConstants.OAI_BAD_RESUMPTION_TOKEN, "The value of the " + request.getResumptionToken() + " argument is invalid or expired."); } } + // Check more errors. List<String> errorValues = new ArrayList<String>(); if (request.getResumptionToken() == null && request.getMetadataPrefix() == null) { @@ -124,8 +129,9 @@ public abstract class IdentifierListDelivererAbstract implements IdentifierListD errorValues.add("identifier"); } if (errorValues.size() > 0) { - result.setError(OAIPMHConstants.OAI_BAD_ARGUMENT, "The request includes illegal arguments " - + "or is missing required arguments: " + errorValues); + result.setError(OAIPMHConstants.OAI_BAD_ARGUMENT, + "The request includes illegal arguments or is missing required arguments: " + + errorValues); } return result; diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHImpl.java b/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHImpl.java index e03760b5f9c00256e6b6a0a86a74675695090a92..4b1465a5939019af891733f5765facae8bb6d709 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHImpl.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHImpl.java @@ -32,13 +32,26 @@ import info.textgrid.middleware.oaipmh.VerbType; * * @author Maximilian Brodhun, SUB Göttingen * @author Stefan E. Funk, SUB Göttingen - * @version 2021-07-12 + * @version 2021-10-21 * @since 2014-01-29 */ public class OAIPMHImpl implements OAIPMHProducer { // NOTE Changed OpenAireIdentifierList into IdentifierListDelivererDATACITE! + // ** + // PRIVATE STATIC FINAL + // ** + + private static final String ERR_VAL_IDENTIFIER = "identifier"; + private static final String ERR_VAL_FROM = "from"; + private static final String ERR_VAL_MDPREFIX = "metadataPrefix"; + private static final String ERR_VAL_RESTOK = "resumptionToken"; + private static final String ERR_VAL_UNTIL = "until"; + private static final String ERR_VAL_SET = "set"; + private static final String ILLEGAL_OAI_VERB = "Illegal OAI verb"; + private static final String ILLEGAL_ARG = "The request includes illegal arguments: "; + // ** // STATICS // ** @@ -55,17 +68,14 @@ public class OAIPMHImpl implements OAIPMHProducer { private RecordListDelivererDC recordListDC; private RecordListDelivererIDIOM recordListIDIOM; - // private OpenAireRecordList openAireRecordList; private RecordListDelivererDATACITE recordListDATACITE; private RecordDelivererDC recordDC; private RecordDelivererIDIOM recordIDIOM; - // private OpenAireRecord openAireRecord; private RecordDelivererDATACITE recordDATACITE; private IdentifierListDelivererDC identifierListDC; private IdentifierListDelivererIDIOM identifierListIDIOM; - // private OpenAireIdentifierList openAireIdentifierList; private IdentifierListDelivererDATACITE identifierListDATACITE; private MetadataFormatListDelivererInterface metadataFormatList; @@ -96,34 +106,28 @@ public class OAIPMHImpl implements OAIPMHProducer { RepIdentification rep, // 0 RecordDelivererDC recordDC, // 1 RecordDelivererIDIOM recordIDIOM, // 2 - // OpenAireRecord openAireRecord, // 3 RecordDelivererDATACITE recordDATACITE, // 3 RecordListDelivererDC recordListDC, // 4 RecordListDelivererIDIOM recordListIDIOM, // 5 - // OpenAireRecordList openAireRecordList, // 6 RecordListDelivererDATACITE recordListDATACITE, // 6 MetadataFormatListDelivererInterface metadataFormatList, // 7 SetListDeliverer setList, // 8 IdentifierListDelivererDC identifierList, // 9 IdentifierListDelivererIDIOM identifierListIDIOM, // 10 - // OpenAireIdentifierList openAireIdentifierList // 11 IdentifierListDelivererDATACITE identifierListDATACITE // 11 ) { this.rep = rep; this.recordDC = recordDC; this.recordIDIOM = recordIDIOM; - // this.openAireRecord = openAireRecord; this.recordDATACITE = recordDATACITE; this.recordListDC = recordListDC; this.recordListIDIOM = recordListIDIOM; - // this.openAireRecordList = openAireRecordList; this.recordListDATACITE = recordListDATACITE; this.identifierListDC = identifierList; this.identifierListIDIOM = identifierListIDIOM; - // this.openAireIdentifierList = openAireIdentifierList; this.identifierListDATACITE = identifierListDATACITE; this.metadataFormatList = metadataFormatList; @@ -238,26 +242,25 @@ public class OAIPMHImpl implements OAIPMHProducer { } else { if (request.getIdentifier() != null) { - errorValues.add("identifier"); + errorValues.add(ERR_VAL_IDENTIFIER); } if (request.getFrom() != null) { - errorValues.add("from"); + errorValues.add(ERR_VAL_FROM); } if (request.getMetadataPrefix() != null) { - errorValues.add("metadataPrefix"); + errorValues.add(ERR_VAL_MDPREFIX); } if (request.getResumptionToken() != null) { - errorValues.add("ResumptionToken"); + errorValues.add(ERR_VAL_RESTOK); } if (request.getUntil() != null) { - errorValues.add("Until"); + errorValues.add(ERR_VAL_FROM); } if (request.getSet() != null) { - errorValues.add("Set"); + errorValues.add(ERR_VAL_SET); } - this.error.setError(OAIPMHConstants.OAI_BAD_ARGUMENT, - "The request includes illegal arguments: " + errorValues); + this.error.setError(OAIPMHConstants.OAI_BAD_ARGUMENT, ILLEGAL_ARG + errorValues); oaipmhRoot.getError().add(this.error.getError()); } @@ -305,13 +308,7 @@ public class OAIPMHImpl implements OAIPMHProducer { String id = request.getIdentifier(); try { getRecord = recDeliv.getRecordById(id); - } catch (ParseException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (DatatypeConfigurationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { + } catch (ParseException | DatatypeConfigurationException | IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } @@ -348,21 +345,22 @@ public class OAIPMHImpl implements OAIPMHProducer { oaipmhRoot.getError().add(requestErrors.getError()); } else { - // If metadataFormat IS SET, set recordListDeliverer accordingly. IdentifierListDelivererInterface idListDeliv = null; + + // If metadataFormat IS SET, set recordListDeliverer accordingly (requestChecker checks for + // BOTH resumption token and metadata format params!). if (request.getMetadataPrefix() != null) { if (request.getMetadataPrefix().equals(OAIPMHUtilities.OAIDC_PREFIX)) { idListDeliv = this.identifierListDC; } else if (request.getMetadataPrefix().equals(OAIPMHConstants.METADATA_IDIOM_PREFIX)) { idListDeliv = this.identifierListIDIOM; } else if (request.getMetadataPrefix().equals(OAIPMHConstants.METADATA_OPENAIRE_PREFIX)) { - // idListDeliv = this.openAireIdentifierList; idListDeliv = this.identifierListDATACITE; } } - // If metadata format IS NOT SET, check resumption token hash maps to decide if we have to - // serve oai_dc or idiom_mets metadata format. + // If resumption token IS SET, check resumption token hash maps to decide which metadata + // format we shall use. else { boolean restokDCExisting = IdentifierListDelivererDC.cursorCollector != null && IdentifierListDelivererDC.cursorCollector.containsKey(request.getResumptionToken()); @@ -372,12 +370,12 @@ public class OAIPMHImpl implements OAIPMHProducer { boolean restokOpenAireExisting = OAIPMHUtilities.cursorCollector != null && IdentifierListDelivererAbstract.cursorCollector .containsKey(request.getResumptionToken()); + if (restokDCExisting) { idListDeliv = this.identifierListDC; } else if (restokIDIOMExisting) { idListDeliv = this.identifierListIDIOM; } else if (restokOpenAireExisting) { - // idListDeliv = this.openAireIdentifierList; idListDeliv = this.identifierListDATACITE; } } @@ -427,26 +425,25 @@ public class OAIPMHImpl implements OAIPMHProducer { List<String> errorValues = new ArrayList<String>(); ErrorHandler badArgument = new ErrorHandler(); if (request.getIdentifier() != null) { - errorValues.add("identifier"); + errorValues.add(ERR_VAL_IDENTIFIER); } if (request.getFrom() != null) { - errorValues.add("from"); + errorValues.add(ERR_VAL_FROM); } if (request.getMetadataPrefix() != null) { - errorValues.add("metadataPrefix"); + errorValues.add(ERR_VAL_MDPREFIX); } if (request.getResumptionToken() != null) { - errorValues.add("ResumptionToken"); + errorValues.add(ERR_VAL_RESTOK); } if (request.getUntil() != null) { - errorValues.add("until"); + errorValues.add(ERR_VAL_UNTIL); } if (request.getSet() != null) { - errorValues.add("set"); + errorValues.add(ERR_VAL_SET); } - badArgument.setError(OAIPMHConstants.OAI_BAD_ARGUMENT, - "The request includes illegal arguments: " + errorValues); + badArgument.setError(OAIPMHConstants.OAI_BAD_ARGUMENT, ILLEGAL_ARG + errorValues); oaipmhRoot.getError().add(badArgument.getError()); } @@ -486,21 +483,20 @@ public class OAIPMHImpl implements OAIPMHProducer { } else { - if (request.getFrom() != null) { - errorValues.add("from"); + errorValues.add(ERR_VAL_FROM); } if (request.getMetadataPrefix() != null) { - errorValues.add("metadataPrefix"); + errorValues.add(ERR_VAL_MDPREFIX); } if (request.getResumptionToken() != null) { - errorValues.add("resumptionToken"); + errorValues.add(ERR_VAL_RESTOK); } if (request.getSet() != null) { - errorValues.add("set"); + errorValues.add(ERR_VAL_SET); } if (request.getUntil() != null) { - errorValues.add("until"); + errorValues.add(ERR_VAL_UNTIL); } this.error.setError(OAIPMHConstants.OAI_BAD_ARGUMENT, "The request includes illegal " @@ -528,8 +524,10 @@ public class OAIPMHImpl implements OAIPMHProducer { oaipmhRoot.getError().add(requestErrors.getError()); } else { - // If metadataFormat IS SET, set recordListDeliverer accordingly. RecordListDelivererInterface recListDeliv = null; + + // If metadataFormat IS SET, set recordListDeliverer accordingly (requestChecker checks for + // BOTH resumption token and metadata format params!). if (request.getMetadataPrefix() != null) { if (request.getMetadataPrefix().equals(OAIPMHUtilities.OAIDC_PREFIX)) { recListDeliv = this.recordListDC; @@ -542,14 +540,13 @@ public class OAIPMHImpl implements OAIPMHProducer { } } - // If metadata format IS NOT SET, check resumption token hash maps to decide if we have to - // serve oai_dc or idiom_mets metadata format. + // If resumption token IS SET, check resumption token hash maps to decide which metadata + // format we shall use. else { boolean restokDCExisting = RecordListDelivererDC.cursorCollector != null && RecordListDelivererDC.cursorCollector.containsKey(request.getResumptionToken()); boolean restokIDIOMExisting = RecordListDelivererIDIOM.cursorCollector != null && RecordListDelivererIDIOM.cursorCollector.containsKey(request.getResumptionToken()); - boolean restokOpenAireExisting = RecordListDelivererAbstract.cursorCollector != null && RecordListDelivererAbstract.cursorCollector .containsKey(request.getResumptionToken()); @@ -608,7 +605,7 @@ public class OAIPMHImpl implements OAIPMHProducer { } else if (verb != null && verb.equals("GetRecord")) { verbParam = VerbType.GET_RECORD; } else if (verb != null && verb.length() > 0) { - this.error.setError(OAIPMHConstants.OAI_VERB_ERROR, "Illegal OAI verb"); + this.error.setError(OAIPMHConstants.OAI_VERB_ERROR, ILLEGAL_OAI_VERB); } // Verb not set --> please do use verb=Identify! // FIXME Is the following appropriate?? Do we miss any error messages that way?? @@ -782,11 +779,11 @@ public class OAIPMHImpl implements OAIPMHProducer { } } else { if (this.error.getError().getValue() != null - && this.error.getError().getValue().equals("Illegal OAI verb")) { - this.error.setError(OAIPMHConstants.OAI_VERB_ERROR, "Illegal OAI verb"); + && this.error.getError().getValue().equals(ILLEGAL_OAI_VERB)) { + this.error.setError(OAIPMHConstants.OAI_VERB_ERROR, ILLEGAL_OAI_VERB); response.getError().add(this.error.getError()); } else { - this.error.setError(OAIPMHConstants.OAI_VERB_ERROR, "Illegal OAI verb"); + this.error.setError(OAIPMHConstants.OAI_VERB_ERROR, ILLEGAL_OAI_VERB); response.getError().add(this.error.getError()); } } 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 f21b86706eebd5e248e7381e46c1f415d0bd0a47..ae76ca3a9b5f9cec387259464c05eb2ce15b4a9d 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHUtilities.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHUtilities.java @@ -451,7 +451,7 @@ public class OAIPMHUtilities { } } } catch (JSONException e) { - log.error("IGNORING JSON ERROR: " + e.getMessage()); + log.debug("IGNORING JSON ERROR: " + e.getMessage()); } } @@ -486,7 +486,7 @@ public class OAIPMHUtilities { } } } catch (JSONException e) { - log.error("IGNORING JSON ERROR: " + e.getMessage()); + log.debug("IGNORING JSON ERROR: " + e.getMessage()); } return fieldResults; diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDelivererAbstract.java b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDelivererAbstract.java index 6970812c23d851d7e1e92d915490f8d63cced8ff..fa2c5b8b95b13a74860f05765efdddb41a4488f6 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDelivererAbstract.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDelivererAbstract.java @@ -174,27 +174,31 @@ public abstract class RecordListDelivererAbstract implements RecordListDeliverer ErrorHandler result = new ErrorHandler(); + // Check for metadata prefix AND resumption token. + if (request.getMetadataPrefix() != null && request.getResumptionToken() != null) { + result.setError(OAIPMHConstants.OAI_BAD_ARGUMENT, + "The resumptionToken is an exclusive argument, please remove metadataPrefix!"); + } + // Check if metadata prefix is existing and valid. if (request.getMetadataPrefix() != null && !request.getMetadataPrefix().equals(OAIPMHUtilities.OAIDC_PREFIX) && !request.getMetadataPrefix().equals(OAIPMHConstants.METADATA_IDIOM_PREFIX) && !request.getMetadataPrefix().equals(OAIPMHConstants.METADATA_OPENAIRE_PREFIX)) { result.setError(OAIPMHConstants.OAI_METADATA_FORMAT_ERROR, - "The value of the metadataPrefix: " + request.getMetadataPrefix() + "The value of the metadataPrefix " + request.getMetadataPrefix() + " is not supported by the item identified by the value of: " + request.getIdentifier()); } - // Check if resumptionToken is invalid or existing. + // Check for invalid resumptionToken. if (request.getResumptionToken() != null) { boolean restokIDIOMExisting = RecordListDelivererIDIOM.cursorCollector != null && RecordListDelivererIDIOM.cursorCollector.containsKey(request.getResumptionToken()); - boolean restokDCExisting = RecordListDelivererDC.cursorCollector != null && RecordListDelivererDC.cursorCollector.containsKey(request.getResumptionToken()); boolean restok = cursorCollector != null && cursorCollector.containsKey(request.getResumptionToken()); - if (!restokDCExisting && !restokIDIOMExisting && !restok) { result.setError(OAIPMHConstants.OAI_BAD_RESUMPTION_TOKEN, "The value of the " + request.getResumptionToken() + " argument is invalid or expired."); 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 49644298a80f415f351e35b5131071c365ae2816..715089ab10f332408811aa76c82270fed42cf606 100644 --- a/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhDariahdeOnlineTests.java +++ b/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhDariahdeOnlineTests.java @@ -21,7 +21,7 @@ import info.textgrid.utils.httpclient.TGHttpResponse; * * @author Stefan E. Funk, SUB Göttingen */ -//@Ignore +@Ignore public class OaiPmhDariahdeOnlineTests { // TODO Configure config files for all the different OAI-PMH service instances! @@ -455,8 +455,6 @@ public class OaiPmhDariahdeOnlineTests { i = res.indexOf("<" + recordOrHeader + ">", i); } - System.out.println("recordCount: " + recordCount); - System.out.println("\t" + recordOrHeader + "s: " + recordCount); // Check if token tag is existing. diff --git a/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTextgridOnlineTests.java b/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTextgridOnlineTests.java index 13354373da9f27467a0f1a2ba92ddf10f74c44a3..fc6e4187d0ae3dd8678b990791d854de0b21aab2 100644 --- a/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTextgridOnlineTests.java +++ b/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTextgridOnlineTests.java @@ -14,9 +14,7 @@ import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; -import info.textgrid.namespaces.middleware.tgcrud.services.tgcrudservice.AuthFault; import info.textgrid.utils.httpclient.TGHttpClient; import info.textgrid.utils.httpclient.TGHttpResponse; @@ -27,7 +25,7 @@ import info.textgrid.utils.httpclient.TGHttpResponse; * * @author Stefan E. Funk, SUB Göttingen */ -@Ignore +// @Ignore public class OaiPmhTextgridOnlineTests { private static final String OAI_DC_PREFIX = "oai_dc"; @@ -563,6 +561,25 @@ public class OaiPmhTextgridOnlineTests { System.out.println(OK); } + /** + * @throws IOException + */ + @Test + public void testListIdentifiersOAIDCMorePagesAndMetadataFormatWithRestok() throws IOException { + + System.out.println(TESTING + "testListIdentifiersOAIDCMorePagesAndMetadataFormatWithRestok()"); + + // Testing set: Digitale Bibliothek (on prod and dev available only...) + String set = "project:TGPR-372fe6dc-57f2-6cd4-01b5-2c4bbefcfd3c"; + + testList(VERB_LIST_IDENTIFIERS, set, OAI_DC_PREFIX, 30, 100, NO_THREAD_NAME, NO_FROM, NO_UNTIL, + METADATA_FORMAT_WITH_RESTOK); + + // The metadataFormat is simply requested and ignored by the server here! Must it be an error? + + System.out.println(OK); + } + /** * @throws IOException */ @@ -580,7 +597,7 @@ public class OaiPmhTextgridOnlineTests { /** * @throws IOException */ - @Test(expected = IOException.class) // FIXME Fix expected error! + @Test public void testListIdentifiersIDIOMMETSSomePagesAndMetadataFormatWithRestok() throws IOException { @@ -590,6 +607,8 @@ public class OaiPmhTextgridOnlineTests { testList(VERB_LIST_IDENTIFIERS, NO_SET, OAI_IDIOMMETS_PREFIX, 3, 30, NO_THREAD_NAME, NO_FROM, NO_UNTIL, METADATA_FORMAT_WITH_RESTOK); + // The metadataFormat is simply requested and ignored by the server here! Must it be an error? + System.out.println(OK); } @@ -618,26 +637,21 @@ public class OaiPmhTextgridOnlineTests { System.out.println(TESTING + "testListIdentifiersConcurrentlyIDIOMMETSMorePages()"); - // Do not test on dev.textgridlab.org. We only do have ONE IDIOM page yet! - if (!host.contains("dev.textgridlab.org")) { - ExecutorService executor = Executors.newFixedThreadPool(3); - - Future<Boolean> f1 = - executor.submit(new OaiPmhResumptionTokenTestThread(VERB_LIST_IDENTIFIERS, - NO_SET, OAI_IDIOMMETS_PREFIX, 3, 30, "[C1]")); - Future<Boolean> f2 = - executor.submit(new OaiPmhResumptionTokenTestThread(VERB_LIST_IDENTIFIERS, - NO_SET, OAI_IDIOMMETS_PREFIX, 3, 30, "[C2]")); - Future<Boolean> f3 = - executor.submit(new OaiPmhResumptionTokenTestThread(VERB_LIST_IDENTIFIERS, - NO_SET, OAI_IDIOMMETS_PREFIX, 3, 30, "[C2]")); + ExecutorService executor = Executors.newFixedThreadPool(3); - executor.shutdown(); + Future<Boolean> f1 = + executor.submit(new OaiPmhResumptionTokenTestThread(VERB_LIST_IDENTIFIERS, + NO_SET, OAI_IDIOMMETS_PREFIX, 3, 30, "[C1]")); + Future<Boolean> f2 = + executor.submit(new OaiPmhResumptionTokenTestThread(VERB_LIST_IDENTIFIERS, + NO_SET, OAI_IDIOMMETS_PREFIX, 5, 30, "[C2]")); + Future<Boolean> f3 = + executor.submit(new OaiPmhResumptionTokenTestThread(VERB_LIST_IDENTIFIERS, + NO_SET, OAI_IDIOMMETS_PREFIX, 8, 30, "[C2]")); - System.out.println(OK + ": [C1]=" + f1.get() + ", [C2]=" + f2.get() + ", [C3]=" + f3.get()); - } else { - System.out.println(NOT_TESTED); - } + executor.shutdown(); + + System.out.println(OK + ": [C1]=" + f1.get() + ", [C2]=" + f2.get() + ", [C3]=" + f3.get()); } /** @@ -654,11 +668,11 @@ public class OaiPmhTextgridOnlineTests { ExecutorService executor = Executors.newFixedThreadPool(3); Future<Boolean> f1 = executor.submit(new OaiPmhResumptionTokenTestThread(VERB_LIST_RECORDS, - NO_SET, OAI_IDIOMMETS_PREFIX, 1, 30, "[D1]")); + NO_SET, OAI_IDIOMMETS_PREFIX, 2, 30, "[D1]")); Future<Boolean> f2 = executor.submit(new OaiPmhResumptionTokenTestThread(VERB_LIST_RECORDS, - NO_SET, OAI_IDIOMMETS_PREFIX, 1, 30, "[D2]")); + NO_SET, OAI_IDIOMMETS_PREFIX, 3, 30, "[D2]")); Future<Boolean> f3 = executor.submit(new OaiPmhResumptionTokenTestThread(VERB_LIST_RECORDS, - NO_SET, OAI_IDIOMMETS_PREFIX, 1, 30, "[D3]")); + NO_SET, OAI_IDIOMMETS_PREFIX, 4, 30, "[D3]")); executor.shutdown(); @@ -839,7 +853,7 @@ public class OaiPmhTextgridOnlineTests { int idiomRecordsPerPage = 30; if (!host.contains("dev.textgridlab.org")) { idiomPagesToTest = 1; - idiomRecordsPerPage = 1; + idiomRecordsPerPage = 30; } ExecutorService executor = Executors.newFixedThreadPool(3); @@ -1051,9 +1065,6 @@ public class OaiPmhTextgridOnlineTests { if (!restok.isEmpty()) { synchronized (OaiPmhTextgridOnlineTests.class) { // Check <record> or <header> count, must be recordsExpectedPerRequest! - - System.out.println(" ## " + recordCount + " " + recordsExpectedPerRequest); - if (recordCount != recordsExpectedPerRequest) { String message = ERROR + ": " + recordOrHeader + " count mismatch, must be " + recordsExpectedPerRequest + " if token is provided, but is " + recordCount; @@ -1172,7 +1183,7 @@ public class OaiPmhTextgridOnlineTests { } } - // Only check for max loops, if we do have less loops and nmo resumption token, it will be fine, + // Only check for max loops, if we do have less loops and no resumption token, it will be fine, // too! if (!restok.equals(NO_TOKEN) && loopCount < maxNumberOfPagesToTest) { System.out.println(theThreadName + ERROR + ": " + "Must have done " + maxNumberOfPagesToTest diff --git a/oaipmh-webapp/pom.xml b/oaipmh-webapp/pom.xml index 7727ae84646997788f9727022ac06859c43808d2..aa9a3921012bc437f079308f0c200158ddba8b18 100644 --- a/oaipmh-webapp/pom.xml +++ b/oaipmh-webapp/pom.xml @@ -5,7 +5,7 @@ <parent> <artifactId>oaipmh</artifactId> <groupId>info.textgrid.middleware</groupId> - <version>4.0.3-SNAPSHOT</version> + <version>4.0.4-SNAPSHOT</version> </parent> <groupId>info.textgrid.middleware</groupId> <artifactId>oaipmh-webapp</artifactId> diff --git a/pom.xml b/pom.xml index c1dcee5fd05bf8236bcc05db93b271da83b8acd2..50650ac58ba10e7ba62f76bc3fd82fd8600602be 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>info.textgrid.middleware</groupId> <artifactId>oaipmh</artifactId> - <version>4.0.3-SNAPSHOT</version> + <version>4.0.4-SNAPSHOT</version> <packaging>pom</packaging> <name>DARIAHDE :: OAI-PMH DataProvider</name> <properties>