Package org.apache.ace.useradmin.ui.editor

Examples of org.apache.ace.useradmin.ui.editor.UserDTO


        }
    }

    public void testAddUserWithNullUsername() throws Exception {
        try {
            UserDTO userDTO = new UserDTO(null, "tran", "TestGroup");
            m_userEditor.addUser(userDTO);
        }
        catch (IllegalArgumentException ex) {
            assertEquals("Username, password and groupname cannot be null or \"\"", ex.getMessage());
        }
View Full Code Here


        }
    }

    public void testAddUserToNonExistingGroup() throws Exception {
        try {
            UserDTO userDTO = new UserDTO("tran", "bob", "nonexistingGroup");
            m_userEditor.addUser(userDTO);
        }
        catch (Exception ex) {
            assertEquals("Group: nonexistingGroup not found", ex.getMessage());
        }
View Full Code Here

        }
    }

    public void testAddUserToNullGroup() throws Exception {
        try {
            UserDTO userDTO = new UserDTO("tran", "bob", null);
            m_userEditor.addUser(userDTO);
        }
        catch (IllegalArgumentException ex) {
            assertEquals("Username, password and groupname cannot be null or \"\"", ex.getMessage());
        }
View Full Code Here

        }
    }

    public void testAddUserToEmptyGroupname() throws Exception {
        try {
            UserDTO userDTO = new UserDTO("tran", "bob", "");
            m_userEditor.addUser(userDTO);
        }
        catch (Exception ex) {
            assertEquals("Username, password and groupname cannot be null or \"\"", ex.getMessage());
        }
View Full Code Here

            assertEquals("Username, password and groupname cannot be null or \"\"", ex.getMessage());
        }
    }

    public void testEditUserWithValidPassword() throws Exception {
        UserDTO userDTO = new UserDTO("bob", "tran", "TestGroup");
        m_userEditor.addUser(userDTO);
        userDTO.setPassword("bob");
        m_userEditor.editPassword(userDTO);
        assertEquals("bob", (String) m_userEditor.getUser("bob").getCredentials().get("password"));
        m_userEditor.removeUser(userDTO);
    }
View Full Code Here

        assertEquals("bob", (String) m_userEditor.getUser("bob").getCredentials().get("password"));
        m_userEditor.removeUser(userDTO);
    }

    public void testEditUserWithNullPassword() throws UserNotFoundException {
        UserDTO userDTO = new UserDTO("tran", "tran", "TestGroup");

        try {
            m_userEditor.addUser(userDTO);
            userDTO.setPassword(null);
            m_userEditor.editPassword(userDTO);
        }
        catch (Exception e) {
            assertEquals("Username or Password cannot be null or \"\" ", e.getMessage());
            m_userEditor.removeUser(userDTO);
View Full Code Here

            m_userEditor.removeUser(userDTO);
        }
    }

    public void testEditUserWithEmptyPassword() throws UserNotFoundException {
        UserDTO userDTO = new UserDTO("tran", "tran", "TestGroup");
        try {

            m_userEditor.addUser(userDTO);
            userDTO.setPassword("");
            m_userEditor.editPassword(userDTO);
        }
        catch (Exception e) {
            assertEquals("Username or Password cannot be null or \"\" ", e.getMessage());
            m_userEditor.removeUser(userDTO);
View Full Code Here

        }
    }

    public void testEditNonExistingUser() {
        try {
            UserDTO userDTO = new UserDTO("BOOOOOB", null, null);
            userDTO.setUsername("bob");
            m_userEditor.editUsername(userDTO);
        }
        catch (Exception userNotFoundException) {
            assertEquals("User: BOOOOOB not found", userNotFoundException.getMessage());
        }
View Full Code Here

            assertEquals("User: BOOOOOB not found", userNotFoundException.getMessage());
        }
    }

    public void testEditUsernameWithValidName() throws Exception {
        UserDTO userDTO = new UserDTO("lala", "tran", "TestGroup");
        m_userEditor.addUser(userDTO);
        m_userAdmin.getUser("username", "lala").getProperties().put("username", "lala1");
        User user = (User) m_userAdmin.getRole("lala");
        assertEquals("lala", user.getName());
        assertEquals("lala1", (String) user.getProperties().get("username"));
        user = m_userAdmin.getUser("username", "lala1");
        userDTO = new UserDTO(user, m_userEditor.getGroup(user));
        assertEquals("lala", user.getName());
        assertEquals("lala1", (String) user.getProperties().get("username"));
        m_userEditor.removeUser(userDTO);
    }
View Full Code Here

        m_userEditor.removeUser(userDTO);
    }

    public void testEditUsernameWithAlreadyExistingName() throws UserNotFoundException {
        try {
            UserDTO userDTO = new UserDTO("Hank", "password", "TestGroup");
            m_userEditor.addUser(userDTO);
            userDTO = new UserDTO("Dirk", "password", "TestGroup");
            m_userEditor.addUser(userDTO);
            userDTO.setUsername("Hank");
            m_userEditor.editUsername(userDTO);
        }
        catch (Exception userAlreadyExistsException) {
            assertEquals("User: Hank already exists", userAlreadyExistsException.getMessage());
            m_userEditor.removeUser(new UserDTO("Hank", null, null));
            m_userEditor.removeUser(new UserDTO("Dirk", null, null));
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.ace.useradmin.ui.editor.UserDTO

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.