Package org.opentides.bean.user

Examples of org.opentides.bean.user.UserCredential


public class UserController extends BaseCrudController<BaseUser> {
  private UserGroupService userGroupService;
 
  @Override
  protected void preCreateAction(BaseUser command) {
    UserCredential credential = command.getCredential();
    if (!StringUtil.isEmpty(credential.getNewPassword()))
      credential.setPassword(SecurityUtil.encryptPassword(credential.getNewPassword()));
  }
View Full Code Here


      credential.setPassword(SecurityUtil.encryptPassword(credential.getNewPassword()));
  }

  @Override
  protected void preUpdateAction(BaseUser command) {
    UserCredential credential = command.getCredential();
        if (!StringUtil.isEmpty(credential.getNewPassword()))
            credential.setPassword(SecurityUtil.encryptPassword(credential.getNewPassword()));
  }
View Full Code Here

    BaseUser user = new BaseUser();
    user.addGroup(group1);
    user.setFirstName("John");
    user.setLastName("Doe");
    user.setEmailAddress("johndoe@unittest.com");
    UserCredential userAccount = new UserCredential();
    userAccount.setPassword("unittest");
    userAccount.setUsername("jdoe");
    userAccount.setUser(user);
    user.setCredential(userAccount);
    coreUserDAO.saveEntityModel(user);
    // ensure user is saved and has id
    assertNotNull(user.getId());
    assertEquals( 1, jdbcTemplate.queryForInt("select count(*) from USER_PROFILE where EMAIL='johndoe@unittest.com'"));
View Full Code Here

        // a user can be member of multiple user group
        user = new BaseUser();
        user.addGroup(group1);
        user.addGroup(group2);
        user.setEmailAddress("multiple@unittest.com");
        UserCredential userAccount = new UserCredential();
        userAccount.setPassword("test");
        userAccount.setUsername("multiple");
        userAccount.setUser(user);
        user.setCredential(userAccount);
        coreUserDAO.saveEntityModel(user);
       
        List<BaseUser> users1 = coreUserDAO.findByUsergroupName("group1");
        assertEquals(1, users1.size());
View Full Code Here

      BaseUser user = new BaseUser();
      user.addGroup(group1);
      user.setFirstName("SuperUser");
      user.setLastName("Duplicate");
      user.setEmailAddress("duplicate@unittest.com");
      UserCredential userAccount = new UserCredential();
      userAccount.setPassword("unittest");
      userAccount.setUsername("admin");
      userAccount.setUser(user);
      user.setCredential(userAccount);
      coreUserDAO.saveEntityModel(user);
      fail("Failed to throw exception on duplicate username");
    } catch (Exception e) {
      // success
View Full Code Here

      BaseUser user = new BaseUser();
      user.addGroup(group1);
      user.setFirstName("SuperUser");
      user.setLastName("Duplicate");
      user.setEmailAddress("admin@ideyatech.com");
      UserCredential userAccount = new UserCredential();
      userAccount.setPassword("unittest");
      userAccount.setUsername("admin");
      userAccount.setUser(user);
      user.setCredential(userAccount);
      coreUserDAO.saveEntityModel(user);
      fail("Failed to throw exception on duplicate email");
    } catch (Exception e) {
     
View Full Code Here

    if (userDAO.countAll() > 0)
      exist = true;
    else {
      // if none, let's create admin user
      BaseUser user = new BaseUser();
      UserCredential cred = new UserCredential();
      cred.setUsername("admin");
      cred.setPassword("ideyatech");
      cred.setEnabled(true);
      cred.setUser(user);
      user.setCredential(cred);
      user.setEmailAddress("admin@ideyatech.com");
      user.setFirstName("SuperAdmin");
      user.setLastName("User");
View Full Code Here

     * Test for inner class
     */
    @Test
    public void testBuildJpaQueryString2() {
      UserCriteria user = new UserCriteria();
      UserCredential cred = new UserCredential();
      user.setFirstName("Test");
        cred.setUsername("testname");
      cred.setEnabled(true);
      user.setCredential(cred);

    Assert
        .assertEquals(
            " where obj.firstName like '%Test%' and obj.credential.username like '%testname%' and obj.credential.enabled = true",
View Full Code Here

     * Test for numeric types
     */
    @Test
    public void testBuildJpaQueryString3() {
      UserCriteria user = new UserCriteria();
      UserCredential cred = new UserCredential();
      user.setFirstName("Test");
      cred.setId(123l);
      cred.setEnabled(null);
      user.setCredential(cred);

    Assert
        .assertEquals(
            " where obj.firstName like '%Test%' and obj.credential.id = 123",
View Full Code Here

    }
   
    @Test
    public void testRetrieveObjectValue() {
      UserCriteria user = new UserCriteria();
      UserCredential cred = new UserCredential();
      user.setFirstName("Test");
         user.setEmailAddress("admin@ideyatech.com");
        cred.setUsername("testname");
      cred.setPassword("password");
      cred.setId(123l);
      cred.setEnabled(true);
      user.setCredential(cred);
      Assert.assertEquals("Test", CrudUtil.retrieveObjectValue(user, "firstName"));
      Assert.assertEquals("admin@ideyatech.com", CrudUtil.retrieveObjectValue(user, "emailAddress"));
      Assert.assertEquals("testname", CrudUtil.retrieveObjectValue(user, "credential.username"));
      // Assert.assertEquals("password", CrudUtil.retrieveObjectValue(user, "credential.password"));
View Full Code Here

TOP

Related Classes of org.opentides.bean.user.UserCredential

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.