Class BrowserlessFeatureFlags
- All Implemented Interfaces:
Serializable
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
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 TypeMethodDescriptionstatic voidinstall(VaadinContext context, Map<String, Boolean> overrides) Installs aFeatureFlagsinstance applying the given overrides into the given Vaadin context.voidRead the feature flag properties files and updates the enable property of each feature object.voidsetEnabled(String featureId, boolean enabled) Enables or disables the given feature.Methods inherited from class com.vaadin.experimental.FeatureFlags
get, getEnableHelperMessage, getFeatures, isEnabled, isEnabled, setPropertiesLocation
-
Method Details
-
install
Installs aFeatureFlagsinstance 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 nulloverrides- feature identifiers mapped to their enablement state, not null- Throws:
BrowserlessTestSetupException- if a feature identifier is not known by Vaadin
-
loadProperties
public void loadProperties()Read the feature flag properties files and updates the enable property of each feature object.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:
loadPropertiesin classFeatureFlags
-
setEnabled
Enables or disables the given feature.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:
setEnabledin classFeatureFlags- Parameters:
featureId- the feature idenabled-trueto enable,falseto disable
-