GitHub PullRequestReviewCommentEvent at 2014-08-18 20:30:29
Repository: spring-xd
Actor: pperalta
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/spring-projects/spring-xd/pulls/comments/16379704","id":16379704,"diff_hunk":"@@ -0,0 +1,147 @@\n+/*\n+ *\n+ *  * Copyright 2014 the original author or authors.\n+ *  *\n+ *  * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ *  * you may not use this file except in compliance with the License.\n+ *  * You may obtain a copy of the License at\n+ *  *\n+ *  * http://www.apache.org/licenses/LICENSE-2.0\n+ *  *\n+ *  * Unless required by applicable law or agreed to in writing, software\n+ *  * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ *  * See the License for the specific language governing permissions and\n+ *  * limitations under the License.\n+ *\n+ */\n+\n+package org.springframework.xd.dirt.test;\n+\n+import java.util.Arrays;\n+import java.util.List;\n+\n+import org.springframework.xd.dirt.core.BaseDefinition;\n+import org.springframework.xd.dirt.core.DeploymentStatusRepository;\n+import org.springframework.xd.dirt.core.DeploymentUnitStatus;\n+import org.springframework.xd.dirt.core.DeploymentUnitStatus.State;\n+import org.springframework.xd.store.DomainRepository;\n+\n+/**\n+ * Verifies the state of resources (job or stream) by polling repository state until the resource is in the expected state or the operation times out. For use with SingleNodeApplication testing.\n+ * @see org.springframework.xd.dirt.test.SingleNodeIntegrationTestSupport\n+ * @author David Turanski\n+ * @since 1.0\n+ */\n+public class ResourceStateVerifier {\n+\n+\tprivate static final long STATE_CHANGE_WAIT_TIME = 50;\n+\n+\tprivate static final long STATE_CHANGE_TIMEOUT = 10000;\n+\n+\tprivate final DeploymentStatusRepository<?, String> deploymentStatusRepository;\n+\n+\tprivate final DomainRepository<? extends BaseDefinition, String> domainRepository;\n+\n+\t/**\n+\t *\n+\t * @param deploymentStatusRepository the repository that tracks deployment status\n+\t * @param domainRepository the resource definition repository\n+\t */\n+\tpublic ResourceStateVerifier(DeploymentStatusRepository<?, String> deploymentStatusRepository, DomainRepository<? extends BaseDefinition, String> domainRepository) {\n+\t\tthis.deploymentStatusRepository = deploymentStatusRepository;\n+\t\tthis.domainRepository = domainRepository;\n+\t}\n+\n+\t/**\n+\t * Wait for a named resource to be completely deployed.\n+\t * @param resourceName the name of the resource being deployed\n+\t * @return the deployment status, either State.deployed or the current State when this operation timed out.\n+\t */\n+\tpublic State waitForDeploy(String resourceName) {\n+\t\treturn waitForDeploy(resourceName, false);\n+\t}\n+\n+\t/**\n+\t * Wait for a named resource to be deployed.\n+\t * @param resourceName the name of the resource being deployed\n+\t * @param allowIncomplete if true, will return on State.incomplete or State.deployed\n+\t * @return one of the expected States or the current State when this operation timed out.\n+\t */\n+\tpublic State waitForDeploy(String resourceName, boolean allowIncomplete) {\n+\t\tif (allowIncomplete) {\n+\t\t\treturn waitForDeployState(resourceName, State.deployed, State.incomplete);\n+\t\t}\n+\t\treturn waitForDeployState(resourceName, State.deployed);\n+\t}\n+\n+\t/**\n+\t * Wait for a named resource to be undeployed.\n+\t * @param resourceName the name of the resource being undeployed\n+\t * @return either State.undeployed or the current state when the operation timed out.\n+\t */\n+\tpublic State waitForUndeploy(String resourceName) {\n+\t\treturn waitForDeployState(resourceName, State.undeployed);\n+\t}\n+\n+\t/**\n+\t * Wait for a resource definition to be created.\n+\t * @param resourceName the name of the resource being created.\n+\t * @return true if the resource exists; false otherwise.\n+\t */\n+\tpublic boolean waitForCreate(String resourceName) {\n+\t\tlong waitTime = 0;\n+\t\tboolean exists;\n+\t\twhile (!(exists = domainRepository.exists(resourceName)) && waitTime < STATE_CHANGE_TIMEOUT) {\n+\t\t\ttry {\n+\t\t\t\tThread.sleep(STATE_CHANGE_WAIT_TIME);\n+\t\t\t\twaitTime += STATE_CHANGE_WAIT_TIME;\n+\t\t\t}\n+\t\t\tcatch (InterruptedException e) {\n+\t\t\t\tThread.interrupted();","path":"spring-xd-dirt/src/main/java/org/springframework/xd/dirt/test/ResourceStateVerifier.java","position":101,"original_position":101,"commit_id":"6b66613fb6d8e85c5b2ccad02ec6593829790a9d","original_commit_id":"6b66613fb6d8e85c5b2ccad02ec6593829790a9d","user":{"login":"pperalta","id":394956,"avatar_url":"https://avatars.githubusercontent.com/u/394956?v=2","gravatar_id":"9f837642125ea6c406250d9316db7e08","url":"https://api.github.com/users/pperalta","html_url":"https://github.com/pperalta","followers_url":"https://api.github.com/users/pperalta/followers","following_url":"https://api.github.com/users/pperalta/following{/other_user}","gists_url":"https://api.github.com/users/pperalta/gists{/gist_id}","starred_url":"https://api.github.com/users/pperalta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pperalta/subscriptions","organizations_url":"https://api.github.com/users/pperalta/orgs","repos_url":"https://api.github.com/users/pperalta/repos","events_url":"https://api.github.com/users/pperalta/events{/privacy}","received_events_url":"https://api.github.com/users/pperalta/received_events","type":"User","site_admin":false},"body":"Did you mean to reset the interrupt flag via `Thread.currentThread().interrupt()` instead? This is optional, but I think it is reasonable for a method named `wait...` to throw `InterruptedException` to allow the caller to decide what to do if the wait is interrupted.","created_at":"2014-08-18T20:30:29Z","updated_at":"2014-08-18T20:30:29Z","html_url":"https://github.com/spring-projects/spring-xd/pull/1156#discussion_r16379704","pull_request_url":"https://api.github.com/repos/spring-projects/spring-xd/pulls/1156","_links":{"self":{"href":"https://api.github.com/repos/spring-projects/spring-xd/pulls/comments/16379704"},"html":{"href":"https://github.com/spring-projects/spring-xd/pull/1156#discussion_r16379704"},"pull_request":{"href":"https://api.github.com/repos/spring-projects/spring-xd/pulls/1156"}}},"pull_request":{"url":"https://api.github.com/repos/spring-projects/spring-xd/pulls/1156","id":19925610,"html_url":"https://github.com/spring-projects/spring-xd/pull/1156","diff_url":"https://github.com/spring-projects/spring-xd/pull/1156.diff","patch_url":"https://github.com/spring-projects/spring-xd/pull/1156.patch","issue_url":"https://api.github.com/repos/spring-projects/spring-xd/issues/1156","number":1156,"state":"open","locked":false,"title":"XD-2058 - Renamed DeploymentVerifier to ResourceStateVerifier. Added met...","user":{"login":"dturanski","id":886859,"avatar_url":"https://avatars.githubusercontent.com/u/886859?v=2","gravatar_id":"84c8faecf1c26022da6feb55ef8f6af7","url":"https://api.github.com/users/dturanski","html_url":"https://github.com/dturanski","followers_url":"https://api.github.com/users/dturanski/followers","following_url":"https://api.github.com/users/dturanski/following{/other_user}","gists_url":"https://api.github.com/users/dturanski/gists{/gist_id}","starred_url":"https://api.github.com/users/dturanski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dturanski/subscriptions","organizations_url":"https://api.github.com/users/dturanski/orgs","repos_url":"https://api.github.com/users/dturanski/repos","events_url":"https://api.github.com/users/dturanski/events{/privacy}","received_events_url":"https://api.github.com/users/dturanski/received_events","type":"User","site_admin":false},"body":"...hods to SingleNodeIntegrationTestSupport to allow blocking until incomplete status. Also removed *PathProvider classes and used Repositories directly.","created_at":"2014-08-18T15:39:01Z","updated_at":"2014-08-18T20:30:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0a3c050a613a45fdd181d6df49426f61e553cc4c","assignee":{"login":"pperalta","id":394956,"avatar_url":"https://avatars.githubusercontent.com/u/394956?v=2","gravatar_id":"9f837642125ea6c406250d9316db7e08","url":"https://api.github.com/users/pperalta","html_url":"https://github.com/pperalta","followers_url":"https://api.github.com/users/pperalta/followers","following_url":"https://api.github.com/users/pperalta/following{/other_user}","gists_url":"https://api.github.com/users/pperalta/gists{/gist_id}","starred_url":"https://api.github.com/users/pperalta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pperalta/subscriptions","organizations_url":"https://api.github.com/users/pperalta/orgs","repos_url":"https://api.github.com/users/pperalta/repos","events_url":"https://api.github.com/users/pperalta/events{/privacy}","received_events_url":"https://api.github.com/users/pperalta/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/spring-projects/spring-xd/pulls/1156/commits","review_comments_url":"https://api.github.com/repos/spring-projects/spring-xd/pulls/1156/comments","review_comment_url":"https://api.github.com/repos/spring-projects/spring-xd/pulls/comments/{number}","comments_url":"https://api.github.com/repos/spring-projects/spring-xd/issues/1156/comments","statuses_url":"https://api.github.com/repos/spring-projects/spring-xd/statuses/6b66613fb6d8e85c5b2ccad02ec6593829790a9d","head":{"label":"dturanski:resource-state-verifier","ref":"resource-state-verifier","sha":"6b66613fb6d8e85c5b2ccad02ec6593829790a9d","user":{"login":"dturanski","id":886859,"avatar_url":"https://avatars.githubusercontent.com/u/886859?v=2","gravatar_id":"84c8faecf1c26022da6feb55ef8f6af7","url":"https://api.github.com/users/dturanski","html_url":"https://github.com/dturanski","followers_url":"https://api.github.com/users/dturanski/followers","following_url":"https://api.github.com/users/dturanski/following{/other_user}","gists_url":"https://api.github.com/users/dturanski/gists{/gist_id}","starred_url":"https://api.github.com/users/dturanski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dturanski/subscriptions","organizations_url":"https://api.github.com/users/dturanski/orgs","repos_url":"https://api.github.com/users/dturanski/repos","events_url":"https://api.github.com/users/dturanski/events{/privacy}","received_events_url":"https://api.github.com/users/dturanski/received_events","type":"User","site_admin":false},"repo":{"id":11422310,"name":"spring-xd","full_name":"dturanski/spring-xd","owner":{"login":"dturanski","id":886859,"avatar_url":"https://avatars.githubusercontent.com/u/886859?v=2","gravatar_id":"84c8faecf1c26022da6feb55ef8f6af7","url":"https://api.github.com/users/dturanski","html_url":"https://github.com/dturanski","followers_url":"https://api.github.com/users/dturanski/followers","following_url":"https://api.github.com/users/dturanski/following{/other_user}","gists_url":"https://api.github.com/users/dturanski/gists{/gist_id}","starred_url":"https://api.github.com/users/dturanski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dturanski/subscriptions","organizations_url":"https://api.github.com/users/dturanski/orgs","repos_url":"https://api.github.com/users/dturanski/repos","events_url":"https://api.github.com/users/dturanski/events{/privacy}","received_events_url":"https://api.github.com/users/dturanski/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dturanski/spring-xd","description":"Spring XD makes it easy to solve common big data problems such as data ingestion and export, real-time analytics, and batch workflow orchestration","fork":true,"url":"https://api.github.com/repos/dturanski/spring-xd","forks_url":"https://api.github.com/repos/dturanski/spring-xd/forks","keys_url":"https://api.github.com/repos/dturanski/spring-xd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dturanski/spring-xd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dturanski/spring-xd/teams","hooks_url":"https://api.github.com/repos/dturanski/spring-xd/hooks","issue_events_url":"https://api.github.com/repos/dturanski/spring-xd/issues/events{/number}","events_url":"https://api.github.com/repos/dturanski/spring-xd/events","assignees_url":"https://api.github.com/repos/dturanski/spring-xd/assignees{/user}","branches_url":"https://api.github.com/repos/dturanski/spring-xd/branches{/branch}","tags_url":"https://api.github.com/repos/dturanski/spring-xd/tags","blobs_url":"https://api.github.com/repos/dturanski/spring-xd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dturanski/spring-xd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dturanski/spring-xd/git/refs{/sha}","trees_url":"https://api.github.com/repos/dturanski/spring-xd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dturanski/spring-xd/statuses/{sha}","languages_url":"https://api.github.com/repos/dturanski/spring-xd/languages","stargazers_url":"https://api.github.com/repos/dturanski/spring-xd/stargazers","contributors_url":"https://api.github.com/repos/dturanski/spring-xd/contributors","subscribers_url":"https://api.github.com/repos/dturanski/spring-xd/subscribers","subscription_url":"https://api.github.com/repos/dturanski/spring-xd/subscription","commits_url":"https://api.github.com/repos/dturanski/spring-xd/commits{/sha}","git_commits_url":"https://api.github.com/repos/dturanski/spring-xd/git/commits{/sha}","comments_url":"https://api.github.com/repos/dturanski/spring-xd/comments{/number}","issue_comment_url":"https://api.github.com/repos/dturanski/spring-xd/issues/comments/{number}","contents_url":"https://api.github.com/repos/dturanski/spring-xd/contents/{+path}","compare_url":"https://api.github.com/repos/dturanski/spring-xd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dturanski/spring-xd/merges","archive_url":"https://api.github.com/repos/dturanski/spring-xd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dturanski/spring-xd/downloads","issues_url":"https://api.github.com/repos/dturanski/spring-xd/issues{/number}","pulls_url":"https://api.github.com/repos/dturanski/spring-xd/pulls{/number}","milestones_url":"https://api.github.com/repos/dturanski/spring-xd/milestones{/number}","notifications_url":"https://api.github.com/repos/dturanski/spring-xd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dturanski/spring-xd/labels{/name}","releases_url":"https://api.github.com/repos/dturanski/spring-xd/releases{/id}","created_at":"2013-07-15T12:11:03Z","updated_at":"2014-06-18T13:14:29Z","pushed_at":"2014-08-18T15:37:06Z","git_url":"git://github.com/dturanski/spring-xd.git","ssh_url":"git@github.com:dturanski/spring-xd.git","clone_url":"https://github.com/dturanski/spring-xd.git","svn_url":"https://github.com/dturanski/spring-xd","homepage":null,"size":26350,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"spring-projects:master","ref":"master","sha":"baddfc24b08286a78392d5f565742c9bab5adfea","user":{"login":"spring-projects","id":317776,"avatar_url":"https://avatars.githubusercontent.com/u/317776?v=2","gravatar_id":"6f8a529bd100f4272a9ff1b8cdfbd26e","url":"https://api.github.com/users/spring-projects","html_url":"https://github.com/spring-projects","followers_url":"https://api.github.com/users/spring-projects/followers","following_url":"https://api.github.com/users/spring-projects/following{/other_user}","gists_url":"https://api.github.com/users/spring-projects/gists{/gist_id}","starred_url":"https://api.github.com/users/spring-projects/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spring-projects/subscriptions","organizations_url":"https://api.github.com/users/spring-projects/orgs","repos_url":"https://api.github.com/users/spring-projects/repos","events_url":"https://api.github.com/users/spring-projects/events{/privacy}","received_events_url":"https://api.github.com/users/spring-projects/received_events","type":"Organization","site_admin":false},"repo":{"id":9349347,"name":"spring-xd","full_name":"spring-projects/spring-xd","owner":{"login":"spring-projects","id":317776,"avatar_url":"https://avatars.githubusercontent.com/u/317776?v=2","gravatar_id":"6f8a529bd100f4272a9ff1b8cdfbd26e","url":"https://api.github.com/users/spring-projects","html_url":"https://github.com/spring-projects","followers_url":"https://api.github.com/users/spring-projects/followers","following_url":"https://api.github.com/users/spring-projects/following{/other_user}","gists_url":"https://api.github.com/users/spring-projects/gists{/gist_id}","starred_url":"https://api.github.com/users/spring-projects/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spring-projects/subscriptions","organizations_url":"https://api.github.com/users/spring-projects/orgs","repos_url":"https://api.github.com/users/spring-projects/repos","events_url":"https://api.github.com/users/spring-projects/events{/privacy}","received_events_url":"https://api.github.com/users/spring-projects/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spring-projects/spring-xd","description":"Spring XD makes it easy to solve common big data problems such as data ingestion and export, real-time analytics, and batch workflow orchestration","fork":false,"url":"https://api.github.com/repos/spring-projects/spring-xd","forks_url":"https://api.github.com/repos/spring-projects/spring-xd/forks","keys_url":"https://api.github.com/repos/spring-projects/spring-xd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spring-projects/spring-xd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spring-projects/spring-xd/teams","hooks_url":"https://api.github.com/repos/spring-projects/spring-xd/hooks","issue_events_url":"https://api.github.com/repos/spring-projects/spring-xd/issues/events{/number}","events_url":"https://api.github.com/repos/spring-projects/spring-xd/events","assignees_url":"https://api.github.com/repos/spring-projects/spring-xd/assignees{/user}","branches_url":"https://api.github.com/repos/spring-projects/spring-xd/branches{/branch}","tags_url":"https://api.github.com/repos/spring-projects/spring-xd/tags","blobs_url":"https://api.github.com/repos/spring-projects/spring-xd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spring-projects/spring-xd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spring-projects/spring-xd/git/refs{/sha}","trees_url":"https://api.github.com/repos/spring-projects/spring-xd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spring-projects/spring-xd/statuses/{sha}","languages_url":"https://api.github.com/repos/spring-projects/spring-xd/languages","stargazers_url":"https://api.github.com/repos/spring-projects/spring-xd/stargazers","contributors_url":"https://api.github.com/repos/spring-projects/spring-xd/contributors","subscribers_url":"https://api.github.com/repos/spring-projects/spring-xd/subscribers","subscription_url":"https://api.github.com/repos/spring-projects/spring-xd/subscription","commits_url":"https://api.github.com/repos/spring-projects/spring-xd/commits{/sha}","git_commits_url":"https://api.github.com/repos/spring-projects/spring-xd/git/commits{/sha}","comments_url":"https://api.github.com/repos/spring-projects/spring-xd/comments{/number}","issue_comment_url":"https://api.github.com/repos/spring-projects/spring-xd/issues/comments/{number}","contents_url":"https://api.github.com/repos/spring-projects/spring-xd/contents/{+path}","compare_url":"https://api.github.com/repos/spring-projects/spring-xd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spring-projects/spring-xd/merges","archive_url":"https://api.github.com/repos/spring-projects/spring-xd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spring-projects/spring-xd/downloads","issues_url":"https://api.github.com/repos/spring-projects/spring-xd/issues{/number}","pulls_url":"https://api.github.com/repos/spring-projects/spring-xd/pulls{/number}","milestones_url":"https://api.github.com/repos/spring-projects/spring-xd/milestones{/number}","notifications_url":"https://api.github.com/repos/spring-projects/spring-xd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spring-projects/spring-xd/labels{/name}","releases_url":"https://api.github.com/repos/spring-projects/spring-xd/releases{/id}","created_at":"2013-04-10T15:31:44Z","updated_at":"2014-08-13T01:59:22Z","pushed_at":"2014-08-07T11:32:13Z","git_url":"git://github.com/spring-projects/spring-xd.git","ssh_url":"git@github.com:spring-projects/spring-xd.git","clone_url":"https://github.com/spring-projects/spring-xd.git","svn_url":"https://github.com/spring-projects/spring-xd","homepage":"http://projects.spring.io/spring-xd","size":74113,"stargazers_count":151,"watchers_count":151,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":137,"mirror_url":null,"open_issues_count":23,"forks":137,"open_issues":23,"watchers":151,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spring-projects/spring-xd/pulls/1156"},"html":{"href":"https://github.com/spring-projects/spring-xd/pull/1156"},"issue":{"href":"https://api.github.com/repos/spring-projects/spring-xd/issues/1156"},"comments":{"href":"https://api.github.com/repos/spring-projects/spring-xd/issues/1156/comments"},"review_comments":{"href":"https://api.github.com/repos/spring-projects/spring-xd/pulls/1156/comments"},"review_comment":{"href":"https://api.github.com/repos/spring-projects/spring-xd/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/spring-projects/spring-xd/pulls/1156/commits"},"statuses":{"href":"https://api.github.com/repos/spring-projects/spring-xd/statuses/6b66613fb6d8e85c5b2ccad02ec6593829790a9d"}}}}