MyFaces Core
  1. MyFaces Core
  2. MYFACES-2524

Change ExternalSpecifications to enable using it in automated tests

    Details

    • Type: Task Task
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-beta
    • Fix Version/s: 2.0.0-beta-2
    • Component/s: None
    • Labels:
      None

      Description

      Currently ExternalSpecifications is using public static final fields to hold the information if something is available or not (e.g. bean validation). However, this is problematic for automated testing, because the value can not be adapted for the test case (not even with reflection).

        Activity

        Hide
        Jakob Korherr added a comment -

        I changed the public static final fields to private static fields and public getters with lazy initialization. So the value of the fields can be changed using reflection (for automated tests).

        Show
        Jakob Korherr added a comment - I changed the public static final fields to private static fields and public getters with lazy initialization. So the value of the fields can be changed using reflection (for automated tests).
        Hide
        Jan-Kees van Andel added a comment -

        The only reason for this approach was performance, since final fields are automatically thread safe. The classloader makes sure it is.

        Most of the code should be quite performant, only: "Validation.buildDefaultValidatorFactory().getValidator();" is an issue.
        You don't want to invoke this beast on every request, since it bootstraps Bean Validation. I added it because of an issue raised by (I think) Mike Concini.

        I think a lazy initializing singleton is a good replacement. This way, you can change some settings before initialization happens.

        Show
        Jan-Kees van Andel added a comment - The only reason for this approach was performance, since final fields are automatically thread safe. The classloader makes sure it is. Most of the code should be quite performant, only: "Validation.buildDefaultValidatorFactory().getValidator();" is an issue. You don't want to invoke this beast on every request, since it bootstraps Bean Validation. I added it because of an issue raised by (I think) Mike Concini. I think a lazy initializing singleton is a good replacement. This way, you can change some settings before initialization happens.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development