Package org.magicbox.domain

Examples of org.magicbox.domain.AnnuncioImpl


        StringTrimmerEditor trimmerEditor = new StringTrimmerEditor(false);
        binder.registerCustomEditor(String.class, trimmerEditor);
    }

    protected Object formBackingObject(HttpServletRequest req) throws Exception {
        return new AnnuncioImpl();
    }
View Full Code Here


        pubblicazioniFacade.pubblicaRss(getAnnuncio(req, command));
        return new ModelAndView(getSuccessView());
    }

    private Annuncio getAnnuncio(HttpServletRequest req, Object command) throws Exception {
        AnnuncioImpl annuncio = (AnnuncioImpl) command;
        annuncio.setIdCentro(WebUtils.getIdCentro(req));
        annuncio.setData(new Date());
        annuncio.setTipo(Constant.TYPE_FEED);
        return annuncio;
    }
View Full Code Here

  }
 
  public void testCorrectLenght() {

    //use impl only for test
    AnnuncioImpl annuncio = new AnnuncioImpl();
    annuncio.setTitolo("titolo");
    annuncio.setData(new Date());
    annuncio.setId(0l);
    annuncio.setIdCentro(46l);
    annuncio.setTipo(Constant.TYPE_MAIL);
    annuncio.setContenuto("contenuto");
   
    Envelope envelope = new Envelope(annuncio);
    Errors errors = new BindException(envelope, "command");

    _validator.validate(envelope, errors);
View Full Code Here

  }

  public void testAllWrong() {

    //use impl only for test
    AnnuncioImpl annuncio = new AnnuncioImpl();
    annuncio.setTitolo("ti");
    annuncio.setData(new Date());
    annuncio.setId(0l);
    annuncio.setIdCentro(46l);
    annuncio.setTipo(Constant.TYPE_MAIL);
    annuncio.setContenuto("con");
   
    Envelope envelope = new Envelope(annuncio);
    Errors errors = new BindException(envelope, "command");

    _validator.validate(envelope, errors);
View Full Code Here

  }
 
  public void testWrongTitolo() {

    //use impl only for test
    AnnuncioImpl annuncio = new AnnuncioImpl();
    annuncio.setTitolo("ti");
    annuncio.setData(new Date());
    annuncio.setId(0l);
    annuncio.setIdCentro(46l);
    annuncio.setTipo(Constant.TYPE_MAIL);
    annuncio.setContenuto("contenuto");
    Envelope envelope = new Envelope(annuncio);
    Errors errors = new BindException(envelope, "command");

    _validator.validate(envelope, errors);
    assertTrue(errors.hasErrors());
View Full Code Here

  }
 
  public void testWrongTesto() {

    //use impl only for test
    AnnuncioImpl annuncio = new AnnuncioImpl();
    annuncio.setTitolo("titolo");
    annuncio.setData(new Date());
    annuncio.setId(0l);
    annuncio.setIdCentro(46l);
    annuncio.setTipo(Constant.TYPE_MAIL);
    annuncio.setContenuto("co");
    Envelope envelope = new Envelope(annuncio);
    Errors errors = new BindException(envelope, "command");

    _validator.validate(envelope, errors);
    assertTrue(errors.hasErrors());
View Full Code Here

    DBCentro dbAdmin = new DBCentro();
    dbAdmin.preparaDb();
   
    List<Annuncio> annunci = _service.getAnnunci(Constant.TYPE_FEED);
    assertTrue(annunci.size()==0);
    AnnuncioImpl annuncio = new AnnuncioImpl();
    annuncio.setIdCentro(46l);
    annuncio.setContenuto("bla bla");
    Date data = new Date();
    annuncio.setData(data);
    annuncio.setTipo(Constant.TYPE_FEED);
    annuncio.setTitolo("Nuovo Annucio");
   
    _service.insertAnnuncio(annuncio);
    annunci = _service.getAnnunci(Constant.TYPE_FEED);
   
    assertTrue(annunci.size() == 1);
   
    Annuncio one = (Annuncio)annunci.get(0);
    Long id =one.getId();
   
    Annuncio retrieve = _service.getAnnuncio(id);
    assertEquals(annuncio.getIdCentro(), retrieve.getIdCentro());
    assertEquals(annuncio.getTipo(), retrieve.getTipo());
    assertEquals(annuncio.getContenuto(), retrieve.getContenuto());
    //assertEquals(annuncio.getData(), retrieve.getData());
    assertEquals(annuncio.getTipo(), retrieve.getTipo());
    assertEquals(annuncio.getTitolo(), retrieve.getTitolo());
   
   
    DBAnnuncio dbAnnunci = new DBAnnuncio();
    dbAnnunci.pulisciDb();
    dbAdmin.pulisciDb();
View Full Code Here

    dbAdmin.preparaDb();
   
    List<Annuncio> annunci = _service.getAnnunci(Constant.TYPE_FEED);
    assertTrue(annunci.size()==0);
   
    AnnuncioImpl one = new AnnuncioImpl();
    one.setIdCentro(46l);
    one.setContenuto("bla bla");
    Date data = new Date();
    one.setData(data);
    one.setTipo(Constant.TYPE_FEED);
    one.setTitolo("Nuovo Annucio");
   
    _service.insertAnnuncio(one);
   
    annunci = _service.getAnnunci(Constant.TYPE_FEED);
    assertTrue(annunci.size()==1);
   
    AnnuncioImpl two = new AnnuncioImpl();
    two.setIdCentro(46l);
    two.setContenuto("cra cra");
    Date dataTwo = new Date();
    two.setData(dataTwo);
    two.setTipo(Constant.TYPE_FEED);
    two.setTitolo("Un altro Nuovo Annucio");
   
   
    _service.insertAnnuncio(two);
   
    annunci = _service.getAnnunci(Constant.TYPE_FEED);
View Full Code Here

    DBCentro dbAdmin = new DBCentro();
    dbAdmin.preparaDb();
   
    List<Annuncio> annunci = _service.getAnnunci(Constant.TYPE_FEED);
    assertTrue(annunci.size()==0);
    AnnuncioImpl annuncio = new AnnuncioImpl();
    annuncio.setIdCentro(46l);
    annuncio.setContenuto("bla bla");
    Date data = new Date();
    annuncio.setData(data);
    annuncio.setTipo(Constant.TYPE_FEED);
    annuncio.setTitolo("Nuovo Annucio");
   
    _service.insertAnnuncio(annuncio);
    annunci = _service.getAnnunci(Constant.TYPE_FEED);
   
    assertTrue(annunci.size() == 1);
View Full Code Here

  public void testGetAnnuncio() {
   
    List<Annuncio> lista = _dao.getAnnunci(Constant.TYPE_FEED);
    assertEquals(lista.size(), 0);
   
    AnnuncioImpl annuncio = new AnnuncioImpl();
    annuncio.setIdCentro(2l);
    annuncio.setContenuto("Hola a todos !");
    annuncio.setData(new Date());
    annuncio.setTipo(Constant.TYPE_FEED);
    annuncio.setTitolo("Wilkommen");
    _dao.insertAnnuncio(annuncio);
   
    lista = _dao.getAnnunci(Constant.TYPE_FEED);
    assertEquals(lista.size(), 1);
    Annuncio retrieve = (Annuncio)lista.get(0);
    assertNotNull(retrieve);
    Annuncio up = _dao.getAnnuncio(retrieve.getId());
    assertEquals(annuncio.getIdCentro(), up.getIdCentro());
    assertEquals(annuncio.getContenuto(), up.getContenuto());
    assertEquals(annuncio.getTitolo(), up.getTitolo());
    assertEquals(annuncio.getTipo(), up.getTipo());
    _dao.deleteAnnuncio(retrieve.getId());
  }
View Full Code Here

TOP

Related Classes of org.magicbox.domain.AnnuncioImpl

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.