diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java index 3b46d2714b7..85f22d4728a 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java @@ -205,6 +205,10 @@ public class TestThriftServer { assertEquals(handler.getTableNames().size(), 2); } + public static void checkTableList(Hbase.Iface handler) throws Exception { + assertTrue(handler.getTableNames().contains(tableAname)); + } + public static void dropTestTables(Hbase.Iface handler) throws Exception { handler.disableTable(tableBname); assertFalse(handler.isTableEnabled(tableBname)); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServerCmdLine.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServerCmdLine.java index f8fcb37a9d0..c7c781396cf 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServerCmdLine.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServerCmdLine.java @@ -87,8 +87,8 @@ public class TestThriftServerCmdLine { continue; } for (boolean specifyCompact : new boolean[] {false, true}) { - parameters.add(new Object[]{implType, new Boolean(specifyFramed), - new Boolean(specifyBindIP), new Boolean(specifyCompact)}); + parameters.add(new Object[]{implType, specifyFramed, + specifyBindIP, specifyCompact}); } } } @@ -167,7 +167,10 @@ public class TestThriftServerCmdLine { thriftServer = new ThriftServer(TEST_UTIL.getConfiguration()); startCmdLineThread(args.toArray(new String[0])); - Threads.sleepWithoutInterrupt(2000); + + while ( thriftServer.serverRunner == null || thriftServer.serverRunner.tserver == null ){ + Thread.sleep(1); + } Class expectedClass = implType != null ? implType.serverClass : TBoundedThreadPoolServer.class; @@ -189,6 +192,8 @@ public class TestThriftServerCmdLine { } } + private static volatile boolean tableCreated = false; + private void talkToThriftServer() throws Exception { TSocket sock = new TSocket(InetAddress.getLocalHost().getHostName(), port); @@ -206,10 +211,12 @@ public class TestThriftServerCmdLine { prot = new TBinaryProtocol(transport); } Hbase.Client client = new Hbase.Client(prot); - TestThriftServer.doTestTableCreateDrop(client); - TestThriftServer.doTestGetRegionInfo(client); - TestThriftServer.doTestGetTableRegions(client); - TestThriftServer.doTestTableMutations(client); + if (!tableCreated){ + TestThriftServer.createTestTables(client); + tableCreated = true; + } + TestThriftServer.checkTableList(client); + } finally { sock.close(); }