[ 
https://issues.apache.org/jira/browse/KAFKA-3237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15153769#comment-15153769
 ] 

ASF GitHub Bot commented on KAFKA-3237:
---------------------------------------

GitHub user jcustenborder opened a pull request:

    https://github.com/apache/kafka/pull/936

    KAFKA-3237 - Remove test cases testInvalidDefaultRange() and testInva…

    Remove test cases testInvalidDefaultRange() and testInvalidDefaultString(). 
Defaults if not overridden will get checked on parse. Testing the defaults is 
unnecessary. This allows you to set that a parameter is required while setting 
a validator for that parameter. Added a test case testNullDefaultWithValidator 
that allows a null default with a validator for certain strings.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jcustenborder/kafka KAFKA-3237

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/kafka/pull/936.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #936
    
----
commit 249e4d781235311742d270033a13b92bea582745
Author: Jeremy Custenborder <jcustenbor...@gmail.com>
Date:   2016-02-19T06:04:46Z

    KAFKA-3237 - Remove test cases testInvalidDefaultRange() and 
testInvalidDefaultString(). Defaults if not overridden will get checked on 
parse. Testing the defaults is unnecessary. This allows you to set that a 
parameter is required while setting a validator for that parameter. Added a 
test case testNullDefaultWithValidator that allows a null default with a 
validator for certain strings.

----


> ConfigDef validators require a default value
> --------------------------------------------
>
>                 Key: KAFKA-3237
>                 URL: https://issues.apache.org/jira/browse/KAFKA-3237
>             Project: Kafka
>          Issue Type: Bug
>          Components: config
>    Affects Versions: 0.9.0.0
>            Reporter: Jeremy Custenborder
>            Priority: Minor
>
> I should be able to add a ConfigDef that has a validator but does has null as 
> the default value. This would allow me to have a required property that is 
> restricted to certain strings in this example. This exception should be 
> thrown upon call to ConfigDef.parse instead. 
> {code}
> ConfigDef def = new ConfigDef();
> def.define(key, Type.STRING, null, ValidString.in("ONE", "TWO", "THREE"), 
> Importance.HIGH, "docs");
> {code}
> {code}
> Invalid value null for configuration test: String must be one of: ONE, TWO, 
> THREE
> org.apache.kafka.common.config.ConfigException: Invalid value null for 
> configuration enum_test: String must be one of: ONE, TWO, THREE
>       at 
> org.apache.kafka.common.config.ConfigDef$ValidString.ensureValid(ConfigDef.java:349)
>       at 
> org.apache.kafka.common.config.ConfigDef$ConfigKey.<init>(ConfigDef.java:375)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to