Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Enable xacml node-type registration on integration tests only
  • Loading branch information
Andrew Woods committed Jun 30, 2014
1 parent 90b57be commit ff1f836
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
7 changes: 7 additions & 0 deletions pom.xml
Expand Up @@ -143,6 +143,13 @@
<scope>test</scope>
<type>test-jar</type>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>

</dependencies>

<build>
Expand Down
18 changes: 15 additions & 3 deletions src/main/java/org/fcrepo/auth/xacml/XACMLWorkspaceInitializer.java
Expand Up @@ -86,13 +86,25 @@ public XACMLWorkspaceInitializer(final File initialPoliciesDirectory, final File
}

/**
* Initializes node types and default policies.
* Initializes default policies.
*/
public void init() {
doInit(false);
}

/**
* Initializes node types and default policies - for Integration Tests!
*/
public void initTest() {
doInit(true);
}

private void doInit(final boolean test) {
// Do not "registerNodeTypes" because the xacml-policy.cnd introduces a cyclical dependency with the main
// fedora-node-types.cnd that causes an exception on repository restart.
// TODO: We can remove this dead code in the near future.
// registerNodeTypes();
if (test) {
registerNodeTypes();
}
loadInitialPolicies();
linkRootToPolicy();
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/spring-test/repo.xml
Expand Up @@ -23,7 +23,7 @@

<bean class="org.modeshape.jcr.JcrRepositoryFactory" />

<bean class="org.fcrepo.auth.xacml.XACMLWorkspaceInitializer" init-method="init">
<bean class="org.fcrepo.auth.xacml.XACMLWorkspaceInitializer" init-method="initTest">
<constructor-arg value="${fcrepo.xacml.initial.policies.dir:src/main/resources/policies}"/>
<constructor-arg value="${fcrepo.xacml.initial.root.policy.file:src/main/resources/policies/GlobalRolesPolicySet.xml}"/>
</bean>
Expand Down

0 comments on commit ff1f836

Please sign in to comment.