{"action":"created","comment":{"url":"https://api.github.com/repos/amplab/tachyon/pulls/comments/36307754","id":36307754,"diff_hunk":"@@ -22,49 +42,235 @@\n \n import tachyon.Constants;\n import tachyon.conf.TachyonConf;\n+import tachyon.util.network.NetworkAddressUtils;\n \n /**\n  * Unit test for inner class {@link tachyon.security.authentication.AuthenticationFactory\n  * .AuthType} and methods of {@link tachyon.security.authentication.AuthenticationFactory}\n+ *\n+ * In order to test methods that return kinds of TTransport for connection in different mode,\n+ * we build Thrift servers and clients with specific TTransport, and let them connect.\n  */\n public class AuthenticationFactoryTest {\n \n+  TThreadPoolServer mServer;\n+  TachyonConf mTachyonConf = new TachyonConf();\n+  InetSocketAddress mServerAddress = new InetSocketAddress(\"localhost\",\n+      Constants.DEFAULT_MASTER_PORT);\n+\n   @Rule\n   public ExpectedException mThrown = ExpectedException.none();\n \n   @Test\n   public void authenticationFactoryConstructorTest() {\n-    TachyonConf tachyonConf = new TachyonConf();\n-    tachyonConf.set(Constants.TACHYON_SECURITY_AUTHENTICATION, \"SIMPLE\");\n+    mTachyonConf.set(Constants.TACHYON_SECURITY_AUTHENTICATION, \"SIMPLE\");\n \n-    AuthenticationFactory authenticationFactory = new AuthenticationFactory(tachyonConf);\n+    AuthenticationFactory authenticationFactory = new AuthenticationFactory(mTachyonConf);\n \n-    Assert.assertEquals(AuthenticationFactory.AuthType.SIMPLE.getAuthName(),\n-        authenticationFactory.getAuthTypeStr());\n+    Assert.assertEquals(AuthenticationFactory.AuthType.SIMPLE, authenticationFactory.getAuthType());\n   }\n \n   @Test\n   public void getAuthTypeFromConfTest() {\n-    TachyonConf tachyonConf = new TachyonConf();\n     AuthenticationFactory.AuthType authType;\n \n     // should return a SIMPLE AuthType with conf \"SIMPLE\"\n-    tachyonConf.set(Constants.TACHYON_SECURITY_AUTHENTICATION, \"SIMPLE\");\n-    authType = AuthenticationFactory.getAuthTypeFromConf(tachyonConf);\n+    mTachyonConf.set(Constants.TACHYON_SECURITY_AUTHENTICATION, \"SIMPLE\");\n+    authType = AuthenticationFactory.getAuthTypeFromConf(mTachyonConf);\n     Assert.assertEquals(AuthenticationFactory.AuthType.SIMPLE, authType);\n \n     // should return a SIMPLE AuthType with conf \"simple\"\n-    tachyonConf.set(Constants.TACHYON_SECURITY_AUTHENTICATION, \"simple\");\n-    authType = AuthenticationFactory.getAuthTypeFromConf(tachyonConf);\n+    mTachyonConf.set(Constants.TACHYON_SECURITY_AUTHENTICATION, \"simple\");\n+    authType = AuthenticationFactory.getAuthTypeFromConf(mTachyonConf);\n     Assert.assertEquals(AuthenticationFactory.AuthType.SIMPLE, authType);\n \n     // should throw exception with conf \"wrong\"\n-    tachyonConf.set(Constants.TACHYON_SECURITY_AUTHENTICATION, \"wrong\");\n+    mTachyonConf.set(Constants.TACHYON_SECURITY_AUTHENTICATION, \"wrong\");\n     mThrown.expect(IllegalArgumentException.class);\n     mThrown.expectMessage(\"wrong is not a valid authentication type. Check the configuration \"\n         + \"parameter \" + Constants.TACHYON_SECURITY_AUTHENTICATION);\n-    authType = AuthenticationFactory.getAuthTypeFromConf(tachyonConf);\n+    authType = AuthenticationFactory.getAuthTypeFromConf(mTachyonConf);\n+  }\n+\n+  /**\n+   * In NOSASL mode, the TTransport used should be the same as Tachyon original code.\n+   */\n+  @Test\n+  public void nosaslAuthenticationTest() throws Exception {\n+    mTachyonConf.set(Constants.TACHYON_SECURITY_AUTHENTICATION, \"NOSASL\");\n+\n+    // start server\n+    startServerThread(mTachyonConf);\n+\n+    // create client and connect to server\n+    TTransport client = createClient(null, null);\n+    client.open();\n+    Assert.assertTrue(client.isOpen());\n+\n+    // clean up\n+    client.close();\n+    mServer.stop();\n+  }\n+\n+  /**\n+   * In SIMPLE mode, the TTransport mechanism is PLAIN. When server authenticate the connected\n+   * client user, it use {@link tachyon.security.authentication.SimpleAuthenticationProviderImpl}.\n+   */\n+  @Test\n+  public void simpleAuthenticationTest() throws Exception {\n+    mTachyonConf.set(Constants.TACHYON_SECURITY_AUTHENTICATION, \"SIMPLE\");","path":"common/src/test/java/tachyon/security/authentication/AuthenticationFactoryTest.java","position":119,"original_position":119,"commit_id":"935b1daef9eb550efe167e4ea644a178ea588a15","original_commit_id":"935b1daef9eb550efe167e4ea644a178ea588a15","user":{"login":"ooq","id":5876435,"avatar_url":"https://avatars.githubusercontent.com/u/5876435?v=3","gravatar_id":"","url":"https://api.github.com/users/ooq","html_url":"https://github.com/ooq","followers_url":"https://api.github.com/users/ooq/followers","following_url":"https://api.github.com/users/ooq/following{/other_user}","gists_url":"https://api.github.com/users/ooq/gists{/gist_id}","starred_url":"https://api.github.com/users/ooq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ooq/subscriptions","organizations_url":"https://api.github.com/users/ooq/orgs","repos_url":"https://api.github.com/users/ooq/repos","events_url":"https://api.github.com/users/ooq/events{/privacy}","received_events_url":"https://api.github.com/users/ooq/received_events","type":"User","site_admin":false},"body":"In simple mode, what if the client provides `null` as the username? What is the expected behavior?","created_at":"2015-08-05T14:31:05Z","updated_at":"2015-08-05T14:31:05Z","html_url":"https://github.com/amplab/tachyon/pull/1229#discussion_r36307754","pull_request_url":"https://api.github.com/repos/amplab/tachyon/pulls/1229","_links":{"self":{"href":"https://api.github.com/repos/amplab/tachyon/pulls/comments/36307754"},"html":{"href":"https://github.com/amplab/tachyon/pull/1229#discussion_r36307754"},"pull_request":{"href":"https://api.github.com/repos/amplab/tachyon/pulls/1229"}}},"pull_request":{"url":"https://api.github.com/repos/amplab/tachyon/pulls/1229","id":41544483,"html_url":"https://github.com/amplab/tachyon/pull/1229","diff_url":"https://github.com/amplab/tachyon/pull/1229.diff","patch_url":"https://github.com/amplab/tachyon/pull/1229.patch","issue_url":"https://api.github.com/repos/amplab/tachyon/issues/1229","number":1229,"state":"open","locked":false,"title":"[TACHYON-726] Add methods of creating TTransport","user":{"login":"dongche","id":8003874,"avatar_url":"https://avatars.githubusercontent.com/u/8003874?v=3","gravatar_id":"","url":"https://api.github.com/users/dongche","html_url":"https://github.com/dongche","followers_url":"https://api.github.com/users/dongche/followers","following_url":"https://api.github.com/users/dongche/following{/other_user}","gists_url":"https://api.github.com/users/dongche/gists{/gist_id}","starred_url":"https://api.github.com/users/dongche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dongche/subscriptions","organizations_url":"https://api.github.com/users/dongche/orgs","repos_url":"https://api.github.com/users/dongche/repos","events_url":"https://api.github.com/users/dongche/events{/privacy}","received_events_url":"https://api.github.com/users/dongche/received_events","type":"User","site_admin":false},"body":"JIRA: https://tachyon.atlassian.net/browse/TACHYON-726\r\n\r\nThis patch adds a method in AuthenticationFactory for creating server side TTransportFactory, which is used to build a Thrift TServer.\r\n\r\nIn original code, `TachyonMaster` build a `TThreadPoolServer` with transport `TFramedTransport.Factory`. This method increase options of transport, so enhance the server.","created_at":"2015-08-04T08:16:40Z","updated_at":"2015-08-05T14:31:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a7521b450013d9c50cbb69deebbbb34cd0083dc3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/amplab/tachyon/pulls/1229/commits","review_comments_url":"https://api.github.com/repos/amplab/tachyon/pulls/1229/comments","review_comment_url":"https://api.github.com/repos/amplab/tachyon/pulls/comments{/number}","comments_url":"https://api.github.com/repos/amplab/tachyon/issues/1229/comments","statuses_url":"https://api.github.com/repos/amplab/tachyon/statuses/935b1daef9eb550efe167e4ea644a178ea588a15","head":{"label":"dongche:security-726","ref":"security-726","sha":"935b1daef9eb550efe167e4ea644a178ea588a15","user":{"login":"dongche","id":8003874,"avatar_url":"https://avatars.githubusercontent.com/u/8003874?v=3","gravatar_id":"","url":"https://api.github.com/users/dongche","html_url":"https://github.com/dongche","followers_url":"https://api.github.com/users/dongche/followers","following_url":"https://api.github.com/users/dongche/following{/other_user}","gists_url":"https://api.github.com/users/dongche/gists{/gist_id}","starred_url":"https://api.github.com/users/dongche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dongche/subscriptions","organizations_url":"https://api.github.com/users/dongche/orgs","repos_url":"https://api.github.com/users/dongche/repos","events_url":"https://api.github.com/users/dongche/events{/privacy}","received_events_url":"https://api.github.com/users/dongche/received_events","type":"User","site_admin":false},"repo":{"id":38419009,"name":"tachyon","full_name":"dongche/tachyon","owner":{"login":"dongche","id":8003874,"avatar_url":"https://avatars.githubusercontent.com/u/8003874?v=3","gravatar_id":"","url":"https://api.github.com/users/dongche","html_url":"https://github.com/dongche","followers_url":"https://api.github.com/users/dongche/followers","following_url":"https://api.github.com/users/dongche/following{/other_user}","gists_url":"https://api.github.com/users/dongche/gists{/gist_id}","starred_url":"https://api.github.com/users/dongche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dongche/subscriptions","organizations_url":"https://api.github.com/users/dongche/orgs","repos_url":"https://api.github.com/users/dongche/repos","events_url":"https://api.github.com/users/dongche/events{/privacy}","received_events_url":"https://api.github.com/users/dongche/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dongche/tachyon","description":" A Reliable Memory Centric Distributed Storage System","fork":true,"url":"https://api.github.com/repos/dongche/tachyon","forks_url":"https://api.github.com/repos/dongche/tachyon/forks","keys_url":"https://api.github.com/repos/dongche/tachyon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dongche/tachyon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dongche/tachyon/teams","hooks_url":"https://api.github.com/repos/dongche/tachyon/hooks","issue_events_url":"https://api.github.com/repos/dongche/tachyon/issues/events{/number}","events_url":"https://api.github.com/repos/dongche/tachyon/events","assignees_url":"https://api.github.com/repos/dongche/tachyon/assignees{/user}","branches_url":"https://api.github.com/repos/dongche/tachyon/branches{/branch}","tags_url":"https://api.github.com/repos/dongche/tachyon/tags","blobs_url":"https://api.github.com/repos/dongche/tachyon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dongche/tachyon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dongche/tachyon/git/refs{/sha}","trees_url":"https://api.github.com/repos/dongche/tachyon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dongche/tachyon/statuses/{sha}","languages_url":"https://api.github.com/repos/dongche/tachyon/languages","stargazers_url":"https://api.github.com/repos/dongche/tachyon/stargazers","contributors_url":"https://api.github.com/repos/dongche/tachyon/contributors","subscribers_url":"https://api.github.com/repos/dongche/tachyon/subscribers","subscription_url":"https://api.github.com/repos/dongche/tachyon/subscription","commits_url":"https://api.github.com/repos/dongche/tachyon/commits{/sha}","git_commits_url":"https://api.github.com/repos/dongche/tachyon/git/commits{/sha}","comments_url":"https://api.github.com/repos/dongche/tachyon/comments{/number}","issue_comment_url":"https://api.github.com/repos/dongche/tachyon/issues/comments{/number}","contents_url":"https://api.github.com/repos/dongche/tachyon/contents/{+path}","compare_url":"https://api.github.com/repos/dongche/tachyon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dongche/tachyon/merges","archive_url":"https://api.github.com/repos/dongche/tachyon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dongche/tachyon/downloads","issues_url":"https://api.github.com/repos/dongche/tachyon/issues{/number}","pulls_url":"https://api.github.com/repos/dongche/tachyon/pulls{/number}","milestones_url":"https://api.github.com/repos/dongche/tachyon/milestones{/number}","notifications_url":"https://api.github.com/repos/dongche/tachyon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dongche/tachyon/labels{/name}","releases_url":"https://api.github.com/repos/dongche/tachyon/releases{/id}","created_at":"2015-07-02T07:53:56Z","updated_at":"2015-07-02T07:53:58Z","pushed_at":"2015-08-05T02:52:19Z","git_url":"git://github.com/dongche/tachyon.git","ssh_url":"git@github.com:dongche/tachyon.git","clone_url":"https://github.com/dongche/tachyon.git","svn_url":"https://github.com/dongche/tachyon","homepage":"http://tachyon-project.org","size":15904,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"amplab:security","ref":"security","sha":"1437ff196a89465b63228ce6b0a7c5fe70d73e4a","user":{"login":"amplab","id":1438454,"avatar_url":"https://avatars.githubusercontent.com/u/1438454?v=3","gravatar_id":"","url":"https://api.github.com/users/amplab","html_url":"https://github.com/amplab","followers_url":"https://api.github.com/users/amplab/followers","following_url":"https://api.github.com/users/amplab/following{/other_user}","gists_url":"https://api.github.com/users/amplab/gists{/gist_id}","starred_url":"https://api.github.com/users/amplab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amplab/subscriptions","organizations_url":"https://api.github.com/users/amplab/orgs","repos_url":"https://api.github.com/users/amplab/repos","events_url":"https://api.github.com/users/amplab/events{/privacy}","received_events_url":"https://api.github.com/users/amplab/received_events","type":"Organization","site_admin":false},"repo":{"id":7276954,"name":"tachyon","full_name":"amplab/tachyon","owner":{"login":"amplab","id":1438454,"avatar_url":"https://avatars.githubusercontent.com/u/1438454?v=3","gravatar_id":"","url":"https://api.github.com/users/amplab","html_url":"https://github.com/amplab","followers_url":"https://api.github.com/users/amplab/followers","following_url":"https://api.github.com/users/amplab/following{/other_user}","gists_url":"https://api.github.com/users/amplab/gists{/gist_id}","starred_url":"https://api.github.com/users/amplab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amplab/subscriptions","organizations_url":"https://api.github.com/users/amplab/orgs","repos_url":"https://api.github.com/users/amplab/repos","events_url":"https://api.github.com/users/amplab/events{/privacy}","received_events_url":"https://api.github.com/users/amplab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/amplab/tachyon","description":" A Reliable Memory Centric Distributed Storage System","fork":false,"url":"https://api.github.com/repos/amplab/tachyon","forks_url":"https://api.github.com/repos/amplab/tachyon/forks","keys_url":"https://api.github.com/repos/amplab/tachyon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/amplab/tachyon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/amplab/tachyon/teams","hooks_url":"https://api.github.com/repos/amplab/tachyon/hooks","issue_events_url":"https://api.github.com/repos/amplab/tachyon/issues/events{/number}","events_url":"https://api.github.com/repos/amplab/tachyon/events","assignees_url":"https://api.github.com/repos/amplab/tachyon/assignees{/user}","branches_url":"https://api.github.com/repos/amplab/tachyon/branches{/branch}","tags_url":"https://api.github.com/repos/amplab/tachyon/tags","blobs_url":"https://api.github.com/repos/amplab/tachyon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/amplab/tachyon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/amplab/tachyon/git/refs{/sha}","trees_url":"https://api.github.com/repos/amplab/tachyon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/amplab/tachyon/statuses/{sha}","languages_url":"https://api.github.com/repos/amplab/tachyon/languages","stargazers_url":"https://api.github.com/repos/amplab/tachyon/stargazers","contributors_url":"https://api.github.com/repos/amplab/tachyon/contributors","subscribers_url":"https://api.github.com/repos/amplab/tachyon/subscribers","subscription_url":"https://api.github.com/repos/amplab/tachyon/subscription","commits_url":"https://api.github.com/repos/amplab/tachyon/commits{/sha}","git_commits_url":"https://api.github.com/repos/amplab/tachyon/git/commits{/sha}","comments_url":"https://api.github.com/repos/amplab/tachyon/comments{/number}","issue_comment_url":"https://api.github.com/repos/amplab/tachyon/issues/comments{/number}","contents_url":"https://api.github.com/repos/amplab/tachyon/contents/{+path}","compare_url":"https://api.github.com/repos/amplab/tachyon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/amplab/tachyon/merges","archive_url":"https://api.github.com/repos/amplab/tachyon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/amplab/tachyon/downloads","issues_url":"https://api.github.com/repos/amplab/tachyon/issues{/number}","pulls_url":"https://api.github.com/repos/amplab/tachyon/pulls{/number}","milestones_url":"https://api.github.com/repos/amplab/tachyon/milestones{/number}","notifications_url":"https://api.github.com/repos/amplab/tachyon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/amplab/tachyon/labels{/name}","releases_url":"https://api.github.com/repos/amplab/tachyon/releases{/id}","created_at":"2012-12-21T17:43:46Z","updated_at":"2015-08-05T09:39:01Z","pushed_at":"2015-08-05T14:14:53Z","git_url":"git://github.com/amplab/tachyon.git","ssh_url":"git@github.com:amplab/tachyon.git","clone_url":"https://github.com/amplab/tachyon.git","svn_url":"https://github.com/amplab/tachyon","homepage":"http://tachyon-project.org","size":38362,"stargazers_count":1494,"watchers_count":1494,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":574,"mirror_url":null,"open_issues_count":22,"forks":574,"open_issues":22,"watchers":1494,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/amplab/tachyon/pulls/1229"},"html":{"href":"https://github.com/amplab/tachyon/pull/1229"},"issue":{"href":"https://api.github.com/repos/amplab/tachyon/issues/1229"},"comments":{"href":"https://api.github.com/repos/amplab/tachyon/issues/1229/comments"},"review_comments":{"href":"https://api.github.com/repos/amplab/tachyon/pulls/1229/comments"},"review_comment":{"href":"https://api.github.com/repos/amplab/tachyon/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/amplab/tachyon/pulls/1229/commits"},"statuses":{"href":"https://api.github.com/repos/amplab/tachyon/statuses/935b1daef9eb550efe167e4ea644a178ea588a15"}}}}