I'm not 100% in love with this change, and would like input from others (e.g. Mark). the TCK expects a failure to occur, which makes sense. i'm not sure if the default "defaultValue" was changed over time, so I'm not sure if we need the empty string check or not.
John On Mon, Jul 3, 2017 at 5:51 PM <[email protected]> wrote: > Author: johndament > Date: Mon Jul 3 21:51:01 2017 > New Revision: 1800715 > > URL: http://svn.apache.org/viewvc?rev=1800715&view=rev > Log: > GERONIMO-6566 TCK Check - if a property is configured with the default > defaultValue then it should not be considered as having a default value. > > TCK Assertions: WrongConverterOnInstanceInjectionTest, > MissingValueOnInstanceInjectionTest > > Modified: > > geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/cdi/ConfigExtension.java > > Modified: > geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/cdi/ConfigExtension.java > URL: > http://svn.apache.org/viewvc/geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/cdi/ConfigExtension.java?rev=1800715&r1=1800714&r2=1800715&view=diff > > ============================================================================== > --- > geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/cdi/ConfigExtension.java > (original) > +++ > geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/cdi/ConfigExtension.java > Mon Jul 3 21:51:01 2017 > @@ -44,7 +44,7 @@ import org.eclipse.microprofile.config.i > * @author <a href="mailto:[email protected]">Mark Struberg</a> > */ > public class ConfigExtension implements Extension { > - > + private static final String DEFAULT_UNCONFIGURED_VALUE = > "org.eclipse.microprofile.config.configproperty.unconfigureddvalue"; > private Config config; > > private Set<InjectionPoint> injectionPoints = new HashSet<>(); > @@ -81,7 +81,8 @@ public class ConfigExtension implements > // a direct injection of a ConfigProperty > // that means a Converter must exist. > String key = > ConfigInjectionBean.getConfigKey(injectionPoint, configProperty); > - if ((configProperty.defaultValue() == null || > configProperty.defaultValue().length() == 0) > + if ((configProperty.defaultValue() == null || > configProperty.defaultValue().length() == 0 > + || > configProperty.defaultValue().equals(DEFAULT_UNCONFIGURED_VALUE)) > && !config.getOptionalValue(key, (Class) > type).isPresent()) { > deploymentProblems.add("No Config Value exists for " > + key); > } > > >
