@Test public void testRemoveConfig() { assertThat(configService.getSubjectFactory(String.class), nullValue()); assertThat(configService.getSubjectFactory("key"), nullValue()); registry.registerConfigFactory(config1Factory); registry.registerConfigFactory(config2Factory); configService.applyConfig("configKey", BasicConfig1.class, new ObjectMapper().createObjectNode()); configService.applyConfig("key1", "key", "config1", new ObjectMapper().createObjectNode()); configService.applyConfig("key1", "keyxx", "config3", new ObjectMapper().createObjectNode()); configService.applyConfig("key2", "key1", "config4", new ObjectMapper().createObjectNode()); configService.removeConfig(); Set<String> subjects = configService.getSubjects(factory1.subjectClass()); assertThat(subjects.size(), is(0)); Set<String> subjects2 = configService.getSubjects(factory2.subjectClass()); assertThat(subjects2.size(), is(0)); configService.applyConfig("key1", "key", "config1", new ObjectMapper().createObjectNode()); configService.applyConfig("key1", "keyxx", "config3", new ObjectMapper().createObjectNode()); configService.applyConfig("key1", "key1", "config4", new ObjectMapper().createObjectNode()); @SuppressWarnings("unchecked") Set<String> configs = configService.getSubjects( configService.getSubjectFactory("key1").subjectClass()); configs.forEach(c -> configService.removeConfig(c)); Set<String> newConfig1 = configService.getSubjects(factory1.subjectClass()); assertThat(newConfig1, notNullValue()); }
@Override public <S, C extends Config<S>> void removeConfig(S subject, Class<C> configClass) { checkPermission(CONFIG_WRITE); checkNotNull(subject, NULL_SUBJECT_MSG); checkNotNull(configClass, NULL_CCLASS_MSG); store.clearConfig(subject, configClass); }
NetworkConfigManager extends AbstractListenerManager<NetworkConfigEvent, NetworkConfigListener> implements NetworkConfigRegistry, NetworkConfigService { @Override public <S, C extends Config<S>> void removeConfig(S subject, Class<C> configClass) { checkPermission(CONFIG_WRITE); checkNotNull(subject, NULL_SUBJECT_MSG); checkNotNull(configClass, NULL_CCLASS_MSG); store.clearConfig(subject, configClass); } }
NetworkConfigManager extends AbstractListenerManager<NetworkConfigEvent, NetworkConfigListener> implements NetworkConfigRegistry, NetworkConfigService { @Override public <S, C extends Config<S>> void removeConfig(S subject, Class<C> configClass) { checkPermission(CONFIG_WRITE); checkNotNull(subject, NULL_SUBJECT_MSG); checkNotNull(configClass, NULL_CCLASS_MSG); store.clearConfig(subject, configClass); }  }
NetworkConfigManager extends AbstractListenerManager<NetworkConfigEvent, NetworkConfigListener> implements NetworkConfigRegistry, NetworkConfigService { @Override public <S, C extends Config<S>> void removeConfig(S subject, Class<C> configClass) { checkPermission(CONFIG_WRITE); checkNotNull(subject, NULL_SUBJECT_MSG); checkNotNull(configClass, NULL_CCLASS_MSG); store.clearConfig(subject, configClass); }  @Activate void activate(); @Deactivate void deactivate(); @Override @SuppressWarnings("unchecked") void registerConfigFactory(ConfigFactory configFactory); @Override void unregisterConfigFactory(ConfigFactory configFactory); @Override Set<ConfigFactory> getConfigFactories(); @Override @SuppressWarnings("unchecked") Set<ConfigFactory<S, C>> getConfigFactories(Class<S> subjectClass); @Override ConfigFactory<S, C> getConfigFactory(Class<C> configClass); @Override Set<Class> getSubjectClasses(); @Override SubjectFactory getSubjectFactory(String subjectClassKey); @Override SubjectFactory getSubjectFactory(Class subjectClass); @Override Class<? extends Config> getConfigClass(String subjectClassKey, String configKey); @Override Set<S> getSubjects(Class<S> subjectClass); @Override Set<S> getSubjects(Class<S> subjectClass, Class<C> configClass); @Override Set<Config<S>> getConfigs(S subject); @Override C getConfig(S subject, Class<C> configClass); @Override C addConfig(S subject, Class<C> configClass); @Override C applyConfig(S subject, Class<C> configClass, JsonNode json); @Override @SuppressWarnings("unchecked") C applyConfig(String subjectClassKey, S subject,
                                                  String configKey, JsonNode json); @Override void removeConfig(S subject, Class<C> configClass); @Override void removeConfig(String subjectClassKey, S subject, String configKey); @Override void removeConfig(S subject); @Override void removeConfig(); }
NetworkConfigManager extends AbstractListenerManager<NetworkConfigEvent, NetworkConfigListener> implements NetworkConfigRegistry, NetworkConfigService { @Override public <S, C extends Config<S>> void removeConfig(S subject, Class<C> configClass) { checkPermission(CONFIG_WRITE); checkNotNull(subject, NULL_SUBJECT_MSG); checkNotNull(configClass, NULL_CCLASS_MSG); store.clearConfig(subject, configClass); }  @Activate void activate(); @Deactivate void deactivate(); @Override @SuppressWarnings("unchecked") void registerConfigFactory(ConfigFactory configFactory); @Override void unregisterConfigFactory(ConfigFactory configFactory); @Override Set<ConfigFactory> getConfigFactories(); @Override @SuppressWarnings("unchecked") Set<ConfigFactory<S, C>> getConfigFactories(Class<S> subjectClass); @Override ConfigFactory<S, C> getConfigFactory(Class<C> configClass); @Override Set<Class> getSubjectClasses(); @Override SubjectFactory getSubjectFactory(String subjectClassKey); @Override SubjectFactory getSubjectFactory(Class subjectClass); @Override Class<? extends Config> getConfigClass(String subjectClassKey, String configKey); @Override Set<S> getSubjects(Class<S> subjectClass); @Override Set<S> getSubjects(Class<S> subjectClass, Class<C> configClass); @Override Set<Config<S>> getConfigs(S subject); @Override C getConfig(S subject, Class<C> configClass); @Override C addConfig(S subject, Class<C> configClass); @Override C applyConfig(S subject, Class<C> configClass, JsonNode json); @Override @SuppressWarnings("unchecked") C applyConfig(String subjectClassKey, S subject,
                                                  String configKey, JsonNode json); @Override void removeConfig(S subject, Class<C> configClass); @Override void removeConfig(String subjectClassKey, S subject, String configKey); @Override void removeConfig(S subject); @Override void removeConfig();  }