Package com.volantis.shared.security.acl.mutable

Examples of com.volantis.shared.security.acl.mutable.MutableACLEntry


     * Test the entry.
     */
    public void testEntry()
            throws Exception {

        MutableACLEntry entry = factory.createACLEntry(principalMock, false);

        // The permission is not contained as it is empty.
        assertFalse(entry.checkPermission(permission1Mock));

        // The permission should be added as the entry is empty.
        assertTrue(entry.addPermission(permission1Mock));

        // Adding it again does nothing.
        assertFalse(entry.addPermission(permission1Mock));

        // The entry should contain the permission as it has just been added.
        assertTrue(entry.checkPermission(permission1Mock));

        // Removing permission2 should fail as it has not been added.
        assertFalse(entry.removePermission(permission2Mock));

        // Removing permission1 should work as it has been added.
        assertTrue(entry.removePermission(permission1Mock));

        // Entries should be positive by default.
        assertFalse(entry.isNegative());

        // Making them negative should be honoured.
        entry = factory.createACLEntry(principalMock, true);
        assertTrue(entry.isNegative());
    }
View Full Code Here


     */
    public void testPermissions() throws Exception {

        MutableACL acl = factory.createACL(principalMock);

        MutableACLEntry negative = factory.createACLEntry(otherMock, true);
        negative.addPermission(permission1Mock);

        acl.addEntry(principalMock, negative);

        MutableACLEntry positive = factory.createACLEntry(otherMock, false);
        positive.addPermission(permission1Mock);
        positive.addPermission(permission2Mock);

        acl.addEntry(principalMock, positive);

        Set permissions = acl.permissions(otherMock);
        assertEquals(permissions, Collections.singleton(permission2Mock));
View Full Code Here

TOP

Related Classes of com.volantis.shared.security.acl.mutable.MutableACLEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.