{"action":"created","comment":{"url":"https://api.github.com/repos/palantir/docker-compose-rule/pulls/comments/104897858","pull_request_review_id":25751850,"id":104897858,"diff_hunk":"@@ -0,0 +1,98 @@\n+/*\n+ * Copyright 2016 Palantir Technologies, Inc. All rights reserved.\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+package com.palantir.docker.compose.execution;\n+\n+import static org.hamcrest.MatcherAssert.assertThat;\n+import static org.hamcrest.core.Is.is;\n+\n+import java.io.IOException;\n+import java.nio.file.Files;\n+import java.nio.file.Path;\n+import org.junit.Before;\n+import org.junit.Rule;\n+import org.junit.Test;\n+import org.junit.contrib.java.lang.system.EnvironmentVariables;\n+import org.junit.rules.ExpectedException;\n+import org.junit.rules.TemporaryFolder;\n+\n+public class DockerCommandLocatorShould {\n+    private static final String command = \"not-a-real-command!\";\n+    private static final String windowsCommand = command + \".exe\";\n+\n+    @Rule public TemporaryFolder folder = new TemporaryFolder();\n+\n+    @Rule public ExpectedException exception = ExpectedException.none();\n+\n+    @Rule public EnvironmentVariables environmentVariables = new EnvironmentVariables();\n+\n+    private Path firstPathFolder;\n+\n+    private String commandFileLocation;\n+    private String windowsCommandFileLocation;\n+\n+    @Before\n+    public void setup() throws IOException {\n+        firstPathFolder = folder.newFolder(\"first\").toPath();\n+\n+        commandFileLocation = Files.createFile(firstPathFolder.resolve(command)).toString();\n+        windowsCommandFileLocation = Files.createFile(firstPathFolder.resolve(windowsCommand)).toString();\n+\n+        environmentVariables.set(\"PATH\", firstPathFolder.toString());\n+    }\n+\n+    @Test public void\n+    provide_the_first_command_location() {\n+        DockerCommandLocator locator = DockerCommandLocator.forCommand(command)\n+                .isWindows(false)\n+                .build();\n+        assertThat(locator.getLocation(), is(commandFileLocation));\n+    }\n+\n+    @Test public void\n+    provide_the_first_command_location_on_windows() {\n+        DockerCommandLocator locator = DockerCommandLocator.forCommand(command)\n+                .isWindows(true)\n+                .build();\n+        assertThat(locator.getLocation(), is(windowsCommandFileLocation));\n+    }\n+\n+    @Test public void\n+    fail_when_no_paths_contain_command() {","path":"docker-compose-rule-core/src/test/java/com/palantir/docker/compose/execution/DockerCommandLocatorShould.java","position":73,"original_position":73,"commit_id":"19791dd6a73d94d7deb892f38a80ace0661ab68f","original_commit_id":"19791dd6a73d94d7deb892f38a80ace0661ab68f","user":{"login":"samwright","id":2478950,"avatar_url":"https://avatars3.githubusercontent.com/u/2478950?v=3","gravatar_id":"","url":"https://api.github.com/users/samwright","html_url":"https://github.com/samwright","followers_url":"https://api.github.com/users/samwright/followers","following_url":"https://api.github.com/users/samwright/following{/other_user}","gists_url":"https://api.github.com/users/samwright/gists{/gist_id}","starred_url":"https://api.github.com/users/samwright/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samwright/subscriptions","organizations_url":"https://api.github.com/users/samwright/orgs","repos_url":"https://api.github.com/users/samwright/repos","events_url":"https://api.github.com/users/samwright/events{/privacy}","received_events_url":"https://api.github.com/users/samwright/received_events","type":"User","site_admin":false},"body":"Ah, found it again (I had @Ignore'd the test, woops!)\r\n\r\n`Expected: (an instance of java.lang.IllegalStateException and exception with message a string containing \"Could not find not-a-real-command! in [/usr/local/bin, /usr/bin]\")\r\n     but: exception with message a string containing \"Could not find not-a-real-command! in [/usr/local/bin, /usr/bin]\" message was \"Could not find not-a-real-command! in [\\usr\\local\\bin, \\usr\\bin]\"`\r\n\r\nThe \"/usr/local/bin\" string is converted to a `Path` in `DockerCommandLocations.pathLocations()`, which on Windows converts it to \"\\usr\\local\\bin\" (aren't path separators fun?!)\r\n\r\nYou could change the expected message to just `\"Could not find \" + command`, or create a `List<Path> defaultPaths = ImmutableList.of(Paths.get(\"/usr/local/bin\"), Paths.get(\"/usr/bin\"))` and expect `\"Could not find \" + command + \" in \" + defaultPaths`.","created_at":"2017-03-08T11:26:52Z","updated_at":"2017-03-08T11:26:53Z","html_url":"https://github.com/palantir/docker-compose-rule/pull/175#discussion_r104897858","pull_request_url":"https://api.github.com/repos/palantir/docker-compose-rule/pulls/175","_links":{"self":{"href":"https://api.github.com/repos/palantir/docker-compose-rule/pulls/comments/104897858"},"html":{"href":"https://github.com/palantir/docker-compose-rule/pull/175#discussion_r104897858"},"pull_request":{"href":"https://api.github.com/repos/palantir/docker-compose-rule/pulls/175"}}},"pull_request":{"url":"https://api.github.com/repos/palantir/docker-compose-rule/pulls/175","id":109511737,"html_url":"https://github.com/palantir/docker-compose-rule/pull/175","diff_url":"https://github.com/palantir/docker-compose-rule/pull/175.diff","patch_url":"https://github.com/palantir/docker-compose-rule/pull/175.patch","issue_url":"https://api.github.com/repos/palantir/docker-compose-rule/issues/175","number":175,"state":"open","locked":false,"title":"Feature/look in path","user":{"login":"hpryce","id":3803639,"avatar_url":"https://avatars3.githubusercontent.com/u/3803639?v=3","gravatar_id":"","url":"https://api.github.com/users/hpryce","html_url":"https://github.com/hpryce","followers_url":"https://api.github.com/users/hpryce/followers","following_url":"https://api.github.com/users/hpryce/following{/other_user}","gists_url":"https://api.github.com/users/hpryce/gists{/gist_id}","starred_url":"https://api.github.com/users/hpryce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hpryce/subscriptions","organizations_url":"https://api.github.com/users/hpryce/orgs","repos_url":"https://api.github.com/users/hpryce/repos","events_url":"https://api.github.com/users/hpryce/events{/privacy}","received_events_url":"https://api.github.com/users/hpryce/received_events","type":"User","site_admin":false},"body":"This combines https://github.com/palantir/docker-compose-rule/pull/170 and https://github.com/palantir/docker-compose-rule/pull/152 to provide support for finding docker from the path both on Windows and in existing setups.","created_at":"2017-03-07T16:04:43Z","updated_at":"2017-03-08T11:26:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0327b0c4a424c736939aaf83305fd4d66b69bf50","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/palantir/docker-compose-rule/pulls/175/commits","review_comments_url":"https://api.github.com/repos/palantir/docker-compose-rule/pulls/175/comments","review_comment_url":"https://api.github.com/repos/palantir/docker-compose-rule/pulls/comments{/number}","comments_url":"https://api.github.com/repos/palantir/docker-compose-rule/issues/175/comments","statuses_url":"https://api.github.com/repos/palantir/docker-compose-rule/statuses/19791dd6a73d94d7deb892f38a80ace0661ab68f","head":{"label":"palantir:feature/look_in_path","ref":"feature/look_in_path","sha":"19791dd6a73d94d7deb892f38a80ace0661ab68f","user":{"login":"palantir","id":303157,"avatar_url":"https://avatars3.githubusercontent.com/u/303157?v=3","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"repo":{"id":50542309,"name":"docker-compose-rule","full_name":"palantir/docker-compose-rule","owner":{"login":"palantir","id":303157,"avatar_url":"https://avatars3.githubusercontent.com/u/303157?v=3","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/palantir/docker-compose-rule","description":"A JUnit rule to manage docker containers using docker-compose","fork":false,"url":"https://api.github.com/repos/palantir/docker-compose-rule","forks_url":"https://api.github.com/repos/palantir/docker-compose-rule/forks","keys_url":"https://api.github.com/repos/palantir/docker-compose-rule/keys{/key_id}","collaborators_url":"https://api.github.com/repos/palantir/docker-compose-rule/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/palantir/docker-compose-rule/teams","hooks_url":"https://api.github.com/repos/palantir/docker-compose-rule/hooks","issue_events_url":"https://api.github.com/repos/palantir/docker-compose-rule/issues/events{/number}","events_url":"https://api.github.com/repos/palantir/docker-compose-rule/events","assignees_url":"https://api.github.com/repos/palantir/docker-compose-rule/assignees{/user}","branches_url":"https://api.github.com/repos/palantir/docker-compose-rule/branches{/branch}","tags_url":"https://api.github.com/repos/palantir/docker-compose-rule/tags","blobs_url":"https://api.github.com/repos/palantir/docker-compose-rule/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/palantir/docker-compose-rule/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/palantir/docker-compose-rule/git/refs{/sha}","trees_url":"https://api.github.com/repos/palantir/docker-compose-rule/git/trees{/sha}","statuses_url":"https://api.github.com/repos/palantir/docker-compose-rule/statuses/{sha}","languages_url":"https://api.github.com/repos/palantir/docker-compose-rule/languages","stargazers_url":"https://api.github.com/repos/palantir/docker-compose-rule/stargazers","contributors_url":"https://api.github.com/repos/palantir/docker-compose-rule/contributors","subscribers_url":"https://api.github.com/repos/palantir/docker-compose-rule/subscribers","subscription_url":"https://api.github.com/repos/palantir/docker-compose-rule/subscription","commits_url":"https://api.github.com/repos/palantir/docker-compose-rule/commits{/sha}","git_commits_url":"https://api.github.com/repos/palantir/docker-compose-rule/git/commits{/sha}","comments_url":"https://api.github.com/repos/palantir/docker-compose-rule/comments{/number}","issue_comment_url":"https://api.github.com/repos/palantir/docker-compose-rule/issues/comments{/number}","contents_url":"https://api.github.com/repos/palantir/docker-compose-rule/contents/{+path}","compare_url":"https://api.github.com/repos/palantir/docker-compose-rule/compare/{base}...{head}","merges_url":"https://api.github.com/repos/palantir/docker-compose-rule/merges","archive_url":"https://api.github.com/repos/palantir/docker-compose-rule/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/palantir/docker-compose-rule/downloads","issues_url":"https://api.github.com/repos/palantir/docker-compose-rule/issues{/number}","pulls_url":"https://api.github.com/repos/palantir/docker-compose-rule/pulls{/number}","milestones_url":"https://api.github.com/repos/palantir/docker-compose-rule/milestones{/number}","notifications_url":"https://api.github.com/repos/palantir/docker-compose-rule/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/palantir/docker-compose-rule/labels{/name}","releases_url":"https://api.github.com/repos/palantir/docker-compose-rule/releases{/id}","deployments_url":"https://api.github.com/repos/palantir/docker-compose-rule/deployments","created_at":"2016-01-27T22:24:46Z","updated_at":"2017-03-07T00:47:15Z","pushed_at":"2017-03-08T10:56:07Z","git_url":"git://github.com/palantir/docker-compose-rule.git","ssh_url":"git@github.com:palantir/docker-compose-rule.git","clone_url":"https://github.com/palantir/docker-compose-rule.git","svn_url":"https://github.com/palantir/docker-compose-rule","homepage":"","size":980,"stargazers_count":77,"watchers_count":77,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":29,"mirror_url":null,"open_issues_count":25,"forks":29,"open_issues":25,"watchers":77,"default_branch":"master"}},"base":{"label":"palantir:master","ref":"master","sha":"41bc8696c334d6a705d4987c3bdefd608de28404","user":{"login":"palantir","id":303157,"avatar_url":"https://avatars3.githubusercontent.com/u/303157?v=3","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"repo":{"id":50542309,"name":"docker-compose-rule","full_name":"palantir/docker-compose-rule","owner":{"login":"palantir","id":303157,"avatar_url":"https://avatars3.githubusercontent.com/u/303157?v=3","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/palantir/docker-compose-rule","description":"A JUnit rule to manage docker containers using docker-compose","fork":false,"url":"https://api.github.com/repos/palantir/docker-compose-rule","forks_url":"https://api.github.com/repos/palantir/docker-compose-rule/forks","keys_url":"https://api.github.com/repos/palantir/docker-compose-rule/keys{/key_id}","collaborators_url":"https://api.github.com/repos/palantir/docker-compose-rule/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/palantir/docker-compose-rule/teams","hooks_url":"https://api.github.com/repos/palantir/docker-compose-rule/hooks","issue_events_url":"https://api.github.com/repos/palantir/docker-compose-rule/issues/events{/number}","events_url":"https://api.github.com/repos/palantir/docker-compose-rule/events","assignees_url":"https://api.github.com/repos/palantir/docker-compose-rule/assignees{/user}","branches_url":"https://api.github.com/repos/palantir/docker-compose-rule/branches{/branch}","tags_url":"https://api.github.com/repos/palantir/docker-compose-rule/tags","blobs_url":"https://api.github.com/repos/palantir/docker-compose-rule/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/palantir/docker-compose-rule/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/palantir/docker-compose-rule/git/refs{/sha}","trees_url":"https://api.github.com/repos/palantir/docker-compose-rule/git/trees{/sha}","statuses_url":"https://api.github.com/repos/palantir/docker-compose-rule/statuses/{sha}","languages_url":"https://api.github.com/repos/palantir/docker-compose-rule/languages","stargazers_url":"https://api.github.com/repos/palantir/docker-compose-rule/stargazers","contributors_url":"https://api.github.com/repos/palantir/docker-compose-rule/contributors","subscribers_url":"https://api.github.com/repos/palantir/docker-compose-rule/subscribers","subscription_url":"https://api.github.com/repos/palantir/docker-compose-rule/subscription","commits_url":"https://api.github.com/repos/palantir/docker-compose-rule/commits{/sha}","git_commits_url":"https://api.github.com/repos/palantir/docker-compose-rule/git/commits{/sha}","comments_url":"https://api.github.com/repos/palantir/docker-compose-rule/comments{/number}","issue_comment_url":"https://api.github.com/repos/palantir/docker-compose-rule/issues/comments{/number}","contents_url":"https://api.github.com/repos/palantir/docker-compose-rule/contents/{+path}","compare_url":"https://api.github.com/repos/palantir/docker-compose-rule/compare/{base}...{head}","merges_url":"https://api.github.com/repos/palantir/docker-compose-rule/merges","archive_url":"https://api.github.com/repos/palantir/docker-compose-rule/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/palantir/docker-compose-rule/downloads","issues_url":"https://api.github.com/repos/palantir/docker-compose-rule/issues{/number}","pulls_url":"https://api.github.com/repos/palantir/docker-compose-rule/pulls{/number}","milestones_url":"https://api.github.com/repos/palantir/docker-compose-rule/milestones{/number}","notifications_url":"https://api.github.com/repos/palantir/docker-compose-rule/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/palantir/docker-compose-rule/labels{/name}","releases_url":"https://api.github.com/repos/palantir/docker-compose-rule/releases{/id}","deployments_url":"https://api.github.com/repos/palantir/docker-compose-rule/deployments","created_at":"2016-01-27T22:24:46Z","updated_at":"2017-03-07T00:47:15Z","pushed_at":"2017-03-08T10:56:07Z","git_url":"git://github.com/palantir/docker-compose-rule.git","ssh_url":"git@github.com:palantir/docker-compose-rule.git","clone_url":"https://github.com/palantir/docker-compose-rule.git","svn_url":"https://github.com/palantir/docker-compose-rule","homepage":"","size":980,"stargazers_count":77,"watchers_count":77,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":29,"mirror_url":null,"open_issues_count":25,"forks":29,"open_issues":25,"watchers":77,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/palantir/docker-compose-rule/pulls/175"},"html":{"href":"https://github.com/palantir/docker-compose-rule/pull/175"},"issue":{"href":"https://api.github.com/repos/palantir/docker-compose-rule/issues/175"},"comments":{"href":"https://api.github.com/repos/palantir/docker-compose-rule/issues/175/comments"},"review_comments":{"href":"https://api.github.com/repos/palantir/docker-compose-rule/pulls/175/comments"},"review_comment":{"href":"https://api.github.com/repos/palantir/docker-compose-rule/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/palantir/docker-compose-rule/pulls/175/commits"},"statuses":{"href":"https://api.github.com/repos/palantir/docker-compose-rule/statuses/19791dd6a73d94d7deb892f38a80ace0661ab68f"}}}}
{"actor":{"display_login":"samwright"}}