From 5b6be1a66ac12f22ee07a63dfdf4e98021319d84 Mon Sep 17 00:00:00 2001
From: "Stefan E. Funk" <funk@sub.uni-goettingen.de>
Date: Mon, 21 Nov 2016 15:52:56 +0100
Subject: [PATCH] MEIN TEST!

---
 .../textgrid/middleware/OaiPmhOnlineTests.java   | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhOnlineTests.java b/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhOnlineTests.java
index dccfbd04..47d105fc 100644
--- a/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhOnlineTests.java
+++ b/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhOnlineTests.java
@@ -244,7 +244,7 @@ public class OaiPmhOnlineTests {
 	 * @throws IOException
 	 */
 	private static String examineResumptionTokenTag(TGHttpResponse theResponse,
-			String recordOrHeader) throws IOException {
+			String recordOrHeader, String oldtok) throws IOException {
 
 		String res = IOUtils.readStringFromStream(theResponse.getInputstream());
 
@@ -268,6 +268,10 @@ public class OaiPmhOnlineTests {
 		String restok = restokTmp.substring(restokTmp.indexOf(">") + 1).trim();
 		System.out.println("\ttoken:    " + restok);
 
+		// Check if old and new token are equal or not.
+		boolean tokchanged = oldtok.equals(restok);
+		System.out.println("\ttokchanged: " + tokchanged);
+
 		// Get completeListSize and cursor.
 		String sizeStr = toktag
 				.substring(toktag.indexOf("completeListSize=\"") + 18);
@@ -345,7 +349,8 @@ public class OaiPmhOnlineTests {
 	 * @param theVerb
 	 * @throws IOException
 	 */
-	private static void testList(String theVerb) throws IOException {
+	private static void testList(String theVerb, String oldtok)
+			throws IOException {
 
 		long startTime = System.currentTimeMillis();
 
@@ -369,14 +374,16 @@ public class OaiPmhOnlineTests {
 		long timeRunning = System.currentTimeMillis() - startTime;
 		System.out.println("\ttime:     " + getDuration(timeRunning));
 
-		String restok = examineResumptionTokenTag(httpResponse, testOccurance);
+		String restok = examineResumptionTokenTag(httpResponse, testOccurance,
+				"");
 
 		while (status == HttpStatus.SC_OK && !restok.equals("-1")) {
 			url = host + "/oai?verb=" + theVerb + "&resumptionToken=" + restok;
 			httpResponse = getHttpResponse(url);
 			timeRunning = System.currentTimeMillis() - startTime;
 			System.out.println("\ttime:     " + getDuration(timeRunning));
-			restok = examineResumptionTokenTag(httpResponse, testOccurance);
+			restok = examineResumptionTokenTag(httpResponse, testOccurance,
+					restok);
 		}
 
 		if (status != HttpStatus.SC_OK) {
@@ -387,5 +394,4 @@ public class OaiPmhOnlineTests {
 
 		System.out.println(OK);
 	}
-
 }
-- 
GitLab