Package org.encuestame.persistence.domain.security

Examples of org.encuestame.persistence.domain.security.UserAccount


     *             exception
     **/
    @Category(DefaultTest.class)
    @Test
    public void testUpdateUser() throws EnMeExpcetion {
        final UserAccount secUsers = createUserAccount("developer",
                this.userPrimary);
        final Long idUser = secUsers.getUid();
        final UserAccountBean userBean = ConvertDomainBean
                .convertSecondaryUserToUserBean(secUsers);
        userBean.setName("editor");
        securityService.updateUser(userBean);
        final UserAccount userUpdateRetrieve = getAccountDao()
                .getUserAccountById(idUser);
        assertEquals("shouldbe", "editor", userUpdateRetrieve.getCompleteName());
    }
View Full Code Here


     *             exception
     */
    @Category(InternetTest.class)
    @Test
    public void testRenewPassword() throws EnMeExpcetion {
        final UserAccount secUser = createUserAccount("paola", this.userPrimary);
        final String passwd = secUser.getPassword();
        final UserAccountBean userPass = ConvertDomainBean
                .convertSecondaryUserToUserBean(secUser);
        final String retrievePassword = securityService.renewPassword(userPass,
                passwd);
        assertEquals("should be equals", passwd, retrievePassword);
View Full Code Here

     *             EnMeExpcetion
     */
    @Category(DefaultTest.class)
    @Test(expected = EnMeExpcetion.class)
    public void testRenewPasswordwithoutPass() throws EnMeExpcetion {
        final UserAccount secUser = createUserAccount("diana", this.userPrimary);
        UserAccountBean userPassBean = ConvertDomainBean
                .convertSecondaryUserToUserBean(secUser);
        final String retrievePassword = securityService.renewPassword(
                userPassBean, null);
        assertEquals("should be equals", null, retrievePassword);
View Full Code Here

        userCreateBean.setDateNew(new Date());
        userCreateBean.setPrimaryUserId(createAccount().getUid());
        securityService.createUser(userCreateBean,
                this.userAccount.getUsername());
        // TODO: need assert
        final UserAccount user = getAccountDao().getUserByUsername(
                userCreateBean.getUsername());
        assertNotNull("should be equals", user);
        assertEquals("should be equals", 1, user.getSecUserPermissions().size());
    }
View Full Code Here

     */
    @Category(InternetTest.class)
    @Test
    public void testCreateUserwithoutPassword() throws EnMeExpcetion {
        createDefaultPermission();
        UserAccount secCreateUser = new UserAccount();
        UserAccountBean userCreateBean = ConvertDomainBean
                .convertSecondaryUserToUserBean(secCreateUser);
        userCreateBean.setPassword(null);
        userCreateBean.setEmail("demo2@demo.org");
        userCreateBean.setUsername("demo2");
        userCreateBean.setStatus(true);
        userCreateBean.setName("Diana Paola");
        userCreateBean.setPrimaryUserId(createAccount().getUid());
        userCreateBean.setDateNew(new Date());
        securityService.createUser(userCreateBean,
                this.userAccount.getUsername());
        // TODO: need assert
        final UserAccount user = getAccountDao().getUserByUsername(
                userCreateBean.getUsername());
        assertNotNull("should be equals", user);
        assertEquals("should be equals", 1, user.getSecUserPermissions().size());
    }
View Full Code Here

     */
    @Category(InternetTest.class)
    @Test
    public void testCreateUserwithPassword() throws EnMeExpcetion {
        createDefaultPermission();
        UserAccount secCreateUser = new UserAccount();
        UserAccountBean userCreateBean = ConvertDomainBean
                .convertSecondaryUserToUserBean(secCreateUser);
        userCreateBean.setPassword("12345");
        userCreateBean.setEmail("demo1@demo.org");
        userCreateBean.setUsername("demo1");
        userCreateBean.setStatus(true);
        userCreateBean.setName("Diana Paola");
        userCreateBean.setDateNew(new Date());
        userCreateBean.setPrimaryUserId(createAccount().getUid());
        securityService.createUser(userCreateBean,
                this.userAccount.getUsername());
        // TODO: need assert
        final UserAccount user = getAccountDao().getUserByUsername(
                userCreateBean.getUsername());
        assertNotNull("should be equals", user);
        assertEquals("should be equals", 1, user.getSecUserPermissions().size());
    }
View Full Code Here

     *             EnMeExpcetion
     */
    @Category(DefaultTest.class)
    @Test
    public void testAssignPermissionwithIdUsername() throws EnMeExpcetion {
        final UserAccount secUser = createUserAccount("demo", this.userPrimary);
        final UserAccountBean userPermissionBean = ConvertDomainBean
                .convertSecondaryUserToUserBean(secUser);
        final UnitPermission permissionBean = ConvertDomainBean
                .convertPermissionToBean(this.permission);
        userPermissionBean.setId(userPermissionBean.getId());
        userPermissionBean.setUsername("demo");
        securityService.assignPermission(userPermissionBean, permissionBean);
        assertEquals("should be equals", 1, secUser.getSecUserPermissions()
                .size());
    }
View Full Code Here

     *             EnMeExpcetion
     */
    @Category(DefaultTest.class)
    @Test(expected = EnMeExpcetion.class)
    public void testAssignPermissionwithPermission() throws EnMeExpcetion {
        final UserAccount secUser = createUserAccount("juanpicado2",
                this.userPrimary);
        final UserAccountBean userPermissionBean = ConvertDomainBean
                .convertSecondaryUserToUserBean(secUser);
        final UnitPermission permissionBean = new UnitPermission();
        // modify id permission.
View Full Code Here

     *             EnMeExpcetion
     */
    @Category(DefaultTest.class)
    @Test
    public void testAssignGroup() throws EnMeExpcetion {
        final UserAccount users = createUserAccount("juanpicado",
                this.userPrimary);
        final Group groups = createGroups("encuestador");
        UserAccountBean userBean = ConvertDomainBean
                .convertSecondaryUserToUserBean(users);
        UnitGroupBean groupBean = ConvertDomainBean
View Full Code Here

     * Test searchUsersByEmail.
     */
    @Test
    @Category(DefaultTest.class)
    public void testsearchUsersByEmail() {
        final UserAccount email = createUserAccount("emailUser1",
                this.userPrimary);
        List<UserAccount> emailUsers = this.securityService
                .searchUsersByEmail(email.getUserEmail());
        assertEquals(emailUsers.size(), 1);
    }
View Full Code Here

TOP

Related Classes of org.encuestame.persistence.domain.security.UserAccount

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.