Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-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 A56C617C7B for ; Mon, 26 Jan 2015 17:37:26 +0000 (UTC) Received: (qmail 11075 invoked by uid 500); 26 Jan 2015 17:37:26 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 11034 invoked by uid 500); 26 Jan 2015 17:37:26 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 11025 invoked by uid 99); 26 Jan 2015 17:37:26 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Jan 2015 17:37:26 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8F312E03F2; Mon, 26 Jan 2015 17:37:26 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: elserj@apache.org To: commits@accumulo.apache.org Date: Mon, 26 Jan 2015 17:37:26 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/2] accumulo git commit: ACCUMULO-3534 Don't start the already started TServer Repository: accumulo Updated Branches: refs/heads/master 6f14edac3 -> aed37c21d ACCUMULO-3534 Don't start the already started TServer Also wait for the tserver to start before running the test. Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/226999ef Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/226999ef Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/226999ef Branch: refs/heads/master Commit: 226999ef88092e619a9d9b22b79f9511db6d9224 Parents: 6f14eda Author: Josh Elser Authored: Mon Jan 26 12:19:27 2015 -0500 Committer: Josh Elser Committed: Mon Jan 26 12:21:42 2015 -0500 ---------------------------------------------------------------------- .../proxy/TestProxyInstanceOperations.java | 27 ++++++++------------ 1 file changed, 11 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/226999ef/test/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java b/test/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java index f4d3b64..ce8745c 100644 --- a/test/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java +++ b/test/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java @@ -21,8 +21,8 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import java.nio.ByteBuffer; +import java.util.Collections; import java.util.Properties; -import java.util.TreeMap; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.thrift.TException; @@ -31,17 +31,19 @@ import org.apache.thrift.server.TServer; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.google.common.net.HostAndPort; public class TestProxyInstanceOperations { + private static final Logger log = LoggerFactory.getLogger(TestProxyInstanceOperations.class); + protected static TServer proxy; - protected static Thread thread; protected static TestProxyClient tpc; protected static ByteBuffer userpass; protected static final int port = 10197; - @SuppressWarnings("serial") @BeforeClass public static void setup() throws Exception { Properties prop = new Properties(); @@ -49,25 +51,18 @@ public class TestProxyInstanceOperations { prop.put("tokenClass", PasswordToken.class.getName()); proxy = Proxy.createProxyServer(HostAndPort.fromParts("localhost", port), new TCompactProtocol.Factory(), prop).server; - thread = new Thread() { - @Override - public void run() { - proxy.serve(); - } - }; - thread.start(); + log.info("Waiting for proxy to start"); + while (!proxy.isServing()) { + Thread.sleep(500); + } + log.info("Proxy started"); tpc = new TestProxyClient("localhost", port); - userpass = tpc.proxy.login("root", new TreeMap() { - { - put("password", ""); - } - }); + userpass = tpc.proxy.login("root", Collections.singletonMap("password", "")); } @AfterClass public static void tearDown() throws InterruptedException { proxy.stop(); - thread.join(); } @Test