Package test.org.magicbox.dbunit

Examples of test.org.magicbox.dbunit.DBPages


  public void testDettaglio() throws Exception {

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

    _reqMock = new MockHttpServletRequest("GET",
        "/pages.admin?action=dettaglio");
    _reqMock.setParameter(Constant.ID, "1");
    ModelAndView mav = _controller.dettaglio(_reqMock, _resMock);
    assertEquals("admin/dettaglioPage", mav.getViewName());

    Page page = (Page) mav.getModel().get(Constant.PAGE);
    assertNotNull(page);

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


 
  public void testElenco() throws Exception {

    DBCentri dbCentri = new DBCentri();
    dbCentri.preparaDb();
    DBPages dBPages = new DBPages();
    dBPages.preparaDb();

    _reqMock = new MockHttpServletRequest("GET",
        "/pages.admin?action=elenco");

    ModelAndView mav = _controller.elenco(_reqMock, _resMock);
    assertEquals("admin/elencoPages", mav.getViewName());
    List centri = (List) mav.getModel().get(Constant.ELENCO_PAGES);
    assertEquals(10, centri.size());

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

  public void testCentro() throws Exception {

    DBCentri dbCentri = new DBCentri();
    dbCentri.preparaDb();
    DBPages dBPages = new DBPages();
    dBPages.preparaDb();

    _reqMock = new MockHttpServletRequest("GET",
        "/pages.admin?action=centro");
    _reqMock.getSession().setAttribute(Constant.ID_CENTRO_SESSIONE, 46l);

    ModelAndView mav = _controller.centro(_reqMock, _resMock);
    assertEquals("admin/elencoPages", mav.getViewName());
    List centri = (List) mav.getModel().get(Constant.ELENCO_PAGES);
    assertEquals(7, centri.size());

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

  public void testAdmin() throws Exception {

    DBCentri dbCentri = new DBCentri();
    dbCentri.preparaDb();
    DBPages dbPages = new DBPages();
    dbPages.preparaDb();

    _reqMock = new MockHttpServletRequest("GET",
        "/pages.admin?action=admin");

    ModelAndView mav = _controller.admin(_reqMock, _resMock);
    assertEquals("admin/elencoPages", mav.getViewName());
    List centri = (List) mav.getModel().get(Constant.ELENCO_PAGES);
    assertEquals(3, centri.size());

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

  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

 
  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

  }

  public void testGetPages() {
    DBCentro dbCentro = new DBCentro();
    dbCentro.preparaDb();
    DBPages db = new DBPages();
    db.preparaDb();
   
    assertTrue(_service.getPages().size() == 10);
   
    db.pulisciDb();
    dbCentro.pulisciDb();
    db = null;
    dbCentro = null;
  }
View Full Code Here

  }

  public void testGetPagesAdmin() {
    DBCentro dbCentro = new DBCentro();
    dbCentro.preparaDb();
    DBPages db = new DBPages();
    db.preparaDb();
   
    assertTrue(_service.getPages().size() == 10);
    assertEquals(_service.getPagesAdmin().size(),3);
   
    db.pulisciDb();
    dbCentro.pulisciDb();
    db = null;
    dbCentro = null;
  }
View Full Code Here

  }

  public void testGetPagesCentro() {
    DBCentro dbCentro = new DBCentro();
    dbCentro.preparaDb();
    DBPages db = new DBPages();
    db.preparaDb();
   
    assertTrue(_service.getPagesCentro(46).size() == 7);
   
    db.pulisciDb();
    dbCentro.pulisciDb();
    db = null;
    dbCentro = null;
  }
View Full Code Here

  }

  public void testGetPage() {
    DBCentro dbCentro = new DBCentro();
    dbCentro.preparaDb();
    DBPages db = new DBPages();
   
    PageLight pageLight = new PageLightImpl(0,"prova");
    Page pagina = new PageImpl("blah blah",false,1,46,pageLight);
    assertTrue(_service.getPages().size() == 0);
   
      Long id =_service.savePage(pagina);
      assertNotNull(_service.getPage(id));
   
    db.pulisciDb();
    dbCentro.pulisciDb();
    db = null;
    dbCentro = null;
  }
View Full Code Here

TOP

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

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.