accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [1/2] accumulo git commit: ACCUMULO-3534 Don't start the already started TServer
Date Mon, 26 Jan 2015 17:37:26 GMT
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 <elserj@apache.org>
Authored: Mon Jan 26 12:19:27 2015 -0500
Committer: Josh Elser <elserj@apache.org>
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<String,String>() {
-      {
-        put("password", "");
-      }
-    });
+    userpass = tpc.proxy.login("root", Collections.singletonMap("password", ""));
   }
 
   @AfterClass
   public static void tearDown() throws InterruptedException {
     proxy.stop();
-    thread.join();
   }
 
   @Test


Mime
View raw message