Bring Thrift test code up to date
authorMark Slee <mcslee@apache.org>
Thu, 26 Oct 2006 04:56:18 +0000 (04:56 +0000)
committerMark Slee <mcslee@apache.org>
Thu, 26 Oct 2006 04:56:18 +0000 (04:56 +0000)
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664852 13f79535-47bb-0310-9956-ffa450edef68

test/java/src/TestClient.java
test/java/src/TestServer.java
test/php/TestClient.php
test/py/TestClient.py
test/py/TestServer.py

index 546265c..7e2e49e 100644 (file)
@@ -69,9 +69,9 @@ public class TestClient {
       }
 
       TBinaryProtocol binaryProtocol =
-        new TBinaryProtocol();
+        new TBinaryProtocol(transport, transport);
       ThriftTest.Client testClient =
-        new ThriftTest.Client(transport, binaryProtocol);
+        new ThriftTest.Client(binaryProtocol);
 
       long timeMin = 0;
       long timeMax = 0;
index fe70594..bf3f685 100644 (file)
@@ -237,12 +237,10 @@ public class TestServer {
       }
       
       // Processor
-      TBinaryProtocol binaryProtocol =
-        new TBinaryProtocol();
       TestHandler testHandler =
         new TestHandler();
       ThriftTest.Processor testProcessor =
-        new ThriftTest.Processor(testHandler, binaryProtocol);
+        new ThriftTest.Processor(testHandler);
 
       // Transport
       TServerSocket tServerSocket =
@@ -254,7 +252,7 @@ public class TestServer {
       // serverEngine = new TSimpleServer(testProcessor, tServerSocket);
 
       // ThreadPool Server
-      serverEngine =  new TThreadPoolServer(testProcessor, tServerSocket);
+      serverEngine = new TThreadPoolServer(testProcessor, tServerSocket);
 
       // Run it
       System.out.println("Starting the server on port " + port + "...");
index 235abbe..0f1540c 100644 (file)
@@ -36,7 +36,7 @@ if ($argc > 2) {
   $host = $argv[1];
 }
 
-$hosts = array('localhost', '8.2.3.5');
+$hosts = array('localhost');
 
 $socket = new TSocket($host, $port);
 $socket = new TSocketPool($hosts, $port);
@@ -48,8 +48,8 @@ if ($MODE == 'inline') {
 } else {
   $bufferedSocket = new TBufferedTransport($socket, 1024, 1024);
   $transport = $bufferedSocket;
-  $protocol = new TBinaryProtocol();
-  $testClient = new ThriftTestClient($transport, $protocol);
+  $protocol = new TBinaryProtocol($transport);
+  $testClient = new ThriftTestClient($protocol);
 }
 
 $transport->open();
index a2fa3c7..3e48733 100755 (executable)
@@ -48,8 +48,8 @@ if framed:
 else:
   transport = TTransport.TBufferedTransport(socket)
 
-protocol = TBinaryProtocol.TBinaryProtocol()
-client = ThriftTest.Client(transport, protocol)
+protocol = TBinaryProtocol.TBinaryProtocol(transport)
+client = ThriftTest.Client(protocol)
 
 # Connect!
 transport.open()
index 96312c5..e3f76f8 100755 (executable)
@@ -51,10 +51,10 @@ class TestHandler:
       x.message = str
       raise x
 
-transport = TSocket.TServerSocket(9090)
-protocol = TBinaryProtocol.TBinaryProtocol()
 handler = TestHandler()
-processor = ThriftTest.Processor(handler, protocol)
-factory = TTransport.TBufferedTransportFactory()
-server = TServer.TSimpleServer(processor, transport, factory)
+processor = ThriftTest.Processor(handler)
+transport = TSocket.TServerSocket(9090)
+tfactory = TTransport.TBufferedTransportFactory()
+pfactory = TBinaryProtocol.TBinaryProtocolFactory()
+server = TServer.TThreadedServer(processor, transport, tfactory, pfactory)
 server.serve()