{"action":"created","comment":{"url":"https://api.github.com/repos/Alluxio/alluxio/pulls/comments/80311946","id":80311946,"diff_hunk":"@@ -0,0 +1,69 @@\n+/*\n+ * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0\n+ * (the \"License\"). You may not use this work except in compliance with the License, which is\n+ * available at www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n+ * either express or implied, as more fully set forth in the License.\n+ *\n+ * See the NOTICE file distributed with this work for information regarding copyright ownership.\n+ */\n+\n+package alluxio.underfs.s3a;\n+\n+import com.amazonaws.services.s3.model.ObjectMetadata;\n+import com.amazonaws.services.s3.model.PutObjectRequest;\n+import com.amazonaws.services.s3.transfer.TransferManager;\n+import com.amazonaws.services.s3.transfer.Upload;\n+import org.junit.Before;\n+import org.junit.Test;\n+import org.junit.runner.RunWith;\n+import org.mockito.Matchers;\n+import org.mockito.Mockito;\n+import org.powermock.api.mockito.PowerMockito;\n+import org.powermock.core.classloader.annotations.PrepareForTest;\n+import org.powermock.modules.junit4.PowerMockRunner;\n+\n+import java.io.File;\n+\n+/**\n+ * Unit tests for the {@link S3ADirectOutputStream}.\n+ */\n+@RunWith(PowerMockRunner.class)\n+@PrepareForTest(S3ADirectOutputStream.class)\n+public class S3ADirectOutputStreamTest {\n+  private static final String BUCKET_NAME = \"testBucket\";\n+  private static final String KEY = \"testKey\";\n+\n+  private TransferManager mManager;\n+  private S3ADirectOutputStream mStream;\n+\n+  /**\n+   * Sets the properties and configuration before each test runs.\n+   */\n+  @Before\n+  public void before() throws Exception {\n+    mManager = Mockito.mock(TransferManager.class);\n+    Upload result = Mockito.mock(Upload.class);\n+\n+    Mockito.when(mManager.upload(Mockito.any(PutObjectRequest.class))).thenReturn(result);\n+    mStream = new S3ADirectOutputStream(BUCKET_NAME, KEY, mManager);\n+  }\n+\n+  /**\n+   * Tests to ensure the permanent file path is used when upload is called.\n+   */\n+  @Test\n+  public void close() throws Exception {\n+    PutObjectRequest request = Mockito.mock(PutObjectRequest.class);\n+\n+    Mockito.when(request.withMetadata(Mockito.any(ObjectMetadata.class))).thenReturn(request);\n+    PowerMockito.whenNew(PutObjectRequest.class)","path":"underfs/s3a/src/test/java/alluxio/underfs/s3a/S3ADirectOutputStreamTest.java","position":61,"original_position":61,"commit_id":"15a6d8a4b872e4a06db68774e9c0cbe8b5edf911","original_commit_id":"15a6d8a4b872e4a06db68774e9c0cbe8b5edf911","user":{"login":"aaudiber","id":3455177,"avatar_url":"https://avatars.githubusercontent.com/u/3455177?v=3","gravatar_id":"","url":"https://api.github.com/users/aaudiber","html_url":"https://github.com/aaudiber","followers_url":"https://api.github.com/users/aaudiber/followers","following_url":"https://api.github.com/users/aaudiber/following{/other_user}","gists_url":"https://api.github.com/users/aaudiber/gists{/gist_id}","starred_url":"https://api.github.com/users/aaudiber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaudiber/subscriptions","organizations_url":"https://api.github.com/users/aaudiber/orgs","repos_url":"https://api.github.com/users/aaudiber/repos","events_url":"https://api.github.com/users/aaudiber/events{/privacy}","received_events_url":"https://api.github.com/users/aaudiber/received_events","type":"User","site_admin":false},"body":"Hm, it's not too great to leak implementation details like the constructor we use for `PutObjectRequest` into the unit test.\r\n\r\nI'd rather capture the `PutObjectRequest` argument to `mManager.upload()`, and check that it uses the right key. See http://site.mockito.org/mockito/docs/current/org/mockito/Mockito.html#captors","created_at":"2016-09-23T19:31:02Z","updated_at":"2016-09-23T19:31:11Z","html_url":"https://github.com/Alluxio/alluxio/pull/3930#discussion_r80311946","pull_request_url":"https://api.github.com/repos/Alluxio/alluxio/pulls/3930","_links":{"self":{"href":"https://api.github.com/repos/Alluxio/alluxio/pulls/comments/80311946"},"html":{"href":"https://github.com/Alluxio/alluxio/pull/3930#discussion_r80311946"},"pull_request":{"href":"https://api.github.com/repos/Alluxio/alluxio/pulls/3930"}}},"pull_request":{"url":"https://api.github.com/repos/Alluxio/alluxio/pulls/3930","id":86431151,"html_url":"https://github.com/Alluxio/alluxio/pull/3930","diff_url":"https://github.com/Alluxio/alluxio/pull/3930.diff","patch_url":"https://github.com/Alluxio/alluxio/pull/3930.patch","issue_url":"https://api.github.com/repos/Alluxio/alluxio/issues/3930","number":3930,"state":"open","locked":false,"title":"[ALLUXIO-2234] Add DirectS3AOutputStream","user":{"login":"calvinjia","id":2223813,"avatar_url":"https://avatars.githubusercontent.com/u/2223813?v=3","gravatar_id":"","url":"https://api.github.com/users/calvinjia","html_url":"https://github.com/calvinjia","followers_url":"https://api.github.com/users/calvinjia/followers","following_url":"https://api.github.com/users/calvinjia/following{/other_user}","gists_url":"https://api.github.com/users/calvinjia/gists{/gist_id}","starred_url":"https://api.github.com/users/calvinjia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calvinjia/subscriptions","organizations_url":"https://api.github.com/users/calvinjia/orgs","repos_url":"https://api.github.com/users/calvinjia/repos","events_url":"https://api.github.com/users/calvinjia/events{/privacy}","received_events_url":"https://api.github.com/users/calvinjia/received_events","type":"User","site_admin":false},"body":"https://alluxio.atlassian.net/browse/ALLUXIO-2234","created_at":"2016-09-22T23:19:16Z","updated_at":"2016-09-23T19:31:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"46ded8cfa29a4eb20df0e64a71e97d1d4313c1cd","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Alluxio/alluxio/pulls/3930/commits","review_comments_url":"https://api.github.com/repos/Alluxio/alluxio/pulls/3930/comments","review_comment_url":"https://api.github.com/repos/Alluxio/alluxio/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Alluxio/alluxio/issues/3930/comments","statuses_url":"https://api.github.com/repos/Alluxio/alluxio/statuses/15a6d8a4b872e4a06db68774e9c0cbe8b5edf911","head":{"label":"calvinjia:alluxio-2234","ref":"alluxio-2234","sha":"15a6d8a4b872e4a06db68774e9c0cbe8b5edf911","user":{"login":"calvinjia","id":2223813,"avatar_url":"https://avatars.githubusercontent.com/u/2223813?v=3","gravatar_id":"","url":"https://api.github.com/users/calvinjia","html_url":"https://github.com/calvinjia","followers_url":"https://api.github.com/users/calvinjia/followers","following_url":"https://api.github.com/users/calvinjia/following{/other_user}","gists_url":"https://api.github.com/users/calvinjia/gists{/gist_id}","starred_url":"https://api.github.com/users/calvinjia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calvinjia/subscriptions","organizations_url":"https://api.github.com/users/calvinjia/orgs","repos_url":"https://api.github.com/users/calvinjia/repos","events_url":"https://api.github.com/users/calvinjia/events{/privacy}","received_events_url":"https://api.github.com/users/calvinjia/received_events","type":"User","site_admin":false},"repo":{"id":9278135,"name":"tachyon","full_name":"calvinjia/tachyon","owner":{"login":"calvinjia","id":2223813,"avatar_url":"https://avatars.githubusercontent.com/u/2223813?v=3","gravatar_id":"","url":"https://api.github.com/users/calvinjia","html_url":"https://github.com/calvinjia","followers_url":"https://api.github.com/users/calvinjia/followers","following_url":"https://api.github.com/users/calvinjia/following{/other_user}","gists_url":"https://api.github.com/users/calvinjia/gists{/gist_id}","starred_url":"https://api.github.com/users/calvinjia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calvinjia/subscriptions","organizations_url":"https://api.github.com/users/calvinjia/orgs","repos_url":"https://api.github.com/users/calvinjia/repos","events_url":"https://api.github.com/users/calvinjia/events{/privacy}","received_events_url":"https://api.github.com/users/calvinjia/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/calvinjia/tachyon","description":"Tachyon","fork":true,"url":"https://api.github.com/repos/calvinjia/tachyon","forks_url":"https://api.github.com/repos/calvinjia/tachyon/forks","keys_url":"https://api.github.com/repos/calvinjia/tachyon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/calvinjia/tachyon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/calvinjia/tachyon/teams","hooks_url":"https://api.github.com/repos/calvinjia/tachyon/hooks","issue_events_url":"https://api.github.com/repos/calvinjia/tachyon/issues/events{/number}","events_url":"https://api.github.com/repos/calvinjia/tachyon/events","assignees_url":"https://api.github.com/repos/calvinjia/tachyon/assignees{/user}","branches_url":"https://api.github.com/repos/calvinjia/tachyon/branches{/branch}","tags_url":"https://api.github.com/repos/calvinjia/tachyon/tags","blobs_url":"https://api.github.com/repos/calvinjia/tachyon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/calvinjia/tachyon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/calvinjia/tachyon/git/refs{/sha}","trees_url":"https://api.github.com/repos/calvinjia/tachyon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/calvinjia/tachyon/statuses/{sha}","languages_url":"https://api.github.com/repos/calvinjia/tachyon/languages","stargazers_url":"https://api.github.com/repos/calvinjia/tachyon/stargazers","contributors_url":"https://api.github.com/repos/calvinjia/tachyon/contributors","subscribers_url":"https://api.github.com/repos/calvinjia/tachyon/subscribers","subscription_url":"https://api.github.com/repos/calvinjia/tachyon/subscription","commits_url":"https://api.github.com/repos/calvinjia/tachyon/commits{/sha}","git_commits_url":"https://api.github.com/repos/calvinjia/tachyon/git/commits{/sha}","comments_url":"https://api.github.com/repos/calvinjia/tachyon/comments{/number}","issue_comment_url":"https://api.github.com/repos/calvinjia/tachyon/issues/comments{/number}","contents_url":"https://api.github.com/repos/calvinjia/tachyon/contents/{+path}","compare_url":"https://api.github.com/repos/calvinjia/tachyon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/calvinjia/tachyon/merges","archive_url":"https://api.github.com/repos/calvinjia/tachyon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/calvinjia/tachyon/downloads","issues_url":"https://api.github.com/repos/calvinjia/tachyon/issues{/number}","pulls_url":"https://api.github.com/repos/calvinjia/tachyon/pulls{/number}","milestones_url":"https://api.github.com/repos/calvinjia/tachyon/milestones{/number}","notifications_url":"https://api.github.com/repos/calvinjia/tachyon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/calvinjia/tachyon/labels{/name}","releases_url":"https://api.github.com/repos/calvinjia/tachyon/releases{/id}","deployments_url":"https://api.github.com/repos/calvinjia/tachyon/deployments","created_at":"2013-04-07T14:56:38Z","updated_at":"2016-01-28T08:06:47Z","pushed_at":"2016-09-23T18:26:24Z","git_url":"git://github.com/calvinjia/tachyon.git","ssh_url":"git@github.com:calvinjia/tachyon.git","clone_url":"https://github.com/calvinjia/tachyon.git","svn_url":"https://github.com/calvinjia/tachyon","homepage":null,"size":60643,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"Alluxio:master","ref":"master","sha":"cb9dd999ec77c5785ee22f09d1314e67168cfb47","user":{"login":"Alluxio","id":16203694,"avatar_url":"https://avatars.githubusercontent.com/u/16203694?v=3","gravatar_id":"","url":"https://api.github.com/users/Alluxio","html_url":"https://github.com/Alluxio","followers_url":"https://api.github.com/users/Alluxio/followers","following_url":"https://api.github.com/users/Alluxio/following{/other_user}","gists_url":"https://api.github.com/users/Alluxio/gists{/gist_id}","starred_url":"https://api.github.com/users/Alluxio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alluxio/subscriptions","organizations_url":"https://api.github.com/users/Alluxio/orgs","repos_url":"https://api.github.com/users/Alluxio/repos","events_url":"https://api.github.com/users/Alluxio/events{/privacy}","received_events_url":"https://api.github.com/users/Alluxio/received_events","type":"Organization","site_admin":false},"repo":{"id":7276954,"name":"alluxio","full_name":"Alluxio/alluxio","owner":{"login":"Alluxio","id":16203694,"avatar_url":"https://avatars.githubusercontent.com/u/16203694?v=3","gravatar_id":"","url":"https://api.github.com/users/Alluxio","html_url":"https://github.com/Alluxio","followers_url":"https://api.github.com/users/Alluxio/followers","following_url":"https://api.github.com/users/Alluxio/following{/other_user}","gists_url":"https://api.github.com/users/Alluxio/gists{/gist_id}","starred_url":"https://api.github.com/users/Alluxio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alluxio/subscriptions","organizations_url":"https://api.github.com/users/Alluxio/orgs","repos_url":"https://api.github.com/users/Alluxio/repos","events_url":"https://api.github.com/users/Alluxio/events{/privacy}","received_events_url":"https://api.github.com/users/Alluxio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Alluxio/alluxio","description":"Alluxio, formerly Tachyon, Memory Speed Virtual Distributed Storage System","fork":false,"url":"https://api.github.com/repos/Alluxio/alluxio","forks_url":"https://api.github.com/repos/Alluxio/alluxio/forks","keys_url":"https://api.github.com/repos/Alluxio/alluxio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Alluxio/alluxio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Alluxio/alluxio/teams","hooks_url":"https://api.github.com/repos/Alluxio/alluxio/hooks","issue_events_url":"https://api.github.com/repos/Alluxio/alluxio/issues/events{/number}","events_url":"https://api.github.com/repos/Alluxio/alluxio/events","assignees_url":"https://api.github.com/repos/Alluxio/alluxio/assignees{/user}","branches_url":"https://api.github.com/repos/Alluxio/alluxio/branches{/branch}","tags_url":"https://api.github.com/repos/Alluxio/alluxio/tags","blobs_url":"https://api.github.com/repos/Alluxio/alluxio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Alluxio/alluxio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Alluxio/alluxio/git/refs{/sha}","trees_url":"https://api.github.com/repos/Alluxio/alluxio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Alluxio/alluxio/statuses/{sha}","languages_url":"https://api.github.com/repos/Alluxio/alluxio/languages","stargazers_url":"https://api.github.com/repos/Alluxio/alluxio/stargazers","contributors_url":"https://api.github.com/repos/Alluxio/alluxio/contributors","subscribers_url":"https://api.github.com/repos/Alluxio/alluxio/subscribers","subscription_url":"https://api.github.com/repos/Alluxio/alluxio/subscription","commits_url":"https://api.github.com/repos/Alluxio/alluxio/commits{/sha}","git_commits_url":"https://api.github.com/repos/Alluxio/alluxio/git/commits{/sha}","comments_url":"https://api.github.com/repos/Alluxio/alluxio/comments{/number}","issue_comment_url":"https://api.github.com/repos/Alluxio/alluxio/issues/comments{/number}","contents_url":"https://api.github.com/repos/Alluxio/alluxio/contents/{+path}","compare_url":"https://api.github.com/repos/Alluxio/alluxio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Alluxio/alluxio/merges","archive_url":"https://api.github.com/repos/Alluxio/alluxio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Alluxio/alluxio/downloads","issues_url":"https://api.github.com/repos/Alluxio/alluxio/issues{/number}","pulls_url":"https://api.github.com/repos/Alluxio/alluxio/pulls{/number}","milestones_url":"https://api.github.com/repos/Alluxio/alluxio/milestones{/number}","notifications_url":"https://api.github.com/repos/Alluxio/alluxio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Alluxio/alluxio/labels{/name}","releases_url":"https://api.github.com/repos/Alluxio/alluxio/releases{/id}","deployments_url":"https://api.github.com/repos/Alluxio/alluxio/deployments","created_at":"2012-12-21T17:43:46Z","updated_at":"2016-09-23T08:16:30Z","pushed_at":"2016-09-23T19:29:05Z","git_url":"git://github.com/Alluxio/alluxio.git","ssh_url":"git@github.com:Alluxio/alluxio.git","clone_url":"https://github.com/Alluxio/alluxio.git","svn_url":"https://github.com/Alluxio/alluxio","homepage":"http://www.alluxio.org/","size":93152,"stargazers_count":2608,"watchers_count":2608,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1075,"mirror_url":null,"open_issues_count":16,"forks":1075,"open_issues":16,"watchers":2608,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Alluxio/alluxio/pulls/3930"},"html":{"href":"https://github.com/Alluxio/alluxio/pull/3930"},"issue":{"href":"https://api.github.com/repos/Alluxio/alluxio/issues/3930"},"comments":{"href":"https://api.github.com/repos/Alluxio/alluxio/issues/3930/comments"},"review_comments":{"href":"https://api.github.com/repos/Alluxio/alluxio/pulls/3930/comments"},"review_comment":{"href":"https://api.github.com/repos/Alluxio/alluxio/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Alluxio/alluxio/pulls/3930/commits"},"statuses":{"href":"https://api.github.com/repos/Alluxio/alluxio/statuses/15a6d8a4b872e4a06db68774e9c0cbe8b5edf911"}}}}
{"actor":{"display_login":"aaudiber"}}