/**
* Unit test for https://jira.exoplatform.org/browse/JCR-1832
*/
public void testGetFileFromFolder() throws Exception
{
ExtendedNode folderA = (ExtendedNode)session.getRootNode().addNode("folderA", "nt:folder");
folderA.addMixin("exo:privilegeable");
folderA.setPermission("john", PermissionType.ALL);
folderA.removePermission(IdentityConstants.ANY);
session.save();
assertEquals(4, folderA.getACL().getPermissionEntries().size());
assertEquals("john read", folderA.getACL().getPermissionEntries().get(0).getAsString());
assertEquals("john add_node", folderA.getACL().getPermissionEntries().get(1).getAsString());
assertEquals("john set_property", folderA.getACL().getPermissionEntries().get(2).getAsString());
assertEquals("john remove", folderA.getACL().getPermissionEntries().get(3).getAsString());
Session sessJohn = repository.login(new CredentialsImpl("john", "exo".toCharArray()), "ws");
ExtendedNode folderB = (ExtendedNode)sessJohn.getRootNode().getNode("folderA").addNode("folderB", "nt:folder");
folderB.addMixin("exo:privilegeable");
folderB.setPermission("any", new String[]{"read"});
sessJohn.save();
assertEquals(5, folderB.getACL().getPermissionEntries().size());
assertEquals("john read", folderB.getACL().getPermissionEntries().get(0).getAsString());
assertEquals("john add_node", folderB.getACL().getPermissionEntries().get(1).getAsString());
assertEquals("john set_property", folderB.getACL().getPermissionEntries().get(2).getAsString());
assertEquals("john remove", folderB.getACL().getPermissionEntries().get(3).getAsString());
assertEquals("any read", folderB.getACL().getPermissionEntries().get(4).getAsString());
// Login as anonim.
// Tthis session use on server side, thank SessionProvider.
repository.login(new CredentialsImpl(IdentityConstants.ANONIM, "exo".toCharArray()), "ws");