Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,19 @@ protected Context createJndiContext() throws Exception {
user = userManager.createUser("test", "quatloos");
}
// set up permissions
String permissionsPath = session.getRootNode().getPath();
String path = session.getRootNode().getPath();
AccessControlManager accessControlManager = session
.getAccessControlManager();
AccessControlPolicyIterator acls = accessControlManager
.getApplicablePolicies(permissionsPath);
.getApplicablePolicies(path);
AccessControlList acl = null;
if (acls.hasNext()) {
AccessControlList acl = (AccessControlList) acls.nextAccessControlPolicy();
acl.addAccessControlEntry(user.getPrincipal(), accessControlManager
.getSupportedPrivileges(permissionsPath));
accessControlManager.setPolicy(permissionsPath, acl);
acl = (AccessControlList) acls.nextAccessControlPolicy();
} else {
throw new Exception("could not set access control for path "
+ permissionsPath);
acl = (AccessControlList) accessControlManager.getPolicies(path)[0];
}
acl.addAccessControlEntry(user.getPrincipal(), accessControlManager.getSupportedPrivileges(path));
accessControlManager.setPolicy(path, acl);

session.save();
session.logout();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,22 @@
*/
package org.apache.camel.component.jcr;

import javax.jcr.LoginException;

import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.junit.Ignore;
import org.junit.Test;

public class JcrAuthTokenWithLoginTest extends JcrAuthTestBase {
public class JcrAuthTokenLoginFailureTest extends JcrAuthTestBase {

@Test
@Ignore("Fails with some error")
public void testCreateNodeWithAuthentication() throws Exception {
Exchange exchange = createExchangeWithBody("<message>hello!</message>");
Exchange out = template.send("direct:a", exchange);
assertNotNull(out);
String uuid = out.getOut().getBody(String.class);
assertNull("Expected body to be null, found JCR node UUID", uuid);
assertTrue("Wrong exception type", out.getException() instanceof LoginException);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@

import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.junit.Ignore;
import org.junit.Test;

public class AuthTokenLoginFailureTest extends JcrAuthTestBase {
public class JcrAuthTokenLoginTest extends JcrAuthTestBase {

@Test
@Ignore("Fails with some error")
public void testCreateNodeWithAuthentication() throws Exception {
Exchange exchange = createExchangeWithBody("<message>hello!</message>");
Exchange out = template.send("direct:a", exchange);
Expand Down