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

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


        }
    }

    public void testEditUserNameWithNull() throws GroupNotFoundException, UserAlreadyExistsException, UserNotFoundException {
        try {
            UserDTO userDTO = new UserDTO("Dirk", "password", "TestGroup");
            m_userEditor.addUser(userDTO);
            userDTO.setUsername(null);
            m_userEditor.editUsername(userDTO);
        }
        catch (Exception invalidArgumentException) {
            assertEquals("oldUsername and newUsername cannot be null or \"\" ", invalidArgumentException.getMessage());
            m_userEditor.removeUser(new UserDTO("Dirk", "password", "TestGroup"));
        }
    }
View Full Code Here


        }
    }

    public void testEditUserNameWithEmptyName() throws GroupNotFoundException, UserAlreadyExistsException, UserNotFoundException {
        try {
            UserDTO userDTO = new UserDTO("Dirk", "password", "TestGroup");
            m_userEditor.addUser(userDTO);
            userDTO.setUsername("");
            m_userEditor.editUsername(userDTO);
        }
        catch (Exception invalidArgumentException) {
            assertEquals("oldUsername and newUsername cannot be null or \"\" ", invalidArgumentException.getMessage());
            m_userEditor.removeUser(new UserDTO("Dirk", "password", "TestGroup"));
        }
    }
View Full Code Here

            String groupName = (String) m_groupSelect.getValue();

            String notification;
            Object itemID;

            UserDTO user = (UserDTO) m_userTable.getValue();
            if (user == null) {
                user = new UserDTO(username, password, groupName);

                m_userUtil.addUser(user);

                notification = String.format("User '%s' created!", user.getUsername());

                itemID = m_userTable.addItem(new Object[] { user }, user);
            }
            else {
                if (!groupName.equals(user.getGroupname())) {
                    user.setGroupname(groupName);
                }
                if (!username.equals(user.getUsername())) {
                    user.setUsername(username);
                }
                if (!password.equals(user.getPassword())) {
                    user.setPassword(password);
                }

                m_userUtil.updateUser(user);

                notification = String.format("User '%s' changed!", user.getUsername());

                itemID = user;
            }

            m_userTable.sort(new Object[] { "User" }, new boolean[] { true });
View Full Code Here

            Role[] roles = m_useradmin.getRoles(null);
            if (roles != null) {
                for (Role role : roles) {
                    if (role.getType() == Role.USER) {
                        User user = (User) role;
                        tempData.add(new UserDTO((User) role, getGroup(user)));
                    }
                }
            }
        }
        catch (InvalidSyntaxException e) {
View Full Code Here

        return false;
    }

    private void initializeUserDTO(User user) {
        m_userDTO = new UserDTO((String) user.getProperties().get("username"), (String) user.getCredentials().get("password"), m_userUtil.getGroup(user).getName());

        m_usernameTextField.setValue(m_userDTO.getUsername());
        m_passwordTextField.setValue(m_userDTO.getPassword());
        m_groupField.setValue(m_userDTO.getGroupname());
    }
View Full Code Here

    }

    public void testAddUserAndRemove() throws Exception {
        String username = "name";

        UserDTO userDTO = new UserDTO(username, "pwd", TEST_GROUP);
        m_userEditor.addUser(userDTO);

        User user = m_userEditor.getUser(username);
        assertNotNull(user);
        assertEquals(username, (String) user.getProperties().get("username"));
View Full Code Here

        assertEquals(username, (String) user.getProperties().get("username"));
    }

    public void testAddUserToEmptyGroupname() throws Exception {
        try {
            UserDTO userDTO = new UserDTO("name", "pwd", "");
            m_userEditor.addUser(userDTO);

            fail("Expected IllegalArgumentException!");
        }
        catch (IllegalArgumentException ex) {
View Full Code Here

        }
    }

    public void testAddUserToNonExistingGroup() throws Exception {
        try {
            UserDTO userDTO = new UserDTO("name", "pwd", "nonexistingGroup");
            m_userEditor.addUser(userDTO);

            fail("Expected GroupNotFoundException!");
        }
        catch (GroupNotFoundException ex) {
View Full Code Here

        }
    }

    public void testAddUserToNullGroup() throws Exception {
        try {
            UserDTO userDTO = new UserDTO("user", "pwd", null);
            m_userEditor.addUser(userDTO);

            fail("Expected IllegalArgumentException!");
        }
        catch (IllegalArgumentException ex) {
View Full Code Here

        }
    }

    public void testAddUserWithEmptyUsername() throws Exception {
        try {
            UserDTO userDTO = new UserDTO("", "pwd", TEST_GROUP);
            m_userEditor.addUser(userDTO);

            fail("Expected IllegalArgumentException!");
        }
        catch (IllegalArgumentException ex) {
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.