Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Include fcrepo-tranform in default artifact
  • Loading branch information
Andrew Woods committed Oct 19, 2015
1 parent 3a2ab16 commit 9b2864b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
5 changes: 5 additions & 0 deletions pom.xml
Expand Up @@ -57,6 +57,11 @@
<type>jar</type>
<classifier>classes</classifier>
</dependency>
<dependency>
<groupId>org.fcrepo.transform</groupId>
<artifactId>fcrepo-transform</artifactId>
<version>4.4.1-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
Expand Down
29 changes: 26 additions & 3 deletions src/test/java/org/fcrepo/integration/SanityIT.java
Expand Up @@ -15,14 +15,21 @@
*/
package org.fcrepo.integration;

import static javax.ws.rs.core.Response.Status.CREATED;
import static javax.ws.rs.core.Response.Status.OK;
import static javax.ws.rs.core.Response.Status.UNAUTHORIZED;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

import org.apache.commons.codec.binary.Base64;
import org.apache.http.Header;
import org.apache.http.HttpResponse;
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.HttpUriRequest;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.PoolingClientConnectionManager;
Expand Down Expand Up @@ -58,9 +65,9 @@ public void setLogger() {

logger.debug("auth.enabled: {}", System.getProperty("auth.enabled"));
if ("true".equals(System.getProperty("auth.enabled"))) {
noAuthExpectedResponse = 401;
noAuthExpectedResponse = UNAUTHORIZED.getStatusCode();
} else {
noAuthExpectedResponse = 200;
noAuthExpectedResponse = OK.getStatusCode();
}
}

Expand All @@ -85,7 +92,7 @@ public void setLogger() {
public void doASanityCheck() throws IOException {
final HttpGet get = new HttpGet(serverAddress + "rest/");
setAdminAuth(get);
assertEquals(200, getStatus(get));
assertEquals(OK.getStatusCode(), getStatus(get));
}

@Test
Expand All @@ -94,6 +101,22 @@ public void doASanityCheckNoAuth() throws IOException {
assertEquals(noAuthExpectedResponse, getStatus(get));
}

@Test
public void doSanityTranform() throws IOException {
final HttpPost post = new HttpPost(serverAddress + "rest/");
setAdminAuth(post);
final HttpResponse responsePost = client.execute(post);
assertEquals(CREATED.getStatusCode(), responsePost.getStatusLine().getStatusCode());

final Header locationHeader = responsePost.getFirstHeader("Location");
assertNotNull("Location header was null!", locationHeader);

final String location = locationHeader.getValue();
final HttpGet get = new HttpGet(location + "/fcr:transform/default");
setAdminAuth(get);
assertEquals(OK.getStatusCode(), getStatus(get));
}

protected int getStatus(final HttpUriRequest method) throws IOException {
logger.debug("Executing: " + method.getMethod() + " to " +
method.getURI());
Expand Down

0 comments on commit 9b2864b

Please sign in to comment.