Package org.magicbox.domain

Examples of org.magicbox.domain.Page


  public void setUp() throws Exception {}
 
  public void tearDown() throws Exception {}
 
  public void testCostruttoreVuoto() {
    Page page = new PageImpl();
    assertNull(page.getTitolo());
    assertTrue(page.getId() == -1);
    assertFalse(page.isAdmin());
    assertTrue(page.isNew());
    assertNull(page.getContent());
    assertEquals(0,page.getIdCentro());
    assertEquals(0,page.getOrdine());
  }
View Full Code Here


    assertEquals(0,page.getOrdine());
  }
 
  public void testCostruttorePieno() {
    PageLight pageLight = new PageLightImpl(new Long(13),"titolo");
    Page page = new PageImpl("contenuto",false,2,46,pageLight);
    assertEquals("titolo",page.getTitolo());
    assertTrue(page.getId() == 13);
    assertEquals("contenuto",page.getContent());
    assertEquals(46,page.getIdCentro());
    assertEquals(2,page.getOrdine());
  }
View Full Code Here

        "/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;
View Full Code Here

        return Page.class.isAssignableFrom(clazz);
    }

    public void validate(Object command, Errors err) {

        Page page = (PageImpl) command;
        if (page.getContent() == null) {
            err.rejectValue("content", "required.empty");
        }
        if (page.getTitolo() == null) {
            err.rejectValue("titolo", "required.empty");
        }

    }
View Full Code Here

        long id = ServletRequestUtils.getLongParameter(req, Constant.ID, 0);
        return id != 0 ? proceed(id) : notFound();
    }

    private ModelAndView proceed(long id) {
        Page page = pagesService.getPage(id);
        return page != null ? new ModelAndView("pages/dettaglioContent", Constant.CONTENT, pagesService.getPage(id)) : notFound();
    }
View Full Code Here

    _validator = (PageValidator) _ctx.getBean("magicbox.admin.pageValidator");
  }
 
  public void testAllEmpty() {
   
    Page pagina = new PageImpl();
    Errors errors = new BindException(pagina, "command");
    _validator.validate(pagina, errors);
    assertTrue(errors.hasErrors());
    assertTrue(errors.hasFieldErrors("content"));
    assertTrue(errors.hasFieldErrors("titolo"));
View Full Code Here

    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());
View Full Code Here

    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());
View Full Code Here

    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));
   
View Full Code Here

    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);
      _service.savePage(pagina);
      assertTrue(_service.getPages().size() == 1);
   
View Full Code Here

TOP

Related Classes of org.magicbox.domain.Page

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.