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

Add test config files

Add configuration for textgrid host tests
Remove not needed .info logs
parent 331d2c8c
No related branches found
No related tags found
No related merge requests found
Showing
with 397 additions and 292 deletions
......@@ -32,7 +32,7 @@ import info.textgrid.middleware.oaipmh.VerbType;
*
* @author Maximilian Brodhun, SUB Göttingen
* @author Stefan E. Funk, SUB Göttingen
* @version 2021-10-26
* @version 2021-10-27
* @since 2014-01-29
*/
public class OAIPMHImpl implements OAIPMHProducer {
......@@ -369,7 +369,7 @@ public class OAIPMHImpl implements OAIPMHProducer {
.containsKey(request.getResumptionToken())) {
idListDeliv = this.identifierListDC;
this.log.info("DC collector: " + IdentifierListDelivererDC.cursorCollector);
this.log.debug("DC collector: " + IdentifierListDelivererDC.cursorCollector);
}
// Token is from IDIOM request.
else if (IdentifierListDelivererIDIOM.cursorCollector != null
......@@ -377,7 +377,7 @@ public class OAIPMHImpl implements OAIPMHProducer {
.containsKey(request.getResumptionToken())) {
idListDeliv = this.identifierListIDIOM;
this.log.info("IDIOM collector: " + IdentifierListDelivererIDIOM.cursorCollector);
this.log.debug("IDIOM collector: " + IdentifierListDelivererIDIOM.cursorCollector);
}
// Token is from DATACITE request.
else if (IdentifierListDelivererDATACITE.cursorCollector != null
......@@ -385,7 +385,7 @@ public class OAIPMHImpl implements OAIPMHProducer {
.containsKey(request.getResumptionToken())) {
idListDeliv = this.identifierListDATACITE;
this.log.info("DATACITE collector: " + IdentifierListDelivererDATACITE.cursorCollector);
this.log.debug("DATACITE collector: " + IdentifierListDelivererDATACITE.cursorCollector);
}
// We have got an invalid resumptionToken here!
else {
......@@ -566,14 +566,14 @@ public class OAIPMHImpl implements OAIPMHProducer {
&& RecordListDelivererDC.cursorCollector.containsKey(request.getResumptionToken())) {
recListDeliv = this.recordListDC;
this.log.info("DC collector: " + RecordListDelivererDC.cursorCollector);
this.log.debug("DC collector: " + RecordListDelivererDC.cursorCollector);
}
// Token is from IDIOM request.
else if (RecordListDelivererIDIOM.cursorCollector != null
&& RecordListDelivererIDIOM.cursorCollector.containsKey(request.getResumptionToken())) {
recListDeliv = this.recordListIDIOM;
this.log.info("IDIOM collector: " + RecordListDelivererIDIOM.cursorCollector);
this.log.debug("IDIOM collector: " + RecordListDelivererIDIOM.cursorCollector);
}
// Token is from IDIOM request.
else if (RecordListDelivererDATACITE.cursorCollector != null
......@@ -581,7 +581,7 @@ public class OAIPMHImpl implements OAIPMHProducer {
.containsKey(request.getResumptionToken())) {
recListDeliv = this.recordListDATACITE;
this.log.info("DATACITE collector: " + RecordListDelivererDATACITE.cursorCollector);
this.log.debug("DATACITE collector: " + RecordListDelivererDATACITE.cursorCollector);
}
// We have got an invalid resumptionToken here!
else {
......
......@@ -251,7 +251,7 @@ public class RecordListDelivererDATACITE extends RecordListDelivererAbstract {
try {
cursorCollector.remove(resumptionToken);
} catch (NullPointerException couldNotRemove) {
log.info("Could not remove hash value: " + resumptionToken + " from hash map");
log.debug("Could not remove hash value: " + resumptionToken + " from hash map");
}
this.resTokenForResponse.setValue("");
} else {
......@@ -262,7 +262,6 @@ public class RecordListDelivererDATACITE extends RecordListDelivererAbstract {
log.debug("cursorCollector: " + cursorCollector);
} else {
log.info("HALLO");
setFoundItems(false);
}
......
......@@ -178,8 +178,8 @@ public class RecordListDelivererDC extends RecordListDelivererAbstract {
}
}
log.info("Queried fields: " + this.fields.toString());
log.info("Lifetime for resumption token is set to: " + LIFETIME_RES_TOKEN);
log.debug("Queried fields: " + this.fields.toString());
log.debug("Lifetime for resumption token is set to: " + LIFETIME_RES_TOKEN);
scrollID = scrollResp.getScrollId();
......@@ -296,7 +296,7 @@ public class RecordListDelivererDC extends RecordListDelivererAbstract {
public ListRecordsType getRecords(String from, String to, String set, String resumptionToken)
throws ParseException, IOException {
log.info("Started List Records with booleans for DARIAH: " + this.dariah + " and TextGrid: "
log.debug("Started List Records with booleans for DARIAH: " + this.dariah + " and TextGrid: "
+ this.textgrid);
ListRecordsType recordList = new ListRecordsType();
......
......@@ -29,7 +29,8 @@ import org.junit.Test;
@Ignore
public class OaiPmhDariahdeOnlineTests {
// TODO Configure config files for all the different OAI-PMH service instances!
// FIXME Configure config files for all the different OAI-PMH service instances (see TG
// implementation)!
// **
// The OAIPMH host to be tested.
......
package info.textgrid.middleware;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.core.Response;
import org.apache.cxf.jaxrs.client.Client;
import org.apache.cxf.jaxrs.client.WebClient;
......@@ -23,6 +28,11 @@ public class OaiPmhTestUtilities {
protected static final String OAI_DC_PREFIX = "oai_dc";
protected static final String OAI_DATACITE_PREFIX = "oai_datacite";
protected static final String OAI_IDIOMMETS_PREFIX = "oai_idiom_mets";
protected static final String EXPECTED_OAIDC_FORMAT_CONTENT = "<oai_dc:dc>";
protected static final String EXPECTED_IDIOMMETS_FORMAT_CONTENT = "<mets ";
protected static final String EXPECTED_DATACITE_FORMAT_CONTENT = "<datacite:resource>";
protected static final String NO_SET = null;
protected static final String ERROR = " >>> ERROR";
protected static final String OK = " >>> OKIDOKI";
......@@ -106,4 +116,54 @@ public class OaiPmhTestUtilities {
return theMillis / secs + " second" + ((theMillis / secs) != 1 ? "s" : "");
}
/**
* <p>
* Loads a resource.
* </p>
*
* TODO Put together with the method in TGCrudServiceUtilities! Maybe create a first build maven
* module for utility things.
*
* @param {@link String} The resource to search for.
* @return {@link File} The resource.
* @throws IOException
*/
protected static File getResource(String resPart) throws IOException {
File res;
// If we have an absolute resPart, just return the file.
if (resPart.startsWith(File.separator)) {
return new File(resPart);
}
URL url = ClassLoader.getSystemClassLoader().getResource(resPart);
if (url == null) {
throw new IOException("Resource '" + resPart + "' not found");
}
try {
res = new File(url.toURI());
} catch (URISyntaxException ue) {
res = new File(url.getPath());
}
return res;
}
/**
* @param theProperty
* @return
*/
protected static List<String> getListFromProperties(String theProperty) {
List<String> result = new ArrayList<String>();
String parts[] = theProperty.split(",");
for (String part : parts) {
result.add(part.trim());
}
return result;
}
}
/oaipmh.test.local.properties
# OAI-PMH host
oaipmhEndpoint = https://dev.textgridlab.org/1.0/tgoaipmh/oai
# ListSets
expectedListSets = project:TGPR-372fe6dc-57f2-6cd4-01b5-2c4bbefcfd3c
# GetRecord
checkGetRecordDC = textgrid:vqn0.0
expectedGetRecordDC = Heidi
checkGetRecordIDIOM = textgrid:2sg18.0
expectedGetRecordIDIOM = Aguateca
checkGetRecordDATACITE = textgrid:mq05.0
expectedGetRecordDATACITE = Spraach-en Hfflichkeit
checkGetRecordIDList = textgrid:mq05.0, textgrid:jgv6.0, textgrid:w7rz.0, textgrid:w36b.0, textgrid:mcdv.0, textgrid:v0qx.0, textgrid:xkck.0, textgrid:t3m1.0, textgrid:10rsq.0, textgrid:mq05.0, textgrid:jgv6.0, textgrid:w7rz.0, textgrid:w36b.0, textgrid:mcdv.0, textgrid:v0qx.0, textgrid:xkck.0, textgrid:t3m1.0, textgrid:10rsq.0
# ListRecords
checkListRecordsDC = project:TGPR-59722e29-efcb-330f-b9b4-5ef2fb08edab
checkListRecordsDCFrom = 2012-01-04T01:00:00
checkListRecordsDCUntil = 2012-01-04T12:00:00
checkListRecordsIDIOMFrom = 2012-01-04T01:00:00
checkListRecordsIDIOMUntil = 2012-01-04T12:00:00
checkListRecordsDATACITEFrom = 2012-01-04T01:00:00
checkListRecordsDATACITEUntil = "2012-01-04T12:00:00
# ListIdentifiers
checkListIdentifiersSet = project:TGPR-59722e29-efcb-330f-b9b4-5ef2fb08edab
checkListIdentifiersPagesToTestIDIOM = 10
checkListIdentifiersRecordsPerPageIDIOM = 30
# OAI-PMH host
oaipmhEndpoint = https://repository.de.dariah.eu/1.0/tgoaipmh/oai
# OAI-PMH host
oaipmhEndpoint = https://textgridlab.org/1.0/tgoaipmh/oai
# ListSets
expectedListSets = project:TGPR-372fe6dc-57f2-6cd4-01b5-2c4bbefcfd3c
# GetRecord
checkGetRecordDC = textgrid:vqn0.0
expectedGetRecordDC = Heidi
checkGetRecordIDIOM = textgrid:2sg18.0
expectedGetRecordIDIOM = Aguateca
checkGetRecordDATACITE = textgrid:mq05.0
expectedGetRecordDATACITE = Spraach-en Hfflichkeit
checkGetRecordIDList = textgrid:mq05.0, textgrid:jgv6.0, textgrid:w7rz.0, textgrid:w36b.0, textgrid:mcdv.0, textgrid:v0qx.0, textgrid:xkck.0, textgrid:t3m1.0, textgrid:10rsq.0, textgrid:mq05.0, textgrid:jgv6.0, textgrid:w7rz.0, textgrid:w36b.0, textgrid:mcdv.0, textgrid:v0qx.0, textgrid:xkck.0, textgrid:t3m1.0, textgrid:10rsq.0
# ListRecords
checkListRecordsDC = project:TGPR-59722e29-efcb-330f-b9b4-5ef2fb08edab
checkListRecordsDCFrom = 2012-01-04T01:00:00
checkListRecordsDCUntil = 2012-01-04T12:00:00
checkListRecordsIDIOMFrom = 2012-01-04T01:00:00
checkListRecordsIDIOMUntil = 2012-01-04T12:00:00
checkListRecordsDATACITEFrom = 2012-01-04T01:00:00
checkListRecordsDATACITEUntil = "2012-01-04T12:00:00
# ListIdentifiers
checkListIdentifiersSet = project:TGPR-59722e29-efcb-330f-b9b4-5ef2fb08edab
checkListIdentifiersPagesToTestIDIOM = 10
checkListIdentifiersRecordsPerPageIDIOM = 30
\ No newline at end of file
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