示例#1
0
  @Test
  public void testUpdateRole() throws Exception {
    Role role = dao.getRoleByName("ROLE_USER");
    log.debug(role);
    role.setDescription("test descr");

    dao.save(role);

    role = dao.getRoleByName("ROLE_USER");
    assertEquals(role.getDescription(), "test descr");
  }
示例#2
0
  @Test
  public void testAddAndRemoveRole() throws Exception {
    Role role = new Role("testrole");
    role.setDescription("new role descr");
    dao.save(role);
    // setComplete(); // change behavior from rollback to commit
    // endTransaction();

    // startNewTransaction();
    role = dao.getRoleByName("testrole");
    assertNotNull(role.getDescription());

    dao.removeRole("testrole");
    // setComplete();
    // endTransaction(); // deletes role from database

    role = dao.getRoleByName("testrole");
    assertNull(role);
  }