Package com.sishuok.es.sys.user.entity

Examples of com.sishuok.es.sys.user.entity.User


        Assert.assertNotNull(userService.login(user.getUsername(), password));
    }

    @Test
    public void testLoginSuccessWithEmail() {
        User user = createUser(username, email, mobilePhoneNumber, password);
        Assert.assertNotNull(userService.login(user.getEmail(), password));
    }
View Full Code Here


    }


    @Test
    public void testLoginSuccessWithMobilePhoneNumber() {
        User user = createUser(username, email, mobilePhoneNumber, password);
        Assert.assertNotNull(userService.login(user.getMobilePhoneNumber(), password));
    }
View Full Code Here

    }


    @Test(expected = UserNotExistsException.class)
    public void testLoginFailWithUserNotExists() {
        User user = createUser(username, email, mobilePhoneNumber, password);
        userService.login(username + "1", password);
    }
View Full Code Here

    }


    @Test(expected = UserNotExistsException.class)
    public void testLoginFailWithUserDeleted() {
        User user = createUser(username, email, mobilePhoneNumber, password);
        userService.delete(user);
        clear();
        userService.login(username, password);
    }
View Full Code Here

        userService.login(username, password);
    }

    @Test(expected = UserPasswordNotMatchException.class)
    public void testLoginFailWithUserPasswordNotMatch() {
        User user = createUser(username, email, mobilePhoneNumber, password);
        userService.login(username, password + "1");
    }
View Full Code Here

    }


    @Test(expected = UserBlockedException.class)
    public void testLoginFailWithStatusBlocked() {
        User user = createUser(username, email, mobilePhoneNumber, password);
        userService.changeStatus(user, user, UserStatus.blocked, "sql");
        userService.login(username, password);
    }
View Full Code Here

        userService.login(username, password);
    }

    @Test(expected = UserPasswordRetryLimitExceedException.class)
    public void testLoginFailWithRetryLimitExceed() {
        User user = createUser(username, email, mobilePhoneNumber, password);
        for (int i = 0; i < maxtRetryCount; i++) {
            try {
                userService.login(username, password + "1");
            } catch (UserPasswordNotMatchException e) {
            }
View Full Code Here

        passwordService.setMaxRetryCount(maxtRetryCount);

        userService.setPasswordService(passwordService);
        passwordService.setMaxRetryCount(maxtRetryCount);

        User user = userService.findByUsername(username);
        if (user != null) {
            userService.delete(user);//因为用户是逻辑删除 此处的目的主要是清 缓存
            delete(user);              //所以还需要物理删除
        }
        user = userService.findByEmail(email);
View Full Code Here

        passwordService.clearLoginRecordCache(mobilePhoneNumber);
    }


    protected User createUser(String username, String email, String mobilePhoneNumber, String password) {
        User user = new User();
        user.setUsername(username);
        user.setEmail(email);
        user.setMobilePhoneNumber(mobilePhoneNumber);
        user.setPassword(password);
        userService.saveAndFlush(user);
        return user;
    }
View Full Code Here

    @Autowired
    private JobService jobService;

    @Test
    public void testCascadeSaveOrgnizationAndJob() {
        User user = createDefaultUser();

        Organization organization1 = new Organization();
        organization1.setName("test1");
        Organization organization2 = new Organization();
        organization2.setName("test2");
        organizationService.save(organization1);
        organizationService.save(organization2);

        Job job1 = new Job();
        job1.setName("test1");
        Job job2 = new Job();
        job2.setName("test2");
        jobService.save(job1);
        jobService.save(job2);

        user.addOrganizationJob(new UserOrganizationJob(organization1.getId(), null));
        user.addOrganizationJob(new UserOrganizationJob(organization2.getId(), job1.getId()));
        user.addOrganizationJob(new UserOrganizationJob(organization2.getId(), job2.getId()));
        userService.update(user);

        clear();

        user = userService.findOne(user.getId());

        Assert.assertEquals(3, user.getOrganizationJobs().size());
        Assert.assertEquals(organization1.getId(), user.getOrganizationJobs().get(0).getOrganizationId());

        Assert.assertEquals(organization2.getId(), user.getOrganizationJobs().get(1).getOrganizationId());
        Assert.assertEquals(organization2.getId(), user.getOrganizationJobs().get(2).getOrganizationId());
    }
View Full Code Here

TOP

Related Classes of com.sishuok.es.sys.user.entity.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.