BackendExperimentalFeaturesRegistryServiceImpl implements ExperimentalFeaturesRegistryService,
                                                                       BackendExperimentalFeaturesRegistryService,
                                                                       FeaturesEditorService { @Override public boolean isFeatureEnabled(String featureId) { ExperimentalFeaturesRegistryImpl registry = getFeaturesRegistry(); if(!registry.getFeature(featureId).isPresent()) { return true; } return isExperimentalEnabled() && getFeaturesRegistry().isFeatureEnabled(featureId); } @Inject  BackendExperimentalFeaturesRegistryServiceImpl(final ExperimentalFeatureDefRegistry defRegistry, @Named("global") final ExperimentalFeaturesStorage globalStorage); @Override ExperimentalFeaturesRegistryImpl getFeaturesRegistry(); @Override Boolean isExperimentalEnabled(); @Override boolean isFeatureEnabled(String featureId); @Override void save(EditableExperimentalFeature editableFeature); @Override ExperimentalFeaturesSession getExperimentalFeaturesSession(); static final String EXPERIMENTAL_FEATURES_PROPERTY_NAME; }
@Test public void testLoadRegistryWithExistingData() { init(true); assertTrue(service.isFeatureEnabled(GLOBAL_FEATURE_1)); assertFalse(service.isFeatureEnabled(GLOBAL_FEATURE_2)); assertTrue(service.isFeatureEnabled(GLOBAL_FEATURE_3)); assertTrue(service.isFeatureEnabled(FEATURE_1)); assertFalse(service.isFeatureEnabled(FEATURE_2)); assertTrue(service.isFeatureEnabled(FEATURE_3)); assertTrue(service.isFeatureEnabled(UNEXISTING_FEATURE)); }
@Test public void testLoadRegistryWithExistingDataExperimentalDisabled() { init(false); assertFalse(service.isFeatureEnabled(GLOBAL_FEATURE_1)); assertFalse(service.isFeatureEnabled(GLOBAL_FEATURE_2)); assertFalse(service.isFeatureEnabled(GLOBAL_FEATURE_3)); assertFalse(service.isFeatureEnabled(FEATURE_1)); assertFalse(service.isFeatureEnabled(FEATURE_2)); assertFalse(service.isFeatureEnabled(FEATURE_3)); assertTrue(service.isFeatureEnabled(UNEXISTING_FEATURE)); }
@Test public void testLoadRegistryWithoutExistingDataExperimentalDisabled() { init(false); assertFalse(service.isFeatureEnabled(GLOBAL_FEATURE_1)); assertFalse(service.isFeatureEnabled(GLOBAL_FEATURE_2)); assertFalse(service.isFeatureEnabled(GLOBAL_FEATURE_3)); assertFalse(service.isFeatureEnabled(FEATURE_1)); assertFalse(service.isFeatureEnabled(FEATURE_2)); assertFalse(service.isFeatureEnabled(FEATURE_3)); assertTrue(service.isFeatureEnabled(UNEXISTING_FEATURE)); }