Return-Path: X-Original-To: apmail-hive-commits-archive@www.apache.org Delivered-To: apmail-hive-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2BE61E7AB for ; Mon, 4 Feb 2013 07:24:22 +0000 (UTC) Received: (qmail 12265 invoked by uid 500); 4 Feb 2013 07:24:21 -0000 Delivered-To: apmail-hive-commits-archive@hive.apache.org Received: (qmail 12119 invoked by uid 500); 4 Feb 2013 07:24:20 -0000 Mailing-List: contact commits-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hive-dev@hive.apache.org Delivered-To: mailing list commits@hive.apache.org Received: (qmail 12077 invoked by uid 99); 4 Feb 2013 07:24:19 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Feb 2013 07:24:19 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Feb 2013 07:24:17 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 8074F2388900; Mon, 4 Feb 2013 07:23:57 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1442038 - /hive/trunk/metastore/src/test/org/apache/hadoop/hive/metastore/TestMetaStoreAuthorization.java Date: Mon, 04 Feb 2013 07:23:57 -0000 To: commits@hive.apache.org From: hashutosh@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130204072357.8074F2388900@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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; + } }