Exemplo n.º 1
0
$socket = new TSocketPool($hosts, $port);
$socket->setDebug(TRUE);
if ($MODE == 'inline') {
    $transport = $socket;
    $testClient = new \ThriftTest\ThriftTestClient($transport);
} else {
    if ($MODE == 'framed') {
        $framedSocket = new TFramedTransport($socket);
        $transport = $framedSocket;
        $protocol = new TBinaryProtocol($transport);
        $testClient = new \ThriftTest\ThriftTestClient($protocol);
    } else {
        $bufferedSocket = new TBufferedTransport($socket, 1024, 1024);
        $transport = $bufferedSocket;
        $protocol = new TBinaryProtocol($transport);
        $testClient = new \ThriftTest\ThriftTestClient($protocol);
    }
}
$transport->open();
$start = microtime(true);
/**
 * VOID TEST
 */
print_r("testVoid()");
$testClient->testVoid();
print_r(" = void\n");
/**
 * STRING TEST
 */
print_r("testString(\"Test\")");
$s = $testClient->testString("Test");
Exemplo n.º 2
0
$socket = new TSocketPool($hosts, $port);
$socket->setDebug(TRUE);
if ($MODE == 'inline') {
    $transport = $socket;
    $testClient = new \ThriftTest\ThriftTestClient($transport);
} else {
    if ($MODE == 'framed') {
        $framedSocket = new TFramedTransport($socket);
        $transport = $framedSocket;
        $protocol = makeProtocol($transport, $PROTO);
        $testClient = new \ThriftTest\ThriftTestClient($protocol);
    } else {
        $bufferedSocket = new TBufferedTransport($socket, 1024, 1024);
        $transport = $bufferedSocket;
        $protocol = makeProtocol($transport, $PROTO);
        $testClient = new \ThriftTest\ThriftTestClient($protocol);
    }
}
$transport->open();
$start = microtime(true);
define(ERR_BASETYPES, 1);
// ERR_STRUCTS = 2;
// ERR_CONTAINERS = 4;
// ERR_EXCEPTIONS = 8;
// ERR_UNKNOWN = 64;
$exitcode = 0;
/**
 * VOID TEST
 */
print_r("testVoid()");
$testClient->testVoid();