(new QName("general"), String.class, repoDescription));
id.getDescription().add(0, desc);
final RequestType req = oaiFactory.createRequestType();
diff --git a/src/main/resources/app.properties b/src/main/resources/app.properties
new file mode 100644
index 0000000..71dfb33
--- /dev/null
+++ b/src/main/resources/app.properties
@@ -0,0 +1 @@
+application.version=${project.version}
diff --git a/src/test/java/org/fcrepo/oai/integration/AbstractOAIProviderIT.java b/src/test/java/org/fcrepo/oai/integration/AbstractOAIProviderIT.java
index 8c8530f..09bbfd3 100644
--- a/src/test/java/org/fcrepo/oai/integration/AbstractOAIProviderIT.java
+++ b/src/test/java/org/fcrepo/oai/integration/AbstractOAIProviderIT.java
@@ -19,6 +19,7 @@
import static java.lang.Integer.MAX_VALUE;
import static java.util.concurrent.TimeUnit.SECONDS;
import static javax.ws.rs.core.Response.Status.CREATED;
+import static javax.ws.rs.core.Response.Status.NO_CONTENT;
import static org.apache.http.impl.client.HttpClientBuilder.create;
import static org.junit.Assert.assertEquals;
import static org.slf4j.LoggerFactory.getLogger;
@@ -42,6 +43,7 @@
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPatch;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.entity.ContentType;
@@ -57,6 +59,9 @@
import org.slf4j.Logger;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.core.io.ClassPathResource;
+import java.util.Properties;
+
/**
*
@@ -138,6 +143,41 @@ protected int getStatus(final HttpUriRequest method)
return client.execute(method).getStatusLine().getStatusCode();
}
+ protected String getVersion() {
+ final ClassPathResource resource = new ClassPathResource("app.properties");
+ InputStream inputstream = null;
+ String verstring = "";
+ try {
+ inputstream = resource.getInputStream();
+ final Properties p = new Properties();
+ p.load(inputstream);
+ verstring = p.getProperty("application.version");
+ } catch (IOException e) {
+ }
+ return verstring;
+ }
+
+
+ protected void createProperty(final String ident, final String value) throws IOException {
+ final HttpPatch post = new HttpPatch(serverAddress + "/");
+ //post.addHeader("Slug", "/");
+ if (!ident.isEmpty() && !value.isEmpty()) {
+ StringBuilder sparql = new StringBuilder("PREFIX oai: ")
+ .append(" ")
+ .append("INSERT { ")
+ .append("<> ")
+ .append(ident)
+ .append(" \"").append(value).append("\"")
+ .append(" } WHERE { }");
+ post.setEntity(new StringEntity(sparql.toString()));
+ post.setHeader("Content-Type", "application/sparql-update");
+ }
+
+ final HttpResponse response = client.execute(post);
+ assertEquals(NO_CONTENT.getStatusCode(), response.getStatusLine().getStatusCode());
+ post.releaseConnection();
+ }
+
protected void createFedoraObject(final String pid, final String set) throws IOException {
final HttpPost post = postObjMethod("/");
if (pid.length() > 0) {
diff --git a/src/test/java/org/fcrepo/oai/integration/IdentifyIT.java b/src/test/java/org/fcrepo/oai/integration/IdentifyIT.java
index 1a4353e..e2ff012 100644
--- a/src/test/java/org/fcrepo/oai/integration/IdentifyIT.java
+++ b/src/test/java/org/fcrepo/oai/integration/IdentifyIT.java
@@ -49,5 +49,21 @@ public void testIdentify() throws Exception {
assertEquals(VerbType.IDENTIFY.value(), oaipmh.getRequest().getVerb().value());
assertEquals("Fedora 4", oaipmh.getIdentify().getRepositoryName());
assertEquals(serverAddress, oaipmh.getIdentify().getBaseURL());
+
+ createProperty("oai:repositoryName","This is a name to test the repository");
+ createProperty("oai:description","Not a description");
+ createProperty("oai:adminEmail","someone@somewhere.org");
+ HttpResponse resp2 = getOAIPMHResponse(VerbType.IDENTIFY.value(), null, null, null, null, null);
+ assertEquals(200, resp2.getStatusLine().getStatusCode());
+ OAIPMHtype oaipmh2 =
+ ((JAXBElement) this.unmarshaller.unmarshal(resp2.getEntity().getContent())).getValue();
+ assertEquals(0, oaipmh2.getError().size());
+ assertNotNull(oaipmh2.getIdentify());
+ assertNotNull(oaipmh2.getRequest());
+ assertEquals(VerbType.IDENTIFY.value(), oaipmh2.getRequest().getVerb().value());
+ assertEquals("This is a name to test the repository", oaipmh2.getIdentify().getRepositoryName());
+ //assertEquals("Not a description ["+getVersion()+"]", oaipmh2.getIdentify().getDescription().get(0).getAny());
+ assertEquals("someone@somewhere.org",oaipmh2.getIdentify().getAdminEmail().get(0));
+ assertEquals(serverAddress, oaipmh2.getIdentify().getBaseURL());
}
}
diff --git a/src/test/resources/spring-test/repo.xml b/src/test/resources/spring-test/repo.xml
index 872aaac..b4c0235 100644
--- a/src/test/resources/spring-test/repo.xml
+++ b/src/test/resources/spring-test/repo.xml
@@ -27,7 +27,8 @@
+ p:repositoryConfiguration="classpath:repository.json"/>
+