hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject svn commit: r1442038 - /hive/trunk/metastore/src/test/org/apache/hadoop/hive/metastore/TestMetaStoreAuthorization.java
Date Mon, 04 Feb 2013 07:23:57 GMT
Author: hashutosh
Date: Mon Feb  4 07:23:57 2013
New Revision: 1442038

URL: http://svn.apache.org/viewvc?rev=1442038&view=rev
Log:
HIVE-3956 : TestMetaStoreAuthorization always uses the same port (Navis via Ashutosh Chauhan)

Modified:
    hive/trunk/metastore/src/test/org/apache/hadoop/hive/metastore/TestMetaStoreAuthorization.java

Modified: hive/trunk/metastore/src/test/org/apache/hadoop/hive/metastore/TestMetaStoreAuthorization.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/test/org/apache/hadoop/hive/metastore/TestMetaStoreAuthorization.java?rev=1442038&r1=1442037&r2=1442038&view=diff
==============================================================================
--- hive/trunk/metastore/src/test/org/apache/hadoop/hive/metastore/TestMetaStoreAuthorization.java
(original)
+++ hive/trunk/metastore/src/test/org/apache/hadoop/hive/metastore/TestMetaStoreAuthorization.java
Mon Feb  4 07:23:57 2013
@@ -18,6 +18,9 @@
 
 package org.apache.hadoop.hive.metastore;
 
+import java.io.IOException;
+import java.net.ServerSocket;
+
 import junit.framework.TestCase;
 
 import org.apache.hadoop.fs.FileSystem;
@@ -34,9 +37,10 @@ import org.apache.hadoop.hive.shims.Shim
 public class TestMetaStoreAuthorization extends TestCase {
   protected HiveConf conf = new HiveConf();
 
-  private final int port = 10000;
+  private int port;
 
   public void setup() throws Exception {
+    port = findFreePort();
     System.setProperty(HiveConf.ConfVars.METASTORE_AUTHORIZATION_STORAGE_AUTH_CHECKS.varname,
         "true");
     conf.setVar(HiveConf.ConfVars.METASTOREURIS, "thrift://localhost:" + port);
@@ -111,4 +115,11 @@ public class TestMetaStoreAuthorization 
       }
     }
   }
+
+  private int findFreePort() throws IOException {
+    ServerSocket socket= new ServerSocket(0);
+    int port = socket.getLocalPort();
+    socket.close();
+    return port;
+  }
 }



Mime
View raw message