Package fr.ippon.tatami.domain

Examples of fr.ippon.tatami.domain.User


        }
        return groups;
    }

    public Group buildGroupIds(String groupId) {
        User currentUser = authenticationService.getCurrentUser();
        return buildGroupIds(currentUser, groupId);
    }
View Full Code Here


        mockAuthentication("userWhoFollow@ippon.fr");

        assertFalse(friendshipService.followUser("userWhoIsFollowed"));

        /* verify */
        User userWhoFollow = userService.getUserByUsername("userWhoFollow");
        assertThat(userWhoFollow.getFriendsCount(), is(1L));
        assertThat(userWhoFollow.getFollowersCount(), is(0L));

        User userWhoIsFollowed = userService.getUserByUsername("userWhoIsFollowed");
        assertThat(userWhoIsFollowed.getFriendsCount(), is(0L));
        assertThat(userWhoIsFollowed.getFollowersCount(), is(1L));
    }
View Full Code Here

        String login = "nuser_ippon.fr";
        String firstName = "12345678901234567";
        String lastName = "User";
        String avatar = "newAvatar";

        User user = new User();
        user.setLogin(login);
        user.setFirstName(firstName);
        user.setLastName(lastName);
        user.setAvatar(avatar);

        userRepository.updateUser(user);
    }
View Full Code Here

    @Test
    public void shouldNotFollowUserBecauseSameUser() throws Exception {

        mockAuthentication("userWhoWantToFollow@ippon.fr");

        User userWhoFollow = userService.getUserByUsername("userWhoWantToFollow");
        assertThat(userWhoFollow.getFriendsCount(), is(0L));
        assertThat(userWhoFollow.getFollowersCount(), is(0L));

        assertFalse(friendshipService.followUser("userWhoWantToFollow"));

        /* verify */
        userWhoFollow = userService.getUserByUsername("userWhoWantToFollow");
        assertThat(userWhoFollow.getFriendsCount(), is(0L));
        assertThat(userWhoFollow.getFollowersCount(), is(0L));
    }
View Full Code Here

    @Test
    public void shouldForgetUser() {
        mockAuthentication("userWhoWantToForget@ippon.fr");

        User userWhoWantToForget = userService.getUserByUsername("userWhoWantToForget");
        assertThat(userWhoWantToForget.getFriendsCount(), is(1L));

        User userToForget = new User();
        userToForget.setLogin("userToForget@ippon.fr");
        userService.createUser(userToForget);
        userToForget.setDailyDigestSubscription(false);
        userToForget.setWeeklyDigestSubscription(false);
        userService.updateUser(userToForget);

        assertTrue(friendshipService.unfollowUser("userToForget"));
        userWhoWantToForget = userService.getUserByUsername("userWhoWantToForget");
        assertThat(userWhoWantToForget.getFriendsCount(), is(0L));
        User userWhoIsForgotten = userService.getUserByUsername("userToForget");
        assertThat(userWhoIsForgotten.getFollowersCount(), is(0L));
    }
View Full Code Here

        mockAuthentication("userWhoWantToForget@ippon.fr");

        assertFalse(friendshipService.unfollowUser("unknownUser"));

        /* verify */
        User userWhoWantToForget = userService.getUserByUsername("userWhoWantToForget");
        assertThat(userWhoWantToForget.getFriendsCount(), is(0L));
    }
View Full Code Here

        User userWhoWantToForget = userService.getUserByUsername("userWhoWantToForget");
        assertThat(userWhoWantToForget.getFriendsCount(), is(0L));
    }

    private void mockAuthentication(String login) {
        User authenticateUser = constructAUser(login);
        AuthenticationService mockAuthenticationService = mock(AuthenticationService.class);
        when(mockAuthenticationService.getCurrentUser()).thenReturn(authenticateUser);
        ReflectionTestUtils.setField(friendshipService, "authenticationService", mockAuthenticationService);
        ReflectionTestUtils.setField(userService, "authenticationService", mockAuthenticationService);
    }
View Full Code Here

    @Before
    public void setup() {

        GroupController groupController = new GroupController();

        User authenticateUser = constructAUser("userWhoHasGroup@ippon.fr");
        AuthenticationService mockAuthenticationService = mock(AuthenticationService.class);
        when(mockAuthenticationService.getCurrentUser()).thenReturn(authenticateUser);
        ReflectionTestUtils.setField(groupController, "authenticationService", mockAuthenticationService);
        ReflectionTestUtils.setField(groupController, "groupService", groupService);
        ReflectionTestUtils.setField(groupController, "userService", userService);
View Full Code Here

        assertNotNull(registrationKey);

        String validatedLogin = userService.validateRegistration(registrationKey);
        assertEquals(newUserLogin.toLowerCase(), validatedLogin);

        User validatedUser = userService.getUserByLogin(validatedLogin);
        assertNotNull(validatedUser);
    }
View Full Code Here

    @Inject
    private AuthenticationService authenticationService;

    public String createAvatar(Avatar avatar) {

        User currentUser = authenticationService.getCurrentUser();

        if (currentUser.getAvatar() != null && !("").equals(currentUser.getAvatar())) {
            deleteAvatar(currentUser.getAvatar());
        }

        try {
            avatar.setContent(scaleImage(avatar.getContent()));
        } catch (IOException e) {
View Full Code Here

TOP

Related Classes of fr.ippon.tatami.domain.User

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.