Package com.tll.model

Examples of com.tll.model.IEntity


          return (dir.getPath().indexOf("smbiz") > 0) && (dir.getPath().indexOf("classes") > 0)
          && (dir.getPath().indexOf("test") < 0);
        }
      });
    for(final Class<? extends IEntity> entityClass : entityClasses) {
      final IEntity e = getEntityBeanFactory().getEntityCopy(entityClass, false);
      if(e == null) continue// skip
      Assert.assertNotNull(e);
      final Model model = marshaler.marshalEntity(e, MarshalOptions.UNCONSTRAINED_MARSHALING);

      assert model.getEntityType() != null : "The marshaled entity model's ref type was found null";

      final ModelKey refKey = model.getKey();
      assert refKey != null : "The marshaled entity model's ref key was found null";
      assert refKey.isSet() : "The marshaled entity model's ref key was found un-set";

      Assert.assertNotNull(model);
      final IEntity e2 = marshaler.marshalModel(model, e.entityClass());
      Assert.assertNotNull(e2);
      Assert.assertEquals(e, e2);
    }
  }
View Full Code Here


  /**
   * Tests the dao impls transaction integrity.
   * @throws Exception
   */
  final void daoTransactionIntegrity() throws Exception {
    IEntity e = getTestEntity();

    e = dao.persist(e);
    endTransaction()// rollback

    startNewTransaction();
View Full Code Here

  /**
   * Test CRUD and find ops
   * @throws Exception
   */
  final void daoCRUDAndFind() throws Exception {
    IEntity e = getTestEntity();
    Assert.assertTrue(e.isNew(), "The created test entity is not new and should be");

    String persistentId = null;

    // create
    e = dao.persist(e);
    setComplete();
    endTransaction();
    persistentId = e.getId();
    Assert.assertNotNull(e.getId(), "The created entities' id is null");
    Assert.assertTrue(!e.isNew(), "The created entity is new and shouldn't be");

    if(e instanceof ITimeStampEntity) {
      // verify time stamp
      Assert.assertNotNull(((ITimeStampEntity) e).getDateCreated(),
      "Created time stamp entity does not have a create date");
View Full Code Here

    Assert.assertNotNull(list, "loadAll returned null");
  }

  @SuppressWarnings("unchecked")
  final void daoFindByName() throws Exception {
    IEntity e = getTestEntity();

    // create
    e = dao.persist(e);
    setComplete();
    endTransaction();
View Full Code Here

  /**
   * Tests the find by ids method
   * @throws Exception
   */
  final void daoFindByIds() throws Exception {
    IEntity e = getTestEntity();
    e = dao.persist(e);
    setComplete();
    endTransaction();

    startNewTransaction();
    Assert.assertNotNull(e, "Null generated test entity");
    final List<String> ids = new ArrayList<String>(1);
    ids.add(e.getId());
    final List<IEntity> list = dao.findByIds(entityHandler.entityClass(), ids, null);
    endTransaction();
    Assert.assertTrue(list != null && list.size() == 1, "find by ids returned null list");
  }
View Full Code Here

    // for the current entity type!!
    if(!BusinessKeyFactory.hasBusinessKeys(entityHandler.entityClass())) {
      return;
    }

    IEntity e = getTestEntity();
    e = dao.persist(e);
    setComplete();
    endTransaction();

    startNewTransaction();
    final IEntity e2 = getTestEntity();
    ensureNonUnique(e, e2);
    try {
      dao.persist(e2);
      setComplete();
      endTransaction();
View Full Code Here

      // expected
    }
  }

  final void daoPurgeNewEntity() throws Exception {
    final IEntity e = getTestEntity();
    final PrimaryKey<IEntity> pk = new PrimaryKey<IEntity>(e);
    try {
      dao.purge(e);
      Assert.fail("An EntityNotFoundException should have occurred (" + pk + ")");
    }
View Full Code Here

    }
  }

  final void daoFindEntityByPrimaryKeyCriteria() throws Exception {
    // persist the target test entity
    IEntity e = getTestEntity();
    e = dao.persist(e);
    setComplete();
    endTransaction();

    final Criteria<IEntity> c = new Criteria<IEntity>(entityHandler.entityClass());
    c.getPrimaryGroup().addCriterion(new PrimaryKey<IEntity>(entityHandler.entityClass(), e.getId()));
    startNewTransaction();
    final IEntity re = dao.findEntity(c);
    assert re != null && re.getId().equals(e.getId());
  }
View Full Code Here

  final void daoFindEntityByBusinessKeyCriteria() throws Exception {
    try {
      final IBusinessKeyDefinition<IEntity>[] bkdefs = BusinessKeyFactory.definitions(entityHandler.entityClass());

      // persist the target test entity
      IEntity e = getTestEntity();
      e = dao.persist(e);
      setComplete();
      endTransaction();

      startNewTransaction();
      final Criteria<IEntity> c = new Criteria<IEntity>(entityHandler.entityClass());
      for(final IBusinessKeyDefinition<IEntity> bkdef : bkdefs) {
        final IBusinessKey<IEntity> bk = BusinessKeyFactory.create(e, bkdef);
        c.getPrimaryGroup().addCriterion(bk, true);
      }
      final IEntity re = dao.findEntity(c);
      assert re != null && re.getId().equals(e.getId());

    }
    catch(final BusinessKeyNotDefinedException e) {
      // ok skip
    }
View Full Code Here

  final void daoFindEntityByCriteria() throws Exception {
    final Criteria c = entityHandler.getTestCriteria();
    if(c == null) return// ok

    // persist the target test entity
    IEntity e = getTestEntity();
    e = dao.persist(e);
    setComplete();
    endTransaction();

    startNewTransaction();
View Full Code Here

TOP

Related Classes of com.tll.model.IEntity

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.