Package com.gwtplatform.carstore.shared.dto

Examples of com.gwtplatform.carstore.shared.dto.CurrentUserDto


            userDto = getUserFromCookie(action.getLoggedInCookie());
        } else {
            userDto = getUserFromCredentials(action.getUsername(), action.getPassword());
        }

        CurrentUserDto currentUserDto = new CurrentUserDto(isLoggedIn, userDto);

        String loggedInCookie = "";
        if (isLoggedIn) {
            loggedInCookie = loginCookieDao.createSessionCookie(userDto);
        }
View Full Code Here


    public void logoutShouldDestroyTheSession(UserSessionDao userSessionDao) {
        // Given
        UserDto userDto = mock(UserDto.class);
        given(userDto.getId()).willReturn(0l);

        CurrentUserDto currentUserDto = mock(CurrentUserDto.class);
        given(currentUserDto.getUser()).willReturn(userDto);
        given(currentUserDtoProvider.get()).willReturn(currentUserDto);

        // When
        authenticator.logout();
View Full Code Here

        return userId != null;
    }

    private void removeCurrentUserLoginCookie() {
        CurrentUserDto currentUserDto = currentUserDtoProvider.get();
        UserDto userDto = currentUserDto.getUser();
        userSessionDao.removeLoggedInCookie(userDto);
    }
View Full Code Here

            userDto = User.createDto(userDao.get(currentUserId));
        }

        boolean isLoggedIn = userDto != null;

        return new CurrentUserDto(isLoggedIn, userDto);
    }
View Full Code Here

        given(httpSession.getAttribute(SecurityParameters.getUserSessionKey())).willReturn(A_USER_ID);
        given(userDao.get(A_USER_ID)).willReturn(user);
        UserDto userDto = User.createDto(user);

        // When
        CurrentUserDto currentUserDto = currentUserDtoProvider.get();

        // Then
        assertTrue(currentUserDto.isLoggedIn());
        assertEquals(userDto, currentUserDto.getUser());
    }
View Full Code Here

        // Given
        given(httpSession.getAttribute(SecurityParameters.getUserSessionKey())).willReturn(null);
        given(userDao.get(anyLong())).willReturn(null);

        // When
        CurrentUserDto currentUserDto = currentUserDtoProvider.get();

        // Then
        assertFalse(currentUserDto.isLoggedIn());
        assertNull(currentUserDto.getUser());
    }
View Full Code Here

TOP

Related Classes of com.gwtplatform.carstore.shared.dto.CurrentUserDto

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.