Package org.apache.rave.portal.model

Examples of org.apache.rave.portal.model.NewUser


    }

    @Test
    public void failedAccountCreationTest_duplicateEmail() throws Exception {
        String duplicateEmail = "duplicateEmail";
        NewUser newUser = new NewUser();
        newUser.setUsername("newUser");
        newUser.setEmail(duplicateEmail);
        User existingUser = new User();
        existingUser.setEmail(duplicateEmail);

        expect(userService.getUserByUsername("newUser")).andReturn(null);
        expect(userService.getUserByEmail(duplicateEmail)).andReturn(existingUser);
View Full Code Here


  }
 
  @Test
  public void create_UsernameNotSpecified() {
    final Model model = createNiceMock(Model.class);
    final NewUser newUser = new NewUser();
    final BindingResult errors = createNiceMock(BindingResult.class);
    final String username = ""; //no username specified
    final String password = "password";
    final String confirmPassword = password;
    List<ObjectError> errorList = new ArrayList<ObjectError>();
    final ObjectError error = new ObjectError("username.required", "Username required");
   
    newUser.setUsername(username);
    newUser.setPassword(password);
    newUser.setConfirmPassword(confirmPassword);
   
    errorList.add(error);
   
    expect(errors.hasErrors()).andReturn(true).anyTimes();   
    expect(errors.getAllErrors()).andReturn(errorList).anyTimes();
View Full Code Here

  }
 
  @Test
  public void create_UsernameAlreadyExists() {
    final Model model = createNiceMock(Model.class);
    final NewUser newUser = new NewUser();
    final BindingResult errors = createNiceMock(BindingResult.class);
    final String username = "canonical"; //specified username already exists in database
    final String password = "password";
    final String confirmPassword = password;
    final User existingUser = new User();
    List<ObjectError> errorList = new ArrayList<ObjectError>();
    final ObjectError error = new ObjectError("username.exists", "Username already exists");
   
    newUser.setUsername(username);
    newUser.setPassword(password);
    newUser.setConfirmPassword(confirmPassword);
   
    existingUser.setUsername(username);
    existingUser.setPassword(password);
   
    errorList.add(error);
View Full Code Here

  }
   
  @Test
  public void create_InvalidUsernameLength() {
    final Model model = createNiceMock(Model.class);
    final NewUser newUser = new NewUser();
    final BindingResult errors = createNiceMock(BindingResult.class);
    final String username = "u"; //username length less than 2 characters
    final String password = "password";
    final String confirmPassword = password;
    List<ObjectError> errorList = new ArrayList<ObjectError>();
    final ObjectError error = new ObjectError("username.invalid.length", "Username must be atleast 2 characters long");
   
    newUser.setUsername(username);
    newUser.setPassword(password);
    newUser.setConfirmPassword(confirmPassword);
   
    errorList.add(error);
   
    expect(errors.hasErrors()).andReturn(true).anyTimes();   
    expect(errors.getAllErrors()).andReturn(errorList).anyTimes();
View Full Code Here


    @RequestMapping(value = {"/changepassword/{passwordHash:.*}"}, method = RequestMethod.GET)
    public String initialize(Model model, @PathVariable("passwordHash") String passwordHash) {
        log.debug("Requesting user for hash: {}", passwordHash);
        NewUser user = new NewUser();
        model.addAttribute(ModelKeys.NEW_USER, user);
        user.setForgotPasswordHash(passwordHash);
        return ViewNames.PASSWORD_CHANGE;
    }
View Full Code Here

  }
 
  @Test
  public void create_PasswordNotSpecified() {
    final Model model = createNiceMock(Model.class);
    final NewUser newUser = new NewUser();
    final BindingResult errors = createNiceMock(BindingResult.class);
    final String username = "username";
    final String password = ""; //password not specified
    final String confirmPassword = password;
    List<ObjectError> errorList = new ArrayList<ObjectError>();
       
    newUser.setUsername(username);
    newUser.setPassword(password);
    newUser.setConfirmPassword(confirmPassword);
   
    errorList.add(new ObjectError("password.required", "Password required"));
    errorList.add(new ObjectError("confirmPassword.required", "Confirm password required"));
   
    expect(errors.hasErrors()).andReturn(true).anyTimes();   
View Full Code Here

  }
 
  @Test
  public void create_ConfirmPasswordNotSpecified() {
    final Model model = createNiceMock(Model.class);
    final NewUser newUser = new NewUser();
    final BindingResult errors = createNiceMock(BindingResult.class);
    final String username = "usename";
    final String password = "pasword";
    final String confirmPassword = ""; //confirm password not specified
    List<ObjectError> errorList = new ArrayList<ObjectError>();
       
    newUser.setUsername(username);
    newUser.setPassword(password);
    newUser.setConfirmPassword(confirmPassword);
   
    errorList.add(new ObjectError("confirmPassword.required", "Confirm password required"));
   
    expect(errors.hasErrors()).andReturn(true).anyTimes();   
    expect(errors.getAllErrors()).andReturn(errorList).anyTimes();
View Full Code Here

  }
 
  @Test
  public void create_InvalidPasswordLength() {
    final Model model = createNiceMock(Model.class);
    final NewUser newUser = new NewUser();
    final BindingResult errors = createNiceMock(BindingResult.class);
    final String username = "usename";
    final String password = "pas"; //invalid length password
    final String confirmPassword = password;
    List<ObjectError> errorList = new ArrayList<ObjectError>();
       
    newUser.setUsername(username);
    newUser.setPassword(password);
    newUser.setConfirmPassword(confirmPassword);
   
    errorList.add(new ObjectError("password.invalid.length", "Password must be atleast 4 characters long"));
   
    expect(errors.hasErrors()).andReturn(true).anyTimes();   
    expect(errors.getAllErrors()).andReturn(errorList).anyTimes();
View Full Code Here

    @RequestMapping(value = "/newaccount.jsp")
    public void setUpForm(ModelMap model, HttpServletRequest request) {
        logger.debug("Initializing form");
        model.addAttribute(ModelKeys.CAPTCHA_HTML, captchaService.createHtml(request));
        model.addAttribute(ModelKeys.NEW_USER, new NewUser());
    }
View Full Code Here

  }
 
  @Test
  public void create_PasswordMismatchCaseOne() {
    final Model model = createNiceMock(Model.class);
    final NewUser newUser = new NewUser();
    final BindingResult errors = createNiceMock(BindingResult.class);
    final String username = "username";
    final String password = "password";
    final String confirmPassword = "passwor"; //confirm password not of same length as password
    List<ObjectError> errorList = new ArrayList<ObjectError>();
       
    newUser.setUsername(username);
    newUser.setPassword(password);
    newUser.setConfirmPassword(confirmPassword);
   
    errorList.add(new ObjectError("confirmPassword.mismatch", "Password mismatch"));
   
    expect(errors.hasErrors()).andReturn(true).anyTimes();   
    expect(errors.getAllErrors()).andReturn(errorList).anyTimes();
View Full Code Here

TOP

Related Classes of org.apache.rave.portal.model.NewUser

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.