Package org.magicbox.domain

Examples of org.magicbox.domain.Credenziali


  public void testGetUser(){
    // inserisco max e pippo sul db
    DBCredentials dbCredentials = new DBCredentials();
    dbCredentials.preparaDb();
   
    Credenziali credenziali = _service.getUser("pippo", Cripto.stringToSHA("pippo"));

    assertEquals(credenziali.getUsername(),"pippo");
    assertNull(credenziali.getPassword());

    dbCredentials.pulisciDb();
    dbCredentials = null;
  }
View Full Code Here


  public void testUpdatePassword() throws Exception {

    _reqMock = new MockHttpServletRequest("GET", "/changeP.page");
    _reqMock.getSession().setAttribute(Constant.ID_CENTRO_SESSIONE, 46);
    //_reqMock.setRemoteUser("pippo");
    Credenziali credenziali = new Credenziali();
    credenziali.setUsername("pippo");
    credenziali.setOldPassword("pippo");
    credenziali.setPassword("michele");
    credenziali.setConfermaPassword("michele");
        ModelAndView mav = _controller.onSubmit(_reqMock, _resMock,credenziali,new BindException(credenziali, Constant.CREDENZIALI));
    assertEquals("redirect:welcome.page", mav.getViewName());
  }
View Full Code Here

    admin.setSysadmin(false);
    admin.setEmail("pippo@yahoo.it");
    admin.setPassword("hola");
   
   
    Credenziali creds = new Credenziali("pippo","postgres");
    NuovoCentroView centro = new NuovoCentroView(centroView,"postgres",admin,creds);
   
    assertTrue(_facade.insert(centro));
   
    dbRoles.pulisciDb();
View Full Code Here

  public void setUp() throws Exception {}
 
  public void tearDown() throws Exception {}
 
  public void testCostruttoreVuoto() {
    Credenziali creds = new Credenziali();
    assertNull(creds.getConfermaPassword());
    assertTrue(creds.getId() == -1);
    assertNull(creds.getOldPassword());
    assertNull(creds.getPassword());
    assertNull(creds.getUsername());
  }
View Full Code Here

    assertNull(creds.getUsername());
  }
 
  public void testCostruttorePieno() {
   
    Credenziali creds = new Credenziali("pippo","postgres");
    assertNull(creds.getConfermaPassword());
    assertTrue(creds.getId() == -1);
    assertNull(creds.getOldPassword());
    assertEquals(Cripto.stringToSHA("postgres"), creds.getPassword());
    assertEquals("pippo",creds.getUsername());
  }
View Full Code Here

    public boolean supports(Class clazz) {
        return Credenziali.class.isAssignableFrom(clazz);
    }

    public void validate(Object command, Errors errors) {
        Credenziali creds = (Credenziali) command;

        if (isValidUserName(creds, errors) || isValidOldPassword(creds, errors)) {

            if (isValidCreds(creds, errors)) {
View Full Code Here

        .getBean("magicbox.credentialsValidator");
  }

  public void testEmpty() {

    Credenziali creds = new Credenziali();
    Errors errors = new BindException(creds, "command");

    _validator.validate(creds, errors);
    assertTrue(errors.hasErrors());
View Full Code Here

  }

  public void testWrongPassword() {
    DBCredentials dbCredentials = new DBCredentials();
    dbCredentials.preparaDb();
    Credenziali creds = new Credenziali();
    creds.setUsername("pippo");
    creds.setOldPassword("giulio");
    creds.setPassword("");
    creds.setConfermaPassword("");

   
    Errors errors = new BindException(creds, "command");

    _validator.validate(creds, errors);
View Full Code Here

  }
 
  public void testWrongusername() {
    DBCredentials dbCredentials = new DBCredentials();
    dbCredentials.preparaDb();
    Credenziali creds = new Credenziali();
    creds.setUsername("gargoile");
    creds.setOldPassword("giulio");
    creds.setPassword("");
    creds.setConfermaPassword("");

   
    Errors errors = new BindException(creds, "command");

    _validator.validate(creds, errors);
View Full Code Here

 
 
  public void testCorrectPassword() {
    DBCredentials dbCredentials = new DBCredentials();
    dbCredentials.preparaDb();
    Credenziali creds = new Credenziali();
    creds.setUsername("pippo");
    creds.setOldPassword("pippo");
    creds.setPassword("");
    creds.setConfermaPassword("");
 
    Errors errors = new BindException(creds, "command");

    _validator.validate(creds, errors);
    assertTrue(!errors.hasErrors());
View Full Code Here

TOP

Related Classes of org.magicbox.domain.Credenziali

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.