Package org.elevenbits.westvleteren.model.item

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


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

    public void testAddAndRemoveType() throws Exception {
      Type type = new Type("Type", "of the implementation");
      type = manager.saveType(type);
      assertNotNull(type.getId());
      if (log.isDebugEnabled()) {
        log.debug("Type created: " + type);
      }
      Integer id = type.getId();
      manager.removeType(type);
      try {
        type = manager.getType(id);
            fail("'badtypeame' found in database, failing test...");
      } catch (ObjectRetrievalFailureException orfe) {
View Full Code Here


        }
    }

    public void testCreateAndGetAndRemoveType() throws Exception {
      log.warn("Creating a type");
      Type type = new Type("type", "description");
      dao.saveType(type);
      Integer id = type.getId();
      type = dao.getType(id);
      assertEquals(type.getName(), "type");
      assertEquals(type.getDescription(), "description");
      log.warn("Type created: " + type);
      dao.removeType(type);
      log.warn("Type removed");
      try {
        type = dao.getType(id);
View Full Code Here

        }
    }

    public void testCreateAndUpdateAndRemoveType() throws Exception {
      log.warn("Creating a type");
      Type type = new Type("type", "description");
      dao.saveType(type);
      Integer id = type.getId();
      type = dao.getType(id);
      assertEquals(type.getName(), "type");
      assertEquals(type.getDescription(), "description");
      log.warn("Type created: " + type);
      type.setName("newtype");
      type.setDescription("other description");
      dao.saveType(type);
      log.warn("Type updated");
      type = dao.getType(id);
      assertEquals(type.getName(), "newtype");
      assertEquals(type.getDescription(), "other description");
      log.warn("Type: " + type);     
         dao.removeType(type);
      log.warn("Type removed");
     }
View Full Code Here

      log.warn("Type removed");
     }

    public void testAddAndRemoveType() throws Exception {
      log.warn("Add and remove!");
        Type type = new Type("type", "description");       
        dao.saveType(type);
        assertNotNull(type.getId());
        assertEquals("type", type.getName());
        dao.removeType(type.getId());
        try {
            type = dao.getType(type.getId());
            fail("getType didn't throw DataAccessException");
        } catch (DataAccessException d) {
            assertNotNull(d);
          log.warn("Needed to catch exception since the type did not exist");
        }
View Full Code Here

    dao.saveType(type);
    return type;
  }

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

public class TypeDaoHibernate extends HibernateDaoSupport implements
    TypeDao {


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

  public List getTypes() {
    return getHibernateTemplate().find("from Type");
  }

  public void removeType(Integer id) {
    Type type = (Type) getHibernateTemplate().load(Type.class, id);
    getHibernateTemplate().delete(type);
  }
View Full Code Here

TOP

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

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.