Package org.elevenbits.westvleteren.model.item

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


        }
    }

    public void testCreateAndGetAndRemoveShape() throws Exception {
      log.warn("Creating a shape");
      Shape shape = new Shape("shape", "description");
      dao.saveShape(shape);
      Integer id = shape.getId();
      shape = dao.getShape(id);
      assertEquals(shape.getName(), "shape");
      assertEquals(shape.getDescription(), "description");
      log.warn("Shape created: " + shape);
      dao.removeShape(shape);
      log.warn("Shape removed");
      try {
        shape = dao.getShape(id);
View Full Code Here


        }
    }

    public void testCreateAndUpdateAndRemoveShape() throws Exception {
      log.warn("Creating a shape");
      Shape shape = new Shape("shape", "description");
      dao.saveShape(shape);
      Integer id = shape.getId();
      shape = dao.getShape(id);
      assertEquals(shape.getName(), "shape");
      assertEquals(shape.getDescription(), "description");
      log.warn("Shape created: " + shape);
      shape.setName("newshape");
      shape.setDescription("other description");
      dao.saveShape(shape);
      log.warn("Shape updated");
      shape = dao.getShape(id);
      assertEquals(shape.getName(), "newshape");
      assertEquals(shape.getDescription(), "other description");
      log.warn("Shape: " + shape);     
         dao.removeShape(shape);
         log.warn("Shape removed");
     }
View Full Code Here

         log.warn("Shape removed");
     }

    public void testAddAndRemoveShape() throws Exception {
      log.warn("Add and remove!");
        Shape shape = new Shape("shape", "description")
        dao.saveShape(shape);
        assertNotNull(shape.getId());
        assertEquals("shape", shape.getName());
        dao.removeShape(shape.getId());
        try {
            shape = dao.getShape(shape.getId());
            fail("getShape didn't throw DataAccessException");
        } catch (DataAccessException d) {
          log.warn("Needed to catch exception since the shape did not exist");         
            assertNotNull(d);
        }
View Full Code Here

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

    public void testAddAndRemoveShape() throws Exception {
      Shape shape = new Shape("Good shape", "Worst band ever");
      shape = manager.saveShape(shape);
      assertNotNull(shape.getId());
      if (log.isDebugEnabled()) {
        log.debug("Shape created: " + shape);
      }     
      Integer id = shape.getId();
      manager.removeShape(shape);
      try {
        shape = manager.getShape(id);
            fail("'badshapename' found in database, failing test...");       
      } catch (ObjectRetrievalFailureException orfe) {
View Full Code Here

    dao.saveShape(shape);
    return shape;
  }

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

public class ShapeDaoHibernate extends HibernateDaoSupport implements
    ShapeDao {


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

  public List getShapes() {
    return getHibernateTemplate().find("from Shape");
  }

  public void removeShape(Integer id) {
    Shape shape = (Shape) getHibernateTemplate().load(Shape.class, id);
    getHibernateTemplate().delete(shape);
  }
View Full Code Here

TOP

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

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.