Examples of DBRoles


Examples of test.org.magicbox.dbunit.DBRoles

    _ctx = SpringFactory.getXmlWebApplicationContext();
    _service = (RolesService) _ctx.getBean("magicbox.admin.rolesService");
  }
 
    public void testInsertRoles() {
      DBRoles dbRoles = new DBRoles();
      dbRoles.pulisciDb();
    assertTrue(_service.insertInRoles("pippo", "user"));
    _service.deleteFromRoles("pippo");
    dbRoles.pulisciDb();
  }
View Full Code Here

Examples of test.org.magicbox.dbunit.DBRoles

    _service.deleteFromRoles("pippo");
    dbRoles.pulisciDb();
  }
 
  public void testDeleteFromRoles() {
    DBRoles dbRoles = new DBRoles();
    dbRoles.preparaDb();
    assertTrue(_service.deleteFromRoles("anon"));
    assertTrue(_service.deleteFromRoles("max"));
    assertTrue(_service.deleteFromRoles("pippo"));

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

Examples of test.org.magicbox.dbunit.DBRoles

  }
 
    public void testInsert() {
    DBCentro dbcentro = new DBCentro();
    dbcentro.preparaDb();
    DBRoles dbRoles = new DBRoles();
    DBCredentials dbCredentials = new DBCredentials();
     
    Indirizzo indirizzo = new IndirizzoImpl("09129","Cagliari","CA","Via casamia 74");
    //use impl only for test
    CentroLightImpl centroLight = new CentroLightImpl();
    centroLight.setCreditoResiduoSms(1000);
    centroLight.setId(0);
    centroLight.setNomeCentro("Casa mia");
    centroLight.setNumeroDonatori(144);
    Centro centroView = new CentroImpl("http://www.magicbox.org","070123456","0701234567","desmatik@yahoo.it","Centro San Benedetto",indirizzo,centroLight);
    //use impl only for test
    RecapitoTelefonicoImpl recapito = new RecapitoTelefonicoImpl();
    recapito.setCellulare("3391234567");
    AmministratoreLight adminLight = new AmministratoreLightImpl("pippo","ciccio pasticcio", new Long(46),new Long(0));
    //use implement only for tests
    AmministratoreImpl admin = new AmministratoreImpl();
    admin.setRecapiti(recapito);
    admin.setAmministratoreLight(adminLight);
    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();
    dbcentro.pulisciDb();
    dbCredentials.pulisciDb();
    dbRoles = null;
    dbcentro = null;
    dbCredentials = null;
View Full Code Here

Examples of test.org.magicbox.dbunit.DBRoles

  }

  public void testAdmin() {
    DBCredentials dbCredentials = new DBCredentials();
    dbCredentials.preparaDb();
    DBRoles dbRoles = new DBRoles();
    dbRoles.preparaDb();

    Authentication authentication = new UsernamePasswordAuthenticationToken(
        "max", "max");
    Authentication authenticated = _dao.authenticate(authentication);
    assertNotNull(authenticated);
    GrantedAuthority[] authorities = authenticated.getAuthorities();
    assertNotNull(authorities);
    assertEquals(1, authorities.length);
    assertEquals(Constant.ROLE_ADMIN, authorities[0].getAuthority());

    dbRoles.pulisciDb();
    dbCredentials.pulisciDb();
  }
View Full Code Here

Examples of test.org.magicbox.dbunit.DBRoles

  }

  public void testReferenteCentro() {
    DBCredentials dbCredentials = new DBCredentials();
    dbCredentials.preparaDb();
    DBRoles dbRoles = new DBRoles();
    dbRoles.preparaDb();

    Authentication authentication = new UsernamePasswordAuthenticationToken(
        "pippo", "pippo");
    Authentication authenticated = _dao.authenticate(authentication);
    assertNotNull(authenticated);
    GrantedAuthority[] authorities = authenticated.getAuthorities();
    assertNotNull(authorities);
    assertEquals(1, authorities.length);
    assertEquals(Constant.ROLE_USER, authorities[0].getAuthority());

    dbRoles.pulisciDb();
    dbCredentials.pulisciDb();
  }
View Full Code Here

Examples of test.org.magicbox.dbunit.DBRoles

  }

  public void testBadCredentials() {
    DBCredentials dbCredentials = new DBCredentials();
    dbCredentials.preparaDb();
    DBRoles dbRoles = new DBRoles();
    dbRoles.preparaDb();

    Authentication authentication = new UsernamePasswordAuthenticationToken(
        "gargoile", "notredame");
    boolean flag = false;
    try {
      _dao.authenticate(authentication);
    } catch (BadCredentialsException e) {
      flag = true;
    }
    assertTrue(flag);

    dbRoles.pulisciDb();
    dbCredentials.pulisciDb();
  }
View Full Code Here

Examples of test.org.magicbox.dbunit.DBRoles

 
  public void testInsertRoles() {
   
    assertTrue(_dao.insertInRoles("pippo", "user"));

    DBRoles dbRoles = new DBRoles();
    dbRoles.pulisciDb();
  }
View Full Code Here

Examples of test.org.magicbox.dbunit.DBRoles

    DBRoles dbRoles = new DBRoles();
    dbRoles.pulisciDb();
  }
 
  public void testDeleteFromRoles() {
    DBRoles dbRoles = new DBRoles();
    dbRoles.preparaDb();
    assertTrue(_dao.deleteFromRoles("anon"));
    assertTrue(_dao.deleteFromRoles("max"));
    assertTrue(_dao.deleteFromRoles("pippo"));

    dbRoles.pulisciDb();
    dbRoles = null ;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.