HBASE-6655 thrift.TestThriftServerCmdLine takes too much time: 733.972 sec

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1378559 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
nkeywal 2012-08-29 13:55:19 +00:00
parent c09b2f5f5d
commit 9bd419f52d
2 changed files with 18 additions and 7 deletions

View File

@ -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));

View File

@ -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<? extends TServer> 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();
}