Package org.elevenbits.westvleteren.model.item

Examples of org.elevenbits.westvleteren.model.item.Width


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

    public void testAddAndRemoveWidth() throws Exception {
      Width width = new Width(new BigDecimal("666.666"));
      width = manager.saveWidth(width);
      assertNotNull(width.getId());
      if (log.isDebugEnabled()) {
        log.debug("Width created: " + width);
      }
      Integer id = width.getId();
      manager.removeWidth(width);
      try {
        width = manager.getWidth(id);
            fail("'badwidthname' found in database, failing test...");
      } catch (ObjectRetrievalFailureException orfe) {
View Full Code Here


        }
    }

    public void testCreateAndGetAndRemoveWidth() throws Exception {
      log.warn("Creating a width");
      Width width = new Width(new BigDecimal("666.666"));
      dao.saveWidth(width);
      Integer id = width.getId();
      width = dao.getWidth(id);
      assertEquals(width, new Width(new BigDecimal("666.666")));
      log.warn("Width created: " + width);
      dao.removeWidth(width);
      log.warn("Width removed");
      try {
        width = dao.getWidth(id);
View Full Code Here

        }
    }

    public void testCreateAndUpdateAndRemoveWidth() throws Exception {
      log.warn("Creating a width");
      Width width = new Width(new BigDecimal("666.666"));
      dao.saveWidth(width);
      Integer id = width.getId();
      width = dao.getWidth(id);
      assertEquals(width, new Width(new BigDecimal("666.666")));
      log.warn("Width created: " + width);
      width.setValue(new BigDecimal("333.333"));
      dao.saveWidth(width);
      log.warn("Width updated");
      width = dao.getWidth(id);
      assertEquals(width, new Width(new BigDecimal("333.333")));
      log.warn("Width: " + width);     
         dao.removeWidth(width);
         log.warn("Width removed");
     }
View Full Code Here

         log.warn("Width removed");
     }

    public void testAddAndRemoveWidth() throws Exception {
      log.warn("Add and remove!");
        Width width = new Width(new BigDecimal("666.666"));
        dao.saveWidth(width);
        assertNotNull(width.getId());
        assertEquals(new Width(new BigDecimal("666.666")), width);
        dao.removeWidth(width.getId());
        try {
            width = dao.getWidth(width.getId());
            fail("getWidth didn't throw DataAccessException");
        } catch (DataAccessException d) {
          log.warn("Needed to catch exception since the width did not exist");         
            assertNotNull(d);
        }
View Full Code Here

    dao.saveWidth(width);
    return width;
  }

  public Width getWidth(Integer id) {
    Width width = dao.getWidth(id);
    if (width == null) {
      log.warn("No role with id '" + id + "' found.");
    }
    return width;
  }
View Full Code Here

public class WidthDaoHibernate extends HibernateDaoSupport implements
    WidthDao {


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

  public List getWidths() {
    return getHibernateTemplate().find("from Width");
  }

  public void removeWidth(Integer id) {
    Width width = (Width) getHibernateTemplate().load(Width.class, id);
    getHibernateTemplate().delete(width);
  }
View Full Code Here

TOP

Related Classes of org.elevenbits.westvleteren.model.item.Width

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.