glassfish
  1. glassfish
  2. GLASSFISH-1420

Allow entity-persistence-tests to automatically clean up

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 9.1pe
    • Fix Version/s: not determined
    • Component/s: entity-persistence
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      1,420

      Description

      The following is a suggestion from Craig Russell that would allow test clean up
      to happen in a much more intuitive way:

      It might be worthwhile to look at adding some behavior to the toplink
      base class JUnitTestCase to allow a subclass to acquire an
      EntityManager that will be cleaned up by the tearDown method in the
      base class.

      Maybe add a protected field EntityManager em to the base class.
      Subclass tests could either clean up their own EntityManager using a
      try finally pattern or if they assigned the base class em field could
      simply throw an exception and exit. At the end of the test, if the em
      field is not null, the base class tearDown would clean it up.

      This pattern provides for cleaning up the EntityManager without
      duplicating or adding code to each test case.

      From my experience, it's difficult to look at a test case that does
      its own cleanup, because each test writer's ideas of what needs to be
      cleaned up tends to be different. Some tests use a try catch where
      the catch cleans up, some don't clean up at all, some use try finally.

      It's more efficient to have common code that can evolve as our
      understanding of how to clean up evolves.

        Activity

        tware created issue -
        Hide
        marina vatkina added a comment -

        resetting the default owner

        Show
        marina vatkina added a comment - resetting the default owner
        kenaiadmin made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 1420 33024
        Hide
        Tom Mueller added a comment -

        Bulk change to set fix version to "not determined" where the issue is open but the value is for a released version.

        Show
        Tom Mueller added a comment - Bulk change to set fix version to "not determined" where the issue is open but the value is for a released version.
        Tom Mueller made changes -
        Fix Version/s not determined [ 11149 ]
        Fix Version/s 9.1pe [ 10974 ]

          People

          • Assignee:
            tware
            Reporter:
            tware
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: