Package org.elevenbits.westvleteren.model

Examples of org.elevenbits.westvleteren.model.Invoice


        }
    }

    public void testCreateAndGetAndRemoveInvoice() throws Exception {
      log.warn("Creating a invoice");
      Invoice invoice = new Invoice("invoice", "description");
      dao.saveInvoice(invoice);
      Integer id = invoice.getId();
      invoice = dao.getInvoice(id);
      assertEquals(invoice.getName(), "invoice");
      assertEquals(invoice.getDescription(), "description");
      log.warn("Invoice created: " + invoice);
      dao.removeInvoice(invoice);
      log.warn("Invoice removed");
      try {
        invoice = dao.getInvoice(id);
View Full Code Here


        }
    }

    public void testCreateAndUpdateAndRemoveInvoice() throws Exception {
      log.warn("Creating a invoice");
      Invoice invoice = new Invoice("invoice", "description");
      dao.saveInvoice(invoice);
      Integer id = invoice.getId();
      invoice = dao.getInvoice(id);
      assertEquals(invoice.getName(), "invoice");
      assertEquals(invoice.getDescription(), "description");
      log.warn("Invoice created: " + invoice);
      invoice.setName("newinvoice");
      invoice.setDescription("other description");
      dao.saveInvoice(invoice);
      log.warn("Invoice updated");
      invoice = dao.getInvoice(id);
      assertEquals(invoice.getName(), "newinvoice");
      assertEquals(invoice.getDescription(), "other description");
      log.warn("Invoice: " + invoice);     
         dao.removeInvoice(invoice);
     }
View Full Code Here

         dao.removeInvoice(invoice);
     }

    public void testAddAndRemoveInvoice() throws Exception {
      log.warn("Add and remove!");
        Invoice invoice = new Invoice("invoice", "description");       
        dao.saveInvoice(invoice);
        assertNotNull(invoice.getId());
        assertEquals("invoice", invoice.getName());
        dao.removeInvoice(invoice.getId());
        try {
            invoice = dao.getInvoice(invoice.getId());
            fail("getInvoice didn't throw DataAccessException");
        } catch (DataAccessException d) {
          log.warn("Needed to catch exception since the invoice did not exist");
            assertNotNull(d);
        }
View Full Code Here

    protected void tearDown() throws Exception {
      manager = null;
    }

    public void testAddAndRemoveInvoice() throws Exception {
      Invoice invoice = new Invoice("Groen!", "What should I say");
      invoice = manager.saveInvoice(invoice);
      assertNotNull(invoice.getId());
      if (log.isDebugEnabled()) {
        log.debug("Invoice created: " + invoice);
      }    
      Integer id = invoice.getId();
      manager.removeInvoice(invoice);
      try {
        invoice = manager.getInvoice(id);
            fail("'badinvoiceame' found in database, failing test...");       
      } catch (ObjectRetrievalFailureException orfe) {
View Full Code Here

public class InvoiceDaoHibernate extends HibernateDaoSupport implements
    InvoiceDao {


  public Invoice getInvoice(Integer id) {
    Invoice invoice = (Invoice) getHibernateTemplate().get(
        Invoice.class, id);
    if (invoice == null) {
      throw new ObjectRetrievalFailureException(Invoice.class, id);
    }
    return invoice;
View Full Code Here

  public List getInvoices() {
    return getHibernateTemplate().find("from Invoice");
  }

  public void removeInvoice(Integer id) {
    Invoice invoice = (Invoice) getHibernateTemplate().load(Invoice.class, id);
    getHibernateTemplate().delete(invoice);
  }
View Full Code Here

    dao.saveInvoice(invoice);
    return invoice;
  }

  public Invoice getInvoice(Integer id) {
    Invoice invoice = dao.getInvoice(id);
    if (invoice == null) {
      log.warn("No invoice with id '" + id + "' found.");
    }
    return invoice;
  }
View Full Code Here

TOP

Related Classes of org.elevenbits.westvleteren.model.Invoice

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.