Skip to content

Commit

Permalink
Merge pull request #9 from fcrepo4-labs/fcrepo-1503
Browse files Browse the repository at this point in the history
SanityIT works with or without auth enabled
  • Loading branch information
Andrew Woods committed May 5, 2015
2 parents bd8b713 + 8376a7a commit 1b8cd56
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -35,7 +35,7 @@ mvn install -P xacml
This profile builds webapp that includes the [fcrepo-audit](https://github.com/fcrepo4-labs/fcrepo-audit) module that provides internal auditing capability.

```
mvn install -P audit -DskipTests=true
mvn install -P audit
```


Expand Down
20 changes: 20 additions & 0 deletions pom.xml
Expand Up @@ -220,6 +220,10 @@
<name>fcrepo.xacml.initial.root.policy.file</name>
<value>${project.build.directory}/policies/GlobalRolesPolicySet.xml</value>
</systemProperty>
<systemProperty>
<name>auth.enabled</name>
<value>${auth.enabled:false}</value>
</systemProperty>

</systemProperties>

Expand All @@ -237,6 +241,20 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<argLine>-XX:MaxPermSize=128m ${jacoco.agent.it.arg} -Dauth.enabled=${auth.enabled}</argLine>
</configuration>
<executions>
<execution>
<id>default-integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>

</build>
Expand Down Expand Up @@ -273,6 +291,7 @@
<id>xacml</id>
<properties>
<profile.src.dir>${project.basedir}/src/xacml</profile.src.dir>
<auth.enabled>true</auth.enabled>
</properties>
<dependencies>
<dependency>
Expand Down Expand Up @@ -345,6 +364,7 @@
<id>rbacl</id>
<properties>
<profile.src.dir>${project.basedir}/src/rbacl</profile.src.dir>
<auth.enabled>true</auth.enabled>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
Expand Down
10 changes: 9 additions & 1 deletion src/test/java/org/fcrepo/integration/SanityIT.java
Expand Up @@ -50,10 +50,18 @@ public class SanityIT {
private static final String CONTEXT_PATH = System.getProperty("fcrepo.test.context.path");

protected Logger logger;
private static int noAuthExpectedResponse;

@Before
public void setLogger() {
logger = LoggerFactory.getLogger(this.getClass());

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

protected static final String HOSTNAME = "localhost";
Expand Down Expand Up @@ -83,7 +91,7 @@ public void doASanityCheck() throws IOException {
@Test
public void doASanityCheckNoAuth() throws IOException {
final HttpGet get = new HttpGet(serverAddress + "rest/");
assertEquals(401, getStatus(get));
assertEquals(noAuthExpectedResponse, getStatus(get));
}

protected int getStatus(final HttpUriRequest method) throws IOException {
Expand Down

0 comments on commit 1b8cd56

Please sign in to comment.