Пример #1
0
  @Override
  public void delete() {
    cancelListeners(getHibernateDao());

    Long pid = Long.valueOf(6L);
    Product product = dao.read(pid);
    Assert.assertNotNull(product);
    Set<User> authorizedUsers = product.getAuthorizedUsers();

    List<MetadataIndex> indexes = product.getIndexes();
    Assert.assertNotNull(indexes);
    Assert.assertFalse(indexes.isEmpty());
    Assert.assertFalse(authorizedUsers.isEmpty());

    dao.delete(product);
    getHibernateDao().getSessionFactory().getCurrentSession().flush();

    Assert.assertNull(dao.read(pid));
    Assert.assertEquals(countElements("METADATA_INDEXES", pid), 0);
    Assert.assertEquals(countElements("CHECKSUMS", pid), 0);

    for (User user : authorizedUsers) {
      Assert.assertNotNull(udao.read(user.getUUID()));
    }
  }
Пример #2
0
 @Test
 public void read() throws Exception {
   User actual = userDao.read(1);
   User expected = getAdmin();
   assertReflectionEquals(expected, actual);
 }