Package org.apache.felix.useradmin.impl.role

Examples of org.apache.felix.useradmin.impl.role.RoleImpl


    /**
     * Tests that we must enter a valid name upon constructing a {@link RoleImpl}.
     */
    public void testCreateNullNameFail() {
        try {
            new RoleImpl(null);
           
            fail();
        } catch (IllegalArgumentException e) {
            // Ok; expected
        }
View Full Code Here


    /**
     * Tests that we must enter a valid name upon constructing a {@link RoleImpl}.
     */
    public void testCreateEmptyNameFail() {
        try {
            new RoleImpl(" ");
           
            fail();
        } catch (IllegalArgumentException e) {
            // Ok; expected
        }
View Full Code Here

    /**
     * Tests that we can obtain the name of a {@link RoleImpl} as set in its constructor.
     */
    public void testGetName() {
        RoleImpl role = new RoleImpl("foo");
        assertEquals("foo", role.getName());
    }
View Full Code Here

    /**
     * Tests that we can obtain the properties of a {@link RoleImpl}.
     */
    public void testGetProperties() {
        RoleImpl role = new RoleImpl("foo");

        Dictionary dict = role.getProperties();
        assertNotNull(dict);
    }
View Full Code Here

    /**
     * Test method for {@link org.apache.felix.useradmin.impl.role.RoleImpl#getType()}.
     */
    public void testGetType() {
        RoleImpl role = new RoleImpl("foo");
        assertEquals(Role.ROLE, role.getType());
    }
View Full Code Here

    /**
     * Tests that {@link RoleImpl#hashCode()} yields predictable results.
     */
    public void testHashCodeOk() {
        RoleImpl role1 = new RoleImpl("foo");
        RoleImpl role2 = new RoleImpl("foo");
        RoleImpl role3 = new RoleImpl("bar");
       
        assertTrue(role1.hashCode() == role2.hashCode());
        assertFalse(role1.hashCode() == role3.hashCode());
        assertFalse(role2.hashCode() == role3.hashCode());
    }
View Full Code Here

     * Tests that adding a role as basic member while another role with the same name exists does not cause duplication.
     */
    public void testAddBasicMemberWithExistingRoleOk() {
        GroupImpl group = new GroupImpl("foo");
        assertTrue(group.addMember(new UserImpl("bar")));
        assertFalse(group.addMember(new RoleImpl("bar"))); // should be ignored...

        assertEquals(1, group.getMembers().length);
        assertNull(group.getRequiredMembers());
    }
View Full Code Here

     * Tests that adding a role as required member while another role with the same name exists does not cause duplication.
     */
    public void testAddRequiredMemberWithExistingRoleOk() {
        GroupImpl group = new GroupImpl("foo");
        assertTrue(group.addRequiredMember(new UserImpl("bar")));
        assertFalse(group.addRequiredMember(new RoleImpl("bar"))); // should be ignored...

        assertNull(group.getMembers());
        assertEquals(1, group.getRequiredMembers().length);
    }
View Full Code Here

     * Tests that with permission, the {@link GroupImpl#addMember(Role)} method can be accessed.
     */
    public void testAddMemberWithPermissionsOk() throws SecurityException {
        m_securityManager.m_allowed = true;
       
        m_group.addMember(new RoleImpl(Role.USER_ANYONE));
    }
View Full Code Here

    /**
     * Tests that without permission, the {@link GroupImpl#addMember(Role)} method can not be accessed.
     */
    public void testAddMemberWithoutPermissionsFail() throws SecurityException {
        try {
            m_group.addMember(new RoleImpl(Role.USER_ANYONE));
           
            fail("Security exception expected!");
        } catch (SecurityException e) {
            // Ok; expected
        }
View Full Code Here

TOP

Related Classes of org.apache.felix.useradmin.impl.role.RoleImpl

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.