コード例 #1
0
  /** Test groups loading */
  @Test
  public void testLoadAllGroups() throws Exception {
    System.out.println(">>> Loading all groups");
    UserTransaction tx = getUserTransaction();
    try {
      AdminEJBLocal instance = (AdminEJBLocal) getEJBInstance(AdminEJB.class.getSimpleName());
      tx.begin();
      List<Group> result = instance.getGroups();
      tx.commit();

      assertNotNull("List of groups is null.", result);
      assertFalse("List of groups is empty.", result.size() <= 0);

      System.out.println(">>> Found " + result.size() + " groups.");
    } catch (Exception e) {
      tx.rollback();
      fail(e.getMessage());
    }
  }