Skip to content
Snippets Groups Projects
Commit a36707c4 authored by Stefan E. Funk's avatar Stefan E. Funk
Browse files

test: add test for comparing modification dates

parent 414e7e55
No related branches found
No related tags found
No related merge requests found
Pipeline #324431 passed
......@@ -43,8 +43,8 @@ public class OaipmhUtilitiesOnline {
// ## CHANGE SETTINGS BELOW FOR SETTING TEST SCOPE ---------------------------------------------
public static final String PROPERTIES_FILE = "oaipmh.test.textgridlab-org.properties";
// public static final String PROPERTIES_FILE = "oaipmh.test.dev-textgridlab-org.properties";
// public static final String PROPERTIES_FILE = "oaipmh.test.textgridlab-org.properties";
public static final String PROPERTIES_FILE = "oaipmh.test.dev-textgridlab-org.properties";
public static final boolean TEST_ALL_PAGES = false;
// public static final boolean TEST_ALL_PAGES = true;
......@@ -576,6 +576,32 @@ public class OaipmhUtilitiesOnline {
}
}
/**
* <p>
* Looks for both dates and compares them. <datestamp> must be equal to <recordChangeDate>!
* </p>
*
* @param theResponseString
*/
public static void examineModificationDates(String theResponseString) {
String datestampTag = "<datestamp>";
String recordChangeTag = "<recordChangeDate encoding=\"iso8601\">";
// Count the occurrence of modification date, must be in GetRecord.record.header.datestamp, and
// in mets.recordInfo.recordChangeDate!
String datestamp = theResponseString.substring(
theResponseString.indexOf(datestampTag) + datestampTag.length(),
theResponseString.indexOf("</datestamp>") - 10);
String recordChangeDate = theResponseString.substring(
theResponseString.indexOf(recordChangeTag) + recordChangeTag.length(),
theResponseString.indexOf("</recordChangeDate>") - 1);
if (!datestamp.equals(recordChangeDate)) {
assertTrue(datestamp + " != " + recordChangeDate, false);
}
}
// **
// DH used methods
// **
......
......@@ -175,6 +175,7 @@ public class TestTGGetRecordOnline {
// Test OAI header.
OaipmhUtilitiesOnline.examineTGHeaderIDs(response, OaipmhUtilitiesOnline.OAI_IDIOMMETS_PREFIX);
OaipmhUtilitiesOnline.examineModificationDates(response);
System.out.println("\tresponse: " + response);
System.out.println(OaipmhUtilitiesOnline.OK);
......@@ -206,6 +207,7 @@ public class TestTGGetRecordOnline {
// Test OAI header.
OaipmhUtilitiesOnline.examineTGHeaderIDs(response, OaipmhUtilitiesOnline.OAI_IDIOMMETS_PREFIX);
OaipmhUtilitiesOnline.examineModificationDates(response);
System.out.println("\tresponse: " + response);
System.out.println(OaipmhUtilitiesOnline.OK);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment