_manager = (AmministratoriManager) _ctx.getBean("magicbox.admin.adminService");
}
public void testGetAmministratori(){
DBCredentials dbCredentials = new DBCredentials();
dbCredentials.preparaDb();
DBCentro dbCentro = new DBCentro();
dbCentro.preparaDb();
DBAdmin dbAdmin = new DBAdmin();
assertTrue(_manager.getAmministratori().size()==0);
//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 adminInsert = new AmministratoreImpl();
adminInsert.setRecapiti(recapito);
adminInsert.setAmministratoreLight(adminLight);
adminInsert.setSysadmin(false);
adminInsert.setEmail("pippo@yahoo.it");
adminInsert.setPassword("hola");
assertTrue(_manager.saveAmministratore(adminInsert) > 1);
//use impl only for test
RecapitoTelefonicoImpl recapitoBis = new RecapitoTelefonicoImpl();
recapitoBis.setCellulare("3391234567");
AmministratoreLight adminLightBis = 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(adminLightBis);
admin.setSysadmin(false);
admin.setEmail("pippo@yahoo.it");
admin.setPassword("hola");
assertTrue(_manager.saveAmministratore(admin) > 1);
assertTrue(_manager.getAmministratori().size()==2);
dbAdmin.pulisciDb();
dbCentro.pulisciDb();
dbCredentials.pulisciDb();
dbAdmin = null;
dbCentro = null;
dbCredentials = null;
}