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

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


    /**
     * Tests that we can get the credentials for a {@link UserImpl}.
     */
    public void testGetCredentials() {
        UserImpl user = new UserImpl("foo");
       
        Dictionary dict = user.getCredentials();
        assertNotNull(dict);
    }
View Full Code Here


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

    /**
     * Test method for {@link org.apache.felix.useradmin.impl.role.UserImpl#hasCredential(java.lang.String, java.lang.Object)}.
     */
    public void testHasExistingCredentialAlternativeValueTypeOk() {
        UserImpl user = new UserImpl("foo");
       
        Dictionary dict = user.getCredentials();
        dict.put("password", "secret");

        // Direct comparison...
        assertTrue(user.hasCredential("password", "secret"));

        // In case the given value is a byte[]...
        assertTrue(user.hasCredential("password", "secret".getBytes()));

        dict.put("password", "otherSecret".getBytes());
       
        // Direct comparison...
        assertTrue(user.hasCredential("password", "otherSecret".getBytes()));

        // In case the stored value is a byte[]...
        assertTrue(user.hasCredential("password", "otherSecret"));
    }
View Full Code Here

    /**
     * Test method for {@link org.apache.felix.useradmin.impl.role.UserImpl#hasCredential(java.lang.String, java.lang.Object)}.
     */
    public void testHasExistingCredentialOk() {
        UserImpl user = new UserImpl("foo");
       
        Dictionary dict = user.getCredentials();
        dict.put("password", "secret");

        assertTrue(user.hasCredential("password", "secret"));
    }
View Full Code Here

    /**
     * Tests that {@link UserImpl#hashCode()} yields predictable results.
     */
    public void testHashCodeOk() {
        UserImpl user1 = new UserImpl("foo");
        UserImpl user2 = new UserImpl("foo");
        UserImpl user3 = new UserImpl("bar");
       
        assertTrue(user1.hashCode() == user2.hashCode());
        assertFalse(user1.hashCode() == user3.hashCode());
        assertFalse(user2.hashCode() == user3.hashCode());
    }
View Full Code Here

     * @param name the name of the role to create.
     * @return a new {@link Role} instance denoting the requested role, never <code>null</code>.
     */
    public static Role createRole(int type, String name) {
        if (type == Role.USER) {
            UserImpl result = new UserImpl(name);
            return result;
        } else if (type == Role.GROUP) {
            GroupImpl result = new GroupImpl(name);
            return result;
        } else {
View Full Code Here

TOP

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

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.