@Override protected void maybeNotifyFeatureUpdate(ExperimentalFeatureImpl feature) { event.fire(new PortableExperimentalFeatureModifiedEvent(feature)); } }
public void onFeatureModified(@Observes PortableExperimentalFeatureModifiedEvent event) { onFeatureModified(event.getFeature()); }
public void onFeatureModified(@Observes NonPortableExperimentalFeatureModifiedEvent event) { onFeatureModified(event.getFeature()); }
@Override public void updateExperimentalFeature(String featureId, boolean enabled) { if (isExperimentalEnabled()) { Optional<ExperimentalFeature> optional = session.getFeaturesRegistry().getFeature(featureId); if (optional.isPresent()) { ExperimentalFeatureImpl feature = (ExperimentalFeatureImpl) optional.get(); if (feature.isEnabled() != enabled) { feature.setEnabled(enabled); event.fire(new NonPortableExperimentalFeatureModifiedEvent(feature)); } } } }
@Override protected void maybeNotifyFeatureUpdate(ExperimentalFeatureImpl feature) { event.fire(new PortableExperimentalFeatureModifiedEvent(feature)); } }
public void onFeatureModified(@Observes NonPortableExperimentalFeatureModifiedEvent event) { onFeatureModified(event.getFeature()); }
@Override public void updateExperimentalFeature(String featureId, boolean enabled) { if (isExperimentalEnabled()) { Optional<ExperimentalFeature> optional = session.getFeaturesRegistry().getFeature(featureId); if (optional.isPresent()) { ExperimentalFeatureImpl feature = (ExperimentalFeatureImpl) optional.get(); if (feature.isEnabled() != enabled) { feature.setEnabled(enabled); event.fire(new NonPortableExperimentalFeatureModifiedEvent(feature)); } } } }
public void onFeatureModified(@Observes PortableExperimentalFeatureModifiedEvent event) { onFeatureModified(event.getFeature()); }
@Test public void testOnFeatureModifiedGlobalEvent() { testOnFeatureModified(feature -> authorizationManager.onFeatureModified(new PortableExperimentalFeatureModifiedEvent(feature))); }
private void checkNotifyFeatureUpdate(ExperimentalFeatureImpl feature) { ArgumentCaptor<NonPortableExperimentalFeatureModifiedEvent> eventCaptor = ArgumentCaptor.forClass(NonPortableExperimentalFeatureModifiedEvent.class); verify(event).fire(eventCaptor.capture()); assertEquals(feature, eventCaptor.getValue().getFeature()); }
@Test public void testOnFeatureModifiedEvent() { testOnFeatureModified(feature -> authorizationManager.onFeatureModified(new NonPortableExperimentalFeatureModifiedEvent(feature))); }
public void onGlobalFeatureModified(@Observes PortableExperimentalFeatureModifiedEvent event) { updateExperimentalFeature(event.getFeature().getFeatureId(), event.getFeature().isEnabled()); } }
@Test public void testNotifyFeatureUpdateWhenExperimentalDisabledViaEvent() { initService(false); ExperimentalFeatureImpl feature = new ExperimentalFeatureImpl(FEATURE_1, false); service.onGlobalFeatureModified(new PortableExperimentalFeatureModifiedEvent(feature)); verify(event, never()).fire(any()); }
private void checkNotifyFeatureUpdate(ExperimentalFeatureImpl feature) { ArgumentCaptor<NonPortableExperimentalFeatureModifiedEvent> eventCaptor = ArgumentCaptor.forClass(NonPortableExperimentalFeatureModifiedEvent.class); verify(event).fire(eventCaptor.capture()); assertEquals(feature, eventCaptor.getValue().getFeature()); }
@Test public void testOnFeatureModifiedEvent() { testOnFeatureModified(feature -> authorizationManager.onFeatureModified(new NonPortableExperimentalFeatureModifiedEvent(feature))); }
public void onGlobalFeatureModified(@Observes PortableExperimentalFeatureModifiedEvent event) { updateExperimentalFeature(event.getFeature().getFeatureId(), event.getFeature().isEnabled()); } }
@Test public void testOnFeatureModifiedGlobalEvent() { testOnFeatureModified(feature -> authorizationManager.onFeatureModified(new PortableExperimentalFeatureModifiedEvent(feature))); }
@Test public void testNotifyFeatureUpdateWhenExperimentalDisabledViaEvent() { initService(false); ExperimentalFeatureImpl feature = new ExperimentalFeatureImpl(FEATURE_1, false); service.onGlobalFeatureModified(new PortableExperimentalFeatureModifiedEvent(feature)); verify(event, never()).fire(any()); }
@Test public void testNotifyFeatureUpdateViaEvent() { initService(true); ExperimentalFeatureImpl feature = new ExperimentalFeatureImpl(FEATURE_1, false); service.onGlobalFeatureModified(new PortableExperimentalFeatureModifiedEvent(feature)); checkNotifyFeatureUpdate(feature); }
@Test public void testNotifyFeatureUpdateViaEvent() { initService(true); ExperimentalFeatureImpl feature = new ExperimentalFeatureImpl(FEATURE_1, false); service.onGlobalFeatureModified(new PortableExperimentalFeatureModifiedEvent(feature)); checkNotifyFeatureUpdate(feature); }