{"action":"created","comment":{"url":"https://api.github.com/repos/apache/storm/pulls/comments/41886199","id":41886199,"diff_hunk":"@@ -0,0 +1,137 @@\n+package backtype.storm;\n+\n+import backtype.storm.utils.Utils;\n+import org.junit.Test;\n+import org.junit.Assert;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+import backtype.storm.validation.ConfigValidationAnnotations;\n+import backtype.storm.validation.ConfigValidation;\n+\n+import java.lang.annotation.Annotation;\n+import java.lang.reflect.Field;\n+import java.lang.reflect.InvocationTargetException;\n+import java.util.Arrays;\n+import java.util.Collection;\n+import java.util.HashMap;\n+import java.util.LinkedList;\n+import java.util.Map;\n+\n+/**\n+ * Created by jerrypeng on 10/1/15.\n+ */","path":"storm-core/test/jvm/backtype/storm/TestConfigValidate.java","position":22,"original_position":22,"commit_id":"41a81b5a406c1128c15b5c5e9fae9e680e9a250b","original_commit_id":"41a81b5a406c1128c15b5c5e9fae9e680e9a250b","user":{"login":"d2r","id":905298,"avatar_url":"https://avatars.githubusercontent.com/u/905298?v=3","gravatar_id":"","url":"https://api.github.com/users/d2r","html_url":"https://github.com/d2r","followers_url":"https://api.github.com/users/d2r/followers","following_url":"https://api.github.com/users/d2r/following{/other_user}","gists_url":"https://api.github.com/users/d2r/gists{/gist_id}","starred_url":"https://api.github.com/users/d2r/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/d2r/subscriptions","organizations_url":"https://api.github.com/users/d2r/orgs","repos_url":"https://api.github.com/users/d2r/repos","events_url":"https://api.github.com/users/d2r/events{/privacy}","received_events_url":"https://api.github.com/users/d2r/received_events","type":"User","site_admin":false},"body":"remove?","created_at":"2015-10-13T15:57:34Z","updated_at":"2015-10-13T15:57:34Z","html_url":"https://github.com/apache/storm/pull/785#discussion_r41886199","pull_request_url":"https://api.github.com/repos/apache/storm/pulls/785","_links":{"self":{"href":"https://api.github.com/repos/apache/storm/pulls/comments/41886199"},"html":{"href":"https://github.com/apache/storm/pull/785#discussion_r41886199"},"pull_request":{"href":"https://api.github.com/repos/apache/storm/pulls/785"}}},"pull_request":{"url":"https://api.github.com/repos/apache/storm/pulls/785","id":46969645,"html_url":"https://github.com/apache/storm/pull/785","diff_url":"https://github.com/apache/storm/pull/785.diff","patch_url":"https://github.com/apache/storm/pull/785.patch","issue_url":"https://api.github.com/repos/apache/storm/issues/785","number":785,"state":"open","locked":false,"title":"[STORM-1084] - Improve Storm config validation process to use java annotations instead of *_SCHEMA format","user":{"login":"jerrypeng","id":3613359,"avatar_url":"https://avatars.githubusercontent.com/u/3613359?v=3","gravatar_id":"","url":"https://api.github.com/users/jerrypeng","html_url":"https://github.com/jerrypeng","followers_url":"https://api.github.com/users/jerrypeng/followers","following_url":"https://api.github.com/users/jerrypeng/following{/other_user}","gists_url":"https://api.github.com/users/jerrypeng/gists{/gist_id}","starred_url":"https://api.github.com/users/jerrypeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jerrypeng/subscriptions","organizations_url":"https://api.github.com/users/jerrypeng/orgs","repos_url":"https://api.github.com/users/jerrypeng/repos","events_url":"https://api.github.com/users/jerrypeng/events{/privacy}","received_events_url":"https://api.github.com/users/jerrypeng/received_events","type":"User","site_admin":false},"body":"So currently we specify validators:\r\n\r\npublic static final String STORM_MESSAGING_NETTY_MIN_SLEEP_MS = \"storm.messaging.netty.min_wait_ms\";\r\n\r\npublic static final Object STORM_MESSAGING_NETTY_MIN_SLEEP_MS_SCHEMA = ConfigValidation.IntegerValidator;\r\n\r\nA better way to do this is using annotations. Something like:\r\n\r\n@IntegerValidator\r\npublic static final String STORM_MESSAGING_NETTY_MIN_SLEEP_MS = \"storm.messaging.netty.min_wait_ms\";\r\n\r\nDo this has many advantages. For one you can stack multiple annotations:\r\n\r\n@IntegerValidator\r\n@NotNull\r\npublic static final String STORM_MESSAGING_NETTY_MIN_SLEEP_MS = \"storm.messaging.netty.min_wait_ms\";\r\n\r\nAnd we don't have to write another validator for strings that cannot be null\r\nAnd we can pass parameters into the annotations:\r\n\r\n@PositiveIntegerValidator(notNull=true)\r\npublic static final String DRPC_REQUEST_TIMEOUT_SECS = \"drpc.request.timeout.secs\";\r\n\r\ninstead of having to write another validator: ConfigValidation.NotNullPosIntegerValidator for checking for not null","created_at":"2015-10-06T23:06:57Z","updated_at":"2015-10-13T15:57:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"60c12c74f710689653dc30e8b9720c37ef9f50ce","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/storm/pulls/785/commits","review_comments_url":"https://api.github.com/repos/apache/storm/pulls/785/comments","review_comment_url":"https://api.github.com/repos/apache/storm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/storm/issues/785/comments","statuses_url":"https://api.github.com/repos/apache/storm/statuses/41a81b5a406c1128c15b5c5e9fae9e680e9a250b","head":{"label":"jerrypeng:STORM-1084","ref":"STORM-1084","sha":"41a81b5a406c1128c15b5c5e9fae9e680e9a250b","user":{"login":"jerrypeng","id":3613359,"avatar_url":"https://avatars.githubusercontent.com/u/3613359?v=3","gravatar_id":"","url":"https://api.github.com/users/jerrypeng","html_url":"https://github.com/jerrypeng","followers_url":"https://api.github.com/users/jerrypeng/followers","following_url":"https://api.github.com/users/jerrypeng/following{/other_user}","gists_url":"https://api.github.com/users/jerrypeng/gists{/gist_id}","starred_url":"https://api.github.com/users/jerrypeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jerrypeng/subscriptions","organizations_url":"https://api.github.com/users/jerrypeng/orgs","repos_url":"https://api.github.com/users/jerrypeng/repos","events_url":"https://api.github.com/users/jerrypeng/events{/privacy}","received_events_url":"https://api.github.com/users/jerrypeng/received_events","type":"User","site_admin":false},"repo":{"id":37741458,"name":"storm","full_name":"jerrypeng/storm","owner":{"login":"jerrypeng","id":3613359,"avatar_url":"https://avatars.githubusercontent.com/u/3613359?v=3","gravatar_id":"","url":"https://api.github.com/users/jerrypeng","html_url":"https://github.com/jerrypeng","followers_url":"https://api.github.com/users/jerrypeng/followers","following_url":"https://api.github.com/users/jerrypeng/following{/other_user}","gists_url":"https://api.github.com/users/jerrypeng/gists{/gist_id}","starred_url":"https://api.github.com/users/jerrypeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jerrypeng/subscriptions","organizations_url":"https://api.github.com/users/jerrypeng/orgs","repos_url":"https://api.github.com/users/jerrypeng/repos","events_url":"https://api.github.com/users/jerrypeng/events{/privacy}","received_events_url":"https://api.github.com/users/jerrypeng/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jerrypeng/storm","description":"Mirror of Apache Storm","fork":true,"url":"https://api.github.com/repos/jerrypeng/storm","forks_url":"https://api.github.com/repos/jerrypeng/storm/forks","keys_url":"https://api.github.com/repos/jerrypeng/storm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jerrypeng/storm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jerrypeng/storm/teams","hooks_url":"https://api.github.com/repos/jerrypeng/storm/hooks","issue_events_url":"https://api.github.com/repos/jerrypeng/storm/issues/events{/number}","events_url":"https://api.github.com/repos/jerrypeng/storm/events","assignees_url":"https://api.github.com/repos/jerrypeng/storm/assignees{/user}","branches_url":"https://api.github.com/repos/jerrypeng/storm/branches{/branch}","tags_url":"https://api.github.com/repos/jerrypeng/storm/tags","blobs_url":"https://api.github.com/repos/jerrypeng/storm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jerrypeng/storm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jerrypeng/storm/git/refs{/sha}","trees_url":"https://api.github.com/repos/jerrypeng/storm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jerrypeng/storm/statuses/{sha}","languages_url":"https://api.github.com/repos/jerrypeng/storm/languages","stargazers_url":"https://api.github.com/repos/jerrypeng/storm/stargazers","contributors_url":"https://api.github.com/repos/jerrypeng/storm/contributors","subscribers_url":"https://api.github.com/repos/jerrypeng/storm/subscribers","subscription_url":"https://api.github.com/repos/jerrypeng/storm/subscription","commits_url":"https://api.github.com/repos/jerrypeng/storm/commits{/sha}","git_commits_url":"https://api.github.com/repos/jerrypeng/storm/git/commits{/sha}","comments_url":"https://api.github.com/repos/jerrypeng/storm/comments{/number}","issue_comment_url":"https://api.github.com/repos/jerrypeng/storm/issues/comments{/number}","contents_url":"https://api.github.com/repos/jerrypeng/storm/contents/{+path}","compare_url":"https://api.github.com/repos/jerrypeng/storm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jerrypeng/storm/merges","archive_url":"https://api.github.com/repos/jerrypeng/storm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jerrypeng/storm/downloads","issues_url":"https://api.github.com/repos/jerrypeng/storm/issues{/number}","pulls_url":"https://api.github.com/repos/jerrypeng/storm/pulls{/number}","milestones_url":"https://api.github.com/repos/jerrypeng/storm/milestones{/number}","notifications_url":"https://api.github.com/repos/jerrypeng/storm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jerrypeng/storm/labels{/name}","releases_url":"https://api.github.com/repos/jerrypeng/storm/releases{/id}","created_at":"2015-06-19T19:23:06Z","updated_at":"2015-10-10T17:25:37Z","pushed_at":"2015-10-09T13:44:36Z","git_url":"git://github.com/jerrypeng/storm.git","ssh_url":"git@github.com:jerrypeng/storm.git","clone_url":"https://github.com/jerrypeng/storm.git","svn_url":"https://github.com/jerrypeng/storm","homepage":null,"size":20253,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"1822491bc2889765454e456f56125fd7912c1043","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":14135470,"name":"storm","full_name":"apache/storm","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/storm","description":"Mirror of Apache Storm","fork":false,"url":"https://api.github.com/repos/apache/storm","forks_url":"https://api.github.com/repos/apache/storm/forks","keys_url":"https://api.github.com/repos/apache/storm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/storm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/storm/teams","hooks_url":"https://api.github.com/repos/apache/storm/hooks","issue_events_url":"https://api.github.com/repos/apache/storm/issues/events{/number}","events_url":"https://api.github.com/repos/apache/storm/events","assignees_url":"https://api.github.com/repos/apache/storm/assignees{/user}","branches_url":"https://api.github.com/repos/apache/storm/branches{/branch}","tags_url":"https://api.github.com/repos/apache/storm/tags","blobs_url":"https://api.github.com/repos/apache/storm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/storm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/storm/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/storm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/storm/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/storm/languages","stargazers_url":"https://api.github.com/repos/apache/storm/stargazers","contributors_url":"https://api.github.com/repos/apache/storm/contributors","subscribers_url":"https://api.github.com/repos/apache/storm/subscribers","subscription_url":"https://api.github.com/repos/apache/storm/subscription","commits_url":"https://api.github.com/repos/apache/storm/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/storm/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/storm/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/storm/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/storm/contents/{+path}","compare_url":"https://api.github.com/repos/apache/storm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/storm/merges","archive_url":"https://api.github.com/repos/apache/storm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/storm/downloads","issues_url":"https://api.github.com/repos/apache/storm/issues{/number}","pulls_url":"https://api.github.com/repos/apache/storm/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/storm/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/storm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/storm/labels{/name}","releases_url":"https://api.github.com/repos/apache/storm/releases{/id}","created_at":"2013-11-05T08:00:14Z","updated_at":"2015-10-13T11:59:53Z","pushed_at":"2015-10-12T22:49:04Z","git_url":"git://github.com/apache/storm.git","ssh_url":"git@github.com:apache/storm.git","clone_url":"https://github.com/apache/storm.git","svn_url":"https://github.com/apache/storm","homepage":null,"size":822296,"stargazers_count":2433,"watchers_count":2433,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1771,"mirror_url":"git://git.apache.org/incubator-storm.git","open_issues_count":81,"forks":1771,"open_issues":81,"watchers":2433,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/storm/pulls/785"},"html":{"href":"https://github.com/apache/storm/pull/785"},"issue":{"href":"https://api.github.com/repos/apache/storm/issues/785"},"comments":{"href":"https://api.github.com/repos/apache/storm/issues/785/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/storm/pulls/785/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/storm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/storm/pulls/785/commits"},"statuses":{"href":"https://api.github.com/repos/apache/storm/statuses/41a81b5a406c1128c15b5c5e9fae9e680e9a250b"}}}}