Skip to content

Commit

Permalink
Fixed fcrepo-generator-dc integration tests for Mac builds by using U…
Browse files Browse the repository at this point in the history
…UIDs instead of fixed names for test resources
  • Loading branch information
ajs6f committed Oct 7, 2013
1 parent 1b08474 commit 5f1f093
Showing 1 changed file with 12 additions and 10 deletions.
Expand Up @@ -16,6 +16,8 @@

package org.fcrepo.integration.generator;

import static java.lang.System.err;
import static java.util.UUID.randomUUID;
import static java.util.regex.Pattern.DOTALL;
import static java.util.regex.Pattern.compile;
import static javax.ws.rs.core.MediaType.TEXT_XML;
Expand All @@ -25,7 +27,6 @@
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPatch;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.BasicHttpEntity;
import org.apache.http.util.EntityUtils;
import org.junit.Test;
Expand All @@ -42,8 +43,8 @@ public void testJcrPropertiesBasedOaiDc() throws Exception {
assertEquals(201, status);
final HttpPatch post = new HttpPatch(serverAddress + "DublinCoreTest1");
post.setHeader("Content-Type", "application/sparql-update");
BasicHttpEntity entity = new BasicHttpEntity();
String subjectURI = serverAddress + "DublinCoreTest1";
final BasicHttpEntity entity = new BasicHttpEntity();
final String subjectURI = serverAddress + "DublinCoreTest1";
entity.setContent(new ByteArrayInputStream(
("INSERT { <" + subjectURI + "> <http://purl.org/dc/terms/identifier> \"this is an identifier\" } WHERE {}")
.getBytes()));
Expand All @@ -67,20 +68,21 @@ public void testJcrPropertiesBasedOaiDc() throws Exception {

@Test
public void testWellKnownPathOaiDc() throws Exception {
HttpResponse response =
client.execute(postObjMethod("DublinCoreTest2"));

final String pid = randomUUID().toString();

HttpResponse response = client.execute(postObjMethod(pid));
assertEquals(201, response.getStatusLine().getStatusCode());
response =
client.execute(postDSMethod("DublinCoreTest2", "DC",
"marbles for everyone"));
int status = response.getStatusLine().getStatusCode();
client.execute(postDSMethod(pid, "DC", "marbles for everyone"));
final int status = response.getStatusLine().getStatusCode();
if (status != 201) {
System.err.println(EntityUtils.toString(response.getEntity()));
err.println(EntityUtils.toString(response.getEntity()));
}
assertEquals(201, status);

final HttpGet getWorstCaseOaiMethod =
new HttpGet(serverOAIAddress + "DublinCoreTest2/oai:dc");
new HttpGet(serverOAIAddress + pid + "/oai:dc");
getWorstCaseOaiMethod.setHeader("Accept", TEXT_XML);
response = client.execute(getWorstCaseOaiMethod);
assertEquals(200, response.getStatusLine().getStatusCode());
Expand Down

0 comments on commit 5f1f093

Please sign in to comment.