Package test.org.magicbox.dbunit

Examples of test.org.magicbox.dbunit.DBCentro


  }
 
 
  public void testConferma() throws Exception {

    DBCentro dbCentro = new DBCentro();
    dbCentro.preparaDb();
    DBGruppiCentro dbGruppi = new DBGruppiCentro();
    dbGruppi.preparaDb();
    DBUtenti dbUtenti = new DBUtenti();
    dbUtenti.preparaDb();

    _reqMock = new MockHttpServletRequest("GET", "/gruppi.page?action=conferma");
    _reqMock.getSession().setAttribute(Constant.ID_CENTRO_SESSIONE, new Long(46));
    _reqMock.setParameter(Constant.ID, "1");
   
    ModelAndView mav = _controller.conferma(_reqMock, _resMock);
    assertEquals("gruppi/confermaEliminazioneGruppo", mav.getViewName());
   
    dbUtenti.pulisciDb();
    dbGruppi.pulisciDb();
    dbCentro.pulisciDb();
    dbGruppi = null;
    dbCentro = null;
    dbUtenti = null;
  }
View Full Code Here


  }
 
 
  public void testElimina() throws Exception {

    DBCentro dbCentro = new DBCentro();
    dbCentro.preparaDb();
    DBGruppiCentro dbGruppi = new DBGruppiCentro();
    dbGruppi.preparaDb();
    DBUtenti dbUtenti = new DBUtenti();
    dbUtenti.preparaDb();

    _reqMock = new MockHttpServletRequest("GET", "/gruppi.page?action=elimina");
    _reqMock.getSession().setAttribute(Constant.ID_CENTRO_SESSIONE, new Long(46));
    _reqMock.setParameter(Constant.ID, "1");
   
    ModelAndView mav = _controller.elimina(_reqMock, _resMock);
    assertEquals("redirect:gruppi.page?action=elenco", mav.getViewName());
   
    dbUtenti.pulisciDb();
    dbGruppi.pulisciDb();
    dbCentro.pulisciDb();
    dbGruppi = null;
    dbCentro = null;
    dbUtenti = null;
  }
View Full Code Here

    _resMock = new MockHttpServletResponse();
  }

  public void testUpdate() throws Exception {

    DBCentro dbCentro = new DBCentro();
    dbCentro.preparaDb();
    DBPages dbPages = new DBPages();
    dbPages.preparaDb();

    _reqMock = new MockHttpServletRequest("GET", "/page.admin");
    _reqMock.addParameter(Constant.ID, "46");
    Page pagina = new PageImpl(1,"titolone","bla bla",true,0,46);

    ModelAndView mav = _controller.onSubmit(_reqMock, _resMock, pagina,
        new BindException(pagina, Constant.PAGE));
    assertEquals(Constant.REDIRECT_ELENCO_PAGES, mav.getViewName());

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

    dbPages = null;
  }
 
  public void testInsert() throws Exception {

    DBCentro dbCentro = new DBCentro();
    dbCentro.preparaDb();
    DBPages dbPages = new DBPages();
    dbPages.preparaDb();

    _reqMock = new MockHttpServletRequest("GET", "/page.admin");
    _reqMock.addParameter(Constant.ID, "46");
    Page pagina = new PageImpl(0,"titolone","bla bla",true,0,46);

    ModelAndView mav = _controller.onSubmit(_reqMock, _resMock, pagina,
        new BindException(pagina, Constant.PAGE));
    assertEquals(Constant.REDIRECT_ELENCO_PAGES, mav.getViewName());

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

    _resMock = new MockHttpServletResponse();
  }

  public void testProcessFinish() throws Exception {

    DBCentro dbCentro = new DBCentro();

    _reqMock = new MockHttpServletRequest("GET", "/nuovoCentro.admin");
    Indirizzo indirizzo = new IndirizzoImpl("09100", "cagliari", "CA",
        "casamia 3");
    //use impl only for test
    CentroLightImpl centroLight = new CentroLightImpl();
    centroLight.setCreditoResiduoSms(200);
    centroLight.setId(46);
    centroLight.setNomeCentro("Centro del quartiere di S.Benedetto");
    centroLight.setNumeroDonatori(200);
    Centro centro = new CentroImpl(
        "http://magic-box.wiki.sourceforge.net/", "070789123",
        "0709876543", "gooo46@yahoo.it",
        "Cagliari Due", indirizzo, centroLight);
    RecapitoTelefonico recapitotel = new RecapitoTelefonicoImpl("", "", "", "");
    Amministratore admin = new AmministratoreImpl("pippo", "pippo", 46,
        1, false, "", "centrotest@avis.it",recapitotel);
    Credenziali credenziali = new Credenziali();
    credenziali.setPassword("pippo");

    NuovoCentroView ncw = new NuovoCentroView(centro, "", admin,
        credenziali);

    ModelAndView mav = _controller.processFinish(_reqMock, _resMock, ncw,
        new BindException(ncw, Constant.NUOVO_CENTRO_WIZ));
    assertEquals(Constant.REDIRECT_WELCOME_USER, mav.getViewName());

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

  }
 
  @SuppressWarnings("unchecked")
  public void testElenco() throws Exception {

    DBCentro dbCentro = new DBCentro();
    dbCentro.preparaDb();
    DBCredentials dbCredentials = new DBCredentials();
    dbCredentials.preparaDb();
    DBAdmin dbAdmin = new DBAdmin();
    dbAdmin.preparaDb();

    _reqMock = new MockHttpServletRequest("GET", "/ricercheAdmin.admin?action=elenco");
    _reqMock.setParameter(Constant.LETTERA, "p");
    ModelAndView mav = _controller.elenco(_reqMock, _resMock);
    assertEquals("admin/elencoRicercaAlfabeticaAdmins", mav.getViewName());
    List admins = (List) mav.getModel().get(Constant.ELENCO_ADMIN);
    assertEquals(1,admins.size() );

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

    dbCentro = null;
  }
 
  public void testPrepara() throws Exception {

    DBCentro dbCentro = new DBCentro();
    dbCentro.preparaDb();
    DBCredentials dbCredentials = new DBCredentials();
    dbCredentials.preparaDb();
    DBAdmin dbAdmin = new DBAdmin();
    dbAdmin.preparaDb();

    _reqMock = new MockHttpServletRequest("GET", "/ricercheAdmin.admin?action=prepara");
    ModelAndView mav = _controller.prepara(_reqMock, _resMock);
    assertEquals("admin/ricercaAlfabeticaReferenti", mav.getViewName());
   
    dbAdmin.pulisciDb();
    dbCredentials.pulisciDb();
    dbCentro.pulisciDb();
  }
View Full Code Here

    dbUtenti = null;
    dbCentro = null;
  }

  public void testInsertUtenti() {
    DBCentro dbCentro = new DBCentro();
    dbCentro.preparaDb();
    DBUtenti dbUtenti = new DBUtenti();
    List<Utente> utenti = new ArrayList<Utente>();
    for (int i = 0; i < 1000; i++) {
      RecapitoTelefonico recapitoTel = new RecapitoTelefonicoImpl( "3391234567", "070123457", "070123458",
      "070123456");
      Indirizzo indirizzo = new IndirizzoImpl( "09129", "Cagliari",
          "CA", "Via Casamia 1");
      UtenteLight utenteLight = new UtenteLightImpl("101","Baldussu Aldo",0,2);
      Utente utente = new UtenteImpl(utenteLight,46, "desmax74@yahoo.it", true, indirizzo, recapitoTel);
      utenti.add(utente);
    }

    assertEquals(1000, _service.insertUtenti(utenti, 46));

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

    dbUtenti = null;
    dbCentro = null;
  }

  public void testGetUtentiByNominativo() {
    DBCentro dbCentro = new DBCentro();
    DBUtenti db = new DBUtenti();
    dbCentro.preparaDb();
    db.preparaDb();

    assertEquals(_service.getUtentiByNominativo("b", 46, 0).size(), 15);
    assertEquals(_service.getUtentiByNominativo("ba", 46, 0).size(), 15);
    assertEquals(_service.getUtentiByNominativo("bal", 46, 0).size(), 15);
    assertEquals(_service.getUtentiByNominativo("bald", 46, 0).size(), 15);
    assertEquals(_service.getUtentiByNominativo("baldu", 46, 0).size(), 15);
    assertEquals(_service.getUtentiByNominativo("baldus", 46, 0).size(), 15);
    assertEquals(_service.getUtentiByNominativo("balduss", 46, 0).size(),
        15);
    assertEquals(_service.getUtentiByNominativo("baldussi", 46, 0).size(),
        1);
    assertEquals(_service.getUtentiByNominativo("baldussu", 46, 0).size(),
        14);

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

    db = null;
    dbCentro = null;
  }

  public void testGetUtentiByAlfabetico() {
    DBCentro dbCentro = new DBCentro();
    DBUtenti db = new DBUtenti();
    dbCentro.preparaDb();
    db.preparaDb();

    assertEquals(_service.getUtentiByAlfabetico("a", 46, 0).size(), 0);
    assertEquals(_service.getUtentiByAlfabetico("b", 46, 0).size(), 15);
    assertEquals(_service.getUtentiByAlfabetico("c", 46, 0).size(), 0);

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

TOP

Related Classes of test.org.magicbox.dbunit.DBCentro

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.