JBehave
  1. JBehave
  2. JBEHAVE-1009

Ensure lazy initialisation in ConfigurableEmbedder.configuredEmbedder()

    Details

    • Type: Improvement Improvement
    • Status: Resolved Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 3.9
    • Fix Version/s: 3.9.2, 4.0
    • Component/s: Core
    • Labels:
      None
    • Number of attachments :
      0

      Description

      I stumbled upon a beheavior of this method:

      org.jbehave.core.ConfigurableEmbedder.configuredEmbedder()

      It always calls these methods when being called:

      embedder.useConfiguration(configuration());
      embedder.useCandidateSteps(candidateSteps());
      embedder.useStepsFactory(stepsFactory());

      This had some unexpected side effects for me. For example I am logging which steps are being used. Since I call "configuredEmbeder()" multiple times, the method "stepsFactory()" is called multiple times. Even if I use just one instance of embedder it is called many times since the JBehave framework calls "configuredEmbedder()" many times.

      Maybe it would be good if there is another method added to "org.jbehave.core.ConfigurableEmbedder" called "configureEmbedder" which actually configures the embedder every time when it is called.

      But the method "configuredEmbedder" should maybe be implemented with lazy initialization, so that the calls in its method are just executed once. I tried this in the class which I extend from "JUnitStories". But then the meta-filtering does not work for some strange reason. So I could not find a solution for this.

        Activity

        Mauro Talevi made changes -
        Field Original Value New Value
        Affects Version/s 3.x [ 16979 ]
        Affects Version/s 3.9 [ 19035 ]
        Fix Version/s 4.0 [ 18486 ]
        Fix Version/s 3.9.2 [ 20180 ]
        Assignee Mauro Talevi [ maurotalevi ]
        Mauro Talevi made changes -
        Summary Method being called many times: ConfigurableEmbedder.configuredEmbedder() Ensure lazy initialisation in ConfigurableEmbedder.configuredEmbedder()
        Mauro Talevi made changes -
        Issue Type Bug [ 1 ] Improvement [ 4 ]
        Mauro Talevi made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]

          People

          • Assignee:
            Mauro Talevi
            Reporter:
            Otto Diesel
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: