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

Increase version

Add and somewhat refactor tests, running with HTTPS now
parent 2309a92c
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@
<parent>
<artifactId>oaipmh</artifactId>
<groupId>info.textgrid.middleware</groupId>
<version>4.0.4-SNAPSHOT</version>
<version>4.0.5-SNAPSHOT</version>
</parent>
<groupId>info.textgrid.middleware</groupId>
<artifactId>oaipmh-core</artifactId>
......
package info.textgrid.middleware;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import javax.ws.rs.core.Response;
import org.apache.cxf.jaxrs.client.Client;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.http.HttpStatus;
/**
* <p>
* Some online tests for the TextGrid OAIMPH service.
* </p>
*
* @author Stefan E. Funk, SUB Göttingen
*/
public class OaiPmhTestUtilities {
// **
// FINALS
// **
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 NO_SET = null;
protected static final String ERROR = " >>> ERROR";
protected static final String OK = " >>> OKIDOKI";
protected static final String TESTING = "\n >>> TESTING ";
protected static final String NO_THREAD_NAME = "";
protected static final String NOT_TESTED = " >>> NOT_TESTED";
protected static final String NO_TOKEN = "-1";
protected static final String VERB_LIST_IDENTIFIERS = "ListIdentifiers";
protected static final String VERB_LIST_RECORDS = "ListRecords";
protected static final String VERB_GET_RECORD = "GetRecord";
protected static final String VERB_IDENTIFY = "Identify";
protected static final String VERB_LIST_METADATA_FORMATS = "ListMetadataFormats";
protected static final String VERB_LIST_SETS = "ListSets";
protected static final boolean NO_METADATA_FORMAT_WITH_RESTOK = false;
protected static final boolean METADATA_FORMAT_WITH_RESTOK = true;
protected static final String NO_FROM = null;
protected static final String NO_UNTIL = null;
// Time to wait between the single queries using resumption tokens in milliseconds.
protected static final Long TIME = 275l;
protected static final long OAIPMH_CLIENT_TIMEOUT = 30000;
/**
* @param theClient
* @param thePath
* @return
* @throws IOException
*/
protected static Response getHttpResponse(Client theClient, String thePath) throws IOException {
return getHttpResponse(theClient, thePath, "");
}
/**
* @param theClient
* @param thePath
* @param theThreadName
* @return
* @throws IOException
*/
protected static Response getHttpResponse(Client theClient, String thePath, String theThreadName)
throws IOException {
Response result;
try {
Thread.sleep(TIME);
} catch (InterruptedException e) {
// Nothing interrupts here!
}
WebClient w = WebClient.fromClient(theClient).replaceQuery(thePath);
System.out.println("\t" + theThreadName + "HTTP GET " + w.getCurrentURI());
result = w.get();
// Check HTTP status.
int status = result.getStatus();
if (status != HttpStatus.SC_OK) {
System.err.println("\t" + theThreadName + "status: " + status);
System.err.println(ERROR);
assertTrue(false);
} else {
System.out.println("\t" + theThreadName + "status: " + status);
}
return result;
}
/**
* @param theMillis
* @return
*/
public static String getDurationInSecs(long theMillis) {
int SECS_IN_MILLIS = 1000;
int secs = SECS_IN_MILLIS;
return theMillis / secs + " second" + ((theMillis / secs) != 1 ? "s" : "");
}
}
......@@ -5,7 +5,7 @@
<parent>
<artifactId>oaipmh</artifactId>
<groupId>info.textgrid.middleware</groupId>
<version>4.0.4-SNAPSHOT</version>
<version>4.0.5-SNAPSHOT</version>
</parent>
<groupId>info.textgrid.middleware</groupId>
<artifactId>oaipmh-webapp</artifactId>
......
......@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>info.textgrid.middleware</groupId>
<artifactId>oaipmh</artifactId>
<version>4.0.4-SNAPSHOT</version>
<version>4.0.5-SNAPSHOT</version>
<packaging>pom</packaging>
<name>DARIAHDE :: OAI-PMH DataProvider</name>
<properties>
......
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