use of org.apache.jackrabbit.oak.spi.security.authorization.accesscontrol.ACE in project jackrabbit-oak by apache.
the class UtilTest method testGenerateNameDifferentAllow.
@Test
public void testGenerateNameDifferentAllow() throws Exception {
ACE allow = new TestAce(false);
ACE deny = new TestAce(true);
assertNotEquals(Util.generateAceName(allow, 0), Util.generateAceName(deny, 0));
assertNotEquals(Util.generateAceName(allow, 1), Util.generateAceName(deny, 1));
assertNotEquals(Util.generateAceName(allow, 20), Util.generateAceName(deny, 20));
assertNotEquals(Util.generateAceName(allow, 0), Util.generateAceName(deny, 1));
assertNotEquals(Util.generateAceName(allow, 1), Util.generateAceName(deny, 20));
}
use of org.apache.jackrabbit.oak.spi.security.authorization.accesscontrol.ACE in project jackrabbit-oak by apache.
the class UtilTest method testGenerateName.
@Test
public void testGenerateName() throws AccessControlException {
ACE ace = new TestAce(true);
String name = Util.generateAceName(ace, 0);
assertTrue(name.startsWith(ALLOW));
assertEquals(ALLOW, name);
assertEquals(name, Util.generateAceName(ace, 0));
name = Util.generateAceName(ace, 1);
assertTrue(name.startsWith(ALLOW));
assertEquals(ALLOW + 1, name);
assertEquals(name, Util.generateAceName(ace, 1));
}
use of org.apache.jackrabbit.oak.spi.security.authorization.accesscontrol.ACE in project jackrabbit-oak by apache.
the class ACLTest method testGetEntries.
@Test
public void testGetEntries() throws RepositoryException {
List<ACE> aces = createTestEntries();
AbstractAccessControlList acl = createACL(TEST_PATH, aces, getNamePathMapper());
assertNotNull(acl.getEntries());
assertNotNull(acl.getAccessControlEntries());
assertEquals(aces.size(), acl.getEntries().size());
assertEquals(aces.size(), acl.getAccessControlEntries().length);
assertTrue(acl.getEntries().containsAll(aces));
assertTrue(Arrays.asList(acl.getAccessControlEntries()).containsAll(aces));
}
Aggregations