Class BrowserlessFeatureFlags

java.lang.Object
com.vaadin.experimental.FeatureFlags
com.vaadin.browserless.internal.BrowserlessFeatureFlags
All Implemented Interfaces:
Serializable

public class BrowserlessFeatureFlags extends com.vaadin.experimental.FeatureFlags
FeatureFlags implementation that applies test defined feature flag overrides on top of the ones resolved by Vaadin.

The instance is installed into the VaadinContext of the mock environment before the Vaadin servlet is initialized, so that everything reading feature flags during startup, for example a VaadinServiceInitListener, already observes the test configuration.

For internal use only. May be renamed or removed in a future release.

Since:
25.3
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.vaadin.experimental.FeatureFlags

    com.vaadin.experimental.FeatureFlags.FeatureFlagsWrapper
  • Field Summary

    Fields inherited from class com.vaadin.experimental.FeatureFlags

    ACCESSIBLE_DISABLED_BUTTONS, COLLABORATION_ENGINE_BACKEND, COMPONENT_STYLE_INJECTION, DEFAULT_AUTO_RESPONSIVE_FORM_LAYOUT, HILLA_FULLSTACK_SIGNALS, LAYOUT_COMPONENT_IMPROVEMENTS, PROPERTIES_FILENAME, SYSTEM_PROPERTY_PREFIX_EXPERIMENTAL
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    install(com.vaadin.flow.server.VaadinContext context, Map<String,Boolean> overrides)
    Installs a FeatureFlags instance applying the given overrides into the given Vaadin context.
    void
    void
    setEnabled(String featureId, boolean enabled)

    Methods inherited from class com.vaadin.experimental.FeatureFlags

    get, getEnableHelperMessage, getFeatures, isEnabled, isEnabled, setPropertiesLocation

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • install

      public static void install(com.vaadin.flow.server.VaadinContext context, Map<String,Boolean> overrides)
      Installs a FeatureFlags instance applying the given overrides into the given Vaadin context.

      Must be invoked before anything requests the feature flags for the context, otherwise Vaadin creates and caches its own instance.

      Parameters:
      context - the Vaadin context of the mock environment, not null
      overrides - feature identifiers mapped to their enablement state, not null
      Throws:
      BrowserlessTestSetupException - if a feature identifier is not known by Vaadin
    • loadProperties

      public void loadProperties()

      Re-applies the test defined overrides, so that they are not silently discarded by code reloading the feature flags, for example through FeatureFlags.setPropertiesLocation(java.io.File).

      Overrides:
      loadProperties in class com.vaadin.experimental.FeatureFlags
    • setEnabled

      public void setEnabled(String featureId, boolean enabled)

      Toggles the feature for the current test only. Unlike the default implementation, it neither requires development mode nor stores the new state into the vaadin-featureflags.properties file of the project.

      The new state is recorded among the overrides, so that it survives a later reload of the feature flags, exactly like the states declared by the test configuration.

      Overrides:
      setEnabled in class com.vaadin.experimental.FeatureFlags