GlobalConfigResourceImpl implements GlobalConfigResource { @Timed @Override public ConfigProperty update(final String propertyName, final ConfigProperty configProperty) { RestUtil.requireNonNull(propertyName, "propertyName not supplied"); RestUtil.requireNonNull(configProperty, "configProperty not supplied"); if (!propertyName.equals(configProperty.getNameAsString())) { throw new BadRequestException(LogUtil.message("Property names don't match, {} & {}", propertyName, configProperty.getNameAsString())); } try { return globalConfigService.update(configProperty); } catch (ConfigPropertyValidationException e) { throw new BadRequestException(e.getMessage(), e); } } @Inject  GlobalConfigResourceImpl(final GlobalConfigService globalConfigService,
                             final NodeService nodeService,
                             final UiConfig uiConfig,
                             final NodeInfo nodeInfo,
                             final WebTargetFactory webTargetFactory,
                             final UriFactory uriFactory); @Timed @Override ListConfigResponse list(final GlobalConfigCriteria criteria); @Timed @Override ListConfigResponse listByNode(final String nodeName,
                                         final GlobalConfigCriteria criteria); @Timed @Override ConfigProperty getPropertyByName(final String propertyPath); @Timed OverrideValue<String> getYamlValueByName(final String propertyPath); @Timed @Override OverrideValue<String> getYamlValueByNodeAndName(final String propertyName,
                                                           final String nodeName); @Timed @Override ConfigProperty create(final ConfigProperty configProperty); @Timed @Override ConfigProperty update(final String propertyName, final ConfigProperty configProperty); @Timed @Override UiConfig fetchUiConfig();  }
@Test void update() { initNodes(); ConfigProperty existingConfigProperty = new ConfigProperty(PropertyPath.fromPathString("a.new.config.prop")); existingConfigProperty.setId(1); existingConfigProperty.setVersion(1); ConfigProperty expectedConfigProperty = new ConfigProperty(PropertyPath.fromPathString("a.new.config.prop")); expectedConfigProperty.setId(1); expectedConfigProperty.setVersion(2); final String subPath = ResourcePaths.buildPath( GlobalConfigResource.CLUSTER_PROPERTIES_SUB_PATH, existingConfigProperty.getNameAsString(), GlobalConfigResource.DB_OVERRIDE_VALUE_SUB_PATH); final ConfigProperty createdConfigProperty = doPutTest( subPath, existingConfigProperty, ConfigProperty.class, expectedConfigProperty); }