Skip to content

Commit

Permalink
Ignore the HtmlResponses tests until permgen issue is solved; specify…
Browse files Browse the repository at this point in the history
… exception mappers
  • Loading branch information
barmintor committed Nov 12, 2013
1 parent 3d133a6 commit 606fc61
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 34 deletions.
Expand Up @@ -16,8 +16,6 @@

package org.fcrepo.http.api.repository;

import javax.inject.Inject;
import javax.jcr.Session;
import javax.ws.rs.Path;

import org.fcrepo.http.api.FedoraTransactions;
Expand All @@ -32,6 +30,4 @@
@Path("/fcr:tx")
public class FedoraRepositoryTransactions extends FedoraTransactions {

@Inject
protected Session session;
}
Expand Up @@ -32,28 +32,27 @@ public class FedoraExportIT extends AbstractResourceIT {

@Test
public void shouldRoundTripOneObject() throws IOException {
final String objName = "JcrXmlSerializerIT1";
String objPath = getTestObjectPath("JcrXmlSerializerIT1");

// set up the object
client.execute(postObjMethod(objName));
client.execute(postDSMethod(objName, "testDS", "stuff"));
client.execute(postDSMethod(objPath, "testDS", "stuff"));

// export it
logger.debug("Attempting to export: " + objName);
logger.debug("Attempting to export: " + objPath);
final HttpGet getObjMethod =
new HttpGet(serverAddress + "JcrXmlSerializerIT1" + "/fcr:export");
new HttpGet(serverAddress + objPath + "/fcr:export");
HttpResponse response = client.execute(getObjMethod);
assertEquals("application/xml", response.getEntity().getContentType()
.getValue());
assertEquals(200, response.getStatusLine().getStatusCode());
logger.debug("Successfully exported: " + objName);
logger.debug("Successfully exported: " + objPath);
final String content = EntityUtils.toString(response.getEntity());
logger.debug("Found exported object: " + content);

// delete it
client.execute(new HttpDelete(serverAddress + "JcrXmlSerializerIT1"));
client.execute(new HttpDelete(serverAddress + objPath));
response =
client.execute(new HttpGet(serverAddress + "JcrXmlSerializerIT1"));
client.execute(new HttpGet(serverAddress + objPath));
assertEquals(404, response.getStatusLine().getStatusCode());

// try to import it
Expand All @@ -63,36 +62,33 @@ public void shouldRoundTripOneObject() throws IOException {

// check that we made it
response =
client.execute(new HttpGet(serverAddress + "JcrXmlSerializerIT1"));
client.execute(new HttpGet(serverAddress + objPath));
assertEquals(200, response.getStatusLine().getStatusCode());

}

@Test
public
void
shouldMoveObjectToTheRootLevelUsingTheRepositoryWideApi()
throws IOException {
final String objName = "JcrXmlSerializerIT2";
public void shouldMoveObjectToTheRootLevelUsingTheRepositoryWideApi()
throws IOException {
final String objName = getTestObjectPath("JcrXmlSerializerIT2");

// set up the object
client.execute(postObjMethod(objName));
client.execute(postDSMethod(objName, "testDS", "stuff"));

// export it
logger.debug("Attempting to export: " + objName);
final HttpGet getObjMethod =
new HttpGet(serverAddress + "JcrXmlSerializerIT2" + "/fcr:export");
new HttpGet(serverAddress + objName + "/fcr:export");
HttpResponse response = client.execute(getObjMethod);
assertEquals(200, response.getStatusLine().getStatusCode());
logger.debug("Successfully exported: " + objName);
final String content = EntityUtils.toString(response.getEntity());
logger.debug("Found exported object: " + content);

// delete it
client.execute(new HttpDelete(serverAddress + "JcrXmlSerializerIT2"));
client.execute(new HttpDelete(serverAddress + objName));
response =
client.execute(new HttpGet(serverAddress + "JcrXmlSerializerIT2"));
client.execute(new HttpGet(serverAddress + objName));
assertEquals(404, response.getStatusLine().getStatusCode());

// try to import it
Expand All @@ -102,23 +98,22 @@ public void shouldRoundTripOneObject() throws IOException {

// check that we made it
response =
client.execute(new HttpGet(serverAddress + "JcrXmlSerializerIT2"));
client.execute(new HttpGet(serverAddress + objName));
assertEquals(200, response.getStatusLine().getStatusCode());

}

@Test
public void shouldExportUsingTheRepositoryWideApi() throws IOException {
final String objName = "JcrXmlSerializerIT2";
final String objName = getTestObjectPath("JcrXmlSerializerIT2");

// set up the object
client.execute(postObjMethod(objName));
client.execute(postDSMethod(objName, "testDS", "stuff"));

// export it
logger.debug("Attempting to export: " + objName);
final HttpGet getObjMethod =
new HttpGet(serverAddress + "JcrXmlSerializerIT2" + "/fcr:export");
new HttpGet(serverAddress + objName + "/fcr:export");
final HttpResponse response = client.execute(getObjMethod);
assertEquals(200, response.getStatusLine().getStatusCode());
logger.debug("Successfully exported: " + objName);
Expand Down
Expand Up @@ -25,12 +25,15 @@
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.BasicHttpEntity;
import org.fcrepo.http.commons.domain.RDFMediaType;
import org.fcrepo.kernel.RdfLexicon;
import org.junit.Test;

import java.io.ByteArrayInputStream;
import java.io.IOException;

import javax.ws.rs.core.HttpHeaders;

import static org.fcrepo.http.commons.test.util.TestHelpers.parseTriples;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
Expand Down Expand Up @@ -68,6 +71,7 @@ public void itShouldAllowUpdatesUsingCNDDeclarations() throws IOException {


final HttpGet httpGet = new HttpGet(serverAddress + "/fcr:nodetypes");
httpGet.setHeader(HttpHeaders.ACCEPT, RDFMediaType.N3_TEXT);

final HttpResponse result = client.execute(httpGet);

Expand Down
Expand Up @@ -248,12 +248,11 @@ public void testIngestWithBinary() throws Exception {

@Test
public void testDeleteObject() throws Exception {
assertEquals(CREATED.getStatusCode(),
getStatus(postObjMethod("FedoraObjectsTest3")));
String testObj = getTestObjectPath("FedoraObjectsTest3");
assertEquals(204, getStatus(new HttpDelete(serverAddress
+ "FedoraObjectsTest3")));
+ testObj)));
assertEquals("Object wasn't really deleted!", 404,
getStatus(new HttpGet(serverAddress + "FedoraObjectsTest3")));
getStatus(new HttpGet(serverAddress + testObj)));
}

@Test
Expand Down
Expand Up @@ -29,7 +29,7 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
//import org.junit.Test;

import java.io.IOException;

Expand All @@ -38,6 +38,7 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

@Ignore
public class FedoraHtmlResponsesIT extends AbstractResourceIT {

private WebClient webClient;
Expand Down
6 changes: 5 additions & 1 deletion fcrepo-http-api/src/test/resources/web.xml
Expand Up @@ -21,7 +21,11 @@
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>org.fcrepo.kernel.services;org.fcrepo.http;org.fcrepo.http.commons.responses;org.fcrepo.http.api</param-value>
<param-value>org.fcrepo.kernel.services;
org.fcrepo.http;
org.fcrepo.http.commons.responses;
org.fcrepo.http.api;
org.fcrepo.http.api.repository</param-value>
</init-param>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
Expand Down
Expand Up @@ -17,6 +17,12 @@

import javax.jcr.Session;

import org.fcrepo.http.commons.exceptionhandlers.AccessControlExceptionMapper;
import org.fcrepo.http.commons.exceptionhandlers.InvalidChecksumExceptionMapper;
import org.fcrepo.http.commons.exceptionhandlers.PathNotFoundExceptionMapper;
import org.fcrepo.http.commons.exceptionhandlers.RepositoryExceptionMapper;
import org.fcrepo.http.commons.exceptionhandlers.TransactionMissingExceptionMapper;
import org.fcrepo.http.commons.exceptionhandlers.WildcardExceptionMapper;
import org.fcrepo.http.commons.responses.RdfProvider;
import org.fcrepo.http.commons.session.AuthenticatedSessionProvider;
import org.fcrepo.kernel.services.TransactionService;
Expand All @@ -40,7 +46,12 @@ public FedoraApplication() {
//TODO this is a temporary hack to get tests to run
// until we know why classpath scanning from mvn isn't working
register(RdfProvider.class);
registerInstances(singletonTx);
register(AccessControlExceptionMapper.class);
register(InvalidChecksumExceptionMapper.class);
register(PathNotFoundExceptionMapper.class);
register(RepositoryExceptionMapper.class);
register(TransactionMissingExceptionMapper.class);
register(WildcardExceptionMapper.class);
}

static class FactoryBinder extends AbstractBinder {
Expand Down
Expand Up @@ -87,7 +87,6 @@ public void writeTo(final Dataset rdf, final Class<?> type,
public boolean isWriteable(final Class<?> type, final Type genericType,
final Annotation[] annotations, final MediaType mediaType) {

logger.info("{} with mediaType {}", type.getName(), mediaType.toString());
// we can return a result for any MIME type that Jena can serialize
final Boolean appropriateMimeType =
mediaType == null ||
Expand Down

0 comments on commit 606fc61

Please sign in to comment.