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 fe874abe6e3a7750eb4114bec51cc9bfa6ab6b66..74611774dd47817f665c8512c5e3da712deff836 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHUtilities.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHUtilities.java @@ -381,7 +381,7 @@ public class OAIPMHUtilities { for (String field : fields) { String[] fieldPathForESIndex = field.split(ES_DIVIDER_REGEXP); - log.debug("field[" + count + "]: " + field); + System.out.println("field[" + count + "]: " + field); count++; JSONObject singlePath = resultFromGetRequestInES; @@ -399,6 +399,9 @@ public class OAIPMHUtilities { log.debug("get " + fieldPathForESIndex[i]); + System.out.println("urgl: " + resultFromGetRequestInES); + System.out.println("argl: " + fieldPathForESIndex[i]); + fieldResulsts.add(resultFromGetRequestInES.get(fieldPathForESIndex[i]).toString()); } else { String res = singlePath.get(fieldPathForESIndex[i]).toString(); 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 6c481dabe2aa68a12828571e1b05acbbd878bbbc..9a6e159e2a524f3b72a6ebd420413d4b762ec313 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDelivererDC.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDelivererDC.java @@ -4,8 +4,6 @@ import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.text.ParseException; -import java.util.Hashtable; -import java.util.Map; import javax.xml.datatype.DatatypeConfigurationException; import org.apache.commons.logging.LogFactory; import org.elasticsearch.action.get.GetRequest; @@ -45,7 +43,6 @@ public class RecordListDelivererDC extends RecordListDelivererAbstract { // ** private static org.apache.commons.logging.Log log = LogFactory.getLog(OAIPMHImpl.class); - protected static Map<String, Integer> cursorCollector = new Hashtable<String, Integer>(); // ** // DC-Field Lists diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDelivererIDIOM.java b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDelivererIDIOM.java index 061fd2edda9a9e8d792d2551ae853ee9c382cfe7..b2e4e11ffbd5a468869d2f3ea941ad5af8ce4c9a 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDelivererIDIOM.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDelivererIDIOM.java @@ -2,8 +2,6 @@ package info.textgrid.middleware; import java.io.IOException; import java.text.ParseException; -import java.util.Hashtable; -import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.elasticsearch.action.search.SearchRequest; @@ -29,7 +27,6 @@ import info.textgrid.middleware.oaipmh.ResumptionTokenType; public class RecordListDelivererIDIOM extends RecordListDelivererAbstract { private static Log log = LogFactory.getLog(OAIPMHImpl.class); - static Map<String, Integer> cursorCollector = new Hashtable<String, Integer>(); /** * @param textgrid 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 311502b99b55fa555a2075804f5e250a9895368a..2c5f96a6987c658f5090448d20457c33057e9a2f 100644 --- a/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTextgridOnlineTests.java +++ b/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTextgridOnlineTests.java @@ -26,10 +26,11 @@ 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"; + private static final String OAI_DATACITE_PREFIX = "oai_datacite"; private static final String OAI_IDIOMMETS_PREFIX = "oai_idiom_mets"; private static final String NO_SET = null; private static final String ERROR = " >>> ERROR"; @@ -318,13 +319,8 @@ public class OaiPmhTextgridOnlineTests { System.out.println(TESTING + "testListRecordsOAIDCMorePages()"); - // Testing set: Digitale Bibliothek (TODO Find another project with less records for testing!). + // Testing set: Digitale Bibliothek (on prod and dev available only...) String set = "project:TGPR-372fe6dc-57f2-6cd4-01b5-2c4bbefcfd3c"; - if (host.contains("dev.textgridlab.org")) { - // Use fu's test project, if test instance used in host name. - // Testing set: fu's shakespeare. - set = "project:TGPR-962c949c-56a3-7134-9265-582f29a0992d"; - } testList(VERB_LIST_RECORDS, set, OAI_DC_PREFIX, 0, 100, NO_THREAD_NAME); @@ -344,6 +340,19 @@ public class OaiPmhTextgridOnlineTests { System.out.println(OK); } + /** + * @throws IOException + */ + @Test + public void testListRecordsDATACITEMorePages() throws IOException { + + System.out.println(TESTING + "testListRecordsDATACITEMorePages()"); + + testList(VERB_LIST_RECORDS, NO_SET, OAI_DATACITE_PREFIX, 15, 100, NO_THREAD_NAME); + + System.out.println(OK); + } + /** * @throws IOException */ @@ -368,15 +377,10 @@ public class OaiPmhTextgridOnlineTests { System.out.println(TESTING + "testListIdentifiersOAIDCMorePages()"); - // Testing set: Digitale Bibliothek (TODO Find another project with less records for testing!). + // Testing set: Digitale Bibliothek (on prod and dev available only...) String set = "project:TGPR-372fe6dc-57f2-6cd4-01b5-2c4bbefcfd3c"; - if (host.contains("dev.textgridlab.org")) { - // Use fu's test project, if test instance used in host name. - // Testing set: fu's shakespeare. - set = "project:TGPR-962c949c-56a3-7134-9265-582f29a0992d"; - } - testList(VERB_LIST_IDENTIFIERS, set, OAI_DC_PREFIX, 0, 100, NO_THREAD_NAME); + testList(VERB_LIST_IDENTIFIERS, set, OAI_DC_PREFIX, 30, 100, NO_THREAD_NAME); System.out.println(OK); } @@ -394,6 +398,19 @@ public class OaiPmhTextgridOnlineTests { System.out.println(OK); } + /** + * @throws IOException + */ + @Test + public void testListIdentifiersDATACITEMorePages() throws IOException { + + System.out.println(TESTING + "testListIdentifiersDATACITEMorePages()"); + + testList(VERB_LIST_IDENTIFIERS, NO_SET, OAI_DATACITE_PREFIX, 44, 100, NO_THREAD_NAME); + + System.out.println(OK); + } + /** * @throws IOException * @throws ExecutionException @@ -438,24 +455,18 @@ public class OaiPmhTextgridOnlineTests { System.out.println(TESTING + "testListRecordsConcurrentlyIDIOMMETSMorePages()"); - // 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_RECORDS, - NO_SET, OAI_IDIOMMETS_PREFIX, 3, 30, "[D1]")); - Future<Boolean> f2 = executor.submit(new OaiPmhResumptionTokenTestThread(VERB_LIST_RECORDS, - NO_SET, OAI_IDIOMMETS_PREFIX, 3, 30, "[D2]")); - Future<Boolean> f3 = executor.submit(new OaiPmhResumptionTokenTestThread(VERB_LIST_RECORDS, - NO_SET, OAI_IDIOMMETS_PREFIX, 3, 30, "[D3]")); + ExecutorService executor = Executors.newFixedThreadPool(3); - executor.shutdown(); + Future<Boolean> f1 = executor.submit(new OaiPmhResumptionTokenTestThread(VERB_LIST_RECORDS, + NO_SET, OAI_IDIOMMETS_PREFIX, 1, 30, "[D1]")); + Future<Boolean> f2 = executor.submit(new OaiPmhResumptionTokenTestThread(VERB_LIST_RECORDS, + NO_SET, OAI_IDIOMMETS_PREFIX, 1, 30, "[D2]")); + Future<Boolean> f3 = executor.submit(new OaiPmhResumptionTokenTestThread(VERB_LIST_RECORDS, + NO_SET, OAI_IDIOMMETS_PREFIX, 1, 30, "[D3]")); - System.out.println(OK + ": [D1]=" + f1.get() + ", [D2]=" + f2.get() + ", [D3]=" + f3.get()); + executor.shutdown(); - } else { - System.out.println(NOT_TESTED); - } + System.out.println(OK + ": [D1]=" + f1.get() + ", [D2]=" + f2.get() + ", [D3]=" + f3.get()); } /** @@ -464,10 +475,10 @@ public class OaiPmhTextgridOnlineTests { * @throws ExecutionException */ @Test - public void testRestokConcurrentlyListIdentifiers() + public void testRestokConcurrentlyListIdentifiersDC() throws InterruptedException, ExecutionException { - System.out.println(TESTING + "testRestokConcurrentlyListIdentifiers()"); + System.out.println(TESTING + "testRestokConcurrentlyListIdentifiersDC()"); ExecutorService executor = Executors.newFixedThreadPool(3); @@ -483,6 +494,56 @@ public class OaiPmhTextgridOnlineTests { System.out.println(OK + ": [A1]=" + f1.get() + ", [A2]=" + f2.get() + ", [A3]=" + f3.get()); } + /** + * @throws IOException + * @throws InterruptedException + * @throws ExecutionException + */ + @Test + public void testRestokConcurrentlyListIdentifiersIDIOM() + throws InterruptedException, ExecutionException { + + System.out.println(TESTING + "testRestokConcurrentlyListIdentifiersIDIOM()"); + + ExecutorService executor = Executors.newFixedThreadPool(3); + + Future<Boolean> f1 = executor.submit(new OaiPmhResumptionTokenTestThread(VERB_LIST_IDENTIFIERS, + NO_SET, OAI_IDIOMMETS_PREFIX, 13, 30, "[A1]")); + Future<Boolean> f2 = executor.submit(new OaiPmhResumptionTokenTestThread(VERB_LIST_IDENTIFIERS, + NO_SET, OAI_IDIOMMETS_PREFIX, 35, 30, "[A2]")); + Future<Boolean> f3 = executor.submit(new OaiPmhResumptionTokenTestThread(VERB_LIST_IDENTIFIERS, + NO_SET, OAI_IDIOMMETS_PREFIX, 11, 30, "[A3]")); + + executor.shutdown(); + + System.out.println(OK + ": [A1]=" + f1.get() + ", [A2]=" + f2.get() + ", [A3]=" + f3.get()); + } + + /** + * @throws IOException + * @throws InterruptedException + * @throws ExecutionException + */ + @Test + public void testRestokConcurrentlyListIdentifiersDATACITE() + throws InterruptedException, ExecutionException { + + System.out.println(TESTING + "testRestokConcurrentlyListIdentifiersDATACITE()"); + + ExecutorService executor = Executors.newFixedThreadPool(3); + + Future<Boolean> f1 = executor.submit(new OaiPmhResumptionTokenTestThread(VERB_LIST_IDENTIFIERS, + NO_SET, OAI_DATACITE_PREFIX, 13, 100, "[A1]")); + Future<Boolean> f2 = executor.submit(new OaiPmhResumptionTokenTestThread(VERB_LIST_IDENTIFIERS, + NO_SET, OAI_DATACITE_PREFIX, 35, 100, "[A2]")); + Future<Boolean> f3 = executor.submit(new OaiPmhResumptionTokenTestThread(VERB_LIST_IDENTIFIERS, + NO_SET, OAI_DATACITE_PREFIX, 11, 100, "[A3]")); + + executor.shutdown(); + + System.out.println(OK + ": [A1]=" + f1.get() + ", [A2]=" + f2.get() + ", [A3]=" + f3.get()); + } + /** * @throws InterruptedException * @throws ExecutionException @@ -514,6 +575,33 @@ public class OaiPmhTextgridOnlineTests { System.out.println(OK + ": [A1]=" + f1.get() + ", [A2]=" + f2.get() + ", [A3]=" + f3.get()); } + /** + * @throws InterruptedException + * @throws ExecutionException + */ + @Test + public void testRestokConcurrentlyListRecordsDC() + throws InterruptedException, ExecutionException { + + System.out.println(TESTING + "testRestokConcurrentlyListRecordsDC()"); + + ExecutorService executor = Executors.newFixedThreadPool(4); + + Future<Boolean> f1 = executor.submit(new OaiPmhResumptionTokenTestThread(VERB_LIST_RECORDS, + NO_SET, OAI_DC_PREFIX, 44, 100, "[DC1]")); + Future<Boolean> f2 = executor.submit(new OaiPmhResumptionTokenTestThread(VERB_LIST_RECORDS, + NO_SET, OAI_DC_PREFIX, 33, 100, "[DC2]")); + Future<Boolean> f3 = executor.submit(new OaiPmhResumptionTokenTestThread(VERB_LIST_RECORDS, + NO_SET, OAI_DC_PREFIX, 66, 100, "[DC3]")); + Future<Boolean> f4 = executor.submit(new OaiPmhResumptionTokenTestThread(VERB_LIST_RECORDS, + NO_SET, OAI_DC_PREFIX, 28, 100, "[DC4]")); + + executor.shutdown(); + + System.out.println(OK + ": [A1]=" + f1.get() + ", [A2]=" + f2.get() + ", [A3]=" + f3.get() + + ", [A4]=" + f4.get()); + } + /** * @throws IOException * @throws InterruptedException